:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.5;
  --bg: #050b16;
  --bg-soft: #091225;
  --surface: rgba(8, 15, 29, 0.82);
  --surface-strong: rgba(10, 18, 36, 0.94);
  --surface-muted: rgba(16, 28, 52, 0.76);
  --border: rgba(148, 163, 184, 0.18);
  --text: #f5f8ff;
  --muted: #95a7ca;
  --muted-strong: #c5d3ee;
  --primary: #6ea8ff;
  --primary-strong: #7c5cff;
  --positive: #4ade80;
  --zero: #fbbf24;
  --negative: #fb7185;
  --shadow: 0 28px 80px rgba(2, 6, 23, 0.46);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(110, 168, 255, 0.18), transparent 26%),
    radial-gradient(circle at 85% 10%, rgba(124, 92, 255, 0.18), transparent 24%),
    linear-gradient(180deg, #08101d 0%, #040914 45%, #02050b 100%);
}

button,
input,
summary {
  font: inherit;
}

button,
input,
summary {
  min-height: 52px;
}

button {
  cursor: pointer;
}

input {
  width: 100%;
  padding: 0.95rem 1rem;
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(6, 12, 24, 0.92);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

input::placeholder {
  color: #7082a7;
}

input:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(110, 168, 255, 0.35);
  outline-offset: 2px;
}

.app-backdrop {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.backdrop-orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(80px);
  opacity: 0.5;
}

.orb-one {
  top: -6rem;
  left: -4rem;
  width: 18rem;
  height: 18rem;
  background: rgba(110, 168, 255, 0.22);
}

.orb-two {
  top: 14rem;
  right: -5rem;
  width: 20rem;
  height: 20rem;
  background: rgba(124, 92, 255, 0.2);
}

.orb-three {
  bottom: -8rem;
  left: 35%;
  width: 16rem;
  height: 16rem;
  background: rgba(74, 222, 128, 0.14);
}

.backdrop-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 80%);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(76rem, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1rem 0 3rem;
}

.app-header {
  margin-bottom: 0.8rem;
}

.section-kicker {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #8eb4ff;
}

.settings-summary-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.38rem 0.8rem;
  border-radius: 999px;
  background: rgba(110, 168, 255, 0.12);
  border: 1px solid rgba(110, 168, 255, 0.22);
  color: #cfe0ff;
  font-size: 0.84rem;
  font-weight: 700;
}

h1,
.allowance-value,
.panel-header h2,
.panel-header h3,
.settings-title,
.spotlight-copy,
.summary-value {
  margin: 0;
}

h1 {
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  line-height: 1.02;
  letter-spacing: -0.05em;
}

.header-note,
.muted-text,
.panel-header p,
.settings-warning,
.summary-meta,
.benefit-list li,
.empty-state {
  margin: 0;
  color: var(--muted);
}

.header-note {
  max-width: 26rem;
  justify-self: start;
  font-size: 1rem;
  line-height: 1.65;
}

.panel,
.allowance-card,
.summary-card,
.spotlight-card,
.settings-panel,
.form-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.panel,
.spotlight-card,
.settings-panel,
.form-shell {
  border-radius: 1.6rem;
}

.panel,
.spotlight-card {
  padding: 1.2rem;
}

.loading-panel {
  display: grid;
  place-items: center;
  min-height: 16rem;
}

.loading-shell {
  display: inline-grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: center;
}

.loading-ring {
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  border: 3px solid rgba(110, 168, 255, 0.15);
  border-top-color: rgba(110, 168, 255, 0.9);
  animation: spin 1s linear infinite;
}

.setup-panel {
  padding: 1.35rem;
}

.setup-layout {
  display: grid;
  gap: 1.25rem;
}

.setup-copy {
  display: grid;
  gap: 0.9rem;
}

.setup-copy h2 {
  font-size: clamp(1.8rem, 5vw, 3rem);
  line-height: 1.02;
}

.benefit-list {
  list-style: none;
  display: grid;
  gap: 0.8rem;
  margin: 0.2rem 0 0;
  padding: 0;
}

.benefit-list li {
  padding: 0.95rem 1rem;
  border-radius: 1.1rem;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(7, 13, 24, 0.78);
}

.form-shell {
  padding: 1.2rem;
  background:
    linear-gradient(180deg, rgba(13, 25, 49, 0.94), rgba(8, 15, 29, 0.92)),
    rgba(8, 15, 29, 0.92);
}

.dashboard-grid,
.dashboard-main,
.dashboard-side,
.priority-grid,
.summary-grid,
.stack-form,
.expense-form,
.settings-body,
.field,
.panel-header {
  display: grid;
  gap: 1rem;
}

.priority-grid {
  align-items: stretch;
}

.allowance-card {
  position: relative;
  overflow: hidden;
  border-radius: 1.8rem;
  padding: 1.5rem;
  background:
    radial-gradient(circle at top right, rgba(110, 168, 255, 0.16), transparent 35%),
    linear-gradient(180deg, rgba(14, 24, 44, 0.98), rgba(7, 13, 25, 0.95));
}

.allowance-card::before {
  content: '';
  position: absolute;
  inset: auto -4rem -5rem auto;
  width: 12rem;
  height: 12rem;
  border-radius: 999px;
  background: rgba(110, 168, 255, 0.18);
  filter: blur(40px);
}

.allowance-card.status-positive {
  border-color: rgba(74, 222, 128, 0.34);
}

.allowance-card.status-zero {
  border-color: rgba(251, 191, 36, 0.34);
}

.allowance-card.status-negative {
  border-color: rgba(251, 113, 133, 0.34);
}

.allowance-top {
  display: grid;
  gap: 1rem;
  position: relative;
  z-index: 1;
}

.allowance-footer {
  position: relative;
  z-index: 1;
  margin-top: 1rem;
}

.label {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8ca2c9;
}

.allowance-value {
  margin-top: 0.4rem;
  font-size: clamp(3.2rem, 13vw, 6.4rem);
  line-height: 0.94;
  letter-spacing: -0.08em;
}

.month-context {
  display: flex;
  gap: 0.35rem 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.allowance-caption {
  margin: 0;
  color: #d9e2f6;
  font-size: 1rem;
}

.progress-track {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 0.8rem;
  margin-top: 1.2rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6ea8ff, #7c5cff);
  transition: width 220ms ease;
}

.status-positive .progress-fill {
  background: linear-gradient(90deg, #5eead4, #4ade80);
}

.status-zero .progress-fill {
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.status-negative .progress-fill {
  background: linear-gradient(90deg, #fb7185, #ef4444);
}

.summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.summary-card {
  display: grid;
  gap: 0.65rem;
  border-radius: 1.35rem;
  padding: 1.15rem;
  min-height: 6.8rem;
}

.summary-value {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  line-height: 1.05;
}

.summary-meta {
  margin-top: auto;
}

.spotlight-card {
  background: linear-gradient(180deg, rgba(15, 27, 52, 0.96), rgba(9, 16, 31, 0.94));
  padding: 1.3rem;
}

.spotlight-copy {
  font-size: 1.05rem;
  line-height: 1.4;
}

.compact-header {
  margin-bottom: 0.2rem;
}

.action-panel {
  align-content: start;
}

.field {
  gap: 0.5rem;
}

.field span {
  font-weight: 700;
  color: #e6eeff;
}

.field-error {
  min-height: 1.15rem;
  color: #fda4af;
}

.expense-form {
  align-items: end;
}

.expense-field input {
  font-size: 1.3rem;
  font-weight: 700;
  text-align: right;
}

.numpad-grid,
.numpad-actions {
  display: grid;
  gap: 0.75rem;
}

.numpad-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.numpad-button {
  min-height: 3.4rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 1rem;
  background: rgba(10, 19, 37, 0.92);
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.numpad-button:hover,
.numpad-button:focus-visible {
  background: rgba(17, 30, 56, 0.98);
}

.numpad-actions {
  grid-template-columns: auto minmax(0, 1fr);
}

.numpad-clear {
  min-width: 6rem;
}

.primary-button,
.secondary-button {
  border: 0;
  border-radius: 999px;
  padding: 0.95rem 1.4rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.primary-button {
  min-width: 12rem;
  color: #f9fbff;
  background: linear-gradient(135deg, #4f8cff 0%, #5f7cff 50%, #7c5cff 100%);
  box-shadow: 0 18px 30px rgba(79, 140, 255, 0.3);
}

.primary-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.secondary-button {
  background: rgba(110, 168, 255, 0.14);
  color: #dbe8ff;
  border: 1px solid rgba(110, 168, 255, 0.22);
}

.banner {
  margin-bottom: 1rem;
  padding: 0.95rem 1rem;
  border-radius: 1.15rem;
  border: 1px solid rgba(251, 113, 133, 0.25);
  background: rgba(69, 10, 10, 0.72);
  color: #ffe4e6;
  box-shadow: 0 18px 32px rgba(69, 10, 10, 0.18);
}

.expense-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.expense-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem;
  border-radius: 1.15rem;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(8, 14, 27, 0.84);
}

.expense-meta {
  min-width: 0;
}

.expense-amount {
  display: block;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
}

.expense-time {
  display: block;
  margin-top: 0.3rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.delete-button {
  border: 1px solid rgba(251, 113, 133, 0.24);
  border-radius: 999px;
  padding: 0.8rem 1rem;
  background: rgba(251, 113, 133, 0.12);
  color: #ffd5dd;
  font-weight: 700;
}

.empty-state {
  padding: 1rem;
  border-radius: 1.1rem;
  border: 1px dashed rgba(148, 163, 184, 0.18);
  background: rgba(8, 14, 27, 0.52);
}

.settings-panel {
  overflow: hidden;
  background: linear-gradient(180deg, rgba(11, 19, 37, 0.94), rgba(7, 13, 25, 0.92));
}

.settings-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  padding: 1rem 1.15rem;
  cursor: pointer;
  list-style: none;
}

.settings-panel summary > div {
  display: grid;
  gap: 0.2rem;
}

.settings-panel summary::-webkit-details-marker {
  display: none;
}

.settings-panel summary:hover {
  background: rgba(110, 168, 255, 0.04);
}

.settings-panel[open] summary {
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.settings-title {
  font-size: 1.15rem;
}

.settings-summary-copy {
  margin: 0.25rem 0 0;
  color: var(--muted);
}

.settings-body {
  padding: 1rem 1.15rem 1.15rem;
}

.settings-warning {
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  border: 1px solid rgba(251, 191, 36, 0.18);
  background: rgba(251, 191, 36, 0.08);
  color: #f5df9e;
}

.hidden {
  display: none !important;
}

@media (min-width: 720px) {
  .app-shell {
    width: min(76rem, calc(100% - 3rem));
    padding-top: 1.25rem;
  }

  .priority-grid {
    grid-template-columns: minmax(0, 1.45fr) minmax(17rem, 0.9fr);
  }

  .expense-field {
    min-width: 0;
  }
}

@media (min-width: 960px) {
  .priority-grid {
    grid-template-columns: 1fr;
  }

  .setup-layout,
  .dashboard-grid {
    grid-template-columns: minmax(0, 1.55fr) minmax(20rem, 0.95fr);
    align-items: start;
  }

  .dashboard-side {
    display: grid;
    gap: 1rem;
    position: sticky;
    top: 1.5rem;
  }
}

@media (max-width: 719px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .numpad-actions {
    grid-template-columns: 1fr;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
