/* Spondesk Lite v3. Calm and quiet: neutral surfaces, one brass accent for the main action, readable type (15 px
   body), an 8 px spacing scale, soft dark mode (no pure black, no pure white, no glow). No build step. */

:root {
  --bg: #F7F7F5;
  --surface: #FFFFFF;
  --surface-2: #F3F3F1;
  --surface-3: #EAEAE7;
  --hover: rgba(24, 26, 30, .04);
  --fg: #1F2126;
  --fg-2: #3E424A;
  --muted: #62666F;
  --faint: #868A92;
  --border: #E6E6E2;
  --border-2: #D9D9D4;
  --input: #D4D4CF;
  --primary: #A06A1D;
  --primary-hover: #8C5C18;
  --primary-fg: #FFFFFF;
  --primary-soft: rgba(160, 106, 29, .09);
  --primary-text: #87581A;
  --ring: rgba(160, 106, 29, .45);
  --good: #2E7A58;
  --good-soft: rgba(46, 122, 88, .09);
  --info: #3E424A;
  --info-soft: rgba(62, 66, 74, .07);
  --warn: #9A5A17;
  --warn-soft: rgba(154, 90, 23, .09);
  --bad: #AE3B32;
  --bad-soft: rgba(174, 59, 50, .08);
  --neutral-soft: rgba(62, 66, 74, .07);
  --chart: #B98A4A;
  --chart-now: rgba(185, 138, 74, .4);
  --chart-grid: #ECECE8;
  --spark: #8A8E96;
  --p-verified: #2E7A58;
  --p-creator: #4B6A9B;
  --p-provider: #3F7C77;
  --p-observed: #6E6A92;
  --p-estimated: #8C5E78;
  --p-inferred: #6F7580;
  --kind-channel: #1F2126;
  --kind-cluster: #5B7BA6;
  --kind-topic: #4F8C7E;
  --kind-entity: #8A6FA6;
  --kind-video: #B98A4A;
  --shadow: 0 8px 28px rgba(24, 26, 30, .08), 0 1px 2px rgba(24, 26, 30, .04);
  --shadow-sm: 0 1px 2px rgba(24, 26, 30, .05);
  --r-sm: 6px;
  --r: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --side: 224px;
  --font: "Inter", "IBM Plex Sans Arabic", ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Noto Sans Arabic", sans-serif;
  --font-ar: "IBM Plex Sans Arabic", "Inter", ui-sans-serif, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

/* Dark: soft charcoal, off-white text, muted accent. Chosen in the sidebar (cookie), else follows the system. */
:root[data-theme="dark"] {
  --bg: #17191D; --surface: #1D2025; --surface-2: #22252B; --surface-3: #2A2E35; --hover: rgba(227, 229, 232, .04);
  --fg: #E3E5E8; --fg-2: #C3C7CE; --muted: #9DA2AB; --faint: #7B8089; --border: #2B2F36; --border-2: #363B43;
  --input: #3B4048; --primary: #CFA15A; --primary-hover: #D9AE6B; --primary-fg: #1B1609;
  --primary-soft: rgba(207, 161, 90, .11); --primary-text: #D6AC6A; --ring: rgba(207, 161, 90, .45);
  --good: #7DBE9E; --good-soft: rgba(125, 190, 158, .1); --info: #C3C7CE; --info-soft: rgba(195, 199, 206, .07);
  --warn: #D6A46C; --warn-soft: rgba(214, 164, 108, .1); --bad: #DE8A82; --bad-soft: rgba(222, 138, 130, .1);
  --neutral-soft: rgba(195, 199, 206, .07); --chart: #B99160; --chart-now: rgba(185, 145, 96, .4);
  --chart-grid: #2A2E35; --spark: #7B8089; --p-verified: #7DBE9E; --p-creator: #8FA7CC; --p-provider: #82B5AF;
  --p-observed: #A8A3C8; --p-estimated: #C79BB3; --p-inferred: #9AA0AA; --kind-channel: #E3E5E8;
  --kind-cluster: #7F9BC2; --kind-topic: #74AE9F; --kind-entity: #AB93C4; --kind-video: #B99160;
  --shadow: 0 10px 30px rgba(0, 0, 0, .3); --shadow-sm: 0 1px 2px rgba(0, 0, 0, .2);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17191D; --surface: #1D2025; --surface-2: #22252B; --surface-3: #2A2E35; --hover: rgba(227, 229, 232, .04);
    --fg: #E3E5E8; --fg-2: #C3C7CE; --muted: #9DA2AB; --faint: #7B8089; --border: #2B2F36; --border-2: #363B43;
    --input: #3B4048; --primary: #CFA15A; --primary-hover: #D9AE6B; --primary-fg: #1B1609;
    --primary-soft: rgba(207, 161, 90, .11); --primary-text: #D6AC6A; --ring: rgba(207, 161, 90, .45);
    --good: #7DBE9E; --good-soft: rgba(125, 190, 158, .1); --info: #C3C7CE; --info-soft: rgba(195, 199, 206, .07);
    --warn: #D6A46C; --warn-soft: rgba(214, 164, 108, .1); --bad: #DE8A82; --bad-soft: rgba(222, 138, 130, .1);
    --neutral-soft: rgba(195, 199, 206, .07); --chart: #B99160; --chart-now: rgba(185, 145, 96, .4);
    --chart-grid: #2A2E35; --spark: #7B8089; --p-verified: #7DBE9E; --p-creator: #8FA7CC; --p-provider: #82B5AF;
    --p-observed: #A8A3C8; --p-estimated: #C79BB3; --p-inferred: #9AA0AA; --kind-channel: #E3E5E8;
    --kind-cluster: #7F9BC2; --kind-topic: #74AE9F; --kind-entity: #AB93C4; --kind-video: #B99160;
    --shadow: 0 10px 30px rgba(0, 0, 0, .3); --shadow-sm: 0 1px 2px rgba(0, 0, 0, .2);
    color-scheme: dark;
  }
}

:root { --muted-fg: var(--muted); --card: var(--surface); }   /* names map.js reads */
.kind-toggle[aria-pressed="false"] { opacity: .45; background: transparent; color: var(--muted); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 15px; line-height: 1.55;
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
:dir(rtl) { font-family: var(--font-ar); }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--primary-text); }
p { margin: 0; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.011em; }
code { font-family: var(--mono); font-size: .86em; background: var(--surface-2); padding: 1px 6px; border-radius: 5px; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--primary-soft); }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--surface); padding: 8px 12px; border-radius: var(--r); }
.skip:focus { left: 8px; }
.i { flex: none; vertical-align: -3px; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
[hidden] { display: none !important; }
.num, .n, .tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--muted); }
.small { font-size: 14px; }
.xs { font-size: 13px; }
.nowrap { white-space: nowrap; }
.trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack > * + * { margin-top: 16px; }
.mt { margin-top: 16px; }
.mt-lg { margin-top: 32px; }

/* ---------------------------------------------------------------- shell */

.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 8px;
  background: var(--bg); border-right: 1px solid var(--border); padding: 16px 12px; overflow-y: auto;
}
.side-top { display: flex; align-items: center; gap: 8px; padding: 4px 8px 16px; }
.brand { display: inline-flex; align-items: center; gap: 8px; }
.brand img { display: block; height: 16px; width: auto; }
.brand-lite { font-size: 12px; font-weight: 500; color: var(--muted); }
.brand img.wm-dark { display: none; }
:root[data-theme="dark"] .brand img.wm-dark { display: block; }
:root[data-theme="dark"] .brand img.wm-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand img.wm-dark { display: block; }
  :root:not([data-theme="light"]) .brand img.wm-light { display: none; }
}
.navt, .side-top .navt-btn { display: none; }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; }
.nav-a {
  display: flex; align-items: center; gap: 12px; height: 36px; padding: 0 12px; border-radius: 8px; color: var(--fg-2);
  font-weight: 500; font-size: 14.5px;
}
.nav-a .i { color: var(--muted); }
.nav-a:hover { color: var(--fg); background: var(--hover); }
.nav-a[aria-current="page"] { color: var(--fg); background: var(--surface-3); }
.nav-a[aria-current="page"] .i { color: var(--fg); }
.nav-badge {
  margin-left: auto; font-size: 12px; font-weight: 600; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center; background: var(--primary-soft); color: var(--primary-text);
  font-variant-numeric: tabular-nums;
}
.nav-badge.due { background: var(--primary-soft); color: var(--primary-text); }
.side-foot { padding: 12px 4px 0; display: flex; flex-direction: column; gap: 8px; }
.me { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; min-width: 0; }
.me:hover { background: var(--hover); color: var(--fg); }
.me .logo { width: 32px; height: 32px; }
.me-t { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.me-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-sub { font-size: 13px; color: var(--muted); }
.side-actions { display: flex; align-items: center; gap: 4px; padding: 0 4px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px;
  background: transparent; border: 0; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--hover); color: var(--fg); }
.theme-dark-i { display: none; }
:root[data-theme="dark"] .theme-light-i { display: none; }
:root[data-theme="dark"] .theme-dark-i { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-light-i { display: none; }
  :root:not([data-theme="light"]) .theme-dark-i { display: inline; }
}
.run-pill {
  display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--fg-2); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; line-height: 1.3;
}
.run-pill.done { color: var(--good); }

.main { min-width: 0; }
.page { max-width: 1120px; margin: 0 auto; padding: 40px 40px 64px; }
.page-narrow { max-width: 880px; }
.demo-banner {
  display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--warn); background: var(--warn-soft);
  padding: 8px 40px; border-bottom: 1px solid var(--border);
}

/* ---------------------------------------------------------------- page header */

.ph { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 32px; flex-wrap: wrap; }
.ph h1 { font-size: 26px; line-height: 1.25; letter-spacing: -.02em; }
.ph .sub { color: var(--muted); font-size: 15px; margin-top: 8px; max-width: 640px; }
.ph-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 16px; display: flex; gap: 6px; align-items: center; }
.crumbs a:hover { color: var(--fg); }
.subnav { display: flex; gap: 4px; margin: -16px 0 32px; border-bottom: 1px solid var(--border); }

/* ---------------------------------------------------------------- cards, sections */

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 24px;
  min-width: 0;
}
.card.flush { padding: 0; }
.card.flush > .card-h { padding: 20px 24px 12px; margin: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; min-width: 0; }
.card-h h2 { font-size: 16px; }
.card-sub { color: var(--muted); font-size: 14px; margin-top: -8px; margin-bottom: 16px; }
.sec { margin-top: 40px; }
.sec-h { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.sec-h h2 { font-size: 17px; }
.sec-h p { color: var(--muted); font-size: 14px; margin-top: 4px; }
.label { font-size: 13px; font-weight: 600; color: var(--muted); }
.link-more { font-size: 14px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.link-more:hover { color: var(--primary-text); }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; gap: 24px; }
.g-main-wide { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; gap: 24px; }
.span-all { grid-column: 1 / -1; }
.divider { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }

/* numbers in a quiet row: at most four, no boxes around each */
.kpis { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 24px; }
.kpis.hero-kpis, .kpis.board-kpis { --cols: 4; }
.kpi { min-width: 0; }
.kpi .v {
  font-size: 22px; line-height: 1.2; font-weight: 600; letter-spacing: -.015em;
  font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kpi .v.sm { font-size: 18px; }
.kpi .v .unit { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.kpi .l { font-size: 14px; color: var(--muted); margin-top: 4px; }
.kpi .d { font-size: 13px; color: var(--muted); margin-top: 2px; }
.kpi a.v:hover { color: var(--primary-text); }
.kpi .v.accent { color: var(--primary-text); }
.board-kpis { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border); }

/* ---------------------------------------------------------------- buttons, inputs */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: 8px; border: 1px solid var(--border-2); background: var(--surface); color: var(--fg);
  font-weight: 500; font-size: 14px; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--surface-2); color: var(--fg); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--primary-fg); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--hover); color: var(--fg); border-color: transparent; }
.btn-danger { color: var(--bad); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 14px; }
.btn-xs { height: 28px; padding: 0 10px; font-size: 13px; border-radius: 7px; gap: 6px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn.on { color: var(--fg); border-color: var(--border-2); background: var(--surface-3); }
.inline { display: inline; margin: 0; }
.inline-flex { display: inline-flex; margin: 0; gap: 8px; align-items: center; }

.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field > label, .field > .flabel { font-size: 14px; font-weight: 500; color: var(--fg-2); }
.field .hint { font-size: 13px; color: var(--muted); }
.input, .field input[type="text"], .field input[type="password"], .field input[type="date"], .field input[type="number"],
.field input[type="url"], .field select, .field textarea, select.input, textarea.input {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--input);
  background: var(--surface); color: var(--fg); font-size: 14.5px; transition: border-color .12s, box-shadow .12s;
}
.field textarea, textarea.input { height: auto; min-height: 96px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
select { cursor: pointer; }
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon > .i { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.input-icon > input { padding-left: 38px !important; }
.kbd {
  font-family: var(--mono); font-size: 12px; color: var(--muted); border: 1px solid var(--border-2);
  border-radius: 4px; padding: 0 6px; line-height: 18px;
}
.input-icon .kbd { position: absolute; right: 10px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; color: var(--fg-2); }
.check input { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; }

/* ---------------------------------------------------------------- pills, badges, chips (few, quiet) */

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 13px; font-weight: 500; white-space: nowrap; background: var(--neutral-soft); color: var(--fg-2);
  line-height: 1;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tone-good { background: var(--good-soft); color: var(--good); }
.tone-info { background: var(--neutral-soft); color: var(--fg-2); }
.tone-warn { background: var(--warn-soft); color: var(--warn); }
.tone-bad { background: var(--bad-soft); color: var(--bad); }
.tone-muted { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--border-2); }
.tone-neutral { background: var(--neutral-soft); color: var(--fg-2); }
.tone-brand { background: var(--primary-soft); color: var(--primary-text); }
.state-new, .state-active, .state-cooling { background: var(--neutral-soft); color: var(--fg-2); }
.state-dormant { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--border-2); }

.fit { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fit-n { font-weight: 600; font-size: 14.5px; color: var(--fg); min-width: 22px; }
.fit-l { font-size: 14px; color: var(--muted); }
.fit-perfect .fit-n, .fit-good .fit-n { color: var(--fg); }
.fit-fair .fit-n, .fit-weak .fit-n { color: var(--muted); font-weight: 500; }
.fit-badge { display: inline-flex; align-items: baseline; gap: 6px; font-size: 14px; color: var(--muted); white-space: nowrap; }
.fit-badge b { font-size: 15px; color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--border-2); color: var(--fg-2); font-size: 14px; font-weight: 500; white-space: nowrap;
  background: transparent;
}
.chip:hover { color: var(--fg); background: var(--hover); }
.chip.on { background: var(--surface-3); border-color: var(--surface-3); color: var(--fg); }
.chip .x { margin-left: 2px; opacity: .7; }
.tag {
  display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 6px; font-size: 13px;
  background: var(--surface-2); color: var(--fg-2); white-space: nowrap; max-width: 220px; overflow: hidden;
  text-overflow: ellipsis;
}
.tag.lang { font-weight: 600; }
a.tag:hover { color: var(--primary-text); }

/* tooltips from data-tip (hover and keyboard focus) */
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
  z-index: 40; width: max-content; max-width: 300px; white-space: pre-line; text-align: left;
  background: var(--fg); color: var(--bg); font-size: 13px; font-weight: 400; line-height: 1.45; padding: 8px 12px;
  border-radius: 8px; box-shadow: var(--shadow); pointer-events: none; letter-spacing: 0; text-transform: none;
}
[data-tip].tip-left:hover::after, [data-tip].tip-left:focus-visible::after { left: 0; transform: none; }
[data-tip].tip-right:hover::after, [data-tip].tip-right:focus-visible::after { left: auto; right: 0; transform: none; }
[data-tip].tip-below:hover::after, [data-tip].tip-below:focus-visible::after { bottom: auto; top: calc(100% + 8px); }
.prov { display: inline-flex; margin-left: 6px; vertical-align: -2px; cursor: help; color: var(--muted); }

/* ---------------------------------------------------------------- logos, avatars */

.logo {
  --h: 30; position: relative; flex: none; width: 32px; height: 32px; border-radius: 8px; overflow: hidden;
  background: hsl(var(--h) 18% 92%); color: hsl(var(--h) 20% 34%); display: inline-flex; align-items: center;
  justify-content: center; font-size: 12px; font-weight: 600; letter-spacing: .01em; box-shadow: inset 0 0 0 1px var(--border);
}
:root[data-theme="dark"] .logo { background: hsl(var(--h) 10% 25%); color: hsl(var(--h) 16% 80%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo { background: hsl(var(--h) 10% 25%); color: hsl(var(--h) 16% 80%); } }
.logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; padding: 4px; }
.logo.lg { width: 56px; height: 56px; border-radius: 12px; font-size: 18px; }
.logo.lg img { padding: 8px; }
.logo.sm { width: 24px; height: 24px; border-radius: 6px; font-size: 10px; }
.logo.sm img { padding: 2px; }
.avatar { border-radius: 50%; }
.avatar img { padding: 0; object-fit: cover; background: var(--surface-3); }
.logo-stack { display: inline-flex; }
.logo-stack .logo { box-shadow: 0 0 0 2px var(--surface); }
.logo-stack .logo + .logo { margin-left: -6px; }

.ent { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ent-t { min-width: 0; display: flex; flex-direction: column; }
.ent-name { font-weight: 600; font-size: 14.5px; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ent-sub { font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.ent:hover .ent-name { color: var(--primary-text); }

/* ---------------------------------------------------------------- tables */

table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14.5px; }
.t th {
  position: sticky; top: 0; z-index: 2; background: var(--surface); text-align: left; font-weight: 500; font-size: 13.5px;
  color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.t th a { display: inline-flex; align-items: center; gap: 4px; color: inherit; }
.t th a:hover, .t th a.on { color: var(--fg); }
.t td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.t tbody tr:last-child td { border-bottom: 0; }
.t tbody tr:hover { background: var(--hover); }
.t .n, .t th.n { text-align: right; font-variant-numeric: tabular-nums; }
.t td.n { color: var(--fg-2); }
.t td:first-child, .t th:first-child { padding-left: 24px; }
.t td:last-child, .t th:last-child { padding-right: 24px; }
.t .rank { color: var(--muted); width: 34px; font-size: 13px; }
.t .sub-line { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; }
.t .zero { color: var(--muted); }
.t-compact td { padding-top: 10px; padding-bottom: 10px; }
.t .cb { width: 40px; }
.brand-col { min-width: 200px; max-width: 300px; }
.t-scroll { overflow-x: auto; position: relative; }
.col, .card { position: relative; }

/* charts */
.spark { display: block; overflow: visible; }
.spark-line { fill: none; stroke: var(--spark); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.spark-area { fill: var(--spark); opacity: .08; stroke: none; }
.spark-dot { fill: var(--spark); }
.spark-empty .spark-line { stroke: var(--border-2); } .spark-empty .spark-dot { fill: var(--border-2); } .spark-empty .spark-area { opacity: 0; }
.trend { display: flex; align-items: center; gap: 8px; }
.chart { display: block; width: 100%; height: 170px; overflow: visible; }
.chart-grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart-axis, .chart-x { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart-bar { fill: var(--chart); }
.chart-bar:hover { opacity: .8; }
.chart-bar-now { fill: var(--chart-now); }
.chart-zero { fill: var(--border-2); }
.ring-track { fill: none; stroke: var(--surface-3); }
.ring-fill { fill: none; stroke: var(--chart); stroke-linecap: round; }

.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 112px minmax(0, 1fr) 72px; gap: 16px; align-items: center; font-size: 14px; }
.bar-row .bl { color: var(--fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .bv { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-track { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 3px; background: var(--chart); }
.bar-row.you .bl { color: var(--fg); font-weight: 600; }
.meter { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--chart); border-radius: 3px; }
.meter.warn > span { background: var(--warn); }
.mini-bar { display: inline-block; width: 48px; height: 5px; border-radius: 3px; background: var(--surface-3); vertical-align: middle; overflow: hidden; margin-left: 8px; }
.mini-bar > span { display: block; height: 100%; background: var(--chart); }

/* ---------------------------------------------------------------- tabs, segmented */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 12px; margin-bottom: -1px; font-size: 14.5px;
  font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--fg); }
.tab[aria-current="page"] { color: var(--fg); border-bottom-color: var(--fg); }
.tab .count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px; }
.seg a, .seg button {
  height: 30px; padding: 0 12px; border-radius: 6px; font-size: 14px; font-weight: 500; color: var(--muted);
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; cursor: pointer;
}
.seg a:hover { color: var(--fg); }
.seg .on { background: var(--surface); color: var(--fg); box-shadow: var(--shadow-sm); }
.seg .count { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- filters */

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.toolbar .search { flex: 1 1 280px; max-width: 420px; }
.toolbar .input { width: auto; }
.toolbar .search .input { width: 100%; }
.icon-btn.on { color: var(--primary-text); background: var(--primary-soft); }
.toolbar .spacer { flex: 1 1 auto; }
.filters {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px;
  padding: 20px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface);
}
.filters .field > label { font-size: 13px; color: var(--muted); font-weight: 500; }
.filters .field select, .filters .field input { height: 36px; font-size: 14px; }
.filters .checks { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 24px; }
.filters .quick { grid-column: 1 / -1; }
.filters .actions { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
details.fold > summary { list-style: none; cursor: pointer; }
details.fold > summary::-webkit-details-marker { display: none; }
.pop { position: relative; }
.pop > .filters {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: min(720px, calc(100vw - 32px));
  box-shadow: var(--shadow);
}
.results-meta { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 14px; color: var(--muted); margin: 0 4px 12px; flex-wrap: wrap; }
.results-meta strong { color: var(--fg); font-weight: 600; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 24px; border-top: 1px solid var(--border); font-size: 14px; color: var(--muted); }
.pager .btns { display: flex; gap: 8px; }
[data-swap].loading { opacity: .55; transition: opacity .15s; pointer-events: none; }

/* ---------------------------------------------------------------- lists */

.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.list > li:last-child { border-bottom: 0; }
.list .meta { margin-left: auto; text-align: right; font-size: 14px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.reasons { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.reasons li { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; color: var(--fg-2); line-height: 1.5; }
.reasons li .i { margin-top: 3px; color: var(--muted); }
.reasons li.con { color: var(--muted); }

.empty {
  border: 1px dashed var(--border-2); border-radius: var(--r-lg); padding: 40px 24px; text-align: center; color: var(--muted);
}
.empty h3 { font-size: 16px; color: var(--fg); margin-bottom: 8px; }
.empty p { max-width: 520px; margin: 0 auto; font-size: 14.5px; }
.empty .btn { margin-top: 16px; }
.empty .i-lg { color: var(--muted); margin-bottom: 12px; }
.card .empty { border: 0; padding: 24px 12px; }

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r); margin-bottom: 24px; font-size: 14.5px; border: 1px solid var(--border); background: var(--surface); }
.alert .i { margin-top: 3px; color: var(--muted); }
.alert-ok .i { color: var(--good); }
.alert-error { border-color: transparent; background: var(--bad-soft); }
.alert-error .i { color: var(--bad); }
.alert-warn .i { color: var(--warn); }
.alert span { color: var(--fg); }

/* skeletons and progress */
.skel { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: skel 1.4s ease-in-out infinite; border-radius: 6px; }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skel-line { height: 10px; margin: 6px 0; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--chart); border-radius: 3px; transition: width .5s ease; }
.progress.done > span { background: var(--good); }

/* ---------------------------------------------------------------- disclosure: details on demand */

details.more { border-top: 1px solid var(--border); }
details.more:last-of-type { border-bottom: 1px solid var(--border); }
details.more > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 16px 4px;
  font-size: 15px; font-weight: 500; color: var(--fg);
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary .i { color: var(--muted); transition: transform .15s; }
details.more[open] > summary .i { transform: rotate(90deg); }
details.more > summary .hint { margin-left: auto; font-size: 14px; font-weight: 400; color: var(--muted); }
details.more > summary:hover { color: var(--primary-text); }
details.more > .more-body { padding: 4px 4px 24px; }
.more-group { margin-top: 40px; }
.more-group > .label { display: block; margin-bottom: 8px; }

/* ---------------------------------------------------------------- Today */

.picks { display: flex; flex-direction: column; gap: 12px; }
.pick {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px 20px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px 24px;
}
.pick .logo { width: 44px; height: 44px; border-radius: 10px; }
.pick-name { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.pick-name a { font-size: 16px; font-weight: 600; }
.pick-why { color: var(--fg-2); font-size: 14.5px; margin-top: 4px; }
.pick-who { color: var(--muted); font-size: 14px; margin-top: 8px; display: flex; gap: 8px; align-items: center; min-width: 0; }
.pick-who .i { color: var(--muted); }
.pick-who a { color: var(--fg-2); text-decoration: underline; text-decoration-color: var(--border-2); text-underline-offset: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-who a:hover { color: var(--primary-text); }
.db-line { margin-top: 48px; font-size: 14px; color: var(--muted); display: flex; gap: 8px 16px; align-items: center; flex-wrap: wrap; }
.db-line .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--good); display: inline-block; }
.db-line a { text-decoration: underline; text-decoration-color: var(--border-2); text-underline-offset: 3px; }
.batch { margin-top: 16px; }
.batch > summary { list-style: none; cursor: pointer; font-size: 14px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.batch > summary::-webkit-details-marker { display: none; }
.batch > summary:hover { color: var(--fg); }
.batch-body { margin-top: 16px; }
.owner { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; }
.owner-id { display: flex; align-items: center; gap: 16px; min-width: 0; }
.owner-id .logo { width: 52px; height: 52px; border-radius: 50%; font-size: 17px; }
.owner-id h2 { font-size: 18px; }
.owner-meta { font-size: 14px; color: var(--muted); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px 0; }
.owner-meta > * + *::before { content: "\00B7"; margin: 0 8px; color: var(--muted); }
.owner-status { text-align: right; font-size: 14px; color: var(--muted); }
.owner-status .ok { color: var(--good); font-weight: 500; }
.scan { margin-top: 24px; }
.scan-top { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 8px; color: var(--fg-2); gap: 12px; }
.scan-top .st { color: var(--fg); font-weight: 600; white-space: nowrap; }
.scan-top .st.ok { color: var(--good); }
.scan-steps { display: flex; gap: 24px; font-size: 13.5px; color: var(--muted); margin-top: 12px; flex-wrap: wrap; }
.scan-steps .done { color: var(--good); }
.scan-steps .now { color: var(--fg); }
.detected { list-style: none; margin: 0; padding: 0; }
.detected li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.detected li:last-child { border-bottom: 0; }
.detected .st { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }
.feed-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.vcard { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.thumb { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: var(--surface-3); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .by {
  position: absolute; left: 8px; bottom: 8px; display: flex; align-items: center; gap: 6px; background: rgba(20, 22, 26, .78);
  color: #E9EAEC; font-size: 12.5px; padding: 3px 8px 3px 4px; border-radius: 7px; max-width: calc(100% - 16px);
}
.thumb .by .logo { width: 18px; height: 18px; border-radius: 4px; }
.thumb .ts { position: absolute; right: 6px; bottom: 6px; background: rgba(20, 22, 26, .78); color: #E9EAEC; font-size: 12px; padding: 1px 6px; border-radius: 4px; }
.vcard-t { font-size: 14.5px; font-weight: 500; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vcard-m { font-size: 13.5px; color: var(--muted); }
.check-col input { width: 16px; height: 16px; accent-color: var(--primary); }
.batch-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 24px; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* onboarding */
.onb { min-height: calc(100vh - 120px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 16px; }
.onb h1 { font-size: clamp(28px, 3.4vw, 40px); line-height: 1.15; letter-spacing: -.025em; max-width: 720px; }
.onb h1 em { font-style: normal; color: var(--primary-text); }
.onb .lede { color: var(--muted); font-size: 16px; max-width: 560px; margin: 16px auto 32px; }
.onb-form { display: flex; gap: 8px; width: 100%; max-width: 560px; }
.onb-form .input-icon { flex: 1; }
.onb-form input { height: 48px !important; font-size: 15px !important; border-radius: 10px !important; }
.onb-form .btn { height: 48px; border-radius: 10px; padding: 0 20px; font-size: 15px; }
.onb-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; max-width: 760px; margin-top: 40px; text-align: left; }
.onb-steps div { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px 20px; background: var(--surface); }
.onb-steps .label { display: block; margin-bottom: 8px; color: var(--fg); }
.onb-steps p { font-size: 14px; color: var(--muted); }
.onb-fresh { margin-top: 24px; font-size: 14px; color: var(--muted); }

/* ---------------------------------------------------------------- brand and channel pages */

.bh { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; margin-bottom: 40px; }
.bh-id { display: flex; gap: 16px; align-items: center; min-width: 0; }
.bh h1 { font-size: 26px; letter-spacing: -.02em; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bh .sub { color: var(--muted); font-size: 14.5px; margin-top: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; }
.bh .sub > * + *::before { content: "\00B7"; margin: 0 8px; color: var(--muted); }
.bh-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stage-form select { height: 36px; border-radius: 8px; border: 1px solid var(--border-2); background: var(--surface); padding: 0 32px 0 12px; font-size: 14px; font-weight: 500; }
.lead { font-size: 17px; line-height: 1.6; color: var(--fg); max-width: 720px; }
.lead-note { font-size: 14.5px; color: var(--muted); margin-top: 12px; max-width: 720px; }
.fitline { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; font-size: 14px; color: var(--muted); }
.who { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.who-main { font-size: 15.5px; font-weight: 500; }
.cta { margin-top: 40px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 24px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); }
.cta p { color: var(--muted); font-size: 14.5px; flex: 1 1 280px; }
.fitbox { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: start; }
.fitbox .score { position: relative; width: 64px; height: 64px; }
.fitbox .score .ring { position: absolute; inset: 0; }
.fitbox .score b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 19px; font-weight: 600; }
.fitbox h3 { font-size: 15px; margin-bottom: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.goodtime { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--good); }
.goodtime.no { color: var(--muted); }
.ev { display: grid; grid-template-columns: 176px minmax(0, 1fr); gap: 20px; padding: 20px 0; border-bottom: 1px solid var(--border); }
.ev:last-child { border-bottom: 0; }
.ev-title { font-weight: 600; font-size: 15px; line-height: 1.4; }
.ev-meta { font-size: 14px; color: var(--muted); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 2px 0; }
.ev-meta > * + *::before { content: "\00B7"; margin: 0 8px; color: var(--muted); }
.quote {
  margin: 12px 0 0; padding: 8px 14px; border-left: 2px solid var(--border-2); background: var(--surface-2);
  border-radius: 0 8px 8px 0; font-size: 14.5px; color: var(--fg-2); line-height: 1.55; overflow-wrap: anywhere;
}
.quote:dir(rtl) { border-left: 0; border-right: 2px solid var(--border-2); border-radius: 8px 0 0 8px; }
.ev-tags { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-top: 12px; align-items: center; font-size: 14px; color: var(--fg-2); }
.value { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--fg); white-space: nowrap; }
.value-sub { font-size: 13px; color: var(--muted); }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 24px; font-size: 14.5px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.person { padding: 16px 0; border-bottom: 1px solid var(--border); }
.person:last-child { border-bottom: 0; }
.person-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.person-name { font-weight: 600; }
.person-title { color: var(--muted); font-size: 14px; margin-top: 2px; }
.person-email { margin-top: 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14.5px; }
.person-meta { margin-top: 8px; display: flex; gap: 16px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }
.person-note { display: block; width: 100%; font-size: 13.5px; color: var(--muted); }
.ext { display: inline-flex; align-items: center; gap: 4px; color: var(--fg-2); text-decoration: underline; text-decoration-color: var(--border-2); text-underline-offset: 3px; }
.ext:hover { color: var(--primary-text); text-decoration-color: currentColor; }
.honest { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; color: var(--muted); background: var(--surface-2); border-radius: var(--r); padding: 12px 16px; }
.hide-row { display: flex; justify-content: flex-end; margin-top: 32px; }

/* pitch composer (styles for the pitch area; markup lives in _pitch.html) */
.composer { border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); }
.composer-row { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); font-size: 14.5px; align-items: center; }
.composer-row .k { color: var(--muted); font-size: 13.5px; }
.composer-body { padding: 20px; font-size: 15px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.composer-body:dir(rtl) { font-family: var(--font-ar); }
mark.fact { background: var(--primary-soft); color: inherit; border-radius: 4px; padding: 0 2px; box-shadow: inset 0 -1px 0 var(--ring); }
mark.flag { background: var(--bad-soft); color: var(--bad); border-radius: 4px; padding: 0 2px; font-weight: 600; }
.composer-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 16px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13.5px; color: var(--muted); align-items: center; }
.legend mark { font-size: 13px; }
.warnings { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.warnings li { display: flex; gap: 8px; font-size: 14px; color: var(--warn); }

/* ---------------------------------------------------------------- pipeline */

.board { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 16px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: var(--surface-2); border-radius: var(--r-lg); padding: 12px; min-height: 140px; }
.col-h { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 12px; font-size: 14px; font-weight: 600; }
.col-h .n { color: var(--muted); font-weight: 500; }
.col-h .dot { display: none; }
.pcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.pcard + .pcard { margin-top: 8px; }
.pcard:hover { border-color: var(--border-2); }
.pcard-m { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--muted); }
.pcard-f { display: flex; align-items: center; gap: 8px; }
.pcard-f select, .pcard-f input { flex: 1; height: 32px; font-size: 13.5px; border-radius: 7px; border: 1px solid var(--border-2); background: var(--surface); padding: 0 8px; min-width: 0; }
.pcard .note { font-size: 13.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard details > summary { list-style: none; cursor: pointer; font-size: 13px; color: var(--muted); }
.pcard details > summary::-webkit-details-marker { display: none; }
.pcard details > summary:hover { color: var(--fg); }
.pcard details[open] > summary { margin-bottom: 8px; }
.col-empty { font-size: 13.5px; color: var(--muted); padding: 20px 8px; text-align: center; }

/* ---------------------------------------------------------------- feed */

.feed { list-style: none; margin: 0; padding: 0; }
.feed > li { display: grid; grid-template-columns: 160px minmax(0, 1fr) auto; gap: 20px; padding: 20px 24px; border-bottom: 1px solid var(--border); align-items: start; }
.feed > li:last-child { border-bottom: 0; }
.feed .what { font-size: 15px; }
.feed .what b { font-weight: 600; }
.feed .when { font-size: 13.5px; color: var(--muted); white-space: nowrap; text-align: right; }

/* ---------------------------------------------------------------- media kit */

.kit { max-width: 960px; margin: 0 auto; }
.kit-head { display: flex; align-items: center; gap: 16px; }
.kit-head .logo { width: 64px; height: 64px; border-radius: 50%; font-size: 20px; }
.kit-head h1 { font-size: 26px; letter-spacing: -.02em; }
.kit-foot { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; color: var(--muted); padding-top: 16px; border-top: 1px solid var(--border); margin-top: 24px; flex-wrap: wrap; }
.rate-big { font-size: 26px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.public-page { min-height: 100vh; padding: 48px 20px; }

/* settings */
.settings section { scroll-margin-top: 24px; }
.settings section + section { margin-top: 16px; }
.settings .ext, .alert .ext { display: inline; word-break: break-all; }
.prov-list { list-style: none; margin: 0; padding: 0; }
.prov-list li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border); align-items: center; }
.prov-list li:last-child { border-bottom: 0; }
.cpm-table input { width: 72px !important; height: 34px !important; text-align: right; }
.switch { display: flex; gap: 12px; align-items: flex-start; }
.switch input { width: 36px; height: 20px; appearance: none; -webkit-appearance: none; background: var(--surface-3); border-radius: 10px; position: relative; cursor: pointer; flex: none; margin-top: 2px; box-shadow: inset 0 0 0 1px var(--border-2); transition: background .15s; }
.switch input::after { content: ""; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-sm); transition: transform .15s; }
.switch input:checked { background: var(--primary); box-shadow: none; }
.switch input:checked::after { transform: translateX(16px); }

/* system */
.stages { list-style: none; margin: 0; padding: 0; }
.stages li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--border); align-items: start; }
.stages li:last-child { border-bottom: 0; }
.stages .idx { width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat-line { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); margin-top: 4px; }
pre.log { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; font-family: var(--mono); font-size: 13px; line-height: 1.55; overflow: auto; max-height: 70vh; white-space: pre-wrap; overflow-wrap: anywhere; }

/* auth */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; gap: 24px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 32px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 20px; margin-bottom: 8px; }
.auth-card p { font-size: 14.5px; }
.auth-card form { margin-top: 24px; }

.footer { max-width: 1120px; margin: 0 auto; padding: 24px 40px 32px; font-size: 13px; color: var(--muted); display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; }
.footer a { text-decoration: underline; text-decoration-color: var(--border-2); text-underline-offset: 3px; }

/* map page */
.map-wrap { height: 560px; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface); position: relative; overflow: hidden; }
#graph { position: absolute; inset: 0; }
.map-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13.5px; color: var(--muted); margin-top: 12px; }
.map-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.k-channel { background: var(--kind-channel); } .k-cluster { background: var(--kind-cluster); } .k-topic { background: var(--kind-topic); }
.k-entity { background: var(--kind-entity); } .k-video { background: var(--kind-video); }

/* lookup (channel match) */
.mode { font-size: 13px; font-weight: 500; border-radius: 6px; padding: 2px 8px; background: var(--neutral-soft); color: var(--fg-2); }
.cats { list-style: none; margin: 0; padding: 0; counter-reset: c; }
.cats li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.cats li:last-child { border-bottom: 0; }
.cats .ix { width: 24px; height: 24px; border-radius: 6px; background: var(--surface-2); font-size: 12.5px; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.why { font-size: 14px; color: var(--muted); }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 1280px) {
  .c-xl { display: none; }
}
@media (max-width: 1100px) {
  .c-lg { display: none; }
  .g-main, .g-main-wide { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .shell { display: block; }
  .side { position: sticky; top: 0; z-index: 30; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 8px 16px; border-right: 0; border-bottom: 1px solid var(--border); gap: 0; overflow: visible; }
  .side-top { padding: 4px 0; flex: 1; }
  .side-top .navt-btn { display: inline-flex; }
  .side-nav, .side-foot { display: none; width: 100%; }
  .navt:checked ~ .side-nav { display: flex; padding: 8px 0 4px; }
  .navt:checked ~ .side-foot { display: flex; padding-bottom: 8px; }
  .page { padding: 24px 16px 48px; }
  .demo-banner { padding: 8px 16px; }
  .footer { padding: 16px; }
  .c-md { display: none; }
  .g-2, .g-3 { grid-template-columns: minmax(0, 1fr); }
  .feed-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ev { grid-template-columns: 136px minmax(0, 1fr); }
  .feed > li { grid-template-columns: 120px minmax(0, 1fr); }
  .feed .when { grid-column: 2; text-align: left; }
  .kpis { --cols: 2 !important; }
}
@media (max-width: 640px) {
  .ph { margin-bottom: 24px; }
  .ph h1, .bh h1 { font-size: 22px; }
  .kpi .v { font-size: 20px; }
  .feed-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .fit-l { display: none; }
  .owner { grid-template-columns: minmax(0, 1fr); }
  .owner-status { text-align: left; }
  .onb-form { flex-direction: column; }
  .onb-steps { grid-template-columns: minmax(0, 1fr); }
  .c-sm { display: none; }
  .t td:first-child, .t th:first-child { padding-left: 16px; }
  .t td:last-child, .t th:last-child { padding-right: 16px; }
  .t td, .t th { padding-left: 10px; padding-right: 10px; }
  .card { padding: 20px 16px; }
  .card.flush > .card-h { padding: 16px 16px 8px; }
  .ev { grid-template-columns: minmax(0, 1fr); }
  .ev .thumb { max-width: 280px; }
  .feed > li { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .feed .when { grid-column: auto; }
  .composer-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .bar-row { grid-template-columns: 92px minmax(0, 1fr) 56px; gap: 12px; }
  .prov-list li { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .pager { padding: 12px 16px; }
  .batch-bar { padding: 12px 16px; }
  .fitbox { grid-template-columns: minmax(0, 1fr); }
  .toolbar .search { max-width: none; flex-basis: 100%; }
  .pick { grid-template-columns: auto minmax(0, 1fr); padding: 16px; gap: 12px 16px; }
  .pick .pick-act { grid-column: 1 / -1; }
  .pick .pick-act .btn { width: 100%; }
  .bh { margin-bottom: 32px; }
  .bh-actions { width: 100%; }
  .cta .btn { width: 100%; }
  .subnav { margin-top: -8px; }
}

/* ---------------------------------------------------------------- print (media kit) */

@media print {
  :root, :root[data-theme="dark"] {
    --bg: #fff; --surface: #fff; --surface-2: #fff; --surface-3: #F1F1EE; --fg: #111; --fg-2: #333; --muted: #555;
    --faint: #666; --border: #e3e3de; --border-2: #d6d6d0; --primary: #A06A1D; --primary-text: #87581A; --chart: #B98A4A;
    color-scheme: light;
  }
  body { background: #fff; font-size: 12px; }
  .side, .footer, .no-print, .demo-banner, .alert, .ph-actions, .subnav { display: none !important; }
  .shell { display: block; }
  .page { padding: 0; max-width: none; }
  .card { break-inside: avoid; border-color: #e3e3de; }
  a { text-decoration: none; }
}

/* tables fit the page on desktop; let tooltips escape the scroll box there */
@media (min-width: 961px) {
  .t-scroll { overflow: visible; }
}
