/* SercomAI client docs.
   Layout: fixed section rail (left) · reading column with wide demo figures · page outline (right).
   Docs chrome uses the logo blues; demos use the dashboard's own brand/neutral tokens (--ui-*). */

:root {
  /* docs chrome */
  --bg: #f5f8fa;
  --panel: #ffffff;
  --ink: #0f1e2b;
  --muted: #536578;
  --line: #d9e2ea;
  --accent: #0372b0;
  --accent-2: #1eb1e7;
  --accent-soft: #e2f2fb;
  --rail: #0d2233;
  --rail-ink: #dbe8f2;
  --rail-muted: #8fa6b8;
  --rail-line: #1d3a50;
  --rail-active: #17405c;

  /* product UI tokens, from dashboard-nextjs/app/globals.css */
  --ui-bg: #ffffff;
  --ui-surface: #fafafa;
  --ui-raised: #ffffff;
  --ui-border: #e5e5e5;
  --ui-text: #171717;
  --ui-text-2: #737373;
  --ui-brand: #2563eb;
  --ui-brand-strong: #1d4ed8;
  --ui-brand-soft: #eff6ff;
  --ui-brand-line: #bfdbfe;
  --ui-on-brand: #ffffff;
  --ui-success: #16a34a;
  --ui-success-soft: #e9f7ee;
  --ui-warning: #a16207;
  --ui-warning-soft: #fdf6dc;
  --ui-error: #dc2626;
  --ui-error-soft: #fdeaea;
  --ui-violet: #7c3aed;
  --ui-violet-soft: #f1eafe;
  --ui-shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 4px 12px rgb(15 30 43 / 0.06);

  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1118; --panel: #101a24; --ink: #e7eef5; --muted: #93a5b6; --line: #213040;
    --accent: #53c1ee; --accent-2: #1eb1e7; --accent-soft: #0f2a3b;
    --rail: #070d13; --rail-ink: #dbe8f2; --rail-muted: #8399ab; --rail-line: #172633; --rail-active: #12303f;
    --ui-bg: #0a0a0a; --ui-surface: #171717; --ui-raised: #1f1f1f; --ui-border: #2e2e2e;
    --ui-text: #f5f5f5; --ui-text-2: #a3a3a3;
    --ui-brand: #3b82f6; --ui-brand-strong: #60a5fa; --ui-brand-soft: #132444; --ui-brand-line: #1e3a8a; --ui-on-brand: #ffffff;
    --ui-success: #22c55e; --ui-success-soft: #0f2a1a; --ui-warning: #eab308; --ui-warning-soft: #2c2408;
    --ui-error: #f87171; --ui-error-soft: #331414; --ui-violet: #a78bfa; --ui-violet-soft: #231a3d;
    --ui-shadow: 0 1px 2px rgb(0 0 0 / 0.5), 0 4px 12px rgb(0 0 0 / 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a1118; --panel: #101a24; --ink: #e7eef5; --muted: #93a5b6; --line: #213040;
  --accent: #53c1ee; --accent-2: #1eb1e7; --accent-soft: #0f2a3b;
  --rail: #070d13; --rail-ink: #dbe8f2; --rail-muted: #8399ab; --rail-line: #172633; --rail-active: #12303f;
  --ui-bg: #0a0a0a; --ui-surface: #171717; --ui-raised: #1f1f1f; --ui-border: #2e2e2e;
  --ui-text: #f5f5f5; --ui-text-2: #a3a3a3;
  --ui-brand: #3b82f6; --ui-brand-strong: #60a5fa; --ui-brand-soft: #132444; --ui-brand-line: #1e3a8a; --ui-on-brand: #ffffff;
  --ui-success: #22c55e; --ui-success-soft: #0f2a1a; --ui-warning: #eab308; --ui-warning-soft: #2c2408;
  --ui-error: #f87171; --ui-error-soft: #331414; --ui-violet: #a78bfa; --ui-violet-soft: #231a3d;
  --ui-shadow: 0 1px 2px rgb(0 0 0 / 0.5), 0 4px 12px rgb(0 0 0 / 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.6 var(--font); -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
a { color: var(--accent); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 100%; }
.rail {
  background: var(--rail); color: var(--rail-ink);
  position: sticky; top: 0; align-self: start; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; overflow: hidden;
}
.rail-head { display: flex; align-items: center; gap: 10px; padding: 18px 18px 12px; }
.rail-head img { width: 30px; height: 30px; object-fit: contain; }
.rail-head b { font-size: 16px; letter-spacing: -0.01em; display: block; line-height: 1.2; }
.rail-head span { font-size: 12px; color: var(--rail-muted); display: block; }
.rail-search { padding: 4px 14px 12px; }
.rail-search input {
  width: 100%; background: transparent; border: 1px solid var(--rail-line); border-radius: var(--r-md);
  padding: 7px 10px; font-size: 14px; color: var(--rail-ink);
}
.rail-search input::placeholder { color: var(--rail-muted); }
.rail-nav { flex: 1; overflow-y: auto; padding: 0 10px 20px; }
.rail-group { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--rail-muted); padding: 16px 8px 6px; }
.rail-link {
  display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: var(--r-md);
  padding: 6px 8px; font-size: 14px; color: var(--rail-ink); line-height: 1.35;
}
.rail-link:hover { background: var(--rail-line); }
.rail-link[aria-current="page"] { background: var(--rail-active); color: #fff; box-shadow: inset 2px 0 0 var(--accent-2); }
.rail-link small { display: block; color: var(--rail-muted); font-size: 12px; }
.rail-empty { color: var(--rail-muted); font-size: 13px; padding: 12px 8px; }
.topbar { display: none; }

.main { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) 208px; gap: 40px;
  padding-block: 40px 80px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.page { min-width: 0; max-width: 920px; width: 100%; margin-inline: auto; padding-inline: clamp(0px, 3vw, 32px); }
.outline { position: sticky; top: 40px; align-self: start; font-size: 13px; }
.outline b { display: block; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.outline a { display: block; color: var(--muted); text-decoration: none; padding: 3px 0 3px 10px; border-left: 1px solid var(--line); }
.outline a:hover { color: var(--ink); border-left-color: var(--accent); }

/* ---------- page head and prose ---------- */
.page-eyebrow { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.page h1 { font-size: clamp(30px, 4vw, 40px); line-height: 1.12; letter-spacing: -0.025em; margin: 6px 0 10px; text-wrap: balance; }
.page-summary { font-size: 19px; line-height: 1.5; color: var(--muted); max-width: 62ch; margin: 0 0 16px; }
.page-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.meta-chip { display: inline-flex; gap: 6px; align-items: baseline; font-size: 13px; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 3px 12px; }
.meta-chip i { font-style: normal; color: var(--muted); }
.prose > * { max-width: 68ch; }
.prose > .demo, .prose > .doc-fields, .prose > .doc-grid, .prose > .doc-wide { max-width: none; }
.prose h2 { font-size: 24px; letter-spacing: -0.015em; line-height: 1.25; margin: 44px 0 10px; scroll-margin-top: 24px; text-wrap: balance; }
.prose h3 { font-size: 17px; margin: 28px 0 6px; }
.prose p, .prose ul, .prose ol { margin: 0 0 14px; }
.prose li { margin-bottom: 6px; }
.prose code { font: 0.88em var(--mono); background: var(--accent-soft); border-radius: var(--r-sm); padding: 1px 5px; }
.prose kbd, .doc-ui { font: 600 0.9em var(--font); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0 6px; white-space: nowrap; }
.doc-lead { font-size: 18px; }

.doc-steps { list-style: none; counter-reset: step; padding: 0; display: grid; gap: 10px; }
.doc-steps > li { counter-increment: step; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; margin: 0; }
.doc-steps > li::before { content: counter(step); width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  font: 600 13px/28px var(--mono); text-align: center; }

.doc-callout { border: 1px solid var(--line); border-left: 3px solid var(--accent); background: var(--panel); border-radius: var(--r-md); padding: 12px 16px; margin: 0 0 16px; }
.doc-callout > b:first-child { display: block; font-size: 13px; letter-spacing: 0.02em; }
.doc-callout p:last-child { margin-bottom: 0; }
.doc-callout.is-warn { border-left-color: var(--ui-warning); }
.doc-callout.is-danger { border-left-color: var(--ui-error); }
.doc-callout.is-tip { border-left-color: var(--ui-success); }

.doc-fields { width: 100%; border-collapse: collapse; font-size: 14.5px; margin: 0 0 18px; display: block; overflow-x: auto; }
.doc-fields th { text-align: left; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.doc-fields td { padding: 9px 16px 9px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc-fields td:first-child { font-weight: 600; white-space: nowrap; }

.doc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 0 0 18px; }
.doc-tile { text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; text-decoration: none; color: var(--ink); display: block; }
button.doc-tile:hover, a.doc-tile:hover { border-color: var(--accent); }
.doc-tile b { display: block; margin-bottom: 2px; }
.doc-tile span { color: var(--muted); font-size: 14px; line-height: 1.45; display: block; }
.doc-role { display: inline-block; font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 1px 9px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.doc-role.is-agent { background: var(--ui-success-soft); color: var(--ui-success); }

.page-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); }
.page-nav button { background: none; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px 14px; text-align: left; max-width: 48%; }
.page-nav button:hover { border-color: var(--accent); }
.page-nav small { display: block; color: var(--muted); font-size: 12px; }
.page-nav .is-next { margin-left: auto; text-align: right; }

/* ---------- demo frame ---------- */
.demo { margin: 22px 0 26px; border: 1px solid var(--line); border-radius: 10px; background: var(--ui-bg); color: var(--ui-text); box-shadow: var(--ui-shadow); overflow: hidden; position: relative; }
.demo-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink); }
.demo-bar b { font-weight: 600; margin-right: auto; }
.demo-flag { font-size: 11.5px; color: var(--muted); border: 1px dashed var(--line); border-radius: 999px; padding: 1px 9px; }
.demo-reset { background: none; border: 1px solid var(--line); border-radius: var(--r-md); padding: 2px 10px; font-size: 12.5px; }
.demo-reset:hover { border-color: var(--accent); color: var(--accent); }
.demo-stage { padding: 16px; font-size: 14px; line-height: 1.45; overflow-x: auto; }
.demo-stage.is-flush { padding: 0; }
.demo > figcaption { padding: 9px 14px; border-top: 1px solid var(--line); background: var(--panel); font-size: 13.5px; color: var(--muted); }
.demo-toast { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); background: var(--ink); color: var(--bg); font-size: 13px; padding: 7px 14px; border-radius: 999px; z-index: 5; max-width: calc(100% - 24px); text-align: center; animation: toast-in 0.18s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 6px); } }
@media (prefers-reduced-motion: reduce) { .demo-toast { animation: none; } }

/* ---------- UI kit: dashboard look (ui-*) ---------- */
.ui-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ui-row.is-between { justify-content: space-between; }
.ui-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ui-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.ui-grow { flex: 1; min-width: 0; }
.ui-h { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.ui-sub { font-size: 13px; color: var(--ui-text-2); margin: 0; }
.ui-label { font-size: 13px; font-weight: 500; display: block; margin-bottom: 4px; }
.ui-help { font-size: 12px; color: var(--ui-text-2); margin: 4px 0 0; }
.ui-mono { font-family: var(--mono); font-size: 0.92em; }
.ui-divider { border: 0; border-top: 1px solid var(--ui-border); margin: 14px 0; }

.ui-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: var(--r-md); border: 1px solid transparent; padding: 6px 14px; font-size: 14px; font-weight: 500; background: var(--ui-brand); color: var(--ui-on-brand); white-space: nowrap; }
.ui-btn:hover:not(:disabled) { background: var(--ui-brand-strong); color: var(--ui-on-brand); }
.ui-btn.is-secondary { background: var(--ui-raised); color: var(--ui-text); border-color: var(--ui-border); }
.ui-btn.is-secondary:hover:not(:disabled) { background: var(--ui-surface); color: var(--ui-text); }
.ui-btn.is-ghost { background: transparent; color: var(--ui-brand-strong); }
.ui-btn.is-ghost:hover:not(:disabled) { background: var(--ui-brand-soft); color: var(--ui-brand-strong); }
.ui-btn.is-danger { background: var(--ui-error); color: #fff; }
.ui-btn.is-danger:hover:not(:disabled) { background: var(--ui-error); filter: brightness(0.92); color: #fff; }
.ui-btn.is-sm { padding: 3px 10px; font-size: 13px; }

.ui-card { background: var(--ui-raised); border: 1px solid var(--ui-border); border-radius: var(--r-lg); padding: 14px 16px; }
.ui-card > .ui-h { font-size: 15px; margin-bottom: 8px; }
.ui-kpi { background: var(--ui-raised); border: 1px solid var(--ui-border); border-radius: var(--r-lg); padding: 12px 14px; }
.ui-kpi span { font-size: 12.5px; color: var(--ui-text-2); display: block; }
.ui-kpi b { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; display: block; }
.ui-kpi small { font-size: 12px; color: var(--ui-text-2); }

.ui-badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 500; background: var(--ui-surface); color: var(--ui-text-2); border: 1px solid var(--ui-border); white-space: nowrap; }
.ui-badge.is-brand { background: var(--ui-brand-soft); color: var(--ui-brand-strong); border-color: var(--ui-brand-line); }
.ui-badge.is-success { background: var(--ui-success-soft); color: var(--ui-success); border-color: transparent; }
.ui-badge.is-warning { background: var(--ui-warning-soft); color: var(--ui-warning); border-color: transparent; }
.ui-badge.is-error { background: var(--ui-error-soft); color: var(--ui-error); border-color: transparent; }
.ui-badge.is-ai { background: var(--ui-violet-soft); color: var(--ui-violet); border-color: transparent; }

.ui-input, .ui-select, .ui-textarea { width: 100%; background: var(--ui-surface); color: var(--ui-text); border: 1px solid var(--ui-border); border-radius: var(--r-md); padding: 6px 10px; font-size: 14px; }
.ui-textarea { min-height: 72px; resize: vertical; }
.ui-input:focus, .ui-select:focus, .ui-textarea:focus { outline: 2px solid var(--ui-brand); outline-offset: 0; border-color: transparent; }
.ui-field { min-width: 0; }
.ui-check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.ui-check input { width: 16px; height: 16px; accent-color: var(--ui-brand); }

.ui-switch { width: 36px; height: 20px; border-radius: 999px; border: 0; background: var(--ui-border); position: relative; flex: none; padding: 0; transition: background 0.15s; }
.ui-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / 0.3); transition: transform 0.15s; }
.ui-switch[aria-checked="true"] { background: var(--ui-brand); }
.ui-switch[aria-checked="true"]::after { transform: translateX(16px); }
@media (prefers-reduced-motion: reduce) { .ui-switch, .ui-switch::after { transition: none; } }

.ui-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--ui-border); overflow-x: auto; margin-bottom: 14px; }
.ui-tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; font-size: 14px; color: var(--ui-text-2); white-space: nowrap; margin-bottom: -1px; }
.ui-tab:hover { color: var(--ui-text); }
.ui-tab[aria-selected="true"] { color: var(--ui-brand-strong); border-bottom-color: var(--ui-brand); font-weight: 500; }
.ui-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.ui-pill { background: var(--ui-raised); border: 1px solid var(--ui-border); border-radius: 999px; padding: 3px 12px; font-size: 13px; color: var(--ui-text-2); }
.ui-pill[aria-pressed="true"], .ui-pill[aria-selected="true"] { background: var(--ui-brand-soft); border-color: var(--ui-brand-line); color: var(--ui-brand-strong); font-weight: 500; }

.ui-table-wrap { overflow-x: auto; border: 1px solid var(--ui-border); border-radius: var(--r-lg); }
.ui-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ui-table th { text-align: left; font-weight: 500; font-size: 12px; color: var(--ui-text-2); background: var(--ui-surface); padding: 8px 12px; border-bottom: 1px solid var(--ui-border); white-space: nowrap; }
.ui-table td { padding: 9px 12px; border-bottom: 1px solid var(--ui-border); vertical-align: middle; }
.ui-table tr:last-child td { border-bottom: 0; }
.ui-table .is-num { text-align: right; font-variant-numeric: tabular-nums; }

.ui-alert { border-radius: var(--r-md); padding: 9px 12px; font-size: 13.5px; background: var(--ui-brand-soft); color: var(--ui-text); border: 1px solid var(--ui-brand-line); }
.ui-alert.is-success { background: var(--ui-success-soft); border-color: transparent; }
.ui-alert.is-warning { background: var(--ui-warning-soft); border-color: transparent; }
.ui-alert.is-error { background: var(--ui-error-soft); border-color: transparent; }

.ui-modal { position: absolute; inset: 0; background: rgb(10 17 24 / 0.55); display: grid; place-items: center; padding: 16px; z-index: 4; }
.ui-modal-box { background: var(--ui-raised); color: var(--ui-text); border: 1px solid var(--ui-border); border-radius: 10px; padding: 18px; width: min(440px, 100%); max-height: 100%; overflow-y: auto; box-shadow: var(--ui-shadow); display: grid; gap: 12px; }
.ui-modal-box .ui-h { font-size: 16px; }
.ui-progress { height: 8px; background: var(--ui-border); border-radius: 999px; overflow: hidden; }
.ui-progress > i { display: block; height: 100%; background: var(--ui-brand); border-radius: 999px; }
.ui-empty { text-align: center; color: var(--ui-text-2); font-size: 13.5px; padding: 22px 12px; border: 1px dashed var(--ui-border); border-radius: var(--r-lg); }
.ui-stepper { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.ui-step { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ui-text-2); }
.ui-step i { font: 600 12px/22px var(--mono); width: 22px; height: 22px; text-align: center; border-radius: 50%; background: var(--ui-border); color: var(--ui-text); font-style: normal; }
.ui-step.is-current { color: var(--ui-text); font-weight: 500; }
.ui-step.is-current i, .ui-step.is-done i { background: var(--ui-brand); color: #fff; }

/* kanban */
.ui-board { display: flex; gap: 12px; overflow-x: auto; align-items: flex-start; padding-bottom: 4px; }
.ui-lane { flex: 0 0 220px; background: var(--ui-surface); border: 1px solid var(--ui-border); border-radius: var(--r-lg); padding: 10px; display: grid; gap: 8px; min-height: 120px; align-content: start; }
.ui-lane.is-over { outline: 2px dashed var(--ui-brand); outline-offset: -2px; }
.ui-lane-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 600; }
.ui-deal { background: var(--ui-raised); border: 1px solid var(--ui-border); border-radius: var(--r-md); padding: 9px 10px; font-size: 13px; display: grid; gap: 4px; cursor: grab; }
.ui-deal[aria-pressed="true"] { outline: 2px solid var(--ui-brand); }
.ui-deal b { font-weight: 600; }
.ui-deal span { color: var(--ui-text-2); font-size: 12.5px; }

/* chat bubbles (Test Chat and conversation views) */
.ui-chat { display: flex; flex-direction: column; gap: 8px; padding: 4px; }
.ui-msg { max-width: min(78%, 460px); padding: 8px 12px; border-radius: 12px; font-size: 14px; line-height: 1.45; background: var(--ui-surface); border: 1px solid var(--ui-border); align-self: flex-start; white-space: pre-line; }
.ui-msg.is-out { align-self: flex-end; background: var(--ui-brand); color: var(--ui-on-brand); border-color: transparent; }
.ui-msg.is-bot { align-self: flex-end; background: var(--ui-violet-soft); border-color: transparent; }
.ui-msg.is-note { align-self: flex-end; background: var(--ui-warning-soft); border-color: transparent; }
.ui-msg.is-activity { align-self: center; background: none; border: 0; color: var(--ui-text-2); font-size: 12.5px; padding: 2px; }
.ui-msg small { display: block; font-size: 11.5px; opacity: 0.75; margin-top: 2px; }
.ui-composer { display: flex; gap: 8px; padding-top: 10px; border-top: 1px solid var(--ui-border); margin-top: 8px; }

/* simple bar chart rows */
.ui-bars { display: grid; gap: 8px; }
.ui-bar { display: grid; grid-template-columns: minmax(90px, 150px) minmax(0, 1fr) 56px; gap: 10px; align-items: center; font-size: 13px; }
.ui-bar > i { display: block; height: 14px; border-radius: 3px; background: var(--ui-brand); min-width: 2px; }
.ui-bar > b { text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }

/* ---------- Chatwoot look (cw-*): the CRM shell around the embeds ---------- */
.cw-app { display: grid; grid-template-columns: 200px minmax(0, 1fr); min-height: 380px; font-size: 13.5px; background: var(--ui-bg); }
.cw-app.has-list { grid-template-columns: 200px 250px minmax(0, 1fr); }
.cw-app.is-conv { grid-template-columns: 170px minmax(0, 1fr) 200px; }
.cw-side { background: var(--ui-surface); border-right: 1px solid var(--ui-border); padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cw-brand { display: flex; align-items: center; gap: 8px; font-weight: 600; padding: 2px 8px 10px; }
.cw-brand img { width: 22px; height: 22px; }
.cw-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: none; border: 0; border-radius: var(--r-md); padding: 6px 8px; font-size: 13.5px; color: var(--ui-text); }
.cw-item:hover { background: var(--ui-border); }
.cw-item[aria-current="true"] { background: var(--ui-brand-soft); color: var(--ui-brand-strong); font-weight: 500; }
.cw-item.is-child { padding-left: 30px; font-size: 13px; color: var(--ui-text-2); }
.cw-item.is-child[aria-current="true"] { color: var(--ui-brand-strong); }
.cw-item.is-sercom::after { content: "SercomAI"; margin-left: auto; font-size: 10px; letter-spacing: 0.04em; color: var(--ui-brand-strong); background: var(--ui-brand-soft); border-radius: 999px; padding: 0 6px; }
.cw-sep { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ui-text-2); padding: 10px 8px 4px; }
.cw-list { border-right: 1px solid var(--ui-border); min-width: 0; overflow-y: auto; }
.cw-conv { display: grid; gap: 2px; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--ui-border); padding: 10px 12px; font-size: 13px; color: var(--ui-text); }
.cw-conv:hover, .cw-conv[aria-current="true"] { background: var(--ui-surface); }
.cw-conv b { font-weight: 600; }
.cw-conv span { color: var(--ui-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-main { min-width: 0; display: flex; flex-direction: column; }
.cw-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; border-bottom: 1px solid var(--ui-border); }
.cw-head b { margin-right: auto; }
.cw-body { padding: 12px; flex: 1; min-width: 0; overflow: auto; }
.cw-panel { border-left: 1px solid var(--ui-border); min-width: 0; overflow-y: auto; }
.cw-acc { border-bottom: 1px solid var(--ui-border); }
.cw-acc > summary { list-style: none; cursor: pointer; padding: 9px 12px; font-weight: 600; font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.cw-acc > summary::-webkit-details-marker { display: none; }
.cw-acc > summary::after { content: "+"; color: var(--ui-text-2); font-weight: 400; }
.cw-acc[open] > summary::after { content: "−"; }
.cw-acc-body { padding: 4px 12px 14px; display: grid; gap: 10px; }
.cw-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--ui-brand-soft); color: var(--ui-brand-strong); font: 600 11px/26px var(--font); text-align: center; flex: none; }
.cw-embed { border: 1px dashed var(--ui-brand-line); border-radius: var(--r-lg); padding: 14px; background: var(--ui-bg); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) { .main { grid-template-columns: minmax(0, 1fr); } .outline { display: none; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--rail); color: var(--rail-ink);
    padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .topbar img { width: 24px; height: 24px; }
  .topbar b { margin-right: auto; }
  .topbar button { background: none; border: 1px solid var(--rail-line); color: var(--rail-ink); border-radius: var(--r-md); padding: 4px 12px; font-size: 14px; }
  body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--rail); }
  .rail { position: fixed; inset: 0; height: auto; z-index: 25; padding-top: env(safe-area-inset-top, 0px); }
  .rail:not(.is-open) { display: none; }
  .main { padding-block: 24px 56px; }
  .cw-app, .cw-app.has-list, .cw-app.is-conv { grid-template-columns: minmax(0, 1fr); }
  .cw-side, .cw-list, .cw-panel { border: 0; border-bottom: 1px solid var(--ui-border); }
  .ui-msg { max-width: 92%; }
}

/* Demo content never inherits prose spacing: layout inside demos comes from ui-col / ui-row gaps. */
.demo :is(h2, h3, h4, h5, p, ul, ol, table) { margin: 0; max-width: none; }
.demo :is(h2, h3, h4, h5) { font-size: 15px; letter-spacing: 0; line-height: 1.35; }
.demo .ui-h { font-size: 18px; }
.demo .ui-card > .ui-h, .demo .ui-modal-box .ui-h { font-size: 15px; }
.demo code { font: 0.9em var(--mono); background: var(--ui-surface); border: 1px solid var(--ui-border); border-radius: var(--r-sm); padding: 0 4px; }
.cw-item.is-sercom::after { flex: none; }

/* The hidden attribute must win over kit display rules (modals, panes, rows). */
[hidden] { display: none !important; }
.doc-callout.is-warning { border-left-color: var(--ui-warning); }
