:root {
  color-scheme: light;
  --bg: #eef2f5;
  --surface: #ffffff;
  --surface-soft: #f7f9fb;
  --ink: #111827;
  --ink-soft: #334155;
  --muted: #6b7280;
  --line: #dbe2ea;
  --dark: #111827;
  --dark-2: #1f2937;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --cyan: #0891b2;
  --cyan-soft: #cffafe;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --coral: #e11d48;
  --coral-soft: #ffe4e6;
  --violet: #7c3aed;
  --violet-soft: #ede9fe;
  --shadow: 0 18px 60px rgba(15, 23, 42, 0.12);
  --shadow-soft: 0 10px 28px rgba(15, 23, 42, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, #f8fafc 0, #eef2f5 360px),
    var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hidden {
  display: none !important;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 42px;
}

.app-header,
.brand-lockup,
.header-actions,
.section-head,
.row-actions {
  display: flex;
  align-items: center;
}

.app-header {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.brand-lockup {
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--dark);
  box-shadow: var(--shadow-soft);
  font-weight: 900;
}

.app-header h1,
.section-head h2,
.auth-panel h1 {
  margin: 0;
  letter-spacing: 0;
}

.app-header h1 {
  font-size: 1.55rem;
  line-height: 1;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.eyebrow.inverse {
  color: rgba(255, 255, 255, 0.64);
}

.muted {
  color: var(--muted);
}

.header-actions {
  gap: 8px;
}

.hero-grid,
.quick-actions,
.salary-layout,
.work-grid {
  display: grid;
  gap: 14px;
}

.hero-grid {
  grid-template-columns: 1fr;
}

.runway-panel,
.panel,
.action-tile,
.auth-panel,
.drawer-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.period-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 800;
}

.period-chip {
  color: rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.1);
}

.runway-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 138px;
  align-content: space-between;
  gap: 18px;
  min-height: 304px;
  padding: 26px;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(135deg, rgba(17, 24, 39, 0.99) 0%, rgba(31, 41, 55, 0.98) 50%, rgba(8, 145, 178, 0.9) 100%);
  box-shadow: var(--shadow);
}

.runway-total {
  display: block;
  margin: 22px 0 18px;
  color: #fff;
  font-size: 5.4rem;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

.runway-ring {
  display: grid;
  width: 132px;
  height: 132px;
  place-items: center;
  align-self: start;
  justify-self: end;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(17, 24, 39, 0.94) 0 56%, transparent 57%),
    conic-gradient(#a7f3d0 var(--runway-progress), rgba(255, 255, 255, 0.18) 0);
}

.runway-ring strong,
.runway-ring span {
  grid-area: 1 / 1;
}

.runway-ring strong {
  margin-top: -10px;
  color: #fff;
  font-size: 2rem;
  letter-spacing: 0;
}

.runway-ring span {
  margin-top: 42px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.78rem;
  font-weight: 800;
}

.daily-strip {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.daily-strip span {
  color: rgba(255, 255, 255, 0.68);
  font-weight: 800;
}

.daily-strip strong {
  color: #fff;
  font-size: 2rem;
  letter-spacing: 0;
  white-space: nowrap;
}

.quick-actions {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 14px 0;
}

.period-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 14px 0;
  padding: 16px;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  background: var(--green-soft);
  box-shadow: var(--shadow-soft);
}

.period-banner strong,
.period-banner span {
  display: block;
}

.period-banner strong {
  color: var(--ink);
  font-size: 1.05rem;
}

.period-banner span {
  margin-top: 4px;
  color: var(--ink-soft);
  font-weight: 750;
}

.action-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 66px;
  padding: 0 16px;
  color: var(--ink);
  background: var(--surface);
  font-weight: 850;
}

.action-tile svg {
  width: 23px;
  height: 23px;
}

.action-tile.expense {
  color: var(--coral);
  border-color: #fecdd3;
  background: var(--coral-soft);
}

.action-tile.income {
  color: var(--green);
  border-color: #bbf7d0;
  background: var(--green-soft);
}

.action-tile.voice {
  color: var(--violet);
  border-color: #ddd6fe;
  background: var(--violet-soft);
}

.action-tile.notify {
  color: var(--cyan);
  border-color: #a5f3fc;
  background: var(--cyan-soft);
}

.salary-panel {
  margin-bottom: 14px;
}

.salary-layout {
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.74fr);
  align-items: stretch;
}

.salary-head {
  align-items: flex-start;
}

.account-mini {
  display: grid;
  justify-items: end;
  gap: 4px;
  min-width: 148px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.account-mini span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.account-mini strong {
  font-size: 1.05rem;
  white-space: nowrap;
}

.period-spent-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 4px 14px;
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
}

.period-spent-card span,
.period-spent-card small {
  color: var(--muted);
  font-weight: 850;
}

.period-spent-card span {
  font-size: 0.82rem;
}

.period-spent-card strong {
  grid-row: span 2;
  color: var(--ink);
  font-size: 1.7rem;
  letter-spacing: 0;
  white-space: nowrap;
}

.period-spent-card small {
  font-size: 0.78rem;
}

.salary-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.salary-results {
  display: grid;
  gap: 12px;
}

.salary-result {
  display: grid;
  align-content: center;
  min-height: 92px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.salary-result span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
}

.salary-result strong {
  margin-top: 10px;
  font-size: 1.5rem;
  letter-spacing: 0;
  white-space: nowrap;
}

.salary-result.tax {
  border-top: 4px solid #fb7185;
}

.salary-result.free {
  border-top: 4px solid var(--green);
}

.salary-result.shortfall {
  border-top-color: var(--coral);
}

.salary-result.shortfall strong {
  color: var(--coral);
}

.work-grid {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.82fr);
}

.panel {
  padding: 18px;
  background: rgba(255, 255, 255, 0.94);
}

.section-head {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.section-head.compact {
  margin-bottom: 12px;
}

.section-head h2 {
  font-size: 1.12rem;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-width: 176px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f1f5f9;
}

.segmented button {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-weight: 850;
}

.segmented button.active {
  color: #fff;
  background: var(--dark);
}

.transaction-form,
.drawer-panel {
  display: grid;
  gap: 12px;
}

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

.wide {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

select {
  appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%) calc(100% - 18px) 50% / 6px 6px no-repeat,
    linear-gradient(135deg, var(--muted) 50%, transparent 50%) calc(100% - 13px) 50% / 6px 6px no-repeat,
    #fff;
  padding-right: 40px;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.12);
}

.button,
.icon-button {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 42px;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 15px;
  font-weight: 850;
}

.button.primary {
  color: #fff;
  background: var(--dark);
}

.button.secondary {
  color: var(--dark);
  border-color: var(--line);
  background: var(--surface-soft);
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: var(--dark);
  background: var(--surface);
}

.icon-button.subtle {
  border-color: var(--line);
}

.icon-button.dark {
  color: #fff;
  background: var(--dark);
}

.icon-button.coral {
  color: #fff;
  background: var(--coral);
}

.button:active,
.icon-button:active,
.action-tile:active,
.segmented button:active,
.mobile-dock button:active {
  transform: translateY(1px);
}

.row-actions {
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.parsed-list,
.transaction-list {
  display: grid;
  gap: 10px;
}

.parsed-list {
  margin-top: 12px;
}

.parsed-item,
.transaction-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.transaction-avatar {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  color: var(--dark);
  background: var(--surface-soft);
  font-weight: 900;
}

.transaction-item.expense .transaction-avatar,
.parsed-item.expense .transaction-avatar {
  color: var(--coral);
  background: var(--coral-soft);
}

.transaction-item.income .transaction-avatar,
.parsed-item.income .transaction-avatar {
  color: var(--green);
  background: var(--green-soft);
}

.transaction-item.expense .transaction-amount,
.parsed-item.expense .transaction-amount {
  color: var(--coral);
}

.transaction-item.income .transaction-amount,
.parsed-item.income .transaction-amount {
  color: var(--green);
}

.transaction-title {
  min-width: 0;
}

.transaction-title strong,
.transaction-title span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transaction-title strong {
  font-size: 0.96rem;
}

.transaction-title span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
}

.transaction-amount {
  font-weight: 900;
  white-space: nowrap;
}

.mini-delete {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
}

.mini-delete svg {
  width: 16px;
  height: 16px;
}

.history-panel {
  margin-top: 14px;
}

.empty-state {
  display: grid;
  min-height: 112px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-soft);
  font-weight: 750;
  text-align: center;
}

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-panel {
  display: grid;
  width: min(360px, 100%);
  gap: 14px;
  padding: 22px;
  background: var(--surface);
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  justify-items: end;
}

.drawer[aria-hidden="true"] {
  pointer-events: none;
}

.drawer[aria-hidden="true"] .drawer-backdrop,
.drawer[aria-hidden="true"] .drawer-panel {
  opacity: 0;
}

.drawer[aria-hidden="true"] .drawer-panel {
  transform: translateX(28px);
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  transition: opacity 0.18s ease;
}

.drawer-panel {
  position: relative;
  width: min(430px, 100%);
  min-height: 100%;
  padding: 20px;
  overflow: auto;
  background: var(--surface);
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.toggle {
  grid-template-columns: auto 1fr;
  align-items: center;
  color: var(--ink);
}

.toggle input {
  width: 20px;
  height: 20px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 50;
  max-width: min(520px, calc(100% - 28px));
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--dark);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translate(-50%, 10px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.mobile-dock {
  display: none;
}

@media (max-width: 980px) {
  .hero-grid,
  .salary-layout,
  .work-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  body {
    background: #f7f9fb;
  }

  .app-shell {
    width: min(100% - 20px, 1180px);
    padding: 14px 0 96px;
  }

  .app-header {
    margin-bottom: 12px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .app-header h1 {
    font-size: 1.28rem;
  }

  .hero-grid,
  .quick-actions,
  .salary-layout,
  .work-grid {
    gap: 10px;
  }

  .runway-panel {
    min-height: 260px;
    grid-template-columns: minmax(0, 1fr) 92px;
    padding: 16px;
  }

  .runway-total {
    margin: 20px 0 16px;
    font-size: 3.25rem;
    white-space: normal;
  }

  .runway-ring {
    width: 88px;
    height: 88px;
  }

  .runway-ring strong {
    font-size: 1.3rem;
  }

  .runway-ring span {
    margin-top: 30px;
    font-size: 0.72rem;
  }

  .daily-strip {
    min-height: 52px;
  }

  .daily-strip strong {
    font-size: 1.45rem;
  }

  .quick-actions {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .period-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .action-tile {
    justify-content: center;
    min-height: 58px;
    padding: 0 8px;
  }

  .action-tile span {
    display: none;
  }

  .account-mini {
    justify-items: start;
    width: 100%;
  }

  .salary-form {
    grid-template-columns: 1fr;
  }

  .period-spent-card {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .period-spent-card strong {
    grid-row: auto;
    font-size: 1.45rem;
  }

  .salary-result {
    min-height: 82px;
  }

  .panel {
    padding: 16px;
  }

  .transaction-form {
    grid-template-columns: 1fr;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .entry-panel .section-head,
  .history-panel .section-head {
    align-items: stretch;
  }

  .segmented,
  .button,
  .row-actions .button {
    width: 100%;
  }

  .parsed-item,
  .transaction-item {
    grid-template-columns: 38px minmax(0, 1fr) auto;
  }

  .transaction-avatar {
    width: 38px;
    height: 38px;
  }

  .mini-delete {
    grid-column: 3;
  }

  .mobile-dock {
    display: none;
  }
}

@media (max-width: 380px) {
  .runway-panel {
    grid-template-columns: 1fr;
  }

  .runway-total {
    font-size: 2.72rem;
  }

  .runway-ring {
    justify-self: start;
  }

  .salary-result strong {
    font-size: 1.28rem;
  }
}
