/* Mathru design system. One stylesheet, no build step, no external fonts or scripts. */

:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #f8faf9;
  --ink: #0d1a15;
  --ink-2: #33423c;
  --muted: #66756e;
  --line: #e3e8e5;
  --line-strong: #cfd7d3;
  --brand: #087f57;
  --brand-strong: #066a48;
  --brand-ink: #ffffff;
  --brand-soft: #e4f5ed;
  --brand-glow: rgba(8, 127, 87, .18);
  --grad: linear-gradient(135deg, #17c48a 0%, #0a8f63 52%, #05624a 100%);
  --chat-bg: #edf1ee;
  --chat-dot: rgba(13, 26, 21, .05);
  --in: #ffffff;
  --out: #d6f5e3;
  --warn-bg: #fff3d1;
  --warn-ink: #6d4b00;
  --bad-bg: #fde8e7;
  --bad-ink: #9b1c1c;
  --ok-bg: #e0f5ea;
  --ok-ink: #075c40;
  --info-bg: #e6f0fb;
  --info-ink: #174a84;
  --shadow-1: 0 1px 2px rgba(13, 26, 21, .05), 0 1px 3px rgba(13, 26, 21, .04);
  --shadow-2: 0 10px 30px rgba(13, 26, 21, .09), 0 2px 8px rgba(13, 26, 21, .05);
  --shadow-3: 0 24px 60px rgba(13, 26, 21, .22);
  --radius: 14px;
  --radius-sm: 10px;
  /* The sidebar stays dark in both themes. */
  --side-bg: #0a1411;
  --side-bg-2: #0e1d18;
  --side-ink: #e6efea;
  --side-muted: #8da097;
  --side-line: rgba(255, 255, 255, .08);
  --side-hover: rgba(255, 255, 255, .05);
  --side-active: rgba(45, 212, 150, .14);
  --side-accent: #3ddba0;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0a0f0d;
  --surface: #121a16;
  --surface-2: #17211c;
  --ink: #e9f1ed;
  --ink-2: #c3d0c9;
  --muted: #8a9a92;
  --line: #212c27;
  --line-strong: #2e3b35;
  --brand: #35d49a;
  --brand-strong: #56e0ae;
  --brand-ink: #03130c;
  --brand-soft: #11301f;
  --brand-glow: rgba(53, 212, 154, .22);
  --chat-bg: #0c1310;
  --chat-dot: rgba(255, 255, 255, .035);
  --in: #19241f;
  --out: #0f4a35;
  --warn-bg: #3a2f10;
  --warn-ink: #f3d88a;
  --bad-bg: #3f1d1d;
  --bad-ink: #f5b5b5;
  --ok-bg: #12301f;
  --ok-ink: #9fe6c9;
  --info-bg: #14273d;
  --info-ink: #a9cdf5;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-2: 0 10px 30px rgba(0, 0, 0, .45);
  --shadow-3: 0 24px 60px rgba(0, 0, 0, .6);
  --side-bg: #070c0a;
  --side-bg-2: #0a1310;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0f0d;
    --surface: #121a16;
    --surface-2: #17211c;
    --ink: #e9f1ed;
    --ink-2: #c3d0c9;
    --muted: #8a9a92;
    --line: #212c27;
    --line-strong: #2e3b35;
    --brand: #35d49a;
    --brand-strong: #56e0ae;
    --brand-ink: #03130c;
    --brand-soft: #11301f;
    --brand-glow: rgba(53, 212, 154, .22);
    --chat-bg: #0c1310;
    --chat-dot: rgba(255, 255, 255, .035);
    --in: #19241f;
    --out: #0f4a35;
    --warn-bg: #3a2f10;
    --warn-ink: #f3d88a;
    --bad-bg: #3f1d1d;
    --bad-ink: #f5b5b5;
    --ok-bg: #12301f;
    --ok-ink: #9fe6c9;
    --info-bg: #14273d;
    --info-ink: #a9cdf5;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-2: 0 10px 30px rgba(0, 0, 0, .45);
    --shadow-3: 0 24px 60px rgba(0, 0, 0, .6);
    --side-bg: #070c0a;
    --side-bg-2: #0a1310;
    color-scheme: dark;
  }
}

/* ------------------------------------------------------------------ base */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14.5px/1.5 "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -.015em; line-height: 1.25; }
h1 { font-size: 24px; font-weight: 680; }
h2 { font-size: 16.5px; font-weight: 650; }
h3 { font-size: 14.5px; font-weight: 650; }
p { margin: 0 0 10px; }
a { color: var(--brand); text-decoration: none; font-weight: 550; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.label { font-size: 11.5px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ic { flex: none; display: block; }
.grow { flex: 1; min-width: 0; }
.boot { display: grid; place-items: center; height: 100%; color: var(--muted); }
::selection { background: var(--brand-glow); }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

/* ------------------------------------------------------------------ controls */
.field { display: block; margin: 0 0 16px; }
.field > span { display: block; font-size: 13px; font-weight: 550; color: var(--ink-2); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
textarea { resize: vertical; min-height: 42px; }
input.tick { width: 18px; height: 18px; padding: 0; accent-color: var(--brand); flex: none; }
.check { display: flex; gap: 10px; align-items: center; padding: 6px 0; cursor: pointer; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; min-height: 38px;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: var(--brand); color: var(--brand-ink);
  font-weight: 620; cursor: pointer; text-decoration: none; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(13, 26, 21, .12), inset 0 1px 0 rgba(255, 255, 255, .14);
  transition: background .15s, transform .05s, box-shadow .15s, border-color .15s;
}
.btn:hover { background: var(--brand-strong); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); box-shadow: var(--shadow-1); }
.btn.secondary:hover { background: var(--surface-2); border-color: var(--muted); }
.btn.ghost { background: transparent; color: var(--ink-2); box-shadow: none; font-weight: 550; }
.btn.ghost:hover { background: var(--line); }
.btn.danger { background: transparent; color: var(--bad-ink); border-color: var(--bad-ink); box-shadow: none; }
.btn.danger:hover { background: var(--bad-bg); }
.btn.sm { padding: 5px 11px; min-height: 30px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.icon { padding: 0; width: 36px; min-height: 36px; border-radius: 10px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > .field { flex: 1; min-width: 180px; align-self: flex-end; }
.stack { display: flex; flex-direction: column; gap: 8px; }

.notice { display: flex; gap: 10px; padding: 11px 14px; border-radius: var(--radius-sm); margin: 0 0 16px; font-size: 13.5px; line-height: 1.45; border: 1px solid transparent; }
.notice .ic { margin-top: 2px; }
.notice.bad { background: var(--bad-bg); color: var(--bad-ink); }
.notice.warn { background: var(--warn-bg); color: var(--warn-ink); }
.notice.ok { background: var(--ok-bg); color: var(--ok-ink); }
.notice.info { background: var(--info-bg); color: var(--info-ink); }
.notice a { color: inherit; text-decoration: underline; }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 650; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; }
.chip.ok { background: var(--ok-bg); color: var(--ok-ink); border-color: transparent; }
.chip.bad { background: var(--bad-bg); color: var(--bad-ink); border-color: transparent; }
.chip.warn { background: var(--warn-bg); color: var(--warn-ink); border-color: transparent; }
.chip.info { background: var(--info-bg); color: var(--info-ink); border-color: transparent; }

.avatar { display: inline-grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 50%; color: #fff; font-size: 13.5px; font-weight: 680; letter-spacing: .01em; text-transform: uppercase; }
.avatar.sm { width: 30px; height: 30px; font-size: 11.5px; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.avatar.sq { border-radius: 10px; }
.a0 { background: linear-gradient(135deg, #14b8a6, #0b7d73); }
.a1 { background: linear-gradient(135deg, #6f7df0, #4350c9); }
.a2 { background: linear-gradient(135deg, #f0913f, #c9631a); }
.a3 { background: linear-gradient(135deg, #e0609a, #b53a72); }
.a4 { background: linear-gradient(135deg, #3ea6ec, #1f73c2); }
.a5 { background: linear-gradient(135deg, #8a6bdc, #6243b8); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-1); margin: 0 0 20px; }
.card > h2 { margin-bottom: 4px; }
.card > h2 + .muted { margin-bottom: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; margin: 0 0 20px; }
.grid2 > .card { margin: 0; }
.split { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: start; margin: 0 0 20px; }
.split > .card { margin: 0; }
.formgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 28px; }

/* ------------------------------------------------------------------ brand mark */
.logo { display: inline-flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 720; letter-spacing: -.02em; }
.logo-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--grad); color: #fff; box-shadow: 0 4px 14px rgba(10, 143, 99, .4), inset 0 1px 0 rgba(255, 255, 255, .28); }
.logo.lg { font-size: 22px; }
.logo.lg .logo-mark { width: 42px; height: 42px; border-radius: 12px; }

/* ------------------------------------------------------------------ signed-out screens */
.auth { min-height: 100%; display: grid; grid-template-columns: minmax(360px, 5fr) 7fr; }
.auth-brand {
  position: relative; overflow: hidden; color: #eef7f2; padding: 44px 48px; display: flex; flex-direction: column;
  background: radial-gradient(900px 500px at 10% -10%, rgba(61, 219, 160, .28), transparent 60%), radial-gradient(700px 500px at 110% 110%, rgba(23, 196, 138, .2), transparent 60%), linear-gradient(160deg, #0b1d17 0%, #07130f 100%);
}
.auth-brand::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px); background-size: 22px 22px; mask-image: linear-gradient(180deg, transparent, #000 40%, transparent); pointer-events: none; }
.auth-brand > * { position: relative; z-index: 1; }
.auth-brand h2 { font-size: 34px; line-height: 1.15; font-weight: 700; letter-spacing: -.03em; margin: auto 0 28px; max-width: 420px; }
.points { list-style: none; padding: 0; margin: 0 0 auto; display: grid; gap: 18px; max-width: 420px; }
.points li { display: flex; gap: 14px; align-items: flex-start; }
.points .pt-ic { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 10px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .1); color: var(--side-accent); }
.points strong { display: block; font-weight: 620; }
.points span { color: #a9bdb4; font-size: 13.5px; }
.auth-foot { margin: 28px 0 0; font-size: 12.5px; color: #7f948a; }
.auth-main { display: grid; place-items: center; padding: 32px 20px; background: var(--bg); }
.auth-card { width: 100%; max-width: 440px; }
.auth-card.wide { max-width: 560px; }
.auth-card h1 { font-size: 27px; margin-bottom: 6px; }
.auth-card > .muted { margin-bottom: 26px; }
.auth-card form { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 26px; box-shadow: var(--shadow-2); }
.auth-card .label { display: block; margin: 4px 0 12px; }
.auth-card .label.sep { margin-top: 10px; padding-top: 18px; border-top: 1px solid var(--line); }
.auth-logo-sm { display: none; margin-bottom: 26px; }

/* ------------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); height: 100%; }
.side { background: linear-gradient(180deg, var(--side-bg-2), var(--side-bg)); color: var(--side-ink); display: flex; flex-direction: column; padding: 18px 12px 12px; min-height: 0; overflow-y: auto; }
.side .logo { padding: 2px 8px 16px; color: #fff; }
.ws { display: flex; align-items: center; gap: 10px; padding: 10px; margin: 0 0 6px; border-radius: 12px; background: var(--side-hover); border: 1px solid var(--side-line); }
.ws-name { font-weight: 620; font-size: 13.5px; line-height: 1.25; overflow-wrap: anywhere; color: #fff; }
.ws-sub { font-size: 12px; color: var(--side-muted); }
.practice { display: flex; align-items: center; gap: 8px; margin: 6px 0 2px; padding: 7px 10px; border-radius: 10px; font-size: 12.5px; font-weight: 600; color: #f6dc8c; background: rgba(246, 196, 62, .1); border: 1px solid rgba(246, 196, 62, .18); }
.side .label { color: var(--side-muted); padding: 16px 10px 6px; opacity: .85; }
.nav { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; color: var(--side-ink); opacity: .8; font-weight: 520; text-decoration: none; transition: background .12s, opacity .12s; }
.nav:hover { background: var(--side-hover); opacity: 1; text-decoration: none; }
.nav.active { background: var(--side-active); color: #fff; opacity: 1; font-weight: 620; box-shadow: inset 3px 0 0 var(--side-accent); }
.nav.active .ic { color: var(--side-accent); }
.side .spacer { flex: 1; min-height: 16px; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px 6px 4px 8px; border-top: 1px solid var(--side-line); }
.me-name { font-size: 13.5px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-mail { font-size: 12px; color: var(--side-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side .btn.icon { background: transparent; color: var(--side-muted); box-shadow: none; width: 32px; min-height: 32px; }
.side .btn.icon:hover { background: var(--side-hover); color: #fff; }
.topbar { display: none; }
.scrim { display: none; }
.main { position: relative; overflow: auto; min-width: 0; min-height: 0; }
.main.flush { overflow: hidden; }
.page { max-width: 1160px; margin: 0 auto; padding: 30px 34px 48px; }
.page > * { animation: rise .28s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.loader { position: absolute; top: 40px; left: 50%; width: 26px; height: 26px; margin-left: -13px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; pointer-events: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 0 0 24px; flex-wrap: wrap; }
.pagehead p { margin: 4px 0 0; }
.back { margin: 0 0 14px -8px; }

/* ------------------------------------------------------------------ home */
.hero { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 26px 28px; margin: 0 0 20px; border-radius: 18px; color: #f1faf5; background: radial-gradient(600px 260px at 100% 0%, rgba(61, 219, 160, .35), transparent 65%), linear-gradient(135deg, #0d2a20, #0a1a14 70%); box-shadow: var(--shadow-2); flex-wrap: wrap; }
.hero h1 { font-size: 26px; color: #fff; }
.hero p { margin: 6px 0 0; color: #b4c8be; }
.hero .btn.secondary { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .18); box-shadow: none; }
.hero .btn.secondary:hover { background: rgba(255, 255, 255, .16); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin: 0 0 20px; }
.tile { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-1); color: inherit; font-weight: inherit; transition: transform .15s, box-shadow .15s, border-color .15s; }
a.tile:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--line-strong); }
.tile-ic { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--brand-soft); color: var(--brand); margin-bottom: 14px; }
.tile-ic.t1 { background: var(--info-bg); color: var(--info-ink); }
.tile-ic.t2 { background: var(--warn-bg); color: var(--warn-ink); }
.tile-ic.t3 { background: #f0e9fd; color: #5b3cb3; }
:root[data-theme="dark"] .tile-ic.t3 { background: #251b3f; color: #c3b0f5; }
.tile .v { font-size: 28px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile .k { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.steps { list-style: none; margin: 0; padding: 0; }
.step { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-top: 1px solid var(--line); }
.step:first-child { border-top: 0; }
.step-dot { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--line-strong); color: var(--muted); font-size: 12.5px; font-weight: 650; }
.step.done .step-dot { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.step.done .step-t { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.step-t { font-weight: 600; }
.step-s { font-size: 13px; color: var(--muted); }
progress { appearance: none; -webkit-appearance: none; width: 100%; height: 8px; border: 0; border-radius: 999px; background: var(--line); overflow: hidden; display: block; }
progress::-webkit-progress-bar { background: var(--line); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--grad); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--brand); border-radius: 999px; }
.rowlink { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 8px; margin: 0 -8px; border: 0; border-radius: 10px; background: transparent; text-align: left; cursor: pointer; }
.rowlink:hover { background: var(--surface-2); }
.rowlink .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rowlink .s { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; font-size: 13.5px; border-top: 1px solid var(--line); }
.kv:first-of-type { border-top: 0; }
.kv > span:first-child { color: var(--muted); }

/* ------------------------------------------------------------------ inbox */
.inbox { position: relative; display: grid; grid-template-columns: 340px minmax(0, 1fr) 310px; height: 100%; overflow: hidden; background: var(--surface); }
.list { display: flex; flex-direction: column; border-right: 1px solid var(--line); min-height: 0; background: var(--surface); }
.list-head { padding: 20px 18px 12px; }
.list-head h1 { font-size: 21px; margin-bottom: 12px; }
.search { position: relative; }
.search .ic { position: absolute; left: 11px; top: 50%; margin-top: -8px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 34px; background: var(--surface-2); border-color: var(--line); }
.convs { flex: 1; overflow: auto; padding: 4px 8px 12px; }
.conv { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 10px; border: 0; border-radius: 12px; background: transparent; cursor: pointer; transition: background .12s; }
.conv:hover { background: var(--surface-2); }
.conv.active { background: var(--brand-soft); }
.conv .name { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.conv .name > span:first-child { font-weight: 620; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .time { font-size: 11.5px; color: var(--muted); flex: none; font-variant-numeric: tabular-nums; }
.conv .snippet { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.conv .snippet > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; }
.thread-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--surface); min-height: 64px; }
.thread-head .t { font-weight: 650; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-head .s { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.only-narrow, .only-mid { display: none; }
.msgs { flex: 1; overflow: auto; padding: 18px 22px; display: flex; flex-direction: column; gap: 6px; background-color: var(--chat-bg); background-image: radial-gradient(var(--chat-dot) 1px, transparent 1px); background-size: 18px 18px; }
.day { align-self: center; margin: 10px 0 6px; padding: 3px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 11.5px; font-weight: 600; box-shadow: var(--shadow-1); }
.msg { max-width: min(74%, 580px); padding: 8px 12px 6px; border-radius: 16px 16px 16px 5px; background: var(--in); box-shadow: 0 1px 1px rgba(13, 26, 21, .08); overflow-wrap: anywhere; white-space: pre-wrap; align-self: flex-start; animation: rise .2s ease both; }
.msg.out { align-self: flex-end; background: var(--out); border-radius: 16px 16px 5px 16px; }
.msg .meta { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 3px; font-size: 11px; color: var(--muted); white-space: normal; font-variant-numeric: tabular-nums; }
.tick { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
.tick.ok { color: var(--ok-ink); }
.tick.bad { color: var(--bad-ink); }
.tick.warn { color: var(--warn-ink); }
.msg .why { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line-strong); font-size: 12.5px; color: var(--ink-2); white-space: normal; }
.composer { border-top: 1px solid var(--line); padding: 12px 18px 14px; background: var(--surface); }
.composer .notice { margin-bottom: 10px; }
.composer-row { display: flex; gap: 10px; align-items: flex-end; }
.composer textarea { flex: 1; resize: none; border-radius: 14px; background: var(--surface-2); min-height: 42px; max-height: 150px; }
.composer select { width: auto; max-width: 100%; padding: 5px 30px 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 550; background-color: var(--surface-2); margin-bottom: 8px; }
.btn.send { width: 42px; min-height: 42px; padding: 0; border-radius: 50%; flex: none; }
.hint { margin: 6px 2px 0; font-size: 11.5px; color: var(--muted); }
.tpl-values { flex: 1; min-width: 0; }
.tpl-preview { padding: 9px 12px; border-radius: 14px 14px 5px 14px; background: var(--out); margin-bottom: 8px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; }
.tpl-values .row > input { flex: 1; min-width: 140px; }
td.wording { max-width: 460px; white-space: pre-wrap; overflow-wrap: anywhere; }
.big { font-size: 18px; font-weight: 680; }
.pad { padding: 16px 18px; margin: 0; }
.setupkey { margin-top: 6px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--line-strong); font-size: 15px; letter-spacing: .08em; user-select: all; overflow-wrap: anywhere; }
.switchrow { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.switchrow.on { background: var(--bad-bg); margin: 0 -22px; padding: 14px 22px; }
.switchrow .who { margin-bottom: 2px; }
dialog.dlg h2 { margin-bottom: 8px; }
dialog.dlg textarea.mono { font-size: 12.5px; margin-bottom: 12px; }
.toolbar select { width: auto; }
td select { width: auto; padding: 5px 28px 5px 10px; font-size: 13px; }
.auth-card form > p.small { margin: 14px 0 0; text-align: center; }
.btn.ghost.block { margin-top: 8px; }
.howto { margin: 0; padding-left: 20px; display: grid; gap: 12px; color: var(--ink-2); font-size: 13.5px; }
.card p.small .ic { display: inline-block; vertical-align: -2px; }
.info { border-left: 1px solid var(--line); overflow: auto; background: var(--surface); min-height: 0; }
.info-head { display: flex; align-items: center; justify-content: space-between; padding: 0 18px; min-height: 64px; border-bottom: 1px solid var(--line); font-weight: 650; }
.info .body { padding: 20px 18px; }
.profile { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding-bottom: 18px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.profile .t { font-weight: 680; font-size: 16.5px; margin-top: 8px; }
.info .label { display: block; margin: 20px 0 6px; }
.empty { display: grid; place-items: center; height: 100%; color: var(--muted); text-align: center; padding: 24px; }
.blank { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 44px 20px; }
.blank-ic { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--brand-soft); color: var(--brand); margin-bottom: 8px; }
.blank p { max-width: 380px; margin: 0 0 10px; }

/* ------------------------------------------------------------------ tables, stats, wallet */
.tablecard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); overflow: hidden; margin: 0 0 20px; }
.tablecard > .card-head { padding: 16px 18px 0; }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 18px; border-bottom: 1px solid var(--line); font-size: 13.5px; vertical-align: middle; }
th { color: var(--muted); font-weight: 650; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; background: var(--surface-2); white-space: nowrap; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.act { text-align: right; width: 1%; white-space: nowrap; }
.who { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.amt.pos { color: var(--ok-ink); font-weight: 650; }
.amt.neg { color: var(--ink); font-weight: 650; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin: 0 0 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-1); }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat .k { color: var(--muted); font-size: 13px; }
.balance { position: relative; overflow: hidden; padding: 26px 28px; border-radius: 18px; color: #fff; background: radial-gradient(500px 240px at 100% 0%, rgba(255, 255, 255, .22), transparent 60%), var(--grad); box-shadow: 0 14px 34px rgba(10, 143, 99, .3); }
.balance .label { color: rgba(255, 255, 255, .8); }
.balance .v { font-size: 40px; font-weight: 720; letter-spacing: -.035em; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.balance .k { color: rgba(255, 255, 255, .82); font-size: 13.5px; }
.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar .search { width: min(320px, 100%); }
.filepick { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; flex-wrap: wrap; }
.filepick input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.filepick input:focus-visible + .btn { outline: 2px solid var(--brand); outline-offset: 2px; }

/* phone preview */
.phone { border-radius: 26px; padding: 10px; background: #0b1512; box-shadow: var(--shadow-2); max-width: 300px; margin: 0 auto; }
.phone-screen { border-radius: 18px; overflow: hidden; background-color: var(--chat-bg); background-image: radial-gradient(var(--chat-dot) 1px, transparent 1px); background-size: 18px 18px; min-height: 300px; display: flex; flex-direction: column; }
.phone-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #0f5d44; color: #fff; font-weight: 620; font-size: 13.5px; }
.phone-body { padding: 14px 12px; display: flex; flex-direction: column; }
.phone .msg { max-width: 92%; font-size: 13.5px; }

/* ------------------------------------------------------------------ dialog and toasts */
dialog.dlg { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink); padding: 24px; width: calc(100% - 32px); max-width: 440px; box-shadow: var(--shadow-3); animation: rise .18s ease both; }
dialog.dlg::backdrop { background: rgba(6, 12, 10, .55); backdrop-filter: blur(3px); }
dialog.dlg p { font-size: 15px; font-weight: 550; }
.dlg-actions { margin-top: 18px; justify-content: flex-end; }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 40px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 12px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-3); font-size: 13.5px; font-weight: 550; animation: rise .25s ease both; }
.toast .ic { margin-top: 2px; color: var(--side-accent); }
.toast.bad .ic { color: #ff9c9c; }

/* ------------------------------------------------------------------ smaller screens */
@media (max-width: 1240px) {
  .inbox { grid-template-columns: 310px minmax(0, 1fr); }
  .info { position: absolute; top: 0; right: 0; bottom: 0; width: min(330px, 100%); transform: translateX(105%); transition: transform .2s ease; z-index: 5; visibility: hidden; }
  .inbox.show-info .info { transform: none; visibility: visible; box-shadow: var(--shadow-3); }
  .only-mid { display: inline-flex; }
}
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-logo-sm { display: inline-flex; }
  .shell { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .topbar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--side-bg); color: #fff; }
  .topbar .btn.icon { background: transparent; color: #fff; box-shadow: none; }
  .side { position: fixed; top: 0; bottom: 0; left: 0; width: 272px; z-index: 30; transform: translateX(-105%); transition: transform .2s ease; visibility: hidden; }
  .shell.nav-open .side { transform: none; visibility: visible; box-shadow: var(--shadow-3); }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 20; background: rgba(6, 12, 10, .55); border: 0; }
  .page { padding: 20px 16px 40px; }
  .grid2, .split, .formgrid { grid-template-columns: minmax(0, 1fr); }
  .hero { padding: 22px 20px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .tile { padding: 14px; }
  .tile .v { font-size: 22px; }
  .inbox { grid-template-columns: 1fr; }
  .inbox.has-open .list { display: none; }
  .inbox:not(.has-open) .thread { display: none; }
  .only-narrow { display: inline-flex; }
  .msgs { padding: 14px; }
  .thread-head { padding: 10px 12px; gap: 10px; }
  .thread-head .chip { display: none; }
  .msg { max-width: 86%; }
  th, td { padding: 11px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
