@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500;600;700&display=swap');

/* Signal dark */
:root {
  color-scheme: dark;
  --bg:#0c0d0c; --surface-1:#101210; --surface-2:#151714; --surface-3:#20241d;
  --surface-hover:#191c17; --surface-selected:#20241d;
  --text-primary:#e6e8e4; --text-secondary:#9aa096; --text-tertiary:#6d726a;
  --border:#20241d; --border-strong:#262a24; --border-subtle:#161815;
  --accent:#b8f24a; --accent-text:#b8f24a; --accent-quiet:rgb(184 242 74 / .12);
  --accent-ink:#0c0d0c; --ring-focus:#b8f24a;
  --info:#4ad2f2; --info-quiet:rgb(74 210 242 / .13);
  --warn:#f2b34a; --warn-quiet:rgb(242 179 74 / .13);
  --success:#6ee787; --success-quiet:rgb(110 231 135 / .13);
  --danger:#f2554a; --danger-quiet:rgb(242 85 74 / .13);
  --cat-1:#b8f24a; --cat-2:#4ad2f2; --cat-3:#c084fc; --cat-4:#f2b34a;
  --cat-5:#6ee787; --cat-6:#4a7ff2; --cat-7:#f2554a; --cat-8:#6d726a;
  --chart-grid:#20241d; --chart-track:#2a2f26; --sweep:none;
  --grain-color:rgb(255 255 255 / .035);
}

/* Signal light */
:root[data-theme="light"] {
  color-scheme: light;
  --bg:#f2f3f0; --surface-1:#ffffff; --surface-2:#f2f3f0; --surface-3:#e8eae5;
  --surface-hover:#f7f8f5; --surface-selected:#eef0eb;
  --text-primary:#101210; --text-secondary:#5a5f57; --text-tertiary:#8b9088;
  --border:#dcded8; --border-strong:#c9ccc4; --border-subtle:#eceee9;
  --accent:#4d7a05; --accent-text:#4d7a05; --accent-quiet:rgb(77 122 5 / .12);
  --accent-ink:#ffffff; --ring-focus:#4d7a05;
  --info:#0f7f9c; --info-quiet:rgb(15 127 156 / .12);
  --warn:#a86a06; --warn-quiet:rgb(168 106 6 / .12);
  --success:#1f7f42; --success-quiet:rgb(31 127 66 / .12);
  --danger:#c2372c; --danger-quiet:rgb(194 55 44 / .12);
  --cat-1:#4d7a05; --cat-2:#0f7f9c; --cat-3:#8652bd; --cat-4:#a86a06;
  --cat-5:#1f7f42; --cat-6:#315cc3; --cat-7:#c2372c; --cat-8:#8b9088;
  --chart-grid:#e4e6e0; --chart-track:#dcded8; --sweep:none; --grain-color:transparent;
}

/* Components: register-independent */
* { box-sizing:border-box; }
html, body { margin:0; min-height:100%; }
html { background:var(--bg); }
body {
  color:var(--text-primary); font:14px/1.45 'Geist',sans-serif;
  background-color:var(--bg);
  background-image:radial-gradient(circle, var(--grain-color) .5px, transparent .5px);
  background-size:3px 3px;
  -webkit-font-smoothing:antialiased;
}
button { font:inherit; cursor:pointer; }
button, a { -webkit-tap-highlight-color:transparent; }
button:focus-visible, a:focus-visible { outline:2px solid var(--ring-focus); outline-offset:2px; }
button:active, a:active { transform:scale(.985); }
.mono, .eyebrow, .nav-label, .nav-group, .wordmark, .sidebar-footer, .synced,
.column-title, .column-count, .identifier, .priority, .label-chip, .assignee,
.stat-label, .stat-value, .metric-note, .progress-caption, .section-heading,
.flag-id, .flag-more, .status-key, .empty-frame, .loading-bar, .team-name {
  font-family:'Geist Mono',monospace;
}
.eyebrow, .nav-group, .section-heading, .column-title, .stat-label {
  font-size:10px; font-weight:600; letter-spacing:.16em; text-transform:uppercase;
  color:var(--text-tertiary);
}
.app-shell { display:flex; min-height:100dvh; width:100%; }
.sidebar {
  width:216px; flex:0 0 216px; height:100dvh; position:sticky; top:0;
  display:flex; flex-direction:column;
  background:var(--surface-1); border-right:1px solid var(--border);
  z-index:2;
}
.brand { height:78px; display:flex; align-items:center; padding:0 20px; border-bottom:1px solid var(--border); }
.wordmark { font-size:11px; font-weight:700; letter-spacing:-.035em; white-space:nowrap; }
.wordmark .brand-separator { color:var(--text-tertiary); }
.sidebar-nav { padding:24px 10px; flex:1; overflow-y:auto; }
.nav-group { padding:0 12px 10px; }
.nav-group:not(:first-child) { padding-top:28px; }
.nav-button {
  width:100%; min-height:38px; display:flex; align-items:center; gap:10px;
  border:0; border-left:2px solid transparent; border-radius:0 4px 4px 0;
  padding:0 11px; background:transparent; color:var(--text-secondary);
  text-align:left; transition:background-color 140ms, color 140ms, transform 140ms;
}
.nav-button:hover { background:var(--surface-hover); color:var(--text-primary); }
.nav-button.active { background:var(--surface-selected); border-left-color:var(--accent); color:var(--text-primary); }
.nav-button.scope-active { color:var(--text-primary); background:var(--surface-2); }
.nav-button.scope-active .nav-glyph { color:var(--accent-text); }
.nav-glyph { font:500 12px 'Geist Mono',monospace; color:var(--text-tertiary); width:16px; flex:0 0 16px; }
.nav-label { font-size:11px; white-space:nowrap; }
.sidebar-footer { border-top:1px solid var(--border); padding:15px 12px 18px; }
.footer-label { font-size:10px; letter-spacing:.16em; color:var(--text-tertiary); text-transform:uppercase; margin:0 0 8px; }
.footer-controls { display:flex; align-items:stretch; gap:6px; }
.theme-btn, .register-btn {
  height:34px; border:1px solid var(--border-strong); border-radius:4px;
  background:var(--surface-2); color:var(--text-secondary);
  transition:background-color 140ms, color 140ms, transform 140ms;
}
.theme-btn { min-width:34px; padding:0 7px; font:500 12px 'Geist Mono',monospace; }
.register-control { display:flex; flex:1; gap:2px; padding:2px; border:1px solid var(--border-strong); border-radius:4px; background:var(--surface-2); }
.register-btn { flex:1; min-width:0; height:28px; padding:0 4px; border:0; background:transparent; font:500 10px 'Geist Mono',monospace; }
.register-btn[aria-pressed="true"] { background:var(--surface-selected); color:var(--text-primary); }
.theme-btn:hover, .register-btn:hover { background:var(--surface-hover); color:var(--text-primary); }
.main-area { min-width:0; flex:1; }
.page-header {
  min-height:144px; padding:30px 38px 23px; background:var(--surface-1);
  border-bottom:1px solid var(--border); position:relative;
  display:flex; justify-content:space-between; align-items:flex-end; gap:20px;
}
.page-header::after { content:""; position:absolute; left:38px; right:38px; bottom:-1px; height:3px; background:var(--sweep); transform-origin:left; }
.page-header h1 { margin:8px 0 4px; font-size:30px; font-weight:600; line-height:1.1; letter-spacing:-.045em; }
.header-meta { display:flex; align-items:center; flex-wrap:wrap; gap:8px; }
.team-name { color:var(--text-secondary); font-size:11px; }
.header-actions { display:flex; align-items:center; gap:14px; padding-bottom:2px; }
.synced { color:var(--text-tertiary); font-size:10px; white-space:nowrap; }
.refresh-btn {
  height:32px; padding:0 12px; border:1px solid var(--border-strong); border-radius:4px;
  background:var(--surface-2); color:var(--text-secondary);
  font:500 11px 'Geist Mono',monospace;
  transition:background-color 140ms, color 140ms, transform 140ms;
}
.refresh-btn:hover { background:var(--surface-hover); color:var(--text-primary); }
.refresh-btn.busy::before { content:"··· "; color:var(--accent-text); }
.view[hidden] { display:none !important; }
.view { min-width:0; padding:30px 38px 48px; }
.summary-wrap { width:100%; max-width:1200px; margin:0; }
.summary-hero { display:flex; align-items:flex-end; justify-content:space-between; gap:20px; margin-bottom:24px; }
.summary-hero h2 { font-size:19px; letter-spacing:-.03em; font-weight:600; margin:5px 0 0; }
.summary-sub { color:var(--text-secondary); font-size:11px; margin:0 0 2px; }
.summary-stats { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; margin-bottom:18px; }
.stat-card {
  min-width:0; padding:16px; min-height:116px; display:flex; flex-direction:column; justify-content:space-between;
  border:1px solid var(--border); border-radius:6px; background:var(--surface-1);
  transition:background-color 200ms, color 140ms;
}
.stat-card:hover, .panel:hover { background:var(--surface-hover); }
.stat-card .stat-value { color:var(--text-primary); font-size:26px; font-weight:500; line-height:1; letter-spacing:-.055em; }
.stat-card.urgent-card .stat-value { color:var(--danger); }
.stat-bottom { display:flex; align-items:end; justify-content:space-between; gap:8px; }
.metric-note { font-size:10px; color:var(--text-tertiary); white-space:nowrap; }
.metric-note.alert { color:var(--danger); }
.summary-grid { display:grid; grid-template-columns:minmax(0,1.05fr) minmax(0,1fr); gap:18px; }
.panel { min-width:0; align-self:start; padding:20px; border:1px solid var(--border); border-radius:6px; background:var(--surface-1); transition:background-color 200ms; }
.section-heading { margin:0 0 17px; }
.progress-detail { display:flex; align-items:baseline; gap:10px; margin-bottom:19px; }
.progress-big { font:500 36px/1 'Geist Mono',monospace; letter-spacing:-.06em; color:var(--text-primary); }
.progress-sub { font:11px 'Geist Mono',monospace; color:var(--text-secondary); }
.progress-track { height:4px; width:100%; background:var(--chart-track); border-radius:4px; overflow:hidden; }
.progress-fill { height:100%; background:var(--accent); transition:width 200ms; }
.progress-caption { margin:12px 0 0; color:var(--text-tertiary); font-size:10px; }
.summary-sections { min-width:0; }
.summary-section { border:1px solid var(--border); border-radius:6px; background:var(--surface-1); padding:16px; margin-bottom:10px; }
.summary-section:last-child { margin-bottom:0; }
.summary-section .section-heading { margin-bottom:10px; display:flex; align-items:center; justify-content:space-between; }
.section-count { font:500 10px 'Geist Mono',monospace; color:var(--text-secondary); border-radius:999px; padding:2px 7px; background:var(--surface-3); letter-spacing:0; }
.flag-list { display:flex; flex-direction:column; }
.flag-item {
  min-width:0; display:flex; gap:10px; padding:9px 0; border-top:1px solid var(--border-subtle);
  text-decoration:none; color:var(--text-secondary); font-size:12px;
  transition:color 140ms, background-color 140ms;
}
.flag-item:hover { color:var(--text-primary); background:var(--surface-hover); }
.flag-id { color:var(--text-tertiary); white-space:nowrap; font-size:10px; padding-top:2px; }
.flag-title { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.flag-more { color:var(--text-tertiary); font-size:10px; padding-top:8px; }
.empty-frame {
  border:1px dashed var(--border-strong); border-radius:4px; padding:16px;
  color:var(--text-secondary); font-size:11px; line-height:1.8;
}
.empty-frame strong { color:var(--text-primary); font-weight:500; display:block; }
.empty-frame span { display:block; }
.loading-bar { height:1px; width:100%; background:var(--chart-track); position:relative; overflow:hidden; }
.loading-bar::after { content:""; position:absolute; top:0; bottom:0; width:28%; background:var(--accent); animation:loading 1.25s linear infinite; }
@keyframes loading { from { left:-28%; } to { left:100%; } }
#boardView { padding-right:0; }
.board-scroll { width:100%; overflow-x:auto; overflow-y:hidden; padding:0 38px 10px 0; }
.board { display:flex; align-items:stretch; gap:12px; min-height:350px; }
.column {
  flex:1 0 256px; min-width:256px; max-width:360px; align-self:stretch;
  border:1px solid var(--border); border-radius:6px; background:var(--surface-1);
  display:flex; flex-direction:column; overflow:hidden;
}
.column-head {
  height:28px; min-height:28px; padding:0 14px; display:flex; align-items:center; gap:8px;
  border-bottom:1px solid var(--border); background:var(--surface-2);
}
.state-dot, .label-dot { width:7px; height:7px; flex:none; border-radius:999px; background:var(--category,var(--cat-8)); }
.column-title { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--text-secondary); letter-spacing:.1em; }
.column-count { margin-left:auto; padding:1px 7px; border-radius:999px; background:var(--surface-3); color:var(--text-secondary); font-size:10px; }
.column-body { padding:8px; overflow-y:auto; max-height:calc(100dvh - 275px); min-height:230px; }
.card {
  display:block; padding:16px; margin-bottom:7px; background:var(--surface-2);
  border:1px solid var(--border); border-radius:6px; text-decoration:none; color:var(--text-secondary);
  transition:background-color 200ms, color 140ms, transform 140ms;
}
.card:hover { background:var(--surface-hover); color:var(--text-primary); }
.card-top { display:flex; align-items:center; gap:8px; margin-bottom:11px; }
.identifier { font-size:10px; color:var(--text-tertiary); }
.priority { margin-left:auto; display:inline-flex; align-items:center; gap:4px; font-size:10px; color:var(--text-tertiary); }
.priority.urgent { color:var(--danger); } .priority.high { color:var(--warn); } .priority.medium { color:var(--info); }
.priority svg { width:12px; height:12px; }
.card-title { font-size:12px; line-height:1.45; font-weight:500; color:var(--text-primary); margin-bottom:14px; }
.card-meta, .labels { display:flex; gap:5px; flex-wrap:wrap; align-items:center; }
.label-chip { border-radius:4px; background:var(--surface-3); padding:3px 6px; font-size:10px; color:var(--text-secondary); display:inline-flex; gap:5px; align-items:center; max-width:150px; }
.label-chip span:last-child { white-space:nowrap; text-overflow:ellipsis; overflow:hidden; }
.label-dot { width:6px; height:6px; }
.assignee { margin-left:auto; font-size:10px; border:1px solid var(--border-strong); color:var(--text-secondary); border-radius:999px; width:23px; height:23px; display:grid; place-items:center; }
.status-chip { display:inline-flex; align-items:center; gap:6px; background:color-mix(in srgb, var(--category) 13%, transparent); border-radius:4px; padding:3px 6px; margin-bottom:10px; }
.status-key { font-size:9px; letter-spacing:.08em; color:var(--text-secondary); }
.state-banner { max-width:520px; margin:24px 0; }
.skeleton-col { min-height:300px; }
.skeleton-card { height:98px; margin:8px; padding:16px; border:1px solid var(--border); border-radius:6px; background:var(--surface-2); }
.skeleton-card .loading-bar { margin-top:16px; }

/* Graphite dark. Keep after Signal light. */
:root[data-register="graphite"] {
  color-scheme:dark;
  --bg:#0c0c10; --surface-1:#121218; --surface-2:#17171f; --surface-3:#262633;
  --surface-hover:#1d1d27; --surface-selected:#262633;
  --text-primary:#ebebf2; --text-secondary:#9d9db0; --text-tertiary:#7a7a8f;
  --border:#262633; --border-strong:#2f2f3d; --border-subtle:#1a1a22;
  --accent:#635bff; --accent-text:#a5a0ff; --accent-quiet:rgb(99 91 255 / .14);
  --accent-ink:#ffffff; --ring-focus:#a5a0ff;
  --info:#00d4ff; --info-quiet:rgb(0 212 255 / .14);
  --warn:#ffb020; --warn-quiet:rgb(255 176 32 / .14);
  --success:#3ecf8e; --success-quiet:rgb(62 207 142 / .14);
  --danger:#ff5996; --danger-quiet:rgb(255 89 150 / .14);
  --cat-1:#635bff; --cat-2:#00d4ff; --cat-3:#9966ff; --cat-4:#ffb020;
  --cat-5:#3ecf8e; --cat-6:#0a84ff; --cat-7:#ff5996; --cat-8:#7a7a8f;
  --chart-grid:#262633; --chart-track:#2f2f3d;
  --sweep:linear-gradient(90deg,#00d4ff 0%,#635bff 38%,#ff5996 70%,#ffb020 100%);
  --grain-color:rgb(190 190 215 / .05);
}
:root[data-register="graphite"] body::before {
  content:""; position:fixed; top:0; left:0; right:0; height:3px; z-index:10; background:var(--sweep);
}
:root[data-register="graphite"] .page-header.view-enter::after { animation:wipe 640ms ease-out both; }
:root[data-register="graphite"] .page-header.view-enter .eyebrow,
:root[data-register="graphite"] .page-header.view-enter h1,
:root[data-register="graphite"] .page-header.view-enter .header-meta { animation:rise 420ms ease-out both; }
:root[data-register="graphite"] .page-header h1 { animation-delay:60ms; }
:root[data-register="graphite"] .page-header .header-meta { animation-delay:120ms; }
:root[data-register="graphite"] .card { border-top:1px solid var(--category,var(--cat-8)); }
@keyframes wipe { from { transform:scaleX(0); } to { transform:scaleX(1); } }
@keyframes rise { from { transform:translateY(6px); } to { transform:translateY(0); } }

/* Graphite light */
:root[data-register="graphite"][data-theme="light"] {
  color-scheme:light;
  --bg:#f7f7fa; --surface-1:#ffffff; --surface-2:#f7f7fa; --surface-3:#eeeef3;
  --surface-hover:#fafafc; --surface-selected:#eeeef3;
  --text-primary:#121218; --text-secondary:#55556a; --text-tertiary:#55556a;
  --border:#e0e0e8; --border-strong:#cfcfda; --border-subtle:#eeeef3;
  --accent:#635bff; --accent-text:#4b44d1; --accent-quiet:rgb(99 91 255 / .10);
  --accent-ink:#ffffff; --ring-focus:#4b44d1;
  --info:#0086a8; --info-quiet:rgb(0 134 168 / .12);
  --warn:#a8660a; --warn-quiet:rgb(168 102 10 / .12);
  --success:#1c8a5a; --success-quiet:rgb(28 138 90 / .12);
  --danger:#d0306e; --danger-quiet:rgb(208 48 110 / .12);
  --cat-1:#635bff; --cat-2:#0086a8; --cat-3:#7650d5; --cat-4:#a8660a;
  --cat-5:#1c8a5a; --cat-6:#0a68c2; --cat-7:#d0306e; --cat-8:#55556a;
  --chart-grid:#e4e4ec; --chart-track:#e4e4ec; --grain-color:transparent;
}

@media (max-width:1000px) {
  .summary-stats { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .summary-grid { grid-template-columns:1fr; }
}
@media (max-width:760px) {
  .sidebar { width:56px; flex-basis:56px; }
  .brand { padding:0; justify-content:center; height:148px; }
  .wordmark { font-size:9px; letter-spacing:-.05em; writing-mode:vertical-rl; transform:rotate(180deg); }
  .sidebar-nav { padding:20px 5px; }
  .nav-group { font-size:0; padding:0; height:14px; }
  .nav-group:not(:first-child) { padding-top:14px; height:34px; }
  .nav-button { justify-content:center; padding:0; width:44px; height:42px; }
  .nav-label { display:none; }
  .nav-glyph { width:auto; flex:none; font-size:12px; }
  .sidebar-footer { padding:10px 5px; }
  .footer-label { font-size:0; margin-bottom:5px; }
  .footer-controls { flex-direction:column; align-items:center; gap:6px; }
  .theme-btn { width:36px; }
  .register-control { flex-direction:column; width:36px; flex:none; align-items:center; }
  .register-btn { width:30px; flex:none; height:30px; font-size:0; }
  .register-btn span { display:none; }
  #registerSignal::after { content:"S"; font-size:11px; }
  #registerGraphite::after { content:"G"; font-size:11px; }
  .page-header { min-height:132px; padding:24px 18px 18px; align-items:flex-start; flex-direction:column; gap:12px; }
  .page-header::after { left:18px; right:18px; }
  .page-header h1 { font-size:24px; }
  .header-actions { width:100%; justify-content:space-between; }
  .view { padding:22px 16px 35px; }
  #boardView { padding-right:0; }
  .board-scroll { padding-right:16px; }
  .summary-hero { align-items:flex-start; flex-direction:column; gap:5px; }
  .column-body { max-height:calc(100dvh - 230px); }
}
@media (max-width:440px) {
  .summary-stats { gap:7px; }
  .stat-card { min-height:105px; padding:11px; }
  .stat-card .stat-value { font-size:23px; }
  .stat-label { font-size:9px; }
  .summary-hero h2 { font-size:17px; }
  .panel, .summary-section { padding:14px; }
}
@media (prefers-reduced-motion:reduce) {
  *, *::before, *::after { animation:none !important; transition:none !important; scroll-behavior:auto !important; }
}
@media print {
  :root, :root[data-theme="light"], :root[data-register="graphite"], :root[data-register="graphite"][data-theme="light"] {
    color-scheme:light;
    --bg:#f7f7fa; --surface-1:#ffffff; --surface-2:#f7f7fa; --surface-3:#eeeef3;
    --surface-hover:#fafafc; --surface-selected:#eeeef3;
    --text-primary:#121218; --text-secondary:#55556a; --text-tertiary:#55556a;
    --border:#e0e0e8; --border-strong:#cfcfda; --border-subtle:#eeeef3;
    --accent:#4b44d1; --accent-text:#4b44d1; --chart-track:#e4e4ec; --grain-color:transparent; --sweep:none;
  }
  :root[data-register="graphite"] body::before { display:none; }
  .sidebar, .header-actions { display:none; }
  .page-header, .view { padding:12px 0; }
  .column-body { max-height:none; overflow:visible; }
  .board-scroll { overflow:visible; }
}