/* ==========================================================================
   Resource Tracker styles
   1. Design tokens (light / dark)      5. Gantt & week grids
   2. Base & layout                     6. Dialogs, forms, lists
   3. Header & navigation               7. Feature views (slide, charts, snapshots)
   4. Buttons, badges, controls         8. Motion   9. Print
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  color-scheme: light;
  --page: #f5f6f8; --surface: #ffffff; --surface-2: #f8f9fb; --surface-3: #f0f2f5;
  --line: #e3e6eb; --line-soft: #eef0f3; --line-strong: #cfd5dd;
  --text: #14181d; --text-2: #4b5563; --muted: #7a8494;
  --accent: #2563eb; --accent-2: #1d4ed8; --accent-soft: #eaf1fe; --focus: rgba(37, 99, 235, .35);
  --header: #0f172a; --header-2: #1e293b; --header-3: #334155; --header-text: #cbd5e1;
  /* Series (entities) – the same colour means the same thing on every tab. Validated for colour-blind separation. */
  --s-committed: #2a78d6; --s-projected: #eb6834; --s-total: #6250d6; --s-allocated: #1baf7a; --s-unalloc: #eda100;
  /* Status (state) – fixed, never used for series; always paired with a shape cue. */
  --st-good: #0ca30c; --st-warn: #fab219; --st-serious: #ec835a; --st-critical: #d03b3b;
  --tint-good: color-mix(in srgb, var(--st-good) 13%, var(--surface));
  --tint-warn: color-mix(in srgb, var(--st-warn) 26%, var(--surface));
  --tint-serious: color-mix(in srgb, var(--st-serious) 24%, var(--surface));
  --tint-critical: color-mix(in srgb, var(--st-critical) 18%, var(--surface));
  --tint-neutral: color-mix(in srgb, var(--accent) 9%, var(--surface));
  --ink-good: #006300; --ink-critical: #b42318; --ink-warn: #8a5a00;
  --today: #e5484d; --grid: #e4e3dd; --axis: #c3c2b7; --hatch: rgba(0, 0, 0, .07);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-md: 0 6px 16px rgba(16, 24, 40, .08);
  --shadow-lg: 0 24px 56px rgba(16, 24, 40, .24);
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px;
  --lblw: 360px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0e1013; --surface: #17191d; --surface-2: #1c1f24; --surface-3: #24272d;
  --line: #2c3037; --line-soft: #22262c; --line-strong: #3b4048;
  --text: #eceef1; --text-2: #b8bfc9; --muted: #8a93a0;
  --accent: #5b9bf0; --accent-2: #7cb0f5; --accent-soft: rgba(91, 155, 240, .15); --focus: rgba(91, 155, 240, .45);
  --header: #0a0b0e; --header-2: #1a1d22; --header-3: #2a2e35; --header-text: #b8bfc9;
  --s-committed: #3987e5; --s-projected: #d95926; --s-total: #9085e9; --s-allocated: #199e70; --s-unalloc: #c98500;
  --tint-good: color-mix(in srgb, var(--st-good) 22%, var(--surface));
  --tint-warn: color-mix(in srgb, var(--st-warn) 26%, var(--surface));
  --tint-serious: color-mix(in srgb, var(--st-serious) 28%, var(--surface));
  --tint-critical: color-mix(in srgb, var(--st-critical) 30%, var(--surface));
  --tint-neutral: color-mix(in srgb, var(--accent) 14%, var(--surface));
  --ink-good: #3fcf3f; --ink-critical: #ff8a8a; --ink-warn: #fab219;
  --today: #f0565b; --grid: #2c2c2a; --axis: #3d3d3a; --hatch: rgba(255, 255, 255, .07);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow-md: 0 6px 16px rgba(0, 0, 0, .45); --shadow-lg: 0 24px 56px rgba(0, 0, 0, .6);
}

/* 2. Base ------------------------------------------------------------------ */
* { box-sizing: border-box; }
body { margin: 0; font: 13px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--page); color: var(--text); transition: background-color .2s, color .2s; }
main { padding: 16px 20px 28px; }
a { color: var(--accent); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; margin-bottom: 14px; box-shadow: var(--shadow-sm); }
.card h2 { margin: 0 0 10px; font-size: 15px; letter-spacing: -.1px; }
.card h3 { margin: 0; font-size: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 11px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: middle; margin-right: 6px; }
.print-head { display: none; }
svg.i { width: 15px; height: 15px; flex: none; vertical-align: -3px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.i.fill { fill: currentColor; stroke: none; }

/* 3. Header & navigation --------------------------------------------------- */
header { display: flex; align-items: center; gap: 10px; padding: 7px 16px; background: var(--header); color: #fff; position: sticky; top: 0; z-index: 20; box-shadow: 0 1px 0 rgba(255,255,255,.04), 0 4px 14px rgba(0,0,0,.18); }
.brand { display: flex; align-items: center; gap: 8px; white-space: nowrap; margin-right: 6px; }
.brand svg { width: 26px; height: 26px; flex: none; }
.brand h1 { font-size: 14px; margin: 0; font-weight: 650; letter-spacing: .1px; }
nav { display: flex; gap: 14px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
nav::-webkit-scrollbar { display: none; }
.ngroup { display: flex; flex-direction: column; gap: 1px; }
.nlabel { font-size: 9px; font-weight: 700; letter-spacing: .9px; text-transform: uppercase; color: #64748b; padding-left: 9px; }
.nbtns { display: flex; gap: 1px; }
nav button { background: transparent; color: var(--header-text); border: 0; padding: 4px 9px; border-radius: var(--r-sm); cursor: pointer; font: inherit; font-size: 13px; white-space: nowrap; transition: background-color .15s, color .15s; }
nav button:hover { background: var(--header-2); color: #fff; }
nav button.active { background: var(--header-3); color: #fff; box-shadow: inset 0 -2px 0 var(--accent); }
header .spacer { flex: 1; }
header .btn { background: var(--header-2); color: #e5e7eb; border-color: var(--header-3); }
header .btn:hover:not(:disabled) { background: var(--header-3); }
header .btn.icon { padding: 4px 7px; }
#syncStatus { font-size: 11px; color: #94a3b8; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
#syncStatus .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
details.menu { position: relative; }
details.menu summary { list-style: none; }
details.menu summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-lg); padding: 5px; z-index: 30; min-width: 290px; }
.menu-pop button { display: flex; gap: 8px; align-items: center; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: var(--r-sm); font: inherit; color: var(--text); cursor: pointer; }
.menu-pop button:hover { background: var(--surface-3); }

@media (max-width: 1440px) { .brand h1 { display: none; } }
@media (max-width: 1240px) { #syncStatus .st-text { display: none; } .nlabel { display: none; } }

/* 4. Buttons, badges, controls --------------------------------------------- */
.btn { font: inherit; display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: var(--r-md); border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; color: var(--text); white-space: nowrap; transition: background-color .15s, border-color .15s, box-shadow .15s; }
.btn:hover:not(:disabled) { background: var(--surface-3); }
.btn:focus-visible, nav button:focus-visible, .seg button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(37,99,235,.25); }
.btn.primary:hover:not(:disabled) { background: var(--accent-2); }
.btn.danger { color: var(--ink-critical); }
.btn.danger:hover:not(:disabled) { background: var(--tint-critical); }
.btn.sm { padding: 2px 8px; font-size: 12px; border-radius: var(--r-sm); }
.btn.sm svg.i { width: 13px; height: 13px; vertical-align: -2px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--surface-3); }
.btn.link { border: 0; background: none; color: var(--accent); padding: 0; }
.btn:disabled { opacity: .45; cursor: default; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.seg button { font: inherit; font-size: 12px; border: 0; background: none; color: var(--text-2); padding: 2px 9px; cursor: pointer; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.badge { display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 999px; font-size: 11px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; border: 1px solid transparent; }
.badge svg.i { width: 11px; height: 11px; }
.badge.warn { background: var(--tint-warn); color: var(--text); }
.badge.warn svg { color: var(--ink-warn); }
.badge.bad { background: var(--tint-critical); color: var(--text); }
.badge.bad svg { color: var(--ink-critical); }
.badge.ok { background: var(--tint-good); color: var(--text); }
.badge.ok svg { color: var(--ink-good); }
.badge.c { background: color-mix(in srgb, var(--s-committed) 14%, var(--surface)); color: var(--text); }
.badge.p { background: color-mix(in srgb, var(--s-projected) 14%, var(--surface)); color: var(--text); }
input, select { font: inherit; padding: 5px 8px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--text); }
input[type=color] { padding: 1px; width: 44px; height: 30px; }
input:focus, select:focus { outline: 2px solid var(--focus); border-color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); }
.empty { padding: 26px; text-align: center; color: var(--muted); }
.empty-state { text-align: center; padding: 34px 20px; }
.empty-state .ico { width: 44px; height: 44px; border-radius: 12px; margin: 0 auto 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.empty-state .ico svg.i { width: 22px; height: 22px; }
.empty-state h3 { margin: 0 0 4px; font-size: 15px; }
.empty-state p { margin: 0 auto 14px; max-width: 460px; color: var(--text-2); }
.chip { display: inline-flex; align-items: center; gap: 2px; padding: 2px 3px 2px 10px; border-radius: 14px; background: var(--accent-soft); color: var(--text); font-size: 12px; }
.chip button { border: 0; background: none; cursor: pointer; color: var(--accent); line-height: 1; padding: 2px 4px; border-radius: 10px; display: inline-flex; }
.chip button:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--header); color: #fff; padding: 9px 15px; border-radius: var(--r-md); font-size: 13px; z-index: 70; box-shadow: var(--shadow-lg); }
.note { padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--r-sm); font-size: 12px; }
.note.warn { background: var(--tint-warn); border-color: color-mix(in srgb, var(--st-warn) 40%, var(--surface)); color: var(--text); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--text-2); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend i { display: inline-block; width: 16px; height: 13px; border-radius: 3px; position: relative; border: 1px solid var(--line); }
.legend i.ser { width: 10px; height: 10px; border: 0; border-radius: 2px; }

/* 5. Gantt & week grids ---------------------------------------------------- */
.toolbar { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; margin-bottom: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 8px 12px; box-shadow: var(--shadow-sm); }
.toolbar .group { display: flex; align-items: center; gap: 6px; padding-right: 12px; border-right: 1px solid var(--line); }
.toolbar .group:last-child { border-right: 0; padding-right: 0; }
.toolbar .lab { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.toolbar-break { flex-basis: 100%; height: 0; }
.card .toolbar { background: none; border: 0; box-shadow: none; padding: 0; }
.gantt-wrap { overflow: auto; max-height: calc(100vh - 210px); border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); position: relative; }
table.gantt { border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.gantt th, .gantt td { height: 22px; padding: 0 2px; text-align: center; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); font-size: 11px; white-space: nowrap; overflow: hidden; font-variant-numeric: tabular-nums; }
.gantt.num-right td:not(.lbl):not(.barcell), .gantt.num-right thead tr.count th:not(.lbl) { text-align: right; padding-right: 5px; }
.gantt thead { position: sticky; top: 0; z-index: 5; }
.gantt thead th { background: var(--surface-2); font-weight: 500; color: var(--text-2); }
.gantt thead th.grp { text-align: left; padding-left: 6px; font-weight: 650; color: var(--text); border-left: 1px solid var(--line-strong); }
.gantt .lbl { position: sticky; left: 0; z-index: 3; background: var(--surface); text-align: left; padding: 0 10px; border-right: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; }
.gantt thead th.lbl { z-index: 6; background: var(--surface-3); font-weight: 600; color: var(--text-2); }
.gantt tr.count th { font-weight: 600; color: var(--text); }
.gantt tr.count th.lbl[data-act] { cursor: pointer; }
.gantt tr.count th.lbl[data-act]:hover { background: color-mix(in srgb, var(--surface-3) 70%, var(--line)); }
.gantt tr.subcount th { font-weight: 500; }
.gantt tr.subcount th.lbl { padding-left: 30px; font-weight: 500; }
.gantt tr.grp-first th { border-top: 2px solid var(--line-strong); }
.gantt tr.hc-total th { font-weight: 650; }
.gantt .ms { border-left: 1px solid var(--line-strong); }
.gantt .now { box-shadow: inset 1px 0 0 color-mix(in srgb, var(--today) 70%, transparent); }
.gantt thead tr:not(.count) th.now { background: color-mix(in srgb, var(--today) 16%, var(--surface-2)); color: var(--text); font-weight: 700; box-shadow: inset 0 -2px 0 var(--today); }
.gantt th .ser { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; vertical-align: 0; }
/* compact metrics strip: tiny bar charts in each week cell */
.gantt tr.strip th { height: 30px; padding: 3px 1px 2px; vertical-align: bottom; }
.gantt tr.strip.rem th { height: 28px; padding: 0 1px; vertical-align: middle; }
.gantt tr.strip th .spark { height: 22px; }
.gantt tr.strip.rem th .dvg { height: 20px; }
.spark { display: flex; flex-direction: column-reverse; justify-content: flex-start; height: 100%; width: 100%; max-width: 22px; margin: 0 auto; position: relative; }
.spark i { display: block; width: 100%; border-radius: 1px; }
.spark i + i { margin-bottom: 1px; }
.spark .cap { position: absolute; left: -3px; right: -3px; height: 0; border-top: 2px solid var(--text-2); border-radius: 1px; opacity: .55; }
.dvg { position: relative; height: 100%; width: 100%; max-width: 22px; margin: 0 auto; }
.dvg::before { content: ''; position: absolute; left: -2px; right: -2px; top: 50%; border-top: 1px solid var(--line-strong); }
.dvg i { position: absolute; left: 0; right: 0; border-radius: 1px; }
.dvg i.pos { bottom: 50%; background: color-mix(in srgb, var(--text-2) 30%, var(--surface)); }
.dvg i.neg { top: 50%; background: var(--st-critical); background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.35) 0 2px, transparent 2px 4px); }
.gantt th .lnk { font-weight: 500; font-size: 11px; color: var(--accent); margin-left: 6px; }
/* project rows */
.gantt tr.prow td { height: 32px; border-bottom-color: var(--line); }
.gantt tr.prow td.lbl { cursor: pointer; font-weight: 600; }
.gantt tr.prow td.lbl:hover, .gantt tr.util td.lbl:hover { background: var(--surface-2); }
.gantt .caret { display: inline-flex; width: 16px; color: var(--muted); }
.gantt .caret svg { width: 13px; height: 13px; transition: transform .18s ease; }
.gantt .caret.open svg { transform: rotate(90deg); }
.gantt .lw { display: flex; align-items: center; gap: 5px; }
.gantt .lw .pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.gantt .lw .swatch { flex: none; margin-right: 2px; }
.gantt .lw .btn.icon { padding: 2px 5px; opacity: .35; transition: opacity .15s; }
.gantt tr:hover .lw .btn.icon, .gantt .lw .btn.icon:focus-visible { opacity: 1; }
.gantt td.barcell { padding: 5px 0; }
.gantt .bar { height: 100%; display: flex; align-items: center; padding: 0 7px; font-size: 11px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-right: 2px solid var(--surface); cursor: grab; user-select: none; transition: filter .15s, box-shadow .15s; }
.gantt .bar:hover { filter: brightness(1.06); box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.gantt .bar.first { border-top-left-radius: 7px; border-bottom-left-radius: 7px; }
.gantt .bar.last { border-top-right-radius: 7px; border-bottom-right-radius: 7px; border-right: 0; }
.gantt .bar.tentative { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.28) 0 5px, transparent 5px 10px) !important; }
.gantt td[data-w] { user-select: none; cursor: cell; }
.gantt td.selr { background: color-mix(in srgb, var(--accent) 28%, var(--surface)) !important; box-shadow: inset 0 0 0 1px var(--accent); }
.drag-ghost { position: absolute; z-index: 2; border: 2px dashed; border-radius: 7px; pointer-events: none; display: flex; align-items: center; padding: 0 8px; font-size: 11px; font-weight: 700; white-space: nowrap; background: color-mix(in srgb, var(--surface) 60%, transparent); }
.dragtip { position: fixed; z-index: 60; background: var(--header); color: #fff; font-size: 12px; padding: 4px 8px; border-radius: 5px; pointer-events: none; white-space: nowrap; box-shadow: var(--shadow-md); }
.gantt tr.sub td { background: var(--surface-2); }
.gantt tr.sub td.lbl { font-weight: 400; padding-left: 30px; color: var(--text-2); background: var(--surface-2); }
.gantt tr.sub.mem td.lbl { cursor: pointer; }
.gantt tr.sub.mem td.lbl:hover { color: var(--accent); }
.gantt tr.role td.lbl { padding-left: 40px; }
.gantt tr.section td { background: var(--surface-3); font-weight: 650; color: var(--text); height: 28px; letter-spacing: .1px; }
.gantt tr.util td.lbl { font-weight: 600; cursor: pointer; }
.gantt.compact th, .gantt.compact td { height: 18px; font-size: 10px; }
.gantt.compact tr.prow td { height: 24px; }
.gantt.compact td.barcell { padding: 3px 0; }
.gantt.compact .bar { font-size: 10px; }
.gantt.zoom-s th:not(.lbl), .gantt.zoom-s td:not(.lbl) { font-size: 9px; padding: 0 1px; }
/* status cells: tint + shape cue (never colour alone) */
.st-ok, .st-warn, .st-bad, .st-over { position: relative; color: var(--text); }
.st-ok { background: var(--tint-good) !important; }
.st-warn { background: var(--tint-warn) !important; font-weight: 600; }
.st-bad { background-color: var(--tint-critical) !important; background-image: repeating-linear-gradient(45deg, var(--hatch) 0 3px, transparent 3px 6px) !important; font-weight: 700; }
.st-over { background: var(--tint-serious) !important; font-weight: 600; }
.st-warn::before, .st-bad::before { content: ''; position: absolute; top: 0; left: 0; border-top: 6px solid var(--ink-warn); border-right: 6px solid transparent; }
.st-bad::before { border-top-color: var(--st-critical); }
.st-over::before { content: ''; position: absolute; top: 0; right: 0; border-top: 6px solid var(--st-serious); border-left: 6px solid transparent; }
.u-part { background: var(--tint-neutral); }
.meter { position: absolute; left: 3px; right: 3px; bottom: 2px; height: 3px; border-radius: 2px; background: color-mix(in srgb, var(--text-2) 16%, transparent); overflow: hidden; }
.meter b { display: block; height: 100%; background: var(--text-2); border-radius: 2px; }
.st-ok .meter b { background: var(--st-good); } .st-warn .meter b { background: var(--ink-warn); } .st-bad .meter b { background: var(--st-critical); } .st-over .meter b { background: var(--st-serious); }
.gantt td.mcell { position: relative; }
.gantt td.ovc { position: relative; }
.gantt td.ovc::before { content: ''; position: absolute; top: 0; right: 0; border-top: 7px solid var(--st-serious); border-left: 7px solid transparent; }
.gantt td.zero { color: var(--line-strong); }
.gantt td.na { background: repeating-linear-gradient(45deg, var(--surface-3) 0 4px, var(--surface) 4px 8px); color: var(--muted); }
.gantt td.hol { box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--text-2) 45%, transparent); }
.gantt td.s-c { background: color-mix(in srgb, var(--s-committed) 22%, var(--surface)); color: var(--text); font-weight: 700; }
.gantt td.s-p { background: color-mix(in srgb, var(--s-projected) 20%, var(--surface)); color: var(--text); font-weight: 700; background-image: repeating-linear-gradient(45deg, var(--hatch) 0 4px, transparent 4px 8px); }
.legend i.s-c { background: color-mix(in srgb, var(--s-committed) 22%, var(--surface)); } .legend i.s-p { background: color-mix(in srgb, var(--s-projected) 20%, var(--surface)); }
.gantt tr.foot td { background: var(--surface-3); font-weight: 600; border-top: 2px solid var(--line-strong); }
.gantt tr.foot td.lbl { background: var(--surface-3); }
.grip { cursor: grab; color: var(--muted); padding: 0 1px; user-select: none; flex: none; display: inline-flex; opacity: .7; }
.grip svg.i { width: 13px; height: 13px; }
.grip:hover { color: var(--accent); opacity: 1; }
.grip:active { cursor: grabbing; }
.dragging { opacity: .45; }
tbody.drop-before > tr:first-child > *, tr.drop-before > * { box-shadow: inset 0 3px 0 var(--accent) !important; }
tbody.drop-after > tr:last-child > *, tr.drop-after > * { box-shadow: inset 0 -3px 0 var(--accent) !important; }
.card.drop-before { box-shadow: 0 -3px 0 var(--accent); }
.card.drop-after { box-shadow: 0 3px 0 var(--accent); }
.tl { display: flex; height: 22px; border-radius: 6px; overflow: hidden; margin: 8px 0 4px; }
.tl div { display: flex; align-items: center; justify-content: center; font-size: 11px; overflow: hidden; white-space: nowrap; padding: 0 4px; border-right: 2px solid var(--surface); }

/* 6. Dialogs, forms, lists ------------------------------------------------- */
.modal { position: fixed; inset: 0; background: rgba(8, 12, 20, .5); display: flex; align-items: flex-start; justify-content: center; z-index: 50; padding: 6vh 16px; overflow: auto; }
.modal.hidden { display: none; }
.modal-box { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px 22px; width: 560px; max-width: 100%; box-shadow: var(--shadow-lg); }
.modal-box.wide { width: 720px; }
.modal-box.xwide { width: min(1150px, 96vw); }
.modal-box h3 { margin: 0 0 14px; font-size: 16px; }
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 4px; font-weight: 500; font-size: 12px; color: var(--text-2); }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form .hint { font-size: 11px; color: var(--muted); font-weight: 400; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.quick { display: flex; flex-wrap: wrap; gap: 5px; }
table.list { border-collapse: collapse; width: 100%; }
table.list th, table.list td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.list th { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600; }
table.list tbody tr { transition: background-color .12s; }
table.list tbody tr:hover { background: var(--surface-2); }
table.list td.num, table.list th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.roles input { width: 260px; }
.secs input { width: 100%; }
.secs td { padding: 4px; }
.secs input[data-k=role] { width: 64px; text-align: right; }
.secs th.rolecol { text-align: left; font-size: 10px; text-transform: none; letter-spacing: 0; white-space: normal; line-height: 1.2; }
.secs tfoot td { font-size: 11px; color: var(--muted); text-align: right; border-bottom: 0; }
.secs input.ovr { background: var(--tint-warn); border-color: var(--st-warn); }
.secs td.dates { font-size: 11px; color: var(--muted); white-space: nowrap; }
.log-entry { border-bottom: 1px solid var(--line-soft); padding: 8px 0; }
.log-entry .when { font-size: 11px; color: var(--muted); }
.log-entry ul { margin: 3px 0 0; padding-left: 18px; font-size: 12px; }

/* 7. Feature views --------------------------------------------------------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-bottom: 12px; }
.tile { border: 1px solid var(--line); border-radius: var(--r-md); padding: 11px 13px; background: var(--surface-2); }
.tile .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.tile .v { font-size: 21px; font-weight: 700; margin-top: 2px; }
.tile .d { font-size: 12px; color: var(--muted); }
.dpos { color: var(--ink-warn); font-weight: 600; } .dneg { color: var(--ink-good); font-weight: 600; } .dbad { color: var(--ink-critical); font-weight: 600; }
table.cmp td, table.cmp th { text-align: right; font-variant-numeric: tabular-nums; }
table.cmp td:first-child, table.cmp th:first-child { text-align: left; }
table.cmp th.grp { text-align: center; border-bottom: 1px solid var(--line); }
.slide-layout { display: grid; grid-template-columns: 350px 1fr; gap: 14px; align-items: start; }
.slide-ctl h4 { margin: 14px 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.slide-ctl h4:first-child { margin-top: 0; }
.slide-ctl label.blk { display: grid; gap: 3px; font-size: 12px; margin-bottom: 7px; }
.slide-ctl label.chk { display: flex; gap: 6px; align-items: center; font-size: 12px; margin: 3px 0; }
.slide-ctl input[type=text], .slide-ctl input[type=date], .slide-ctl select { width: 100%; }
.plist { max-height: 280px; overflow: auto; border: 1px solid var(--line-soft); border-radius: var(--r-sm); padding: 4px 8px; margin-top: 6px; }
.plist label { display: flex; gap: 6px; align-items: center; font-size: 12px; padding: 3px 0; }
.plist label .pn { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slide-main { position: sticky; top: 70px; }
.slide-frame svg { width: 100%; height: auto; display: block; border: 1px solid var(--line-strong); border-radius: 4px; box-shadow: var(--shadow-md); background: #fff; }
/* charts use the chart-chrome tokens */
.viz-root { --surface-1: var(--surface); --text-primary: var(--text); --text-secondary: var(--text-2); }
.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px 12px; margin-bottom: 14px; box-shadow: var(--shadow-sm); }
.chart-card h3 { margin: 0; font-size: 14px; color: var(--text); }
.chart-card .sub { margin: 2px 0 8px; font-size: 12px; color: var(--text-2); }
.chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-2); margin-bottom: 4px; flex-wrap: wrap; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 16px; height: 2px; border-radius: 1px; }
.chart-host { position: relative; }
.chart-host svg { display: block; overflow: visible; }
.chart-host svg:focus { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.chart-tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: var(--shadow-md); padding: 7px 10px; font-size: 12px; color: var(--text-2); white-space: nowrap; display: none; z-index: 5; }
.chart-tip .d { color: var(--text); font-weight: 600; margin-bottom: 4px; }
.chart-tip .r { display: flex; align-items: center; gap: 7px; line-height: 1.6; }
.chart-tip .r b { color: var(--text); min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; }
.chart-tip .x { margin-top: 3px; font-size: 11px; }
.chart-card details { margin-top: 6px; font-size: 12px; color: var(--text-2); }
.chart-card details summary { cursor: pointer; }
.chart-card details .tw { max-height: 260px; overflow: auto; margin-top: 6px; }
.chart-card details td, .chart-card details th { padding: 3px 8px; font-variant-numeric: tabular-nums; }

/* 7b. Help, tooltips, pop-overs, checklist, form messages ---------------- */
#tip { position: fixed; z-index: 90; max-width: 320px; background: var(--header); color: #e5e7eb; font-size: 12px; line-height: 1.45; padding: 7px 10px; border-radius: var(--r-sm); box-shadow: var(--shadow-md); pointer-events: none; opacity: 0; transform: translateY(2px); transition: opacity .12s, transform .12s; }
#tip.on { opacity: 1; transform: none; }
#tip b { color: #fff; font-weight: 600; display: block; }
#tip div { margin-top: 2px; color: #cbd5e1; }
.info { border: 0; background: none; padding: 0 2px; margin-left: 2px; color: var(--muted); cursor: pointer; display: inline-flex; vertical-align: middle; border-radius: 50%; }
.info svg.i { width: 13px; height: 13px; }
.info:hover, .info:focus-visible { color: var(--accent); }
.pop { position: fixed; z-index: 80; width: 300px; max-height: 70vh; overflow: auto; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-lg); padding: 12px 14px; font-size: 12px; animation: popIn .14s ease-out; text-align: left; white-space: normal; font-weight: 400; }
.pop.wide { width: 400px; }
.pop h4 { margin: 2px 22px 6px 0; font-size: 13px; }
.pop p { margin: 6px 0; color: var(--text-2); }
.pop-x { position: absolute; top: 8px; right: 8px; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px; display: inline-flex; }
table.calc { width: 100%; border-collapse: collapse; margin: 6px 0; font-variant-numeric: tabular-nums; }
table.calc td { padding: 4px 2px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.calc td.num { text-align: right; white-space: nowrap; padding-left: 10px; }
table.calc tr.sub td { color: var(--text-2); background: var(--surface-2); }
table.calc tr.tot td { border-top: 2px solid var(--line-strong); border-bottom: 0; font-size: 13px; }
table.calc tr.grp td { font-weight: 650; color: var(--muted); text-transform: uppercase; font-size: 10px; letter-spacing: .5px; padding-top: 8px; }
table.calc .badge { font-size: 10px; padding: 0 5px; margin-left: 4px; }
.gantt thead th[data-act=explain] { cursor: pointer; }
.gantt thead th[data-act=explain]:hover { box-shadow: inset 0 0 0 1px var(--accent); }
#helpDrawer { position: fixed; top: 56px; right: 0; bottom: 0; width: min(400px, 92vw); z-index: 40; background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; transform: translateX(105%); transition: transform .22s cubic-bezier(.2, .8, .2, 1); }
#helpDrawer.open { transform: none; }
.hd-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px 8px; font-size: 14px; }
.hd-head b { display: inline-flex; gap: 6px; align-items: center; }
.hd-search { display: flex; align-items: center; gap: 6px; margin: 0 16px 8px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); color: var(--muted); }
.hd-search input { border: 0; outline: 0; flex: 1; padding: 7px 2px; background: none; }
.hd-search:focus-within { outline: 2px solid var(--focus); border-color: var(--accent); }
.hd-body { overflow: auto; padding: 4px 16px 24px; font-size: 13px; }
.hd-body h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 18px 0 6px; }
.hd-body h4 { margin: 0 0 4px; font-size: 14px; }
.hd-body section.hitem { background: var(--accent-soft); border-radius: var(--r-md); padding: 10px 12px; }
.hd-body section.hitem p { margin: 0 0 6px; } .hd-body ul, .hd-body ol { margin: 4px 0; padding-left: 18px; } .hd-body li { margin: 3px 0; }
.hd-links { display: flex; gap: 8px; margin: 10px 0 0; flex-wrap: wrap; } .hd-links a.btn { text-decoration: none; }
details.guide { border-bottom: 1px solid var(--line-soft); padding: 7px 0; }
details.guide summary { cursor: pointer; font-weight: 600; }
.hitem.term { padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.hitem.term p { margin: 2px 0 0; color: var(--text-2); }
.hitem.flash { animation: flash 1.6s ease-out; border-radius: 6px; }
@keyframes flash { 0%, 30% { background: var(--tint-warn); } 100% { background: transparent; } }
table.keys td { padding: 3px 8px 3px 0; vertical-align: top; }
kbd { font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-3); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; white-space: nowrap; }
#onboard { position: fixed; right: 18px; bottom: 18px; z-index: 35; width: 340px; max-height: calc(100vh - 96px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 10px 14px 12px; animation: popIn .25s ease-out; }
#onboard.min { width: 240px; padding-bottom: 10px; }
.ob-head { display: flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; }
.ob-head b { flex: 1; }
.ob-head .caret svg { transform: rotate(-90deg); } .ob-head .caret.open svg { transform: rotate(90deg); }
.ob-bar { height: 5px; background: var(--surface-3); border-radius: 3px; margin: 8px 0 4px; overflow: hidden; }
.ob-bar i { display: block; height: 100%; background: var(--st-good); border-radius: 3px; transition: width .3s; }
.ob-list { list-style: none; margin: 6px 0 0; padding: 0; }
.ob-list li { display: flex; gap: 9px; align-items: flex-start; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.ob-txt { flex: 1; min-width: 0; }
.ob-list li .btn { flex: none; align-self: center; }
.ob-list li.done b { color: var(--muted); text-decoration: line-through; font-weight: 500; }
.ob-check { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; margin-top: 1px; }
.ob-check svg.i { width: 12px; height: 12px; stroke-width: 3; }
li.done .ob-check { background: var(--st-good); border-color: var(--st-good); color: #fff; }
li.next .ob-check { border-color: var(--accent); }
.ob-foot { margin-top: 8px; font-size: 12px; color: var(--text-2); }
input.err, select.err { border-color: var(--st-critical) !important; outline: 2px solid color-mix(in srgb, var(--st-critical) 25%, transparent); }
.ferr { display: block; color: var(--ink-critical); font-size: 11px; font-weight: 600; margin-top: 3px; }
.ferr.form-level { background: var(--tint-critical); padding: 7px 10px; border-radius: var(--r-sm); color: var(--text); }
.toast { display: flex; align-items: center; gap: 12px; }
.toast button { background: none; border: 1px solid rgba(255,255,255,.35); color: #fff; font: inherit; font-weight: 600; padding: 2px 10px; border-radius: 6px; cursor: pointer; }
.toast button:hover { background: rgba(255,255,255,.12); }

/* 7c. Easter eggs (screen only; never in print) ---------------------------- */
.brand { position: relative; cursor: default; user-select: none; }
.egg-note { position: fixed; top: 66px; right: 18px; z-index: 75; display: flex; gap: 10px; align-items: center; max-width: 360px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-left: 4px solid var(--st-warn); border-radius: var(--r-md); box-shadow: var(--shadow-lg); padding: 10px 12px; font-size: 13px; animation: popIn .25s cubic-bezier(.2, .8, .2, 1); }
.egg-note.out { opacity: 0; transform: translateY(-6px); transition: opacity .3s, transform .3s; }
.egg-note .small { color: var(--text-2); }
.egg-note button { margin-left: auto; font: inherit; font-weight: 600; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); border-radius: 6px; padding: 3px 10px; cursor: pointer; }
.medal { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--st-warn) 22%, var(--surface)); color: var(--ink-warn); }
.medal svg.i { width: 19px; height: 19px; }
.medal.gold { background: linear-gradient(135deg, #f7d774, #d4a017); color: #5a3d00; }
.confetti { position: fixed; z-index: 85; width: 0; height: 0; pointer-events: none; }
.confetti i { position: absolute; width: 7px; height: 10px; border-radius: 2px; animation: burst 1.1s cubic-bezier(.15, .7, .3, 1) forwards; }
@keyframes burst { from { transform: translate(0, 0) rotate(0); opacity: 1; } to { transform: translate(var(--x), calc(var(--y) + 70px)) rotate(var(--r)); opacity: 0; } }
.brand svg.shuffle rect:nth-of-type(2) { animation: shuf1 1.6s ease-in-out; }
.brand svg.shuffle rect:nth-of-type(3) { animation: shuf2 1.6s ease-in-out; }
.brand svg.shuffle rect:nth-of-type(4) { animation: shuf3 1.6s ease-in-out; }
@keyframes shuf1 { 30% { transform: translate(6px, 11px); } 65% { transform: translate(2px, 5px); } }
@keyframes shuf2 { 30% { transform: translate(-4px, -5.5px); } 65% { transform: translate(-4px, 5.5px); } }
@keyframes shuf3 { 30% { transform: translate(9px, -11px); } 65% { transform: translate(5px, -5.5px); } }
.brand .hat { position: absolute; left: 7px; top: -9px; width: 14px; height: 14px; transform: rotate(-14deg); pointer-events: none; }
.gantt.festive .now { box-shadow: inset 2px 0 0 #f5c542; animation: sparkle 1.8s ease-in-out infinite; }
@keyframes sparkle { 50% { box-shadow: inset 2px 0 0 #fff2b3, inset 3px 0 6px -2px #f5c542; } }
.gantt .bar.egg { background-color: #f7c5d9 !important; color: #5b2a3c !important; background-image: radial-gradient(circle at 20% 30%, #fff8 0 2px, transparent 2.5px), radial-gradient(circle at 70% 65%, #b5e3f5 0 2.5px, transparent 3px), radial-gradient(circle at 45% 80%, #fff3a6 0 2px, transparent 2.5px) !important; background-size: 18px 18px, 23px 23px, 15px 15px !important; }
.gantt .bar.egg:nth-child(odd) { background-color: #c9e9d2 !important; }
body.gold { --accent: #c8930f; --accent-2: #a87905; --accent-soft: rgba(212, 160, 23, .14); --focus: rgba(212, 160, 23, .4); }
body.gold .brand svg rect:first-child { fill: #d4a017; }
@media screen {
  body.blueprint { --page: #0b3b8c; --surface: #0e4aa6; --surface-2: #0d439a; --surface-3: #0b3d8f; --line: rgba(255,255,255,.18); --line-soft: rgba(255,255,255,.1); --line-strong: rgba(255,255,255,.32);
    --text: #f2f7ff; --text-2: #cfe0ff; --muted: #9dbbf0; --header: #082c6a;
    --tint-good: rgba(12,163,12,.38); --tint-warn: rgba(250,178,25,.4); --tint-serious: rgba(236,131,90,.45); --tint-critical: rgba(208,59,59,.5); --tint-neutral: rgba(255,255,255,.13); --ink-warn: #ffd166; --ink-good: #7ee07e; --ink-critical: #ffb3b3; --hatch: rgba(255,255,255,.12); background-image: linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px); background-size: 20px 20px; }
  body.blueprint, body.blueprint .gantt { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
  body.blueprint .gantt .bar { background: transparent !important; background-image: none !important; border: 1.5px dashed #dbe8ff; color: #fff !important; }
  body.blueprint .card, body.blueprint .toolbar, body.blueprint .gantt-wrap { box-shadow: none; }
}
.badge-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin: 8px 0; }
.badge-tile { display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 6px 8px; font-size: 12px; }
.badge-tile .medal { grid-row: span 2; width: 30px; height: 30px; }
.badge-tile:not(.got) .medal { background: var(--surface-3); color: var(--muted); }
.badge-tile:not(.got) b { color: var(--muted); letter-spacing: 1px; }
.badge-tile .small { line-height: 1.3; }
.eg-switch { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }

/* 8. Motion ---------------------------------------------------------------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes rowIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes caretIn { from { transform: rotate(0deg); } to { transform: rotate(90deg); } }
@keyframes caretOut { from { transform: rotate(90deg); } to { transform: rotate(0deg); } }
.modal:not(.hidden) { animation: fadeIn .16s ease-out; }
.modal:not(.hidden) .modal-box { animation: popIn .2s cubic-bezier(.2, .8, .2, 1); }
.modal.closing { opacity: 0; transition: opacity .14s ease-in; }
.modal.closing .modal-box { transform: translateY(6px) scale(.985); transition: transform .14s ease-in; }
.toast { animation: toastIn .22s cubic-bezier(.2, .8, .2, 1); }
.toast.out { opacity: 0; transform: translate(-50%, 6px); transition: opacity .2s, transform .2s; }
.view-enter > * { animation: fadeIn .2s ease-out; }
.just > tr.sub > *, tr.just > * { animation: rowIn .2s ease-out both; }
.just .caret.open svg, .just.caret.open svg { animation: caretIn .18s ease-out; }
.just .caret:not(.open) svg, .just.caret:not(.open) svg { animation: caretOut .18s ease-out; }
details.menu[open] .menu-pop { animation: popIn .14s ease-out; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* 9. Print ----------------------------------------------------------------- */
@media print {
  :root, :root[data-theme="dark"] {
    color-scheme: light; --page: #fff; --surface: #fff; --surface-2: #f8f9fb; --surface-3: #f0f2f5; --line: #d9dde3; --line-soft: #e8ebef; --line-strong: #c4cbd4;
    --text: #000; --text-2: #333; --muted: #555; --hatch: rgba(0,0,0,.12);
    --s-committed: #2a78d6; --s-projected: #eb6834; --s-total: #6250d6; --s-allocated: #1baf7a; --s-unalloc: #eda100;
    --tint-good: color-mix(in srgb, #0ca30c 13%, #fff); --tint-warn: color-mix(in srgb, #fab219 26%, #fff); --tint-serious: color-mix(in srgb, #ec835a 24%, #fff);
    --tint-critical: color-mix(in srgb, #d03b3b 18%, #fff); --tint-neutral: color-mix(in srgb, #2563eb 9%, #fff); --ink-warn: #8a5a00; --ink-good: #006300; --ink-critical: #b42318;
  }
  body { background: #fff; font-size: 11px; }
  body.print-colors * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  header, .toolbar, .no-print, .modal, .toast, .egg-note, .confetti, #onboard, #helpDrawer, #tip, .pop, .info, .dragtip, .grip, .gantt .lw .btn, .gantt [data-act=suggest], .slide-ctl, .chart-card details, .menu-pop,
  tr.sub .btn, .card .btn, .tile .btn, .slide-main .row .btn, .slide-main .note { display: none !important; }
  main { padding: 0; }
  .print-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2px solid #000; padding-bottom: 4px; margin-bottom: 8px; }
  .print-head h1 { font-size: 16px; margin: 0; }
  .print-head span { font-size: 10px; color: #444; }
  .card, .chart-card, .toolbar, .gantt-wrap { box-shadow: none !important; }
  .card, .chart-card { break-inside: avoid; border-color: #ccc; }
  .gantt-wrap { max-height: none !important; overflow: visible !important; border: 0; }
  #view.print-fit table.gantt, #view.print-fit .slide-frame, #view.print-fit .chart-card, #view.print-fit table.list { zoom: var(--print-zoom, 1); }
  .gantt thead { position: static; display: table-header-group; }
  .gantt .lbl { position: static; }
  .gantt tbody, .gantt tr { break-inside: avoid; }
  .slide-layout { display: block; }
  .slide-main { position: static; }
  a { color: inherit; text-decoration: none; }
  .view-enter > * { animation: none; }
}
