/* SiteBot dashboard. Cool paper background, deep ink sidebar, one teal brand colour, gold used sparingly. */
:root {
  --ink: #0e2a2b;
  --ink-2: #17403f;
  --paper: #f1f4f2;
  --surface: #ffffff;
  --line: #dbe3df;
  --line-2: #e9eeeb;
  --text: #14272a;
  --muted: #5b6e72;
  --brand: #0b5d5e;
  --brand-2: #094b4c;
  --brand-soft: #e0efec;
  --gold: #f0a81c;
  --ok: #1f7a4d;
  --ok-soft: #e0f3e8;
  --warn: #8a5d05;
  --warn-soft: #fbf0d4;
  --bad: #b3382c;
  --bad-soft: #fbe5e1;
  --info: #2557a7;
  --info-soft: #e4ecfa;
  --font: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Bricolage Grotesque', 'Hanken Grotesk', system-ui, sans-serif;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.55; color: var(--text); background: var(--paper); }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 650; letter-spacing: -0.01em; line-height: 1.2; margin: 0; color: var(--text); }
h1 { font-size: 28px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
p { margin: 0 0 12px; }
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--brand-2); }
code, pre, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
img, svg { max-width: 100%; }
.icon { flex: none; vertical-align: -3px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: var(--r-sm); z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.sidebar :focus-visible { outline-color: var(--gold); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--ink); color: #c9d9d6; padding: 22px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 10px 22px; font-family: var(--display); font-weight: 700; font-size: 20px; color: #fff; text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px 9px 9px 3px; background: var(--gold); display: grid; place-items: center; color: var(--ink); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { margin: 18px 10px 6px; font-size: 12.5px; color: #86a09c; font-weight: 600; }
.nav a, .nav button { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; color: #c9d9d6; text-decoration: none; font: inherit; font-weight: 500; background: none; border: 0; width: 100%; text-align: left; cursor: pointer; position: relative; }
.nav a:hover, .nav button:hover { background: var(--ink-2); color: #fff; }
.nav a.is-active { background: var(--ink-2); color: #fff; }
.nav a.is-active::before { content: ''; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--gold); }
.side-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid #234a49; }
.who { padding: 8px 10px 10px; font-size: 13px; color: #86a09c; overflow-wrap: anywhere; }
.who strong { display: block; color: #fff; font-size: 14px; font-weight: 600; }
.main-wrap { min-width: 0; }
.topbar { display: none; }
.main { padding: 34px 40px 80px; max-width: 1180px; }

/* ---------- page head ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin: 6px 0 0; max-width: 62ch; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; }
.panel + .panel, .stack > * + * { margin-top: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-flat { padding: 0; overflow: hidden; }
.panel-flat .panel-head { padding: 18px 22px 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.grid-2, .grid-3 { align-items: start; }
.grid-2 > .panel, .grid-3 > .panel, .grid-main > .panel { margin-top: 0; }
.figures { display: flex; gap: 34px; flex-wrap: wrap; margin-bottom: 18px; }
.fig strong { display: block; font-family: var(--display); font-size: 30px; font-weight: 650; line-height: 1.1; letter-spacing: -0.02em; }
.fig span { font-size: 13.5px; color: var(--muted); }
.fig.is-warn strong { color: var(--bad); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: 14.5px; cursor: pointer; text-decoration: none; line-height: 1.3; }
.btn:hover { background: #f6f9f7; color: var(--text); border-color: #c5d1cb; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.btn-danger { color: var(--bad); border-color: #ecc4be; }
.btn-danger:hover { background: var(--bad-soft); color: var(--bad); border-color: #e3aaa2; }
.btn-sm { padding: 6px 11px; font-size: 13.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- forms ---------- */
.field { margin-bottom: 16px; }
.field label, .label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 5px; }
.input, .select, .textarea { width: 100%; padding: 10px 12px; font: inherit; color: var(--text); background: #fff; border: 1px solid #c9d5d0; border-radius: 10px; }
.textarea { min-height: 84px; resize: vertical; }
.input:hover, .select:hover, .textarea:hover { border-color: #9fb3ab; }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
.input-sm { padding: 7px 10px; font-size: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; cursor: pointer; }
.check input { margin-top: 4px; width: 17px; height: 17px; accent-color: var(--brand); }
.check .hint { margin-top: 2px; }
.colorpick { display: flex; gap: 10px; align-items: center; }
.colorpick input[type=color] { width: 46px; height: 42px; padding: 3px; border: 1px solid #c9d5d0; border-radius: 10px; background: #fff; cursor: pointer; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.filters .input, .filters .select { width: auto; min-width: 160px; }
.filters .input-search { min-width: 240px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 8px; flex-wrap: wrap; }

/* ---------- badges, flashes, meters ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: #e9eeeb; color: #4d6065; }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-plain::before { display: none; }
.badge-info::before { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.flash { padding: 12px 16px; border-radius: var(--r); margin-bottom: 18px; border: 1px solid; font-weight: 500; }
.flash-success { background: var(--ok-soft); border-color: #b5dfc6; color: #135a36; }
.flash-error { background: var(--bad-soft); border-color: #efc2bb; color: #8a2a20; }
.flash-info { background: var(--info-soft); border-color: #c2d4f0; color: #1d4585; }
.notice { padding: 14px 16px; border-radius: var(--r); background: var(--warn-soft); border: 1px solid #efd9a2; color: #5f4204; margin-bottom: 18px; }
.notice.is-info { background: var(--info-soft); border-color: #c2d4f0; color: #1d4585; }
.notice.is-bad { background: var(--bad-soft); border-color: #efc2bb; color: #8a2a20; }
.notice strong { display: block; margin-bottom: 2px; }
.meter { height: 8px; border-radius: 999px; background: #e4ebe7; overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 999px; background: var(--brand); }
.meter.is-high span { background: var(--gold); }
.meter.is-full span { background: var(--bad); }
.meter-row { margin-bottom: 16px; }
.meter-row .top { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; gap: 10px; }

/* ---------- tables and lists ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 600; font-size: 13px; color: var(--muted); padding: 11px 16px; border-bottom: 1px solid var(--line); background: #f8faf9; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafcfb; }
.table-wrap { overflow-x: auto; }
.table .select, .table .input-sm { width: auto; min-width: 112px; }
.table td.url { max-width: 420px; overflow-wrap: anywhere; }
.rowlist { list-style: none; margin: 0; padding: 0; }
.rowlist li { border-top: 1px solid var(--line-2); }
.rowlist li:first-child { border-top: 0; }
.rowlink { display: flex; gap: 14px; align-items: center; padding: 14px 22px; text-decoration: none; color: inherit; }
.rowlink:hover { background: #f7faf8; color: inherit; }
.rowlink .grow { flex: 1; min-width: 0; }
.rowlink .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.rowlink .meta { font-size: 13px; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--brand); }
.favicon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; color: #fff; flex: none; font-family: var(--display); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 24px; overflow-x: auto; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; color: var(--muted); text-decoration: none; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.is-active { color: var(--brand); border-bottom-color: var(--brand); }

/* ---------- charts ---------- */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-bottom: 22px; }
.bar { flex: 1; height: 100%; display: flex; align-items: flex-end; position: relative; min-width: 0; }
.bar span { display: block; width: 100%; background: var(--brand); border-radius: 4px 4px 0 0; min-height: 2px; opacity: .88; }
.bar span.is-zero { background: var(--line); opacity: 1; }
.bar:hover span { opacity: 1; background: var(--ink-2); }
.bar em { position: absolute; bottom: -22px; left: 50%; transform: translateX(-50%); font-size: 11.5px; color: var(--muted); font-style: normal; white-space: nowrap; }

/* ---------- empty states ---------- */
.empty { text-align: center; padding: 44px 24px; }
.empty h3 { margin-bottom: 6px; font-size: 18px; }
.empty p { color: var(--muted); max-width: 46ch; margin: 0 auto 18px; }
.empty-mini { padding: 26px 22px; color: var(--muted); }

/* ---------- key/value and code ---------- */
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: 14px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.codebox { position: relative; background: var(--ink); color: #d7ebe7; border-radius: var(--r); padding: 16px 52px 16px 16px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.codebox .copy { position: absolute; top: 8px; right: 8px; background: var(--ink-2); color: #fff; border: 0; border-radius: 8px; padding: 7px 9px; cursor: pointer; }
.codebox .copy:hover { background: #21514f; }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line-2); align-items: flex-start; }
.steps li:first-child { border-top: 0; }
.tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #c2cfc9; flex: none; margin-top: 1px; display: grid; place-items: center; color: #fff; }
.tick.is-done { background: var(--ok); border-color: var(--ok); }

/* ---------- transcript ---------- */
.transcript { display: flex; flex-direction: column; gap: 14px; max-width: 760px; }
.msg { max-width: 82%; padding: 11px 15px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg-meta { font-size: 12.5px; color: var(--muted); margin-top: 6px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.msg.user + .msg-meta { align-self: flex-end; }
.transcript .msg + .msg-meta { margin-top: -10px; }
.srcs a { font-size: 13px; }
.flag { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; }
.flag-bad { color: var(--bad); }
.flag-ok { color: var(--ok); }
.lead-card { background: var(--ok-soft); border: 1px solid #b5dfc6; border-radius: var(--r); padding: 14px 18px; margin-bottom: 20px; max-width: 760px; }

/* ---------- pager ---------- */
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 18px; }

/* ---------- appearance preview ---------- */
.studio { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; align-items: start; }
.stage { position: sticky; top: 24px; background: repeating-linear-gradient(45deg, #e6ece9, #e6ece9 10px, #edf1ef 10px, #edf1ef 20px); border-radius: var(--r-lg); padding: 22px 18px 18px; min-height: 560px; display: flex; flex-direction: column; justify-content: flex-end; gap: 14px; }
.stage-label { position: absolute; top: 12px; left: 16px; font-size: 13px; color: var(--muted); font-weight: 600; }
.pv { width: 100%; background: #fff; border-radius: 16px; box-shadow: 0 10px 30px rgba(14, 42, 43, .18); overflow: hidden; display: flex; flex-direction: column; }
.pv-head { background: var(--pv, #0b5d5e); color: #fff; padding: 14px 16px; display: flex; gap: 11px; align-items: center; }
.pv-av { width: 38px; height: 38px; border-radius: 50%; background: rgba(255, 255, 255, .22); display: grid; place-items: center; font-weight: 700; font-size: 17px; flex: none; }
.pv-head strong { display: block; font-size: 15px; line-height: 1.25; }
.pv-head span { font-size: 12.5px; opacity: .85; }
.pv-body { padding: 14px; display: flex; flex-direction: column; gap: 9px; background: #f6f8f7; font-size: 13.5px; }
.pv-b { background: #fff; border: 1px solid #e2e9e5; padding: 8px 12px; border-radius: 14px 14px 14px 4px; max-width: 88%; }
.pv-u { background: var(--pv, #0b5d5e); color: #fff; padding: 8px 12px; border-radius: 14px 14px 4px 14px; align-self: flex-end; max-width: 80%; }
.pv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pv-chip { border: 1px solid var(--pv, #0b5d5e); color: var(--pv, #0b5d5e); background: #fff; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; }
.pv-in { border-top: 1px solid #e2e9e5; padding: 11px 14px; color: #8a9a95; font-size: 13.5px; display: flex; justify-content: space-between; background: #fff; }
.pv-in b { color: var(--pv, #0b5d5e); }
.pv-launch { width: 54px; height: 54px; border-radius: 50%; background: var(--pv, #0b5d5e); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); align-self: flex-end; }
.pv-launch.is-left { align-self: flex-start; }

/* ---------- auth ---------- */
.auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.auth-art { background: var(--ink); color: #fff; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art .brand { padding: 0; }
.auth-art h2 { color: #fff; font-size: 38px; line-height: 1.12; max-width: 15ch; margin-bottom: 14px; }
.auth-art .lede { color: #a8c2bd; max-width: 40ch; font-size: 16.5px; }
.demo { margin: 34px 0 6px; display: flex; flex-direction: column; gap: 10px; max-width: 420px; }
.demo .q { align-self: flex-end; background: var(--gold); color: #2a1d00; padding: 10px 15px; border-radius: 16px 16px 4px 16px; font-weight: 500; }
.demo .a { background: #fff; color: var(--text); padding: 12px 15px; border-radius: 16px 16px 16px 4px; }
.demo .src { display: inline-block; margin-top: 8px; font-size: 12.5px; color: var(--brand); background: var(--brand-soft); padding: 2px 9px; border-radius: 999px; }
.auth-art small { color: #86a09c; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { margin-bottom: 6px; }
.auth-card .sub { color: var(--muted); margin-bottom: 26px; }
.auth-alt { margin-top: 22px; text-align: center; color: var(--muted); }
.mobile-brand { display: none; }

/* ---------- widget-in-dashboard test stage ---------- */
.test-note { max-width: 62ch; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .studio { grid-template-columns: 1fr; }
  .stage { position: static; min-height: 0; }
  .grid-main, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 272px; z-index: 50; transform: translateX(-100%); transition: transform .2s ease; height: 100dvh; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(14, 42, 43, .45); }
  .topbar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 20; }
  .topbar .brand { padding: 0; font-size: 18px; }
  .topbar button { background: none; border: 0; color: #fff; cursor: pointer; padding: 4px; }
  .main { padding: 22px 16px 60px; }
  h1 { font-size: 24px; }
  .grid-2, .form-row { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .mobile-brand { display: flex; color: var(--text); margin-bottom: 26px; padding: 0; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 10px; }
  .figures { gap: 22px; }
  .rowlink { padding: 12px 16px; }
  .panel { padding: 18px; }
  .panel.panel-flat { padding: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
