/* =====================================================================
   Ledgerling — stylesheet
   Sections: fonts · tokens & themes · base · components · screens ·
             dashboard · overlays · nav · responsive
   Mobile-first. iPhone specifics: safe-area insets, 100dvh, 16px inputs.
   ===================================================================== */

/* ===== Fonts (self-hosted) ===== */
@font-face{
  font-family:"Inter Variable"; font-style:normal; font-weight:100 900; font-display:swap;
  src:url("../assets/fonts/inter-latin-wght-normal.woff2") format("woff2");
}
@font-face{
  font-family:"Fraunces Variable"; font-style:normal; font-weight:100 900; font-display:swap;
  src:url("../assets/fonts/fraunces-latin-wght-normal.woff2") format("woff2");
}
@font-face{
  font-family:"JetBrains Mono"; font-style:normal; font-weight:400; font-display:swap;
  src:url("../assets/fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2");
}
@font-face{
  font-family:"JetBrains Mono"; font-style:normal; font-weight:500; font-display:swap;
  src:url("../assets/fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2");
}
@font-face{
  font-family:"JetBrains Mono"; font-style:normal; font-weight:700; font-display:swap;
  src:url("../assets/fonts/jetbrains-mono-latin-700-normal.woff2") format("woff2");
}

/* ===== Tokens ===== */
:root{
  --bg:#0E2529; --panel:#143439; --panel-2:#1B4045; --line:#2A5257;
  --text:#F3EFE4; --muted:#9FB9B8;
  --gold:#E8B84B; --coral:#FF6F59; --mint:#7FD1B9; --amber:#F2A65A; --danger:#E4634E;
  --overlay-rgb:255,255,255;
  --glass-bg:rgba(20,52,57,0.62); --glass-border:rgba(255,255,255,0.14); --glass-highlight:rgba(255,255,255,0.28);

  --radius:20px; --radius-sm:14px; --tap:44px;
  --display:"Fraunces Variable","Fraunces",Georgia,"Times New Roman",serif;
  --body:"Inter Variable","Inter",-apple-system,BlinkMacSystemFont,"Segoe UI",system-ui,sans-serif;
  --mono:"JetBrains Mono",ui-monospace,"SF Mono",Menlo,Consolas,monospace;

  /* iPhone notch / home-indicator insets (0 elsewhere) */
  --sat:env(safe-area-inset-top, 0px);
  --sar:env(safe-area-inset-right, 0px);
  --sab:env(safe-area-inset-bottom, 0px);
  --sal:env(safe-area-inset-left, 0px);
}

/* ===== Themes ===== */
[data-theme="midnight"]{
  --bg:#141329; --panel:#1E1D3A; --panel-2:#282650; --line:#3A3768;
  --text:#EDEBFA; --muted:#A29DC9; --gold:#9B8CFF; --coral:#FF7A9E;
  --mint:#6E9BD8; --amber:#C9A6FF; --danger:#FF6B7A; --overlay-rgb:255,255,255;
  --glass-bg:rgba(30,29,58,0.62); --glass-border:rgba(255,255,255,0.14); --glass-highlight:rgba(255,255,255,0.26);
}
[data-theme="sunset"]{
  --bg:#241014; --panel:#331821; --panel-2:#40202B; --line:#5A2F3A;
  --text:#FBE9E2; --muted:#D3A79A; --gold:#FF9457; --coral:#FF6F59;
  --mint:#F2C078; --amber:#FF8B6B; --danger:#FF5C5C; --overlay-rgb:255,255,255;
  --glass-bg:rgba(51,24,33,0.62); --glass-border:rgba(255,255,255,0.14); --glass-highlight:rgba(255,255,255,0.26);
}
[data-theme="daylight"]{
  --bg:#F5F3EE; --panel:#FFFFFF; --panel-2:#FBF9F4; --line:#E4DFD3;
  --text:#241E14; --muted:#7D7565; --gold:#C9922F; --coral:#D9563F;
  --mint:#3E8F7A; --amber:#C97B2E; --danger:#C9432E; --overlay-rgb:20,20,20;
  --glass-bg:rgba(255,255,255,0.7); --glass-border:rgba(20,20,20,0.1); --glass-highlight:rgba(255,255,255,0.8);
}

/* ===== Base ===== */
*,*::before,*::after{box-sizing:border-box;}
html{-webkit-text-size-adjust:100%; text-size-adjust:100%; background:var(--bg); scroll-padding-top:calc(72px + var(--sat));}
html,body{margin:0; padding:0;}
html.no-scroll, html.no-scroll body{overflow:hidden;}
body{
  background:
    radial-gradient(700px 400px at 15% -10%, rgba(232,184,75,0.08), transparent 60%),
    radial-gradient(600px 350px at 100% 0%, rgba(127,209,185,0.07), transparent 55%),
    var(--bg);
  background-attachment:fixed;
  color:var(--text);
  font-family:var(--body);
  font-size:16px; line-height:1.4;
  min-height:100vh; min-height:100dvh;
  -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale;
  overflow-x:hidden;
  overscroll-behavior-y:none;
}
.hidden{display:none !important;}
h1,h2,h3,h4{font-family:var(--display); font-weight:600; margin:0;}
h4{font-family:var(--body);}
p{margin:0;}
a{color:inherit;}
button{font-family:var(--body); cursor:pointer; -webkit-tap-highlight-color:transparent; touch-action:manipulation;}
input,select,textarea{font-family:var(--body); color:var(--text);}
/* 16px minimum on every form control stops iOS Safari zooming the page when one is focused */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
select,textarea{font-size:16px;}
:focus-visible{outline:2px solid var(--gold); outline-offset:2px;}
input::placeholder,textarea::placeholder{color:var(--muted); opacity:.7;}
.upper{text-transform:uppercase;}

/* ===== Icons (inline SVG sprite) ===== */
.ic{
  width:1.25em; height:1.25em; flex-shrink:0;
  fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round;
  vertical-align:middle;
}

.eyebrow{
  font-family:var(--mono); font-size:11px; letter-spacing:.12em; text-transform:uppercase;
  color:var(--mint); margin:0 0 8px;
}

/* ===== Buttons ===== */
.btn-primary{
  background:linear-gradient(180deg, #F2C868, var(--gold));
  color:#22270F; border:none; border-radius:999px;
  padding:13px 22px; font-weight:700; font-size:15px;
  box-shadow:0 6px 18px rgba(232,184,75,0.22);
  min-height:var(--tap); width:100%;
  transition:transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.btn-primary:hover{filter:brightness(1.04);}
.btn-primary:active{transform:scale(0.98);}
.btn-primary:disabled{opacity:.4; cursor:not-allowed; transform:none; box-shadow:none; filter:none;}
.btn-primary.btn-danger{background:linear-gradient(180deg, #F0806D, var(--danger)); color:#fff; box-shadow:0 6px 18px rgba(228,99,78,0.25);}
.btn-sm{padding:11px 16px; font-size:14px; border-radius:12px; width:auto;}
.btn-tiny{padding:6px 12px; font-size:12px; min-height:34px;}
.btn-ghost{
  background:transparent; border:1px solid var(--line); color:var(--muted);
  border-radius:999px; padding:9px 16px; font-size:13px; font-weight:600; min-height:40px;
  transition:color .15s ease, border-color .15s ease;
}
.btn-ghost:hover{color:var(--text); border-color:var(--mint);}
.btn-ghost:active{color:var(--text); border-color:var(--mint);}
.btn-block{width:100%; margin-top:10px;}
.btn-danger-text{color:var(--danger); border-color:transparent; margin-right:auto;}
.danger-btn{border-color:rgba(228,99,78,0.4); color:var(--danger);}
.link-btn{background:none; border:none; color:var(--mint); font-size:13px; font-weight:700; padding:8px 4px; min-height:36px;}

/* ===== Form controls ===== */
.field{display:flex; flex-direction:column; gap:7px; min-width:0;}
.field > span{font-size:13px; font-weight:600; color:var(--muted);}
.optional-tag{color:var(--muted); font-weight:400; font-style:normal;}
.field > input[type="text"], .field > input[type="number"], .field > input[type="email"], .field > input[type="tel"],
.field > input[type="password"], .field > input[type="date"], .field > select,
.entry-form input[type="text"], .entry-form select, .tx-goal-select, .dialog-input,
.add-cat-row input[type="text"], .custom-range-row input, .field-select, .review-row select{
  background:var(--panel); border:1px solid var(--line); border-radius:12px;
  padding:12px 14px; color:var(--text); min-height:var(--tap); width:100%; min-width:0;
}
.field > input:focus, .field > select:focus, .entry-form input:focus, .entry-form select:focus,
.dialog-input:focus, .field-select:focus, .add-cat-row input:focus{outline:none; border-color:var(--gold);}
select, .field-select{
  -webkit-appearance:none; appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='%239FB9B8' d='M5.5 7.5l4.5 4.5 4.5-4.5z'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 10px center; background-size:18px;
  padding-right:34px !important;
}
input[type="date"]{-webkit-appearance:none; appearance:none; text-align:left;}
.field-select{width:auto; min-width:150px; font-weight:600;}
.field-group{display:flex; flex-direction:column; gap:8px;}
.field-label{font-size:13px; font-weight:600; color:var(--muted);}
.form-error, .modal-warning{
  color:var(--danger); font-size:13px; font-weight:600; background:rgba(228,99,78,0.1);
  border:1px solid rgba(228,99,78,0.3); border-radius:10px; padding:9px 12px;
}
.form-success{
  color:var(--mint); font-size:13px; font-weight:600; background:rgba(127,209,185,0.1);
  border:1px solid rgba(127,209,185,0.3); border-radius:10px; padding:9px 12px;
}

.money-input{
  display:flex; align-items:center; background:var(--panel); border:1px solid var(--line);
  border-radius:12px; padding:0 14px; min-height:var(--tap); min-width:0;
}
.money-input:focus-within{border-color:var(--gold);}
.money-input > span{color:var(--muted); font-family:var(--mono);}
.money-input input{
  flex:1; min-width:0; background:transparent; border:none; padding:11px 8px; color:var(--text);
  font-family:var(--mono); min-height:var(--tap); width:100%;
}
.money-input input:focus{outline:none;}
.money-input.compact{min-height:40px; padding:0 10px;}
.money-input.compact input{padding:8px 6px; min-height:38px;}

.swatch-row{display:flex; gap:10px; flex-wrap:wrap;}
.swatch{
  width:38px; height:38px; border-radius:50%; border:2px solid transparent; padding:0;
  box-shadow:inset 0 0 0 1px rgba(0,0,0,0.15);
  transition:transform .12s ease, border-color .12s ease; flex-shrink:0;
}
.swatch.selected{border-color:var(--gold); box-shadow:0 0 0 3px rgba(232,184,75,0.2);}
.swatch:active{transform:scale(0.92);}
.swatch-sm{width:28px; height:28px;}
.option-row{display:flex; gap:8px; flex-wrap:wrap;}
.opt-btn{
  background:var(--panel); border:1px solid var(--line); color:var(--muted);
  border-radius:10px; padding:10px 14px; font-size:13px; font-weight:600; min-height:40px;
}
.opt-btn.selected{border-color:var(--mint); color:var(--text); background:var(--panel-2);}

.mini-check{display:flex; align-items:center; gap:7px; font-size:12.5px; color:var(--muted);}
.mini-check input, .toggle-row input{width:18px; height:18px; accent-color:var(--gold); flex-shrink:0; margin:0;}

.entry-tabs{display:flex; gap:4px; background:rgba(var(--overlay-rgb),0.05); padding:4px; border-radius:999px;}
.tab-btn{
  background:transparent; border:none; color:var(--muted); font-size:13px; font-weight:700;
  padding:9px 12px; border-radius:999px; flex:1; min-height:38px; white-space:nowrap;
}
.tab-btn.active{background:var(--panel-2); color:var(--text); box-shadow:0 0 0 1px var(--line);}

/* ===== Panels ===== */
.panel{
  background:linear-gradient(180deg, var(--panel-2), var(--panel));
  border:1px solid var(--line); border-radius:var(--radius); padding:22px 20px;
}
.panel h3{font-size:19px;}
.panel-head{display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; gap:10px;}
.panel-head h3{margin:0;}
.page-head{display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap;}
.page-head-actions{display:flex; gap:8px; align-items:center;}
.page-title{font-size:24px; margin:0;}

/* ===== The stage (avatar frame) ===== */
/* Ruled ledger paper behind the character, with a faint margin line */
.stage{
  position:relative; border-radius:22px; overflow:hidden; flex-shrink:0;
  border:1px solid var(--line);
  background:
    linear-gradient(90deg, transparent 12%, rgba(255,111,89,0.16) 12%, rgba(255,111,89,0.16) calc(12% + 1px), transparent calc(12% + 1px)),
    repeating-linear-gradient(0deg, transparent 0 17px, rgba(var(--overlay-rgb),0.05) 17px 18px),
    linear-gradient(180deg, var(--panel-2), var(--panel));
  --sh:240px;
  height:var(--sh); aspect-ratio:180 / 274; width:auto;
}
.stage::after{ /* floor */
  content:""; position:absolute; left:0; right:0; bottom:0; height:13%;
  background:linear-gradient(180deg, transparent, rgba(0,0,0,0.2)); pointer-events:none; z-index:0;
}
.stage-glow{position:absolute; inset:0; transition:background .4s ease; pointer-events:none;}
.avatar-mount{position:absolute; inset:2% 0 3% 0; z-index:1; transform-origin:50% 100%; will-change:transform;}
.avatar-mount svg{width:100%; height:100%; display:block; overflow:hidden;}
.stage-creator{--sh:min(400px, 50dvh); aspect-ratio:180 / 352;}
.stage-settings{--sh:280px;}
.stage-hero{--sh:244px; cursor:pointer; user-select:none; -webkit-user-select:none; -webkit-touch-callout:none;}
.stage-hero:focus-visible{outline-offset:3px;}
.stage-fx{position:absolute; inset:0; z-index:3; pointer-events:none; overflow:hidden;}

.level-badge{
  position:absolute; top:8px; right:8px; z-index:4;
  background:var(--gold); color:#22270F; font-family:var(--mono); font-weight:700; font-size:10.5px;
  padding:4px 8px; border-radius:999px; box-shadow:0 2px 8px rgba(0,0,0,0.25);
}
.level-badge.pop{animation:badgePop .55s cubic-bezier(.3,1.6,.5,1);}

/* Character reactions — tasteful, short, and skipped for reduced-motion users */
@keyframes fxMunch{
  0%{transform:scale(1,1);} 18%{transform:scale(1.09,.91);} 38%{transform:scale(.96,1.05);}
  58%{transform:scale(1.05,.96);} 78%{transform:scale(.99,1.01);} 100%{transform:scale(1,1);}
}
@keyframes fxHop{
  0%{transform:translateY(0);} 28%{transform:translateY(-9%) scale(.98,1.03);}
  52%{transform:translateY(0) scale(1.04,.96);} 72%{transform:translateY(-2.5%);} 100%{transform:translateY(0);}
}
@keyframes fxNod{
  0%,100%{transform:rotate(0);} 30%{transform:rotate(-2.4deg) translateY(1%);} 65%{transform:rotate(2deg);}
}
@keyframes fxShine{
  0%{filter:brightness(1);} 35%{filter:brightness(1.22) drop-shadow(0 0 10px rgba(232,184,75,.65));} 100%{filter:brightness(1);}
}
.avatar-mount.fx-munch{animation:fxMunch .8s ease-out;}
.avatar-mount.fx-hop{animation:fxHop .7s ease-out;}
.avatar-mount.fx-nod{animation:fxNod .7s ease-in-out;}
.avatar-mount.fx-shine{animation:fxShine .9s ease-out;}
@keyframes floatUp{
  0%{opacity:0; transform:translate(-50%, 6px) scale(.9);}
  15%{opacity:1; transform:translate(-50%, 0) scale(1);}
  100%{opacity:0; transform:translate(-50%, -46px) scale(1);}
}
.fx-float{
  position:absolute; left:50%; bottom:44%; transform:translateX(-50%);
  font-family:var(--mono); font-weight:700; font-size:12.5px; color:var(--gold);
  background:rgba(4,14,16,0.55); border:1px solid rgba(232,184,75,0.4);
  padding:2px 9px; border-radius:999px; white-space:nowrap;
  animation:floatUp 1.2s ease-out forwards;
}
@keyframes badgePop{0%{transform:scale(1);} 40%{transform:scale(1.35);} 100%{transform:scale(1);}}
@keyframes bubblePop{0%{transform:scale(.94); opacity:.4;} 60%{transform:scale(1.03);} 100%{transform:scale(1); opacity:1;}}
@keyframes barShine{0%{filter:brightness(1);} 40%{filter:brightness(1.6);} 100%{filter:brightness(1);}}

/* ===== Auth ===== */
.auth-wrap{
  max-width:420px; margin:0 auto; min-height:100vh; min-height:100dvh;
  display:flex; flex-direction:column; justify-content:center; gap:22px;
  padding:calc(28px + var(--sat)) max(20px, var(--sar)) calc(28px + var(--sab)) max(20px, var(--sal));
}
.auth-brand{display:flex; align-items:center; justify-content:center; gap:8px; font-family:var(--display); font-weight:600; font-size:24px;}
.brand-mark{color:var(--gold);}
.auth-card{
  background:linear-gradient(180deg, var(--panel-2), var(--panel)); border:1px solid var(--line);
  border-radius:var(--radius); padding:22px 20px; display:flex; flex-direction:column; gap:16px;
}
.auth-tabs{display:flex; gap:4px; background:rgba(var(--overlay-rgb),0.05); padding:4px; border-radius:999px;}
.auth-form{display:flex; flex-direction:column; gap:14px;}
.auth-note{font-size:12px; color:var(--muted); line-height:1.5;}

/* ===== Creator ===== */
.screen{width:100%; min-height:100vh; min-height:100dvh;}
.creator{display:flex; flex-direction:column; max-width:1180px; margin:0 auto; padding-bottom:calc(24px + var(--sab));}
.creator-preview{
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:12px;
  padding:calc(24px + var(--sat)) 20px 8px;
}
.creator-caption{color:var(--muted); font-size:13px; max-width:280px; text-align:center;}
.creator-controls{padding:20px max(18px, var(--sar)) 40px max(18px, var(--sal)); display:flex; flex-direction:column; gap:18px;}
.creator-controls h1{font-size:26px; line-height:1.18; margin-bottom:2px;}

/* ===== Setup ===== */
.setup{
  max-width:640px; margin:0 auto; display:flex; flex-direction:column; gap:18px;
  padding:calc(28px + var(--sat)) max(18px, var(--sar)) calc(48px + var(--sab)) max(18px, var(--sal));
}
.setup h1{font-size:26px;}
.setup-sub{color:var(--muted); font-size:14px; margin-top:-6px;}
.freq-field select{margin-top:2px;}
.paycheck-result{
  background:var(--panel); border:1px solid var(--mint); border-radius:14px; padding:14px 16px;
  display:flex; flex-direction:column; gap:8px;
}
.paycheck-result .pr-amount{font-family:var(--mono); font-size:22px; font-weight:700; color:var(--mint);}
.paycheck-result .pr-sub{font-size:12.5px; color:var(--muted);}

.alloc-mode-toggle{display:flex; gap:6px; align-self:flex-start;}
.mode-btn{
  background:var(--panel); border:1px solid var(--line); color:var(--muted); font-weight:700; font-size:13px;
  padding:7px 16px; border-radius:999px; min-height:36px;
}
.mode-btn.active{background:var(--panel-2); color:var(--gold); border-color:var(--gold);}
.alloc-grid{display:flex; flex-direction:column; gap:10px;}
.alloc-row{
  display:grid; grid-template-columns:minmax(74px,104px) minmax(0,1fr) 40px 28px; align-items:center; gap:10px;
  background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:10px 12px;
}
.alloc-row .cat-label{font-weight:700; font-size:13px; display:flex; align-items:center; flex-wrap:wrap; gap:2px 7px; min-width:0; overflow-wrap:anywhere;}
.alloc-row .savings-tag{margin-left:16px;}
.cat-dot{width:9px; height:9px; border-radius:50%; display:inline-block; flex-shrink:0;}
.alloc-row input[type="range"]{width:100%; margin:0; accent-color:var(--gold); min-height:var(--tap); touch-action:pan-y;}
.alloc-row .alloc-pct{font-family:var(--mono); text-align:right; font-size:13px;}
.alloc-del{background:none; border:none; color:var(--muted); font-size:20px; line-height:1; padding:4px; min-width:28px; min-height:36px;}
.alloc-del:active{color:var(--danger);}
.alloc-total{font-family:var(--mono); font-size:13px; color:var(--muted);}
.alloc-total strong{color:var(--text);}
.alloc-total.over strong{color:var(--danger);}
.alloc-total.ok strong{color:var(--mint);}
.savings-tag{font-size:9.5px; font-weight:700; color:var(--mint); background:rgba(127,209,185,0.12); padding:1px 6px; border-radius:999px; margin-left:4px;}
.add-cat-row{
  display:flex; flex-wrap:wrap; align-items:center; gap:10px;
  background:rgba(var(--overlay-rgb),0.03); border:1px dashed var(--line); border-radius:14px; padding:12px 14px;
}
.add-cat-row input[type="text"]{flex:1 1 150px; padding:9px 12px; min-height:40px;}

/* ===== Top bar ===== */
.topbar{
  position:sticky; top:0; z-index:20; display:flex; align-items:center; gap:12px;
  padding:calc(10px + var(--sat)) max(18px, var(--sar), calc((100vw - 1400px) / 2 + 18px)) 10px max(18px, var(--sal), calc((100vw - 1400px) / 2 + 18px));
  background:var(--bg); border-bottom:1px solid var(--line);
}
@supports (color: color-mix(in srgb, red 50%, blue)){
  .topbar{background:color-mix(in srgb, var(--bg) 86%, transparent); -webkit-backdrop-filter:blur(14px); backdrop-filter:blur(14px);}
}
.brand{display:flex; align-items:center; gap:7px; font-family:var(--display); font-weight:600; font-size:17px; margin-right:auto;}
.period-label{color:var(--muted); font-size:12px; font-family:var(--mono); display:none; margin-right:auto;}
.topbar-btn{
  display:inline-flex; align-items:center; gap:7px; min-height:40px; padding:0 15px 0 12px;
  background:rgba(232,184,75,0.12); border:1px solid rgba(232,184,75,0.5); color:var(--gold);
  border-radius:999px; font-weight:700; font-size:13.5px;
  transition:background .15s ease, transform .15s ease;
}
.topbar-icon{width:44px; padding:0; justify-content:center; background:rgba(var(--overlay-rgb),0.06); border-color:var(--line); color:var(--muted);}
.topbar-icon .ic{width:20px; height:20px;}
.topbar-icon:hover{color:var(--text);}
.topbar-btn:active{transform:scale(0.96); background:rgba(232,184,75,0.2);}
.topbar-btn .ic{width:18px; height:18px;}

/* ===== Page shell ===== */
.app-pages{
  max-width:1400px; margin:0 auto;
  padding:22px max(18px, var(--sar)) calc(132px + var(--sab)) max(18px, var(--sal));
}
.app-page{display:flex; flex-direction:column; gap:20px;}

/* ===== Dashboard layout ===== */
.dash{display:grid; grid-template-columns:minmax(0,1fr); gap:20px; align-items:start;}
.dash-side, .dash-main{min-width:0;}
.dash-main{display:flex; flex-direction:column; gap:20px;}
.dash-side{display:flex; flex-direction:column; gap:20px;}
.dash-cols{display:grid; grid-template-columns:minmax(0,1fr); gap:20px; align-items:start;}
.dash-col{display:flex; flex-direction:column; gap:20px; min-width:0;}

/* ---- Character hero ---- */
.char-hero{
  display:grid; gap:20px 18px; padding:22px 20px;
  grid-template-columns:auto minmax(0,1fr);
  grid-template-areas:"stage info" "meters meters" "badges badges";
}
.hero-stage-wrap{grid-area:stage;}
.hero-info{grid-area:info; min-width:0; display:flex; flex-direction:column; gap:9px; align-self:center;}
.char-hero .meters{grid-area:meters;}
.char-hero .badges-strip{grid-area:badges;}

.hero-name-row{display:flex; align-items:baseline; gap:8px; flex-wrap:wrap; min-width:0;}
.char-name{font-size:21px; line-height:1.15; overflow-wrap:anywhere;}
.level-title{font-family:var(--mono); font-size:10.5px; letter-spacing:.08em; text-transform:uppercase; color:var(--gold);}

.speech{
  position:relative; font-size:12.5px; line-height:1.35; color:var(--muted); min-height:36px;
  background:rgba(var(--overlay-rgb),0.05); border:1px solid var(--line); border-radius:12px; padding:8px 11px;
  transition:border-color .2s ease, color .2s ease, background .2s ease;
}
.speech::before{ /* tail pointing at the character */
  content:""; position:absolute; left:-6px; top:14px; width:10px; height:10px;
  background:var(--panel-2); border-left:1px solid var(--line); border-bottom:1px solid var(--line);
  transform:rotate(45deg); border-bottom-left-radius:2px; transition:border-color .2s ease;
}
.speech.is-reaction{color:var(--text); border-color:var(--gold); background:rgba(232,184,75,0.1);}
.speech.is-reaction::before{border-color:var(--gold); background:var(--panel);}
.speech.pop{animation:bubblePop .34s cubic-bezier(.3,1.5,.5,1);}

.xp-row{display:flex; align-items:center; gap:8px;}
.xp-track{flex:1; height:7px; border-radius:999px; background:rgba(var(--overlay-rgb),0.08); overflow:hidden;}
.xp-fill{height:100%; width:0; background:linear-gradient(90deg, var(--gold), var(--amber)); border-radius:999px; transition:width .6s cubic-bezier(.2,.8,.2,1);}
.xp-track.shine .xp-fill{animation:barShine .9s ease-out;}
.xp-label{font-family:var(--mono); font-size:10px; color:var(--muted); white-space:nowrap;}

.chip-row{display:flex; flex-wrap:wrap; gap:6px;}
.chip{
  display:inline-flex; align-items:center; gap:5px; font-size:11px; font-weight:700; white-space:nowrap;
  padding:4px 10px 4px 8px; border-radius:999px;
  background:rgba(var(--overlay-rgb),0.05); border:1px solid var(--line); color:var(--muted);
}
.chip{max-width:100%; min-width:0;}
.chip > span{overflow-wrap:anywhere;}
.chip .ic{width:13px; height:13px;}
.streak-chip{color:var(--amber);}
.fullness-chip{color:var(--text);}
.fullness-chip .ic{color:var(--mint);}

.meters{display:flex; flex-direction:column; gap:16px;}
.meter-head{display:flex; justify-content:space-between; font-size:14px; margin-bottom:8px;}
.meter-head em{color:var(--muted); font-style:normal;}
.meter-head span:last-child{font-family:var(--mono); font-weight:700;}
.meter-track{height:11px; border-radius:999px; background:rgba(var(--overlay-rgb),0.07); overflow:hidden;}
.meter-fill{height:100%; border-radius:999px; transition:width .5s cubic-bezier(.2,.8,.2,1);}
.fill-food{background:linear-gradient(90deg, var(--amber), #F7C687);}
.fill-morale{background:linear-gradient(90deg, var(--coral), #FF9C8B);}
.fill-resp{background:linear-gradient(90deg, var(--mint), #A9E8D4);}

.badges-strip{display:flex; flex-wrap:wrap; gap:8px; justify-content:center; padding-top:2px;}
.badge{
  width:34px; height:34px; border-radius:50%; padding:0; display:flex; align-items:center; justify-content:center;
  background:rgba(var(--overlay-rgb),0.04); border:1px solid var(--line); color:var(--muted); opacity:.5;
  transition:transform .12s ease;
}
.badge .ic{width:16px; height:16px;}
.badge:active{transform:scale(0.92);}
.badge.unlocked{opacity:1; color:var(--gold); border-color:var(--gold); background:rgba(232,184,75,0.1);}

/* ---- Remaining / quick actions ---- */
.widget-remaining{padding:24px 22px; display:flex; flex-direction:column; gap:14px;}
.remaining-top{display:flex; justify-content:space-between; align-items:baseline; gap:10px; font-size:14.5px; font-weight:600;}
.remaining-top span:last-child{font-family:var(--mono); font-weight:700; white-space:nowrap; font-size:17px;}
.widget-remaining.tight .remaining-top span:last-child{color:var(--amber);}
.widget-remaining.zero .remaining-top span:last-child{color:var(--danger);}
#remainingFill{background:var(--mint);}
.widget-remaining .cat-bar-track{height:14px;}
.income-chip{
  align-self:flex-start; font-family:var(--mono); font-size:11.5px; color:var(--muted);
  background:rgba(var(--overlay-rgb),0.04); padding:4px 10px; border-radius:999px; border:1px solid var(--line);
}
.quick-actions{display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px;}
.quick-action-btn{
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:7px; text-align:center;
  background:linear-gradient(180deg, var(--panel-2), var(--panel)); border:1px solid var(--line);
  border-radius:var(--radius-sm); padding:18px 6px; color:var(--text); font-size:13px; font-weight:700; min-height:96px;
  transition:transform .12s ease, border-color .15s ease;
}
.quick-action-btn .ic{width:26px; height:26px; color:var(--gold);}
.quick-action-btn:hover{border-color:var(--mint);}
.quick-action-btn:active{transform:scale(0.97);}

/* ---- Budget bars, lists ---- */
.cat-bars{display:flex; flex-direction:column; gap:18px;}
.cat-bar-row{display:flex; flex-direction:column; gap:6px;}
.cat-bar-top{display:flex; justify-content:space-between; font-size:14.5px; gap:8px; flex-wrap:wrap;}
.cat-bar-top .cat-label{display:flex; align-items:center; gap:7px; font-weight:600;}
.cat-bar-top .cat-nums{font-family:var(--mono); color:var(--muted); font-size:12px;}
.cat-bar-track{height:12px; border-radius:999px; background:rgba(var(--overlay-rgb),0.07); overflow:hidden;}
.cat-bar-fill{height:100%; border-radius:999px; transition:width .4s ease;}
.cat-bar-fill.over{background:var(--danger) !important;}

.tx-list, .bills-list{display:flex; flex-direction:column; gap:10px;}
.tx-row, .bill-row{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  background:rgba(var(--overlay-rgb),0.03); border:1px solid var(--line); border-radius:14px; padding:14px 14px;
}
.tx-left{display:flex; align-items:center; gap:10px; min-width:0;}
.tx-text{min-width:0;}
.tx-tag{width:8px; height:8px; border-radius:50%; flex-shrink:0;}
.tx-desc{font-size:15px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.tx-meta{font-size:12px; color:var(--muted); font-family:var(--mono);}
.tx-right{display:flex; align-items:center; gap:2px; flex-shrink:0;}
.tx-amount{font-family:var(--mono); font-weight:700; font-size:13.5px;}
.tx-empty{color:var(--muted); font-size:13.5px; text-align:center; padding:20px 0;}
.tx-del{background:none; border:none; color:var(--muted); font-size:22px; line-height:1; padding:0; border-radius:8px; min-width:40px; min-height:40px;}
.tx-del:active{color:var(--danger);}
.show-more-btn{align-self:center; margin-top:4px;}
.bill-row.paid{opacity:0.65;}
.bill-status{font-size:12px; color:var(--mint); font-weight:700; white-space:nowrap; display:inline-flex; align-items:center; gap:4px;}
.bill-status .ic{width:14px; height:14px;}
.recurring-check{margin-top:2px;}

/* ---- Goals ---- */
.goal-list{display:flex; flex-direction:column; gap:12px;}
.goal-empty{color:var(--muted); font-size:13px;}
.goal-row, .holding-row{
  background:rgba(var(--overlay-rgb),0.03); border:1px solid var(--line); border-radius:14px; padding:16px 16px;
  display:flex; flex-direction:column; gap:9px;
}
.goal-top{display:flex; justify-content:space-between; gap:8px; font-size:13.5px; font-weight:700;}
.goal-top span:first-child{min-width:0; overflow-wrap:anywhere;}
.goal-top span:last-child{flex-shrink:0;}
.goal-nums{color:var(--muted); font-family:var(--mono); font-size:11.5px;}
.goal-pace{font-size:12px; color:var(--amber); display:flex; align-items:center; gap:5px;}
.goal-pace.overdue{color:var(--danger);}
.goal-pace.hit{color:var(--mint);}
.goal-pace .ic{width:14px; height:14px;}
.goal-edit-btn, .holding-edit-btn{align-self:flex-end; margin-top:-4px;}

/* ---- Investments ---- */
.portfolio-summary{display:flex; flex-direction:column; gap:6px;}
.ps-row{display:flex; justify-content:space-between; align-items:baseline; gap:10px;}
.ps-label{font-size:12px; color:var(--muted); text-transform:uppercase; letter-spacing:.05em;}
.ps-value{font-family:var(--mono); font-size:22px; font-weight:700;}
.ps-sub{font-family:var(--mono); font-size:13px; font-weight:700;}
.ps-sub.up{color:var(--mint);} .ps-sub.down{color:var(--danger);}
.price-data-note{font-size:12px; color:var(--muted);}
.holdings-list{display:flex; flex-direction:column; gap:10px;}
.holding-top{display:flex; justify-content:space-between; align-items:baseline; gap:8px;}
.holding-top > div:first-child{min-width:0;}
.holding-ticker{font-weight:700; font-size:15px; overflow-wrap:anywhere;}
.holding-name{font-size:11.5px; color:var(--muted); overflow-wrap:anywhere;}
.holding-value{font-family:var(--mono); font-weight:700; font-size:14px; flex-shrink:0;}
.holding-meta{display:flex; justify-content:space-between; gap:8px; flex-wrap:wrap; font-size:12px; color:var(--muted); font-family:var(--mono);}
.holding-gain{font-weight:700;}
.holding-gain.up{color:var(--mint);} .holding-gain.down{color:var(--danger);}

/* ---- Insights ---- */
.custom-range-row{display:flex; align-items:center; gap:8px; flex-wrap:wrap;}
.custom-range-row input{width:auto; flex:1 1 130px; padding:8px 10px; min-height:40px;}
.custom-range-row span{color:var(--muted); font-size:13px;}
.stat-tiles{display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px;}
.stat-tile{
  background:rgba(var(--overlay-rgb),0.03); border:1px solid var(--line); border-radius:14px; padding:14px;
  display:flex; flex-direction:column; gap:4px; min-width:0;
}
.stat-label{font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:.06em;}
.stat-value{font-family:var(--mono); font-size:19px; font-weight:700; overflow-wrap:anywhere;}
.stat-delta{font-size:11.5px; font-family:var(--mono); color:var(--muted); margin-top:2px;}
.stat-delta.up{color:var(--amber);} .stat-delta.down{color:var(--mint);}
.analytics-charts-row{display:grid; grid-template-columns:minmax(0,1fr); gap:16px;}
.chart-card{
  background:linear-gradient(180deg, var(--panel-2), var(--panel)); border:1px solid var(--line);
  border-radius:var(--radius-sm); padding:14px; min-width:0;
}
.chart-card h4{font-size:13px; font-weight:700; margin-bottom:10px; color:var(--muted);}
.chart-box{position:relative; width:100%; height:220px;}
.chart-box canvas{display:block; max-width:100%;}

/* ---- Settings ---- */
.settings-grid{display:grid; grid-template-columns:minmax(0,1fr); gap:16px; align-items:start;}
.settings-stack{display:flex; flex-direction:column; gap:16px;}
.settings-grid .panel{display:flex; flex-direction:column; gap:12px;}
.settings-grid .panel > .panel-head{margin-bottom:0;}
.settings-hint{font-size:13px; color:var(--muted); line-height:1.5;}
.theme-grid{display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px;}
.theme-swatch{
  display:flex; flex-direction:column; align-items:center; gap:8px;
  background:var(--panel); border:2px solid var(--line); border-radius:var(--radius-sm); padding:10px; color:var(--text);
}
.theme-swatch.selected{border-color:var(--gold);}
.theme-preview{
  width:100%; height:44px; border-radius:10px; display:flex; align-items:flex-end; justify-content:center; gap:6px; padding-bottom:6px;
  border:1px solid rgba(var(--overlay-rgb),0.1);
}
.theme-preview span{width:14px; height:14px; border-radius:50%; display:inline-block; box-shadow:0 0 0 1.5px rgba(var(--overlay-rgb),0.15);}
.theme-name{font-size:12.5px; font-weight:700;}
.settings-avatar-preview{display:flex; justify-content:center;}
.avatar-editor{display:flex; flex-direction:column; gap:16px; padding-top:14px; border-top:1px solid var(--line);}
.settings-divider{height:1px; background:var(--line);}
.settings-btn-row{display:flex; gap:10px; flex-wrap:wrap;}
.settings-btn-row .btn-ghost{flex:1 1 130px;}
.password-editor{display:flex; flex-direction:column; gap:12px;}
.danger-zone h3{color:var(--danger);}

/* ===== Overlays ===== */
.modal{
  position:fixed; inset:0; z-index:80; background:rgba(4,12,14,0.72);
  -webkit-backdrop-filter:blur(3px); backdrop-filter:blur(3px);
  display:flex; align-items:flex-end; justify-content:center;
}
.modal-dialog{z-index:96;}
.modal-card{
  background:var(--panel-2); border:1px solid var(--line); border-bottom:none;
  border-top-left-radius:var(--radius); border-top-right-radius:var(--radius);
  padding:22px max(18px, var(--sar)) calc(18px + var(--sab)) max(18px, var(--sal));
  width:100%; max-width:520px;
  max-height:min(90vh, calc(var(--vvh, 100dvh) - 12px)); max-height:min(90dvh, calc(var(--vvh, 100dvh) - 12px));
  display:flex; flex-direction:column; gap:12px; overflow-y:auto; overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
}
.modal-wide{max-width:600px;}
.modal-sub{color:var(--muted); font-size:13px; line-height:1.45;}
.modal-actions{display:flex; flex-direction:column-reverse; gap:10px; margin-top:4px;}
.modal-actions .btn-ghost{width:100%; margin-right:0;}
.dialog-card{max-width:420px;}
.review-list{display:flex; flex-direction:column; gap:8px; overflow-y:auto; max-height:44vh; padding-right:2px; overscroll-behavior:contain;}
.review-row{
  display:grid; grid-template-columns:minmax(0,1fr) auto; grid-template-rows:auto auto; gap:6px 10px; align-items:center;
  background:var(--panel); border:1px solid var(--line); border-radius:10px; padding:10px 11px;
}
.review-row .rv-desc{font-size:13.5px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; grid-column:1; grid-row:1;}
.review-row .rv-amount{font-family:var(--mono); font-size:12.5px; color:var(--muted); grid-column:2; grid-row:1;}
.review-row select{grid-column:1; grid-row:2; min-height:40px; padding:8px 30px 8px 10px; border-radius:8px; background-color:var(--panel-2);}
.review-row .rv-remove{grid-column:2; grid-row:2; background:none; border:none; color:var(--muted); font-size:13px; font-weight:700; justify-self:end; padding:8px;}
.review-row .rv-remove:active{color:var(--danger);}

.sheet-backdrop{
  position:fixed; inset:0; z-index:78; background:rgba(2,6,7,0.55);
  display:flex; align-items:flex-end; justify-content:center; opacity:0; transition:opacity .22s ease;
}
.sheet-backdrop.show{opacity:1;}
.sheet{
  width:100%; max-width:520px; background:var(--panel-2); border:1px solid var(--line); border-bottom:none;
  border-top-left-radius:26px; border-top-right-radius:26px;
  padding:10px max(20px, var(--sar)) calc(20px + var(--sab)) max(20px, var(--sal));
  transform:translateY(100%); transition:transform .28s cubic-bezier(.2,.9,.25,1.05);
  display:flex; flex-direction:column; gap:12px;
  max-height:min(92vh, calc(var(--vvh, 100dvh) - 8px)); max-height:min(92dvh, calc(var(--vvh, 100dvh) - 8px));
  overflow-y:auto; overscroll-behavior:contain;
}
.sheet-backdrop.show .sheet{transform:translateY(0);}
.sheet-handle{width:38px; height:4px; background:var(--line); border-radius:999px; margin:6px auto 2px; flex-shrink:0;}
.sheet-head{display:flex; flex-direction:column; gap:10px;}
.sheet-head h3{font-size:19px;}
.entry-form{display:flex; flex-direction:column; gap:10px;}
.entry-form-row{display:flex; gap:10px;}
.entry-form-row .money-input, .entry-form-row select{flex:1 1 0; min-width:0;}
.upload-pane{display:flex; flex-direction:column; gap:14px;}
.dropzone{
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:6px; text-align:center;
  border:1.5px dashed var(--line); border-radius:16px; padding:26px 16px; cursor:pointer;
  transition:border-color .15s ease, background .15s ease;
}
.dropzone:active, .dropzone.drag{border-color:var(--mint); background:rgba(127,209,185,0.06);}
.dropzone-title{font-weight:700; font-size:14px;}
.dropzone-sub{color:var(--muted); font-size:12px; max-width:320px;}
.sheet-close-btn{width:100%;}

/* Toasts */
/* Toasts sit just above the nav pill so they never cover the character */
.toast-stack{
  position:fixed; bottom:calc(86px + var(--sab)); left:0; right:0; z-index:100;
  display:flex; flex-direction:column; align-items:center; gap:8px; padding:0 16px; pointer-events:none;
}
.toast{
  display:flex; align-items:center; gap:12px; max-width:min(400px, 100%);
  background:var(--panel-2); border:1px solid var(--line); color:var(--text); font-size:13px; font-weight:600; line-height:1.3;
  padding:10px 18px; border-radius:999px; box-shadow:0 12px 30px rgba(0,0,0,0.35); text-align:left;
  opacity:0; transform:translateY(14px) scale(0.96); transition:opacity .25s ease, transform .25s ease;
}
.toast.show{opacity:1; transform:translateY(0) scale(1);}
.toast.has-action{pointer-events:auto; padding-right:10px;}
.toast-action{background:none; border:none; color:var(--gold); font-weight:700; font-size:13px; padding:6px 10px; border-radius:999px; min-height:32px;}
.toast-achievement, .toast-stage{border-color:var(--gold); color:var(--gold);}
.toast-levelup{border-color:var(--mint); color:var(--mint);}
.toast-warn{border-color:var(--danger); color:var(--text);}

.migration-banner{
  position:fixed; top:0; left:0; right:0; z-index:95; background:var(--gold); color:#22270F;
  padding:calc(10px + var(--sat)) 16px 10px; font-size:13px; display:flex; align-items:center; justify-content:center;
  gap:10px 14px; flex-wrap:wrap; text-align:center;
}
.migration-actions{display:flex; gap:8px;}
.migration-banner .btn-ghost{color:#22270F; border-color:rgba(34,39,15,0.35);}

/* ===== Neo chat & journal ===== */
.chat-panel{
  position:fixed; left:0; right:0; top:var(--vvt, 0px); height:var(--vvh, 100dvh); z-index:84;
  background:var(--panel-2); display:flex; flex-direction:column;
}
.chat-head{
  display:flex; justify-content:space-between; align-items:center; flex-shrink:0;
  padding:14px max(14px, var(--sar)) 12px max(16px, var(--sal)); padding-top:calc(14px + var(--sat));
  border-bottom:1px solid var(--line); background:var(--panel);
}
.chat-title{font-family:var(--display); font-weight:600; font-size:17px;}
.chat-head-actions{display:flex; align-items:center; gap:2px;}
.chat-icon-btn{
  background:none; border:none; color:var(--muted); border-radius:10px;
  min-width:40px; min-height:40px; display:inline-flex; align-items:center; justify-content:center;
}
.chat-icon-btn .ic{width:20px; height:20px;}
.chat-icon-btn.active{color:var(--gold);}
.chat-messages{flex:1; min-height:0; overflow-y:auto; overscroll-behavior:contain; padding:14px max(16px, var(--sar)) 14px max(16px, var(--sal)); display:flex; flex-direction:column; gap:10px; -webkit-overflow-scrolling:touch;}
.chat-msg{max-width:86%; padding:10px 13px; border-radius:14px; font-size:14px; line-height:1.45; white-space:pre-line; overflow-wrap:anywhere;}
.chat-bot{align-self:flex-start; background:var(--panel); border:1px solid var(--line); border-bottom-left-radius:4px;}
.chat-user{align-self:flex-end; background:var(--gold); color:#22270F; font-weight:600; border-bottom-right-radius:4px;}
.chat-quick{display:flex; gap:8px; padding:0 max(16px, var(--sar)) 10px max(16px, var(--sal)); overflow-x:auto; flex-shrink:0; scrollbar-width:none;}
.chat-quick::-webkit-scrollbar{display:none;}
.chat-chip{
  flex-shrink:0; background:var(--panel); border:1px solid var(--line); color:var(--muted);
  font-size:12.5px; font-weight:600; padding:9px 14px; border-radius:999px; white-space:nowrap; min-height:38px;
}
.chat-chip:active{color:var(--text); border-color:var(--mint);}
.chat-input-row{
  display:flex; gap:8px; flex-shrink:0; border-top:1px solid var(--line); background:var(--panel);
  padding:10px max(14px, var(--sar)) calc(10px + var(--sab)) max(14px, var(--sal));
}
.chat-input-row input{
  flex:1; min-width:0; background:var(--bg); border:1px solid var(--line); border-radius:999px;
  padding:11px 16px; min-height:var(--tap);
}
.chat-input-row input:focus{outline:none; border-color:var(--gold);}
.chat-mic, .chat-send{
  width:var(--tap); height:var(--tap); border-radius:50%; flex-shrink:0; display:flex; align-items:center; justify-content:center; padding:0;
}
.chat-mic{border:1px solid var(--line); background:var(--bg); color:var(--muted);}
.chat-mic .ic, .chat-send .ic{width:20px; height:20px;}
.chat-mic.listening{background:var(--coral); color:#fff; border-color:var(--coral); animation:pulseMic 1s ease-in-out infinite;}
@keyframes pulseMic{0%,100%{box-shadow:0 0 0 0 rgba(255,111,89,0.5);} 50%{box-shadow:0 0 0 8px rgba(255,111,89,0);}}
.chat-send{border:none; background:var(--gold); color:#22270F;}
.chat-send .ic{stroke-width:2.6;}

.journal-body{flex:1; min-height:0; overflow-y:auto; overscroll-behavior:contain; padding:16px max(16px, var(--sar)) calc(16px + var(--sab)) max(16px, var(--sal)); display:flex; flex-direction:column; gap:12px;}
.toggle-row{display:flex; align-items:center; gap:10px; font-size:13px; color:var(--muted); cursor:pointer;}
#journalInput{
  width:100%; background:var(--panel); border:1px solid var(--line); border-radius:12px;
  padding:12px 14px; resize:vertical; min-height:100px;
}
#journalInput:focus{outline:none; border-color:var(--gold);}
.journal-list{display:flex; flex-direction:column; gap:10px;}
.journal-entry{background:rgba(var(--overlay-rgb),0.03); border:1px solid var(--line); border-radius:12px; padding:12px 14px;}
.journal-entry-head{display:flex; justify-content:space-between; align-items:center; margin-bottom:6px;}
.journal-entry-head span{font-family:var(--mono); font-size:11px; color:var(--muted);}
.journal-entry p{font-size:14px; line-height:1.45; white-space:pre-wrap; overflow-wrap:anywhere;}

/* ===== Bottom navigation: floating glass pill ===== */
.bottom-nav{
  position:fixed; left:max(12px, var(--sal)); right:max(12px, var(--sar)); bottom:calc(10px + var(--sab));
  max-width:520px; margin:0 auto; z-index:70;
  display:flex; align-items:center; gap:2px; padding:5px;
  background:
    linear-gradient(180deg, rgba(var(--overlay-rgb),0.10), rgba(var(--overlay-rgb),0) 45%),
    var(--glass-bg);
  -webkit-backdrop-filter:blur(26px) saturate(200%); backdrop-filter:blur(26px) saturate(200%);
  border:1px solid var(--glass-border); border-radius:999px;
  box-shadow:0 18px 44px rgba(0,0,0,0.38), inset 0 1px 0 var(--glass-highlight);
  touch-action:none; user-select:none; -webkit-user-select:none;
  transition:transform .38s cubic-bezier(.34,1.56,.64,1), opacity .25s ease, box-shadow .3s ease;
}
.nav-indicator{
  position:absolute; top:5px; bottom:5px; left:5px; width:70px; border-radius:999px;
  background:linear-gradient(180deg, rgba(var(--overlay-rgb),0.16), rgba(var(--overlay-rgb),0.06));
  box-shadow:inset 0 1px 0 var(--glass-highlight), 0 2px 10px rgba(0,0,0,0.15);
  transition:left .42s cubic-bezier(.34,1.56,.64,1), width .42s cubic-bezier(.34,1.56,.64,1);
  z-index:0; pointer-events:none;
}
.nav-btn{
  position:relative; z-index:1; flex:1; min-width:0; background:none; border:none;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px;
  padding:8px 2px; border-radius:999px; color:var(--muted); min-height:54px;
  transition:color .25s ease, transform .18s cubic-bezier(.3,1.5,.5,1);
}
.nav-btn:active{transform:scale(0.92);}
.nav-icon{width:21px; height:21px; opacity:.75; transition:transform .3s cubic-bezier(.34,1.56,.64,1), opacity .2s ease;}
.nav-label{font-size:10px; font-weight:700; opacity:.85; max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.nav-btn.active{color:var(--text);}
.nav-btn.active .nav-icon{opacity:1; transform:translateY(-1px) scale(1.1);}
.nav-btn.drag-over .nav-icon{transform:translateY(-3px) scale(1.2); opacity:1;}
.bottom-nav.dragging{transform:scale(1.015); box-shadow:0 24px 50px rgba(0,0,0,0.45), inset 0 1px 0 var(--glass-highlight);}
.bottom-nav.dragging .nav-indicator{transition-duration:.1s;}

/* ===================================================================== */
/* ===== Small phones (iPhone SE / mini, 320–375) ===== */
@media (max-width:380px){
  .xs-hide{display:none;}
  .app-pages{padding-left:max(12px, var(--sal)); padding-right:max(12px, var(--sar));}
  .char-hero{padding:14px; gap:12px 12px;}
  .stage-hero{--sh:212px;}
  .char-name{font-size:19px;}
  .speech{font-size:12px; padding:7px 9px;}
  .panel{padding:15px;}
  .quick-action-btn{font-size:12px; min-height:88px;}
  .alloc-row{grid-template-columns:minmax(64px,88px) minmax(0,1fr) 36px 26px; gap:8px; padding:9px 10px;}
  .nav-label{font-size:9.5px;}
  .creator-controls h1, .setup h1{font-size:23px;}
}
@media (min-width:391px) and (max-width:719px){
  .stage-hero{--sh:252px;}
}

/* ===== Big phones landscape / small tablets ===== */
@media (min-width:600px){
  .modal{align-items:center; padding:20px;}
  .modal-card{border:1px solid var(--line); border-radius:var(--radius); max-height:min(86vh, 760px); max-height:min(86dvh, 760px);}
  .modal-actions{flex-direction:row; justify-content:flex-end;}
  .modal-actions .btn-ghost, .modal-actions .btn-primary{width:auto;}
  .sheet-backdrop{align-items:center; padding:20px;}
  .sheet{border:1px solid var(--line); border-radius:26px; padding-bottom:20px; transform:translateY(24px) scale(.98); opacity:0; transition:transform .25s ease, opacity .22s ease;}
  .sheet-backdrop.show .sheet{transform:none; opacity:1;}
  .sheet-head{flex-direction:row; align-items:center; justify-content:space-between;}
  .sheet-head .entry-tabs{width:auto; min-width:250px;}
  .sheet-handle{display:none;}
  .entry-form{flex-direction:row; flex-wrap:wrap; align-items:center;}
  .entry-form > input[type="text"]{flex:1 1 100%;}
  .entry-form .entry-form-row{flex:1 1 100%;}
  .entry-form .btn-primary{width:100%;}
  .review-row{grid-template-columns:minmax(0,1fr) auto minmax(150px,200px) auto; grid-template-rows:auto;}
  .review-row .rv-desc, .review-row .rv-amount, .review-row select, .review-row .rv-remove{grid-row:1;}
  .review-row .rv-amount{grid-column:2;} .review-row select{grid-column:3;} .review-row .rv-remove{grid-column:4;}

  /* Neo becomes a floating window under the top bar instead of taking over the screen */
  .chat-panel{
    left:auto; right:16px; top:calc(64px + var(--sat)); height:min(620px, calc(100dvh - 92px));
    width:400px; border:1px solid var(--line); border-radius:var(--radius); overflow:hidden;
    box-shadow:0 24px 60px rgba(0,0,0,0.45);
  }
  .chat-head{padding-top:14px;}
  .stat-tiles{grid-template-columns:repeat(4,minmax(0,1fr));}
  .theme-grid{grid-template-columns:repeat(4,minmax(0,1fr));}
  .period-label{display:inline;}
  .brand{margin-right:0;}
  .topbar{gap:14px;}
  .topbar .period-label{margin-right:auto;}
  .creator-preview, .creator-controls{padding-left:32px; padding-right:32px;}
}
@media (max-width:599px){
  .bottom-nav.nav-hidden{transform:translateY(140%); opacity:0; pointer-events:none;}
}

/* ===== Tablet portrait: hero becomes a wide banner with a large avatar ===== */
@media (min-width:720px){
  .app-pages{padding-top:28px;}
  .char-hero{
    grid-template-columns:auto minmax(0,1fr); gap:16px 28px; padding:24px;
    grid-template-areas:"stage info" "stage meters" "stage badges";
  }
  .stage-hero{--sh:340px;}
  .hero-info{align-self:end;}
  .char-hero .meters{align-self:start;}
  .char-hero .badges-strip{justify-content:flex-start; align-self:start;}
  .dash-cols{grid-template-columns:repeat(2,minmax(0,1fr));}
  .panel{padding:26px;}
  .settings-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
  .analytics-charts-row{grid-template-columns:repeat(2,minmax(0,1fr));}
  .goal-list-full{display:grid; grid-template-columns:repeat(auto-fill, minmax(300px,1fr)); gap:14px;}
  .holdings-list{display:grid; grid-template-columns:repeat(auto-fill, minmax(280px,1fr)); gap:14px;}
  .creator{flex-direction:row; align-items:stretch;}
  .creator-preview{flex:1; padding-top:48px; position:sticky; top:0; align-self:flex-start; height:100vh; height:100dvh; justify-content:center;}
  .creator-controls{flex:1.1; padding-top:56px; padding-bottom:56px; justify-content:center;}
  .creator-controls h1{font-size:32px;}
  .setup{padding-top:56px;}
  .setup h1{font-size:30px;}
  .stage-creator{--sh:min(560px, 74dvh);}
}

/* ===== Desktop: avatar gets its own column at the top-left ===== */
@media (min-width:1000px){
  .dash{grid-template-columns:420px minmax(0,1fr); gap:26px;}
  .dash-side{position:sticky; top:calc(78px + var(--sat)); max-height:calc(100dvh - 100px - var(--sat)); overflow-y:auto; scrollbar-width:none; padding-bottom:4px;}
  .dash-side::-webkit-scrollbar{display:none;}
  .char-hero{
    grid-template-columns:minmax(0,1fr); grid-template-areas:"stage" "info" "meters" "badges";
    gap:16px; padding:22px; justify-items:stretch;
  }
  .hero-stage-wrap{justify-self:center;}
  .stage-hero{--sh:min(430px, 54dvh);}
  .hero-info{align-self:stretch; align-items:center; text-align:center;}
  .hero-name-row{justify-content:center;}
  .speech{width:100%; text-align:center;}
  .speech::before{left:50%; top:-6px; margin-left:-5px; border-left:1px solid var(--line); border-top:1px solid var(--line); border-bottom:none; border-bottom-left-radius:0; border-top-left-radius:2px;}
  .speech.is-reaction::before{border-color:var(--gold);}
  .xp-row{width:100%;}
  .chip-row{justify-content:center;}
  .char-hero .badges-strip{justify-content:center;}
  .dash-cols{gap:24px;}
  .dash-col{gap:24px;}
  .dash-main{gap:24px;}
  .dash-side{gap:24px;}
  .tx-list{max-height:640px; overflow-y:auto; padding-right:2px;}
}
@media (min-width:1000px){
  /* keep the fixed-height sticky column from clipping the shadow */
  .char-hero{box-shadow:0 10px 30px rgba(0,0,0,0.12);}
}

/* ===== Landscape phones: short viewports ===== */
@media (max-height:480px) and (orientation:landscape){
  .creator-preview{position:static; height:auto;}
  .chat-panel{top:var(--vvt, 0px); height:var(--vvh, 100dvh); right:0; left:0; width:auto; border-radius:0; border:none;}
  .app-pages{padding-bottom:calc(84px + var(--sab));}
  .bottom-nav .nav-label{display:none;}
  .nav-btn{min-height:44px;}
}

/* ===== Respect reduced-motion preferences ===== */
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.01ms !important; animation-iteration-count:1 !important; transition-duration:.01ms !important; scroll-behavior:auto !important;}
}

/* =====================================================================
   v2 additions: Neo, income, journal, import, roomier layout
   ===================================================================== */

/* ---- Neo orb (the advisor's face) ---- */
.neo-orb{
  position:relative; display:inline-flex; align-items:center; justify-content:center; flex-shrink:0;
  width:44px; height:44px; border-radius:50%;
  box-shadow:0 0 0 3px rgba(127,209,185,0.16), 0 6px 18px rgba(127,209,185,0.28);
}
.neo-orb .neo-svg{width:100%; height:100%; display:block;}
.neo-orb-lg{width:52px; height:52px;}
.neo-orb-sm{width:30px; height:30px; box-shadow:0 0 0 2px rgba(127,209,185,0.16);}
@keyframes neoPulse{0%,100%{box-shadow:0 0 0 3px rgba(127,209,185,0.16), 0 6px 18px rgba(127,209,185,0.28);} 50%{box-shadow:0 0 0 7px rgba(127,209,185,0.08), 0 8px 24px rgba(127,209,185,0.4);}}
.neo-card .neo-orb-lg, .nav-neo .neo-orb{animation:neoPulse 3.6s ease-in-out infinite;}

/* ---- Neo card on the dashboard ---- */
.neo-card{display:flex; flex-direction:column; gap:16px;}
.neo-head{display:flex; align-items:center; gap:14px;}
.neo-head-text{flex:1; min-width:0;}
.neo-head-text h3{font-size:20px; line-height:1.1;}
.neo-sub{font-size:13px; color:var(--muted); margin-top:3px;}
.neo-insights{display:flex; flex-direction:column; gap:10px;}
.neo-insight{
  display:grid; grid-template-columns:auto minmax(0,1fr) auto; gap:12px; align-items:start;
  background:rgba(var(--overlay-rgb),0.04); border:1px solid var(--line); border-radius:14px; padding:13px 14px;
}
.neo-insight p{font-size:14px; line-height:1.45;}
.neo-insight-icon{width:30px; height:30px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center; background:rgba(var(--overlay-rgb),0.06); color:var(--muted);}
.neo-insight-icon .ic{width:16px; height:16px;}
.neo-insight.tone-warn{border-color:rgba(228,99,78,0.45); background:rgba(228,99,78,0.07);}
.neo-insight.tone-warn .neo-insight-icon{background:rgba(228,99,78,0.16); color:var(--danger);}
.neo-insight.tone-good .neo-insight-icon{background:rgba(127,209,185,0.16); color:var(--mint);}
.neo-insight.tone-tip .neo-insight-icon{background:rgba(232,184,75,0.16); color:var(--gold);}
.neo-insight.tone-info .neo-insight-icon{color:var(--mint);}
.neo-act{background:transparent; border:1px solid var(--line); color:var(--mint); font-weight:700; font-size:12px; border-radius:999px; padding:7px 12px; min-height:34px; white-space:nowrap;}
.neo-act:active{border-color:var(--mint);}
.neo-ask{display:flex; gap:8px; align-items:center; background:var(--bg); border:1px solid var(--line); border-radius:999px; padding:5px 5px 5px 18px;}
.neo-ask:focus-within{border-color:var(--gold);}
.neo-ask input{flex:1; min-width:0; background:transparent; border:none; color:var(--text); padding:10px 0; min-height:44px;}
.neo-ask input:focus{outline:none;}
.neo-ask-send{width:44px; height:44px; border-radius:50%; border:none; background:var(--gold); color:#22270F; display:flex; align-items:center; justify-content:center; flex-shrink:0; padding:0;}
.neo-ask-send .ic{width:20px; height:20px; stroke-width:2.6;}
.neo-chips{display:flex; gap:8px; flex-wrap:wrap;}

/* live Neo check inside the add-expense form */
.neo-check{display:flex; gap:10px; align-items:flex-start; background:rgba(127,209,185,0.08); border:1px solid rgba(127,209,185,0.3); border-radius:14px; padding:11px 12px;}
.neo-check p{font-size:13px; line-height:1.45;}
.neo-check.tone-warn{background:rgba(228,99,78,0.08); border-color:rgba(228,99,78,0.4);}
.neo-check.tone-tip{background:rgba(232,184,75,0.08); border-color:rgba(232,184,75,0.4);}
.neo-check.tone-good{background:rgba(127,209,185,0.12);}
.neo-inline-card, .neo-reflect{display:flex; gap:12px; align-items:flex-start; background:linear-gradient(180deg,var(--panel-2),var(--panel)); border:1px solid var(--line); border-radius:var(--radius-sm); padding:16px;}
.neo-inline-card strong, .neo-reflect strong{font-size:13px; color:var(--mint); display:block; margin-bottom:3px;}
.neo-inline-card p, .neo-reflect p{font-size:14px; line-height:1.5;}
.neo-inline:empty{display:none;}

/* ---- bottom nav: Neo sits in the middle, raised ---- */
.nav-neo{
  position:relative; z-index:2; flex:0 0 70px; background:none; border:none; color:var(--text);
  display:flex; flex-direction:column; align-items:center; justify-content:flex-end; gap:2px; padding:0 0 6px; min-height:54px;
  transition:transform .18s cubic-bezier(.3,1.5,.5,1);
}
.nav-neo .neo-orb{width:52px; height:52px; margin-top:-26px; border:3px solid var(--bg);}
.nav-neo .nav-label{opacity:1; color:var(--mint);}
.nav-neo:active{transform:scale(0.92);}
.bottom-nav{max-width:560px;}
.bottom-nav .nav-btn{min-height:58px;}

/* ---- remaining card extras ---- */
.remaining-foot{display:flex; justify-content:space-between; align-items:center; gap:10px; flex-wrap:wrap;}
.remaining-hint{font-size:13px; color:var(--muted);}
.panel-meta{font-family:var(--mono); font-size:12px; color:var(--muted);}

/* ---- 14-day pulse ---- */
.pulse{display:grid; grid-template-columns:repeat(14,minmax(0,1fr)); gap:6px; align-items:end;}
.pulse-col{display:flex; flex-direction:column; align-items:center; justify-content:flex-end; gap:6px; height:140px;}
.pulse-bar{width:100%; max-width:22px; max-height:calc(100% - 22px); border-radius:6px 6px 3px 3px; background:linear-gradient(180deg,var(--mint),rgba(127,209,185,0.35)); min-height:4px; transition:height .5s ease;}
.pulse-col.today .pulse-bar{background:linear-gradient(180deg,var(--gold),rgba(232,184,75,0.4));}
.pulse-day{font-size:10px; color:var(--muted); font-family:var(--mono);}

/* ---- income ---- */
.income-summary{display:flex; flex-direction:column; gap:14px; margin-bottom:14px;}
.income-figures{display:grid; grid-template-columns:1fr 1fr; gap:14px;}
.income-figures > div{display:flex; flex-direction:column; gap:4px; min-width:0;}
.income-big{font-family:var(--mono); font-size:20px; font-weight:700;}
.income-big.plan{color:var(--muted); font-size:17px;}
.income-big .link-btn{font-size:12px; padding:2px 6px; min-height:0;}
.income-next{display:flex; align-items:flex-start; gap:8px; font-size:13.5px; background:rgba(127,209,185,0.08); border:1px solid rgba(127,209,185,0.28); border-radius:12px; padding:10px 12px;}
.income-next .ic{width:18px; height:18px; color:var(--mint); margin-top:1px;}
.income-next em{font-style:normal; color:var(--muted);}
.income-base{margin-top:2px;}
.income-list{display:flex; flex-direction:column; gap:10px;}
.income-row{display:grid; grid-template-columns:auto minmax(0,1fr) auto auto; gap:12px; align-items:center; background:rgba(var(--overlay-rgb),0.03); border:1px solid var(--line); border-radius:14px; padding:12px 12px;}
.income-row.paused{opacity:.55;}
.income-icon{width:34px; height:34px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center; background:rgba(127,209,185,0.14); color:var(--mint);}
.income-icon .ic{width:17px; height:17px;}
.income-amount{font-family:var(--mono); font-weight:700; font-size:14px; color:var(--mint); white-space:nowrap;}
.income-empty{display:flex; flex-direction:column; gap:12px; align-items:flex-start; color:var(--muted); font-size:14px; line-height:1.5;}
.tx-tag.income{width:30px; height:30px; border-radius:50%; background:rgba(127,209,185,0.16); color:var(--mint); display:inline-flex; align-items:center; justify-content:center;}
.tx-tag.income .ic{width:15px; height:15px;}
.tx-amount.plus{color:var(--mint);}
.tx-row.income{border-color:rgba(127,209,185,0.3); background:rgba(127,209,185,0.05);}
.stat-value.pos{color:var(--mint);} .stat-value.neg{color:var(--coral);}
.entry-hint{font-size:12.5px; color:var(--muted); line-height:1.45;}
.entry-hint:empty{display:none;}

/* ---- moods, tags ---- */
.mood-row{display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:8px;}
.mood-btn{
  display:flex; flex-direction:column; align-items:center; gap:5px; padding:10px 2px 8px; border-radius:14px;
  background:rgba(var(--overlay-rgb),0.04); border:1px solid var(--line); color:var(--muted); font-size:11px; font-weight:700; min-height:60px;
  transition:transform .12s ease, border-color .15s ease, color .15s ease;
}
.mood-btn .ic{width:24px; height:24px;}
.mood-btn:active{transform:scale(0.94);}
.mood-btn.selected{border-color:var(--mood); color:var(--mood); background:rgba(var(--overlay-rgb),0.07);}
.tag-row{display:flex; flex-wrap:wrap; gap:8px;}
.tag-chip{display:inline-flex; align-items:center; gap:5px; font-size:12.5px; font-weight:600; padding:8px 13px; border-radius:999px; border:1px solid var(--line); background:transparent; color:var(--muted); min-height:36px;}
.tag-chip .ic{width:14px; height:14px;}
.tag-chip.selected{border-color:var(--gold); color:var(--gold); background:rgba(232,184,75,0.1);}
.tag-chip.static{min-height:0; padding:4px 10px; font-size:11.5px; cursor:default;}
.tag-chip.linked{color:var(--mint); border-color:rgba(127,209,185,0.4);}

/* ---- journal card on dashboard ---- */
.journal-card{display:flex; flex-direction:column; gap:14px;}
.journal-card .panel-head{margin-bottom:0;}
.journal-card-prompt{font-family:var(--display); font-size:17px; line-height:1.4;}
.jc-last{display:flex; gap:12px; align-items:flex-start; background:rgba(var(--overlay-rgb),0.03); border:1px solid var(--line); border-radius:14px; padding:12px 13px;}
.jc-last .ic{width:22px; height:22px; margin-top:2px;}
.jc-last p{font-size:13.5px; line-height:1.45; color:var(--muted);}
.jc-empty{font-size:13.5px; color:var(--muted);}

/* ---- journal panel ---- */
.journal-panel{position:fixed; inset:0; z-index:86; background:rgba(4,12,14,0.72); -webkit-backdrop-filter:blur(3px); backdrop-filter:blur(3px); display:flex; align-items:stretch; justify-content:center;}
.jp-card{
  width:100%; max-width:760px; background:var(--panel-2); display:flex; flex-direction:column; overflow:hidden;
  height:var(--vvh, 100dvh); margin-top:var(--vvt, 0px);
}
.jp-head{display:flex; align-items:center; justify-content:space-between; padding:calc(14px + var(--sat)) max(14px, var(--sar)) 8px max(18px, var(--sal));}
.jp-title{display:flex; align-items:center; gap:10px;}
.jp-title .ic{width:24px; height:24px; color:var(--gold);}
.jp-title h2{font-size:24px;}
.jp-head-actions{display:flex; gap:2px;}
.jp-tabs{margin:4px max(18px, var(--sar)) 12px max(18px, var(--sal)); flex-shrink:0;}
.jp-body{flex:1; min-height:0; overflow-y:auto; overscroll-behavior:contain; padding:6px max(18px, var(--sar)) calc(28px + var(--sab)) max(18px, var(--sal)); -webkit-overflow-scrolling:touch;}
.jp-pane{display:flex; flex-direction:column; gap:18px;}
.jp-prompt{display:flex; gap:12px; align-items:flex-start; background:rgba(127,209,185,0.08); border:1px solid rgba(127,209,185,0.3); border-radius:var(--radius-sm); padding:14px;}
.jp-prompt p{flex:1; font-family:var(--display); font-size:17px; line-height:1.4;}
#journalInput{min-height:170px; font-size:16px; line-height:1.55;}
.jp-write-foot{display:flex; align-items:center; justify-content:space-between; gap:12px;}
.jp-count{font-family:var(--mono); font-size:12px; color:var(--muted);}
.jp-search{display:flex; align-items:center; gap:10px; background:var(--panel); border:1px solid var(--line); border-radius:999px; padding:0 16px;}
.jp-search .ic{width:18px; height:18px; color:var(--muted);}
.jp-search input{flex:1; min-width:0; background:transparent; border:none; color:var(--text); padding:12px 0; min-height:var(--tap);}
.jp-search input:focus{outline:none;}
.jp-day{font-family:var(--mono); font-size:11.5px; letter-spacing:.08em; text-transform:uppercase; color:var(--muted); padding-top:8px;}
.journal-entry{padding:15px 16px; display:flex; flex-direction:column; gap:10px;}
.journal-entry.pinned{border-color:rgba(232,184,75,0.5);}
.journal-entry-head{margin-bottom:0;}
.je-meta{display:inline-flex; align-items:center; gap:8px; font-family:var(--mono); font-size:12px; color:var(--muted);}
.je-mood .ic{width:20px; height:20px;}
.je-tags{display:flex; flex-wrap:wrap; gap:6px;}
.je-text{font-size:15px; line-height:1.55; white-space:pre-wrap; overflow-wrap:anywhere; cursor:pointer;}
.je-text.clamp{display:-webkit-box; -webkit-line-clamp:4; -webkit-box-orient:vertical; overflow:hidden;}
.je-actions{display:flex; gap:6px; justify-content:flex-end; border-top:1px solid var(--line); padding-top:6px;}
.je-actions .link-btn{font-size:12.5px;}
.je-pin.active{color:var(--gold);}
.jp-tiles{grid-template-columns:repeat(2,minmax(0,1fr));}
.mood-bars{display:grid; grid-template-columns:repeat(14,minmax(0,1fr)); gap:6px; align-items:end; height:96px;}
.mood-bar{height:100%; display:flex; align-items:flex-end;}
.mood-bar-fill{display:block; width:100%; border-radius:5px 5px 2px 2px; transition:height .4s ease;}
.mood-spend-row{display:grid; grid-template-columns:1fr auto auto; gap:12px; align-items:center; padding:9px 0; border-bottom:1px solid var(--line); font-size:14px;}
.mood-spend-row:last-of-type{border-bottom:none;}
.mono{font-family:var(--mono); font-weight:700;}
.jp-insight{font-size:13.5px; line-height:1.5; color:var(--muted); margin-top:8px;}
.chat-id{display:flex; align-items:center; gap:12px;}
.chat-id > div{display:flex; flex-direction:column; line-height:1.15;}
.chat-id .neo-orb{width:38px; height:38px;}
.chat-subtitle{font-size:11.5px; color:var(--muted); margin-top:2px;}

/* ---- import ---- */
.dropzone-icon{width:52px; height:52px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center; background:rgba(232,184,75,0.12); color:var(--gold); margin-bottom:4px;}
.dropzone-icon .ic{width:26px; height:26px;}
.scan-progress{display:flex; flex-direction:column; gap:8px; background:rgba(127,209,185,0.07); border:1px solid rgba(127,209,185,0.3); border-radius:14px; padding:14px;}
.scan-progress-top{display:flex; justify-content:space-between; font-size:13.5px; font-weight:600;}
.scan-progress-top span:last-child{font-family:var(--mono);}
.scan-status{font-size:13.5px; color:var(--mint); padding:2px 2px;}
.import-tips{margin:0; padding:0 0 0 18px; color:var(--muted); font-size:12.5px; line-height:1.55; display:flex; flex-direction:column; gap:4px;}
.review-list{max-height:52vh;}
.rv-row{
  display:grid; grid-template-columns:auto minmax(0,1fr) minmax(104px,128px); grid-template-areas:"chk desc money" "chk date kind" "chk cat cat" "flag flag flag";
  gap:8px 10px; align-items:center; background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:12px;
}
.rv-row.off{opacity:.45;}
.rv-row.income{border-color:rgba(127,209,185,0.4);}
.rv-check{grid-area:chk; display:flex; align-items:center;}
.rv-check input{width:22px; height:22px; accent-color:var(--gold);}
.rv-desc{grid-area:desc;} .rv-money{grid-area:money;} .rv-date{grid-area:date;} .rv-kind{grid-area:kind;} .rv-cat{grid-area:cat;}
.rv-row input[type="text"], .rv-row input[type="date"], .rv-row select{background:var(--panel-2); border:1px solid var(--line); border-radius:10px; padding:9px 10px; color:var(--text); min-height:42px; width:100%; min-width:0;}
.rv-row select{padding-right:30px !important;}
.rv-row .rv-money{min-height:42px; background:var(--panel-2);}
.rv-flag{grid-area:flag; font-size:12px; font-weight:700; color:var(--amber);}
.review-raw{font-size:12.5px; color:var(--muted);}
.review-raw summary{cursor:pointer; padding:6px 0;}
.review-raw pre{white-space:pre-wrap; font-family:var(--mono); font-size:11.5px; max-height:160px; overflow:auto; background:var(--bg); border:1px solid var(--line); border-radius:10px; padding:10px; margin:6px 0 0;}
@media (min-width:600px){
  .rv-row{grid-template-columns:auto minmax(0,1.6fr) 118px 140px 116px; grid-template-areas:"chk desc money date kind" "chk cat cat cat cat" "flag flag flag flag flag";}
  .rv-row .rv-cat{grid-column:2 / -1;}
  .journal-panel{padding:24px;}
  .jp-card{height:min(860px, calc(100dvh - 48px)); margin-top:0; border-radius:var(--radius); border:1px solid var(--line);}
}

/* ---- hero: character portrait beside her stats on phones ---- */
.hero-info{gap:12px;}
.speech{font-size:13.5px; padding:10px 12px; min-height:44px;}
.chip{font-size:12px; padding:6px 11px 6px 9px; white-space:normal; line-height:1.25;}
.char-name{font-size:23px;}
.badge{width:38px; height:38px;}
.badge .ic{width:18px; height:18px;}
.badges-strip{gap:10px;}
.xp-track{height:9px;}

/* ---- tall phones (19.5:9): use the vertical room ---- */
@media (max-width:719px) and (min-height:760px){
  .app-pages{padding-top:26px;}
  .char-hero{padding:24px 20px; gap:24px 18px;}
  .stage-hero{--sh:238px;}
  .neo-card{padding:24px 20px;}
  .journal-card{padding:24px 20px;}
  .widget-remaining{padding:26px 22px;}
  .quick-action-btn{min-height:100px;}
}
@media (max-width:380px){ .stage-hero{--sh:216px;} .quick-actions{gap:8px;} .mood-btn{font-size:10px;} }
@media (min-width:720px){ .neo-insights{gap:12px;} .stat-tiles.jp-tiles{grid-template-columns:repeat(4,minmax(0,1fr));} }
@media (min-width:1000px){
  .neo-card, .journal-card{padding:26px;}
  .nav-neo .neo-orb{width:56px; height:56px; margin-top:-30px;}
}
@media (max-height:480px) and (orientation:landscape){ .nav-neo .neo-orb{width:44px; height:44px; margin-top:-16px;} .nav-neo .nav-label{display:none;} }

/* ---- desktop: Neo takes the top of the main column, character stays pinned on the left ---- */
@media (min-width:1000px){
  .dash{grid-template-columns:420px minmax(0,1fr); grid-template-areas:"hero neo" "hero main"; column-gap:26px; row-gap:24px;}
  .dash-side{display:contents;}
  .char-hero{grid-area:hero; position:sticky; top:calc(78px + var(--sat)); align-self:start; max-height:calc(100dvh - 100px - var(--sat)); overflow-y:auto; scrollbar-width:none;}
  .char-hero::-webkit-scrollbar{display:none;}
  .neo-card{grid-area:neo;}
  .dash-main{grid-area:main;}
  .neo-card .neo-insights{display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); align-items:stretch;}
  .neo-card .neo-insight{grid-template-columns:auto minmax(0,1fr); align-content:start;}
  .neo-card .neo-act{grid-column:1 / -1; justify-self:start;}
}
