/* Katibu Wangu — warm paper, forest green, amber. No external assets. */
:root {
  --bg: #f4f1e8;
  --bg-2: #eee9dc;
  --surface: #fffdf8;
  --surface-2: #faf7ef;
  --surface-3: #f1ecdf;
  --ink: #11211a;
  --ink-2: #263a31;
  --muted: #6d7c73;
  --faint: #95a198;
  --line: #e1dccd;
  --line-strong: #cdc6b2;
  --green: #0f5d46;
  --green-strong: #0a4736;
  --green-soft: #e2efe9;
  --green-tint: #f0f7f3;
  --gold: #c0842b;
  --gold-soft: #fbf0dc;
  --red: #b23a2f;
  --red-soft: #fbeae7;
  --blue: #2c6a86;
  --blue-soft: #e7f1f6;
  --shadow-sm: 0 1px 2px rgba(20, 35, 27, .05), 0 2px 8px rgba(20, 35, 27, .04);
  --shadow: 0 12px 34px rgba(20, 35, 27, .09);
  --shadow-lg: 0 24px 70px rgba(12, 28, 20, .18);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 26px;
  --sidebar: #0d2b22;
  --sidebar-ink: #eaf3ed;
  --sidebar-muted: #9fb7aa;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1511;
    --bg-2: #101c17;
    --surface: #14231d;
    --surface-2: #172922;
    --surface-3: #1d332a;
    --ink: #e9f1ec;
    --ink-2: #d2e0d8;
    --muted: #9aada3;
    --faint: #7d9087;
    --line: #263b32;
    --line-strong: #355146;
    --green: #38a37d;
    --green-strong: #2a8a68;
    --green-soft: #17382d;
    --green-tint: #122a22;
    --gold: #e0a94e;
    --gold-soft: #3a2c15;
    --red: #e2766a;
    --red-soft: #3a1d1a;
    --blue: #6fb3d1;
    --blue-soft: #142a33;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .25);
    --shadow: 0 12px 34px rgba(0, 0, 0, .35);
    --shadow-lg: 0 24px 70px rgba(0, 0, 0, .5);
    --sidebar: #0a1a15;
    --sidebar-ink: #e6f0ea;
    --sidebar-muted: #8ba296;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 500px at 100% -10%, rgba(15, 93, 70, .08), transparent 60%),
    radial-gradient(700px 420px at -10% 110%, rgba(192, 132, 43, .09), transparent 60%);
  z-index: -1;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.18; letter-spacing: -.02em; font-weight: 680; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0; }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; max-width: 100%; }
code { font-family: var(--mono); font-size: .92em; background: var(--surface-3); padding: .12em .35em; border-radius: 6px; }
::selection { background: var(--green); color: #fff; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--green) 45%, transparent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- shared ---------- */
.muted { color: var(--muted); }
.mini { font-size: .8rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .68rem; font-weight: 700; color: var(--muted); }
.fineprint { color: var(--muted); font-size: .78rem; line-height: 1.55; }
.tag { font-style: normal; font-size: .64rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 7px; margin-left: 4px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: grid; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.pos { color: var(--green); }
.neg { color: var(--red); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-weight: 620; font-size: .92rem; transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; box-shadow: 0 6px 18px rgba(15, 93, 70, .22); }
.btn-primary:hover { background: var(--green-strong); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(.94); }
.btn-soft { background: var(--green-soft); border-color: transparent; color: var(--green); }
.btn-soft:hover { background: color-mix(in srgb, var(--green-soft) 80%, var(--green) 8%); }
.btn-sm { min-height: 34px; padding: 0 11px; font-size: .8rem; border-radius: 9px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 11px; border: 1px solid transparent;
  background: transparent; color: var(--muted); transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.danger:hover { background: var(--red-soft); color: var(--red); }
.lang-code { font-size: .72rem; font-weight: 800; letter-spacing: .06em; }

.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: .82rem; font-weight: 650; color: var(--ink-2); }
.field small { color: var(--muted); font-size: .74rem; line-height: 1.4; }
input[type="text"], input[type="password"], input[type="search"], input[type="date"], input[type="number"], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 11px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { resize: vertical; min-height: 84px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 16%, transparent); }
input::placeholder, textarea::placeholder { color: var(--faint); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 51%, calc(100% - 13px) 51%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 34px; }

.alert { border-radius: 12px; padding: 11px 13px; font-size: .84rem; line-height: 1.45; border: 1px solid transparent; }
.alert-error { background: var(--red-soft); color: var(--red); border-color: color-mix(in srgb, var(--red) 20%, transparent); }
.alert-info { background: var(--blue-soft); color: var(--blue); }
.alert-warn { background: var(--gold-soft); color: var(--gold); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink-2); font-size: .8rem; font-weight: 600; white-space: nowrap;
}
.chip:hover { border-color: var(--green); color: var(--green); text-decoration: none; }
.chip.active { background: var(--green); border-color: var(--green); color: #fff; }
.chip-soft { background: var(--surface-2); border-color: transparent; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 999px; background: var(--surface-3); font-size: .72rem; font-weight: 650; color: var(--muted); }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.gold { background: var(--gold-soft); color: var(--gold); }
.pill.red { background: var(--red-soft); color: var(--red); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px; }
.card-tight { padding: 14px; }
.card-flush { padding: 0; overflow: hidden; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 2px 0 12px; }
.section-title h2 { font-size: 1.1rem; }
.section-title a { font-size: .8rem; font-weight: 650; }

.progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--green); transition: width .35s ease; }
.progress.gold > span { background: var(--gold); }
.progress.red > span { background: var(--red); }
.meter-label { display: flex; justify-content: space-between; gap: 10px; font-size: .76rem; color: var(--muted); margin-top: 6px; }

.empty { text-align: center; padding: 40px 18px; color: var(--muted); }
.empty .empty-icon { width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-3); color: var(--green); }
.empty .empty-icon svg { width: 26px; height: 26px; }
.empty h3 { color: var(--ink); margin-bottom: 6px; }
.empty p { max-width: 420px; margin: 0 auto 16px; font-size: .88rem; }

.divider { height: 1px; background: var(--line); margin: 4px 0; }
.hr-space { height: 1px; background: var(--line); margin: 18px 0; grid-column: 1 / -1; }

/* ---------- auth ---------- */
.auth-body { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.auth-shell { width: min(1120px, 100%); display: grid; grid-template-columns: 1.05fr .95fr; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 30px; box-shadow: var(--shadow-lg); overflow: hidden; }
.auth-brand { position: relative; overflow: hidden; background: linear-gradient(150deg, #0f3d2f, #0b2a21 60%, #09251c); color: #edf5ef; padding: 38px 42px; display: flex; flex-direction: column; gap: 26px; min-height: 620px; }
.auth-brand::before { content: ""; position: absolute; width: 420px; height: 420px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .12); right: -150px; top: -140px; }
.auth-brand::after { content: ""; position: absolute; width: 300px; height: 300px; border-radius: 50%; background: radial-gradient(circle, rgba(192, 132, 43, .24), transparent 65%); left: -100px; bottom: -120px; }
.auth-brand > * { position: relative; z-index: 1; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--green); color: #fff; font-weight: 800; font-size: 1.1rem; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15); flex: none; }
.auth-brand .brand-mark { background: #e7b45a; color: #173126; }
.brand-text { display: grid; line-height: 1.15; }
.brand-text strong { font-size: 1rem; letter-spacing: -.01em; }
.brand-text small { font-size: .72rem; color: var(--sidebar-muted); margin-top: 3px; }
.brand-lg .brand-mark { width: 44px; height: 44px; border-radius: 14px; font-size: 1.3rem; }
.brand-lg .brand-text strong { font-size: 1.12rem; }
.brand-copy { margin-top: auto; max-width: 420px; }
.brand-copy h1 { font-size: clamp(1.8rem, 3vw, 2.5rem); letter-spacing: -.035em; line-height: 1.06; }
.brand-copy p { margin-top: 14px; color: #c4d6cc; font-size: .95rem; line-height: 1.6; }
.brand-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.brand-points li { display: flex; align-items: center; gap: 10px; font-size: .84rem; color: #d7e6dd; }
.brand-points li span { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: rgba(255, 255, 255, .08); font-size: .95rem; flex: none; }
.brand-foot { color: #92ab9e; font-size: .72rem; line-height: 1.5; border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 16px; }
.auth-panel { padding: 30px 34px; display: flex; flex-direction: column; justify-content: center; position: relative; background: var(--surface); }
.auth-lang { position: absolute; top: 20px; right: 24px; }
.ghost-link { font-size: .76rem; font-weight: 700; color: var(--muted); padding: 6px 9px; border-radius: 8px; }
.ghost-link:hover { background: var(--surface-2); color: var(--green); text-decoration: none; }
.auth-card { width: 100%; max-width: 430px; margin: 0 auto; }
.auth-card h2 { font-size: 1.55rem; margin-top: 8px; }
.auth-card > .muted { margin: 6px 0 20px; font-size: .88rem; }
.step-badge { display: inline-flex; padding: 4px 9px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.auth-tabs { display: flex; gap: 6px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 20px; }
.auth-tabs a { flex: 1; text-align: center; padding: 8px; border-radius: 9px; font-size: .82rem; font-weight: 700; color: var(--muted); }
.auth-tabs a:hover { text-decoration: none; color: var(--ink); }
.auth-tabs a.active { background: var(--surface); color: var(--green); box-shadow: var(--shadow-sm); }
.switch-line { margin-top: 18px; text-align: center; font-size: .82rem; color: var(--muted); }
.switch-line a { font-weight: 700; }
.auth-card .stack { margin-top: 4px; }
.auth-card .field small { margin-top: 1px; }
.publisher { margin-top: 22px; padding-top: 15px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.publisher-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; line-height: 1.35; }
.publisher-kicker { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.publisher-main strong { font-size: .82rem; letter-spacing: .02em; }
.publisher-main > span:last-child { font-size: .72rem; color: var(--muted); }
.publisher-links { display: flex; flex-wrap: wrap; gap: 5px 12px; font-size: .71rem; }
.publisher-links a { color: var(--muted); }
.publisher-links a:hover { color: var(--green); text-decoration: none; }
.publisher-compact { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); font-size: .7rem; color: var(--muted); }
.publisher-compact strong { color: var(--ink-2); }
.publisher-compact a { color: var(--green); font-weight: 700; }

/* ---------- app shell ---------- */
.app-body { min-height: 100dvh; }
.app-shell { min-height: 100dvh; display: flex; }
.sidebar { width: 252px; flex: none; background: var(--sidebar); color: var(--sidebar-ink); padding: 22px 16px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100dvh; }
.sidebar .brand { padding: 0 6px; }
.sidebar .brand-mark { background: #e7b45a; color: #173126; }
.sidebar .brand-text strong { color: #f3f8f5; }
.sidebar .brand-text small { color: var(--sidebar-muted); }
.side-nav { display: grid; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 12px; border-radius: 10px; border: 0; background: transparent; color: var(--sidebar-muted); font-size: .9rem; font-weight: 600; text-align: left; transition: background .15s ease, color .15s ease; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #f3f8f5; }
.nav-item.active { background: rgba(255, 255, 255, .11); color: #fff; }
.nav-icon svg { width: 19px; height: 19px; }
.side-balance { margin-top: auto; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .08); border-radius: 14px; padding: 13px; display: grid; gap: 3px; }
.side-balance .eyebrow { color: var(--sidebar-muted); }
.side-balance strong { font-size: 1.28rem; letter-spacing: -.02em; color: #fff; }
.side-balance .mini { color: var(--sidebar-muted); }
.sidebar-credit { display: grid; gap: 2px; padding: 9px 6px 0; border-top: 1px solid rgba(255, 255, 255, .08); }
.sidebar-credit strong { font-size: .63rem; letter-spacing: .1em; color: #c9b17a; }
.sidebar-credit span { font-size: .62rem; color: var(--sidebar-muted); line-height: 1.4; }
.sidebar-credit a { color: var(--sidebar-muted); }
.sidebar-credit a:hover { color: #fff; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 0 4px; }
.avatar { width: 36px; height: 36px; border-radius: 11px; background: #e7b45a; color: #173126; display: grid; place-items: center; font-weight: 800; flex: none; }
.side-user-text { display: grid; line-height: 1.2; min-width: 0; flex: 1; }
.side-user-text strong { font-size: .84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-text span { font-size: .68rem; color: var(--sidebar-muted); }
.logout-form { margin: 0; }
.sidebar .icon-btn { color: var(--sidebar-muted); }
.sidebar .icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }

.main-shell { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 26px; background: color-mix(in srgb, var(--bg) 96%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar h1 { font-size: 1.2rem; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.balance-pill { display: grid; justify-items: end; line-height: 1.15; padding: 5px 11px; border-radius: 11px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.balance-pill span { color: var(--muted); font-size: .64rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.balance-pill strong { font-size: .95rem; }
.mobile-menu { display: none; }
.view { padding: 22px 26px 100px; width: 100%; max-width: 1180px; margin: 0 auto; }

.bottom-nav { display: none; }

/* ---------- chat ---------- */
.chat-view { max-width: 800px; margin: 0 auto; display: flex; flex-direction: column; min-height: calc(100dvh - 150px); }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.chat-head .status { display: inline-flex; align-items: center; gap: 7px; font-size: .76rem; color: var(--muted); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.status-dot.off { background: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.chat-stream { display: flex; flex-direction: column; gap: 16px; padding: 6px 2px 28px; flex: 1; }
.msg { display: flex; gap: 10px; max-width: 86%; }
.msg.assistant { align-self: flex-start; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; font-weight: 800; font-size: .85rem; margin-top: 2px; }
.msg.assistant .msg-avatar { background: var(--green); color: #fff; }
.msg.user .msg-avatar { background: #e7b45a; color: #173126; }
.bubble { padding: 11px 14px; border-radius: 16px; font-size: .91rem; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.msg.assistant .bubble { background: var(--surface); border: 1px solid var(--line); border-top-left-radius: 5px; box-shadow: var(--shadow-sm); }
.msg.user .bubble { background: var(--green); color: #fff; border-top-right-radius: 5px; box-shadow: 0 6px 18px rgba(15, 93, 70, .18); }
.msg-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: .68rem; color: var(--faint); }
.msg.user .msg-meta { justify-content: flex-end; color: rgba(255, 255, 255, .7); }
.msg-tools { display: flex; gap: 4px; margin-top: 7px; }
.msg-tools .btn { background: var(--surface-2); border-color: var(--line); }
.chat-day { align-self: center; font-size: .68rem; color: var(--faint); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
.typing { display: inline-flex; gap: 4px; align-items: center; padding: 13px 15px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }
.chat-intro { text-align: center; padding: 22px 10px 10px; }
.chat-intro .intro-mark { width: 54px; height: 54px; border-radius: 18px; margin: 0 auto 12px; display: grid; place-items: center; background: var(--green); color: #fff; font-size: 1.4rem; font-weight: 800; box-shadow: 0 12px 26px rgba(15, 93, 70, .2); }
.chat-intro h2 { font-size: 1.4rem; margin-bottom: 6px; }
.chat-intro p { color: var(--muted); font-size: .9rem; max-width: 460px; margin: 0 auto; }
.quick-chips { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin: 16px auto 4px; max-width: 620px; }
.quick-chips .chip { background: var(--surface); }
.composer-wrap { position: sticky; bottom: 0; z-index: 10; padding: 10px 0 14px; background: linear-gradient(to top, var(--bg) 78%, color-mix(in srgb, var(--bg) 70%, transparent)); }
.composer { display: flex; align-items: flex-end; gap: 8px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 18px; padding: 8px 8px 8px 12px; box-shadow: var(--shadow); }
.composer textarea { border: 0; box-shadow: none; min-height: 40px; max-height: 150px; padding: 8px 2px; background: transparent; resize: none; }
.composer textarea:focus { box-shadow: none; }
.composer .send { width: 44px; height: 44px; border-radius: 13px; background: var(--green); color: #fff; border: 0; display: grid; place-items: center; flex: none; box-shadow: 0 6px 16px rgba(15, 93, 70, .22); }
.composer .send:hover { background: var(--green-strong); }
.composer .send[disabled] { opacity: .5; }
.composer .mic { width: 38px; height: 38px; border-radius: 11px; border: 1px solid transparent; background: transparent; color: var(--muted); display: grid; place-items: center; flex: none; }
.composer .mic:hover { background: var(--surface-2); color: var(--green); }
.composer .mic.listening { background: var(--red-soft); color: var(--red); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(178, 58, 47, .25); } 50% { box-shadow: 0 0 0 6px rgba(178, 58, 47, 0); } }
.composer-hint { text-align: center; font-size: .68rem; color: var(--faint); margin-top: 6px; }

/* ---------- transactions ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { font-size: 1.3rem; }
.page-head p { color: var(--muted); font-size: .86rem; margin-top: 4px; }
.page-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search { flex: 1; min-width: 180px; position: relative; }
.toolbar .search input { padding-left: 36px; }
.toolbar .search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--faint); }
.filter-select { min-height: 40px; width: auto; min-width: 130px; }
.tx-list { display: grid; gap: 8px; }
.tx-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 11px 13px; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow-sm); }
.tx-row:hover { border-color: var(--line-strong); }
.tx-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-3); font-size: 1.05rem; }
.tx-main { min-width: 0; }
.tx-main strong { display: block; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-main span { display: block; font-size: .73rem; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-amount { text-align: right; font-weight: 700; font-size: .9rem; white-space: nowrap; }
.tx-amount small { display: block; font-weight: 500; color: var(--muted); font-size: .68rem; margin-top: 2px; }
.tx-actions { display: flex; gap: 2px; }
.tx-group-head { display: flex; justify-content: space-between; align-items: center; margin: 18px 2px 8px; font-size: .74rem; color: var(--muted); font-weight: 650; }
.tx-group-head:first-child { margin-top: 0; }
.load-more { display: flex; justify-content: center; padding: 18px 0; }

/* ---------- reports ---------- */
.report-hero { background: linear-gradient(145deg, #0f3d2f, #0a2b21); color: #f2f8f4; border-radius: var(--radius-lg); padding: 22px; display: grid; gap: 18px; position: relative; overflow: hidden; }
.report-hero::after { content: ""; position: absolute; width: 260px; height: 260px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .12); right: -100px; top: -120px; }
.report-hero .eyebrow { color: #a9c2b5; }
.report-hero h2 { font-size: 1.55rem; letter-spacing: -.03em; }
.report-hero .hero-amount { font-size: clamp(1.9rem, 4vw, 2.7rem); font-weight: 720; letter-spacing: -.04em; }
.report-hero .hero-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; position: relative; z-index: 1; }
.report-hero .hero-cell { background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .09); border-radius: 12px; padding: 10px 12px; }
.report-hero .hero-cell span { display: block; font-size: .66rem; color: #a9c2b5; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.report-hero .hero-cell strong { font-size: 1.02rem; }
.period-bar { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.period-bar::-webkit-scrollbar { display: none; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 13px; box-shadow: var(--shadow-sm); }
.stat span { display: block; font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; font-weight: 700; }
.stat strong { display: block; font-size: 1.08rem; margin-top: 4px; letter-spacing: -.02em; }
.stat small { display: block; font-size: .7rem; color: var(--faint); margin-top: 2px; }
.chart-card { padding: 16px; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 130px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.bar-track { width: 100%; max-width: 34px; height: 100px; display: flex; align-items: flex-end; background: var(--surface-3); border-radius: 7px; overflow: hidden; }
.bar-fill { width: 100%; background: linear-gradient(to top, var(--green), color-mix(in srgb, var(--green) 65%, #9ad4bd)); border-radius: 7px 7px 0 0; min-height: 2px; transition: height .4s ease; }
.bar-col small { font-size: .62rem; color: var(--faint); white-space: nowrap; }
.cat-list { display: grid; gap: 10px; }
.cat-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.cat-emoji { width: 32px; height: 32px; border-radius: 9px; background: var(--surface-3); display: grid; place-items: center; }
.cat-main { min-width: 0; }
.cat-main .spread { font-size: .82rem; }
.cat-main .progress { height: 6px; margin-top: 5px; }
.cat-amount { font-size: .82rem; font-weight: 700; }
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compare-cell { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.compare-cell span { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.compare-cell strong { display: block; font-size: 1.05rem; margin-top: 3px; }
.delta { font-size: .78rem; font-weight: 650; margin-top: 6px; }
.delta.up { color: var(--red); }
.delta.down { color: var(--green); }
.trend { width: 100%; height: 150px; }
.trend .grid-line { stroke: var(--line); stroke-width: 1; }
.trend .area { fill: color-mix(in srgb, var(--green) 14%, transparent); }
.trend .line { fill: none; stroke: var(--green); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.trend .dot { fill: var(--green); }
.trend text { fill: var(--faint); font-size: 9px; }

/* ---------- plans ---------- */
.plan-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.plan-card { display: grid; gap: 10px; }
.plan-card .spread strong { font-size: .95rem; }
.plan-card .amount { font-size: 1.1rem; font-weight: 720; letter-spacing: -.02em; }
.plan-card .meta { font-size: .74rem; color: var(--muted); }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; }
.tabs button { border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); border-radius: 999px; min-height: 34px; padding: 0 13px; font-size: .8rem; font-weight: 650; white-space: nowrap; }
.tabs button.active { background: var(--green); border-color: var(--green); color: #fff; }
.debt-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.debt-row:last-child { border-bottom: 0; }
.debt-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--gold-soft); color: var(--gold); display: grid; place-items: center; font-weight: 800; flex: none; }
.debt-main { flex: 1; min-width: 0; }
.debt-main strong { display: block; font-size: .88rem; }
.debt-main span { font-size: .72rem; color: var(--muted); }
.debt-amount { font-weight: 700; font-size: .88rem; text-align: right; }

/* ---------- settings ---------- */
.settings-grid { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 22px; align-items: start; }
.settings-nav { display: grid; gap: 3px; position: sticky; top: 82px; }
.settings-nav button { text-align: left; padding: 9px 11px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); font-size: .84rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.settings-nav button:hover { background: var(--surface-2); color: var(--ink); }
.settings-nav button.active { background: var(--green-soft); color: var(--green); }
.settings-panel { display: grid; gap: 16px; min-width: 0; }
.settings-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.settings-section > header { padding: 15px 17px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.settings-section > header h3 { font-size: .98rem; }
.settings-section > header p { font-size: .76rem; color: var(--muted); margin-top: 3px; }
.settings-section > .body { padding: 17px; display: grid; gap: 14px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.settings-row .meta { min-width: 0; }
.settings-row .meta strong { display: block; font-size: .87rem; }
.settings-row .meta span { display: block; font-size: .75rem; color: var(--muted); margin-top: 2px; }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: background .18s ease; pointer-events: none; }
.switch i::after { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: transform .18s ease; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.switch input:checked + i { background: var(--green); }
.switch input:checked + i::after { transform: translateX(18px); }
.danger-zone { border-color: color-mix(in srgb, var(--red) 28%, var(--line)); }
.danger-zone > header { background: var(--red-soft); border-bottom-color: color-mix(in srgb, var(--red) 18%, transparent); }
.danger-zone > header h3 { color: var(--red); }
.list-rows { display: grid; gap: 0; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row .main { flex: 1; min-width: 0; }
.list-row .main strong { display: block; font-size: .85rem; }
.list-row .main span { display: block; font-size: .72rem; color: var(--muted); margin-top: 2px; }
.memory-tag { font-size: .7rem; background: var(--surface-3); border-radius: 6px; padding: 2px 6px; color: var(--muted); }
.stat-inline { display: flex; gap: 14px; flex-wrap: wrap; }
.stat-inline div { font-size: .78rem; color: var(--muted); }
.stat-inline strong { color: var(--ink); }

/* about / publisher */
.about-hero { display: flex; align-items: center; gap: 15px; padding: 16px; border-radius: 16px; background: linear-gradient(145deg, var(--green), var(--green-strong)); color: #f2f8f4; }
.about-logo { width: 62px; height: 62px; border-radius: 17px; flex: none; box-shadow: 0 8px 20px rgba(0, 0, 0, .18); }
.about-hero h3 { font-size: 1.25rem; }
.about-hero p { font-size: .78rem; color: #c2d6ca; margin-top: 3px; }
.about-hero .pill { background: rgba(255, 255, 255, .14); color: #f2f8f4; margin-top: 7px; }
.about-block { display: grid; gap: 2px; }
.about-block .eyebrow { margin-bottom: 2px; }
.about-block strong { font-size: 1rem; letter-spacing: .01em; }
.about-block span { font-size: .78rem; color: var(--muted); }
.contact-list { display: grid; }
.contact-row { display: flex; align-items: center; gap: 11px; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--ink); }
.contact-row:last-child { border-bottom: 0; }
.contact-row:hover { text-decoration: none; }
.contact-row .ico { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-3); color: var(--green); display: grid; place-items: center; flex: none; }
.contact-row .ico svg { width: 17px; height: 17px; }
.contact-row .copy { display: grid; line-height: 1.3; min-width: 0; }
.contact-row .copy strong { font-size: .82rem; }
.contact-row .copy span { font-size: .72rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-row .go { margin-left: auto; color: var(--faint); }
.install-card { display: flex; align-items: center; gap: 13px; padding: 14px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 14px; }
.install-card .ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--green-soft); color: var(--green); flex: none; }
.install-card .copy { flex: 1; min-width: 0; }
.install-card .copy strong { display: block; font-size: .86rem; }
.install-card .copy span { display: block; font-size: .73rem; color: var(--muted); margin-top: 2px; }
.pwa-note { font-size: .74rem; color: var(--muted); line-height: 1.55; }
.install-steps { margin: 0; padding-left: 22px; display: grid; gap: 9px; font-size: .85rem; color: var(--ink-2); }
.install-steps li::marker { color: var(--green); font-weight: 800; }

/* ---------- modal / sheet / toast ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(9, 22, 16, .45); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 18px; animation: fadeIn .16s ease; }
.modal { width: min(560px, 100%); max-height: 90dvh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-lg); animation: popIn .2s ease; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-head h3 { font-size: 1.05rem; }
.modal-body { padding: 20px; display: grid; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: grid; gap: 8px; max-width: min(380px, calc(100vw - 36px)); }
.toast { background: var(--ink); color: var(--bg); border-radius: 11px; padding: 11px 14px; font-size: .82rem; box-shadow: var(--shadow-lg); animation: toastIn .2s ease; }
.toast.error { background: var(--red); color: #fff; }
.toast.success { background: var(--green); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- skeleton ---------- */
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.4s infinite; border-radius: 10px; }
.skeleton-card { height: 150px; margin-bottom: 14px; border-radius: var(--radius); }
.skeleton-line { height: 14px; margin-bottom: 10px; }
.skeleton-line.short { width: 60%; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ---------- responsive ---------- */
@media (max-width: 1050px) {
  .sidebar { width: 218px; }
  .view { padding-left: 20px; padding-right: 20px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { min-height: auto; padding: 26px 24px; gap: 16px; }
  .auth-brand .brand-copy, .auth-brand .brand-points, .auth-brand .brand-foot { display: none; }
  .auth-panel { padding: 24px 22px 30px; }
  .auth-card { max-width: 100%; }
  .sidebar { display: none; }
  .topbar { padding: 11px 16px; }
  .mobile-menu { display: inline-flex; }
  .view { padding: 16px 14px calc(88px + var(--safe-bottom)); }
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + var(--safe-bottom)); justify-content: space-around; align-items: center; }
  .bottom-item { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: transparent; color: var(--muted); font-size: .62rem; min-width: 52px; padding: 4px; border-radius: 9px; }
  .bottom-item svg { width: 21px; height: 21px; }
  .bottom-item.active { color: var(--green); }
  .bottom-add { width: 48px; height: 48px; min-width: 48px; border-radius: 16px; background: var(--green); color: #fff; margin-top: -18px; box-shadow: 0 8px 20px rgba(15, 93, 70, .28); justify-content: center; }
  .bottom-add svg { width: 23px; height: 23px; }
  .bottom-add small { display: none; }
  .chat-view { min-height: calc(100dvh - 160px); }
  .composer-wrap { position: fixed; left: 0; right: 0; bottom: calc(62px + var(--safe-bottom)); z-index: 35; padding: 8px 12px 10px; background: linear-gradient(to top, var(--bg) 72%, transparent); }
  .composer { max-width: 760px; margin: 0 auto; }
  .composer-hint { display: none; }
  .chat-stream { padding-bottom: 90px; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-nav { position: static; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding-bottom: 4px; overflow: visible; }
  .settings-nav button { border: 1px solid var(--line); justify-content: center; text-align: center; font-size: .72rem; line-height: 1.2; padding: 8px 5px; min-height: 38px; white-space: normal; }
  .settings-nav button.active { border-color: var(--green); }
  .plan-grid { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .auth-body { padding: 0; display: block; }
  .auth-shell { border-radius: 0; min-height: 100dvh; border: 0; box-shadow: none; }
  .auth-brand { padding: 20px 18px; }
  .auth-panel { padding: 22px 18px 34px; }
  .auth-lang { top: 14px; right: 14px; }
  .auth-card h2 { font-size: 1.35rem; }
  .topbar h1 { font-size: 1.05rem; }
  #page-subtitle { display: none; }
  .balance-pill { padding: 4px 8px; }
  .balance-pill strong { font-size: .84rem; }
  .view { padding-left: 12px; padding-right: 12px; }
  .msg { max-width: 94%; }
  .msg-avatar { width: 28px; height: 28px; border-radius: 9px; font-size: .75rem; }
  .bubble { font-size: .88rem; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat { padding: 11px; }
  .stat strong { font-size: .95rem; }
  .report-hero { padding: 18px; border-radius: 18px; }
  .report-hero .hero-grid { grid-template-columns: 1fr 1fr; }
  .report-hero .hero-grid .hero-cell:last-child { grid-column: 1 / -1; }
  .compare-grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .tx-row { grid-template-columns: 36px minmax(0, 1fr) auto; gap: 9px; padding: 10px; }
  .tx-icon { width: 34px; height: 34px; }
  .toolbar .search { flex-basis: 100%; }
  .page-head { align-items: flex-start; }
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal { border-radius: 22px 22px 0 0; max-height: 92dvh; width: 100%; }
  .toast-region { left: 12px; right: 12px; bottom: calc(78px + var(--safe-bottom)); max-width: none; }
  .settings-section > .body { padding: 14px; }
  .settings-row { align-items: flex-start; }
  .quick-chips { justify-content: flex-start; }
  .chat-head { gap: 6px; }
  .chat-head .btn { font-size: .7rem; padding: 0 8px; }
  .chat-stream { padding-bottom: 90px; }
  .auth-panel { justify-content: flex-start; }
  .auth-lang { position: static; align-self: flex-end; margin-bottom: 3px; }
  .composer-wrap { background: var(--bg); border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
}
@media (max-width: 420px) {
  .balance-pill span { display: none; }
  .balance-pill { border: 0; background: transparent; box-shadow: none; padding: 2px 4px; }
  .topbar-right { gap: 2px; }
  #page-title { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chat-intro h2 { font-size: 1.22rem; }
  .chat-intro p { font-size: .84rem; }
  .quick-chips { justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
