/* LineaFlow design system — styles.css
   The one stylesheet: tokens first (:root), the dark theme and density scopes,
   then base type, then the component layer. Every page links this file and
   takes colour, type, spacing, radius and shadow from its variables. */
@import url("https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700&family=Geist+Mono:wght@400;500&display=swap");

/* ---------- 1. Palette ---------- */
:root {
  --lf-bg: #f6f5f2;
  --lf-surface: #ffffff;
  --lf-surface-2: #f2f1ee;
  --lf-input: #f9f8f6;
  --lf-border: #e8e6e1;
  --lf-border-2: #d3d1cb;
  --lf-ink: #2b3640;
  --lf-ink-2: #566472;
  --lf-ink-3: #7c8792;
  --lf-accent: #6a9fbd;
  --lf-accent-2: #4f86a6;
  --lf-accent-soft: #eaf2f7;
  --lf-accent-grad: linear-gradient(135deg, #7fb0cb 0%, #6a9fbd 60%, #4f86a6 100%); /* @kind color */
  --lf-ok: #4f8a68;
  --lf-ok-soft: #e9f4ec;
  --lf-warn: #9a7a3d;
  --lf-warn-dot: #cfa564;
  --lf-warn-soft: #fbf4e6;
  --lf-crit: #c86f68;
  --lf-crit-soft: #fbeceb;
  --lf-header-grad: linear-gradient(180deg, #ffffff 0%, #fbfaf8 100%); /* @kind color */
  --lf-scrim: rgba(20, 26, 30, 0.35);

  /* ---------- 2. Type ---------- */
  --font-sans: 'Figtree', system-ui, -apple-system, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, monospace;
  --fs-display: 26px; --lh-display: 1.2; /* @kind font */ --ls-display: -0.02em;
  --fs-h1: 20px; --lh-h1: 1.25; /* @kind font */
  --fs-h2: 15px; --lh-h2: 1.35; /* @kind font */
  --fs-body: 14px; --lh-body: 1.45; /* @kind font */
  --fs-table: 13px; --lh-table: 1.4; /* @kind font */
  --fs-caption: 12px; --lh-caption: 1.35; /* @kind font */
  --fs-label: 11px; --lh-label: 1.3; /* @kind font */ --ls-label: 0.06em;
  --fs-id: 12px;
  --fw-regular: 400; /* @kind font */
  --fw-medium: 500; /* @kind font */
  --fw-semibold: 600; /* @kind font */
  --fw-bold: 700; /* @kind font */

  /* ---------- 3. Spacing, sizes, radii ---------- */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-6: 24px; --sp-8: 32px; --sp-12: 48px;
  --row-h: 40px; --pad-card: 16px; --gap-grid: 12px;
  --h-control: 36px; --h-control-sm: 30px; --h-control-xs: 26px;
  --header-h: 60px; --panel-w: 320px; --content-max: 1440px; --page-margin: 28px;
  --r-chip: 4px; --r-tag: 6px; --r-control: 7px; --r-button: 9px; --r-card: 10px; --r-panel: 10px; --r-nav: 11px; --r-pill: 999px;

  /* ---------- 4. Effects & motion ---------- */
  --shadow-overlay: 0 12px 32px rgba(30, 42, 51, 0.16);
  --shadow-header: 0 6px 18px -12px rgba(30, 42, 51, 0.25);
  --shadow-button: 0 1px 2px rgba(30, 42, 51, 0.12);
  --shadow-nav-active: 0 1px 2px rgba(30, 42, 51, 0.08);
  --shadow-mark: 0 2px 6px rgba(106, 159, 189, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  --focus-ring: 0 0 0 3px rgba(106, 159, 189, 0.22);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1); /* @kind other */
  --dur: 150ms; /* @kind other */
}

/* Dark theme: the same palette slots, remapped. Put data-theme="dark" on <html> or any subtree. */
[data-theme="dark"] {
  --lf-bg: #12181d;
  --lf-surface: #181f26;
  --lf-surface-2: #202932;
  --lf-input: #12181d;
  --lf-border: #2c3640;
  --lf-border-2: #414d59;
  --lf-ink: #e6ebef;
  --lf-ink-2: #b9c3cc;
  --lf-ink-3: #8f9ba6;
  --lf-accent: #8dbbd6;
  --lf-accent-2: #a6cbe0;
  --lf-accent-soft: #1e3140;
  --lf-ok: #9ad3b0;
  --lf-ok-soft: #1b3129;
  --lf-warn: #e3c586;
  --lf-warn-dot: #d9b871;
  --lf-warn-soft: #332c1c;
  --lf-crit: #eea59c;
  --lf-crit-soft: #3b2523;
  --lf-header-grad: linear-gradient(180deg, #151c22 0%, #151c22 100%); /* @kind color */
  --lf-scrim: rgba(0, 0, 0, 0.55);
  --shadow-overlay: 0 12px 32px rgba(0, 0, 0, 0.45);
  --shadow-header: 0 6px 18px -12px rgba(0, 0, 0, 0.6);
  --focus-ring: 0 0 0 3px rgba(141, 187, 214, 0.3);
}

/* Semantic roles — re-declared on every themed subtree so they re-resolve against that theme's palette. */
:root, [data-theme] {
  --text-body: var(--lf-ink);
  --text-secondary: var(--lf-ink-2);
  --text-muted: var(--lf-ink-3);
  --text-link: var(--lf-accent-2);
  --text-on-accent: #ffffff;
  --surface-page: var(--lf-bg);
  --surface-card: var(--lf-surface);
  --surface-inset: var(--lf-surface-2);
  --surface-input: var(--lf-input);
  --surface-header: var(--lf-header-grad);
  --border-hairline: var(--lf-border);
  --border-strong: var(--lf-border-2);
  --action-primary: var(--lf-accent);
  --action-primary-hover: var(--lf-accent-2);
  --ai-dot: var(--lf-accent);
  --ai-surface: var(--lf-accent-soft);
}

/* Density: the user's choice, not the designer's. Compact tightens rows and padding, never type hierarchy. */
[data-density="compact"] {
  --row-h: 32px; --pad-card: 12px; --gap-grid: 8px; --fs-body: 13px;
}

/* ---------- 5. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--surface-page); }
body {
  margin: 0; font-family: var(--font-sans); font-size: var(--fs-body); line-height: var(--lh-body);
  color: var(--text-body); background: var(--surface-page);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p, figure { margin: 0; }
h1, .h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); font-weight: var(--fw-semibold); letter-spacing: -0.01em; }
h2, .h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); font-weight: var(--fw-semibold); }
h3, .h3 { font-size: var(--fs-body); line-height: var(--lh-body); font-weight: var(--fw-medium); }
.display { font-size: var(--fs-display); line-height: var(--lh-display); font-weight: var(--fw-semibold); letter-spacing: var(--ls-display); font-variant-numeric: tabular-nums; }
.caption { font-size: var(--fs-caption); line-height: var(--lh-caption); color: var(--text-muted); }
.label { font-size: var(--fs-label); line-height: var(--lh-label); font-weight: var(--fw-semibold); letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--text-muted); }
.id, code, kbd, .mono { font-family: var(--font-mono); font-size: var(--fs-id); font-weight: var(--fw-regular); }
.num, .tabular { font-variant-numeric: tabular-nums; }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-link { color: var(--text-link); }
.text-ok { color: var(--lf-ok); } .text-warn { color: var(--lf-warn); } .text-crit { color: var(--lf-crit); }
.pretty { text-wrap: pretty; }
a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--lf-accent-soft); color: var(--text-body); }
:focus-visible { outline: none; box-shadow: var(--focus-ring); }
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
hr, .hr { border: 0; border-top: 1px solid var(--border-hairline); margin: 0; }
.vr { width: 1px; height: 16px; background: var(--border-hairline); flex: none; }
svg.icon, .icon > svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Layout helpers */
.row { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: var(--sp-3); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap-grid); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap-grid); }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap-grid); }
.spacer { flex: 1; }
.inset { background: var(--surface-inset); border-radius: var(--r-control); padding: 10px 12px; }
.list { display: flex; flex-direction: column; }
.list > * + * { border-top: 1px solid var(--border-hairline); }
.empty { padding: var(--sp-8) var(--sp-4); text-align: center; color: var(--text-muted); font-size: 13px; }
.elev-overlay { box-shadow: var(--shadow-overlay); }

/* ---------- 6. Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: var(--h-control-sm); padding: 0 12px;
  border: 1px solid var(--border-hairline); border-radius: var(--r-button);
  background: var(--surface-card); color: var(--text-body);
  font-size: 13px; font-weight: var(--fw-medium); line-height: 1; white-space: nowrap;
  cursor: pointer; text-decoration: none;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.btn:hover { border-color: var(--lf-accent); background: var(--ai-surface); text-decoration: none; }
.btn:active { background: color-mix(in srgb, var(--lf-accent) 18%, var(--surface-card)); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: default; pointer-events: none; }
.btn-md { height: var(--h-control); padding: 0 14px; }
.btn-xs { height: var(--h-control-xs); padding: 0 10px; font-size: 12px; }
.btn-primary { background: var(--action-primary); color: var(--text-on-accent); border-color: transparent; box-shadow: var(--shadow-button); font-weight: var(--fw-semibold); }
.btn-primary:hover { background: var(--action-primary-hover); border-color: transparent; }
.btn-primary:active { background: var(--action-primary-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-link); }
.btn-ghost:hover { background: var(--ai-surface); border-color: transparent; }
.btn-danger { background: var(--lf-crit); color: #ffffff; border-color: transparent; font-weight: var(--fw-semibold); }
.btn-danger:hover { background: var(--lf-crit); border-color: transparent; opacity: 0.92; }
.btn-active, .btn[aria-pressed="true"] { border-color: var(--lf-accent); background: var(--ai-surface); color: var(--lf-accent-2); }
.btn-icon { width: var(--h-control); height: var(--h-control); padding: 0; position: relative; color: var(--text-secondary); }
.btn-icon.btn-xs { width: var(--h-control-xs); height: var(--h-control-xs); }
.btn-icon.btn-sm { width: var(--h-control-sm); height: var(--h-control-sm); }
.btn .icon { display: inline-flex; width: 16px; justify-content: center; }
.btn-primary .icon-tile { width: 20px; height: 20px; border-radius: 6px; background: rgba(255, 255, 255, 0.18); display: inline-flex; align-items: center; justify-content: center; font-size: 15px; line-height: 1; }
.count { position: absolute; top: -7px; right: -7px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill); background: var(--lf-crit); color: #fff; font-size: 10px; font-weight: var(--fw-bold); display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--surface-card); line-height: 1; }

/* ---------- 7. Fields ---------- */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; min-width: 0; }
.field-label { font-size: 12px; color: var(--text-muted); }
.field-hint { font-size: 11px; color: var(--text-muted); }
.field-invalid .field-hint { color: var(--lf-crit); }
.input {
  display: flex; align-items: center; gap: 8px; width: 100%; height: var(--h-control); padding: 0 12px;
  border: 1px solid var(--border-hairline); border-radius: var(--r-button);
  background: var(--surface-input); color: var(--text-body); font-size: 13px; font-variant-numeric: tabular-nums;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.input::placeholder { color: var(--text-muted); }
.input:focus, .input:focus-within { outline: 0; border-color: var(--lf-accent); background: var(--surface-card); box-shadow: var(--focus-ring); }
.input > input, .input > textarea { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; padding: 0; background: transparent; font: inherit; color: inherit; }
.input > input::placeholder { color: var(--text-muted); }
.input .affix { color: var(--text-muted); flex: none; }
.input .affix-mono { font-family: var(--font-mono); font-size: 11px; }
.field-invalid .input, .input-invalid { border-color: var(--lf-crit); }
.input-ai { border-color: var(--lf-accent); background: var(--ai-surface); }
textarea.input { height: auto; min-height: 84px; padding: 8px 12px; resize: vertical; line-height: 1.45; }
.select {
  appearance: none; -webkit-appearance: none; width: 100%; height: var(--h-control-sm); padding: 0 28px 0 10px;
  border: 1px solid var(--border-hairline); border-radius: var(--r-control);
  background: var(--surface-card) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%237c8792' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>") no-repeat right 10px center;
  color: var(--text-body); font-size: 13px; font-weight: var(--fw-medium); cursor: pointer;
}
.select:focus { outline: 0; border-color: var(--lf-accent); box-shadow: var(--focus-ring); }
.checkbox, .switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; position: relative; user-select: none; }
.checkbox > input, .switch > input { position: absolute; opacity: 0; width: 0; height: 0; margin: 0; }
.checkbox .box { width: 16px; height: 16px; border-radius: var(--r-chip); border: 1.5px solid var(--border-strong); background: var(--surface-card); display: inline-flex; align-items: center; justify-content: center; flex: none; transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.checkbox > input:checked + .box { border-color: var(--lf-accent); background: var(--lf-accent); }
.checkbox > input:checked + .box::after { content: ""; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
.checkbox > input:focus-visible + .box, .switch > input:focus-visible + .track { box-shadow: var(--focus-ring); }
.switch .track { width: 30px; height: 18px; border-radius: var(--r-pill); background: var(--border-strong); position: relative; flex: none; transition: background var(--dur) var(--ease); }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: left var(--dur) var(--ease); }
.switch > input:checked + .track { background: var(--lf-accent); }
.switch > input:checked + .track::after { left: 14px; }

/* ---------- 8. Status: dot + word, badges, tags ---------- */
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); flex: none; vertical-align: middle; }
.dot-ok { background: var(--lf-ok); }
.dot-warn { background: var(--lf-warn-dot); }
.dot-crit { background: var(--lf-crit); }
.dot-ai { background: var(--ai-dot); width: 6px; height: 6px; }
.dot-neutral { background: var(--text-muted); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: var(--r-chip); background: var(--surface-inset); color: var(--text-secondary); font-size: 12px; font-weight: var(--fw-medium); line-height: 1.4; white-space: nowrap; }
.badge-ok { background: var(--lf-ok-soft); color: var(--lf-ok); }
.badge-warn { background: var(--lf-warn-soft); color: var(--lf-warn); }
.badge-crit { background: var(--lf-crit-soft); color: var(--lf-crit); }
.badge-ai { background: var(--ai-surface); color: var(--lf-accent-2); }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border: 1px solid var(--border-hairline); border-radius: var(--r-chip); background: transparent; color: var(--text-secondary); font-size: 12px; line-height: 1.4; white-space: nowrap; }
.tag-context, .tag-filled { border-color: transparent; background: var(--surface-inset); color: var(--text-body); font-weight: var(--fw-medium); }
.tag-mono { font-family: var(--font-mono); font-size: 11px; }
.tag-quiet { border-color: transparent; color: var(--text-muted); }
.tag-remove { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; padding: 0; line-height: 1; font-size: 13px; }
.tag-remove:hover { color: var(--text-body); }

/* Lifecycle bar — stage segments: done, active, blocked, todo */
.lifecycle { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.lifecycle-bar { display: flex; gap: 4px; align-items: center; }
.lifecycle-bar > i { display: block; flex: 1; height: 6px; border-radius: 3px; background: var(--surface-inset); }
.lifecycle-bar > .seg-done { background: var(--lf-ok); }
.lifecycle-bar > .seg-active { background: var(--lf-warn-dot); }
.lifecycle-bar > .seg-blocked { background: var(--lf-crit); }
.lifecycle-compact .lifecycle-bar { gap: 3px; }
.lifecycle-compact .lifecycle-bar > i { flex: none; width: 14px; height: 4px; }
.lifecycle-labels { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; font-size: 10px; color: var(--text-muted); }
.lifecycle-labels .is-active { color: var(--lf-warn); font-weight: var(--fw-medium); }
.lifecycle-labels .is-blocked { color: var(--lf-crit); font-weight: var(--fw-medium); }

/* ---------- 9. Cards ---------- */
.card { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: var(--pad-card); border: 1px solid var(--border-hairline); border-radius: var(--r-card); background: var(--surface-card); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-title { font-size: var(--fs-h2); line-height: var(--lh-h2); font-weight: var(--fw-semibold); }
.card-flush { padding: 0; gap: 0; overflow: hidden; }
.card-flush > .card-head { padding: 10px var(--pad-card); border-bottom: 1px solid var(--border-hairline); }
.card-flush > .card-foot { padding: 10px var(--pad-card); border-top: 1px solid var(--border-hairline); font-size: 12px; color: var(--text-muted); display: flex; justify-content: space-between; }

/* Metric card and the metric strip */
.metric { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: var(--pad-card); border: 1px solid var(--border-hairline); border-radius: var(--r-card); background: var(--surface-card); }
.metric-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-muted); }
.metric-delta { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.metric-delta.ok { color: var(--lf-ok); }
.metric-delta.warn { color: var(--lf-warn); }
.metric-delta.crit { color: var(--lf-crit); }
.metric-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.metric-value { font-size: 22px; font-weight: var(--fw-semibold); letter-spacing: -0.02em; line-height: 1; font-variant-numeric: tabular-nums; color: var(--text-body); }
.metric-sub { font-size: 11px; color: var(--text-muted); }
.spark { width: 72px; height: 24px; overflow: visible; flex: none; color: var(--text-body); }
.spark polyline { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.spark-warn { color: var(--lf-warn-dot); }
.spark-crit { color: var(--lf-crit); }
.spark-ok { color: var(--lf-ok); }
.metric-strip { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--border-hairline); border-radius: var(--r-card); background: var(--surface-card); overflow: hidden; }
.metric-strip > .metric { border: 0; border-radius: 0; border-right: 1px solid var(--border-hairline); padding: 14px var(--pad-card); }
.metric-strip > .metric:last-child { border-right: 0; }

/* Decision card — a card that ends in a decision */
.decision-head { display: flex; justify-content: space-between; align-items: center; font-size: 11px; }
.decision-type { display: inline-flex; align-items: center; gap: 6px; font-weight: var(--fw-semibold); letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--text-muted); }
.due { font-size: 11px; font-weight: var(--fw-medium); color: var(--text-secondary); white-space: nowrap; }
.due-warn { color: var(--lf-warn); }
.due-crit { color: var(--lf-crit); }
.decision-title { font-size: 14px; line-height: 1.35; font-weight: var(--fw-medium); color: var(--text-body); text-wrap: pretty; }
.decision-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.decision-metrics { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 12px; margin: 0; padding: 10px 12px; border-radius: var(--r-control); background: var(--surface-inset); font-size: 12px; }
.decision-metrics dt { color: var(--text-muted); }
.decision-metrics dd { margin: 0; font-weight: var(--fw-medium); font-variant-numeric: tabular-nums; }
.decision-actions { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.decision-owner { margin-left: auto; font-size: 11px; color: var(--text-muted); }

/* ---------- 10. Table ---------- */
.table-wrap { border: 1px solid var(--border-hairline); border-radius: var(--r-card); background: var(--surface-card); overflow: auto; }
.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px var(--pad-card); border-bottom: 1px solid var(--border-hairline); flex-wrap: wrap; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-table); line-height: var(--lh-table); font-variant-numeric: tabular-nums; }
.table th { height: 36px; padding: 0 12px; border-bottom: 1px solid var(--border-hairline); text-align: left; font-size: 11px; font-weight: var(--fw-medium); letter-spacing: 0.02em; color: var(--text-muted); white-space: nowrap; background: var(--surface-card); }
.table td { height: var(--row-h); padding: 0 12px; border-bottom: 1px solid var(--border-hairline); color: var(--text-body); white-space: nowrap; vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: var(--pad-card); }
.table th:last-child, .table td:last-child { padding-right: var(--pad-card); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-inset); }
.table tr.is-selected td { background: var(--lf-accent-soft); }
.table .num { text-align: right; }
.table .mono { font-family: var(--font-mono); font-size: 12px; }
.table-footer { display: flex; justify-content: space-between; padding: 10px var(--pad-card); border-top: 1px solid var(--border-hairline); font-size: 12px; color: var(--text-muted); }

/* ---------- 11. Filters, tabs, segmented nav ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border: 1px solid var(--border-hairline); border-radius: var(--r-pill); background: var(--surface-card); color: var(--text-secondary); font-size: 12px; white-space: nowrap; cursor: pointer; transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease); }
.chip:hover { border-color: var(--border-strong); }
.chip-active, .chip[aria-pressed="true"] { border-color: var(--lf-accent); background: var(--ai-surface); color: var(--lf-accent-2); font-weight: var(--fw-semibold); }
.chip-add { border-style: dashed; border-color: var(--border-strong); color: var(--text-muted); }
.token { display: inline-flex; align-items: stretch; border: 1px solid var(--border-hairline); border-radius: var(--r-tag); background: var(--surface-card); overflow: hidden; font-size: 12px; white-space: nowrap; }
.token > span { padding: 4px 8px; color: var(--text-muted); border-right: 1px solid var(--border-hairline); }
.token > .token-value { color: var(--text-body); font-weight: var(--fw-medium); font-variant-numeric: tabular-nums; }
.token > span:last-child { border-right: 0; }
.token > button { border: 0; border-left: 1px solid var(--border-hairline); padding: 0 8px; background: transparent; color: var(--text-muted); cursor: pointer; }
.token > button:hover { color: var(--text-body); }
.tabs { display: flex; gap: 2px; padding: 0 10px; border-bottom: 1px solid var(--border-hairline); font-size: 13px; white-space: nowrap; overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 10px 8px; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--text-secondary); font-weight: var(--fw-regular); cursor: pointer; text-decoration: none; }
.tab:hover { color: var(--text-body); text-decoration: none; }
.tab-active, .tab[aria-selected="true"] { color: var(--lf-accent-2); border-bottom-color: var(--lf-accent); font-weight: var(--fw-semibold); }
.tab-count { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.segnav { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--border-hairline); border-radius: var(--r-nav); background: var(--surface-inset); }
.segnav-item { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--text-muted); font-size: 13px; font-weight: var(--fw-semibold); white-space: nowrap; cursor: pointer; text-decoration: none; transition: color var(--dur) var(--ease), background var(--dur) var(--ease); }
.segnav-item:hover { color: var(--text-body); text-decoration: none; }
.segnav-active, .segnav-item[aria-current] { color: var(--lf-accent-2); background: var(--surface-card); box-shadow: var(--shadow-nav-active); }
.segnav-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill); background: var(--surface-card); color: var(--text-muted); font-size: 10px; font-weight: var(--fw-bold); display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.segnav-count.critical { background: var(--lf-crit); color: #fff; }

/* ---------- 12. Lina — the AI colleague ---------- */
.ai-hint { display: flex; gap: 10px; padding: 10px 12px; border-radius: var(--r-control); background: var(--ai-surface); color: var(--text-body); font-size: 12px; line-height: 1.45; }
.ai-hint::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ai-dot); flex: none; margin-top: 5px; }
.ai-hint a { color: var(--text-link); }
.sources { display: flex; flex-wrap: wrap; gap: 6px; }
.sources > span { font-size: 11px; padding: 2px 8px; border: 1px solid var(--border-hairline); border-radius: var(--r-chip); color: var(--text-secondary); }
.panel { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--border-hairline); background: var(--surface-card); }
.panel-head { display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 16px; border-bottom: 1px solid var(--border-hairline); font-size: 13px; font-weight: var(--fw-semibold); }
.panel-body { flex: 1; display: flex; flex-direction: column; gap: 12px; padding: 16px; overflow: auto; }
.panel-foot { padding: 12px 16px; border-top: 1px solid var(--border-hairline); }
.proposal { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--border-hairline); border-radius: var(--r-card); background: var(--surface-card); font-size: 12px; line-height: 1.45; }
.proposal-head { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: var(--fw-semibold); letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--text-muted); }

/* ---------- 13. Tasks ---------- */
.task-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: var(--row-h); padding: 8px var(--pad-card); border-bottom: 1px solid var(--border-hairline); font-size: 13px; }
.task-row:hover { background: var(--surface-inset); }
.task-row:last-child { border-bottom: 0; }
.task-main { display: flex; flex-direction: column; min-width: 0; }
.task-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-body); }
.task-title.strong { font-weight: var(--fw-medium); }
.task-row.is-done .task-title { text-decoration: line-through; color: var(--text-muted); }
.task-context { font-size: 11px; color: var(--text-muted); }
.task-meta { display: flex; align-items: center; gap: 10px; }
.task-kind { font-size: 11px; padding: 2px 8px; border-radius: var(--r-chip); background: var(--surface-inset); color: var(--text-secondary); }

/* ---------- 14. Command bar (⌘K) ---------- */
.scrim { position: fixed; inset: 0; z-index: 50; display: flex; justify-content: center; align-items: flex-start; padding-top: 96px; background: var(--lf-scrim); }
.cmd { width: 640px; max-width: 100%; border: 1px solid var(--border-hairline); border-radius: var(--r-panel); background: var(--surface-card); box-shadow: var(--shadow-overlay); overflow: hidden; }
.cmd-input { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 16px; border-bottom: 1px solid var(--border-hairline); font-size: 14px; }
.cmd-input .prefix { color: var(--text-muted); }
.cmd-input input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; color: var(--text-body); }
.cmd-input input::placeholder { color: var(--text-muted); }
.cmd-context { margin-left: auto; font-size: 11px; padding: 2px 8px; border-radius: var(--r-chip); background: var(--surface-inset); color: var(--text-secondary); }
.cmd-list { display: flex; flex-direction: column; gap: 2px; padding: 8px; font-size: 13px; }
.cmd-group { padding: 6px 10px 4px; font-size: 11px; font-weight: var(--fw-semibold); letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--text-muted); }
.cmd-item { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: var(--r-control); color: var(--text-body); cursor: pointer; }
.cmd-item:hover, .cmd-item.is-selected { background: var(--surface-inset); }
.cmd-item .code { width: 64px; flex: none; font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.cmd-item .sub { color: var(--text-muted); white-space: nowrap; }
.cmd-item .meta { margin-left: auto; font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.cmd-item .label-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmd-hints { display: flex; gap: 14px; padding: 8px 16px; border-top: 1px solid var(--border-hairline); font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.kbd { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border: 1px solid var(--border-hairline); border-radius: var(--r-chip); background: var(--surface-card); font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); }

/* ---------- 15. Application shell ---------- */
.app { min-height: 100vh; display: grid; grid-template-rows: var(--header-h) minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); background: var(--surface-page); color: var(--text-body); }
.header { height: var(--header-h); display: flex; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid var(--border-hairline); background: var(--surface-header); box-shadow: var(--shadow-header); white-space: nowrap; position: relative; z-index: 2; }
.brand { display: flex; align-items: center; gap: 11px; margin-right: 6px; flex: none; }
.mark { width: 36px; height: 36px; border-radius: var(--r-card); background: var(--lf-accent-grad); box-shadow: var(--shadow-mark); display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: var(--fw-bold); font-size: 14px; flex: none; }
.mark-sm { width: 28px; height: 28px; border-radius: 9px; font-size: 12px; }
.wordmark { display: flex; flex-direction: column; line-height: 1.05; }
.wordmark b { font-size: 15px; font-weight: var(--fw-bold); letter-spacing: -0.01em; color: var(--text-body); }
.wordmark small { font-size: 10px; font-weight: var(--fw-semibold); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.search-trigger { position: relative; display: flex; align-items: center; flex: 0 1 300px; width: 300px; min-width: 140px; overflow: hidden; height: var(--h-control); padding: 0 44px 0 12px; border: 1px solid var(--border-hairline); border-radius: var(--r-button); background: var(--surface-input); color: var(--text-muted); font-size: 13px; cursor: pointer; text-align: left; }
.search-trigger:hover { border-color: var(--border-strong); }
.search-trigger .kbd { position: absolute; right: 9px; top: 8px; }
.avatar { width: 36px; height: 36px; border-radius: var(--r-button); background: var(--ai-surface); color: var(--lf-accent-2); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: var(--fw-bold); flex: none; }
.avatar-sm { width: 24px; height: 24px; border-radius: 6px; font-size: 10px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 0; }
.workspace.has-panel { grid-template-columns: minmax(0, 1fr) var(--panel-w); }
.main { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: var(--sp-6) var(--page-margin) var(--sp-12); display: flex; flex-direction: column; gap: var(--sp-6); min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: var(--sp-3); }
.section-head .h2 .tab-count { margin-left: 6px; }

/* Charts: ink strokes on hairline grids; the accent is reserved for the one series that matters. */
.chart-grid { stroke: var(--border-hairline); stroke-width: 1; }
.chart-axis { font-family: var(--font-mono); font-size: 10px; fill: var(--text-muted); }
.chart-line { fill: none; stroke: var(--text-body); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-line-accent { stroke: var(--lf-accent); }
.chart-area { fill: var(--lf-accent-soft); }
.chart-target { stroke: var(--border-strong); stroke-dasharray: 3 3; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; }
}
