/* ============================================================
   Aura Finance — stylesheet (extracted from the design mockup)
   ============================================================ */
/* ============================================================
   AURA FINANCE — Design Memory tokens
   ============================================================ */
:root{
  --bg:#000000;
  --surface:#191C21;
  --surface-2:#1F242B;
  --surface-3:#242A31;
  --border:#27272A;
  --border-soft:#1E2228;
  --gold:#E2C854;
  --gold-dim:#B8A23F;
  --green:#10B981;
  --green-dim:#0E7C5A;
  --red:#F5555D;
  --red-dim:#B83A40;
  --text:#FFFFFF;
  --text-2:#A1A1AA;
  --text-3:#6B6B72;
  --r-card:16px;
  --r-ctrl:8px;
  --r-pill:9999px;
  --pad-card:24px;
  --gap:16px;
  --base:8px;
  --sidebar:264px;
  --font-display:'Kanit','Noto Sans Thai',sans-serif;
  --font-head:'Kanit','Noto Sans Thai',sans-serif;
  --font-body:'Noto Sans Thai','Inter',system-ui,sans-serif;
  --font-mono:'JetBrains Mono',ui-monospace,monospace;
  --shadow:0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px -12px rgba(0,0,0,.6);
  --shadow-lift:0 1px 0 rgba(255,255,255,.05) inset, 0 24px 48px -20px rgba(0,0,0,.75);
}
*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
body{
  background:var(--bg);
  color:var(--text);
  font-family:var(--font-body);
  font-size:15px;
  line-height:1.6;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
  overflow-x:hidden;
}
::selection{background:rgba(226,200,84,.28);color:#fff}
:focus-visible{outline:2px solid var(--gold);outline-offset:2px;border-radius:4px}

/* Money & numerals lean on Inter + tabular figures */
.money,.num,.metric-value,.kpi-value,.stat-value{
  font-family:var(--font-display);
  font-variant-numeric:tabular-nums;
  font-feature-settings:"tnum" 1,"cv01" 1;
  letter-spacing:-.01em;
}
.pos{color:var(--green)}
.neg{color:var(--red)}
.gold{color:var(--gold)}
.muted{color:var(--text-2)}

/* Mono utility labels / eyebrows */
.eyebrow{
  font-family:var(--font-head);          /* Kanit — JetBrains Mono has no Thai glyphs (rendered as blocky fallback) */
  font-size:11.5px;
  font-weight:600;
  letter-spacing:.02em;                  /* tighter than the old mono-label .14em so Thai reads naturally */
  color:var(--text-3);
  display:flex;align-items:center;gap:8px;
}
.eyebrow .dot{width:5px;height:5px;border-radius:50%;background:var(--gold);box-shadow:0 0 10px 1px var(--gold)}

/* ============================================================
   Ambient "aura" — the signature atmospheric layer
   ============================================================ */
.aura{position:fixed;inset:0;z-index:0;pointer-events:none;overflow:hidden}
.aura::before,.aura::after{content:"";position:absolute;border-radius:50%;filter:blur(120px);opacity:.5}
.aura::before{
  width:620px;height:620px;top:-220px;left:-120px;
  background:radial-gradient(circle at center, rgba(226,200,84,.22), transparent 70%);
  animation:breathe 14s ease-in-out infinite;
}
.aura::after{
  width:560px;height:560px;bottom:-240px;right:-100px;
  background:radial-gradient(circle at center, rgba(16,185,129,.16), transparent 70%);
  animation:breathe 18s ease-in-out infinite reverse;
}
@keyframes breathe{0%,100%{transform:translate3d(0,0,0) scale(1);opacity:.42}50%{transform:translate3d(20px,24px,0) scale(1.08);opacity:.6}}

/* ============================================================
   App shell
   ============================================================ */
.app{position:relative;z-index:1;display:grid;grid-template-columns:var(--sidebar) 1fr;min-height:100vh}

/* Sidebar */
.sidebar{
  position:sticky;top:0;height:100vh;overflow-y:auto;-webkit-overflow-scrolling:touch;
  border-right:1px solid var(--border);
  background:linear-gradient(180deg,#0C0E11,#000);
  display:flex;flex-direction:column;
  padding:22px 16px;gap:6px;
}
.brand{display:flex;align-items:center;gap:11px;padding:6px 8px 20px}
.brand-mark{
  width:34px;height:34px;border-radius:10px;flex:none;
  background:conic-gradient(from 210deg,var(--gold),#F4E39A,var(--gold-dim),var(--gold));
  display:grid;place-items:center;color:#1a1600;font-weight:800;
  font-family:var(--font-display);font-size:17px;
  box-shadow:0 0 0 1px rgba(226,200,84,.35),0 8px 20px -8px rgba(226,200,84,.6);
}
.brand-name{font-family:var(--font-head);font-weight:600;font-size:16px;letter-spacing:-.01em;line-height:1.1}
.brand-sub{font-family:var(--font-mono);font-size:9.5px;letter-spacing:.18em;color:var(--text-3);text-transform:uppercase}

.nav-group{margin-top:14px}
.nav-group-label{font-family:var(--font-mono);font-size:9.5px;letter-spacing:.2em;color:var(--text-3);text-transform:uppercase;padding:0 10px 8px}
.nav-item{
  display:flex;align-items:center;gap:12px;
  padding:9px 10px;border-radius:var(--r-ctrl);
  color:var(--text-2);cursor:pointer;user-select:none;
  font-size:14px;font-weight:500;position:relative;
  transition:background .18s ease,color .18s ease;
}
.nav-item svg{width:19px;height:19px;flex:none;stroke-width:1.7}
.nav-item:hover{background:var(--surface);color:var(--text)}
.nav-item.active{background:var(--surface-2);color:var(--text)}
.nav-item.active::before{content:"";position:absolute;left:-16px;top:50%;transform:translateY(-50%);width:3px;height:20px;border-radius:0 3px 3px 0;background:var(--gold);box-shadow:0 0 12px 1px var(--gold)}
.nav-item.active svg{color:var(--gold)}
.nav-badge{margin-left:auto;font-family:var(--font-mono);font-size:10px;font-weight:600;color:var(--gold);background:rgba(226,200,84,.12);padding:1px 7px;border-radius:var(--r-pill)}

.sidebar-foot{margin-top:auto;padding-top:16px;border-top:1px solid var(--border-soft)}
.sidebar-credit,.login-credit{text-align:center;font-size:10.5px;color:var(--gold);font-weight:500;line-height:1.6;margin-top:8px}
.sidebar-credit b,.login-credit b{color:var(--gold);font-weight:500}
.sb-card{background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:12px 14px}
.sb-card .eyebrow{margin-bottom:6px}
.sb-card .money{font-size:18px;font-weight:600}
.version{font-family:var(--font-mono);font-size:10px;color:var(--text-3);text-align:center;padding-top:12px;letter-spacing:.1em}

/* Main */
.main{min-width:0;padding:0 32px 48px;display:flex;flex-direction:column}

/* Topbar */
.topbar{
  position:sticky;top:0;z-index:20;
  display:flex;align-items:center;gap:16px;
  padding:20px 0 16px;
  background:linear-gradient(180deg,rgba(0,0,0,.92),rgba(0,0,0,.72) 70%,transparent);
  backdrop-filter:blur(6px);
}
.page-head{display:flex;flex-direction:column;gap:3px}
.page-title{font-family:var(--font-head);font-size:24px;font-weight:600;letter-spacing:-.01em;line-height:1.15}
.page-sub{font-size:12.5px;color:var(--text-2)}
.topbar-spacer{flex:1}
.month-nav{display:flex;align-items:center;gap:2px;background:var(--surface);border:1px solid var(--border);border-radius:var(--r-pill);padding:3px}
.month-nav button{background:none;border:none;color:var(--text-2);width:30px;height:30px;border-radius:50%;cursor:pointer;display:grid;place-items:center;transition:background .15s,color .15s}
.month-nav button:hover{background:var(--surface-3);color:var(--text)}
.month-nav .label{font-family:var(--font-mono);font-size:12px;font-weight:600;letter-spacing:.06em;color:var(--text);padding:0 10px;min-width:96px;text-align:center;white-space:nowrap}
.icon-btn{width:38px;height:38px;border-radius:var(--r-ctrl);background:var(--surface);border:1px solid var(--border);color:var(--text-2);display:grid;place-items:center;cursor:pointer;transition:all .15s}
.icon-btn:hover{color:var(--text);border-color:#3a3a3f;background:var(--surface-2)}
.icon-btn svg{width:18px;height:18px}
.profile{display:flex;align-items:center;gap:10px;background:var(--surface);border:1px solid var(--border);border-radius:var(--r-pill);padding:4px 12px 4px 4px;cursor:pointer;transition:border-color .15s}
.profile:hover{border-color:#3a3a3f}
.avatar{width:30px;height:30px;border-radius:50%;background:linear-gradient(135deg,var(--gold),var(--green));display:grid;place-items:center;color:#0a0a0a;font-weight:700;font-family:var(--font-display);font-size:13px}
.profile .who{font-size:13px;font-weight:500;line-height:1.1}
.profile .plan{font-family:var(--font-mono);font-size:9px;letter-spacing:.12em;color:var(--gold);text-transform:uppercase}

/* Buttons */
.btn{font-family:var(--font-body);font-size:13.5px;font-weight:600;border-radius:var(--r-ctrl);padding:9px 16px;border:1px solid transparent;cursor:pointer;display:inline-flex;align-items:center;gap:8px;white-space:nowrap;transition:transform .12s ease,filter .15s ease,background .15s}
.btn svg{flex:none}
.btn:active{transform:translateY(1px)}
.btn svg{width:16px;height:16px}
.btn-gold{background:var(--gold);color:#1a1600;box-shadow:0 8px 20px -10px rgba(226,200,84,.7)}
.btn-gold:hover{filter:brightness(1.06)}
.btn-ghost{background:var(--surface);border-color:var(--border);color:var(--text)}
.btn-ghost:hover{background:var(--surface-2);border-color:#3a3a3f}
.btn-green{background:var(--green);color:#04140e}
.btn-green:hover{filter:brightness(1.08)}
.btn-sm{padding:6px 12px;font-size:12.5px}

/* Cards & grid */
.view{display:none}
.view.active{display:block}
.bento{display:grid;grid-template-columns:repeat(12,1fr);gap:var(--gap);align-items:stretch}
.card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--r-card);
  padding:var(--pad-card);
  box-shadow:var(--shadow);
  position:relative;
  transition:border-color .2s ease,transform .2s ease,box-shadow .2s ease;
}
.card:hover{border-color:#34343a;transform:translateY(-2px);box-shadow:var(--shadow-lift)}
.card-head{display:flex;align-items:center;justify-content:space-between;gap:12px 10px;flex-wrap:wrap;margin-bottom:18px}
.info-i{display:inline-flex;align-items:center;justify-content:center;vertical-align:-3px;width:18px;height:18px;margin-left:6px;color:var(--text-3);cursor:pointer;transition:color .15s}
.info-i svg{width:15px;height:15px}
.info-i:hover,.info-i:active{color:var(--gold)}
/* budget action buttons stretch to fill the card once they wrap to their own row */
@media(max-width:900px){
  .budget-actions{flex:1 0 100%;margin-top:2px}
  .budget-actions .btn{flex:1;justify-content:center}
}
.card-title{font-family:var(--font-head);font-size:14.5px;font-weight:600;color:var(--text)}
.card-link{font-family:var(--font-mono);font-size:11px;letter-spacing:.06em;color:var(--text-2);cursor:pointer;text-transform:uppercase}
.card-link:hover{color:var(--gold)}
.span-3{grid-column:span 3}.span-4{grid-column:span 4}.span-5{grid-column:span 5}
.span-6{grid-column:span 6}.span-7{grid-column:span 7}.span-8{grid-column:span 8}
.span-9{grid-column:span 9}.span-12{grid-column:span 12}

/* Hero balance card */
.hero{
  grid-column:span 6;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(226,200,84,.10), transparent 45%),
    radial-gradient(120% 140% at 100% 100%, rgba(16,185,129,.08), transparent 45%),
    var(--surface);
  overflow:hidden;
}
.hero .eyebrow{margin-bottom:14px}
.hero-value{font-family:var(--font-display);font-weight:600;font-size:56px;line-height:1.02;letter-spacing:-.03em;font-variant-numeric:tabular-nums}
.hero-value .cur{font-size:28px;font-weight:500;color:var(--text-2);margin-right:6px;vertical-align:6px}
.hero-value .dec{color:inherit;font-weight:500}
.hero-sub{display:flex;gap:28px;margin-top:22px;flex-wrap:wrap}
.hero-stat .k{font-size:11.5px;color:var(--text-2);margin-bottom:2px}
.hero-stat .v{font-family:var(--font-display);font-weight:600;font-size:17px;font-variant-numeric:tabular-nums}
.spark{margin-top:20px;height:56px}
.delta{display:inline-flex;align-items:center;gap:4px;font-family:var(--font-mono);font-size:11px;font-weight:600;padding:2px 8px;border-radius:var(--r-pill)}
.delta.up{color:var(--green);background:rgba(16,185,129,.12)}
.delta.down{color:var(--red);background:rgba(245,85,93,.12)}
.delta svg{width:12px;height:12px}

/* KPI */
.kpi{display:flex;flex-direction:column;justify-content:space-between}
.kpi .eyebrow{margin-bottom:16px}
.kpi-value{font-size:30px;font-weight:600;line-height:1}
.kpi-foot{display:flex;align-items:center;justify-content:space-between;margin-top:14px;font-size:12px;color:var(--text-2)}
.kpi-icon{position:absolute;top:22px;right:22px;width:36px;height:36px;border-radius:10px;display:grid;place-items:center}
.kpi-icon svg{width:18px;height:18px}
.kpi-icon.g{background:rgba(16,185,129,.12);color:var(--green)}
.kpi-icon.r{background:rgba(245,85,93,.12);color:var(--red)}
.kpi-icon.y{background:rgba(226,200,84,.12);color:var(--gold)}

/* Donut legend */
.donut-wrap{display:flex;flex-direction:column;gap:18px}
.donut-canvas{height:200px;position:relative}
/* center label as a CSS-centered overlay (engine-independent, always dead-centre on the ring).
   The big number is placed dead-centre; the small label floats just above it. */
.donut-center{position:absolute;inset:0;display:grid;place-items:center;pointer-events:none}
.donut-center .dc-label{grid-area:1/1;transform:translateY(-19px);font-family:var(--font-mono);font-size:10px;font-weight:600;color:var(--text-3)}
.donut-center .dc-total{grid-area:1/1;font-family:var(--font-display);font-size:20px;font-weight:600;color:#fff;line-height:1}
.legend{display:flex;flex-direction:column;gap:9px}
.legend-row{display:flex;align-items:center;gap:10px;font-size:13px}
.legend-row .sw{width:9px;height:9px;border-radius:3px;flex:none}
.legend-row .nm{color:var(--text-2)}
.legend-row .amt{margin-left:auto;font-family:var(--font-display);font-variant-numeric:tabular-nums;font-weight:600;font-size:13px}
.legend-row .pct{font-family:var(--font-mono);font-size:11px;color:var(--text-3);width:38px;text-align:right}

/* Budget bars */
.budget-list{display:flex;flex-direction:column;gap:16px}
.b-row .b-top{display:flex;align-items:center;justify-content:space-between;margin-bottom:7px;font-size:13px}
.b-row .b-name{display:flex;align-items:center;gap:8px}
.b-row .b-name .sw{width:8px;height:8px;border-radius:2px}
.b-row .b-amt{font-family:var(--font-display);font-variant-numeric:tabular-nums;color:var(--text-2);font-size:12.5px}
.b-row .b-amt b{color:var(--text);font-weight:600}
.bar{height:7px;border-radius:var(--r-pill);background:var(--surface-3);overflow:hidden}
.bar-fill{height:100%;border-radius:var(--r-pill);transition:width .8s cubic-bezier(.22,1,.36,1)}
.chip{font-family:var(--font-mono);font-size:10px;font-weight:600;padding:2px 8px;border-radius:var(--r-pill);letter-spacing:.04em;text-transform:uppercase}
.chip.ok{color:var(--green);background:rgba(16,185,129,.12)}
.chip.warn{color:var(--gold);background:rgba(226,200,84,.14)}
.chip.over{color:var(--red);background:rgba(245,85,93,.14)}
.chip.off{color:var(--text-3);background:var(--surface-3)}

/* Transaction list */
.txn-list{display:flex;flex-direction:column}
.txn{display:flex;align-items:center;gap:14px;padding:12px 0;border-bottom:1px solid var(--border-soft)}
.txn:last-child{border-bottom:none}
.txn-ic{width:38px;height:38px;border-radius:11px;flex:none;display:grid;place-items:center;background:var(--surface-3);font-size:17px}
.txn-main{min-width:0;flex:1}
.txn-name{font-size:14px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.txn-meta{font-size:11.5px;color:var(--text-2);display:flex;gap:8px;align-items:center}
.txn-meta .cat{font-family:var(--font-mono);letter-spacing:.03em}
.txn-amt{font-family:var(--font-display);font-variant-numeric:tabular-nums;font-weight:600;font-size:15px;white-space:nowrap}

/* Tables */
.table-wrap{overflow-x:auto;margin:0 -6px}
table.tbl{width:100%;border-collapse:collapse;font-size:13.5px;min-width:640px}
.tbl thead th{font-family:var(--font-mono);font-size:10.5px;font-weight:600;letter-spacing:.1em;text-transform:uppercase;color:var(--text-3);text-align:left;padding:0 14px 12px;border-bottom:1px solid var(--border)}
.tbl thead th.r,.tbl td.r{text-align:right}
.tbl tbody td{padding:13px 14px;border-bottom:1px solid var(--border-soft);color:var(--text-2)}
.tbl tbody tr:hover td{background:rgba(255,255,255,.02)}
.tbl tbody tr:last-child td{border-bottom:none}
.tbl .primary{color:var(--text);font-weight:500}
.tbl .amt{font-family:var(--font-display);font-variant-numeric:tabular-nums;font-weight:600}
.tag{display:inline-flex;align-items:center;gap:6px;font-size:12px;color:var(--text-2)}
.tag .sw{width:7px;height:7px;border-radius:2px}
.type-pill{font-family:var(--font-mono);font-size:10px;font-weight:600;padding:2px 9px;border-radius:var(--r-pill);letter-spacing:.05em;text-transform:uppercase}
.type-pill.in{color:var(--green);background:rgba(16,185,129,.12)}
.type-pill.out{color:var(--red);background:rgba(245,85,93,.12)}
.row-act{color:var(--text-3);cursor:pointer;display:inline-grid;place-items:center;width:28px;height:28px;border-radius:6px}
.row-act:hover{color:var(--gold);background:var(--surface-3)}
.row-acts{display:inline-flex;gap:4px;justify-content:flex-end}
.row-act.del-txn:hover{color:var(--red);background:rgba(245,85,93,.12)}
/* row delete animation — slide out + collapse */
tr.row-removing{transition:height .3s ease}
tr.row-removing td{
  transform:translateX(46px);opacity:0;line-height:0;
  padding-top:0!important;padding-bottom:0!important;border-color:transparent!important;
  transition:transform .3s cubic-bezier(.4,0,1,1),opacity .24s ease,padding .3s ease,line-height .3s ease;
}
/* row add animation — slide in from left + expand + gold highlight */
tr.row-adding{transition:height .34s cubic-bezier(.22,1,.36,1)}
tr.row-adding td{
  transform:translateX(-40px);opacity:0;line-height:0;
  padding-top:0!important;padding-bottom:0!important;
  background:rgba(226,200,84,.14);
  transition:transform .44s cubic-bezier(.22,1,.36,1),opacity .34s ease,padding .34s ease,line-height .34s ease,background-color .9s ease;
}
tr.row-adding.in td{
  transform:none;opacity:1;line-height:1.6;
  padding-top:13px!important;padding-bottom:13px!important;
  background:transparent;
}

/* Filter bar */
.toolbar{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin-bottom:18px}
.field{display:flex;align-items:center;gap:8px;background:var(--surface);border:1px solid var(--border);border-radius:var(--r-ctrl);padding:8px 12px;color:var(--text-2);font-size:13px}
.field svg{width:15px;height:15px}
.field input,.field select{background:none;border:none;color:var(--text);font-family:var(--font-body);font-size:13px;outline:none;min-width:0}
.field input::placeholder{color:var(--text-3)}
.field.grow{flex:1;min-width:180px}

/* Today banner (dashboard) — tap to see today's actual income/expense line items */
.today-banner{display:flex;align-items:center;gap:16px;width:100%;text-align:left;margin-bottom:var(--gap);
  background:var(--surface);border:1px solid var(--border);border-radius:var(--r-card);padding:16px 20px;
  cursor:pointer;transition:border-color .15s,background .15s;font-family:var(--font-body)}
.today-banner:hover{border-color:var(--gold);background:var(--surface-2)}
.tb-seg{display:flex;align-items:center;gap:8px;min-width:0}
.tb-lbl{color:var(--text-2);font-size:12.5px;white-space:nowrap}
.tb-val{font-weight:600;font-size:15px;white-space:nowrap}
.tb-div{width:1px;align-self:stretch;background:var(--border)}
.tb-arrow{margin-left:auto;color:var(--text-3);display:flex;flex:none}
.tb-arrow svg{width:18px;height:18px}
@media(max-width:600px){
  .today-banner{flex-wrap:wrap;gap:10px 16px;padding:14px 16px}
  .tb-div{display:none}
  .tb-arrow{position:absolute;right:16px}
  .today-banner{position:relative}
}

/* Today modal (opened from the banner) — grouped income/expense line-item lists */
.today-sec{margin-bottom:6px}
.today-sec-title{font-family:var(--font-mono);font-size:10.5px;letter-spacing:.1em;text-transform:uppercase;color:var(--text-3);margin:14px 0 8px}
.today-sec:first-child .today-sec-title{margin-top:0}
.today-sec .txn{cursor:pointer;border-radius:10px;transition:background .12s}
.today-sec .txn:hover{background:var(--surface-2)}

/* Section-summary strip */
.sum-strip{display:grid;grid-template-columns:repeat(4,1fr);gap:var(--gap);margin-bottom:var(--gap)}
.sum{background:var(--surface);border:1px solid var(--border);border-radius:var(--r-card);padding:18px 20px}
.sum .eyebrow{margin-bottom:10px}
.sum .money{font-size:22px;font-weight:600}
.sum .sub{font-size:11.5px;color:var(--text-2);margin-top:4px}

/* Calendar */
.cal-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:8px}
.cal-dow{font-family:var(--font-mono);font-size:10.5px;letter-spacing:.1em;text-transform:uppercase;color:var(--text-3);text-align:center;padding-bottom:4px}
.cal-cell{background:var(--surface-2);border:1px solid var(--border-soft);border-radius:10px;min-height:88px;padding:8px 9px;display:flex;flex-direction:column;gap:4px;transition:border-color .15s}
.cal-cell:hover{border-color:#3a3a3f}
.cal-cell[data-date]{cursor:pointer}
.cal-cell[data-date]:hover{border-color:var(--gold)}
.cal-cell.dim{opacity:.4}
.cal-cell.today{border-color:var(--gold);box-shadow:0 0 0 1px rgba(226,200,84,.4) inset}
.cal-day{font-family:var(--font-display);font-size:13px;font-weight:600;color:var(--text-2)}
.cal-cell.today .cal-day{color:var(--gold)}
.cal-fig{font-family:var(--font-display);font-variant-numeric:tabular-nums;font-size:11.5px;font-weight:600;margin-top:auto}

/* Category management */
.cat-toolbar{display:flex;justify-content:flex-end;gap:8px;flex-wrap:wrap;margin-bottom:12px}
.cat-cols{display:grid;grid-template-columns:1fr 1fr;gap:var(--gap)}
.cat-item{display:flex;align-items:center;gap:12px;padding:11px 14px;border-radius:10px;background:var(--surface-2);border:1px solid var(--border-soft);margin-bottom:9px}
.cat-item .sw{width:11px;height:11px;border-radius:4px;flex:none}
.cat-item .nm{font-size:13.5px;font-weight:500}
.cat-item .ct{margin-left:auto;font-family:var(--font-mono);font-size:11px;color:var(--text-3)}
.cat-item .edit{color:var(--text-3);cursor:pointer}
.cat-item .edit:hover{color:var(--gold)}

/* Tabs */
.tabs{display:flex;gap:4px;background:var(--surface-2);border:1px solid var(--border);border-radius:var(--r-pill);padding:4px;width:fit-content;margin-bottom:18px}
.tab{font-size:13px;font-weight:500;color:var(--text-2);padding:7px 16px;border-radius:var(--r-pill);cursor:pointer;transition:all .15s}
.tab.active{background:var(--gold);color:#1a1600;font-weight:600}
.tab:not(.active):hover{color:var(--text)}

/* Export options */
.opt-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:12px}
.opt{background:var(--surface-2);border:1px solid var(--border);border-radius:12px;padding:16px;cursor:pointer;transition:border-color .15s}
.opt:hover{border-color:#3a3a3f}
.opt.sel{border-color:var(--gold);background:rgba(226,200,84,.06)}
.opt .eyebrow{margin-bottom:8px}
.opt .lbl{font-size:14px;font-weight:600}
.opt .desc{font-size:12px;color:var(--text-2);margin-top:3px}
.checkline{display:flex;align-items:center;gap:10px;padding:9px 0;font-size:13.5px;color:var(--text-2)}
.checkbox{width:18px;height:18px;border-radius:5px;border:1.5px solid var(--border);display:grid;place-items:center;flex:none}
.checkbox.on{background:var(--gold);border-color:var(--gold);color:#1a1600}
.checkbox svg{width:12px;height:12px;stroke-width:3}

/* Misc grid helpers */
.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:var(--gap)}
.stack{display:flex;flex-direction:column;gap:var(--gap)}
.chart-box{height:280px;position:relative}
.divider{height:1px;background:var(--border-soft);margin:18px 0}
.hint{font-size:12px;color:var(--text-3)}

/* Entrance motion */
.view.active .card,.view.active .sum{animation:rise .55s cubic-bezier(.22,1,.36,1) both}
.view.active .card:nth-child(1),.view.active .sum:nth-child(1){animation-delay:.02s}
.view.active .card:nth-child(2),.view.active .sum:nth-child(2){animation-delay:.06s}
.view.active .card:nth-child(3),.view.active .sum:nth-child(3){animation-delay:.10s}
.view.active .card:nth-child(4),.view.active .sum:nth-child(4){animation-delay:.14s}
.view.active .card:nth-child(5){animation-delay:.18s}
.view.active .card:nth-child(6){animation-delay:.22s}
.view.active .card:nth-child(7){animation-delay:.26s}
.view.active .card:nth-child(8){animation-delay:.30s}
@keyframes rise{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:translateY(0)}}

/* Mobile nav toggle (hidden desktop) */
.menu-btn{display:none}

/* ============================================================
   Login overlay
   ============================================================ */
.login{
  position:fixed;inset:0;z-index:100;overflow-y:auto;overflow-x:hidden;
  display:flex;align-items:center;justify-content:center;padding:24px;
  background:radial-gradient(120% 120% at 50% -10%, #0C0E11, #000 60%);
  transition:opacity .5s ease, visibility .5s ease;
}
.login::before{content:"";position:absolute;width:520px;height:520px;top:-160px;left:50%;transform:translateX(-50%);
  background:radial-gradient(circle, rgba(226,200,84,.18), transparent 70%);filter:blur(90px);pointer-events:none}
.login::after{content:"";position:absolute;width:460px;height:460px;bottom:-180px;right:-80px;
  background:radial-gradient(circle, rgba(16,185,129,.12), transparent 70%);filter:blur(90px);pointer-events:none}
.login.hidden{opacity:0;visibility:hidden;pointer-events:none}
.login-card{position:relative;z-index:1;width:100%;max-width:404px;
  background:var(--surface);border:1px solid var(--border);border-radius:20px;
  padding:36px 32px;box-shadow:0 40px 90px -30px rgba(0,0,0,.85),0 1px 0 rgba(255,255,255,.04) inset;
  animation:rise .6s cubic-bezier(.22,1,.36,1) both}
.login-brand{display:flex;align-items:center;gap:12px;margin-bottom:28px}
.login-title{font-family:var(--font-head);font-size:26px;font-weight:600;letter-spacing:-.01em;line-height:1.15}
.login-sub{color:var(--text-2);font-size:13.5px;margin:5px 0 28px}
.login-label{display:block;font-family:var(--font-mono);font-size:10.5px;letter-spacing:.12em;text-transform:uppercase;color:var(--text-3);margin:0 0 8px 2px}
.login-field{display:flex;align-items:center;gap:10px;background:var(--surface-2);border:1px solid var(--border);border-radius:var(--r-ctrl);padding:12px 14px;margin-bottom:18px;transition:border-color .15s}
.login-field:focus-within{border-color:var(--gold)}
.login-field>svg{width:18px;height:18px;color:var(--text-3);flex:none;stroke-width:1.8}
.login-field input{flex:1;min-width:0;background:none;border:none;outline:none;color:var(--text);font-family:var(--font-body);font-size:15px}
.login-field input::placeholder{color:var(--text-3)}
.login-field .eye{background:none;border:none;color:var(--text-3);cursor:pointer;padding:0;display:grid;place-items:center}
.login-field .eye:hover{color:var(--text-2)}
.login-field .eye.on{color:var(--gold)}
.remember{display:inline-flex;align-items:center;gap:10px;font-size:13px;color:var(--text-2);cursor:pointer;margin-bottom:24px;user-select:none}
.login-btn{width:100%;justify-content:center;padding:13px;font-size:15px}
.login-warn{display:flex;gap:10px;align-items:flex-start;background:rgba(226,200,84,.09);border:1px solid rgba(226,200,84,.35);border-radius:12px;padding:12px 14px;margin-bottom:18px;text-align:left;font-size:12.5px;line-height:1.6;color:var(--text-2)}
.login-warn svg{width:18px;height:18px;flex:none;color:var(--gold);margin-top:1px}
.login-warn b{color:var(--gold);font-weight:600}
.login-foot{text-align:center;font-family:var(--font-mono);font-size:10px;letter-spacing:.12em;color:var(--text-3);margin-top:24px}

/* ============================================================
   Bottom tab bar (mobile)
   ============================================================ */
.bottombar{display:none}
.tab-btn{flex:1;background:none;border:none;cursor:pointer;color:var(--text-3);
  display:flex;flex-direction:column;align-items:center;gap:3px;
  font-family:var(--font-body);font-size:10px;font-weight:500;padding:4px 0;transition:color .15s}
.tab-btn svg{width:23px;height:23px;stroke-width:1.7}
.tab-btn.active{color:var(--gold)}
.tab-fab{flex:0 0 auto;width:54px;height:54px;border-radius:50%;border:none;cursor:pointer;
  background:var(--gold);color:#1a1600;display:grid;place-items:center;margin-top:-26px;
  box-shadow:0 12px 26px -8px rgba(226,200,84,.7),0 0 0 5px rgba(10,12,15,.94);transition:transform .12s}
.tab-fab:active{transform:scale(.93)}
.tab-fab svg{width:26px;height:26px;stroke-width:2.4}

/* ============================================================
   Add transaction — modal / bottom-sheet
   ============================================================ */
.modal-overlay{position:fixed;inset:0;z-index:120;display:none;align-items:center;justify-content:center;padding:24px;
  background:rgba(0,0,0,.72);overscroll-behavior:contain}
/* NOTE: no backdrop-filter blur here — blurring the (already blurred) background is very GPU-heavy on
   mobile and made the add sheet feel laggy on every keypad tap/scroll. A darker overlay reads the same. */
.modal-overlay.open{display:flex}

/* "new version available" prompt (SW update) */
.update-bar{position:fixed;left:50%;bottom:78px;transform:translate(-50%,20px);z-index:200;
  display:flex;align-items:center;gap:8px;padding:11px 18px;border:none;border-radius:999px;
  background:var(--gold);color:#1a1400;font-family:var(--font-body);font-size:13.5px;font-weight:600;
  box-shadow:0 8px 26px rgba(0,0,0,.45);cursor:pointer;max-width:calc(100vw - 28px);
  opacity:0;pointer-events:none;transition:opacity .25s ease,transform .25s ease}
.update-bar.show{opacity:1;transform:translate(-50%,0);pointer-events:auto}
.update-bar svg{width:16px;height:16px;flex:none}
.update-bar:disabled{opacity:.75;cursor:default}
@media(min-width:768px){.update-bar{bottom:24px}}
/* while any sheet/modal is open, lock the page behind it so scrolling stays inside the sheet */
html:has(.modal-overlay.open){overflow:hidden}
.sheet{width:100%;max-width:464px;max-height:calc(100vh - 48px);overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;
  background:var(--surface);border:1px solid var(--border);border-radius:20px;padding:24px;
  box-shadow:0 40px 90px -30px rgba(0,0,0,.85),0 1px 0 rgba(255,255,255,.04) inset;
  animation:pop .32s cubic-bezier(.22,1,.36,1) both}
@keyframes pop{from{opacity:0;transform:translateY(12px) scale(.985)}to{opacity:1;transform:none}}
.sheet-handle{display:none}
.sheet-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:22px}
.sheet-title{font-family:var(--font-head);font-size:19px;font-weight:600}
.icon-btn.close{width:34px;height:34px}
.icon-btn.close svg{width:17px;height:17px}

.type-toggle{display:grid;grid-template-columns:1fr 1fr;gap:6px;background:var(--surface-2);border:1px solid var(--border);border-radius:var(--r-ctrl);padding:5px;margin-bottom:22px}
.tg-btn{padding:10px;border:none;border-radius:6px;background:none;color:var(--text-2);
  font-family:var(--font-body);font-size:14px;font-weight:600;cursor:pointer;
  display:flex;align-items:center;justify-content:center;gap:8px;transition:background .15s,color .15s}
.tg-btn .d{width:8px;height:8px;border-radius:50%;opacity:.5;transition:opacity .15s}
.tg-btn.active .d{opacity:1}
.tg-btn.out.active{background:rgba(245,85,93,.14);color:var(--red)}
.tg-btn.in.active{background:rgba(16,185,129,.14);color:var(--green)}
#shopeeTypeToggle .tg-btn.active{background:rgba(226,200,84,.14);color:var(--gold)}
#shopeeTypeRow{margin-top:-4px}

.amount-wrap{margin-bottom:22px}
.amount-wrap .form-label{margin-bottom:10px}
.amount-field{display:flex;align-items:center;justify-content:center;gap:8px}
.amount-cur{font-family:var(--font-display);font-size:28px;font-weight:500;color:var(--text-2)}
.amount-input{font-family:var(--font-display);font-size:52px;font-weight:600;letter-spacing:-.02em;
  background:none;border:none;outline:none;text-align:center;width:100%;max-width:280px;
  font-variant-numeric:tabular-nums;color:var(--text);transition:color .2s}
.sheet[data-type=out] .amount-input{color:var(--red)}
.sheet[data-type=in] .amount-input{color:var(--green)}
.amount-input{cursor:default}
/* numeric keypad */
.keypad{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-bottom:22px}
.key{padding:14px 0;border:1px solid var(--border);background:var(--surface-2);border-radius:12px;color:var(--text);
  font-family:var(--font-display);font-size:20px;font-weight:600;cursor:pointer;-webkit-tap-highlight-color:transparent;
  display:grid;place-items:center;transition:background .12s ease,transform .06s ease,border-color .12s ease}
.key:hover{background:var(--surface-3)}
.key:active{transform:scale(.95);background:rgba(226,200,84,.16);border-color:var(--gold)}
.key-dot{font-size:24px}
.key-back svg{width:22px;height:22px;color:var(--text-2)}
.key-back:active svg{color:var(--red)}
/* rapid taps (e.g. hammering the keypad ⌫) must not trigger mobile double-tap-to-zoom */
.key,.btn,button,.nav-item,.more-tile,.tab,.tab-btn,.opt,.icon-btn,.month-nav button{touch-action:manipulation}

.form-label{font-family:var(--font-mono);font-size:10.5px;letter-spacing:.12em;text-transform:uppercase;color:var(--text-3);margin:0 0 8px 2px}
.cat-chips{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:20px}
.cat-chip{display:inline-flex;align-items:center;gap:7px;padding:8px 13px;border-radius:var(--r-pill);
  background:var(--surface-2);border:1px solid var(--border);color:var(--text-2);
  font-family:var(--font-body);font-size:13px;cursor:pointer;transition:border-color .15s,background .15s,color .15s}
.cat-chip .d{width:8px;height:8px;border-radius:50%;flex:none}
.cat-chip:hover{border-color:#3a3a3f;color:var(--text)}
.cat-chip.active{border-color:var(--gold);background:rgba(226,200,84,.09);color:var(--text)}

.input-box{display:flex;align-items:center;gap:10px;background:var(--surface-2);border:1px solid var(--border);border-radius:var(--r-ctrl);padding:11px 14px;margin-bottom:18px;transition:border-color .15s}
.input-box:focus-within{border-color:var(--gold)}
.input-box>svg{width:17px;height:17px;color:var(--text-3);flex:none;stroke-width:1.8}
.input-box input{flex:1;min-width:0;background:none;border:none;outline:none;color:var(--text);font-family:var(--font-body);font-size:14.5px;color-scheme:dark}
.input-box input::placeholder{color:var(--text-3)}
.input-box select{flex:1;min-width:0;background:none;border:none;outline:none;color:var(--text);font-family:var(--font-body);font-size:14.5px;color-scheme:dark;cursor:pointer}
.input-box select option{background:var(--surface-2);color:var(--text)}

.upload{border:1.5px dashed var(--border);border-radius:12px;padding:20px;text-align:center;color:var(--text-3);cursor:pointer;transition:border-color .15s,color .15s;margin-bottom:22px}
.upload:hover{border-color:var(--gold);color:var(--text-2)}
.upload svg{width:26px;height:26px;margin-bottom:8px;color:var(--text-2)}
.upload .u-main{font-size:13px;color:var(--text-2);font-weight:500}
.upload .u-sub{font-size:11px;margin-top:2px}

.sheet-foot{display:flex;gap:10px}
.sheet-foot .btn{flex:1;justify-content:center;padding:12px}
.btn-danger{background:rgba(245,85,93,.12);border-color:rgba(245,85,93,.32);color:var(--red)}
.btn-danger:hover{background:rgba(245,85,93,.2)}
.btn-danger svg{width:16px;height:16px}
.btn-danger-solid{background:var(--red);color:#fff}
.btn-danger-solid:hover{filter:brightness(1.07)}
.sheet[data-mode=add] #addDelete{display:none}
.sheet[data-mode=edit] #addCancel{display:none}
.sheet[data-mode=edit] .batch-only{display:none}
/* batch add — queued list */
.btn-add-list{width:100%;justify-content:center;border-style:dashed;margin-bottom:14px}
.queue{display:flex;flex-direction:column;gap:8px}
.queue:not(:empty){margin-bottom:12px}
.q-item{display:flex;align-items:center;gap:10px;padding:9px 12px;background:var(--surface-2);border:1px solid var(--border-soft);border-radius:10px;animation:qin .26s cubic-bezier(.22,1,.36,1) both}
@keyframes qin{from{opacity:0;transform:translateY(-6px)}to{opacity:1;transform:none}}
.q-ic{font-size:16px;flex:none}
.q-main{min-width:0;flex:1}
.q-name{font-size:13px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.q-cat{font-family:var(--font-mono);font-size:10px;color:var(--text-3)}
.q-amt{font-family:var(--font-display);font-variant-numeric:tabular-nums;font-weight:600;font-size:13px;white-space:nowrap}
.q-del{color:var(--text-3);cursor:pointer;width:24px;height:24px;display:grid;place-items:center;border-radius:6px;flex:none}
.q-del svg{width:15px;height:15px}
.q-del:hover{color:var(--red);background:rgba(245,85,93,.12)}
.q-empty{font-size:12px;color:var(--text-3);text-align:center;padding:6px 0 14px;line-height:1.5}
.q-summary{display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:12.5px;color:var(--text-2);margin-bottom:16px;padding:2px 2px 0}
.q-summary .amounts{display:flex;gap:10px;font-family:var(--font-display);font-variant-numeric:tabular-nums;font-weight:600}

/* confirm delete dialog */
.modal-overlay.confirm{z-index:140;align-items:center;padding:24px}
.confirm-box{width:100%;max-width:360px;text-align:center;
  background:var(--surface);border:1px solid var(--border);border-radius:18px;padding:26px 24px;
  box-shadow:0 40px 90px -30px rgba(0,0,0,.85),0 1px 0 rgba(255,255,255,.04) inset;
  animation:pop .28s cubic-bezier(.22,1,.36,1) both}
.confirm-ic{width:52px;height:52px;border-radius:50%;background:rgba(245,85,93,.14);color:var(--red);display:grid;place-items:center;margin:0 auto 16px}
.confirm-ic svg{width:24px;height:24px}
.confirm-title{font-family:var(--font-head);font-size:18px;font-weight:600;margin-bottom:7px}
.confirm-sub{font-size:13px;color:var(--text-2);margin-bottom:22px;line-height:1.55}
.confirm-foot{display:flex;gap:10px}
.confirm-foot .btn{flex:1;justify-content:center;padding:11px}

/* ============================================================
   Profile — dropdown menu + edit modal
   ============================================================ */
.profile{position:relative}
.pf-caret{width:14px;height:14px;color:var(--text-3);transition:transform .22s ease;flex:none}
.profile.open .pf-caret{transform:rotate(180deg)}
.pop-menu{
  position:absolute;top:calc(100% + 10px);right:0;z-index:90;width:270px;
  background:var(--surface);border:1px solid var(--border);border-radius:16px;padding:14px;cursor:default;
  box-shadow:0 30px 70px -24px rgba(0,0,0,.82),0 1px 0 rgba(255,255,255,.05) inset;
  opacity:0;visibility:hidden;transform:translateY(-6px) scale(.98);transform-origin:top right;
  transition:opacity .2s ease,transform .22s cubic-bezier(.22,1,.36,1),visibility .2s}
.profile.open .pop-menu{opacity:1;visibility:visible;transform:none}
.pm-head{display:flex;align-items:center;gap:12px;padding:4px 6px 14px}
.avatar.lg{width:44px;height:44px;font-size:18px;border-radius:14px}
.avatar.xl{width:76px;height:76px;font-size:32px;border-radius:22px}
.pm-name{font-family:var(--font-head);font-weight:600;font-size:15px;line-height:1.2}
.pm-mail{font-size:11.5px;color:var(--text-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pm-plan{display:inline-block;margin-top:6px;font-family:var(--font-mono);font-size:9px;letter-spacing:.12em;color:var(--gold);background:rgba(226,200,84,.12);padding:2px 8px;border-radius:var(--r-pill)}
.pm-stats{display:grid;grid-template-columns:1fr 1fr;gap:10px;padding:12px;margin-bottom:8px;background:var(--surface-2);border:1px solid var(--border-soft);border-radius:12px}
.pm-stats .k{font-size:10px;color:var(--text-3);white-space:nowrap}
.pm-stats .v{font-family:var(--font-display);font-weight:600;font-size:14px;margin-top:3px;font-variant-numeric:tabular-nums}
.pm-list{display:flex;flex-direction:column;gap:1px}
.pm-item{display:flex;align-items:center;gap:12px;width:100%;padding:9px 10px;border:none;background:none;
  color:var(--text-2);font-family:var(--font-body);font-size:13.5px;text-align:left;cursor:pointer;border-radius:9px;transition:background .15s,color .15s}
.pm-item:hover{background:var(--surface-2);color:var(--text)}
.pm-item>svg{width:17px;height:17px;flex:none;color:var(--text-3);stroke-width:1.8}
.pm-item:hover>svg{color:var(--gold)}
.pm-item.danger{color:var(--red)}
.pm-item.danger:hover{background:rgba(245,85,93,.1)}
.pm-item.danger>svg{color:var(--red)}
.pm-divider{height:1px;background:var(--border-soft);margin:8px 0}
.mini-switch{margin-left:auto;width:34px;height:19px;border-radius:var(--r-pill);background:var(--surface-3);position:relative;transition:background .2s;flex:none}
.mini-switch::after{content:"";position:absolute;top:2px;left:2px;width:15px;height:15px;border-radius:50%;background:#fff;transition:transform .2s}
.pm-item.on .mini-switch{background:var(--green)}
.pm-item.on .mini-switch::after{transform:translateX(15px)}
.avatar-edit{display:flex;flex-direction:column;align-items:center;gap:12px;margin-bottom:22px}

/* toast */
.toast{position:fixed;bottom:28px;left:50%;z-index:200;
  display:flex;align-items:center;gap:10px;
  background:var(--surface-2);border:1px solid var(--border);border-radius:var(--r-pill);
  padding:11px 20px 11px 12px;font-size:13.5px;color:var(--text);
  box-shadow:0 20px 44px -16px rgba(0,0,0,.75);
  opacity:0;pointer-events:none;transform:translateX(-50%) translateY(20px);
  transition:opacity .3s ease,transform .3s cubic-bezier(.22,1,.36,1)}
.toast.show{opacity:1;transform:translateX(-50%) translateY(0)}
.toast .ic{width:20px;height:20px;border-radius:50%;background:var(--green);color:#04140e;display:grid;place-items:center;flex:none}

/* bottom-sheet on mobile */
@media(max-width:900px){
  .modal-overlay{align-items:flex-end;padding:0}
  .sheet{max-width:none;max-height:92vh;border-radius:22px 22px 0 0;
    padding-bottom:calc(24px + env(safe-area-inset-bottom));animation:sheetup .32s cubic-bezier(.22,1,.36,1) both}
  .sheet-handle{display:block;width:40px;height:4px;border-radius:2px;background:var(--surface-3);margin:-8px auto 16px}
  .toast{bottom:calc(94px + env(safe-area-inset-bottom))}
}
@keyframes sheetup{from{transform:translateY(100%)}to{transform:translateY(0)}}

/* ============================================================
   Responsive
   ============================================================ */
/* iPad & tablet — two-column bento */
@media(max-width:1100px){
  .hero,.span-6,.span-9,.span-12{grid-column:span 12}
  .span-3,.span-4,.span-5,.span-7,.span-8{grid-column:span 6}
  .sum-strip{grid-template-columns:repeat(2,1fr)}
}
/* iPad portrait & phones — drawer sidebar + bottom tab bar */
@media(max-width:900px){
  :root{--sidebar:0px}
  .app{grid-template-columns:1fr}
  .sidebar{position:fixed;z-index:60;width:280px;max-width:84vw;left:0;top:0;height:100vh;
    transform:translateX(-100%);transition:transform .28s cubic-bezier(.22,1,.36,1);
    padding-bottom:calc(22px + env(safe-area-inset-bottom))}
  .sidebar.open{transform:none;box-shadow:0 0 80px rgba(0,0,0,.85)}
  .main{padding:0 18px calc(94px + env(safe-area-inset-bottom))}
  .topbar .btn-gold,.profile .who,.profile .plan,.profile .pf-caret{display:none}
  .cat-cols,.grid-2{grid-template-columns:1fr}
  .bottombar{display:flex;position:fixed;left:0;right:0;bottom:0;z-index:50;
    align-items:center;justify-content:space-around;gap:4px;
    padding:8px 12px calc(8px + env(safe-area-inset-bottom));
    background:rgba(10,12,15,.94);backdrop-filter:blur(14px);border-top:1px solid var(--border)}
}
/* phones — single column */
@media(max-width:767px){
  .hero,.span-3,.span-4,.span-5,.span-6,.span-7,.span-8,.span-9{grid-column:span 12}
  .topbar{gap:10px}
  .page-head{flex-shrink:0}
  .hero-value{font-size:42px}
  .page-title{font-size:19px;white-space:nowrap}
  .page-sub{font-size:11.5px}
  .toolbar .field.grow{min-width:120px}
}
@media(max-width:520px){
  .sum-strip{grid-template-columns:1fr}
  .hero-value{font-size:36px}
  .hero-value .cur{font-size:22px}
  .main{padding-left:14px;padding-right:14px}
  .card{padding:18px}
  .topbar{gap:8px}
  .topbar>.icon-btn{display:none}
  .month-nav{padding:2px}
  .month-nav .label{min-width:64px;font-size:11px;padding:0 6px}
  .month-nav button{width:28px;height:28px}
  .page-sub{display:none}
}
/* Transactions filter bar → 2 tidy rows on phones: [search | type] / [category | CSV].
   The month field was removed (the page is now scoped by the topbar month-nav instead —
   see txnFiltered() in app.js), so category takes most of row 2. */
@media(max-width:560px){
  #transactions .toolbar{gap:7px}
  #transactions .toolbar .field{min-width:0}
  #transactions .toolbar .field.grow{flex:1 1 54%}
  #transactions .toolbar .field-type{flex:1 1 38%}
  #transactions .toolbar .field-cat{flex:1 1 78%}
  #transactions .toolbar .btn-csv{flex:0 1 16%;justify-content:center;padding-left:10px;padding-right:10px}
  #transactions .toolbar .btn-csv .csv-label{display:none}   /* icon-only on phones to save space */
}
@media(prefers-reduced-motion:reduce){
  *{animation:none!important;transition:none!important}
}
.scrim{display:none;position:fixed;inset:0;background:rgba(0,0,0,.6);z-index:55}
.scrim.show{display:block}

/* ============================================================
   Batch slip import
   ============================================================ */
.batch-import-btn{width:100%;justify-content:center;gap:9px;padding:12px;margin-top:-8px;margin-bottom:6px;font-size:13.5px}
.batch-import-btn svg{width:19px;height:19px;color:var(--gold);stroke-width:1.7}
.batch-import-hint{color:var(--text-3);font-size:11px;text-align:center;margin-bottom:20px}
.batch-count{color:var(--text-3);font-weight:400;font-size:15px}
.batch-progress{margin-bottom:16px}
.bp-bar{height:6px;border-radius:99px;background:var(--surface-3);overflow:hidden;margin-bottom:8px}
.bp-bar span{display:block;height:100%;background:var(--gold);border-radius:99px;transition:width .3s ease}
.bp-txt{font-size:12.5px;color:var(--text-2);text-align:center}
.bp-txt.done{color:var(--green)}
.batch-list{display:flex;flex-direction:column;gap:10px;margin-bottom:20px}
.bi-card{display:flex;gap:12px;background:var(--surface-2);border:1px solid var(--border);border-radius:12px;padding:11px;transition:border-color .15s,opacity .15s}
.bi-card.on{border-color:var(--gold);background:rgba(226,200,84,.05)}
.bi-card.isdup,.bi-card.skip{opacity:.62}
.bi-thumb{width:56px;height:56px;flex:none;border-radius:8px;overflow:hidden;background:var(--surface-3)}
.bi-thumb img{width:100%;height:100%;object-fit:cover;display:block}
.bi-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:7px}
.bi-loading,.bi-skiptxt{font-size:12.5px;color:var(--text-3);padding:6px 0}
.bi-top{display:flex;align-items:center;gap:9px}
.bi-inc{display:inline-flex;align-items:center;cursor:pointer}
.bi-inc input{width:19px;height:19px;accent-color:var(--gold);cursor:pointer}
.bi-inc.small{font-size:12px;color:var(--text-2);gap:6px}
.bi-amt-wrap{display:flex;align-items:center;gap:4px;flex:1;min-width:0;background:var(--surface-3);border:1px solid var(--border);border-radius:var(--r-ctrl);padding:6px 10px}
.bi-amt-wrap:focus-within{border-color:var(--gold)}
.bi-cur{color:var(--text-3);font-size:14px;flex:none}
.bi-amt{flex:1;min-width:0;background:none;border:none;outline:none;color:var(--red);font-family:var(--font-mono);font-size:15px;font-weight:600}
.bi-badges{display:flex;gap:4px;flex:none;flex-wrap:wrap;justify-content:flex-end;max-width:44%}
.bi-badge{font-size:10px;padding:2px 7px;border-radius:99px;white-space:nowrap}
.bi-badge.dup{background:rgba(245,85,93,.15);color:var(--red)}
.bi-badge.err{background:rgba(245,85,93,.15);color:var(--red)}
.bi-badge.bank{background:var(--surface-3);color:var(--text-2)}
.bi-row{display:flex;gap:8px}
.bi-date,.bi-cat,.bi-note{background:var(--surface-3);border:1px solid var(--border);border-radius:var(--r-ctrl);padding:7px 10px;color:var(--text);font-family:var(--font-body);font-size:12.5px;outline:none;color-scheme:dark;min-width:0}
.bi-date{flex:none;width:44%}
.bi-cat{flex:1}
.bi-note{width:100%}
.bi-date:focus,.bi-cat:focus,.bi-note:focus{border-color:var(--gold)}
.bi-errtxt{font-size:11px;color:var(--red)}
#batchSave:disabled{opacity:.4;pointer-events:none}

/* ============================================================
   Mobile "more" menu — bottom sheet
   ============================================================ */
.more-sheet .more-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.more-tile{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:9px;
  background:var(--surface-2);border:1px solid var(--border);border-radius:12px;padding:18px 8px;
  color:var(--text-2);font-family:var(--font-body);font-size:12px;font-weight:500;line-height:1.2;
  text-align:center;cursor:pointer;transition:border-color .15s,color .15s,background .15s}
.more-tile:hover,.more-tile:active{border-color:#3a3a3f;color:var(--text);background:var(--surface-3)}
.more-tile svg{width:23px;height:23px;stroke-width:1.7;flex:none}
.more-tile.active{border-color:var(--gold);background:rgba(226,200,84,.08);color:var(--gold)}
.more-tile.active svg{color:var(--gold)}
.more-foot{margin-top:18px;text-align:center;font-size:11px;color:var(--gold);line-height:1.7;font-weight:500}
.more-foot b{color:var(--gold);font-weight:500}
.more-foot .more-ver{font-family:var(--font-mono);font-size:10px;font-weight:500;letter-spacing:.1em;color:var(--gold)}

/* Access gate — shown when a signed-in email isn't on the allowlist */
.access-denied{position:fixed;inset:0;z-index:200;display:none;align-items:center;justify-content:center;padding:24px;background:radial-gradient(120% 120% at 50% 0%,#0C0E11,#000)}
.access-denied .ad-card{width:100%;max-width:360px;text-align:center;background:var(--surface);border:1px solid var(--border);border-radius:20px;padding:34px 26px;box-shadow:var(--shadow-lift)}
.ad-mark{width:56px;height:56px;margin:0 auto 20px;border-radius:16px;background:conic-gradient(from 210deg,var(--gold),#F4E39A,var(--gold-dim),var(--gold));display:grid;place-items:center;color:#1a1600;font-weight:800;font-family:var(--font-display);font-size:28px;box-shadow:0 8px 22px -8px rgba(226,200,84,.6)}
.ad-title{font-family:var(--font-head);font-size:19px;font-weight:600;margin-bottom:10px}
.ad-sub{font-size:13px;color:var(--text-2);line-height:1.7;margin-bottom:16px}
.ad-mail{font-family:var(--font-mono);font-size:12px;color:var(--gold);background:var(--surface-2);border:1px solid var(--border);border-radius:var(--r-ctrl);padding:9px 12px;margin-bottom:22px;word-break:break-all}
.access-denied #adSignout{width:100%;justify-content:center;padding:12px}

/* type pill / category tag never wrap onto a second line */
.type-pill,.tag{white-space:nowrap}

/* Transactions table -> 2-line cards that fit a phone (no horizontal scroll) */
@media(max-width:680px){
  #transactions .table-wrap{overflow-x:hidden;margin:0}
  #transactions table.tbl,
  #transactions .tbl tbody{display:block;min-width:0;width:100%}
  #transactions .tbl thead{display:none}                       /* header row not needed in card mode */
  #transactions .tbl tbody tr{
    display:grid;grid-template-columns:auto 1fr auto;
    grid-template-areas:"date name amt" "date cat amt";
    align-items:center;column-gap:12px;row-gap:2px;
    padding:12px 4px;border-bottom:1px solid var(--border-soft);cursor:pointer;
  }
  #transactions .tbl tbody tr:last-child{border-bottom:none}
  #transactions .tbl tbody td{display:block;padding:0;border:none}
  #transactions .tbl tbody tr:hover td{background:none}
  #transactions .tbl td:nth-child(1){grid-area:date;font-size:11px;color:var(--text-3);white-space:nowrap;line-height:1.2}
  #transactions .tbl td.primary{grid-area:name;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:13.5px}
  #transactions .tbl td:nth-child(3){grid-area:cat;min-width:0;overflow:hidden}
  #transactions .tbl td:nth-child(3) .tag{font-size:11.5px}
  #transactions .tbl td:nth-child(5){grid-area:amt;text-align:right;white-space:nowrap;font-size:14px}
  #transactions .tbl td:nth-child(4),   /* ประเภท (in/out already shown by amount colour) */
  #transactions .tbl td:nth-child(6){display:none}   /* actions — tap the row to edit */
  #transactions .tbl td[colspan]{display:block;grid-column:1/-1;text-align:center}
}

/* Subscriptions table -> simple name · ฿/month rows that fit phone & iPad (no horizontal scroll) */
@media(max-width:900px){
  #subscriptions .table-wrap{overflow-x:hidden;margin:0}
  #subscriptions table.tbl,
  #subscriptions .tbl tbody{display:block;min-width:0;width:100%}
  #subscriptions .tbl thead{display:none}
  #subscriptions .tbl tbody tr{display:flex;align-items:center;gap:12px;padding:13px 4px;border-bottom:1px solid var(--border-soft);cursor:pointer}
  #subscriptions .tbl tbody tr:last-child{border-bottom:none}
  #subscriptions .tbl tbody td{display:block;padding:0;border:none}
  #subscriptions .tbl tbody tr:hover td{background:none}
  #subscriptions .tbl td.primary{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:13.5px}
  #subscriptions .tbl td.amt{flex:none;text-align:right;white-space:nowrap;font-size:14px}
  #subscriptions .tbl td:nth-child(2),   /* หมวดหมู่ (redundant "รายเดือน") */
  #subscriptions .tbl td:nth-child(3),   /* รอบชำระ (redundant "รายเดือน") */
  #subscriptions .tbl td:nth-child(4),   /* ครบกำหนด (usually empty) */
  #subscriptions .tbl td:nth-child(6){display:none}   /* actions — tap the row to edit */
  #subscriptions .tbl td[colspan]{display:block;flex:1;text-align:center}
}
