/* WeVault web app — light only (the OS dark setting is ignored on purpose).
   Every color is a token below. Dark mode follows the OS unless the Settings > Appearance
   switch pins it (data-theme="light|dark" on <html>, set from localStorage in <head>). */
* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }

:root {
  color-scheme: light;
  color-scheme: light;
  --bg: #F5F6F8; --surface: #FFFFFF; --surface-2: #EFF1F4; --line: #E4E7EB;
  --ink: #0E1116; --muted: #6B7280; --faint: #9CA3AF;
  --accent: #16A34A; --accent-ink: #15803D; --on-accent: #FFFFFF; --accent-soft: #DCFCE7;
  --good: #16A34A; --good-soft: #E8F7EE;
  --bad: #DC2626;  --bad-soft: #FDECEC;
  --warn: #D97706; --warn-soft: #FEF3E2;
  --blue: #2563EB; --blue-soft: #EAF1FE;
  --overlay: rgba(14,17,22,.45);
  --shadow: none;
  --boost: 1;
  /* older names still referenced here and in app-mobile.css */
  --panel: var(--surface); --panel2: var(--surface-2); --text: var(--ink);
  --r: 12px; --r-sm: 8px; --radius: var(--r); --radius-sm: var(--r-sm);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

html { background: var(--bg); }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 16px; }
h2 { font-size: 15px; font-weight: 650; letter-spacing: -.01em; margin-bottom: 12px; }
b, strong { font-weight: 650; }
::selection { background: var(--accent-soft); }

/* ---------- shell: sidebar + main ---------- */
.shell { display: flex; min-height: 100vh; }
.side { width: 216px; flex: 0 0 216px; background: var(--surface); border-right: 1px solid var(--line); padding: 20px 12px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 750; font-size: 17px; letter-spacing: -.02em; margin-bottom: 20px; padding-left: 10px; color: var(--ink); }
.brand span { color: var(--accent-ink); }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a { color: var(--muted); padding: 8px 10px; border-radius: var(--r-sm); display: flex; align-items: center; gap: 6px; font-weight: 500; transition: background-color .12s, color .12s; }
.side nav a:hover { text-decoration: none; background: var(--surface-2); color: var(--ink); }
.side nav a.on { background: var(--surface-2); color: var(--ink); font-weight: 650; }
.side-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line); font-size: 13px; }
.side-foot a { color: var(--muted); }
.who { font-weight: 650; }
.main { flex: 1; min-width: 0; padding: 26px 32px 40px; max-width: 1240px; }
.badge { background: var(--bad); color: var(--surface); font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 999px; margin-left: auto; }

/* mobile nav drawer + scroll lock — desktop defaults; mobile overrides below */
.mobile-bar { display: none; }
.nav-toggle { background: none; border: 0; color: var(--ink); cursor: pointer; padding: 6px; display: inline-flex; align-items: center; }
.nav-backdrop { display: none; position: fixed; inset: 0; background: var(--overlay); z-index: 62; }
.nav-backdrop.show { display: block; }
body.scroll-lock { overflow: hidden; }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.month-nav { display: inline-flex; align-items: center; gap: 6px; }
.month-nav b { min-width: 118px; text-align: center; font-weight: 650; }
.month-nav .btn-sm.off { opacity: .35; pointer-events: none; }

/* ---------- stat cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin-bottom: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; min-width: 0; }
.card .k { color: var(--muted); font-size: 13px; font-weight: 500; }
.card .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin: 6px 0 4px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.card .v .unit { font-size: 14px; font-weight: 500; letter-spacing: 0; white-space: nowrap; }
.bar { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 8px 0; }
.bar i { display: block; height: 100%; border-radius: 999px; }
.bar i.good { background: var(--good); } .bar i.bad { background: var(--bad); }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.cols > * { min-width: 0; }
@media (max-width: 980px) { .cols { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; margin-bottom: 16px; overflow-x: auto; }
.cols > .panel { margin-bottom: 0; }
details.panel > summary { cursor: pointer; }
details.panel > summary::marker { color: var(--faint); }
h2 .sub, h1 .sub { font-weight: 500; color: var(--muted); font-size: 13px; margin-left: 6px; letter-spacing: 0; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { text-align: left; color: var(--muted); font-size: 12px; font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); background: transparent; white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
td.r, th.r { text-align: right; }
.txtable td.desc { max-width: 320px; }
.txtable.full td:first-child { white-space: nowrap; }
.panel th:first-child, .panel td:first-child { padding-left: 0; }
.panel th:last-child, .panel td:last-child { padding-right: 0; }
.txtable tr.txrow:hover td, .txtable tr[data-tx]:hover td { background: var(--surface-2); }

.good-t { color: var(--good); } .bad-t { color: var(--bad); } .warn-t { color: var(--warn); } .blue-t { color: var(--blue); } .accent-t { color: var(--accent-ink); }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .nowrap { white-space: nowrap; }

/* ---------- chips ---------- */
.chip { display: inline-block; padding: 1px 9px; border: 1px solid transparent; border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 1.6; background: var(--surface-2); color: var(--muted); white-space: nowrap; vertical-align: middle; }
.chip.active, .chip.st-confirmed, .chip.ok { color: var(--good); background: var(--good-soft); }
.chip.pending, .chip.st-ai { color: var(--blue); background: var(--blue-soft); }
.chip.delinquent, .chip.st-needs_review { color: var(--warn); background: var(--warn-soft); }
.chip.dissolved, .chip.st-uncategorized, .chip.bad { color: var(--bad); background: var(--bad-soft); }
.chip.note { color: var(--blue); background: var(--blue-soft); }
.chip.sc-business { color: var(--blue); background: var(--blue-soft); }
.chip.sc-personal { color: var(--accent-ink); background: var(--accent-soft); }
.chip.sc-neutral  { color: var(--muted); background: var(--surface-2); }
.chip.sc-none     { color: var(--bad); background: var(--bad-soft); }
.txtable .chip { font-weight: 600; }

/* ---------- forms ---------- */
:where(input, select, textarea, button) { font: inherit; color: inherit; }
:where(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]), select, textarea) {
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-sm);
  transition: border-color .12s, background-color .12s;
}
:where(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea):focus {
  outline: none; border-color: var(--accent); background: var(--surface); box-shadow: none;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
input[type="file"] { color: var(--muted); font-size: 13px; }
input[type="file"]::file-selector-button { font: inherit; font-weight: 600; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px 12px; margin-right: 10px; cursor: pointer; }
select { padding: 6px 10px; }

.form label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--ink); font-weight: 600; }
.form input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), .form select, .form textarea { display: block; width: 100%; margin-top: 5px; padding: 9px 11px; font-weight: 400; }
.form input[type="file"] { display: block; width: 100%; margin-top: 6px; padding: 4px 0; border: 0; background: none; }
.form label .muted { font-weight: 400; }

/* buttons: primary = gold, everything else neutral */
.form button, .login-card button, .btn-primary {
  background: var(--accent); color: var(--on-accent); border: 1px solid var(--accent); border-radius: var(--r-sm);
  padding: 9px 18px; font-weight: 650; cursor: pointer; transition: filter .12s, transform .04s;
}
.form button:hover, .login-card button:hover, .btn-primary:hover { filter: brightness(.95); }
.form button:active, .btn-primary:active, .btn-sm:active, .tab:active {  }
.btn-sm, .btn {
  display: inline-block; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px 12px; font-size: 13px; font-weight: 550;
  background: var(--surface); color: var(--ink); cursor: pointer; line-height: 1.4; transition: background-color .12s, border-color .12s;
}
.btn { padding: 8px 16px; font-size: 14px; }
.btn-sm:hover, .btn:hover { background: var(--surface-2); text-decoration: none; }
/* the generic .form button rule above must not turn small/inline buttons gold */
.form .btn-sm, .form .mini-btn, .form button.x, .form button.danger { background: var(--surface); color: var(--ink); border: 1px solid var(--line); padding: 6px 12px; font-weight: 550; }
button.danger, .form button.danger { background: transparent; color: var(--bad); border: 1px solid var(--bad); border-radius: var(--r-sm); padding: 7px 14px; cursor: pointer; font-weight: 600; }
button.danger:hover { background: var(--bad-soft); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }
select.mini, input.mini { padding: 4px 8px; font-size: 12.5px; max-width: 150px; border-radius: 6px; }
.mini-btn { background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; color: var(--good); cursor: pointer; padding: 3px 8px; font-weight: 700; }
.mini-btn:hover { border-color: var(--good); }
.inline-bal { display: flex; gap: 4px; justify-content: flex-end; }
button.x { background: none; border: 0; color: var(--faint); cursor: pointer; padding: 2px 6px; border-radius: 6px; }
button.x:hover { color: var(--bad); background: var(--bad-soft); }

.alert { background: var(--bad-soft); border: 1px solid transparent; color: var(--bad); border-radius: var(--r-sm); padding: 10px 14px; margin-bottom: 14px; }
.alert.warn { background: var(--warn-soft); color: var(--ink); }
.alert.good { background: var(--good-soft); color: var(--good); }
.alert.info { background: var(--surface-2); color: var(--ink); }
.alert .item { margin-left: 10px; display: inline-block; }
.toolbar { margin-bottom: 14px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar label { display: flex; align-items: center; gap: 6px; }
.tab { padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: var(--surface); font-weight: 550; transition: background-color .12s; }
.tab:hover { text-decoration: none; background: var(--surface-2); }
.tab.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* segmented control (dashboard filters, Settings > Appearance) */
.seg, .txf-group { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: var(--r-sm); }
.seg button, .txf { background: transparent; border: 0; border-radius: 6px; padding: 6px 13px; font-weight: 550; color: var(--muted); cursor: pointer; transition: background-color .12s, color .12s; }
.seg button:hover, .txf:hover { color: var(--ink); }
.seg button.on, .txf.on { background: var(--ink); color: var(--bg); }
.seg button { padding: 7px 18px; }

/* ---------- login ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); padding: 16px; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 32px; width: 360px; max-width: 100%; }
.login-card h1 { text-align: center; margin-bottom: 20px; }
.login-card h1 span { color: var(--accent-ink); }
.login-card label { display: block; margin-bottom: 14px; font-size: 13px; font-weight: 600; }
.login-card label.check { font-weight: 400; display: flex; align-items: center; gap: 8px; }
.login-card input:not([type="checkbox"]) { display: block; width: 100%; margin-top: 5px; padding: 10px 12px; }
.login-card button { width: 100%; padding: 11px; }
.login-card .foot { text-align: center; margin-top: 16px; }
.login-card .foot a { color: var(--muted); }

/* ---------- legacy chat panel (web chat now lives in the app) ---------- */
.chat-panel { display: flex; flex-direction: column; height: calc(100vh - 130px); }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 6px 2px; }
.msg { max-width: 70%; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.msg.mine { align-self: flex-end; background: var(--surface-2); }
.msg .meta { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.msg .body { white-space: pre-wrap; word-break: break-word; }
.chat-form { display: flex; gap: 8px; margin-top: 10px; }
.chat-form input { flex: 1; padding: 9px 12px; }
.chat-form button { background: var(--accent); color: var(--on-accent); border: 0; border-radius: var(--r-sm); padding: 0 20px; font-weight: 650; cursor: pointer; }

/* ---------- AI assistant (floating button + side panel) ---------- */
.ai-fab {
  position: fixed; bottom: 20px; right: 20px; z-index: 55;
  background: var(--accent); color: var(--on-accent); border: none; border-radius: 50%;
  width: 52px; height: 52px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: none; transition: filter .12s;
}
.ai-fab svg { width: 24px; height: 24px; }
.ai-fab:hover { filter: brightness(.95); }
.ai-panel {
  position: fixed; top: 0; right: -420px; width: 400px; max-width: 92vw;
  height: 100vh; height: 100dvh; /* dvh excludes the mobile address bar so the input stays reachable */
  background: var(--surface); border-left: 1px solid var(--line); z-index: 75;
  display: flex; flex-direction: column; transition: right .22s ease; box-shadow: none;
}
.ai-panel.open { right: 0; }
.ai-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.ai-x { background: none; border: 0; font-size: 16px; color: var(--muted); cursor: pointer; }
.ai-log { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.ai-msg { padding: 9px 12px; border-radius: 12px; font-size: 13.5px; line-height: 1.5; max-width: 92%; }
.ai-bot { background: var(--surface-2); align-self: flex-start; }
.ai-me { background: var(--accent); color: var(--on-accent); align-self: flex-end; }
.ai-form { display: flex; gap: 8px; padding: 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.ai-form input { flex: 1; padding: 9px 11px; font-size: 16px; /* >=16px stops iOS auto-zoom on focus */ }
.ai-form button { background: var(--accent); color: var(--on-accent); border: 0; border-radius: var(--r-sm); padding: 0 16px; font-weight: 650; cursor: pointer; }

/* ---------- entity launcher bubbles ---------- */
.entity-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.entity-bubble {
  display: flex; align-items: center; gap: 9px; padding: 7px 14px 7px 7px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; color: var(--ink);
  transition: border-color .12s, background-color .12s;
}
.entity-bubble:hover { text-decoration: none; border-color: var(--faint); }
.ebadge { width: 28px; height: 28px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.entity-bubble .ename { font-weight: 650; font-size: 13px; }
.entity-bubble .small { margin-left: 2px; font-variant-numeric: tabular-nums; }

/* ---------- expandable category rows (Personal) ---------- */
.cat-drop { border-bottom: 1px solid var(--line); }
.cat-drop:last-of-type { border-bottom: 0; }
.cat-drop > summary { display: flex; align-items: center; gap: 10px; padding: 9px 4px; cursor: pointer; list-style: none; border-radius: 6px; }
.cat-drop > summary::-webkit-details-marker { display: none; }
.cat-drop > summary::before { content: '▸'; color: var(--faint); font-size: 11px; transition: transform .12s; }
.cat-drop[open] > summary::before { transform: rotate(90deg); }
.cat-drop > summary:hover { background: var(--surface-2); }
.cat-name { font-weight: 600; font-size: 13px; min-width: 130px; }
.cat-amt { font-weight: 650; font-variant-numeric: tabular-nums; }
.cat-n { margin-left: 2px; }
.cat-bar { flex: 1; height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; min-width: 60px; }
.cat-bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.cat-txlist { max-height: 220px; overflow-y: auto; margin: 2px 0 10px 22px; background: var(--surface-2); border-radius: var(--r-sm); }
.cat-txrow { display: flex; align-items: center; gap: 10px; padding: 5px 8px; font-size: 12.5px; border-bottom: 1px solid var(--line); }
.cat-txrow:last-child { border-bottom: 0; }
.cat-txdate { flex: 0 0 42px; font-variant-numeric: tabular-nums; }
.cat-txdesc { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-txamt { flex: 0 0 auto; font-weight: 650; font-variant-numeric: tabular-nums; }
.cat-total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; display: flex; justify-content: space-between; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- document preview modal ---------- */
.doc-modal { position: fixed; inset: 0; background: var(--overlay); z-index: 80; display: none; align-items: center; justify-content: center; }
.doc-modal.open { display: flex; }
.doc-modal-inner { background: var(--surface); width: 90%; max-width: 900px; height: 88vh; border-radius: var(--r); border: 1px solid var(--line); overflow: hidden; display: flex; flex-direction: column; }
.doc-modal-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); font-weight: 650; }
.doc-modal-bar #docModalTitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: 12px; }
#docModalFrame { flex: 1; width: 100%; border: 0; background: var(--surface); }
a.doc-preview { cursor: pointer; }

/* ---------- dashboard: recent transactions ---------- */
.txfilter { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.txf-sel { padding: 6px 10px; }
.txtable { width: 100%; }
.panel-foot { margin-top: 10px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.panel-foot a { color: var(--muted); font-size: 12.5px; }

/* ---------- charts (inline SVG) ---------- */
.chart-svg { width: 100%; height: auto; font-size: 11px; font-family: var(--font); }
.ch-grid { stroke: var(--line); }
.ch-zero, .ch-cross { stroke: var(--faint); }
.ch-lbl { fill: var(--muted); }
.ch-ink { fill: var(--ink); }
.ch-good { stroke: var(--good); } .ch-good-f { fill: var(--good); }
.ch-blue { stroke: var(--blue); } .ch-blue-f { fill: var(--blue); }
.ch-ring { stroke: var(--surface); }
.ch-tip { position: absolute; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px 10px; font-size: 12px; pointer-events: none; white-space: nowrap; z-index: 5; box-shadow: none; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.donut-wrap { display: flex; gap: 20px; flex-wrap: wrap; align-items: center; }
.donut-legend { flex: 1; min-width: 180px; }
.donut-legend .row { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; font-size: 13px; }
.donut-legend .row .sw { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.donut-legend .row .nm { flex: 1; min-width: 0; }
.donut-legend .row .muted { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- LLC page: extracted document pills ---------- */
.doc-pills td { padding-top: 2px !important; padding-bottom: 10px !important; border-top: 0 !important; }
.doc-pill { display: inline-block; background: var(--surface-2); border-radius: 999px; padding: 2px 10px; font-size: 12px; margin: 0 5px 5px 0; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: top; }
.doc-pill b { font-weight: 600; color: var(--muted); }
.checklist { margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 5px; }

/* ---------- vault document cards ---------- */
.vault-doc { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; background: var(--surface); }
.vd-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vd-name { font-weight: 650; word-break: break-word; color: var(--ink); }
.vd-size { margin-left: auto; white-space: nowrap; }
.vd-pills { margin: 10px 0 2px; }
.vd-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.vd-actions .btn-sm, .vd-actions summary { padding: 5px 12px; }
.vd-refile { position: relative; }
.vd-refile > summary { list-style: none; cursor: pointer; display: inline-block; }
.vd-refile > summary::-webkit-details-marker { display: none; }
.vd-refile[open] > summary { background: var(--surface-2); }
.vd-refile-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; background: var(--surface-2); border-radius: var(--r-sm); padding: 10px; }
.vd-refile-form .mini { max-width: 100%; background: var(--surface); }
.vd-delform { margin-left: auto; }
.btn-sm.vd-del, .vd-del { color: var(--bad); }
.btn-sm.vd-del:hover, .vd-del:hover { background: var(--bad-soft); border-color: var(--bad); }
.vault-group > summary { font-weight: 650; font-size: 14px; cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
.vault-group > summary::-webkit-details-marker { display: none; }
.vault-group > summary::before { content: "▸"; color: var(--faint); font-size: 12px; }
.vault-group[open] > summary::before { content: "▾"; }
.vault-group-body { margin-top: 12px; }
.vault-group > summary .small { font-weight: 500; }

/* ---------- assets ---------- */
.asset-card { border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; margin-bottom: 14px; background: var(--surface); }
.ac-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.ac-name { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.ac-values { text-align: right; }
.ac-val { font-size: 22px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ac-notes { margin-top: 8px; }
.ac-docs { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.ac-manage { margin-top: 12px; }
.ac-manage > summary { list-style: none; cursor: pointer; display: inline-block; }
.ac-manage > summary::-webkit-details-marker { display: none; }
.ac-manage-body { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.ac-upload { background: var(--surface-2); border-radius: var(--r-sm); padding: 12px; margin-bottom: 14px; }
.ac-upload label { display: block; margin-bottom: 8px; }
.ac-chart { margin: 12px 0 4px; }
.ac-recordval { background: var(--surface-2); border-radius: var(--r-sm); padding: 12px; margin-bottom: 14px; }
.ac-upload .btn-sm, .ac-recordval .btn-sm, .ac-recordval .mini { background: var(--surface); }
.ac-recordrow { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.ac-recordrow .mini { max-width: 170px; }

/* ---------- review card ---------- */
.rev-desc { font-size: 17px; font-weight: 650; margin-top: 10px; overflow-wrap: anywhere; }
.rev-amt { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin: 4px 0; font-variant-numeric: tabular-nums; }
.rev-fields { margin: 16px 0; display: flex; gap: 16px; flex-wrap: wrap; }
.rev-fields label { display: flex; flex-direction: column; gap: 4px; }
.rev-fields .mini { max-width: 240px; width: 240px; }
.rev-mode { margin: 10px 0; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.rev-lbl { font-weight: 650; margin: 12px 0 8px; }
.rev-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.rev-rule { display: flex; gap: 8px; align-items: flex-start; margin-top: 16px; }
.rev-rule input { margin-top: 3px; }
.rev-nav { margin-top: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
#revBody .revcat { padding: 9px 14px; font-size: 13px; }
#revBody .revcat:hover { border-color: var(--accent); }
#revBody .btn-sm.sel, #revBody .revcat.sel { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); font-weight: 650; }
#revBody .chip { border-radius: 999px; }

/* ---------- privacy policy ---------- */
.prose { max-width: 720px; margin: 40px auto; padding: 0 16px; line-height: 1.6; }
.prose h1 { margin-bottom: 6px; }
.prose h2 { margin: 24px 0 8px; }
.prose p { margin: 0 0 12px; }

/* ---------- settings ---------- */
.narrow { max-width: 640px; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; margin-top: 4px; }

/* ---------- mobile ---------- */
@media (max-width: 860px) {
  .mobile-bar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 45; background: var(--surface); border-bottom: 1px solid var(--line); padding: 9px 12px; }
  .mobile-bar .brand { margin-bottom: 0; font-size: 16px; padding-left: 0; }
  .shell { flex-direction: column; }
  .side {
    position: fixed; top: 0; left: 0; z-index: 66;
    width: 248px; max-width: 82vw; height: 100vh; height: 100dvh;
    transform: translateX(-100%); transition: transform .22s ease;
    flex-direction: column; align-items: stretch; border-right: 1px solid var(--line); border-bottom: 0;
    box-shadow: none; overflow-y: auto; overscroll-behavior: contain;
  }
  .side.open { transform: translateX(0); }
  .side nav a { padding: 10px 10px; white-space: nowrap; font-size: 15px; }
  .main { padding: 16px 16px 32px; max-width: 100%; }
  h1 { font-size: 21px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr 1fr; gap: 8px; }
  .card { padding: 12px; }
  .card .v { font-size: 19px; }
  .txtable td.desc { max-width: 180px; }
  /* only the TABLE scrolls sideways — not the panel — so titles/filters above it stay put */
  .panel { overflow-x: visible; padding: 14px; }
  .panel > table, table { display: block; width: 100%; min-width: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; white-space: nowrap; }
  .form, .login-card { min-width: 0; }
  /* prevents iOS zoom-on-focus */
  .form input, .form select, .form textarea,
  .login-card input, .chat-form input, .ai-form input,
  select.mini, input.mini { font-size: 16px; }
  .msg { max-width: 90%; }
  .chat-panel { height: calc(100vh - 210px); }
  .entity-nav { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .entity-nav::-webkit-scrollbar { display: none; }
  .entity-bubble { flex: 0 0 auto; }
  .ai-fab { top: 7px; right: 12px; bottom: auto; width: 38px; height: 38px; box-shadow: none; }
  .ai-fab svg { width: 20px; height: 20px; }
  .ai-panel { width: 100%; max-width: 100%; right: -100%; }
  input, select, textarea { font-size: 16px; }
  .vd-refile-form .mini { flex: 1 1 100%; max-width: none; }
  .vd-delform { margin-left: 0; }
  .ac-values { text-align: left; } .ac-val { font-size: 19px; }
  .rev-fields .mini { width: 100%; max-width: none; }
  .rev-fields label { flex: 1 1 100%; }
  .month-nav b { min-width: 0; }
  .alert .item { display: block; margin: 4px 0 0; }
  .txfilter .txf-group { display: flex; width: 100%; }
  .txfilter .txf { flex: 1 1 0; padding: 6px 4px; }
  .txfilter .txf-sel { flex: 1 1 100%; }
  .cat-drop > summary { gap: 8px; }
  .cat-name { min-width: 0; flex: 1 1 auto; }
  .cat-n { white-space: nowrap; }
  .cat-bar { flex: 0 0 44px; min-width: 0; }
}

/* =================================================================
   API-driven pages: notifications, dialogs, calendar, chat, assistant
   ================================================================= */

/* ---------- sidebar head + notifications bell ---------- */
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 20px; }
.side-head .brand { margin-bottom: 0; }
.bell-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--muted); cursor: pointer; flex: 0 0 auto; padding: 0; }
.bell-btn:hover, .bell-btn[aria-expanded="true"] { background: var(--surface-2); color: var(--ink); }
.bell-count { position: absolute; top: 0; right: -3px; min-width: 17px; height: 17px; padding: 0 5px; border-radius: 999px; background: var(--bad); color: var(--surface); font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center; }
.bell-count[hidden], .badge[hidden] { display: none !important; }
.notif-panel { position: fixed; z-index: 90; width: 380px; max-width: calc(100vw - 24px); max-height: min(72vh, 640px); display: none; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: none; overflow: hidden; }
.notif-panel.open { display: flex; }
.np-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.np-actions { display: flex; gap: 6px; }
.np-actions .btn-sm { padding: 4px 10px; font-size: 12px; }
.np-list { overflow-y: auto; overscroll-behavior: contain; }
.np-item { display: flex; align-items: flex-start; gap: 11px; padding: 11px 14px; border-bottom: 1px solid var(--line); cursor: pointer; outline: none; }
.np-item:last-child { border-bottom: 0; }
.np-item:hover, .np-item:focus-visible { background: var(--surface-2); }
.np-item.unread { background: var(--accent-soft); }
.np-item.unread:hover { background: var(--accent-soft); filter: brightness(.97); }
.np-item.nolink { cursor: default; }
.np-ic { flex: 0 0 32px; height: 32px; border-radius: 50%; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: 15px; }
.np-item.unread .np-ic { background: var(--surface); }
.np-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.np-main b { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.np-item.unread .np-main b { font-weight: 700; }
.np-main span { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.np-main time { font-size: 11.5px; color: var(--faint); }
.np-check { flex: 0 0 auto; border: 0; background: transparent; color: var(--muted); width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 14px; padding: 0; }
.np-check:hover { background: var(--surface); color: var(--good); }
.np-empty { padding: 44px 16px; text-align: center; color: var(--muted); }

/* ---------- dialog, toast, inline confirm ---------- */
.ct-modal { position: fixed; inset: 0; z-index: 95; background: var(--overlay); display: flex; align-items: center; justify-content: center; padding: 16px; opacity: 0; transition: opacity .15s; }
.ct-modal.open { opacity: 1; }
.ct-dialog { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; width: 100%; max-width: 520px; max-height: calc(100dvh - 32px); display: flex; flex-direction: column; box-shadow: none; transform: translateY(8px); transition: transform .15s; }
.ct-modal.open .ct-dialog { transform: none; }
.ct-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 4px; }
.ct-dialog-head h2 { margin: 0; font-size: 17px; }
.ct-x { border: 0; background: transparent; color: var(--muted); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 15px; padding: 0; flex: 0 0 auto; }
.ct-x:hover { background: var(--surface-2); color: var(--ink); }
.ct-dialog-body { padding: 10px 18px 18px; overflow-y: auto; overscroll-behavior: contain; }
.ct-toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px); z-index: 100; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 550; opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; max-width: calc(100vw - 32px); text-align: center; }
.ct-toast.show { opacity: 1; transform: translate(-50%, 0); }
.ct-toast.bad { background: var(--bad); color: var(--surface); }
.confirming { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.confirm-q { font-weight: 600; font-size: 13.5px; margin-right: auto; overflow-wrap: anywhere; }
.btn-sm.danger-solid { background: var(--bad); border-color: var(--bad); color: var(--surface); }
.btn-sm.danger-solid:hover { background: var(--bad); filter: brightness(.95); }
.btn-sm.danger-line { color: var(--bad); }
.btn-sm.danger-line:hover { background: var(--bad-soft); border-color: var(--bad); }

/* dialog form bits */
.fx-field { margin-bottom: 14px; }
.fx-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.fx-field input:not([type="checkbox"]), .fx-field select, .fx-field textarea { width: 100%; padding: 9px 11px; }
.fx-field textarea { resize: vertical; min-height: 64px; }
.fx-title { font-size: 16px !important; font-weight: 600; }
.fx-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fx-row > input, .fx-row > select { flex: 1 1 130px; min-width: 0; }
.fx-row .to { color: var(--muted); font-size: 13px; flex: 0 0 auto; }
.pick-group { display: flex; flex-wrap: wrap; gap: 6px; }
.pick { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 500; cursor: pointer; }
.pick:hover { background: var(--surface-2); }
.pick i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; filter: brightness(var(--boost)); }
.pick.on { border-color: var(--ink); background: var(--surface-2); font-weight: 650; }
.seg.full { display: flex; width: 100%; }
.seg.full button { flex: 1 1 0; padding: 7px 6px; }
.switch-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 0 12px; font-weight: 600; font-size: 14px; cursor: pointer; }
.tgl { appearance: none; -webkit-appearance: none; width: 42px; height: 24px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background .15s; flex: 0 0 auto; margin: 0; }
.tgl::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: none; transition: transform .15s; }
.tgl:checked { background: var(--accent); }
.tgl:checked::after { transform: translateX(18px); }
.fx-actions { display: flex; gap: 8px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.fx-actions .btn-primary { margin-left: auto; }
.fx-actions.confirming .confirm-q { margin-right: auto; }
.link-btn { background: none; border: 0; color: var(--accent-ink); font-weight: 600; font-size: 13px; cursor: pointer; padding: 4px 0; }
.link-btn:hover { text-decoration: underline; }
.icon-x { border: 0; background: transparent; color: var(--muted); width: 32px; height: 32px; border-radius: 50%; cursor: pointer; flex: 0 0 auto !important; padding: 0; }
.icon-x:hover { background: var(--surface-2); color: var(--ink); }
.dt-lines { display: flex; flex-direction: column; gap: 9px; margin: 4px 0 6px; }
.dt-line { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.dt-line .ic { flex: 0 0 20px; text-align: center; color: var(--muted); }
.dt-line .tx { flex: 1; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.dt-title { display: flex; gap: 10px; align-items: flex-start; font-size: 19px; font-weight: 700; letter-spacing: -.01em; margin-bottom: 14px; overflow-wrap: anywhere; }
.dt-title i { flex: 0 0 12px; height: 12px; border-radius: 50%; margin-top: 7px; filter: brightness(var(--boost)); }

/* ---------- calendar ---------- */
.cal-head .seg { margin-left: 2px; }
.cal-new { margin-left: auto; }
.seg-count { font-size: 11.5px; opacity: .7; margin-left: 2px; font-variant-numeric: tabular-nums; }
.cal-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.cal-month { padding: 14px 14px 10px; margin: 0; }
.cal-nav { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.cal-nav b { flex: 1; text-align: center; font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.cal-nav .arrow { width: 34px; height: 34px; border-radius: 50%; border: 0; background: transparent; color: var(--ink); cursor: pointer; font-size: 18px; padding: 0; }
.cal-nav .arrow:hover { background: var(--surface-2); }
.cal-dow, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow span { text-align: center; font-size: 11.5px; color: var(--muted); font-weight: 600; padding: 2px 0 6px; }
.cal-cell { background: transparent; border: 0; border-radius: 10px; height: 64px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0 0; cursor: pointer; color: var(--ink); min-width: 0; }
.cal-cell:hover { background: var(--surface-2); }
.cal-cell .d { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }
.cal-cell.out .d { color: var(--faint); }
.cal-cell.sel { background: var(--accent-soft); }
.cal-cell.sel .d { font-weight: 700; }
.cal-cell.today .d { background: var(--ink); color: var(--bg); font-weight: 700; }
.cal-dots { display: flex; align-items: center; gap: 3px; height: 8px; }
.cal-dots i { width: 6px; height: 6px; border-radius: 50%; display: block; filter: brightness(var(--boost)); }
.cal-dots i.todo { width: 7px; height: 7px; border: 1.5px solid var(--accent-ink); background: transparent; filter: none; }
.cal-dots em { font-style: normal; font-size: 9.5px; color: var(--muted); font-weight: 700; }
.cal-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.cal-side .panel { margin: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.panel-head h2 { margin: 0; }
.ev-row { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 8px 6px; background: transparent; border: 0; border-radius: 10px; text-align: left; cursor: pointer; color: var(--ink); }
.ev-row:hover { background: var(--surface-2); }
.ev-ic { flex: 0 0 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; }
.ev-ic svg { width: 17px; height: 17px; filter: brightness(var(--boost)); }
.ev-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ev-main b { font-weight: 650; font-size: 14px; overflow-wrap: anywhere; }
.ev-main small { color: var(--muted); font-size: 12.5px; }
.ev-row.past .ev-main b { color: var(--muted); text-decoration: line-through; }
.ev-by { font-size: 11.5px; color: var(--muted); padding-top: 2px; white-space: nowrap; }
.legend-key { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 12.5px; }
.legend-key span { display: inline-flex; align-items: center; gap: 6px; }
.legend-key i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; filter: brightness(var(--boost)); }
.empty-line { color: var(--muted); padding: 4px 6px 6px; }

/* ---------- to-dos ---------- */
.todo-wrap { max-width: 760px; }
.todo-filter { margin-bottom: 12px; }
.todo-list { padding: 4px 10px; margin-bottom: 8px; }
.todo-row { display: flex; align-items: center; gap: 12px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.todo-row:last-child { border-bottom: 0; }
.todo-check { flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--c, var(--accent)); background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; color: transparent; padding: 0; font-size: 12px; font-weight: 800; }
.todo-check:hover { background: var(--surface-2); color: var(--muted); }
.todo-row.done .todo-check { background: var(--good); border-color: var(--good); color: var(--surface); }
.todo-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; background: transparent; border: 0; text-align: left; cursor: pointer; padding: 2px 0; color: var(--ink); }
.todo-main b { font-weight: 600; font-size: 14.5px; overflow-wrap: anywhere; }
.todo-row.done .todo-main b { color: var(--muted); text-decoration: line-through; }
.todo-main small { font-size: 12.5px; color: var(--muted); }
.todo-main small.overdue { color: var(--bad); font-weight: 600; }
.todo-main small.today { color: var(--warn); font-weight: 600; }
.who-pill { flex: 0 0 auto; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); }
.who-pill.me { background: var(--accent-soft); color: var(--accent-ink); }
.done-toggle { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; color: var(--muted); font-weight: 650; font-size: 13px; cursor: pointer; padding: 6px 2px; margin: 8px 0 6px; }
.done-toggle:hover { color: var(--ink); }
.empty-state { padding: 30px 10px; text-align: center; color: var(--muted); }

/* ---------- chat + assistant ---------- */
body.page-chat .main, body.page-assistant .main { height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding-bottom: 20px; max-width: 1000px; }
body.page-chat .ai-fab { display: none; }
.cx-app { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.cx-app.drag { outline: 2px dashed var(--accent); outline-offset: -6px; }
.cx-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); min-height: 58px; }
.cx-tabs { display: flex; gap: 6px; min-width: 0; }
.cx-tab { display: flex; align-items: center; gap: 9px; padding: 5px 12px 5px 5px; border-radius: 999px; min-width: 0; }
.cx-tab.on { background: var(--surface-2); }
.cx-tab.off { opacity: .55; }
.cx-tab-txt { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.cx-tab-txt b { font-size: 14px; font-weight: 650; white-space: nowrap; }
.cx-tab-txt small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 14px; }
#chatStatus.live { color: var(--accent-ink); font-weight: 600; }
.cx-av { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; font-size: 15px; }
.cx-av.ai { background: var(--accent); color: var(--on-accent); }
.cx-av.lock { background: var(--surface); font-size: 13px; }
.cx-tab.off .cx-av.lock { background: var(--surface-2); }
.cx-title { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.cx-tools { display: flex; gap: 6px; align-items: center; flex: 0 0 auto; }
.cx-tools.confirming { flex: 0 1 auto; }
.cx-log { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px 10px; display: flex; flex-direction: column; background: var(--bg); }
.cx-empty { margin: auto; color: var(--muted); text-align: center; padding: 30px 10px; }
.cx-day, .cx-break { align-self: center; font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--surface); border: 1px solid var(--line); padding: 2px 10px; border-radius: 999px; margin: 12px 0 8px; }
.cx-break { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }
.cx-more { align-self: center; margin: 4px 0 8px; }
.msg-row { display: flex; flex-direction: column; align-items: flex-start; max-width: min(78%, 620px); margin: 3px 0; position: relative; align-self: flex-start; }
.msg-row.mine { align-self: flex-end; align-items: flex-end; }
.bubble { position: relative; padding: 7px 11px 5px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 100%; }
.msg-row.theirs .bubble { border-top-left-radius: 5px; }
.msg-row.mine .bubble { background: var(--accent-soft); border-color: transparent; border-top-right-radius: 5px; }
.msg-row.clickable .bubble { cursor: pointer; }
.bubble .ai-name { display: flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; color: var(--accent-ink); margin-bottom: 2px; white-space: normal; }
.bubble .meta { display: flex; justify-content: flex-end; gap: 4px; align-items: center; font-size: 10.5px; color: var(--faint); margin-top: 2px; white-space: nowrap; }
.bubble .meta .seen { color: var(--blue); }
.bubble.deleted { font-style: italic; color: var(--muted); }
.bubble b { font-weight: 700; }
.bubble a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
.reply-q { display: block; background: var(--surface-2); border-radius: 8px; padding: 5px 9px; margin: 2px 0 6px; font-size: 12.5px; color: var(--muted); white-space: normal; cursor: pointer; overflow: hidden; text-overflow: ellipsis; }
.msg-row.mine .reply-q { background: var(--surface); }
.reply-q b { display: block; color: var(--ink); font-size: 11.5px; }
.cx-img { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; margin: 2px 0 4px; cursor: zoom-in; background: var(--surface-2); min-width: 60px; min-height: 40px; object-fit: contain; }
.bubble video { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; margin: 2px 0 4px; background: #000; }
.bubble audio { display: block; max-width: 100%; margin: 2px 0 4px; }
.cx-file { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); color: var(--ink) !important; white-space: normal; margin: 2px 0 4px; text-decoration: none !important; }
.msg-row.mine .cx-file { background: var(--surface); }
.cx-file .fi { font-size: 20px; flex: 0 0 auto; }
.cx-file b { display: block; font-size: 13px; overflow-wrap: anywhere; }
.cx-file small { color: var(--muted); font-size: 11.5px; }
.ref-card { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 10px; background: var(--surface-2); margin-top: 6px; white-space: normal; font-size: 12.5px; color: var(--ink) !important; text-decoration: none !important; }
.msg-row.mine .ref-card { background: var(--surface); }
.ref-card .amt { margin-left: auto; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 6px; }
.mention { color: var(--accent-ink); font-weight: 650; }
.rx-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: -5px; padding: 0 8px; position: relative; z-index: 1; }
.rx { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 0 7px; font-size: 13px; cursor: pointer; line-height: 1.6; color: var(--ink); }
.rx.mine { border-color: var(--accent); background: var(--accent-soft); }
.msg-act { position: absolute; top: 6px; opacity: 0; border: 1px solid var(--line); background: var(--surface); color: var(--muted); width: 28px; height: 28px; border-radius: 50%; cursor: pointer; transition: opacity .12s; display: flex; align-items: center; justify-content: center; padding: 0; font-size: 15px; line-height: 1; }
.msg-row.theirs .msg-act { right: -34px; }
.msg-row.mine .msg-act { left: -34px; }
.msg-row:hover .msg-act, .msg-act:focus-visible { opacity: 1; }
@media (hover: none) { .msg-act { display: none; } }
.msg-row.pending .bubble { opacity: .6; }
.cx-typing { align-self: flex-start; display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); padding: 8px 4px 4px; }
.cx-typing .dots { display: inline-flex; gap: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 7px 9px; }
.cx-typing .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); animation: ctdot 1.2s infinite ease-in-out; }
.cx-typing .dots i:nth-child(2) { animation-delay: .15s; } .cx-typing .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes ctdot { 0%, 80%, 100% { opacity: .35; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .cx-typing .dots i { animation: none; } }
.msg-menu { position: fixed; z-index: 92; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: none; padding: 6px; width: 296px; max-width: calc(100vw - 16px); }
.mm-emoji { display: flex; flex-wrap: nowrap; justify-content: space-between; gap: 0; padding: 2px 2px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.mm-emoji button, .mm-grid button { border: 0; background: transparent; font-size: 20px; width: 31px; height: 34px; border-radius: 8px; cursor: pointer; padding: 0; line-height: 1; }
.mm-emoji button:hover, .mm-grid button:hover { background: var(--surface-2); }
.mm-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 0; max-height: 216px; overflow-y: auto; }
.mm-item { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border: 0; background: transparent; border-radius: 8px; font-size: 14px; color: var(--ink); cursor: pointer; text-align: left; }
.mm-item:hover { background: var(--surface-2); }
.mm-item.bad { color: var(--bad); }
.msg-menu .confirming { padding: 8px 6px 4px; justify-content: flex-end; }
.msg-menu .confirm-q { flex: 1 1 100%; margin: 0 0 4px; }
.cx-compose { border-top: 1px solid var(--line); padding: 10px 12px; background: var(--surface); }
.cmp-bar { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 10px; padding: 6px 6px 6px 12px; margin-bottom: 8px; font-size: 12.5px; color: var(--muted); }
.cmp-bar b { color: var(--ink); }
.cmp-bar .q { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-row { display: flex; align-items: flex-end; gap: 8px; }
.cmp-row textarea { flex: 1; min-width: 0; resize: none; height: 42px; min-height: 42px; max-height: 160px; padding: 10px 14px; border-radius: 21px; line-height: 1.4; font-size: 15px; display: block; }
.cmp-icon { flex: 0 0 42px; height: 42px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.cmp-icon:hover { background: var(--surface-2); color: var(--ink); }
.cmp-send { flex: 0 0 42px; height: 42px; border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; transition: filter .12s, opacity .12s; }
.cmp-send:hover { filter: brightness(.95); }
.cmp-send:disabled { opacity: .4; cursor: default; filter: none; }
.asst .msg-row.theirs .bubble { background: var(--surface); }
.asst .bubble { font-size: 14.5px; }

/* buttons in these widgets keep their own size (app-mobile.css gives every phone button 42px min-height) */
.bell-btn, .np-check, .ct-x, .icon-x, .pick, .cal-cell, .cal-nav .arrow, .todo-check, .todo-main, .done-toggle, .ev-row, .rx, .msg-act,
.mm-emoji button, .mm-grid button, .mm-item, .cmp-icon, .cmp-send, .link-btn, .np-actions .btn-sm, .seg button, .cx-tools .btn-sm, .confirming .btn-sm { min-height: 0; }

@media (max-width: 980px) { .cal-layout { grid-template-columns: 1fr; } }
@media (max-width: 600px) {
  .ct-modal { align-items: flex-end; padding: 0; }
  .ct-dialog { max-width: none; border-radius: 16px 16px 0 0; max-height: 92dvh; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom); transform: translateY(24px); }
  .ct-toast { bottom: auto; top: 12px; transform: translate(-50%, -12px); }
  .ct-toast.show { transform: translate(-50%, 0); }
}
@media (max-width: 860px) {
  .mobile-bar { height: 54px; }
  .mobile-bar .bell-btn { margin-left: auto; margin-right: 46px; }
  body.page-assistant .mobile-bar .bell-btn { margin-right: 0; }
  .notif-panel { top: 60px; left: 8px; right: 8px; width: auto; max-width: none; max-height: calc(100dvh - 72px); }
  .cal-head { gap: 10px; }
  .cal-head h1 { flex: 1 1 100%; }
  .cal-new { margin-left: auto; padding: 8px 14px; }
  .cal-head .seg button { padding: 6px 12px; }
  .cal-month { padding: 10px 6px 6px; }
  .cal-cell { height: 50px; padding-top: 3px; gap: 3px; }
  .cal-cell .d { width: 26px; height: 26px; font-size: 13px; }
  .todo-list { padding: 2px 8px; }
  body.page-chat .main, body.page-assistant .main { flex: 0 0 auto; min-height: 0; height: calc(100vh - 54px); height: calc(100dvh - 54px); padding: 0; max-width: none; }
  body.page-chat .mobile-bar .bell-btn { margin-right: 0; }
  body.page-chat .shell, body.page-assistant .shell { min-height: 0; }
  .cx-app { border: 0; border-radius: 0; }
  .cx-top { padding: 8px 10px; min-height: 54px; }
  .cx-tab { padding-right: 8px; }
  .cx-log { padding: 12px 10px 8px; }
  .msg-row { max-width: 86%; }
  .cx-compose { padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); }
  .cmp-row textarea { font-size: 16px; }
}
@media (max-width: 420px) {
  .cx-tab.off .cx-tab-txt small { display: none; }
  .cx-tools .btn-sm { padding: 5px 9px; font-size: 12px; }
}

/* ---------- Dashboard: airy cards (Oct 19 2026) ---------- */
.page-dashboard { --tint-mint: #ECFDF3; --tint-slate: #F1F5F9; --tint-amber: #FEF3C7; --hero-a: #16A34A; --hero-b: #22C55E; --hero-shadow: 0 10px 30px rgba(22,163,74,.12); }
.page-dashboard .dash-label { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 28px 0 12px 4px; }
.page-dashboard .dash-label:first-child { margin-top: 4px; }
.page-dashboard .dash-hero { position: relative; background: linear-gradient(135deg, var(--hero-a), var(--hero-b)); color: #fff; border-radius: 22px; padding: 24px; margin-bottom: 24px; box-shadow: var(--hero-shadow); }
.page-dashboard .hero-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-dashboard .hero-k { font-size: 13.5px; font-weight: 600; opacity: .9; }
.page-dashboard .hero-num { font-size: 40px; font-weight: 700; letter-spacing: -.03em; margin: 14px 0 6px; font-variant-numeric: tabular-nums; line-height: 1.05; }
.page-dashboard .hero-sub { font-size: 13.5px; opacity: .92; }
.page-dashboard .hero-sub b { font-weight: 700; }
.page-dashboard .dash-hero .month-nav b { color: #fff; }
.page-dashboard .dash-hero .month-nav .btn-sm { background: rgba(255,255,255,.18); border-color: transparent; color: #fff; }
.page-dashboard .dash-hero .month-nav .btn-sm:hover { background: rgba(255,255,255,.28); }
.page-dashboard .entity-nav { gap: 12px; margin-bottom: 24px; }
.page-dashboard .entity-bubble { background: var(--tint-slate); border: 0; border-radius: 22px; padding: 14px 16px; }
.page-dashboard .dash-cards { gap: 24px; margin-bottom: 8px; }
.page-dashboard .card, .page-dashboard .panel, .page-dashboard .alert.warn { border: 0; border-radius: 22px; padding: 22px 24px; box-shadow: none; }
.page-dashboard .panel { margin-bottom: 24px; }
.page-dashboard .cols { gap: 24px; }
.page-dashboard .tint-mint { background: var(--tint-mint); }
.page-dashboard .tint-slate { background: var(--tint-slate); }
.page-dashboard .tint-amber, .page-dashboard .alert.warn { background: var(--tint-amber); }
.page-dashboard .card .k { font-size: 13.5px; }
.page-dashboard .card .v { font-size: 36px; margin: 10px 0 8px; line-height: 1.05; }
.page-dashboard .card .v .unit { font-size: 15px; }
.page-dashboard .panel h2 { margin-bottom: 14px; }
.page-dashboard .panel th { background: transparent; }
.page-dashboard .panel .txf-group, .page-dashboard .panel .txf-sel { background: var(--surface); }
.page-dashboard .alert.warn { margin-bottom: 24px; }
@media (max-width: 640px) {
  .page-dashboard .dash-hero { padding: 20px; border-radius: 22px; }
  .page-dashboard .hero-num { font-size: 36px; }
  .page-dashboard .card, .page-dashboard .panel, .page-dashboard .alert.warn { padding: 20px; }
  .page-dashboard .dash-cards, .page-dashboard .cols { gap: 16px; }
  .page-dashboard .card .v { font-size: 30px; }
}
/* dashboard numbers never break mid-figure: wider columns, nowrap, size scales with the viewport */
.page-dashboard .dash-cards { grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
.page-dashboard .card .v { white-space: nowrap; overflow: hidden; font-size: clamp(26px, 1.6vw + 14px, 36px); }
.page-dashboard .card .v .unit { white-space: nowrap; }
@media (max-width: 640px) { .page-dashboard .dash-cards { grid-template-columns: 1fr; } .page-dashboard .card .v { font-size: 34px; } }
/* value + unit: the unit drops to its own line only when it doesn't fit (never clipped) */
.page-dashboard .card .v { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; overflow: visible; }
/* tile figures: one line, never broken; unit on its own line; JS (app.js fitNumbers) shrinks the font to fit, min 18px */
.page-dashboard .card .v { display: block; white-space: normal; overflow: visible; }
.page-dashboard .card .v .num, .page-dashboard .hero-num .num { display: block; white-space: nowrap; font-variant-numeric: tabular-nums; overflow: hidden; line-height: 1.05; }
.page-dashboard .card .v .unit { display: block; white-space: nowrap; font-size: 14px; font-weight: 500; margin-top: 4px; letter-spacing: 0; }
@media (max-width: 640px) {
  .page-dashboard .entity-nav { flex-wrap: wrap; overflow-x: visible; }   /* two rows instead of a clipped strip */
  .page-dashboard .entity-bubble { flex: 0 1 auto; }
}
/* plan cards: single full-width column on phones (no orphaned third card) */
@media (max-width: 560px) { .plan-cards { grid-template-columns: 1fr !important; } }
/* trial awareness */
.trial-pill { display: inline-block; margin-top: 8px; padding: 4px 11px; border: 1px solid #16A34A; border-radius: 999px; background: #fff; color: #16A34A; font-size: 12px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.trial-pill b { font-weight: 700; }
.trial-pill:hover { text-decoration: none; background: #ECFDF3; }
.brand .trial-pill { display: block; width: max-content; font-size: 11.5px; margin: 8px 0 0; }
.trial-pill-wrap { display: none; }
.pastdue-bar { background: #FEF3C7; color: #92400E; border-radius: 12px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 16px; }
.pastdue-bar a { color: #92400E; font-weight: 700; text-decoration: underline; }
@media (max-width: 900px) { .brand .trial-pill { display: none; } .trial-pill-wrap { display: block; margin: 0 0 12px; } .trial-pill-wrap:empty { display: none; } }
/* paywall: embedded Checkout takes the full width; on phones the plan cards collapse to three pills */
.checkout-box, .checkout-box > * { max-width: 100% !important; }
@media (max-width: 560px) {
  body.login-body:has(.paywall) { padding: 8px 0 !important; align-items: flex-start; }
  .paywall { padding: 0 10px !important; margin-top: 18px !important; }
  .checkout-box { padding: 0 !important; border: 0 !important; background: transparent !important; }
  .plan-cards.compact-m { display: flex !important; gap: 8px; }
  .plan-cards.compact-m .plan-card { flex: 1 1 0; padding: 9px 4px !important; border-radius: 999px !important; text-align: center; margin: 0 !important; line-height: 1.2; }
  .plan-cards.compact-m .plan-card > div:nth-of-type(1) { font-size: 12.5px; font-weight: 600; }
  .plan-cards.compact-m .plan-card > div:nth-of-type(2) { font-size: 15px; margin: 1px 0 0 !important; }
  .plan-cards.compact-m .plan-card > div:nth-of-type(2) span { display: inline; font-size: 11px; }
  .plan-cards.compact-m .plan-card > div:nth-of-type(3), .plan-cards.compact-m .plan-card .chip { display: none; }
}
/* card-form skeleton while Stripe Elements paints (replaced within ~300 ms) */
@keyframes sk { 0%{opacity:.6} 50%{opacity:1} 100%{opacity:.6} }
#payElement .sk { animation: sk 1.2s ease-in-out infinite; }
