/* ============ Design tokens ============ */
:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #edf2f9;
  --surface-3: #e1e9f3;
  --text: #10233a;
  --text-2: #364b66;
  --muted: #5a6d84;
  --border: #d8e1ed;
  --border-strong: #bdcadc;
  --primary: #0b4fa8;
  --primary-hover: #093f86;
  --primary-soft: #e3edfb;
  --primary-contrast: #ffffff;
  --accent: #d98a4e;
  --accent-soft: #fbeee2;
  --success: #16805a;
  --success-soft: #dff3ea;
  --warn: #93610a;
  --warn-soft: #fbf0d6;
  --danger: #b73a32;
  --danger-soft: #fbe6e4;
  --info: #2d5f9e;
  --info-soft: #e3edf9;
  --shadow-sm: 0 1px 2px rgba(15, 35, 70, .06), 0 1px 1px rgba(15, 35, 70, .04);
  --shadow: 0 6px 20px rgba(15, 40, 80, .08), 0 2px 6px rgba(15, 40, 80, .05);
  --shadow-lg: 0 24px 60px rgba(8, 24, 50, .22);
  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 22px;
  --sidebar-w: 268px;
  --focus: 0 0 0 3px rgba(11, 79, 168, .35);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0a1424;
  --surface: #101f36;
  --surface-2: #162a47;
  --surface-3: #1f365a;
  --text: #e8f0fb;
  --text-2: #c3d2e8;
  --muted: #91a7c4;
  --border: #22395c;
  --border-strong: #33507b;
  --primary: #5aa3f2;
  --primary-hover: #7bb7f7;
  --primary-soft: #13305a;
  --primary-contrast: #051a35;
  --accent: #eba26a;
  --accent-soft: #3b2a1d;
  --success: #4fd39a;
  --success-soft: #123a2c;
  --warn: #e3b25a;
  --warn-soft: #3a2e14;
  --danger: #f0847c;
  --danger-soft: #3d1f1d;
  --info: #86b6f2;
  --info-soft: #152d52;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .6);
  --focus: 0 0 0 3px rgba(90, 163, 242, .45);
  color-scheme: dark;
}

/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.55; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { line-height: 1.22; margin: 0 0 .5em; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.15rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }
p { margin: 0 0 1em; }
a { color: var(--primary); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--primary-hover); }
img, svg, video { max-width: 100%; }
svg.icon { flex: none; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
button { font: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 300; background: var(--primary); color: var(--primary-contrast); padding: 10px 16px; border-radius: 8px; text-decoration: none; }
.skip-link:focus { top: 12px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.xs { font-size: .78rem; }
.center { text-align: center; }
.right { text-align: right; }
.bold { font-weight: 650; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2.25rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.hidden { display: none !important; }
@media (max-width: 640px) { .hide-sm { display: none !important; } }

/* ============ Layout helpers ============ */
.stack { display: flex; flex-direction: column; gap: 1rem; }
.stack-sm { display: flex; flex-direction: column; gap: .5rem; }
.stack-lg { display: flex; flex-direction: column; gap: 1.75rem; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.row-sm { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.row-nowrap { display: flex; align-items: center; gap: .75rem; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 980px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .split { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } .grid-4.keep-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ============ App shell ============ */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: .25rem; padding: 1.1rem .9rem;
  background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: .65rem; padding: .25rem .5rem 1rem; text-decoration: none; color: var(--text); font-weight: 700; letter-spacing: -.01em; }
.brand:hover { color: var(--text); }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; background: #000; overflow: hidden; display: block; flex: none; box-shadow: 0 0 0 1px rgba(255,255,255,.08); }
.brand-mark img { width: 100%; height: 100%; display: block; }
.wordmark { font-weight: 800; font-size: 1.2rem; line-height: 1.05; letter-spacing: -.015em; display: block; }
.wordmark b { font-weight: 800; }
.wordmark .a { color: var(--primary); }
.wordmark .b { color: var(--success); }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: .74rem; letter-spacing: 0; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: .9rem .75rem .35rem; font-weight: 650; }
.nav a {
  display: flex; align-items: center; gap: .7rem; padding: .62rem .75rem; border-radius: 10px; color: var(--text-2); text-decoration: none; font-weight: 550; font-size: .95rem;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); }
.nav .count { margin-left: auto; background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; min-width: 20px; text-align: center; }
.sidebar-foot { margin-top: auto; padding-top: 1rem; display: flex; flex-direction: column; gap: .6rem; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: .6rem; padding: .65rem 1.25rem;
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { display: none; padding: 0; }
.page { width: 100%; max-width: 1200px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; flex: 1; }
.page-narrow { max-width: 760px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.page-header p { margin: .2rem 0 0; color: var(--muted); }
.page-header h1 { margin: 0; }
.bottomnav { display: none; }
.btn.menu-btn { display: none; }
@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 90; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(6, 20, 22, .5); z-index: 80; }
  .btn.menu-btn { display: inline-flex; }
  .topbar .brand { display: flex; white-space: nowrap; min-width: 0; gap: .5rem; }
  .topbar .brand small { display: none; }
  .topbar .brand-mark { width: 32px; height: 32px; }
  .topbar { padding: .55rem .75rem; gap: .35rem; }
  .page { padding: 1.1rem .9rem 6.5rem; }
  .bottomnav {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; z-index: 60; left: 0; right: 0; bottom: 0; background: var(--surface);
    border-top: 1px solid var(--border); padding: .3rem .25rem calc(.3rem + env(safe-area-inset-bottom));
  }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .35rem .2rem; font-size: .68rem; color: var(--muted); text-decoration: none; font-weight: 600; border-radius: 10px; position: relative; }
  .bottomnav a[aria-current="page"] { color: var(--primary); }
  .bottomnav .count { position: absolute; top: 0; right: 22%; background: var(--danger); color: #fff; font-size: .62rem; padding: 0 5px; border-radius: 999px; font-weight: 700; }
}

/* ============ Cards ============ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 1.15rem 1.25rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { margin: 0; font-size: 1.05rem; }
.card-body { padding: 1.15rem 1.25rem; }
.card-flush { padding: 0; overflow: hidden; }
.card.soft { background: var(--primary-soft); border-color: transparent; box-shadow: none; }
.card.clickable { transition: box-shadow .15s, transform .15s, border-color .15s; cursor: pointer; }
.card.clickable:hover { box-shadow: var(--shadow); border-color: var(--border-strong); transform: translateY(-1px); }
.divider-list > * + * { border-top: 1px solid var(--border); }
.item { display: flex; gap: .85rem; align-items: center; padding: .9rem 1.25rem; }
.item.top { align-items: flex-start; }
.item:hover.link { background: var(--surface-2); }
.item .meta { min-width: 0; flex: 1; }
.item .title { font-weight: 600; }

/* ============ KPI ============ */
.kpi { padding: 1rem 1.15rem; display: flex; gap: .9rem; align-items: center; }
.kpi .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.kpi .val { font-size: 1.55rem; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.kpi .lbl { color: var(--muted); font-size: .84rem; }
.kpi.warn .ico { background: var(--warn-soft); color: var(--warn); }
.kpi.info .ico { background: var(--info-soft); color: var(--info); }
.kpi.success .ico { background: var(--success-soft); color: var(--success); }
.kpi.danger .ico { background: var(--danger-soft); color: var(--danger); }

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .62rem 1.05rem; min-height: 42px; border-radius: 11px; border: 1px solid transparent;
  font-weight: 600; font-size: .95rem; cursor: pointer; text-decoration: none; transition: background .15s, box-shadow .15s, transform .05s, border-color .15s; white-space: nowrap; line-height: 1.2;
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--primary); color: var(--primary-contrast); }
.btn-primary:hover { background: var(--primary-hover); color: var(--primary-contrast); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); color: var(--text); }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-soft:hover { background: var(--surface-3); color: var(--primary-hover); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.92); color: #fff; }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.92); color: #fff; }
.btn-sm { padding: .4rem .75rem; min-height: 34px; font-size: .85rem; border-radius: 9px; }
.btn-lg { padding: .85rem 1.5rem; min-height: 50px; font-size: 1.02rem; border-radius: 13px; }
.btn-icon { padding: 0; width: 42px; min-width: 42px; }
.btn-icon.btn-sm { width: 34px; min-width: 34px; }
.btn-block { display: flex; width: 100%; }
.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Badges ============ */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .6rem; border-radius: 999px; font-size: .76rem; font-weight: 650; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.primary { background: var(--primary-soft); color: var(--primary); }
.badge.muted { background: var(--surface-2); color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .75rem; border-radius: 999px; font-size: .84rem; background: var(--surface-2); color: var(--text-2); border: 1px solid transparent; }
button.chip { cursor: pointer; font-weight: 550; }
button.chip:hover { background: var(--surface-3); }
.chip.on, button.chip[aria-pressed="true"] { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.success { background: var(--success); } .dot.warn { background: var(--warn); } .dot.danger { background: var(--danger); }

/* ============ Avatar ============ */
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .9rem; flex: none; letter-spacing: .02em; user-select: none; }
.avatar.sm { width: 30px; height: 30px; font-size: .72rem; }
.avatar.lg { width: 64px; height: 64px; font-size: 1.3rem; }
.avatar.xl { width: 92px; height: 92px; font-size: 1.9rem; }

/* ============ Forms ============ */
.field { display: flex; flex-direction: column; gap: .35rem; }
.field > label, .label { font-weight: 600; font-size: .9rem; color: var(--text-2); }
.field .help { font-size: .82rem; color: var(--muted); }
.field .err { font-size: .84rem; color: var(--danger); font-weight: 550; }
.input, .select, .textarea {
  width: 100%; padding: .65rem .85rem; min-height: 44px; border: 1px solid var(--border-strong); border-radius: 11px; background: var(--surface); color: var(--text);
  font: inherit; transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--muted); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
.input.invalid, .select.invalid, .textarea.invalid { border-color: var(--danger); }
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: .8; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2362727a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .8rem center; padding-right: 2.2rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.check { display: flex; gap: .65rem; align-items: flex-start; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--primary); flex: none; }
.range { width: 100%; accent-color: var(--primary); }
.radio-card { display: flex; gap: .75rem; padding: .85rem 1rem; border: 1.5px solid var(--border-strong); border-radius: 12px; cursor: pointer; background: var(--surface); align-items: flex-start; }
.radio-card:hover { border-color: var(--primary); }
.radio-card.on { border-color: var(--primary); background: var(--primary-soft); }
.radio-card input { accent-color: var(--primary); margin-top: 4px; }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; width: 100%; height: 100%; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px; transition: background .2s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { box-shadow: var(--focus); }
.input-icon { position: relative; }
.input-icon > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon .input { padding-left: 2.5rem; }

/* ============ Tables ============ */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; padding: .75rem 1rem; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: .8rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ============ Tabs ============ */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); overflow-x: auto; margin-bottom: 1.25rem; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: .7rem 1rem; border: 0; background: none; color: var(--muted); font-weight: 600; cursor: pointer; border-bottom: 2.5px solid transparent; white-space: nowrap; margin-bottom: -1px; border-radius: 8px 8px 0 0; }
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }
.segmented { display: inline-flex; background: var(--surface-2); padding: 3px; border-radius: 11px; gap: 2px; }
.segmented button { border: 0; background: none; padding: .4rem .9rem; border-radius: 8px; font-weight: 600; color: var(--muted); cursor: pointer; font-size: .9rem; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ============ Banners / alerts ============ */
.banner { display: flex; gap: .8rem; padding: .9rem 1.1rem; border-radius: var(--radius); background: var(--info-soft); color: var(--info); align-items: flex-start; border: 1px solid transparent; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.danger { background: var(--danger-soft); color: var(--danger); }
.banner.success { background: var(--success-soft); color: var(--success); }
.banner.neutral { background: var(--surface-2); color: var(--text-2); }
.banner .body { flex: 1; min-width: 0; color: var(--text); }
.banner .body strong { display: block; }
.banner svg { flex: none; margin-top: 2px; }

/* ============ Modal & toasts ============ */
.modal-backdrop { position: fixed; inset: 0; z-index: 200; background: rgba(6, 22, 26, .55); display: grid; place-items: center; padding: 1rem; animation: fade .15s ease; overflow-y: auto; }
.modal { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: min(100%, 520px); max-height: calc(100dvh - 2rem); display: flex; flex-direction: column; animation: pop .18s ease; }
.modal.lg { width: min(100%, 760px); }
.modal.xl { width: min(100%, 980px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.35rem .5rem; }
.modal-head h2 { margin: 0; font-size: 1.2rem; }
.modal-body { padding: .5rem 1.35rem 1.1rem; overflow-y: auto; }
.modal-foot { padding: .9rem 1.35rem 1.2rem; display: flex; justify-content: flex-end; gap: .6rem; flex-wrap: wrap; border-top: 1px solid var(--border); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.toasts { position: fixed; z-index: 400; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; width: min(380px, calc(100vw - 2rem)); pointer-events: none; }
@media (max-width: 920px) { .toasts { bottom: 5.5rem; } }
.toast { pointer-events: auto; background: var(--text); color: var(--bg); padding: .8rem 1rem; border-radius: 12px; box-shadow: var(--shadow-lg); display: flex; gap: .7rem; align-items: flex-start; animation: pop .2s ease; font-size: .93rem; }
.toast.success svg { color: #6fdc9d; } .toast.error svg { color: #ff9b93; }
.toast .x { margin-left: auto; background: none; border: 0; color: inherit; opacity: .7; cursor: pointer; padding: 0; }
.popover { position: absolute; right: 0; top: calc(100% + 8px); z-index: 120; width: min(380px, calc(100vw - 1.5rem)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; }
.pop-anchor { position: relative; }
.menu { min-width: 200px; padding: .35rem; }
.menu a, .menu button { display: flex; width: 100%; gap: .6rem; align-items: center; padding: .55rem .7rem; border-radius: 8px; color: var(--text); text-decoration: none; border: 0; background: none; cursor: pointer; text-align: left; font-size: .93rem; }
.menu a:hover, .menu button:hover { background: var(--surface-2); color: var(--text); }

/* ============ Misc components ============ */
.empty { text-align: center; padding: 2.5rem 1.25rem; color: var(--muted); }
.empty .ico { width: 56px; height: 56px; border-radius: 16px; background: var(--surface-2); display: inline-grid; place-items: center; margin-bottom: .8rem; color: var(--muted); }
.empty h3 { color: var(--text); margin-bottom: .25rem; }
.progress { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width .4s; }
.stars { display: inline-flex; gap: 2px; color: #e0a526; }
.stars button { background: none; border: 0; padding: 2px; cursor: pointer; color: inherit; line-height: 0; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.spinner { width: 22px; height: 22px; border: 3px solid var(--surface-3); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
.loading-page { display: grid; place-items: center; min-height: 40vh; }
.kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: .1rem .4rem; border-radius: 5px; font-size: .85em; }
.pill-stat { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); font-size: .86rem; }
.quote { border-left: 3px solid var(--primary); padding: .25rem 0 .25rem 1rem; color: var(--text-2); }
.note-box { background: var(--surface-2); border-radius: 12px; padding: .8rem 1rem; }
.crisis-btn { background: var(--danger-soft); color: var(--danger); font-weight: 650; border: 1px solid transparent; }
.crisis-btn:hover { background: var(--danger); color: #fff; }
.notif { position: relative; }
.notif.unread { background: color-mix(in srgb, var(--primary-soft) 55%, transparent); }
.notif .udot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex: none; margin-top: 8px; }
.bell-count { position: absolute; top: -3px; right: -3px; background: var(--danger); color: #fff; font-size: .66rem; font-weight: 700; min-width: 18px; height: 18px; border-radius: 999px; display: grid; place-items: center; padding: 0 4px; border: 2px solid var(--bg); }

/* ============ Charts ============ */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis { stroke: var(--border-strong); }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .85rem; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ============ Booking ============ */
.day-strip { display: flex; gap: .5rem; overflow-x: auto; padding: .25rem 0 .6rem; scrollbar-width: thin; }
.day-btn { flex: none; width: 64px; padding: .55rem .25rem; border: 1.5px solid var(--border-strong); background: var(--surface); border-radius: 12px; cursor: pointer; text-align: center; color: var(--text); line-height: 1.2; }
.day-btn .dow { font-size: .72rem; text-transform: uppercase; color: var(--muted); font-weight: 650; letter-spacing: .04em; }
.day-btn .dn { font-size: 1.2rem; font-weight: 700; }
.day-btn .mo { font-size: .72rem; color: var(--muted); }
.day-btn:hover { border-color: var(--primary); }
.day-btn[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); }
.day-btn[aria-pressed="true"] .dow, .day-btn[aria-pressed="true"] .mo { color: inherit; opacity: .85; }
.day-btn:disabled { opacity: .38; cursor: not-allowed; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: .5rem; }
.slot-btn { padding: .65rem .5rem; border: 1.5px solid var(--border-strong); background: var(--surface); border-radius: 11px; cursor: pointer; font-weight: 650; color: var(--text); }
.slot-btn:hover { border-color: var(--primary); background: var(--primary-soft); }
.slot-btn[aria-pressed="true"] { background: var(--primary); color: var(--primary-contrast); border-color: var(--primary); }
.steps { display: flex; gap: .5rem; align-items: center; margin-bottom: 1.25rem; flex-wrap: wrap; }
.steps .s { display: flex; align-items: center; gap: .45rem; color: var(--muted); font-weight: 600; font-size: .9rem; }
.steps .s .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-size: .8rem; }
.steps .s.on { color: var(--text); } .steps .s.on .n { background: var(--primary); color: var(--primary-contrast); }
.steps .s.done .n { background: var(--success); color: #fff; }
.steps .bar { width: 28px; height: 2px; background: var(--border-strong); }

/* ============ Therapist cards ============ */
.th-card { display: flex; flex-direction: column; gap: .8rem; padding: 1.15rem; height: 100%; }
.th-card .top { display: flex; gap: .9rem; }
.th-card .headline { color: var(--text-2); font-size: .92rem; }
.rating { display: inline-flex; align-items: center; gap: .3rem; font-weight: 650; font-size: .9rem; }
.rating svg { color: #e0a526; fill: #e0a526; }
.filters { display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: .75rem; }
@media (max-width: 880px) { .filters { grid-template-columns: 1fr 1fr; } .filters .wide { grid-column: 1 / -1; } }

/* ============ Chat ============ */
.chat-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); height: calc(100dvh - 150px); min-height: 480px; overflow: hidden; }
.chat-list { border-right: 1px solid var(--border); overflow-y: auto; }
.chat-thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: .75rem; padding: .8rem 1.1rem; border-bottom: 1px solid var(--border); }
.chat-scroll { flex: 1; overflow-y: auto; padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .35rem; background: var(--surface-2); }
.bubble-row { display: flex; }
.bubble-row.me { justify-content: flex-end; }
.bubble { max-width: min(78%, 520px); padding: .55rem .85rem; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm); word-break: break-word; white-space: pre-wrap; }
.bubble-row.me .bubble { background: var(--primary); color: var(--primary-contrast); border-bottom-right-radius: 5px; }
.bubble-row:not(.me) .bubble { border-bottom-left-radius: 5px; }
.bubble .ts { display: block; font-size: .7rem; opacity: .7; margin-top: 2px; text-align: right; }
.bubble a { color: inherit; }
.day-sep { align-self: center; font-size: .75rem; color: var(--muted); background: var(--surface); padding: .15rem .7rem; border-radius: 999px; margin: .6rem 0 .3rem; }
.chat-compose { display: flex; gap: .5rem; padding: .75rem; border-top: 1px solid var(--border); align-items: flex-end; background: var(--surface); }
.chat-compose .textarea { min-height: 44px; max-height: 140px; resize: none; }
.chat-item { display: flex; gap: .75rem; padding: .85rem 1rem; align-items: center; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--border); }
.chat-item:hover { background: var(--surface-2); color: var(--text); }
.chat-item[aria-current="true"] { background: var(--primary-soft); }
.chat-item .unread { background: var(--primary); color: var(--primary-contrast); font-size: .7rem; font-weight: 700; border-radius: 999px; min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 5px; }
.typing { font-size: .8rem; color: var(--muted); padding: 0 1.1rem .4rem; min-height: 1.4em; background: var(--surface-2); }
.attach { display: inline-flex; gap: .4rem; align-items: center; padding: .3rem .6rem; border-radius: 8px; background: rgba(0,0,0,.08); font-size: .85rem; margin-top: 4px; text-decoration: none; }
.bubble img.att-img { max-width: 100%; border-radius: 10px; display: block; margin-top: 4px; }
@media (max-width: 820px) {
  .chat-layout { grid-template-columns: 1fr; height: calc(100dvh - 190px); }
  .chat-layout.has-thread .chat-list { display: none; }
  .chat-layout:not(.has-thread) .chat-thread { display: none; }
  .chat-back { display: inline-flex !important; }
}
.chat-back { display: none; }

/* ============ Video room ============ */
.call-page { position: fixed; inset: 0; z-index: 150; background: #0b1114; color: #fff; display: flex; flex-direction: column; }
.call-top { display: flex; align-items: center; gap: .75rem; padding: .7rem 1rem; background: rgba(255,255,255,.04); border-bottom: 1px solid rgba(255,255,255,.08); flex-wrap: wrap; }
.call-main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); position: relative; }
.call-main.with-side { grid-template-columns: minmax(0, 1fr) 340px; }
@media (max-width: 860px) { .call-main.with-side { grid-template-columns: 1fr; } .call-side { position: absolute; inset: 0; z-index: 5; } }
.stage { position: relative; background: #05090b; display: grid; place-items: center; min-height: 0; overflow: hidden; }
.stage video.remote { width: 100%; height: 100%; object-fit: contain; background: #05090b; }
.stage .pip { position: absolute; right: 14px; bottom: 14px; width: clamp(120px, 24%, 240px); aspect-ratio: 4 / 3; border-radius: 14px; overflow: hidden; background: #1a2226; border: 2px solid rgba(255,255,255,.2); box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.stage .pip video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.stage .pip.screen video { transform: none; object-fit: contain; }
.stage .overlay { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 1.5rem; background: rgba(5, 9, 11, .78); }
.stage .name-tag { position: absolute; left: 14px; bottom: 14px; background: rgba(0,0,0,.55); padding: .25rem .7rem; border-radius: 8px; font-size: .85rem; }
.call-bar { display: flex; justify-content: center; align-items: center; gap: .7rem; padding: .9rem 1rem calc(.9rem + env(safe-area-inset-bottom)); background: rgba(255,255,255,.04); border-top: 1px solid rgba(255,255,255,.08); flex-wrap: wrap; }
.ctl { width: 52px; height: 52px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); color: #fff; cursor: pointer; display: grid; place-items: center; transition: background .15s; }
.ctl:hover { background: rgba(255,255,255,.24); }
.ctl.off { background: #fff; color: #111; }
.ctl.end { background: #d93f36; width: 64px; border-radius: 26px; }
.ctl.end:hover { background: #ee5147; }
.ctl.active { background: var(--primary); }
.call-side { background: #12191d; border-left: 1px solid rgba(255,255,255,.08); display: flex; flex-direction: column; min-height: 0; }
.call-side .tabs { margin: 0; padding: 0 .5rem; border: 0; }
.call-side .tab { color: #9db0b6; } .call-side .tab:hover { background: rgba(255,255,255,.06); color: #fff; }
.call-side .tab[aria-selected="true"] { color: #fff; border-bottom-color: var(--primary); }
.call-side .pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.call-chat { flex: 1; overflow-y: auto; padding: .8rem; display: flex; flex-direction: column; gap: .35rem; }
.call-chat .bubble { background: rgba(255,255,255,.1); color: #fff; box-shadow: none; }
.call-chat .bubble-row.me .bubble { background: var(--primary); color: var(--primary-contrast); }
.call-side .input, .call-side .textarea { background: #0b1114; border-color: rgba(255,255,255,.18); color: #fff; }
.call-side label { color: #b9c9cd; }
.conn { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; padding: .2rem .65rem; border-radius: 999px; background: rgba(255,255,255,.1); }
.conn i { width: 8px; height: 8px; border-radius: 50%; background: #f0b429; }
.conn.ok i { background: #4cd08a; } .conn.bad i { background: #f0625b; }
.level { height: 8px; width: 100%; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.level i { display: block; height: 100%; background: var(--success); width: 0; transition: width .08s linear; }
.preview { position: relative; aspect-ratio: 16 / 10; background: #0b1114; border-radius: var(--radius); overflow: hidden; display: grid; place-items: center; color: #9db0b6; }
.preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }

/* ============ Landing ============ */
.land-nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1.25rem; max-width: 1200px; margin: 0 auto; }
.land-nav .links { display: flex; align-items: center; gap: .3rem; }
.hero { max-width: 1200px; margin: 0 auto; padding: 3rem 1.25rem 3.5rem; display: grid; grid-template-columns: 1.1fr .9fr; gap: 2.5rem; align-items: center; }
.hero h1 { font-size: clamp(2.1rem, 1.4rem + 3vw, 3.4rem); letter-spacing: -.025em; margin-bottom: .6em; }
.hero .lead { font-size: 1.15rem; color: var(--text-2); max-width: 34rem; }
.hero-art { background: #000; border-radius: 28px; padding: 1.5rem; border: 1px solid var(--border); }
.hero-art { padding: 0; overflow: hidden; }
.hero-art img { width: 100%; height: auto; display: block; }
@media (max-width: 880px) { .hero { grid-template-columns: 1fr; padding-top: 1.5rem; } }
.section { max-width: 1200px; margin: 0 auto; padding: 2.5rem 1.25rem; }
.section-alt { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section h2 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); text-align: center; margin-bottom: .4em; }
.section .sub { text-align: center; color: var(--muted); max-width: 40rem; margin: 0 auto 2rem; }
.feature { padding: 1.25rem; }
.feature .ico { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); margin-bottom: .8rem; }
.feature h3 { margin-bottom: .3rem; }
.feature p { margin: 0; color: var(--text-2); font-size: .95rem; }
.footer { border-top: 1px solid var(--border); padding: 2rem 1.25rem; color: var(--muted); font-size: .9rem; }
.footer-in { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* ============ Auth ============ */
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-side { background: linear-gradient(155deg, #061f47, #0b4fa8 58%, #138a5e); color: #fff; padding: 2.5rem; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.auth-side .brand { color: #fff; transform: scale(1.6); transform-origin: center; }
.auth-side .brand small { color: rgba(255,255,255,.75); }
.auth-side .wordmark .a { color: #a9d6ff; }
.auth-side .wordmark .b { color: #86e6bb; }
.auth-main { padding: 2rem 1.25rem; display: grid; place-items: center; }
.auth-card { width: min(100%, 460px); }
@media (max-width: 860px) { .auth-wrap { grid-template-columns: 1fr; } .auth-side { display: none; } }

/* ============ Breathing / tools ============ */
.breath { display: grid; place-items: center; padding: 1.5rem 0; }
.breath .orb { width: 170px; height: 170px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #8fd0ff, var(--primary)); display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 1.05rem; text-align: center; box-shadow: 0 0 0 0 rgba(11,79,168,.4); transition: transform 1s ease-in-out; }
.article h2 { text-align: left; font-size: 1.15rem; margin-top: 1.4rem; }
.article ul { padding-left: 1.2rem; } .article li { margin-bottom: .4rem; }

/* ============ Mood ============ */
.mood-pick { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; }
.mood-pick button { border: 1.5px solid var(--border-strong); background: var(--surface); border-radius: 14px; padding: .7rem .25rem; cursor: pointer; font-size: 1.7rem; line-height: 1; display: flex; flex-direction: column; gap: .3rem; align-items: center; color: var(--text); }
.mood-pick button span { font-size: .72rem; color: var(--muted); font-weight: 600; }
.mood-pick button:hover { border-color: var(--primary); }
.mood-pick button[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); }
.heat { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.heat i { aspect-ratio: 1; border-radius: 6px; background: var(--surface-3); display: grid; place-items: center; font-style: normal; font-size: .7rem; color: var(--muted); }

/* ============ Print ============ */
@media print {
  .sidebar, .topbar, .bottomnav, .toasts, .no-print, .assistant-fab, .assistant-panel { display: none !important; }
  .app { display: block; }
  body { background: #fff; }
}
@media (max-width: 560px) { .topbar .brand > span:last-child { display: none; } }
@media (max-width: 480px) { .btn { white-space: normal; text-align: center; } }
@media (max-width: 920px) {
  .kpi { padding: .8rem .85rem; gap: .65rem; }
  .kpi .ico { width: 38px; height: 38px; }
  .kpi .val { font-size: 1.3rem; }
  .card-head, .card-body, .item { padding-left: 1rem; padding-right: 1rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }

/* ============ Assistant widget ============ */
/* Resting state: a small glowing star that stays out of the way. The name rolls out to the left only on hover or keyboard focus. */
.assistant-fab { --fab-glow: color-mix(in srgb, var(--primary) 75%, transparent); position: fixed; z-index: 250; right: 1.1rem; bottom: 1.1rem; display: inline-flex; align-items: center; height: 42px; padding: 0; border-radius: 999px; border: 0; cursor: pointer; background: var(--primary); color: var(--primary-contrast); font-weight: 650; font-size: .92rem; white-space: nowrap; box-shadow: 0 0 14px 3px var(--fab-glow); animation: fab-glow 2.8s ease-in-out infinite; }
.assistant-fab:hover { background: var(--primary-hover); }
.assistant-fab:focus-visible { outline: none; box-shadow: 0 0 14px 3px var(--fab-glow), var(--focus); }
.assistant-fab .star { display: grid; place-items: center; flex: none; width: 42px; height: 42px; }
.assistant-fab .star .icon { animation: fab-twinkle 2.8s ease-in-out infinite; }
.assistant-fab .roll { display: inline-flex; align-items: center; gap: .5rem; max-width: 0; opacity: 0; overflow: hidden; transition: max-width .3s ease, opacity .2s ease, padding .3s ease; }
.assistant-fab:hover .roll, .assistant-fab:focus-visible .roll { max-width: 240px; opacity: 1; padding-left: .6rem; }
@keyframes fab-glow {
  0%, 100% { box-shadow: 0 0 12px 2px var(--fab-glow), 0 0 0 0 var(--fab-glow); }
  50% { box-shadow: 0 0 24px 7px var(--fab-glow), 0 0 0 8px transparent; }
}
@keyframes fab-twinkle { 0%, 100% { transform: scale(1) rotate(0deg); } 50% { transform: scale(1.14) rotate(14deg); } }
@media (prefers-reduced-motion: reduce) { .assistant-fab, .assistant-fab .star .icon { animation: none; } }
@media (hover: none) { .assistant-fab .roll { display: none; } }
.assistant-panel { position: fixed; z-index: 260; right: 1.1rem; bottom: 1.1rem; width: min(390px, calc(100vw - 1.4rem)); height: min(600px, calc(100dvh - 2.2rem)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; }
.assistant-head { display: flex; align-items: center; gap: .7rem; padding: .8rem .9rem; background: var(--primary); color: var(--primary-contrast); }
.assistant-head .who { flex: 1; min-width: 0; }
.assistant-head .who b { display: block; font-size: .98rem; line-height: 1.2; }
.assistant-head .who span { font-size: .76rem; opacity: .9; }
.assistant-head .btn { color: inherit; }
.assistant-head .btn:hover { background: rgba(255,255,255,.16); }
.assistant-log { flex: 1; overflow-y: auto; padding: .9rem; display: flex; flex-direction: column; gap: .65rem; background: var(--bg); overscroll-behavior: contain; }
.a-msg { max-width: 88%; padding: .6rem .8rem; border-radius: 14px; font-size: .92rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.a-msg.bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.a-msg.me { align-self: flex-end; background: var(--primary); color: var(--primary-contrast); border-bottom-right-radius: 4px; }
.a-msg.crisis { border-color: var(--danger); background: var(--danger-soft); }
.a-src { margin-top: .4rem; font-size: .76rem; color: var(--muted); }
.a-src a { color: var(--primary); font-weight: 600; }
.a-extras { align-self: flex-start; max-width: 92%; display: flex; flex-wrap: wrap; gap: .4rem; margin-top: -.2rem; }
.a-chip { border: 1px solid var(--border-strong); background: var(--surface); color: var(--primary); border-radius: 999px; padding: .32rem .75rem; font-size: .84rem; font-weight: 600; cursor: pointer; text-decoration: none; }
.a-chip:hover { background: var(--primary-soft); border-color: var(--primary); }
.a-chip.warn { color: var(--danger); border-color: var(--danger); }
.a-typing { display: inline-flex; gap: 4px; padding: .2rem 0; }
.a-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: a-bounce 1s infinite ease-in-out; }
.a-typing i:nth-child(2) { animation-delay: .15s; } .a-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes a-bounce { 0%, 80%, 100% { opacity: .35; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.assistant-form { display: flex; gap: .5rem; padding: .65rem; border-top: 1px solid var(--border); background: var(--surface); }
.assistant-form input { flex: 1; min-width: 0; }
.assistant-foot { padding: .35rem .8rem .6rem; font-size: .72rem; color: var(--muted); background: var(--surface); line-height: 1.35; }
.assistant-foot a, .assistant-foot button { color: var(--danger); font-weight: 650; background: none; border: 0; padding: 0; cursor: pointer; font-size: inherit; text-decoration: underline; }
@media (max-width: 920px) {
  .assistant-fab { bottom: 5.4rem; right: .9rem; }
  .assistant-panel { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; border: 0; }
}

/* ============ Control room and paste fields ============ */
.paste-field { display: grid; gap: .35rem; }
.paste-row { display: flex; gap: .5rem; }
.paste-row .input, .paste-row .textarea { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88rem; }
.paste-state { display: flex; flex-wrap: wrap; gap: .4rem .8rem; align-items: center; font-size: .8rem; color: var(--muted); }
.paste-state .ok { color: var(--success); font-weight: 650; }
.cr-savebar { position: sticky; bottom: 0; z-index: 20; display: flex; gap: .8rem; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: .8rem 1rem; margin-top: 1.25rem; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow-lg); }
@media (max-width: 920px) { .cr-savebar { bottom: 4.9rem; } }
.or-rule { display: flex; align-items: center; gap: .8rem; }
.or-rule::before, .or-rule::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.setup-steps { counter-reset: s; display: grid; gap: .6rem; padding: 0; margin: 0; list-style: none; }
.setup-steps li { counter-increment: s; display: flex; gap: .7rem; align-items: flex-start; }
.setup-steps li::before { content: counter(s); flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: .85rem; display: grid; place-items: center; }
.a-thread-hint { margin: .5rem 0; }
/* ============ Logo watermark (every page and the assistant) ============ */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: url('../icons/logo-watermark.png') center 56% / min(74vmin, 700px) no-repeat; opacity: .075;
}
:root[data-theme="dark"] body::before { opacity: .11; }
/* Let a little of the logo show through panels so it is visible on busy pages too */
.card, .table-wrap, .section-alt, .note-box { background-color: color-mix(in srgb, var(--surface) 92%, transparent); }
.assistant-log {
  background-color: var(--bg);
  background-image: linear-gradient(color-mix(in srgb, var(--bg) 88%, transparent), color-mix(in srgb, var(--bg) 88%, transparent)), url('../icons/logo-watermark.png');
  background-repeat: no-repeat; background-position: center; background-size: 100% 100%, 82% auto;
}
.a-logo { width: 34px; height: 34px; border-radius: 10px; background: #000; object-fit: cover; flex: none; box-shadow: 0 0 0 1px rgba(255,255,255,.18); }
.assistant-fab .a-logo { width: 28px; height: 28px; border-radius: 8px; }
.a-bot-row { display: flex; gap: .5rem; align-items: flex-end; align-self: flex-start; max-width: 94%; }
.a-bot-row .a-logo { width: 24px; height: 24px; border-radius: 7px; margin-bottom: 2px; }
.a-bot-row .a-msg { max-width: none; }
@media print { body::before { display: none; } }

/* ============ Export menu and download banner ============ */
.export-menu { position: relative; display: inline-block; }
.export-menu .popover { right: 0; left: auto; min-width: 210px; top: calc(100% + 6px); }
.export-menu .popover button { display: flex; align-items: center; gap: .6rem; width: 100%; text-align: left; padding: .6rem .8rem; border: 0; background: none; cursor: pointer; color: var(--text); border-radius: 8px; font-size: .92rem; }
.export-menu .popover button:hover { background: var(--surface-2); }
.get-app { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 1rem 1.25rem; border-radius: var(--radius); border: 1px solid var(--border); background: linear-gradient(120deg, color-mix(in srgb, var(--primary-soft) 80%, transparent), color-mix(in srgb, var(--success-soft) 70%, transparent)); }
.get-app .txt { display: flex; gap: .9rem; align-items: center; min-width: 0; }
.get-app .txt img { width: 46px; height: 46px; border-radius: 12px; background: #000; flex: none; }
.get-app .txt b { display: block; }
.dl-steps { counter-reset: d; display: grid; gap: .55rem; padding: 0; margin: 0; list-style: none; }
.dl-steps li { counter-increment: d; display: flex; gap: .65rem; align-items: flex-start; }
.dl-steps li::before { content: counter(d); flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: .8rem; display: grid; place-items: center; }
.dl-steps li.done::before { content: '✓'; background: var(--success); color: #fff; }
.promo-bar { display: flex; align-items: center; gap: .7rem; justify-content: center; flex-wrap: wrap; padding: .45rem 1rem; background: linear-gradient(90deg, #061f47, #0b4fa8 60%, #138a5e); color: #fff; font-size: .9rem; position: relative; z-index: 120; }
.promo-bar .txt { min-width: 0; }
.promo-bar .btn-ghost { color: #fff; }
.promo-bar .btn-ghost:hover { background: rgba(255,255,255,.16); color: #fff; }
.promo-bar .btn-primary { background: #fff; color: #0b4fa8; }
.promo-bar .btn-secondary { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.35); }
@media print { .promo-bar { display: none !important; } }