/* SideAgent — design tokens, layout and components. No external fonts or frameworks. */
:root {
  color-scheme: light;
  --bg: #f6f6f3;
  --bg-2: #ffffff;
  --bg-3: #f0efeb;
  --bg-hover: #ebeae5;
  --border: rgba(11, 11, 11, 0.10);
  --border-strong: rgba(11, 11, 11, 0.18);
  --text: #121212;
  --text-2: #4f4e4a;
  --muted: #84827c;
  --accent: #6a4cf5;
  --accent-2: #0ea5b7;
  --accent-soft: rgba(106, 76, 245, 0.10);
  --accent-ink: #ffffff;
  --good: #0a8f0a;
  --good-text: #006300;
  --bad: #d03b3b;
  --warn: #c98500;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.16);
  --radius: 14px;
  --radius-sm: 9px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  /* charts (dataviz reference palette) */
  --chart-surface: #fcfcfb;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --sidebar-w: 252px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e0e10;
    --bg-2: #18181b;
    --bg-3: #212125;
    --bg-hover: #2a2a2f;
    --border: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.18);
    --text: #f4f4f5;
    --text-2: #c4c3bd;
    --muted: #8b8a85;
    --accent: #8b74ff;
    --accent-2: #22c3d6;
    --accent-soft: rgba(139, 116, 255, 0.14);
    --good: #0ca30c;
    --good-text: #2bc22b;
    --bad: #e66767;
    --warn: #fab219;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    --chart-surface: #1a1a19;
    --series-1: #3987e5;
    --series-2: #d95926;
    --grid: #2c2c2a;
    --axis: #383835;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0e10;
  --bg-2: #18181b;
  --bg-3: #212125;
  --bg-hover: #2a2a2f;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #f4f4f5;
  --text-2: #c4c3bd;
  --muted: #8b8a85;
  --accent: #8b74ff;
  --accent-2: #22c3d6;
  --accent-soft: rgba(139, 116, 255, 0.14);
  --good: #0ca30c;
  --good-text: #2bc22b;
  --bad: #e66767;
  --warn: #fab219;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  --chart-surface: #1a1a19;
  --series-1: #3987e5;
  --series-2: #d95926;
  --grid: #2c2c2a;
  --axis: #383835;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  overflow-x: clip;
  background: var(--bg); color: var(--text); font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
code, pre, kbd { font-family: var(--mono); font-size: .88em; }
kbd { border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; padding: 0 .35em; background: var(--bg-2); }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.2rem 0; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ssr { max-width: 860px; margin: 3rem auto; padding: 0 16px; }
.ssr ul { columns: 2; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- App shell */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--bg-2); border-right: 1px solid var(--border);
  padding: 14px 10px 24px; display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 14px; color: var(--text); font-weight: 700; font-size: 1.08rem; letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand .logo { width: 30px; height: 30px; flex: none; }
.brand small { font-weight: 500; color: var(--muted); font-size: .72rem; display: block; letter-spacing: 0; }
.nav-sec { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 14px 12px 4px; font-weight: 600; }
.nav a, .nav button.navbtn, .nav summary.navbtn {
  display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 9px; color: var(--text-2); font-size: .92rem;
  border: 0; background: none; width: 100%; text-align: left; cursor: pointer; font-family: inherit;
}
.nav a:hover, .nav button.navbtn:hover, .nav summary.navbtn:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav .ico { width: 22px; text-align: center; flex: none; font-size: 1rem; }
.nav .count { margin-left: auto; font-size: .72rem; color: var(--muted); }
.nav details > summary { list-style: none; }
.nav details > summary::-webkit-details-marker { display: none; }
.nav details > summary .chev { margin-left: auto; transition: transform .15s; color: var(--muted); font-size: .7rem; }
.nav details[open] > summary .chev { transform: rotate(90deg); }
.nav details .sub a { padding-left: 44px; font-size: .87rem; }
.sidebar-foot { margin-top: auto; padding: 14px 8px 0; display: grid; gap: 8px; }
.upgrade-card { border-radius: 12px; padding: 12px; background: linear-gradient(135deg, var(--accent-soft), rgba(14, 165, 183, 0.10)); border: 1px solid var(--border); font-size: .85rem; }
.upgrade-card b { display: block; margin-bottom: 2px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 24px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border);
}
.topbar .menu-btn { display: none; }
.searchbox {
  flex: 1; max-width: 520px; display: flex; align-items: center; gap: 8px; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 7px 12px; color: var(--muted); cursor: text; font-size: .9rem;
}
.searchbox:hover { border-color: var(--border-strong); }
.searchbox span { flex: 1; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.credits-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; background: var(--bg-2);
  border: 1px solid var(--border); font-size: .85rem; font-weight: 600; color: var(--text); cursor: pointer; font-family: inherit;
}
.credits-pill:hover { border-color: var(--accent); text-decoration: none; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: 0; cursor: pointer; flex: none;
}
.content { padding: 28px 28px 64px; max-width: 1240px; width: 100%; margin: 0 auto; flex: 1; }
.content.wide { max-width: none; }
.content.flush { padding: 0; max-width: none; }
.announce { background: var(--accent); color: var(--accent-ink); text-align: center; padding: 8px 16px; font-size: .88rem; }
.announce a { color: inherit; text-decoration: underline; }
.maint { background: var(--warn); color: #111; text-align: center; padding: 8px 16px; font-size: .88rem; font-weight: 600; }

/* ---------- Page header */
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .ph-icon { font-size: 1.9rem; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--bg-2); border: 1px solid var(--border); flex: none; }
.page-head h1 { margin: 0 0 4px; font-size: 1.55rem; }
.page-head p { color: var(--text-2); margin: 0; max-width: 720px; }
.page-head .ph-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.crumbs { font-size: .82rem; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }

/* ---------- Cards & grids */
.card { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.card.pad-lg { padding: 24px; }
.card h3 { margin-bottom: 10px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h3 { margin: 0; }
.card-head .spacer { flex: 1; }
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.grid.auto-sm { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.stack { display: grid; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.tiny { font-size: .76rem; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.mt { margin-top: 16px; } .mt-sm { margin-top: 8px; } .mb { margin-bottom: 16px; }
.good { color: var(--good-text); } .bad { color: var(--bad); } .warn { color: var(--warn); }

.tool-card {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: var(--radius); background: var(--bg-2);
  border: 1px solid var(--border); color: var(--text); transition: border-color .15s, transform .15s, box-shadow .15s; min-height: 128px;
}
.tool-card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); }
.tool-card .tc-top { display: flex; align-items: center; gap: 10px; }
.tool-card .tc-icon { font-size: 1.35rem; width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--bg-3); flex: none; }
.tool-card b { font-size: .98rem; }
.tool-card p { color: var(--text-2); font-size: .86rem; margin: 0; line-height: 1.45; }
.tool-card .tc-meta { margin-top: auto; display: flex; gap: 6px; flex-wrap: wrap; padding-top: 4px; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: .7rem; font-weight: 600; padding: 2px 8px; border-radius: 99px;
  background: var(--bg-3); color: var(--text-2); white-space: nowrap; border: 1px solid transparent;
}
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.good { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good-text); }
.badge.bad { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.badge.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.badge.outline { background: transparent; border-color: var(--border-strong); }
.cat-title { display: flex; align-items: baseline; gap: 10px; margin: 30px 0 12px; }
.cat-title h2 { margin: 0; font-size: 1.12rem; }
.cat-title p { margin: 0; color: var(--muted); font-size: .88rem; }

/* ---------- Forms */
label { display: block; font-size: .83rem; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.field { margin-bottom: 14px; }
.hint { font-size: .78rem; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=url], input[type=email], input[type=password], input[type=number], input[type=search], input[type=date],
input[type=datetime-local], input:not([type]), select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--bg-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 9px 12px; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
textarea.code, input.code { font-family: var(--mono); font-size: .85rem; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; }
input[type=range] { accent-color: var(--accent); width: 100%; }
input[type=color] { width: 44px; height: 36px; padding: 2px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--bg-2); }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; color: var(--text); cursor: pointer; margin: 0; }
.input-group { display: flex; gap: 8px; }
.input-group > input, .input-group > select { flex: 1; min-width: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: inherit; font-weight: 600; font-size: .9rem; padding: 9px 16px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--bg-2); color: var(--text); cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s, transform .05s; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--bg-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--bg-hover); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: color-mix(in srgb, var(--bad) 10%, transparent); border-color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: .82rem; border-radius: 8px; }
.btn.lg { padding: 12px 22px; font-size: 1rem; border-radius: 12px; }
.btn.block { width: 100%; }
.btn[disabled], .btn.loading { opacity: .55; pointer-events: none; }
.btn.loading::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.icon-btn { border: 0; background: none; color: var(--text-2); cursor: pointer; padding: 6px; border-radius: 8px; font-size: 1rem; line-height: 1; font-family: inherit; }
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }

.seg { display: inline-flex; background: var(--bg-3); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; font: inherit; font-size: .83rem; font-weight: 600; color: var(--text-2); padding: 5px 11px; border-radius: 8px; cursor: pointer; }
.seg button.on { background: var(--bg-2); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; font: inherit; font-weight: 600; font-size: .88rem; color: var(--muted); padding: 9px 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.tabs button .badge { margin-left: 4px; }

/* ---------- Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-2); }
table.t { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.t th { text-align: left; font-weight: 600; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--bg-2); position: sticky; top: 0; }
table.t td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover td { background: var(--bg-3); }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t.clickable tbody tr { cursor: pointer; }

/* ---------- Stat tiles */
.stat { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat .label { font-size: .8rem; color: var(--muted); font-weight: 500; }
.stat .value { font-size: 1.6rem; font-weight: 650; letter-spacing: -0.02em; }
.stat .delta { font-size: .8rem; font-weight: 600; }
.hero-num { font-size: 3rem; font-weight: 650; letter-spacing: -0.03em; line-height: 1.1; }

/* ---------- Charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; font-family: var(--font); }
.chart .crosshair { stroke: var(--text-2); stroke-width: 1; opacity: .5; pointer-events: none; }
.chart .tip {
  position: absolute; pointer-events: none; background: var(--bg-2); border: 1px solid var(--border-strong); border-radius: 8px; box-shadow: var(--shadow);
  padding: 6px 10px; font-size: .8rem; white-space: nowrap; z-index: 5; transform: translate(-50%, -110%);
}
.chart .tip .tv { font-weight: 700; font-size: .9rem; }
.chart .tip .tk { display: inline-block; width: 12px; height: 2px; vertical-align: middle; margin-right: 6px; border-radius: 2px; }
.chart .bar:hover, .chart .bar:focus { opacity: .8; outline: none; }
.legend { display: flex; gap: 16px; font-size: .8rem; color: var(--text-2); margin-bottom: 8px; flex-wrap: wrap; }
.legend .lk { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.legend .lk.box { height: 10px; width: 10px; border-radius: 3px; }
.spark { display: block; }

/* ---------- Bars & meters */
.meter { height: 8px; border-radius: 99px; background: var(--bg-3); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.hbar-list { display: grid; gap: 6px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; font-size: .85rem; align-items: center; }
.hbar .hb-track { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: var(--bg-3); overflow: hidden; }
.hbar .hb-track span { display: block; height: 100%; background: var(--series-1); border-radius: 99px; }
.hbar .hb-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .hb-val { font-variant-numeric: tabular-nums; color: var(--text-2); }
.statusbar { display: flex; gap: 2px; align-items: flex-end; height: 26px; }
.statusbar i { flex: 1; min-width: 3px; max-width: 8px; height: 100%; border-radius: 2px; background: var(--good); }
.statusbar i.down { background: var(--bad); }
.statusbar i.none { background: var(--bg-3); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.up { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 22%, transparent); }
.dot.down { background: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 22%, transparent); }

/* ---------- Output / results */
.out { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; min-height: 60px; }
.out.empty { color: var(--muted); display: grid; place-items: center; min-height: 140px; text-align: center; font-size: .9rem; }
pre.block { background: var(--bg-3); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; overflow: auto; max-height: 520px; margin: 0; white-space: pre-wrap; word-break: break-word; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.err { color: var(--bad); background: color-mix(in srgb, var(--bad) 8%, transparent); border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent); border-radius: 10px; padding: 10px 14px; font-size: .9rem; }
.notice { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); border-radius: 10px; padding: 10px 14px; font-size: .9rem; }
.notice.warn { background: color-mix(in srgb, var(--warn) 12%, transparent); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.status-line { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .85rem; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; flex: none; }
.skeleton { background: linear-gradient(90deg, var(--bg-3), var(--bg-hover), var(--bg-3)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; height: 14px; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Markdown */
.md { line-height: 1.65; word-wrap: break-word; }
.md > *:last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4 { margin: 1em 0 .45em; }
.md h1 { font-size: 1.35rem; } .md h2 { font-size: 1.18rem; } .md h3 { font-size: 1.05rem; } .md h4 { font-size: .98rem; }
.md ul, .md ol { padding-left: 1.4em; margin: 0 0 .8em; }
.md li { margin: .2em 0; }
.md blockquote { margin: 0 0 .8em; padding: 4px 14px; border-left: 3px solid var(--accent); color: var(--text-2); background: var(--bg-3); border-radius: 0 8px 8px 0; }
.md code { background: var(--bg-3); padding: .1em .35em; border-radius: 5px; }
.md pre { position: relative; background: #111114; color: #e8e8ea; border-radius: 10px; padding: 14px; overflow: auto; margin: 0 0 .9em; }
.md pre code { background: none; padding: 0; color: inherit; font-size: .84rem; }
.md pre .copy { position: absolute; top: 6px; right: 6px; font-size: .72rem; padding: 3px 8px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .08); color: #ddd; cursor: pointer; }
.md pre .lang { position: absolute; top: 8px; right: 60px; font-size: .7rem; color: #888; }
.md table { border-collapse: collapse; margin: 0 0 .9em; font-size: .88rem; display: block; overflow-x: auto; max-width: 100%; }
.md th, .md td { border: 1px solid var(--border-strong); padding: 6px 10px; text-align: left; }
.md th { background: var(--bg-3); }
.md img { border-radius: 12px; max-width: min(100%, 520px); display: block; margin: 6px 0; }
.md hr { margin: 1em 0; }
.md a.cite { font-size: .72em; vertical-align: super; padding: 0 3px; border-radius: 4px; background: var(--accent-soft); margin: 0 1px; text-decoration: none; }

/* ---------- Chat */
.chat-layout { display: grid; grid-template-columns: 260px 1fr; height: calc(100vh - 57px); min-height: 0; }
.chat-side { border-right: 1px solid var(--border); background: var(--bg-2); display: flex; flex-direction: column; min-height: 0; }
.chat-side .cs-top { padding: 12px; display: grid; gap: 8px; }
.chat-list { overflow-y: auto; padding: 0 8px 12px; flex: 1; }
.chat-list a { display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 8px; color: var(--text-2); font-size: .87rem; }
.chat-list a span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-list a:hover { background: var(--bg-hover); text-decoration: none; }
.chat-list a.active { background: var(--accent-soft); color: var(--accent); }
.chat-list .day { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 12px 10px 4px; font-weight: 600; }
.chat-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.chat-bar { display: flex; align-items: center; gap: 8px; padding: 10px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.chat-bar select { width: auto; padding: 6px 10px; font-size: .85rem; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 24px 20px 12px; }
.chat-inner { max-width: 820px; margin: 0 auto; display: grid; gap: 20px; }
.msg { display: grid; grid-template-columns: 34px 1fr; gap: 12px; }
.msg .who { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: .95rem; background: var(--bg-3); }
.msg.assistant .who { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.msg .body { min-width: 0; padding-top: 5px; }
.msg.user .body .md { background: var(--bg-2); border: 1px solid var(--border); padding: 10px 14px; border-radius: 12px; display: inline-block; max-width: 100%; white-space: pre-wrap; }
.msg .meta { font-size: .74rem; color: var(--muted); margin-top: 6px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.msg .meta button { border: 0; background: none; color: var(--muted); cursor: pointer; font: inherit; padding: 0; }
.msg .meta button:hover { color: var(--text); }
.msg .reasoning { font-size: .8rem; color: var(--muted); margin-bottom: 8px; }
.msg .reasoning summary { cursor: pointer; }
.msg .reasoning div { white-space: pre-wrap; padding: 6px 10px; border-left: 2px solid var(--border-strong); margin-top: 4px; max-height: 200px; overflow: auto; }
.sources { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; }
.sources a { flex: none; width: 190px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; font-size: .78rem; color: var(--text-2); }
.sources a:hover { border-color: var(--accent); text-decoration: none; }
.sources a b { display: block; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .82rem; }
.composer-wrap { padding: 10px 20px 18px; }
.composer { max-width: 820px; margin: 0 auto; background: var(--bg-2); border: 1px solid var(--border-strong); border-radius: 16px; padding: 8px; box-shadow: var(--shadow); }
.composer:focus-within { border-color: var(--accent); }
.composer textarea:focus-visible, .hero-box input:focus-visible, .palette input:focus-visible { outline: none; }
.composer textarea { border: 0; box-shadow: none !important; resize: none; min-height: 48px; max-height: 260px; padding: 8px 10px; background: transparent; }
.composer .c-row { display: flex; align-items: center; gap: 6px; padding: 0 4px; flex-wrap: wrap; }
.composer .c-row .grow { flex: 1; }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600; padding: 5px 10px; border-radius: 99px; border: 1px solid var(--border-strong); background: none; color: var(--text-2); cursor: pointer; font-family: inherit; }
.toggle.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border-strong); background: var(--bg-2); color: var(--text-2); border-radius: 99px; padding: 6px 12px; font: inherit; font-size: .84rem; cursor: pointer; text-align: left; }
.chip:hover { border-color: var(--accent); color: var(--text); }
.chat-empty { text-align: center; padding: 6vh 0 2vh; }
.chat-empty .logo { width: 56px; height: 56px; margin-bottom: 12px; }
.chat-empty .chips { justify-content: center; max-width: 680px; margin: 18px auto 0; }
.typing { display: inline-flex; gap: 4px; padding: 6px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* ---------- Modal, toast, menu, palette */
.overlay { position: fixed; inset: 0; background: rgba(8, 8, 12, .55); z-index: 100; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { background: var(--bg-2); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 24px; animation: pop .18s; }
.modal.wide { width: min(820px, 100%); }
.modal h2 { margin-bottom: 6px; }
.modal .m-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.modal .m-close { float: right; margin: -8px -8px 0 0; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.toasts { position: fixed; bottom: 18px; right: 18px; z-index: 200; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 36px)); }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: .9rem; animation: pop .2s; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.good { background: var(--good); color: #fff; }
.menu { position: absolute; z-index: 60; background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 240px; padding: 6px; animation: pop .12s; }
.menu .m-head { padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border-radius: 8px; border: 0; background: none; color: var(--text); font: inherit; font-size: .9rem; cursor: pointer; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--bg-hover); text-decoration: none; }
.menu hr { margin: 6px 0; }
.palette { width: min(620px, 100%); padding: 0; overflow: hidden; align-self: start; margin-top: 10vh; }
.palette input { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 16px 18px; font-size: 1rem; box-shadow: none !important; }
.palette .p-list { max-height: 420px; overflow-y: auto; padding: 6px; }
.palette .p-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 9px; color: var(--text); cursor: pointer; }
.palette .p-item.on, .palette .p-item:hover { background: var(--accent-soft); text-decoration: none; }
.palette .p-item small { color: var(--muted); margin-left: auto; font-size: .76rem; }
.cred-box { background: var(--bg-3); border-radius: 12px; padding: 14px 16px; font-family: var(--mono); display: grid; gap: 6px; margin: 12px 0; }
.cred-box div { display: flex; gap: 10px; align-items: center; }
.cred-box span { color: var(--muted); width: 84px; font-family: var(--font); font-size: .85rem; }
.cred-box b { flex: 1; font-size: 1.02rem; word-break: break-all; }

/* ---------- Landing */
.lp-nav { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 22px; padding: 12px max(16px, calc((100vw - 1180px) / 2)); background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.lp-nav .brand { padding: 0; }
.lp-nav .links { display: flex; gap: 18px; font-size: .92rem; }
.lp-nav .links a { color: var(--text-2); }
.lp-nav .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.lp { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.hero { text-align: center; padding: 72px 0 40px; position: relative; }
.hero::before { content: ""; position: absolute; top: -40px; left: 50%; width: 100vw; margin-left: -50vw; height: 480px; z-index: -1; pointer-events: none;
  -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent); background: radial-gradient(ellipse at 30% 20%, var(--accent-soft), transparent 60%), radial-gradient(ellipse at 75% 30%, rgba(14, 165, 183, .12), transparent 55%); }
.hero .eyebrow { display: inline-flex; gap: 8px; align-items: center; padding: 5px 12px; border-radius: 99px; border: 1px solid var(--border-strong); background: var(--bg-2); font-size: .82rem; color: var(--text-2); margin-bottom: 20px; }
.hero h1 { font-size: clamp(2.1rem, 5.4vw, 3.7rem); letter-spacing: -0.035em; line-height: 1.06; margin-bottom: 16px; }
.hero h1 .grad { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .sub { font-size: 1.12rem; color: var(--text-2); max-width: 680px; margin: 0 auto 28px; }
.hero-box { max-width: 720px; margin: 0 auto; text-align: left; }
.hero-box form { display: flex; gap: 8px; background: var(--bg-2); border: 1px solid var(--border-strong); border-radius: 16px; padding: 8px; box-shadow: var(--shadow); }
.hero-box input { border: 0; box-shadow: none !important; font-size: 1.02rem; padding: 10px 12px; background: transparent; }
.hero-box .chips { margin-top: 14px; justify-content: center; }
.trust { display: flex; justify-content: center; gap: 28px; flex-wrap: wrap; margin-top: 30px; color: var(--muted); font-size: .86rem; }
.trust b { color: var(--text); }
.section { padding: 56px 0; }
.section-head { text-align: center; max-width: 680px; margin: 0 auto 32px; }
.section-head h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); letter-spacing: -0.025em; }
.section-head p { color: var(--text-2); font-size: 1.02rem; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.step { padding: 22px; }
.step .n { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; margin-bottom: 12px; }
.pricing { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: stretch; }
.plan { display: flex; flex-direction: column; gap: 10px; padding: 24px; }
.plan.hl { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); position: relative; }
.plan.hl::before { content: "Most popular"; position: absolute; top: -11px; left: 24px; background: var(--accent); color: #fff; font-size: .72rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; }
.plan .price { font-size: 2.3rem; font-weight: 700; letter-spacing: -0.03em; }
.plan .price small { font-size: .9rem; font-weight: 500; color: var(--muted); }
.plan ul { list-style: none; padding: 0; margin: 4px 0 10px; display: grid; gap: 7px; font-size: .9rem; }
.plan ul li::before { content: "✓"; color: var(--good-text); font-weight: 700; margin-right: 8px; }
.plan .btn { margin-top: auto; }
.faq details { border-bottom: 1px solid var(--border); padding: 14px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 10px 0 0; color: var(--text-2); }
.footer { border-top: 1px solid var(--border); margin-top: 40px; padding: 36px 16px; color: var(--muted); font-size: .86rem; }
.footer .cols { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 24px; }
.footer h4 { color: var(--text); font-size: .86rem; margin-bottom: 10px; }
.footer a { color: var(--muted); display: block; margin-bottom: 6px; }
.footer a:hover { color: var(--text); }
.app-footer { padding: 18px 28px; color: var(--muted); font-size: .8rem; display: flex; gap: 16px; flex-wrap: wrap; border-top: 1px solid var(--border); }
.app-footer a { color: var(--muted); }

/* ---------- Image gallery, misc tool UIs */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.gallery figure { margin: 0; position: relative; border-radius: 12px; overflow: hidden; background: var(--bg-3); aspect-ratio: 1; }
.gallery figure img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.gallery figure figcaption { position: absolute; inset: auto 0 0; padding: 18px 8px 6px; font-size: .72rem; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .7)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gallery figure .g-actions { position: absolute; top: 6px; right: 6px; display: none; gap: 4px; }
.gallery figure:hover .g-actions { display: flex; }
.g-actions a, .g-actions button { background: rgba(0, 0, 0, .6); color: #fff; border: 0; border-radius: 7px; padding: 4px 8px; font-size: .75rem; cursor: pointer; font-family: inherit; }
.img-result { border-radius: 14px; overflow: hidden; background: var(--bg-3); display: grid; place-items: center; min-height: 320px; }
.img-result img { display: block; width: 100%; height: auto; }
.coin { display: flex; align-items: center; gap: 10px; }
.coin img { width: 22px; height: 22px; border-radius: 50%; }
.wx-now { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.wx-now .big { font-size: 3.6rem; line-height: 1; }
.wx-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.wx-day { text-align: center; padding: 12px 6px; border-radius: 12px; background: var(--bg-3); font-size: .85rem; }
.wx-day .i { font-size: 1.6rem; display: block; margin: 4px 0; }
.wx-hours { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.wx-hours div { flex: none; width: 62px; text-align: center; font-size: .8rem; background: var(--bg-3); border-radius: 10px; padding: 8px 4px; }
.qr-preview { display: grid; place-items: center; background: #fff; border-radius: 14px; padding: 16px; min-height: 260px; }
.qr-preview img { width: 240px; height: 240px; }
.pw-out { font-family: var(--mono); font-size: 1.25rem; word-break: break-all; padding: 16px; background: var(--bg-3); border-radius: 12px; }
.check-row { display: grid; grid-template-columns: 22px 180px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: .9rem; align-items: start; }
.check-row:last-child { border-bottom: 0; }
.score-ring { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; font-size: 1.6rem; font-weight: 700; flex: none; }
.result-list { display: grid; gap: 4px; }
.result { padding: 12px 4px; border-bottom: 1px solid var(--border); }
.result:last-child { border-bottom: 0; }
.result a.r-title { font-weight: 600; font-size: 1rem; }
.result .r-url { font-size: .78rem; color: var(--good-text); word-break: break-all; }
.result .r-snip { font-size: .88rem; color: var(--text-2); margin-top: 3px; }
.result .r-meta { font-size: .76rem; color: var(--muted); margin-top: 3px; }
.svc-card { display: flex; flex-direction: column; gap: 8px; }
.empty-state { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty-state .es-ico { font-size: 2.2rem; margin-bottom: 6px; }

/* ---------- Admin */
.admin .sidebar { background: var(--bg-2); }
.admin .brand .tag { font-size: .66rem; background: var(--bad); color: #fff; border-radius: 6px; padding: 1px 6px; margin-left: 4px; font-weight: 700; vertical-align: middle; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(400px, 100%); }
.task { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); align-items: flex-start; }
.task.done .t-title { text-decoration: line-through; color: var(--muted); }
.task .t-title { font-weight: 600; }

/* ---------- Responsive */
@media (max-width: 1100px) {
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chat-layout { grid-template-columns: 1fr; }
  .chat-side { display: none; }
  .chat-side.open { display: flex; position: fixed; inset: 57px 0 0 0; z-index: 25; width: min(320px, 85vw); box-shadow: var(--shadow-lg); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 50; left: 0; top: 0; bottom: 0; width: min(290px, 85vw); transform: translateX(-102%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 45; }
  .topbar { padding: 10px 16px; }
  .topbar .menu-btn { display: inline-flex; }
  .searchbox .kbd-hint { display: none; }
  .content { padding: 20px 16px 48px; }
  .grid.c2, .grid.c3 { grid-template-columns: 1fr; }
  .steps, .pricing { grid-template-columns: 1fr; }
  .lp-nav .links { display: none; }
  .footer .cols { grid-template-columns: 1fr 1fr; }
  .wx-days { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .check-row { grid-template-columns: 22px 1fr; }
  .check-row > :last-child { grid-column: 2; }
  .chat-scroll { padding: 16px 12px 8px; }
  .composer-wrap { padding: 8px 10px 12px; }
  .chat-bar { padding: 8px 12px; }
  .hide-sm { display: none !important; }
}
@media (max-width: 520px) {
  .grid.c4 { grid-template-columns: 1fr 1fr; }
  .credits-pill .lbl { display: none; }
  .hero { padding-top: 44px; }
  .hero-box form { flex-direction: column; }
  .kv { grid-template-columns: 1fr; gap: 0 0; }
  .kv dd { margin-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
