/* ============================================================
   TPMS Brain — Stylesheet
   Adapted from the canonical design reference (design-reference.html)
   Brand: Cherry red + Black sidebar, warm beige canvas
   Font: Inter (loaded via Google Fonts in HTML)
   ============================================================ */

/* ===========================================================
     TPMS Brain — design language adapted from concept-a-v2.1
     Brand: Cherry red (#b8002b) + Black sidebar, warm beige canvas
     =========================================================== */
  :root {
    /* Brand — cherry red replaces claret */
    --cherry:       #b8002b;
    --cherry-deep:  #8a001f;
    --cherry-soft:  #d4334e;
    --cherry-bg:    #fce9ee;
    --cherry-mid:   #e8a8b3;

    /* Surfaces */
    --paper:  #ffffff;
    --card:   #ffffff;
    --bg:     #f3ecd6;     /* warm beige canvas */
    --bg-2:   #ece4cf;

    /* Ink */
    --ink:        #1a1410;
    --ink-mid:    #57534e;
    --ink-soft:   #78716c;
    --muted:      #a8a29e;
    --line:       #e4d9bb;
    --line-soft:  #efe7cf;

    /* Pastels — used for tinted cards + pill backgrounds */
    --mint-bg:   #ebf5f0;  --mint-fg:   #2d7a56;  --mint:   #a8d9c0;
    --peach-bg:  #fef1e8;  --peach-fg:  #ad4e1a;  --peach:  #f5c4a2;
    --lilac-bg:  #f1ecfb;  --lilac-fg:  #5e3b8c;  --lilac:  #c9baea;
    --sky-bg:    #eaf4fb;  --sky-fg:    #2d6a8f;  --sky:    #a9cde3;
    --butter-bg: #fdf5df;  --butter-fg: #7a5210;  --butter: #f2d98a;
    --sage-bg:   #ecf3e8;  --sage-fg:   #3a5728;  --sage:   #bacdb4;
    --rose-bg:   #fbe9ec;  --rose-fg:   #8a2c2e;  --rose:   #f1b8be;

    /* Semantic */
    --good:   #3d8b5e;
    --warn:   #c07a28;
    --block:  #ba4244;
    --info:   #3570a0;

    /* Sidebar — pure TPMS black */
    --sb-bg:        #0a0a0a;
    --sb-bg-2:      #1a1a1a;
    --sb-ink:       rgba(255,255,255,0.88);
    --sb-muted:     rgba(255,255,255,0.46);
    --sb-line:      rgba(255,255,255,0.08);
    --sb-active-bg: rgba(255,255,255,0.10);
    --sb-hover-bg:  rgba(255,255,255,0.06);
    --sb-label:     rgba(255,255,255,0.34);

    /* Layout */
    --sb-w:   240px;
    --top-h:  56px;
    --r-sm:   10px;
    --r-md:   14px;
    --r-lg:   18px;
    --r-pill: 999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,.05), 0 1px 5px rgba(0,0,0,.05);
    --shadow:    0 2px 8px rgba(0,0,0,.07), 0 8px 24px rgba(0,0,0,.06);
    --shadow-lg: 0 8px 32px rgba(0,0,0,.14), 0 2px 8px rgba(0,0,0,.08);

    /* Type */
    --font:  'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --mono:  ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

    /* Compatibility shims for older class references */
    --black:        var(--sb-bg);
    --black-soft:   var(--sb-bg-2);
    --black-line:   rgba(255,255,255,0.08);
    --beige:        var(--bg);
    --beige-soft:   #f8f1de;
    --beige-card:   var(--paper);
    --beige-deep:   var(--bg-2);
    --text:         var(--ink);
    --text-muted:   var(--ink-soft);
    --text-dim:     var(--muted);
    --text-on-dark: var(--sb-ink);
    --text-dim-on-dark: var(--sb-muted);
    --line-soft:    var(--line-soft);
    --ok:           var(--good);
    --ok-bg:        var(--mint-bg);
    --risk:         var(--block);
    --risk-bg:      var(--rose-bg);
    --warn-bg:      var(--butter-bg);
    --info-bg:      var(--sky-bg);
    --neutral-bg:   #eee5cc;
    --cherry-dark:  var(--cherry-deep);
    --cherry-light: var(--cherry-soft);
    --cherry-fade:  rgba(184,0,43,0.08);
    --cherry-fade2: rgba(184,0,43,0.16);
    --font-sans:    var(--font);
    --font-mono:    var(--mono);
    --font-serif:   var(--font); /* concept doesn't use serif */
    --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px;
    --s-5: 20px; --s-6: 24px; --s-7: 32px; --s-8: 40px;
    --s-9: 56px; --s-10: 80px;
    --sidebar-w: var(--sb-w);
    --topbar-h:  var(--top-h);
  }

  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  html, body { height: 100%; }
  body {
    font-family: var(--font);
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }
  a { color: var(--cherry); text-decoration: none; }
  a:hover { color: var(--cherry-deep); text-decoration: underline; }
  button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
  ::selection { background: var(--cherry); color: #fff; }

  /* =============================================================
     TOPBAR
     ============================================================= */
  .topbar {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--top-h);
    background: rgba(255,255,255,.94);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
    display: flex; align-items: center;
    padding: 0 24px;
    gap: 14px;
    z-index: 50;
  }
  .brand {
    display: flex; align-items: center; gap: 10px;
    width: calc(var(--sb-w) - 24px);
    padding-right: 12px;
  }
  .brand-mark {
    width: 30px; height: 30px;
    border-radius: 8px;
    background: linear-gradient(140deg, var(--cherry) 0%, var(--cherry-deep) 100%);
    color: #fff;
    display: grid; place-items: center;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: -0.02em;
    box-shadow: 0 1px 4px rgba(184,0,43,.35);
  }
  .brand-name {
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--ink);
  }
  .brand-name .accent { color: var(--cherry); }

  .topbar-search {
    flex: 1; max-width: 480px;
    margin: 0 16px 0 8px;
    position: relative;
  }
  .topbar-search input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--ink);
    padding: 7px 12px 7px 32px;
    border-radius: 8px;
    font-size: 12.5px;
    font-family: var(--font);
    outline: none;
  }
  .topbar-search input::placeholder { color: var(--muted); }
  .topbar-search input:focus { border-color: var(--cherry-soft); box-shadow: 0 0 0 3px rgba(184,0,43,.08); }
  .topbar-search::before {
    content: "⌕";
    position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
    color: var(--muted);
    font-size: 14px;
  }

  .topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
  .topbar-action {
    height: 32px;
    border-radius: 8px;
    padding: 0 10px;
    background: transparent;
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 500;
    display: inline-flex; align-items: center; gap: 6px;
  }
  .topbar-action:hover { background: var(--bg); color: var(--ink); }
  .topbar-badge {
    background: var(--cherry); color: #fff;
    font-size: 10px; font-weight: 700;
    padding: 1px 6px; border-radius: 999px;
    line-height: 1.4;
  }
  .topbar-user {
    display: flex; align-items: center; gap: 8px;
    padding-left: 12px; margin-left: 4px;
    border-left: 1px solid var(--line);
  }
  .topbar-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: linear-gradient(140deg, var(--cherry), var(--cherry-deep));
    color: #fff; display: grid; place-items: center;
    font-weight: 700; font-size: 10.5px;
    box-shadow: 0 1px 3px rgba(184,0,43,.3);
  }
  .topbar-user-name { color: var(--ink); font-size: 12.5px; font-weight: 600; line-height: 1.2; }
  .topbar-user-role { color: var(--muted); font-size: 10.5px; line-height: 1.3; }

  /* =============================================================
     SIDEBAR
     ============================================================= */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sb-w);
    background: var(--sb-bg);
    color: var(--sb-ink);
    overflow-y: auto;
    padding: var(--top-h) 8px 80px;
    z-index: 40;
    scrollbar-width: none;
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .sidebar-section {
    padding: 16px 10px 6px;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--sb-label);
  }
  .sidebar-section:first-of-type { padding-top: 14px; }
  .nav-item {
    display: flex; align-items: center; gap: 9px;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 400;
    color: var(--sb-muted);
    cursor: pointer;
    transition: background .12s, color .12s;
    margin: 1px 0;
  }
  .nav-item:hover { background: var(--sb-hover-bg); color: var(--sb-ink); }
  .nav-item.active {
    background: var(--sb-active-bg);
    color: #fff;
    font-weight: 600;
  }
  .nav-item .icon {
    width: 16px; height: 16px;
    display: grid; place-items: center;
    color: var(--sb-muted);
    flex-shrink: 0;
    font-size: 13px;
    opacity: .85;
  }
  .nav-item.active .icon { color: var(--cherry-soft); opacity: 1; }
  .nav-count {
    margin-left: auto;
    background: var(--sb-active-bg);
    color: var(--sb-muted);
    padding: 1px 7px; border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    text-align: center;
  }
  .nav-item.active .nav-count {
    background: var(--cherry); color: #fff;
  }

  /* =============================================================
     MAIN
     ============================================================= */
  .main {
    margin-left: var(--sb-w);
    margin-top: var(--top-h);
    min-height: calc(100vh - var(--top-h));
    padding: 24px 28px 72px;
    max-width: calc(1280px + 28px + 28px);
    background: var(--bg);
  }
  .page { display: none; }
  .page.active { display: block; animation: fadeUp .25s ease; }
  @keyframes fadeUp { from { opacity:0; transform:translateY(5px); } to { opacity:1; transform:none; } }

  /* =============================================================
     HERO + AI BRAIN  (concept lilac AI panel)
     ============================================================= */
  .hero {
    background:
      radial-gradient(ellipse 700px 160px at 100% 0%, rgba(232,168,179,.22) 0%, transparent 70%),
      radial-gradient(ellipse 500px 120px at 0% 120%, rgba(252,233,238,.30) 0%, transparent 70%),
      #ffffff;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 22px 24px 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
  }
  .hero-eyebrow {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--cherry);
    text-transform: uppercase;
    margin-bottom: 6px;
  }
  .hero h1 {
    font-family: var(--font);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--ink);
    margin: 0 0 4px;
  }
  .hero-sub {
    font-size: 13px;
    color: var(--ink-soft);
    margin: 0 0 14px;
    max-width: 760px;
  }
  .ai-brain {
    background: var(--lilac-bg);
    border: 1px solid rgba(201,186,234,.6);
    border-radius: var(--r-md);
    padding: 13px 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
  }
  .ai-brain-icon {
    width: 26px; height: 26px;
    border-radius: 7px;
    background: linear-gradient(135deg, var(--lilac-fg), #9b6fcc);
    color: #fff;
    display: grid; place-items: center;
    font-size: 13px;
    flex-shrink: 0;
  }
  .ai-brain-body { flex: 1; min-width: 0; }
  .ai-brain-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--lilac-fg);
    text-transform: uppercase;
    margin-bottom: 4px;
  }
  .ai-brain-content {
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--ink-mid);
  }
  .ai-brain-content strong { color: var(--ink); font-weight: 650; }
  .ai-brain-actions {
    display: flex; gap: 6px; flex-wrap: wrap;
    margin-top: 10px;
  }
  .ai-brain-action {
    background: rgba(255,255,255,.7);
    color: var(--lilac-fg);
    border: 1px solid rgba(94,59,140,.18);
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 999px;
    font-family: var(--font);
  }
  .ai-brain-action:hover {
    background: var(--lilac-fg); color: #fff; border-color: var(--lilac-fg);
  }

  /* =============================================================
     BUTTONS
     ============================================================= */
  .btn-primary, .btn-secondary, .btn-ghost {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 16px;
    font-size: 12px; font-weight: 600;
    border-radius: 999px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background .12s, opacity .12s;
    line-height: 1.4;
    font-family: var(--font);
    white-space: nowrap;
  }
  .btn-primary { background: var(--cherry); color: #fff; }
  .btn-primary:hover { background: var(--cherry-deep); }
  .btn-secondary {
    background: var(--card); color: var(--ink); border-color: var(--line);
  }
  .btn-secondary:hover { background: var(--bg); }
  .btn-ghost { background: transparent; color: var(--cherry); }
  .btn-ghost:hover { background: var(--cherry-bg); }
  .btn-sm { padding: 5px 12px; font-size: 11px; }

  .card-action {
    color: var(--cherry);
    font-size: 12px;
    font-weight: 600;
    background: none; border: none; padding: 0;
    cursor: pointer;
    font-family: var(--font);
  }
  .card-action:hover { text-decoration: underline; }

  /* =============================================================
     SECTION HEAD
     ============================================================= */
  .section-head {
    display: flex; align-items: center; justify-content: space-between;
    margin: 22px 0 12px;
    gap: 12px;
  }
  .section-head h2 {
    font-family: var(--font);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.09em;
    color: var(--muted);
    text-transform: uppercase;
    margin: 0;
  }
  .section-head .actions { display: flex; gap: 10px; align-items: center; }

  /* =============================================================
     CARDS + GRID
     ============================================================= */
  .grid { display: grid; gap: 14px; }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); gap: 10px; }
  .grid-2-1 { grid-template-columns: 2fr 1fr; }
  .grid-1-2 { grid-template-columns: 1fr 2fr; }

  .card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 16px;
    box-shadow: var(--shadow-sm);
  }
  .card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line-soft);
    gap: 10px;
  }
  .card-title {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0;
  }
  .card-title .dot {
    display: inline-block; width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--cherry);
    margin-right: 7px;
    vertical-align: middle;
  }

  /* =============================================================
     KPI TILES (.stat)
     ============================================================= */
  .stat {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 14px 16px 13px;
    box-shadow: var(--shadow-sm);
    transition: transform .15s, box-shadow .15s;
    position: relative;
  }
  .stat:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
  .stat-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 8px;
  }
  .stat-value {
    font-family: var(--font);
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.04em;
    color: var(--ink);
    line-height: 1;
    margin-bottom: 6px;
  }
  .stat-delta {
    font-size: 11px;
    font-weight: 500;
    display: inline-flex; align-items: center; gap: 4px;
  }
  .stat-delta.up { color: var(--good); font-weight: 600; }
  .stat-delta.down { color: var(--block); font-weight: 600; }
  .stat-delta.flat { color: var(--muted); }
  .stat-spark {
    position: absolute; top: 14px; right: 14px;
    width: 60px; height: 22px;
    opacity: 0.6;
  }

  /* =============================================================
     PILLS  (pastel palette from concept)
     ============================================================= */
  .pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
    background: var(--bg);
    color: var(--ink-soft);
    border: 1px solid var(--line);
  }
  .pill.ok    { background: var(--mint-bg);   color: var(--mint-fg);   border-color: rgba(45,122,86,.18); }
  .pill.warn  { background: var(--butter-bg); color: var(--butter-fg); border-color: rgba(122,82,16,.18); }
  .pill.risk  { background: var(--rose-bg);   color: var(--block);     border-color: rgba(186,66,68,.20); }
  .pill.info  { background: var(--sky-bg);    color: var(--sky-fg);    border-color: rgba(45,106,143,.18); }
  .pill.cherry { background: var(--cherry-bg); color: var(--cherry);   border-color: rgba(184,0,43,.18); }
  .pill.dark  { background: var(--ink);       color: #fff;             border-color: var(--ink); }
  .pill.dot::before {
    content: ""; width: 5px; height: 5px; border-radius: 50%;
    background: currentColor; opacity: .7;
  }
  .pill.small { font-size: 10px; padding: 1px 7px; }

  .pill-handler {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px; font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
  }
  .pill-handler.ai  { background: var(--lilac-bg); color: var(--lilac-fg); border: 1px solid rgba(94,59,140,.18); }
  .pill-handler.you { background: var(--peach-bg); color: var(--peach-fg); border: 1px solid rgba(173,78,26,.18); }

  /* =============================================================
     TABLES
     ============================================================= */
  .data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
  }
  .data-table thead th {
    text-align: left;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.07em;
    color: var(--muted);
    text-transform: uppercase;
    padding: 9px 14px 8px;
    border-bottom: 2px solid var(--line);
    background: transparent;
  }
  .data-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
    color: var(--ink);
  }
  .data-table tbody tr:last-child td { border-bottom: none; }
  .data-table tbody tr:hover td { background: var(--bg); }
  .data-table .num { font-variant-numeric: tabular-nums; text-align: right; }
  .data-table .mono { font-family: var(--mono); font-size: 12px; }

  /* =============================================================
     TABS
     ============================================================= */
  .tabs {
    display: flex; gap: 2px;
    border-bottom: 2px solid var(--line);
    margin-bottom: 16px;
    padding-bottom: 0;
    flex-wrap: wrap;
  }
  .tab {
    background: none; border: none;
    padding: 8px 14px;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    margin-bottom: -2px;
    transition: color .12s;
    font-family: var(--font);
  }
  .tab:hover { color: var(--ink); }
  .tab.active {
    color: var(--ink);
    border-bottom-color: var(--cherry);
    font-weight: 650;
  }
  .tab-panel { display: none; }
  .tab-panel.active { display: block; animation: fadeUp .2s ease; }

  /* =============================================================
     KANBAN
     ============================================================= */
  .kanban {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
  }
  .kanban-col {
    background: rgba(255,255,255,0.5);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 12px;
    min-height: 200px;
  }
  .kanban-col-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--cherry);
  }
  .kanban-col-head h4 {
    margin: 0;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink);
  }
  .kanban-col-count {
    background: var(--cherry); color: #fff;
    font-size: 10px; font-weight: 700;
    padding: 1px 7px; border-radius: 999px;
  }
  .kanban-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: border-color .12s, box-shadow .12s, transform .12s;
    box-shadow: var(--shadow-sm);
  }
  .kanban-card:hover {
    transform: translateY(-1px);
    border-color: var(--cherry-mid);
    box-shadow: var(--shadow);
  }
  .kanban-card-title {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 4px;
    line-height: 1.3;
  }
  .kanban-card-meta {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 10.5px;
    color: var(--muted);
  }
  .kanban-card-tags {
    display: flex; gap: 4px; flex-wrap: wrap;
    margin-top: 6px;
  }

  /* =============================================================
     CALENDAR
     ============================================================= */
  .calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
  }
  .cal-head {
    background: var(--ink);
    color: rgba(255,255,255,.85);
    padding: 6px 10px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    text-align: center;
    border-radius: 6px;
  }
  .cal-cell {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 10px 12px;
    min-height: 92px;
  }
  .cal-cell.muted { background: var(--bg); opacity: 0.55; }
  .cal-cell.today {
    background: var(--cherry-bg);
    border-color: var(--cherry-mid);
  }
  .cal-date {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 6px;
    color: var(--ink);
  }
  .cal-cell.today .cal-date { color: var(--cherry); }
  .cal-event {
    background: var(--lilac-bg); color: var(--lilac-fg);
    border-radius: 5px;
    padding: 3px 7px;
    font-size: 10.5px;
    font-weight: 500;
    margin-bottom: 3px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .cal-event.record { background: var(--butter-bg); color: var(--butter-fg); }
  .cal-event.release { background: var(--cherry-bg); color: var(--cherry); }
  .cal-event.social { background: var(--sky-bg); color: var(--sky-fg); }

  /* =============================================================
     METER
     ============================================================= */
  .meter {
    background: var(--line-soft);
    height: 4px;
    border-radius: 999px;
    overflow: hidden;
  }
  .meter-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--cherry-mid), var(--cherry));
    border-radius: 999px;
    transition: width .5s ease;
  }
  .meter-fill.ok { background: linear-gradient(90deg, var(--mint), var(--mint-fg)); }
  .meter-fill.warn { background: linear-gradient(90deg, var(--butter), var(--butter-fg)); }

  /* =============================================================
     CHECKLIST
     ============================================================= */
  .checklist { list-style: none; padding: 0; margin: 0; }
  .checklist li {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--line-soft);
    font-size: 12.5px;
  }
  .checklist li:last-child { border-bottom: none; }
  .checklist .check {
    width: 16px; height: 16px;
    border-radius: 4px;
    border: 1.5px solid var(--line);
    background: var(--card);
    display: grid; place-items: center;
    color: transparent;
    font-size: 11px;
    flex-shrink: 0;
  }
  .checklist li.done .check {
    background: var(--good);
    border-color: var(--good);
    color: #fff;
  }
  .checklist li.done span { color: var(--muted); text-decoration: line-through; }
  .checklist li.locked .check { opacity: 0.4; }
  .check::before { content: "✓"; }
  .checklist-owner {
    margin-left: auto;
    font-size: 10.5px;
    color: var(--muted);
  }

  /* =============================================================
     WORK BLOCKS
     ============================================================= */
  .work-block {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 14px 16px;
    margin-bottom: 6px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 14px;
    align-items: start;
    cursor: pointer;
    transition: border-color .12s, box-shadow .12s;
    box-shadow: var(--shadow-sm);
  }
  .work-block:hover { border-color: var(--cherry-mid); box-shadow: var(--shadow); }
  .work-block.risk { border-left: 3px solid var(--block); }
  .work-block.stalled { border-left: 3px solid var(--warn); }
  .work-block-title {
    font-weight: 600; font-size: 13px;
    color: var(--ink);
    margin-bottom: 4px;
  }
  .work-block-meta {
    font-size: 11px; color: var(--muted);
    display: flex; gap: 12px; flex-wrap: wrap;
  }
  .work-block-flags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }

  /* =============================================================
     AGENT CARDS
     ============================================================= */
  .agent-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    overflow: hidden;
    display: flex; flex-direction: column;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .2s;
  }
  .agent-card:hover { box-shadow: var(--shadow); }
  .agent-hero {
    background: linear-gradient(135deg, var(--sb-bg) 0%, var(--cherry-deep) 100%);
    color: #fff;
    padding: 18px 20px 16px;
  }
  .agent-name {
    font-family: var(--font);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0 0 4px;
  }
  .agent-tag {
    font-size: 10px; font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--cherry-soft);
    text-transform: uppercase;
  }
  .agent-body { padding: 16px 20px; flex: 1; display: flex; flex-direction: column; }
  .agent-section {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--muted);
    text-transform: uppercase;
    margin: 14px 0 7px;
  }
  .agent-section:first-child { margin-top: 0; }
  .agent-list { padding-left: 16px; margin: 0; font-size: 12.5px; color: var(--ink-soft); line-height: 1.55; }
  .agent-list li { margin-bottom: 4px; }

  /* =============================================================
     ACTIVITY FEED
     ============================================================= */
  .activity { padding: 0; margin: 0; list-style: none; }
  .activity li {
    display: grid;
    grid-template-columns: 14px 1fr auto;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line-soft);
    font-size: 12.5px;
  }
  .activity li:last-child { border-bottom: none; }
  .activity-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--cherry);
    margin-top: 6px;
  }
  .activity-dot.ai { background: var(--lilac-fg); }
  .activity-dot.ok { background: var(--good); }
  .activity-time { font-size: 11px; color: var(--muted); white-space: nowrap; }

  /* =============================================================
     CHART
     ============================================================= */
  .chart-svg { width: 100%; display: block; }

  /* =============================================================
     HELPERS
     ============================================================= */
  .row { display: flex; gap: 12px; align-items: center; }
  .row.spread { justify-content: space-between; }
  .stack { display: flex; flex-direction: column; gap: 8px; }
  .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
  .mt-5 { margin-top: 20px; } .mt-6 { margin-top: 24px; }
  .text-muted { color: var(--ink-soft); }
  .text-dim { color: var(--muted); }
  .text-cherry { color: var(--cherry); }
  .small { font-size: 11.5px; }
  .num-big { font-family: var(--font); font-size: 22px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
  .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .avatar {
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--cherry); color: #fff;
    display: inline-grid; place-items: center;
    font-size: 10.5px; font-weight: 700;
    flex-shrink: 0;
  }
  .avatar.curt    { background: var(--mint-fg); }
  .avatar.chelsea { background: var(--butter-fg); }
  .avatar.alec    { background: var(--sky-fg); }
  .avatar.peter   { background: var(--cherry); }
  .avatar.lg { width: 34px; height: 34px; font-size: 12px; }

  /* =============================================================
     DOC PANEL
     ============================================================= */
  .doc {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 22px 26px;
    font-family: var(--font);
    line-height: 1.6;
    max-height: 540px;
    overflow-y: auto;
  }
  .doc h3 { margin: 0 0 8px; font-size: 18px; font-weight: 700; letter-spacing: -0.015em; }
  .doc h4 { font-size: 13px; margin: 18px 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--line-soft); font-weight: 700; }
  .doc p { font-size: 13px; color: var(--ink); margin: 10px 0; }
  .doc ul { padding-left: 18px; }
  .doc li { margin-bottom: 5px; font-size: 13px; }

  /* =============================================================
     LOGO TILE
     ============================================================= */
  .logo-tile {
    width: 40px; height: 40px;
    background: var(--ink); color: var(--cherry-soft);
    border-radius: 8px;
    display: grid; place-items: center;
    font-weight: 800; font-size: 13px;
    letter-spacing: -0.02em;
    flex-shrink: 0;
  }

  /* =============================================================
     EMPTY / SCROLLBAR
     ============================================================= */
  .empty { padding: 40px; text-align: center; color: var(--muted); font-style: italic; }
  ::-webkit-scrollbar { width: 8px; height: 8px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
  ::-webkit-scrollbar-thumb:hover { background: var(--cherry-mid); }
