/* ============================================================
   GrowthEngine — design system
   Orange #F26B1D · Black #111 · Green #1E9E5A · dark + light
   ============================================================ */

:root {
    /* brand */
    --brand: #F26B1D;
    --brand-2: #FF8A3D;
    --brand-deep: #C9530E;
    --green: #1E9E5A;
    --green-2: #34C77B;
    --danger: #E5484D;
    --danger-2: #FF6B6B;
    --amber: #F5A623;

    --radius: 22px;
    --radius-sm: 14px;
    --radius-pill: 999px;
    --gutter: 18px;
    --maxw: 460px;

    --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --ease: cubic-bezier(.22,1,.36,1);
    --shadow-soft: 0 10px 30px -12px rgba(0,0,0,.45);
    --shadow-lift: 0 18px 45px -15px rgba(0,0,0,.55);
}

/* ---------- DARK (default) ---------- */
:root, [data-theme="dark"] {
    --bg: #0E0F12;
    --bg-grad-1: #16110C;
    --bg-grad-2: #0B0C0F;
    --surface: rgba(28,29,34,.72);
    --surface-solid: #1A1B20;
    --surface-2: rgba(255,255,255,.04);
    --border: rgba(255,255,255,.08);
    --border-strong: rgba(255,255,255,.14);
    --text: #F4F5F7;
    --text-dim: #A7ABB4;
    --text-faint: #6E727B;
    --brand-on: #1A1206;
    --glass-blur: 18px;
    color-scheme: dark;
}

/* ---------- LIGHT ---------- */
[data-theme="light"] {
    --bg: #F6F7F9;
    --bg-grad-1: #FFF3EA;
    --bg-grad-2: #F1F3F6;
    --surface: rgba(255,255,255,.82);
    --surface-solid: #FFFFFF;
    --surface-2: rgba(17,17,17,.03);
    --border: rgba(17,17,17,.08);
    --border-strong: rgba(17,17,17,.14);
    --text: #14151A;
    --text-dim: #565A63;
    --text-faint: #8A8F98;
    --brand-on: #FFFFFF;
    --glass-blur: 16px;
    color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    transition: background .4s var(--ease), color .25s var(--ease);
}

/* ambient brand glow behind everything */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(120% 80% at 85% -10%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 60%),
        radial-gradient(90% 60% at -10% 0%, color-mix(in srgb, var(--green) 12%, transparent), transparent 55%),
        linear-gradient(160deg, var(--bg-grad-1), var(--bg-grad-2) 45%);
    transition: background .5s var(--ease);
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

#app { display: block; }

/* ---------- App shell ---------- */
.shell {
    max-width: var(--maxw);
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 0 var(--gutter) 120px;
    position: relative;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 2px 12px;
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar::before {
    content:"";
    position:absolute; inset:-22px -40px 0; z-index:-1;
    background: linear-gradient(var(--bg), transparent);
    pointer-events:none;
}
.brand-mark {
    display: flex; align-items: center; gap: 10px;
    font-weight: 800; letter-spacing: -.02em; font-size: 1.15rem;
}
.brand-logo {
    width: 34px; height: 34px; border-radius: 11px;
    background: linear-gradient(145deg, var(--brand-2), var(--brand-deep));
    display: grid; place-items: center;
    box-shadow: 0 6px 16px -4px color-mix(in srgb, var(--brand) 60%, transparent);
    color: #fff; font-weight: 900;
}
.brand-mark small { color: var(--green-2); font-weight: 700; }

.icon-btn {
    width: 42px; height: 42px; border-radius: 13px;
    display: grid; place-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    backdrop-filter: blur(var(--glass-blur));
    transition: transform .25s var(--ease), background .25s;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- Greeting / hero ---------- */
.greeting { margin: 6px 2px 18px; }
.greeting .hi { font-size: 1.7rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.greeting .sub { color: var(--text-dim); margin-top: 4px; font-size: .92rem; }

/* ---------- Hero balance card ---------- */
.hero {
    position: relative;
    border-radius: var(--radius);
    padding: 22px;
    color: #fff;
    background: linear-gradient(135deg, var(--brand-2), var(--brand-deep) 90%);
    box-shadow: var(--shadow-lift), inset 0 1px 0 rgba(255,255,255,.25);
    overflow: hidden;
    isolation: isolate;
}
.hero::after {
    content:""; position:absolute; z-index:-1; inset:0;
    background:
       radial-gradient(70% 90% at 100% 0%, rgba(255,255,255,.30), transparent 55%),
       radial-gradient(60% 80% at 0% 100%, rgba(0,0,0,.25), transparent 60%);
}
.hero .label { font-size: .8rem; opacity: .9; font-weight: 600; letter-spacing: .02em; }
.hero .amount { font-size: 2.35rem; font-weight: 800; letter-spacing: -.03em; margin: 4px 0 2px; }
.hero .amount .cur { font-size: 1rem; font-weight: 700; opacity: .85; margin-right: 6px; vertical-align: super; }
.hero-row { display: flex; gap: 12px; margin-top: 18px; }
.hero-chip {
    flex: 1; background: rgba(255,255,255,.16);
    border: 1px solid rgba(255,255,255,.22);
    border-radius: var(--radius-sm); padding: 10px 12px;
    backdrop-filter: blur(6px);
}
.hero-chip .k { font-size: .72rem; opacity: .9; display:flex; align-items:center; gap:5px; }
.hero-chip .v { font-size: 1.05rem; font-weight: 800; margin-top: 3px; }

/* ---------- Stat grid ---------- */
.section-title {
    display:flex; align-items:center; justify-content: space-between;
    margin: 26px 2px 12px; font-weight: 800; letter-spacing: -.02em; font-size: 1.05rem;
}
.section-title a { color: var(--brand-2); font-size: .82rem; font-weight: 700; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    box-shadow: var(--shadow-soft);
    transition: transform .3s var(--ease), border-color .3s;
}
.card:active { transform: scale(.985); }
.stat .ico {
    width: 38px; height: 38px; border-radius: 11px; display:grid; place-items:center; margin-bottom: 10px;
}
.stat .ico svg { width: 19px; height: 19px; }
.ico.green { background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green-2); }
.ico.orange { background: color-mix(in srgb, var(--brand) 18%, transparent); color: var(--brand-2); }
.ico.red { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger-2); }
.ico.blue { background: color-mix(in srgb, #4f8cff 18%, transparent); color: #6fa0ff; }
.stat .k { color: var(--text-dim); font-size: .78rem; font-weight: 600; }
.stat .v { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; }
.stat .v.pos { color: var(--green-2); }
.stat .v.neg { color: var(--danger-2); }

/* ---------- Activity feed ---------- */
.feed { display: flex; flex-direction: column; gap: 8px; }
.feed-item {
    display: flex; align-items: center; gap: 13px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    backdrop-filter: blur(var(--glass-blur));
    animation: rise .5s var(--ease) both;
}
.feed-item .badge {
    width: 40px; height: 40px; border-radius: 12px; flex: 0 0 auto;
    display: grid; place-items: center; font-size: 1.1rem;
}
.feed-item .meta { flex: 1; min-width: 0; }
.feed-item .meta .t { font-weight: 700; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-item .meta .s { color: var(--text-faint); font-size: .76rem; margin-top: 2px; }
.feed-item .val { font-weight: 800; font-size: .95rem; white-space: nowrap; }
.val.in { color: var(--green-2); }
.val.out { color: var(--text); }

.b-expense { background: color-mix(in srgb, var(--danger) 16%, transparent); }
.b-income  { background: color-mix(in srgb, var(--green) 18%, transparent); }
.b-debt    { background: color-mix(in srgb, var(--brand) 18%, transparent); }
.b-note    { background: color-mix(in srgb, #4f8cff 16%, transparent); }

/* ---------- Mic / voice FAB + bottom nav ---------- */
.navbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    height: 92px;
    display: flex; align-items: center; justify-content: center;
    pointer-events: none;
}
.nav-inner {
    pointer-events: auto;
    width: min(var(--maxw), calc(100% - 28px));
    height: 64px; margin-bottom: 16px;
    display: flex; align-items: center; justify-content: space-around;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    box-shadow: var(--shadow-lift);
    position: relative;
}
.nav-link {
    flex: 1; display: grid; place-items: center; gap: 3px;
    color: var(--text-faint); font-size: .64rem; font-weight: 700;
    transition: color .2s;
}
.nav-link svg { width: 22px; height: 22px; }
.nav-link.active { color: var(--brand-2); }
.nav-spacer { width: 74px; }

.mic {
    position: absolute; left: 50%; top: -26px; transform: translateX(-50%);
    width: 66px; height: 66px; border-radius: 50%;
    background: linear-gradient(145deg, var(--brand-2), var(--brand-deep));
    display: grid; place-items: center;
    box-shadow: 0 14px 30px -8px color-mix(in srgb, var(--brand) 70%, transparent),
                inset 0 1px 0 rgba(255,255,255,.4);
    transition: transform .25s var(--ease);
}
.mic:active { transform: translateX(-50%) scale(.9); }
.mic svg { width: 28px; height: 28px; color: #fff; }
.mic .ring {
    position: absolute; inset: 0; border-radius: 50%;
    border: 2px solid var(--brand-2);
}
.mic.listening .ring { animation: pulse 1.6s var(--ease) infinite; }
.mic.listening .ring:nth-child(2) { animation-delay: .5s; }
.mic.listening { animation: micglow 1.6s ease-in-out infinite; }

@keyframes pulse {
    0% { transform: scale(1); opacity: .7; }
    100% { transform: scale(2.1); opacity: 0; }
}
@keyframes micglow {
    0%,100% { box-shadow: 0 14px 30px -8px color-mix(in srgb, var(--brand) 70%, transparent); }
    50% { box-shadow: 0 14px 46px -4px color-mix(in srgb, var(--brand) 95%, transparent); }
}

/* ---------- Quick actions ---------- */
.quick { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin-top: 4px; }
.quick button {
    display: grid; place-items: center; gap: 6px;
    padding: 14px 4px; border-radius: var(--radius-sm);
    background: var(--surface); border: 1px solid var(--border);
    backdrop-filter: blur(var(--glass-blur));
    font-size: .68rem; font-weight: 700; color: var(--text-dim);
    transition: transform .2s var(--ease), border-color .2s;
}
.quick button:active { transform: scale(.93); }
.quick .qi { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.quick .qi svg { width: 20px; height: 20px; }

/* ---------- Sheet / modal ---------- */
.scrim {
    position: fixed; inset: 0; z-index: 60;
    background: rgba(0,0,0,.55); backdrop-filter: blur(3px);
    animation: fade .25s ease both;
    display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
    width: 100%; max-width: var(--maxw);
    background: var(--surface-solid);
    border: 1px solid var(--border-strong);
    border-radius: 26px 26px 0 0;
    padding: 10px 20px calc(28px + env(safe-area-inset-bottom));
    box-shadow: 0 -20px 60px -20px rgba(0,0,0,.6);
    animation: slideup .35s var(--ease) both;
    max-height: 88dvh; overflow-y: auto;
}
.sheet .grip { width: 42px; height: 5px; border-radius: 99px; background: var(--border-strong); margin: 8px auto 14px; }
.sheet h3 { margin: 0 0 16px; font-size: 1.2rem; font-weight: 800; letter-spacing: -.02em; }

/* domain picker */
.picker {
    width: 100%; max-width: var(--maxw);
    background: var(--surface-solid);
    border: 1px solid var(--border-strong);
    border-radius: 26px 26px 0 0;
    padding: 10px 20px calc(26px + env(safe-area-inset-bottom));
    box-shadow: 0 -20px 60px -20px rgba(0,0,0,.6);
    animation: slideup .38s var(--ease) both;
}
.picker .grip { width: 42px; height: 5px; border-radius: 99px; background: var(--border-strong); margin: 8px auto 14px; }
.picker h3 { margin: 0 0 16px; font-size: 1.2rem; font-weight: 800; letter-spacing: -.02em; text-align: center; }
.picker-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.picker-tile {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    padding: 20px 10px; border-radius: var(--radius-sm);
    background: var(--surface-2); border: 1px solid var(--border);
    font-weight: 800; font-size: .95rem; color: var(--text);
    transition: transform .18s var(--ease), border-color .18s, background .18s;
}
.picker-tile:active { transform: scale(.94); }
.picker-tile:hover { border-color: var(--brand-2); }
.pt-ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; }
.pt-ico svg { width: 24px; height: 24px; }
.picker-tile span:last-child { letter-spacing: -.01em; }
.picker .btn-ghost { display: flex; align-items: center; justify-content: center; }
/* tile icon tints reuse .red/.green/.orange/.blue mixers */
.pt-ico.red { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger-2); }
.pt-ico.green { background: color-mix(in srgb, var(--green) 20%, transparent); color: var(--green-2); }
.pt-ico.orange { background: color-mix(in srgb, var(--brand) 20%, transparent); color: var(--brand-2); }
.pt-ico.blue { background: color-mix(in srgb, #4f8cff 18%, transparent); color: #6fa0ff; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: .78rem; font-weight: 700; color: var(--text-dim); margin-bottom: 7px; }
.field input, .field select, .field textarea {
    width: 100%; padding: 13px 14px;
    background: var(--surface-2); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 1rem; font-family: inherit;
    transition: border-color .2s, background .2s;
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--brand-2);
    background: color-mix(in srgb, var(--brand) 8%, var(--surface-2));
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    padding: 9px 14px; border-radius: var(--radius-pill);
    background: var(--surface-2); border: 1px solid var(--border);
    font-size: .82rem; font-weight: 700; color: var(--text-dim);
    transition: all .2s var(--ease);
}
.chip.sel { background: var(--brand); border-color: var(--brand); color: var(--brand-on); }
.seg { display:flex; gap:8px; }
.seg .chip { flex:1; text-align:center; }

.btn {
    width: 100%; padding: 15px; border-radius: var(--radius-sm);
    font-weight: 800; font-size: 1rem; letter-spacing: -.01em;
    transition: transform .2s var(--ease), filter .2s;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 18px; height: 18px; vertical-align: -3px; }
.btn-primary { background: linear-gradient(135deg, var(--brand-2), var(--brand-deep)); color: #fff; box-shadow: 0 12px 26px -10px color-mix(in srgb,var(--brand) 70%,transparent); }
.btn-ghost { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
.btn-green { background: linear-gradient(135deg, var(--green-2), var(--green)); color: #06281A; }

/* ---------- misc ---------- */
.empty { text-align:center; color: var(--text-faint); padding: 30px 10px; font-size: .9rem; }
.skeleton {
    background: linear-gradient(90deg, var(--surface-2), color-mix(in srgb,var(--text) 8%,transparent), var(--surface-2));
    background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: var(--radius-sm);
}
.tag { font-size:.68rem; font-weight:800; padding:3px 8px; border-radius:99px; }
.tag.overdue { background: color-mix(in srgb,var(--danger) 20%,transparent); color: var(--danger-2); }
.tag.settled { background: color-mix(in srgb,var(--green) 20%,transparent); color: var(--green-2); }
.tag.partial { background: color-mix(in srgb,var(--amber) 22%,transparent); color: var(--amber); }

.fade-in { animation: rise .5s var(--ease) both; }
@keyframes rise { from { opacity:0; transform: translateY(10px); } to { opacity:1; transform:none; } }
@keyframes fade { from{opacity:0} to{opacity:1} }
@keyframes slideup { from{ transform: translateY(100%);} to{ transform:none;} }
@keyframes shimmer { to { background-position: -200% 0; } }

/* page-load progress (blazor) */
.loading-shell { display:grid; place-items:center; min-height:100dvh; gap:18px; }
.loading-shell .brand-logo { width:60px; height:60px; border-radius:20px; font-size:1.6rem; animation: micglow 1.6s ease-in-out infinite; }
.loading-shell p { color: var(--text-dim); font-weight:600; }

/* ---------- Conversation / capture screen ---------- */
.ministats {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
    margin: 4px 0 8px;
}
.ministat {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 14px; padding: 9px 8px; backdrop-filter: blur(var(--glass-blur));
    display: flex; flex-direction: column; gap: 3px; min-width: 0;
}
.ministat .ml { font-size: .6rem; color: var(--text-faint); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ministat .mv { font-size: .82rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ministat .mv.pos { color: var(--green-2); }
.ministat .mv.neg { color: var(--danger-2); }

/* notes: document studio */
.studio-banner {
    width: 100%; display: flex; align-items: center; gap: 13px; text-align: left;
    border: 1px solid color-mix(in srgb, var(--brand) 28%, transparent); border-radius: 16px;
    padding: 14px 16px; cursor: pointer;
    background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 14%, transparent), color-mix(in srgb, var(--green) 8%, transparent));
}
.studio-banner .sb-ico {
    flex: 0 0 auto; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--brand-2), var(--brand-deep)); color: #fff;
}
.studio-banner .sb-ico svg { width: 20px; height: 20px; }
.studio-banner .sb-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.studio-banner .sb-title { font-weight: 800; font-size: .98rem; }
.studio-banner .sb-sub { color: var(--text-dim); font-size: .82rem; line-height: 1.35; }
.studio-banner .sb-chev { color: var(--brand-2); font-weight: 800; font-size: 1.2rem; }

.note-hint { color: var(--text-faint); font-size: .78rem; font-weight: 700; margin: 14px 2px 0; }
.note-pick { cursor: pointer; transition: background .15s, border-color .15s; }
.note-pick.sel { border-color: var(--brand) !important; background: color-mix(in srgb, var(--brand) 10%, transparent); }

.float-cta { position: sticky; bottom: 88px; margin-top: 14px; box-shadow: 0 10px 30px -8px color-mix(in srgb, var(--brand) 60%, transparent); }

.sheet.studio { max-height: 86dvh; overflow-y: auto; }
.studio-note { color: var(--text-dim); font-size: .9rem; margin: -4px 0 14px; }
.studio-label { display: block; font-size: .82rem; font-weight: 700; color: var(--text-dim); margin-bottom: 8px; }
.doc-preview {
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px;
    padding: 16px 18px; max-height: 46dvh; overflow-y: auto; margin-bottom: 12px;
}
.doc-preview .dp-h1 { font-weight: 800; font-size: 1.1rem; margin: 0 0 10px; }
.doc-preview .dp-h2 { font-weight: 800; font-size: .95rem; margin: 14px 0 6px; }
.doc-preview .dp-p { margin: 0 0 10px; line-height: 1.5; font-size: .92rem; }
.doc-preview .dp-bullet { margin: 0 0 5px 6px; line-height: 1.45; font-size: .92rem; }
.doc-preview .dp-sub { font-size: .92rem; color: var(--text-dim); font-style: italic; margin: 0 0 12px; }
.doc-preview .dp-table { width: 100%; border-collapse: collapse; margin: 6px 0 12px; font-size: .86rem; }
.doc-preview .dp-table td { border: 1px solid var(--border); padding: 5px 8px; }
.doc-preview .dp-table tr:first-child td { font-weight: 700; background: color-mix(in srgb, var(--brand) 8%, transparent); }
.doc-tip { font-size: .8rem; color: var(--text-dim); margin-bottom: 12px; }
.doc-tip span { color: var(--brand-2); font-weight: 700; }
.wallet-chip { display: inline-block; font-size: .8rem; font-weight: 700; color: var(--text-dim);
    background: var(--surface-2); border: 1px solid var(--border); padding: 4px 11px; border-radius: 99px; margin-bottom: 10px; }
.wallet-chip strong { color: var(--green-2); }
.topup-card { margin-top: 14px; padding: 14px; border-radius: 14px;
    border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
    background: color-mix(in srgb, var(--danger) 7%, transparent); }
.file-input { font-size: .82rem; color: var(--text-dim); width: 100%; }
/* auth (login / sign-up gate) */
.auth-splash { min-height: 100dvh; display: grid; place-items: center; }
.brand-logo.big { width: 56px; height: 56px; font-size: 1.6rem; border-radius: 16px; display: grid; place-items: center; }
.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px 18px; }
.auth-card { width: 100%; max-width: 380px; background: var(--surface-solid);
    border: 1px solid var(--border-strong); border-radius: 22px; padding: 24px 20px;
    box-shadow: var(--shadow-soft); }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 20px; }
.auth-title { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; }
.auth-title small { font-weight: 600; color: var(--text-dim); }
.auth-sub { color: var(--text-dim); font-size: .9rem; margin-bottom: 14px; line-height: 1.45; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0 14px; color: var(--text-dim); font-size: .8rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border-strong); }
.g-btn { display: flex; justify-content: center; margin-bottom: 10px; min-height: 40px; }
.fb-btn { background: #1877F2; color: #fff; display: flex; align-items: center; justify-content: center; gap: 8px; }
.fb-btn .fb-f { font-weight: 900; font-family: Georgia, serif; }

.intake-card { margin-top: 14px; padding: 14px; border-radius: 14px;
    border: 1px solid var(--border-strong); background: var(--surface-2); }
.intake-q { margin: 0 0 12px; padding-left: 18px; }
.intake-q li { font-size: .9rem; color: var(--text); margin: 4px 0; line-height: 1.4; }
.file-input::file-selector-button {
    background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
    border-radius: 9px; padding: 6px 12px; font-weight: 700; margin-right: 10px; cursor: pointer; }
.img-preview { display: block; max-width: 140px; max-height: 70px; object-fit: contain;
    background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 4px; margin-bottom: 8px; }

/* stats: category bars + coach */
.bar-row { margin: 12px 0; }
.bar-row:first-child { margin-top: 4px; }
.bar-head { display: flex; justify-content: space-between; font-size: .86rem; font-weight: 700; margin-bottom: 6px; }
.bar-head span:last-child { color: var(--text-dim); font-weight: 600; }
.bar-track { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.coach-note {
    font-size: .96rem; line-height: 1.55; color: var(--text);
    background: color-mix(in srgb, var(--brand) 6%, transparent);
    border: 1px solid color-mix(in srgb, var(--brand) 16%, transparent);
    border-radius: 14px; padding: 14px 16px;
}
.coach-note p:last-child { margin-bottom: 0 !important; }

/* intro */
.intro {
    text-align: center; padding: 26px 8px 10px;
    display: flex; flex-direction: column; align-items: center; gap: 14px;
    min-height: 56dvh; justify-content: center;
}
.intro-orb {
    width: 96px; height: 96px; border-radius: 50%;
    background: linear-gradient(145deg, var(--brand-2), var(--brand-deep));
    display: grid; place-items: center; color: #fff;
    box-shadow: 0 18px 44px -10px color-mix(in srgb, var(--brand) 65%, transparent),
                inset 0 1px 0 rgba(255,255,255,.4);
    animation: micglow 2.4s ease-in-out infinite;
}
.intro-orb svg { width: 40px; height: 40px; }
.intro-title { font-size: 1.7rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; }
.intro-sub { color: var(--text-dim); font-size: .95rem; max-width: 300px; line-height: 1.5; }
.intro-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 320px; margin-top: 6px; }
.intro-actions .btn { display: flex; align-items: center; justify-content: center; }
.intro-badge {
    margin-top: 6px; font-size: .72rem; font-weight: 700; color: var(--text-faint);
    background: var(--surface-2); border: 1px solid var(--border);
    padding: 5px 12px; border-radius: 99px;
}

/* chat thread */
.chat {
    display: flex; flex-direction: column; gap: 12px;
    padding: 8px 2px 20px;
    min-height: 40dvh;
}
.bubble-row { display: flex; gap: 9px; align-items: flex-end; }
.bubble-row.me { justify-content: flex-end; }
.bubble-ava {
    width: 30px; height: 30px; flex: 0 0 auto; border-radius: 50%;
    background: color-mix(in srgb, var(--brand) 16%, transparent); color: var(--brand-2);
    display: grid; place-items: center;
}
.bubble-ava svg { width: 16px; height: 16px; }
.bubble {
    max-width: 78%; padding: 11px 15px; font-size: .95rem; line-height: 1.45;
    border-radius: 20px; animation: rise .35s var(--ease) both;
}
.bubble.ai {
    background: var(--surface-solid); border: 1px solid var(--border);
    border-bottom-left-radius: 7px; color: var(--text);
}
.bubble.me {
    background: linear-gradient(135deg, var(--brand-2), var(--brand-deep)); color: #fff;
    border-bottom-right-radius: 7px;
    box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--brand) 55%, transparent);
}
.bubble.typing { display: flex; gap: 4px; padding: 14px 16px; }
.bubble.typing span {
    width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint);
    animation: blink 1.2s infinite both;
}
.bubble.typing span:nth-child(2) { animation-delay: .2s; }
.bubble.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,80%,100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.confirm-card { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 0 39px; }
.confirm-actions { display: flex; gap: 10px; }
.confirm-actions .btn { flex: 1; display: flex; align-items: center; justify-content: center; }
.ended { display: flex; justify-content: center; margin: 14px 0 4px; }
.ended .btn { display: inline-flex; align-items: center; justify-content: center; width: auto; padding: 12px 22px; }

/* composer (fixed above nav) */
.composer {
    position: fixed; left: 0; right: 0; bottom: 92px; z-index: 35;
    max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter);
}
.composer::before {
    content: ""; position: absolute; inset: -24px 0 0; z-index: -1;
    background: linear-gradient(transparent, var(--bg) 55%); pointer-events: none;
}
.interim {
    background: color-mix(in srgb, var(--brand) 12%, var(--surface-solid));
    border: 1px solid var(--brand-2); color: var(--text);
    border-radius: 14px; padding: 8px 13px; margin-bottom: 8px;
    font-size: .9rem; font-style: italic;
}
.micerror {
    background: color-mix(in srgb, var(--danger) 14%, var(--surface-solid));
    border: 1px solid var(--danger-2); color: var(--text);
    border-radius: 14px; padding: 9px 13px; margin-bottom: 8px;
    font-size: .82rem; line-height: 1.4;
}
.linklike {
    background: none; border: none; padding: 0; margin-top: 4px;
    color: var(--brand); font-size: .78rem; cursor: pointer; text-align: left;
}
.linklike:hover { text-decoration: underline; }

/* ---- Calendar ---- */
.cal-card {
    background: var(--surface-solid); border: 1px solid var(--border-strong);
    border-radius: 18px; padding: 14px 12px 10px; box-shadow: var(--shadow-soft);
}
.cal-head { display: flex; align-items: center; justify-content: space-between; margin: 2px 4px 12px; }
.cal-title { font-size: 1.15rem; font-weight: 800; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-btn {
    border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
    border-radius: 999px; padding: 5px 12px; font-size: .78rem; font-weight: 600; cursor: pointer;
}
.cal-btn:active { transform: scale(.96); }
.cal-arrow {
    width: 32px; height: 32px; display: grid; place-items: center; cursor: pointer;
    border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); border-radius: 50%;
}
.cal-arrow svg { width: 18px; height: 18px; }
.cal-weekdays {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
    margin-bottom: 4px;
}
.cal-weekdays div {
    text-align: center; font-size: .68rem; font-weight: 700; letter-spacing: .04em;
    text-transform: uppercase; color: var(--text-dim); padding: 4px 0;
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-day {
    position: relative; aspect-ratio: 1 / 1; border: none; background: transparent; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; padding-top: 5px; gap: 2px;
    border-radius: 12px; color: var(--text); transition: background .12s ease;
}
.cal-day:hover { background: var(--surface-2); }
.cal-day .num {
    width: 28px; height: 28px; line-height: 28px; text-align: center; border-radius: 50%;
    font-size: .86rem; font-weight: 600;
}
.cal-day.muted .num { color: var(--text-dim); opacity: .45; }
.cal-day.sel { background: var(--surface-2); outline: 1.5px solid var(--brand); }
.cal-day.today .num { background: var(--brand); color: var(--brand-on); font-weight: 800; }
.cal-dots { position: absolute; bottom: 5px; display: flex; gap: 3px; }
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.dot.debt-due { background: #f59e0b; }
.dot.reminder { background: #10b981; }
.dot.my-reminder { background: var(--brand); }
.dot.period   { background: #8b5cf6; }

.cal-day-head {
    display: flex; align-items: center; justify-content: space-between;
    margin: 20px 4px 10px; font-weight: 800; font-size: 1rem;
}
.cal-day-head .cal-btn { display: inline-flex; align-items: center; gap: 5px; }
.cal-day-head .cal-btn svg { width: 15px; height: 15px; }
.cal-badge {
    flex: 0 0 auto; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
    font-size: 1rem; background: var(--surface-2);
}
.cal-badge.debt-due { background: color-mix(in srgb, #f59e0b 22%, var(--surface-solid)); }
.cal-badge.reminder { background: color-mix(in srgb, #10b981 22%, var(--surface-solid)); }
.cal-badge.my-reminder { background: color-mix(in srgb, var(--brand) 22%, var(--surface-solid)); }
.cal-badge.period   { background: color-mix(in srgb, #8b5cf6 22%, var(--surface-solid)); }
.cal-legend {
    display: flex; gap: 16px; justify-content: center; flex-wrap: wrap;
    margin: 18px 0 8px; color: var(--text-dim); font-size: .78rem;
}
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.composer-bar {
    display: flex; gap: 8px; align-items: center;
    background: var(--surface-solid); border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill); padding: 6px 6px 6px 8px;
    box-shadow: var(--shadow-soft);
}
.composer-input {
    flex: 1; border: none; background: transparent; color: var(--text);
    font-size: .95rem; font-family: inherit; padding: 8px 6px; outline: none;
}
.composer-send {
    width: 40px; height: 40px; flex: 0 0 auto; border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-2), var(--brand-deep)); color: #fff;
    display: grid; place-items: center; transition: transform .2s var(--ease), opacity .2s;
}
.composer-send:disabled { opacity: .4; }
.composer-send:active { transform: scale(.9); }
.composer-send svg { width: 18px; height: 18px; }
.composer-mode {
    width: 38px; height: 38px; flex: 0 0 auto; border-radius: 50%;
    display: grid; place-items: center; color: var(--text-dim);
    background: var(--surface-2);
    transition: transform .2s var(--ease), color .2s, background .2s;
}
.composer-mode.on { color: var(--brand); background: color-mix(in srgb, var(--brand) 14%, transparent); }
.composer-mode:active { transform: scale(.9); }
.composer-mode svg { width: 18px; height: 18px; }

/* settings toggle */
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.setting-title { font-weight: 700; }
.setting-sub { color: var(--text-faint); font-size: .8rem; margin-top: 2px; }
.toggle {
    width: 52px; height: 30px; border-radius: 99px; flex: 0 0 auto;
    background: var(--surface-2); border: 1px solid var(--border-strong); position: relative;
    transition: background .25s var(--ease);
}
.toggle.on { background: var(--green); border-color: var(--green); }
.toggle .knob {
    position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
    background: #fff; transition: transform .25s var(--ease); box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.toggle.on .knob { transform: translateX(22px); }

#blazor-error-ui {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
    background: var(--danger); color:#fff; padding: 12px 18px; display: none;
    font-size:.9rem; font-weight:600;
}
#blazor-error-ui .dismiss { float: right; cursor: pointer; }
