:root {
  /* Colours are the vialytics design-system ramps (@vialytics/ui-components,
     src/index.css), mapped through its dark theme:
       surface-default  dark-blue-1400   page
       surface-elevated dark-blue-1200   cards
       surface-raised   dark-blue-1000   inputs and inset rows
       text-default     dark-blue-200
       text-subdued     dark-blue-500
     The accent is the brand yellow the logo is built from, so anything sitting
     on it takes dark ink rather than white — same relationship as the mark. */
  --bg: #0b0d0e;              /* dark-blue-1400 */
  --surface: #191e24;         /* dark-blue-1200 */
  --surface-2: #222d39;       /* dark-blue-1000 */
  --border: #303d48;          /* dark-blue-900  */
  --border-strong: #3f4d5c;   /* dark-blue-800  */
  --text: #eff0f0;            /* dark-blue-200  */
  --muted: #9aa1a9;           /* dark-blue-600  */

  --accent: #fbd400;          /* yellow-600 — the brand yellow */
  --accent-ink: #13171b;      /* dark-blue-1300, for text on the accent */
  --accent-soft: rgba(251, 212, 0, .12);
  --accent-2: #3ccebd;        /* bianchi-green-600, the secondary brand hue */

  --good: #6dd07f;            /* green-600      */
  --warn: #ff9d5d;            /* orange-500     */
  --bad:  #ff7777;            /* coral-red-500  */

  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.5), 0 8px 24px rgba(0,0,0,.35);
  /* Roboto Flex is the design system's typeface; the stack degrades to the
     system UI font when the webfont cannot be fetched. */
  font-family: "Roboto Flex", Roboto, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* ---------- Header ---------- */
.app-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(11,13,14,.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px 0;
}
.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
/* The mark carries its own yellow disc, so the holder stays transparent. */
.brand-mark {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
}
.brand-mark img { display: block; }
.brand h1 { font-size: 18px; margin: 0; letter-spacing: -.01em; }
.subtitle { margin: 0; color: var(--muted); font-size: 13px; }

.tabs { display: flex; gap: 4px; }
.tab {
  appearance: none; border: none; background: none; cursor: pointer;
  color: var(--muted); font-size: 14px; font-weight: 600;
  padding: 10px 16px; border-bottom: 2px solid transparent;
  display: flex; align-items: center; gap: 8px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-badge {
  background: var(--accent); color: var(--accent-ink); font-size: 12px;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  display: inline-grid; place-items: center;
}

/* ---------- Layout ---------- */
main { max-width: 1100px; margin: 0 auto; padding: 24px; }
.panel { display: none; }
.panel.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.panel-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 18px; flex-wrap: wrap; gap: 12px; }
.panel-head h2 { margin: 0; font-size: 20px; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

/* ---------- Project cards ---------- */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  transition: border-color .15s;
}
.card.included { border-color: var(--accent); }
.card.nice { border-color: var(--warn); }

/* Committed / nice-to-have segmented toggle */
.tier-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.tier-btn {
  appearance: none; border: none; background: var(--surface-2); color: var(--muted);
  font-size: 12px; font-weight: 600; padding: 5px 12px; cursor: pointer;
}
.tier-btn + .tier-btn { border-left: 1px solid var(--border); }
.tier-btn.active { background: var(--accent); color: var(--accent-ink); }
.tier-btn.nice.active { background: var(--warn); color: #1a1204; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card h3 { margin: 0 0 4px; font-size: 16px; }
.notion-link { display: inline-block; font-size: 12px; color: var(--accent); text-decoration: none; font-weight: 600; }
.notion-link:hover { text-decoration: underline; }
.inc-row .notion-link { margin-left: 8px; }
.card .outcome { color: var(--muted); font-size: 13.5px; margin: 0 0 10px; }
.metric {
  font-size: 12.5px; color: var(--text); margin: 0 0 14px; padding: 8px 10px;
  border-left: 2px solid var(--accent); background: var(--surface-2); border-radius: 0 6px 6px 0;
}
.metric-label {
  display: block; text-transform: uppercase; letter-spacing: .04em;
  font-size: 10.5px; color: var(--accent); font-weight: 700; margin-bottom: 3px;
}

.include-toggle {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px; transition: .15s;
}
.slider::before {
  content: ""; position: absolute; height: 16px; width: 16px; left: 2px; top: 2px;
  background: var(--muted); border-radius: 50%; transition: .15s;
}
.switch input:checked + .slider { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(16px); background: #fff; }

/* ---------- Milestone / level control ---------- */
.levels { margin-top: 6px; display: flex; flex-direction: column; gap: 6px; }
.levels-caption { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.level-row.milestone .step { border-radius: 50%; }
.level-row {
  display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 10px;
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); font-size: 13px; cursor: pointer;
}
.lvl-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.lvl-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.level-row .step { margin-top: 1px; }
.level-row .role-chips { margin-top: 0; }
.level-row.on { border-color: var(--accent); background: var(--accent-soft); }
.level-row .step {
  width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; background: var(--surface); border: 1px solid var(--border);
}
.level-row.on .step { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.level-row .lvl-effort { color: var(--muted); font-variant-numeric: tabular-nums; }
.level-row input { accent-color: var(--accent); }

.role-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  font-size: 11.5px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text);
  display: inline-flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.card-total { margin-top: 12px; font-size: 13px; color: var(--muted); }
.card-total b { color: var(--text); }

/* ---------- Capacity tab ---------- */
.cap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.cap-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.cap-card .role-name { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.cap-card .role-name .card-edit { margin-left: auto; }
.cap-desc { font-size: 12px; color: var(--muted); margin-top: 4px; }
.cap-card .big { font-size: 32px; font-weight: 700; margin: 10px 0 2px; font-variant-numeric: tabular-nums; }
.cap-card .big-unit { font-size: 14px; font-weight: 600; color: var(--muted); }
.cap-card .unit { color: var(--muted); font-size: 13px; }
.cap-break { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); }
.cap-break > div { display: flex; justify-content: space-between; }
.cap-break b { color: var(--text); font-variant-numeric: tabular-nums; }
.cap-total {
  margin-top: 20px; padding: 16px 18px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; font-size: 15px;
}
.cap-total b { font-size: 20px; }

/* ---------- Comparison tab ---------- */
.summary-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat.ok .value { color: var(--good); }
.stat.over .value { color: var(--bad); }

.cmp-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cmp-table th, .cmp-table td { padding: 12px 14px; text-align: left; font-size: 14px; }
.cmp-table thead th { background: var(--surface-2); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.cmp-table tbody tr { border-top: 1px solid var(--border); }
.cmp-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.role-cell { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.bar { position: relative; height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.bar > span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; }
.util { font-size: 12px; color: var(--muted); }
.pill { font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.pill.ok { background: rgba(34,197,94,.15); color: var(--good); }
.pill.over { background: rgba(239,68,68,.15); color: var(--bad); }
.pill.stretch { background: rgba(245,158,11,.15); color: var(--warn); }
.stat.warn .value { color: var(--warn); }
.stat .value.over-text { color: var(--bad); }
.count-tag { font-size: 12px; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 1px 8px; margin-left: 6px; vertical-align: middle; }
.count-tag.nice { background: var(--warn); color: #1a1204; }
.remaining-pos { color: var(--good); }
.remaining-neg { color: var(--bad); }

.included-list { margin-top: 24px; }
.included-list h3 { font-size: 15px; margin-bottom: 10px; }
.inc-row {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); margin-bottom: 8px;
}
.inc-row .role-chips { margin-top: 8px; }
.inc-row .lvl-tag { font-size: 12px; color: var(--muted); }

.empty { text-align: center; color: var(--muted); padding: 60px 20px; border: 1px dashed var(--border); border-radius: var(--radius); }

/* ---------- Edit tab ---------- */
.edit-actions { display: flex; gap: 8px; }
.btn {
  appearance: none; cursor: pointer; font-size: 13px; font-weight: 600;
  padding: 7px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text);
}
.btn:hover { border-color: var(--accent); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); }
.btn.ghost { background: none; color: var(--muted); }
.btn.ghost:hover { color: var(--text); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn[disabled]:hover { border-color: var(--border); }

.subtabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.subtab {
  appearance: none; border: none; background: none; cursor: pointer;
  color: var(--muted); font-size: 13.5px; font-weight: 600; padding: 8px 14px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.subtab:hover { color: var(--text); }
.subtab.active { color: var(--text); border-bottom-color: var(--accent); }

.edit-hint { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.edit-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 16px; }
.edit-grid2 label, .edit-full { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.edit-full { margin-bottom: 16px; }

input, textarea, select {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 7px; padding: 7px 9px; font: inherit; font-size: 13px; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
input[type="color"] { padding: 2px; height: 32px; width: 48px; cursor: pointer; }
textarea { resize: vertical; }
/* Drop the native number spinner arrows — plain field only */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.edit-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; }
.edit-table th, .edit-table td { padding: 8px 10px; text-align: left; font-size: 13px; border-top: 1px solid var(--border); }
.edit-table thead th { background: var(--surface-2); color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; border-top: none; }
.edit-table.compact th, .edit-table.compact td { padding: 6px 7px; }
.edit-table input.est { width: 58px; text-align: right; }

.edit-proj { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.edit-proj-head { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.edit-proj-name { font-size: 15px; font-weight: 700; flex: 1; }
.edit-proj-head select { width: auto; }

.btn-add { appearance: none; cursor: pointer; background: var(--surface-2); border: 1px dashed var(--border); color: var(--accent); font-weight: 600; font-size: 13px; padding: 8px 14px; border-radius: 8px; }
.btn-add:hover { border-color: var(--accent); }
.btn-add.sm { padding: 5px 10px; font-size: 12px; }
.btn-del { appearance: none; cursor: pointer; background: none; border: 1px solid var(--border); color: var(--muted); font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 7px; white-space: nowrap; }
.btn-del:hover { border-color: var(--bad); color: var(--bad); }
.btn-del.sm { padding: 2px 8px; }

/* ---------- Load error ---------- */
.load-error { position: fixed; inset: 0; background: var(--bg); display: grid; place-items: center; padding: 24px; }
.load-error[hidden] { display: none; } /* explicit: beats .load-error's display:grid when hidden */
.load-error-card { max-width: 520px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.load-error-card pre, .load-error code { background: var(--surface-2); padding: 2px 6px; border-radius: 6px; font-size: 13px; }
.load-error-card pre { padding: 12px; overflow: auto; }
.err-detail { color: var(--bad); font-size: 12px; font-family: monospace; }

/* ---------------- Scenario bar ---------------- */
.scenario-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.scenario-pick {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
.scenario-pick select {
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  min-width: 180px;
}
.scenario-bar .btn { padding: 6px 12px; font-size: 12px; }
.scenario-bar .btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.save-status {
  font-size: 12px;
  color: var(--muted);
  margin-left: auto;
  min-height: 1em;
}
.save-status.error { color: var(--bad); }

/* ---------------- Quarter status, delivery and accuracy ---------------- */
.status-pill {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.status-planning { color: var(--muted); }
.status-committed { color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.status-closed { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn.primary:hover { filter: brightness(1.08); }
.tab.dimmed { opacity: .55; }

.over { color: var(--bad); }
.under { color: var(--muted); }
.muted-note { color: var(--muted); font-size: 12px; }
.section-title { margin: 28px 0 10px; font-size: 14px; }
.pct-cell { color: var(--muted); font-variant-numeric: tabular-nums; }

.reporter { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.reporter input {
  font: inherit; font-size: 13px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px; width: 150px; flex: 0 0 auto;
}

.delivery-list { display: flex; flex-direction: column; gap: 16px; }
.delivery-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.delivery-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; flex-wrap: wrap; margin-bottom: 12px;
}
.delivery-head h3 { margin: 0 0 6px; font-size: 15px; }
.delivery-head > div:first-child { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.delivery-totals { display: flex; gap: 14px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.delivery-totals b { color: var(--text); font-size: 13px; }

.tier-badge {
  font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted);
}
.tier-badge.committed { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.tier-badge.nice { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }

.ms-status-list { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ms-status-list li { display: flex; align-items: center; gap: 10px; font-size: 13px; flex-wrap: wrap; }
.ms-name { flex: 1; min-width: 140px; }
.ms-effort { color: var(--muted); font-size: 12px; }
/* The base rule stretches every control to 100%; these size to their content. */
.ms-status {
  font: inherit; font-size: 12px; padding: 4px 8px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
  width: auto; flex: 0 0 auto; min-width: 118px;
}
.ms-status.done { color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.ms-status.in_progress { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }

.delivery-table { margin-bottom: 14px; }
.delivery-table .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 6px; }

.log-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.log-form select, .log-form input {
  font: inherit; font-size: 13px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; width: auto;
}
.log-form select[name="role"] { min-width: 170px; }
.log-form input[name="amount"] { width: 120px; }
.log-form input[name="note"] { flex: 1; min-width: 160px; width: auto; }

.entry-log { margin-top: 12px; font-size: 13px; }
.entry-log summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.entry-log ul { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.entry-log li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.entry-amount { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 40px; }
.entry-log .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.entry-note { color: var(--muted); font-style: italic; }
.linklike {
  background: none; border: 0; color: var(--muted); font: inherit; font-size: 12px;
  cursor: pointer; text-decoration: underline; padding: 0;
}
.linklike:hover { color: var(--bad); }

.tiles { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 18px; min-width: 130px; display: flex; flex-direction: column; gap: 4px;
}
.tile-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.tile-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile-unit { font-size: 11px; color: var(--muted); }

.delivered-bar {
  display: inline-block; vertical-align: middle; width: 70px; height: 6px;
  background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-right: 6px;
}
.delivered-bar span { display: block; height: 100%; background: var(--good); }

/* ---------- Sign-in ---------- */
/* An author `display` beats the UA stylesheet's [hidden] rule, so the gate has
   to opt out of its own grid explicitly or it would cover the signed-in app. */
.signin[hidden] { display: none; }
.signin { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.signin-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 36px 32px; max-width: 380px; width: 100%; text-align: center;
}
.signin-card .brand-mark { margin: 0 auto 14px; }
.signin-card h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
.signin-tagline { color: var(--muted); font-size: 13px; margin: 2px 0 18px; }
.signin-sub { color: var(--muted); font-size: 14px; margin: 0 0 22px; }
.signin-btn { display: block; width: 100%; text-align: center; text-decoration: none; padding: 11px 16px; }
.signin-error {
  background: rgba(239,68,68,.12); border: 1px solid var(--bad); color: var(--bad);
  border-radius: 8px; padding: 10px 12px; font-size: 13px; margin: 0 0 18px; text-align: left;
}

/* ---------- Signed-in user ---------- */
.user-chip { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-chip .avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none; overflow: hidden;
  display: grid; place-items: center; background: var(--surface-2);
  border: 1px solid var(--border); font-size: 12px; font-weight: 700; color: var(--muted);
}
.user-chip .avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* ---------- History ---------- */
.history { display: flex; flex-direction: column; gap: 22px; }
.history-date {
  font-size: 12px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .04em; font-weight: 600; margin-bottom: 8px;
}
.history-entries {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.history-entry { display: flex; gap: 14px; padding: 12px 16px; }
.history-entry + .history-entry { border-top: 1px solid var(--border); }
/* A left edge carries the tone, so a discarded baseline is visible at a glance
   without colouring the text itself. */
.history-entry { border-left: 3px solid transparent; }
.history-entry.good { border-left-color: var(--good); }
.history-entry.warn { border-left-color: var(--warn); }
.history-entry.bad  { border-left-color: var(--bad); }
.history-time {
  flex: none; width: 64px; color: var(--muted);
  font-size: 12.5px; font-variant-numeric: tabular-nums; padding-top: 1px;
}
.history-body { min-width: 0; }
.history-line { font-size: 14px; }
.history-meta { margin-top: 3px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.history-action, .history-quarter {
  font-size: 11px; color: var(--muted); border: 1px solid var(--border);
  background: var(--surface-2); border-radius: 999px; padding: 1px 8px;
}

/* ---------- Jump from a project card into the editor ---------- */
.card-edit {
  appearance: none; background: none; border: none; cursor: pointer;
  padding: 0; margin-left: 10px;
  font-size: 12px; font-weight: 600; font-family: inherit;
  color: var(--muted);
}
.card-edit:hover { color: var(--accent); text-decoration: underline; }
.card-edit::after { content: " ↗"; }

/* Arriving at one row among a dozen identical ones needs a clear cue as to
   which was actually opened; a focus ring alone is easy to miss after a scroll.
   The ring is drawn with box-shadow so it costs no layout and cannot nudge the
   very scroll position it is meant to draw attention to. */
.edit-proj.just-opened { animation: just-opened 1.4s ease-out; }
@keyframes just-opened {
  0%, 45% {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 14%, var(--surface));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent), var(--shadow);
  }
  100% {
    border-color: var(--border);
    background: var(--surface);
    box-shadow: 0 0 0 0 transparent, var(--shadow);
  }
}

/* A table row paints nothing itself, so the cells carry the flash. */
tr.just-opened > td { animation: just-opened-cell 1.4s ease-out; }
@keyframes just-opened-cell {
  0%, 45% { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
  100%    { background: transparent; }
}

/* The header is sticky, so an element scrolled to the top of the viewport would
   sit underneath it. This keeps it clear whichever alignment the browser picks. */
.edit-proj, .edit-table tr { scroll-margin-top: 230px; scroll-margin-bottom: 40px; }
