@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("fonts/plus-jakarta-sans.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("fonts/inter.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --p: #14B8A6;
  --pd: #0F9184;
  --soft: #CCFBF1;
  --bg: #F4FBFA;
  --line: #E0EFEC;
  --tx: #0F2422;
  --mut: #5F7C78;
  --amber: #B45309;
  --amberbg: #FEF3C7;
  --amberline: #FDE68A;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--tx);
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.num { font-family: "Inter", system-ui, sans-serif; font-variant-numeric: tabular-nums; }

#app {
  max-width: 560px;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

#views { flex: 1; overflow-y: auto; overscroll-behavior: contain; }

.view { padding: 16px 16px 28px; }

#tabs {
  display: flex;
  justify-content: space-around;
  gap: 4px;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 8px 6px calc(10px + env(safe-area-inset-bottom));
}

#tabs button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--mut);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 4px;
  cursor: pointer;
}

#tabs button svg { width: 18px; height: 18px; }

#tabs button.active { color: var(--pd); background: var(--soft); }

.loading { color: var(--mut); font-size: 14px; }

#login {
  min-height: 100dvh;
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
}

#toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  max-width: min(90vw, 420px);
  background: var(--tx);
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(15, 36, 34, .25);
  z-index: 50;
}

.screen-head {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  margin: -16px -16px 14px;
  padding: 12px 16px;
}

.screen-title { font-size: 17px; font-weight: 800; letter-spacing: -.01em; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--pd);
  background: var(--soft);
  border-radius: 999px;
  padding: 4px 10px;
}

.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--p); }

.pill-amber { color: var(--amber); background: var(--amberbg); border: 1px solid var(--amberline); }

.hero {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  padding: 16px 16px 12px;
  background: linear-gradient(135deg, #0A2723 0%, #0D3F38 52%, #0F9184 130%);
  box-shadow: 0 12px 28px rgba(11, 59, 54, .34);
}

.hero-glow {
  position: absolute;
  top: -60px;
  right: -40px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(94, 234, 212, .45) 0%, rgba(94, 234, 212, 0) 70%);
  filter: blur(6px);
  pointer-events: none;
}

.hero-ring {
  position: absolute;
  top: -30px;
  right: -10px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 1px solid rgba(94, 234, 212, .22);
  pointer-events: none;
}

.hero-body { position: relative; }

.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.hero-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: rgba(204, 251, 241, .75); }

.hero-tag {
  font-size: 10.5px;
  font-weight: 700;
  color: #5EEAD4;
  background: rgba(94, 234, 212, .14);
  border: 1px solid rgba(94, 234, 212, .3);
  border-radius: 999px;
  padding: 3px 9px;
}

.hero-total { margin-top: 8px; font-size: 32px; font-weight: 800; color: #fff; letter-spacing: -.02em; }

.hero-sub { margin-top: 4px; font-size: 12px; color: rgba(255, 255, 255, .62); }

.hero-spark { display: block; width: 100%; height: 36px; margin-top: 8px; }

.acct-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }

.acct-card {
  display: flex;
  align-items: center;
  gap: 9px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
}

.acct-badge {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
}

.g1 { background: linear-gradient(135deg, #0F9184, #0B3B36); color: #CCFBF1; }
.g2 { background: linear-gradient(135deg, #14B8A6, #0F9184); color: #ECFDF5; }
.g3 { background: linear-gradient(135deg, #2DD4BF, #14B8A6); color: #0B3B36; }
.g4 { background: linear-gradient(135deg, #7DDBD0, #2DD4BF); color: #0B3B36; }

.acct-meta { display: flex; flex-direction: column; min-width: 0; }

.acct-label { font-size: 11px; color: var(--mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.acct-balance { font-size: 14px; font-weight: 800; }

.acct-more { justify-content: center; border-style: dashed; color: var(--mut); font-size: 12px; font-weight: 600; }

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--mut);
  margin: 16px 2px 8px;
}

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}

.legend { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }

.legend-item { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--mut); }

.swatch { width: 10px; height: 10px; border-radius: 3px; }

.swatch-in { background: linear-gradient(180deg, #5EEAD4, #14B8A6); }

.swatch-out { background: linear-gradient(180deg, #0F9184, #0B3B36); }

.bars-wrap { position: relative; height: 48px; }

.guide { position: absolute; left: 0; right: 0; border-top: 1px dashed rgba(15, 36, 34, .07); }

.bars { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: space-between; padding: 0 2px; }

.bar-col { flex: 1; display: flex; gap: 2px; align-items: flex-end; justify-content: center; }

.bar { width: 7px; border-radius: 3px 3px 1px 1px; }

.bar.in { background: linear-gradient(180deg, #5EEAD4, #14B8A6); }

.bar.out { background: linear-gradient(180deg, #0F9184, #0B3B36); }

.bar-months { display: flex; justify-content: space-between; margin-top: 6px; font-size: 10px; color: var(--mut); }

.insight-card {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: linear-gradient(#fff, #fff) padding-box,
              linear-gradient(135deg, #14B8A6, #0B3B36) border-box;
  border: 1.4px solid transparent;
}

.insight-icon {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  border-radius: 9px;
  background: linear-gradient(135deg, #14B8A6, #0B3B36);
  color: #CCFBF1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.insight-text { margin: 0; font-size: 12.5px; }

.insight-text b { color: var(--pd); }

.banner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, #FEF3C7, #FDE68A);
  border: 1px solid rgba(245, 158, 11, .4);
  color: #78350F;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(180, 83, 9, .12);
}

.banner-static { cursor: default; justify-content: flex-start; }

.banner-left { display: flex; align-items: center; gap: 10px; }

.banner-count {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--amber);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
}

.banner-chevron { font-size: 18px; line-height: 1; color: #92400E; }

.empty-card {
  border: 1px dashed var(--line);
  border-radius: 16px;
  padding: 18px 14px;
  text-align: center;
  color: var(--mut);
  font-size: 13px;
  margin-top: 12px;
}

#login h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; }

.login-sub { margin: 6px 0 22px; color: var(--mut); font-size: 13.5px; }

#login-form { display: flex; flex-direction: column; gap: 10px; }

#login-form label { font-size: 12px; font-weight: 700; color: var(--mut); }

#login-password {
  font: inherit;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--tx);
}

#login-password:focus-visible { outline: 2px solid var(--pd); outline-offset: 1px; }

.btn-primary {
  font: inherit;
  font-weight: 700;
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: 13px 16px;
  background: linear-gradient(135deg, #14B8A6, #0F9184);
  box-shadow: 0 6px 16px rgba(15, 145, 132, .28);
  cursor: pointer;
}

.btn-primary:active { transform: translateY(1px); }

.login-error { margin: 12px 0 0; color: var(--amber); font-size: 13px; font-weight: 600; }

.tx-controls { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }

.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.month-nav button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--tx);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

#tx-month { font-size: 14px; font-weight: 800; }

#tx-search {
  font: inherit;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--tx);
}

#tx-search:focus-visible { outline: 2px solid var(--pd); outline-offset: 1px; }

.day-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 14px 2px 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--mut);
}

.tx-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 12px;
  margin-bottom: 6px;
}

.tx-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }

.tx-merchant { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tx-tags { display: flex; gap: 5px; flex-wrap: wrap; }

.tx-cat { font-size: 10.5px; font-weight: 700; color: var(--pd); background: var(--soft); border-radius: 999px; padding: 2px 8px; }

.tx-needs { color: var(--amber); background: var(--amberbg); }

.tx-flag {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--amber);
  border: 1px solid var(--amberline);
  border-radius: 999px;
  padding: 2px 8px;
}

.tx-amount { font-size: 13.5px; font-weight: 800; white-space: nowrap; }

.tx-amount.in { color: var(--pd); }

.tx-amount.out { color: var(--tx); }

.btn-ghost {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--pd);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.rv-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 14px;
  margin-bottom: 10px;
}

.rv-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.rv-merchant { font-size: 13.5px; font-weight: 800; }

.rv-snippet { margin: 6px 0 0; font-size: 11.5px; color: var(--mut); }

.rv-meta { display: flex; gap: 6px; align-items: center; margin-top: 6px; font-size: 11px; color: var(--mut); flex-wrap: wrap; }

.rv-chips { display: flex; gap: 6px; overflow-x: auto; margin-top: 10px; padding-bottom: 4px; }

.rv-chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--tx);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  padding: 7px 12px;
  cursor: pointer;
}

.rv-chip:active { background: var(--soft); }

.rv-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }

.rv-remember { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--mut); }

.rv-remember input { width: 15px; height: 15px; accent-color: var(--pd); }

.rv-skip {
  border: 0;
  background: transparent;
  color: var(--mut);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 4px;
}

.rv-back {
  border: 0;
  background: transparent;
  color: var(--pd);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.month-wrap { margin-bottom: 12px; }

#bg-month { font-size: 14px; font-weight: 800; }

.hero-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .14);
  margin-top: 14px;
  overflow: hidden;
}

.hero-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #5EEAD4, #14B8A6);
}

.hero-bar-fill.warn { background: linear-gradient(90deg, #FBBF24, #D97706); }

.hero-sub b { color: #5EEAD4; }

.env-list { display: flex; flex-direction: column; gap: 12px; }

.env-row { display: flex; flex-direction: column; gap: 6px; }

.env-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.env-name { font-size: 13px; font-weight: 700; }

.env-status { font-size: 11.5px; font-weight: 800; }

.env-status.ok { color: var(--pd); }

.env-status.warn { color: var(--amber); }

.env-bar { height: 4px; border-radius: 999px; background: var(--soft); overflow: hidden; }

.env-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #2DD4BF, #14B8A6); }

.env-fill.warn { background: linear-gradient(90deg, #FBBF24, #D97706); }

.env-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.env-meta { font-size: 11px; color: var(--mut); }

.env-empty { margin: 0; font-size: 12.5px; color: var(--mut); }

.btn-mini {
  border: 0;
  background: var(--soft);
  color: var(--pd);
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 999px;
  padding: 5px 11px;
  cursor: pointer;
}

.btn-mini-ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--mut);
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 999px;
  padding: 5px 11px;
  cursor: pointer;
}

.env-editor, .cat-editor { display: flex; align-items: center; gap: 8px; }

.add-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.env-input, .cat-input, .add-form input, .add-form select, .search-input, .cat-editor input {
  font: inherit;
  font-size: 13px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--tx);
  min-width: 0;
}

.search-input {
  box-sizing: border-box;
  width: 100%;
  margin-bottom: 10px;
}

.gmail-card { margin-bottom: 10px; }

.gmail-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.gmail-title { font-size: 13px; font-weight: 800; }

.gmail-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pd);
  box-shadow: 0 0 8px rgba(20, 184, 166, .8);
}

.gmail-dot.warn { background: var(--amber); box-shadow: 0 0 8px rgba(180, 83, 9, .5); }

.gmail-line { margin-top: 3px; font-size: 11.5px; color: var(--mut); }

.src-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }

.src-chip {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--pd);
  background: var(--soft);
  border-radius: 999px;
  padding: 3px 9px;
}

.src-more {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--mut);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
}

.gmail-card .btn-primary { width: 100%; margin-top: 10px; }

.rule-row { padding: 10px 2px; border-bottom: 1px solid var(--line); }

.rule-row:last-child { border-bottom: 0; }

.rule-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.rule-pattern { font-size: 12.5px; font-weight: 800; overflow-wrap: anywhere; }

.rule-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 5px;
  font-size: 11px;
  color: var(--mut);
}

.switch { position: relative; display: inline-flex; flex: 0 0 auto; }

.switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.switch-track {
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: var(--line);
  position: relative;
  transition: background .15s ease;
  pointer-events: none;
}

.switch-track::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform .15s ease;
}

.switch input:checked + .switch-track { background: linear-gradient(135deg, #2DD4BF, #14B8A6); }

.switch input:checked + .switch-track::after { transform: translateX(14px); }

.switch input:focus-visible + .switch-track { outline: 2px solid var(--pd); outline-offset: 2px; }

.row-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--tx);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

#cat-manager { margin-top: 8px; }

.cat-row { padding: 10px 2px; border-bottom: 1px solid var(--line); }

.cat-row:last-child { border-bottom: 0; }

.cat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.cat-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.cat-name { font-size: 13px; font-weight: 700; }

.cat-kind { font-size: 11px; color: var(--mut); }

.cat-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }

.offline-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 8px 14px;
  background: var(--amber);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  text-align: center;
}
