/* Slate Hub. Brand neutrals for the chrome, the validated dataviz palette for
   series, status colours reserved for state. Light and dark both selected. */

:root {
  color-scheme: light;
  --paper: #F2F2F1; --fog: #DEDEDD; --ash: #B6B7B7; --slate: #6E7173; --graphite: #2E3032; --ink: #131517;
  --bg: #F4F4F3; --surface: #FFFFFF; --surface-2: #F7F7F6; --line: #E4E4E3; --line-strong: #CFCFCE;
  --text: #131517; --text-2: #4F5254; --text-3: #7A7D7F;
  --accent: #131517; --accent-ink: #F2F2F1;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300;
  --good: #0ca30c; --warn: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --grid: #ECECEB; --axis: #B6B7B7;
  --radius: 14px; --radius-sm: 9px;
  --serif: "Instrument Serif", Georgia, serif; --sans: "Schibsted Grotesk", system-ui, sans-serif; --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --shadow: 0 1px 2px rgba(19,21,23,.05), 0 8px 24px -16px rgba(19,21,23,.18);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #131517; --surface: #1C1E21; --surface-2: #232528; --line: #2E3032; --line-strong: #3C3F42;
    --text: #F2F2F1; --text-2: #C3C4C4; --text-3: #8E9193;
    --accent: #F2F2F1; --accent-ink: #131517;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300;
    --grid: #26282B; --axis: #4A4D50;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131517; --surface: #1C1E21; --surface-2: #232528; --line: #2E3032; --line-strong: #3C3F42;
  --text: #F2F2F1; --text-2: #C3C4C4; --text-3: #8E9193;
  --accent: #F2F2F1; --accent-ink: #131517;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300;
  --grid: #26282B; --axis: #4A4D50;
  --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font: inherit; color: inherit; }

/* ── Shell ─────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; border-right: 1px solid var(--line); background: var(--surface); padding: 22px 14px; display: flex; flex-direction: column; gap: 6px; }
.brand { display: flex; align-items: baseline; gap: 8px; padding: 0 10px 18px; }
.brand .mark img { display: block; height: 30px; width: auto; }
.login .brand .mark img { height: 44px; }
:root[data-theme="dark"] .brand .mark [data-light] { content: url("wordmark-white.png"); }
:root[data-theme="light"] .brand .mark [data-light] { content: url("wordmark-ink.png"); }
.login .note { margin: 0; font-size: 12.5px; color: var(--text-2); line-height: 1.5; }
.login .note code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.brand .hub { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.nav-group { font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); padding: 14px 10px 4px; }
.nav a { display: flex; align-items: center; justify-content: space-between; padding: 7px 10px; border-radius: var(--radius-sm); text-decoration: none; color: var(--text-2); }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent); color: var(--accent-ink); }
.nav .count { font-family: var(--mono); font-size: 11px; opacity: .7; }
.side .foot { margin-top: auto; padding: 14px 10px 0; font-size: 12px; color: var(--text-3); display: flex; flex-direction: column; gap: 6px; }
.side .foot button { background: none; border: 0; padding: 0; text-align: left; color: var(--text-3); cursor: pointer; }
.side .foot button:hover { color: var(--text); }

.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; padding: 16px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar h1 { font-family: var(--serif); font-weight: 400; font-size: 26px; margin: 0; letter-spacing: -.01em; }
.topbar .meta { color: var(--text-3); font-size: 12.5px; }
.topbar .spacer { flex: 1; }
.btn { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 7px 14px; cursor: pointer; font-size: 13px; }
.btn:hover { border-color: var(--text-3); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }

.page { padding: 24px 28px 60px; display: flex; flex-direction: column; gap: 22px; max-width: 1380px; }
.lead { font-family: var(--serif); font-size: 22px; line-height: 1.3; margin: 0; max-width: 820px; }
.lead .muted { color: var(--text-3); }
.lead code, .empty code { font-family: var(--mono); font-size: .72em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }

/* ── Grid and cards ───────────────────────────────────── */
.grid { display: grid; gap: 14px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.col-3 { grid-column: span 3; } .col-4 { grid-column: span 4; } .col-6 { grid-column: span 6; } .col-8 { grid-column: span 8; } .col-12 { grid-column: span 12; }
@media (max-width: 1100px) { .col-3 { grid-column: span 6; } .col-4 { grid-column: span 6; } .col-8 { grid-column: span 12; } }
@media (max-width: 760px) { .shell { grid-template-columns: 1fr; } .side { position: relative; height: auto; flex-direction: row; flex-wrap: wrap; } .col-3, .col-4, .col-6 { grid-column: span 12; } .page, .topbar { padding-left: 16px; padding-right: 16px; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.card h3 { margin: 0 0 10px; font-size: 13px; font-weight: 600; letter-spacing: .01em; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.card h3 .src { font-family: var(--mono); font-weight: 400; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); white-space: nowrap; }
.card p { margin: 6px 0; color: var(--text-2); }
.section-title { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); margin: 6px 0 -6px; }

/* ── Stat tiles ───────────────────────────────────────── */
.tile { display: flex; flex-direction: column; gap: 4px; }
.tile .label { font-size: 12.5px; color: var(--text-2); display: flex; justify-content: space-between; gap: 8px; }
.tile .label .src { font-family: var(--mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.tile .value { font-family: var(--serif); font-size: 34px; line-height: 1.05; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.tile .value.na { color: var(--text-3); font-size: 22px; font-family: var(--sans); }
.tile .delta { font-size: 12px; color: var(--text-3); display: flex; gap: 8px; align-items: center; }
.tile .delta b { font-weight: 600; color: var(--text-2); }
.tile .delta .up { color: var(--good); } .tile .delta .down { color: var(--critical); }
.tile .spark { margin-top: 6px; height: 34px; }

/* ── Charts ───────────────────────────────────────────── */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .axis-text { fill: var(--text-3); font-family: var(--mono); font-size: 10px; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { opacity: .08; }
.chart .dot { r: 3.5; stroke: var(--surface); stroke-width: 2; }
.chart .crosshair { stroke: var(--axis); stroke-width: 1; stroke-dasharray: 2 3; pointer-events: none; }
.chart .hit { fill: transparent; }
.tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 6px 9px; font-size: 12px; box-shadow: var(--shadow); white-space: nowrap; transform: translate(-50%, -110%); z-index: 3; }
.tip .d { font-family: var(--mono); font-size: 10.5px; color: var(--text-3); }
.tip .v { display: flex; gap: 6px; align-items: center; }
.tip .sw { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin: 4px 0 8px; }
.legend .sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; margin-right: 6px; vertical-align: -1px; }
.bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: minmax(80px, 150px) 1fr auto; gap: 10px; align-items: center; font-size: 12.5px; }
.bar-row .name { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .track { height: 10px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar-row .fill { height: 100%; background: var(--s1); border-radius: 0 4px 4px 0; }
.bar-row .num { font-family: var(--mono); font-size: 11.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ── Tables ───────────────────────────────────────────── */
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-family: var(--mono); font-weight: 400; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); padding: 6px 8px 8px 0; border-bottom: 1px solid var(--line); }
table.t td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.t td a { text-decoration: none; border-bottom: 1px solid var(--line-strong); }
table.t .sub { color: var(--text-3); font-size: 12px; }
.scroll { overflow-x: auto; }

/* ── States ───────────────────────────────────────────── */
.pill { display: inline-block; font-family: var(--mono); font-size: 10.5px; letter-spacing: .04em; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--text-2); white-space: nowrap; }
.pill.good { border-color: var(--good); color: var(--good); }
.pill.warn { border-color: var(--warn); color: #8a6100; }
:root[data-theme="dark"] .pill.warn { color: var(--warn); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill.warn { color: var(--warn); } }
.pill.bad { border-color: var(--critical); color: var(--critical); }
.pill.s1 { border-color: var(--s1); color: var(--s1); }
.empty { border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); padding: 14px; color: var(--text-2); font-size: 13px; background: var(--surface-2); }
.empty b { color: var(--text); }
.empty code { font-family: var(--mono); font-size: 12px; background: var(--surface); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line); }
.empty a { color: var(--text); }
.error { border-left: 3px solid var(--critical); padding: 8px 12px; background: var(--surface-2); border-radius: 6px; font-size: 12.5px; color: var(--text-2); font-family: var(--mono); word-break: break-word; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list li { display: flex; gap: 12px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .when { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); min-width: 86px; }
.list .what { flex: 1; min-width: 0; }
.list .what .sub { color: var(--text-3); font-size: 12px; }
.attention { display: flex; flex-wrap: wrap; gap: 8px; }
.attention .item { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 999px; padding: 6px 12px; font-size: 13px; background: var(--surface); text-decoration: none; }
.attention .item .n { font-family: var(--serif); font-size: 18px; line-height: 1; }
.attention .item.warn { border-color: var(--warn); }
.attention .item.bad { border-color: var(--critical); }
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(170px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.kanban .col { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px; min-height: 90px; }
.kanban .col h4 { margin: 0 0 8px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); display: flex; justify-content: space-between; }
.kanban .k { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; font-size: 12.5px; }
.kanban .k .sub { color: var(--text-3); font-size: 11.5px; }
.kanban .k.due { border-color: var(--warn); }
.md { font-size: 13.5px; color: var(--text-2); white-space: pre-wrap; }
.md h1, .md h2 { font-family: var(--serif); font-weight: 400; margin: 10px 0 4px; color: var(--text); }
.doclink { display: flex; gap: 10px; align-items: baseline; }
.kind { font-family: var(--mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); min-width: 44px; }
.connect-row { display: grid; grid-template-columns: 200px 1fr auto; gap: 14px; align-items: start; padding: 14px 0; border-bottom: 1px solid var(--line); }
.connect-row:last-child { border-bottom: 0; }
.connect-row .name { font-weight: 600; }
.connect-row .vars { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); margin-top: 4px; word-break: break-all; }
.connect-row .how { font-size: 13px; color: var(--text-2); }
.connect-row .how a { color: var(--text); }
.result { margin-top: 8px; font-family: var(--mono); font-size: 11.5px; color: var(--text-2); white-space: pre-wrap; word-break: break-word; max-height: 160px; overflow: auto; }

/* ── Links into the apps ──────────────────────────────── */
.applinks { display: flex; flex-wrap: wrap; gap: 6px; }
.ext { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--line-strong); padding-bottom: 1px; }
.ext .arrow { font-size: 10px; color: var(--text-3); }
.ext:hover { border-bottom-color: var(--text); }
.applinks .ext { border: 1px solid var(--line-strong); border-radius: 999px; padding: 5px 11px; font-size: 12.5px; background: var(--surface); }
.applinks .ext:hover { border-color: var(--text-3); }
.nav.apps a { padding: 5px 10px; font-size: 13px; }

/* ── Tasks ────────────────────────────────────────────── */
.task-add { display: grid; grid-template-columns: 1fr 140px 150px 140px 100px auto; gap: 8px; align-items: center; }
.task-add input, .task-add select, .task select { font: inherit; color: inherit; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 8px; padding: 7px 9px; min-width: 0; }
@media (max-width: 900px) { .task-add { grid-template-columns: 1fr 1fr; } }
.kanban .k.task .ttl { font-weight: 500; }
.kanban .k.task .row { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.kanban .k.task select { padding: 3px 6px; font-size: 11.5px; border-radius: 6px; }
.list .when.late { color: var(--critical); }

/* ── Social feed ──────────────────────────────────────── */
.feed { display: flex; flex-direction: column; gap: 10px; }
.post { display: grid; grid-template-columns: 72px 1fr; gap: 12px; align-items: start; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.post:last-child { border-bottom: 0; padding-bottom: 0; }
.post .thumb { display: block; width: 72px; height: 72px; border-radius: 8px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; }
.post .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post .cap { font-size: 13px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post .sub { color: var(--text-3); font-size: 11.5px; margin-top: 2px; }
.post .stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; font-size: 11.5px; color: var(--text-3); }
.post .stats b { color: var(--text-2); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── Login ────────────────────────────────────────────── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login .box { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.login label { font-size: 12.5px; color: var(--text-2); display: flex; flex-direction: column; gap: 5px; }
.login input, .capture textarea, .capture input { font: inherit; color: inherit; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 11px; width: 100%; }
.login .err { color: var(--critical); font-size: 12.5px; min-height: 1em; }

/* ── Capture panel ────────────────────────────────────── */
.capture { position: fixed; right: 24px; bottom: 24px; width: min(380px, calc(100% - 32px)); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 16px; box-shadow: 0 12px 40px -12px rgba(0,0,0,.35); display: none; flex-direction: column; gap: 8px; z-index: 20; }
.capture.open { display: flex; }
.capture textarea { min-height: 90px; resize: vertical; }
.capture .row { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.capture .hint { font-size: 12px; color: var(--text-3); margin-right: auto; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 999px; font-size: 13px; z-index: 30; opacity: 0; transition: opacity .2s; }
.toast.show { opacity: 1; }
