/* Wave29 — operator console design system.
   Tokens first; components below. Dark by default, light via prefers-color-scheme or data-theme. */

:root {
  --bg: #101719;
  --bg-2: #141e21;
  --surface: #192529;
  --surface-2: #213136;
  --border: #2b3d42;
  --border-strong: #466068;
  --text: #edf4f3;
  --text-2: #c2d1d0;
  --muted: #9cafb0;
  --accent: #6cdbc6;
  --accent-2: #a0bafa;
  --accent-ink: #04121a;
  --good: #3ddc97;
  --warn: #ffc857;
  --bad: #ff6b7a;
  --info: #6ea8ff;
  --good-bg: rgba(61, 220, 151, .12);
  --warn-bg: rgba(255, 200, 87, .12);
  --bad-bg: rgba(255, 107, 122, .13);
  --info-bg: rgba(110, 168, 255, .13);
  --muted-bg: rgba(118, 132, 171, .14);
  --shadow: 0 2px 4px rgba(0, 0, 0, .08);
  --radius: 12px;
  --radius-sm: 7px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f7f6; --bg-2: #edf2f0; --surface: #ffffff; --surface-2: #f0f5f3;
    --border: #dbe4e0; --border-strong: #acbfb7; --text: #182e29; --text-2: #3e5750; --muted: #586f67;
    --accent: #087c68; --accent-2: #4a5bea; --accent-ink: #ffffff;
    --good: #157347; --warn: #885700; --bad: #bb3043; --info: #2f6fd6;
    --shadow: 0 2px 4px rgba(24, 46, 41, .025);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f5f7f6; --bg-2: #edf2f0; --surface: #ffffff; --surface-2: #f0f5f3;
  --border: #dbe4e0; --border-strong: #acbfb7; --text: #182e29; --text-2: #3e5750; --muted: #586f67;
  --accent: #087c68; --accent-2: #4a5bea; --accent-ink: #ffffff;
  --good: #157347; --warn: #885700; --bad: #bb3043; --info: #2f6fd6;
  --shadow: 0 2px 4px rgba(24, 46, 41, .025);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; overflow-wrap: anywhere; }
img, video, audio, canvas { max-width: 100%; }
img { height: auto; }
fieldset { min-width: 0; }
input[type=file] { max-width: 100%; min-width: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: clamp(26px, 2.4vw, 34px); letter-spacing: -.035em; }
h2 { font-size: 16.5px; }
h3 { font-size: 14px; }
p { margin: 0 0 .8em; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
pre { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.ico { width: 18px; height: 18px; flex: none; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.sidebar { background: var(--bg-2); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar > .brand, .brand-caption, .nav-search, .sidebar-foot { flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 12px; color: var(--text); font-size: 18px; font-weight: 600; letter-spacing: .02em; }
.brand:hover { text-decoration: none; }
.brand b { color: var(--accent); font-weight: 800; }
.brand-mark { width: 28px; height: 28px; color: var(--accent); }
.brand-lg { justify-content: center; font-size: 24px; margin-bottom: 18px; }
.brand-caption { margin: -6px 18px 18px; font-size: 12px; color: var(--muted); }
.nav-search { padding: 0 14px 10px; }
.nav-search input { font-size: 13px; background: var(--surface); }
.nav-no-results { padding: 10px; }
.nav { padding: 0 12px 18px; flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 14px 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 8px 12px; margin: 2px 0; border-radius: var(--radius-sm); color: var(--text-2); font-size: 14px; }
.nav-item:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.nav-item.active { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--accent); font-weight: 650; box-shadow: inset 3px 0 0 var(--accent); }
.nav-item.active .ico { color: var(--accent); }
.nav-count { margin-left: auto; background: var(--warn); color: #1d1400; font-size: 11px; font-weight: 700; padding: 0 7px; border-radius: 99px; }
.sidebar-foot { border-top: 1px solid var(--border); padding: 12px 18px; font-size: 12.5px; }
.foot-row { display: flex; gap: 14px; margin-top: 6px; }
.foot-row form { margin: 0; }
.linklike { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 32px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.topbar-status { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.kill-form { margin: 0; }
.status-pill { font-size: 12px; padding: 3px 10px; border-radius: 99px; background: var(--muted-bg); color: var(--text-2); }
.status-pill.good { background: var(--good-bg); color: var(--good); }
.status-pill.bad { background: var(--bad-bg); color: var(--bad); font-weight: 600; }
.status-pill.warn { background: var(--warn-bg); color: var(--warn); }
.nav-toggle, .nav-burger { display: none; }
.content { padding: clamp(20px, 2.2vw, 40px) clamp(16px, 2.5vw, 48px) 72px; max-width: 1760px; width: 100%; margin-inline: auto; container: workspace / inline-size; }
.banner { padding: 10px 24px; font-size: 13px; border-bottom: 1px solid var(--border); }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head > div:first-child { min-width: 0; overflow-wrap: anywhere; }
.page-head h1 { margin: 0; }
.subtitle { color: var(--muted); margin: 8px 0 0; max-width: 68ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.page-actions form { margin: 0; }

/* ---------- bare (login/setup) ---------- */
body.bare { display: grid; place-items: center; min-height: 100vh; padding: 24px 16px; background: radial-gradient(1200px 600px at 50% -10%, rgba(61, 214, 245, .12), transparent), var(--bg); }
.bare-wrap { width: 100%; max-width: 420px; }

/* ---------- layout helpers ---------- */
.grid { display: grid; gap: 18px; }
.grid > *, .split > *, .row > *, .row-between > *, .inline-form > *, .page-actions > * { min-width: 0; max-width: 100%; }
.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)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.stack > * + * { margin-top: 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; min-width: 0; }
.card > h2:first-child, .card-head h2 { font-size: 16px; text-transform: none; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush > .card-head { padding: 20px 22px 14px; margin: 0; border-bottom: 1px solid var(--border); }
.card-note { font-size: 12.5px; color: var(--muted); }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat-label { font-size: 13px; color: var(--text-2); font-weight: 600; }
.stat-value { font-size: 32px; font-weight: 650; letter-spacing: -.035em; font-variant-numeric: tabular-nums; margin: 6px 0; }
.stat-delta { font-size: 12px; }
.stat-sub { font-size: 12.5px; color: var(--muted); }
.stat-delta.up { color: var(--good); }
.stat-delta.down { color: var(--bad); }
.spark { color: var(--accent); display: block; }
.kv { display: grid; grid-template-columns: fit-content(40%) minmax(0, 1fr); gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.empty { text-align: center; color: var(--muted); padding: 36px 16px; }
.empty p { max-width: 460px; margin: 6px auto 0; }
.empty-icon { font-size: 26px; color: var(--border-strong); line-height: 1; margin-bottom: 8px; }
.empty-action { margin-top: 14px; }
.empty strong { display: block; color: var(--text-2); margin-bottom: 4px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; max-width: 100%; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--border); }
.card > table.table { table-layout: fixed; }
.table td { padding: 12px 12px; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions form { display: inline; }
.card-flush .table th:first-child, .card-flush .table td:first-child { padding-left: 18px; }
.card-flush .table th:last-child, .card-flush .table td:last-child { padding-right: 18px; }

/* ---------- badges / chips ---------- */
.badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 99px; white-space: nowrap; }
.badge-good { background: var(--good-bg); color: var(--good); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: var(--muted-bg); color: var(--text-2); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 2px 9px; border-radius: 99px; border: 1px solid var(--border-strong); color: var(--text-2); background: var(--surface-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tier { font-family: var(--mono); font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border-strong); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 13.5px/1.35 var(--font); min-height: 40px; max-width: 100%; padding: 9px 15px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; text-align: center; }
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-danger { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.btn-good { background: var(--good-bg); border-color: var(--good); color: var(--good); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 11px; min-height: 34px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.confirming { background: var(--bad); color: #fff; border-color: var(--bad); }

/* ---------- forms ---------- */
form { margin: 0; }
.form { display: grid; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .label { font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.help { font-size: 13px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=date], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; max-width: 100%; font: 14px/1.5 var(--font); color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 10px 12px;
}
textarea { min-height: 90px; resize: vertical; }
textarea.tall { min-height: 260px; }
textarea.code { font-family: var(--mono); font-size: 12.5px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 0; border-color: var(--accent); }
input[type=file] { color: var(--text-2); }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; }
.check input { margin-top: 3px; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { flex: 1 1 180px; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px 16px; margin: 0; }
legend { padding: 0 6px; font-weight: 600; font-size: 13px; color: var(--text-2); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters select, .filters input { width: auto; min-width: 150px; }

/* ---------- flash ---------- */
.flash { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; border: 1px solid; font-size: 13.5px; }
.flash-success { background: var(--good-bg); border-color: var(--good); color: var(--good); }
.flash-error { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.flash-warn { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
.flash-info { background: var(--info-bg); border-color: var(--info); color: var(--info); }

/* ---------- tabs ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tabs a { padding: 9px 14px; color: var(--text-2); border-bottom: 2px solid transparent; max-width: 100%; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); }
.tabs .count { display: inline-block; min-width: 18px; margin-left: 4px; padding: 0 6px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); font-size: 11.5px; text-align: center; }

/* ---------- timeline / feed ---------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.feed li:last-child { border-bottom: 0; }
.feed .when { color: var(--muted); font-size: 12px; }
.feed .kind { font-family: var(--mono); font-size: 11.5px; color: var(--accent-2); }

/* ---------- misc ---------- */
.bar { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 90px; }
.bars span { flex: 1; background: var(--accent); opacity: .85; border-radius: 3px 3px 0 0; min-height: 2px; }
.quote { border-left: 3px solid var(--border-strong); padding: 2px 0 2px 12px; color: var(--text-2); font-style: italic; margin: 6px 0; }
.pager { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; margin-top: 14px; }
.prose { max-width: 760px; }
.prose p { margin-bottom: 1em; }
.preview-body { white-space: pre-wrap; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; font-size: 13.5px; }
details summary { cursor: pointer; color: var(--text-2); }
details.card > summary { padding-block: 2px; }
details.card[open] > summary { padding-bottom: 14px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
[hidden] { display: none !important; }
.thumb { width: 96px; height: 54px; object-fit: cover; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--border); display: block; }
video { max-width: 100%; border-radius: var(--radius-sm); background: #000; }
.lede { font-size: 15px; color: var(--text-2); }

/* ---------- accessibility ---------- */
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 50; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: var(--radius-sm); font-weight: 600; }
.skip-link:focus { top: 12px; text-decoration: none; }
a:focus-visible, button:focus-visible, summary:focus-visible, .btn:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.content:focus { outline: none; }
.btn[aria-busy="true"] { opacity: .7; cursor: progress; }
.flash { position: relative; overflow-wrap: anywhere; }
.flash:has(.flash-dismiss) { padding-right: 90px; min-height: 44px; }
.flash-dismiss { position: absolute; right: 8px; top: 2px; min-height: 40px; padding: 6px 8px; border: 0; background: transparent; color: inherit; font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.copy-feedback { display: inline-block; max-width: 100%; overflow-wrap: anywhere; margin-inline: 6px; }

/* ---------- setup wizard & help ---------- */
.wizard .steps a { color: var(--text); }
.wizard .steps a[aria-current="step"] strong { color: var(--accent); }
.wizard ul { padding-left: 18px; margin: 6px 0 0; }
.wizard ul li { margin-bottom: 4px; }
.glossary { grid-template-columns: 150px 1fr; gap: 10px 18px; }
.glossary dt { font-weight: 650; color: var(--text); }
@media (max-width: 820px) { .glossary { grid-template-columns: 1fr; } .glossary dd { margin-bottom: 8px; } }

/* ---------- navigation extras ---------- */
.nav-advanced { margin-top: 6px; }
.nav-advanced > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.nav-advanced > summary::-webkit-details-marker { display: none; }
.nav-advanced > summary::after { content: '\25B8'; font-size: 10px; }
.nav-advanced[open] > summary::after { content: '\25BE'; }
.nav-item-sm { font-size: 13.5px; padding: 6px 10px; }
.nav-item-sm .ico { width: 16px; height: 16px; }
.product-switch { display: flex; align-items: center; gap: 10px; max-width: 100%; min-width: 0; }
.product-label { color: var(--muted); font-size: 12px; font-weight: 500; }
.product-switch select { width: auto; min-width: 0; max-width: 300px; font-weight: 600; background: var(--surface); }
.product-chip { display: flex; align-items: center; gap: 10px; min-width: 0; max-width: min(100%, 380px); overflow-wrap: anywhere; font-weight: 600; color: var(--text); padding: 6px 0; font-size: 13.5px; }
.product-chip:hover { text-decoration: none; border-color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- friendly components ---------- */
.callout { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); margin-bottom: 16px; }
.callout-info { border-color: color-mix(in srgb, var(--info) 45%, var(--border)); background: var(--info-bg); color: var(--text); }
.callout-warn { border-color: color-mix(in srgb, var(--warn) 50%, var(--border)); background: var(--warn-bg); color: var(--text); }
.callout-good { border-color: color-mix(in srgb, var(--good) 50%, var(--border)); background: var(--good-bg); color: var(--text); }
.callout-bad { border-color: color-mix(in srgb, var(--bad) 50%, var(--border)); background: var(--bad-bg); color: var(--text); }

/* Clean list rows: prefer these over wide tables for simple lists */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .li-main { min-width: 0; flex: 1; }
.list-item .li-title { font-weight: 600; color: var(--text); }
.list-item .li-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.list-item .li-side { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; min-width: 0; max-width: 100%; }
.card-flush .list-item { padding-left: 22px; padding-right: 22px; }

/* Connection cards (Connections hub) */
.connect-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 16px; }
.connect-card { display: flex; flex-direction: column; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; color: var(--text); }
a.connect-card:hover { text-decoration: none; border-color: var(--accent); }
.connect-card .cc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.connect-card .cc-name { font-weight: 650; font-size: 15.5px; }
.connect-card .cc-desc { color: var(--muted); font-size: 13.5px; flex: 1; }
.connect-card .cc-foot { font-size: 13px; color: var(--accent); }

/* Numbered steps (setup guides, "how to fix") */
.steps { counter-reset: step; list-style: none; margin: 0; padding: 0; }
.steps > li { counter-increment: step; position: relative; padding: 0 0 16px 40px; }
.steps > li::before { content: counter(step); position: absolute; left: 0; top: -1px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--accent); }
.steps > li.done::before { content: '\2713'; color: var(--good); border-color: var(--good); }

/* Section headings inside pages */
.section-title { font-size: 16px; font-weight: 650; letter-spacing: -.01em; color: var(--text); margin: 30px 0 14px; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-head { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 0 6px; }
.cal-day { min-height: 110px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; font-size: 12.5px; }
.cal-day.today { border-color: var(--accent); }
.cal-day.other { opacity: .45; }
.cal-num { font-weight: 700; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.cal-item { display: block; padding: 3px 6px; border-radius: 5px; margin-top: 3px; background: var(--surface-2); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-item.good { background: var(--good-bg); }
.cal-item.warn { background: var(--warn-bg); }
.cal-item.info { background: var(--info-bg); }

/* ---------- responsive ---------- */
/* Dashboard: one next step, a few useful shortcuts, then progressively deeper reports. */
.dashboard-focus { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr); gap: 32px; padding: 28px; margin-bottom: 20px; background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 8%, var(--surface)), var(--surface) 70%); border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border)); border-radius: 16px; }
.focus-main { align-self: center; min-width: 0; }
.eyebrow { display: flex; align-items: center; gap: 8px; color: var(--accent); font-size: 12px; font-weight: 650; letter-spacing: .045em; margin-bottom: 14px; }
.eyebrow .ico { width: 16px; height: 16px; }
.focus-main h2 { font-size: clamp(22px, 2vw, 28px); letter-spacing: -.025em; margin-bottom: 10px; }
.focus-main p { color: var(--text-2); max-width: 52ch; margin-bottom: 20px; }
.focus-links { display: flex; flex-direction: column; justify-content: center; border-left: 1px solid var(--border); padding-left: 28px; }
.focus-links a { display: flex; align-items: center; gap: 12px; padding: 14px 10px; border-radius: var(--radius-sm); color: var(--text); }
.focus-links a:hover { background: var(--surface-2); text-decoration: none; }
.focus-links a > .ico { color: var(--accent); }
.focus-links a > span:first-of-type { flex: 1; min-width: 0; }
.focus-links strong { display: block; font-size: 14px; font-weight: 650; }
.focus-links small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.focus-links a > span:last-child { color: var(--muted); }
.setup-checklist { padding: 16px 22px; }
.setup-checklist > summary { position: relative; padding-right: 110px; }
.setup-hint { position: absolute; right: 0; top: 3px; color: var(--accent); font-size: 12px; }
.setup-checklist[open] .setup-hint { display: none; }
.setup-progress { display: block; width: 100%; height: 6px; border: 0; border-radius: 99px; overflow: hidden; margin: 18px 0 22px; appearance: none; background: var(--surface-2); color: var(--accent); }
.setup-progress::-webkit-progress-bar { background: var(--surface-2); }
.setup-progress::-webkit-progress-value { background: var(--accent); }
.setup-progress::-moz-progress-bar { background: var(--accent); }
.overview-sections { display: flex; flex-wrap: wrap; gap: 6px 20px; border-bottom: 1px solid var(--border); margin-top: 24px; padding-bottom: 10px; }
.overview-sections a { padding: 6px 0; font-size: 13px; font-weight: 600; color: var(--text-2); }
.overview-sections a:hover { color: var(--accent); }
.section-heading { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px 16px; margin: 28px 0 14px; scroll-margin-top: 100px; }
.section-heading .section-title { margin: 0; }
.section-heading > a { font-size: 13px; }
.section-period { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 10px; }
.dashboard-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 14px; }
.dashboard-kpis .stat { box-shadow: none; padding: 20px; }
.dashboard-kpis .stat-sub { line-height: 1.6; }
.needs-panel .empty { padding: 20px; text-align: left; }
.needs-panel .empty p { max-width: none; margin: 4px 0 0; }
.needs-panel .empty-icon { display: none; }
.workspace-details { scroll-margin-top: 100px; }
.nav-search-tip { display: block; font-size: 10.5px; margin: 6px 2px 0; color: var(--muted); }
kbd { font: inherit; padding: 1px 4px; border: 1px solid var(--border-strong); border-radius: 4px; }
.display-controls { display: flex; flex-wrap: wrap; gap: 8px 16px; border-bottom: 1px solid var(--border); padding-bottom: 10px; margin-bottom: 10px; }
.display-controls button { font-size: 12px; min-height: 28px; }
.display-controls [aria-pressed="true"] { color: var(--text); font-weight: 650; text-decoration: underline; text-underline-offset: 4px; }

/* Density is based on available width, never device identity. */
@media (min-width: 821px) {
  :root[data-density="compact"] .content { padding-top: 22px; }
  :root[data-density="compact"] .page-head { margin-bottom: 18px; }
  :root[data-density="compact"] .card:not(.card-flush) { padding: 14px 18px; }
  :root[data-density="compact"] .list-item { padding-top: 9px; padding-bottom: 9px; }
  :root[data-density="compact"] .table td { padding-top: 8px; padding-bottom: 8px; }
  :root[data-density="compact"] .nav-item { padding-block: 6px; margin-block: 0; }
  :root[data-density="compact"] .dashboard-focus { padding: 20px 24px; }
  :root[data-density="compact"] .focus-links a { padding-block: 9px; }
  :root[data-density="compact"] .section-heading { margin-top: 20px; }
  :root[data-density="compact"] .stat-value { font-size: 28px; margin-block: 2px; }
}

@media (max-width: 1100px) {
  .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; }
  .dashboard-focus { grid-template-columns: 1fr; }
  .focus-links { border-left: 0; border-top: 1px solid var(--border); padding: 12px 0 0; }
}
@media (max-width: 820px) {
  .dashboard-focus { grid-template-columns: 1fr; padding: 22px; gap: 20px; }
  .focus-links { border-left: 0; border-top: 1px solid var(--border); padding: 12px 0 0; }
  .dashboard-kpis { grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
  .setup-checklist > summary { padding-right: 0; }
  .setup-hint, .nav-search-tip { display: none; }
  .display-controls [data-density-toggle] { display: none; } /* compact view only applies on wider screens */
  .display-controls button { min-height: 44px; }
  .cal { grid-template-columns: 1fr; }
  .cal-head { display: none; }
  .cal-day { min-height: 0; }
  .content .cal-week .cal-day { min-height: 0; }
  .list-item { flex-direction: column; }
  .list-item .li-side { justify-content: flex-start; }
  .shell { display: flex; flex-direction: column; }
  .main { display: contents; }
  .sidebar { display: none; position: static; width: 100%; height: auto; order: 2; border-right: 0; border-bottom: 1px solid var(--border); }
  .nav-toggle:checked ~ .shell .sidebar { display: flex; }
  .nav { flex: auto; overflow: visible; }
  .nav-item { min-height: 44px; }
  .nav-toggle { display: block; position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
  .nav-toggle:focus-visible ~ .shell .nav-burger { outline: 2px solid var(--accent); outline-offset: 3px; }
  .nav-burger { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
  .nav-toggle:checked ~ .shell .nav-burger { background: var(--surface-2); color: var(--accent); }
  .content { padding: 16px 16px 48px; }
  .topbar { padding: 10px 16px; position: static; order: 1; }
  .banner { order: 3; }
  .content { order: 4; }
  .topbar-status { flex-basis: 100%; order: 3; }
  .kill-form { margin-left: auto; }
  .product-chip, .product-switch { flex: 1 1 160px; }
  .product-switch select { width: 100%; }
  .card { padding: 18px; }
  .card-flush { padding: 0; }
  .filters input, .filters select { min-width: 0; width: 100%; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .kv dd { margin-bottom: 10px; }
  .btn { min-height: 44px; }
  input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=date], input[type=datetime-local], input[type=search], select, textarea { font-size: 16px; }
  .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: 1fr; }
  .feed li { grid-template-columns: 1fr; gap: 2px; }
}
/* Respond to the workspace itself: a sidebar or a nested card reduces usable space.
   Viewport rules above remain a fallback for engines without container queries. */
@container workspace (max-width: 960px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .dashboard-focus { grid-template-columns: 1fr; }
  .focus-links { border-left: 0; border-top: 1px solid var(--border); padding: 12px 0 0; }
  .cal { grid-template-columns: 1fr; }
  .cal-head { display: none; }
  .cal-day { min-height: 0; }
  .content .cal-week .cal-day { min-height: 0; }
}
@container workspace (max-width: 600px) {
  .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: 1fr; }
  .list-item { flex-direction: column; }
  .list-item .li-side { justify-content: flex-start; }
  .feed li { grid-template-columns: 1fr; gap: 2px; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .kv dd { margin-bottom: 10px; }
  .setup-checklist > summary { padding-right: 0; }
  .setup-hint { display: none; }
}
/* Module grids share the same width-safe minimum, without changing module behavior.
   Scope supplies precedence over module-local style blocks. */
.content .ideas-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.content .cm-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.content .media-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); }
.content .pick-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 130px), 1fr)); }
.content .ideas-grid > *, .content .cm-grid > *, .content .media-grid > *, .content .pick-grid > * { min-width: 0; }
@media (max-width: 820px) {
  .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .content { padding-inline: 12px; }
  .topbar { padding-inline: 12px; gap: 8px; }
  .card:not(.card-flush), .dashboard-focus, .connect-card { padding: 16px; }
  .card-flush .list-item { padding-inline: 16px; }
  .page-actions { width: 100%; }
  .page-actions > .btn { flex: 1 1 auto; }
  .badge, .nowrap { white-space: normal; }
  .table th, .table td { padding-inline: 6px; }
}
/* Short viewports need the entire navigation to scroll, including its footer. */
@media (min-width: 821px) and (max-height: 600px) {
  .sidebar .nav { flex: 1 0 auto; overflow: visible; }
  .topbar { position: static; }
}
@supports (height: 100dvh) {
  @media (min-width: 821px) { .sidebar { height: 100dvh; } }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
