/* UK MU Desk: dark "war room" theme by default, light theme via the switch at the bottom. */
:root {
  --bg: #0a0e16; --bg2: #0e1420; --card: #121a28; --card2: #172133; --text: #e7ecf5; --muted: #8a95aa; --line: #222c3e;
  --accent: #ff6a3d; --accent-soft: rgba(255,106,61,.14); --accent-text: #0a0e16;
  --g0: #34d399; --g1: #a3e635; --g2: #fbbf24; --g3: #f87171;
  --up: #34d399; --down: #f87171; --zero: rgba(248,113,113,.07); --prev: #3a4659; --bar: #38bdf8;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px rgba(0,0,0,.25);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f3f5f9; --bg2: #e9edf4; --card: #ffffff; --card2: #f7f9fc; --text: #131826; --muted: #5d6880; --line: #e1e6ee;
  --accent: #e0491b; --accent-soft: #fde6dd; --accent-text: #ffffff;
  --g0: #059669; --g1: #65a30d; --g2: #d97706; --g3: #dc2626;
  --up: #059669; --down: #dc2626; --zero: #fdecec; --prev: #c3cad6; --bar: #0284c7;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.04);
  color-scheme: light;
}

:root { --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
         --font-display: "Barlow Condensed", "Inter", system-ui, sans-serif; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--font-ui);
  background-image: radial-gradient(1200px 400px at 50% -200px, var(--bg2), transparent); background-repeat: no-repeat; }
a { color: inherit; }
a:hover { color: var(--accent); }
.muted { color: var(--muted); }

/* header: one row; on a phone the menu scrolls sideways instead of wrapping */
.top { background: rgba(10,14,22,.86); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
:root[data-theme="light"] .top { background: rgba(255,255,255,.9); }
.top::after { content: ""; display: block; height: 2px; background: linear-gradient(90deg, var(--accent), transparent 60%); }
.top-inner { max-width: 1180px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 22px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; text-decoration: none; font-size: 16px; letter-spacing: .6px; text-transform: uppercase; white-space: nowrap; }
.admin-badge { font-family: var(--font-ui); font-size: 10px; letter-spacing: 1px; color: var(--accent); border: 1px solid var(--accent); border-radius: 4px; padding: 1px 6px; }
.mark { background: var(--accent); color: var(--accent-text); border-radius: 5px; padding: 2px 7px; font-size: 12px; letter-spacing: .8px; }
nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
nav::-webkit-scrollbar { display: none; }
nav a { text-decoration: none; padding: 6px 12px; border-radius: 6px; color: var(--muted); font-weight: 600; font-size: 14px; white-space: nowrap; }
nav a:hover { color: var(--text); background: var(--card); }
nav a.active { color: var(--text); background: var(--accent-soft); box-shadow: inset 0 -2px 0 var(--accent); }

main { max-width: 1180px; margin: 0 auto; padding: 22px 16px 40px; }
h1 { font-size: 30px; margin: 0 0 4px; letter-spacing: -.2px; font-weight: 800; }
h2 { font-size: 13px; margin: 30px 0 10px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); font-weight: 700; }
h2 .muted { text-transform: none; letter-spacing: 0; }
h2 a { color: var(--accent); }
.lede { color: var(--muted); margin: 0 0 18px; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--g0); margin-right: 6px; vertical-align: 1px;
  box-shadow: 0 0 0 0 rgba(52,211,153,.6); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(52,211,153,.55); } 70% { box-shadow: 0 0 0 8px rgba(52,211,153,0); } 100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); } }

/* display font for the big things */
h1, .kpi .value, .brand, .health, .hero h1 { font-family: var(--font-display); }
h1 { font-size: 36px; letter-spacing: .3px; text-transform: uppercase; }
.kpi .value { font-size: 34px; letter-spacing: .3px; }

/* banner at the top of the Overview */
.hero { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; padding: 26px 26px 22px; margin-bottom: 14px;
  background:
    radial-gradient(600px 220px at 90% 0%, rgba(56,189,248,.16), transparent 70%),
    radial-gradient(500px 240px at 0% 100%, rgba(255,106,61,.18), transparent 70%),
    linear-gradient(135deg, var(--card2), var(--card)); box-shadow: var(--shadow); }
.hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background: repeating-linear-gradient(135deg, transparent 0 22px, rgba(255,255,255,.018) 22px 23px); }
.hero h1 { font-size: 52px; line-height: 1; margin: 6px 0 8px; }
.hero h1::after { content: ""; display: block; width: 64px; height: 4px; background: var(--accent); border-radius: 2px; margin-top: 10px; }
.hero-sub { color: var(--text); opacity: .85; margin: 0 0 8px; font-size: 16px; max-width: 640px; }
.hero-live { color: var(--muted); margin: 0; font-size: 13px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--accent); }
.page-head { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.page-head h1 { margin: 2px 0 2px; }
.page-head .lede { margin: 0; }

/* avatars */
.av { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; background: var(--card2); border: 1px solid var(--line); flex: none; display: inline-flex; align-items: center; justify-content: center; }
.av-md { width: 44px; height: 44px; border-radius: 10px; }
a.feed.academy { text-decoration: none; display: block; transition: transform .15s, border-color .15s; }
a.feed.academy:hover { transform: translateY(-2px); border-color: var(--muted); color: inherit; }
.av-ph { font-family: var(--font-display); font-weight: 700; color: var(--muted); font-size: 15px; }
.av-lg { width: 72px; height: 72px; border-radius: 16px; font-size: 32px; box-shadow: 0 0 0 3px var(--accent-soft); }
.c-av { display: flex; align-items: center; gap: 10px; }
.c-main { font-weight: 600; }
.c-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
td.num .c-sub { text-align: right; }
.tag-first { margin-left: 0; }
.ico { width: 14px; height: 14px; margin-right: 6px; vertical-align: -2px; color: var(--accent); }

/* cards */
/* headline boxes always split evenly: 6 / 3 / 2 per row (MU pages have 8: 4 / 4) */
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 8px; }
.kpis:has(> :nth-child(7)) { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .kpis, .kpis:has(> :nth-child(7)) { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1100px) and (min-width: 701px) { .kpis:has(> :nth-child(8)):not(:has(> :nth-child(9))) { grid-template-columns: repeat(4, 1fr); } }
/* pages with exactly 4 boxes: 4 in a row, or 2 + 2 */
.kpis:has(> :nth-child(4)):not(:has(> :nth-child(5))) { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .kpis:has(> :nth-child(4)):not(:has(> :nth-child(5))) { grid-template-columns: repeat(2, 1fr); } }
.kpi, .card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.kpi { padding: 12px 14px; position: relative; overflow: hidden; background: linear-gradient(180deg, var(--card2), var(--card)); transition: transform .15s, border-color .15s; }
.kpi:hover { transform: translateY(-2px); border-color: var(--muted); }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); opacity: .7; }
.kpi .label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 700; }
.kpi .value { font-size: 28px; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi .hint { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.card { padding: 14px 16px; }
.card p { margin: 6px 0; }

/* "live now" feed on the Overview: three columns on a wide screen, stacked on a phone */
.live-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.feed { background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 12px 14px; }
.feed h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.feed h3 .count { color: var(--text); font-size: 13px; }
.feed h3 a { color: var(--accent); text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 12px; }
details.card summary { cursor: pointer; }
details.card[open] summary { margin-bottom: 6px; }
.feed ul { list-style: none; margin: 0; padding: 0; }
.feed li { padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.feed li:first-child { border-top: 0; }
.feed li .when { color: var(--muted); font-size: 12px; display: block; }
.show-all { margin-top: 8px; font: inherit; font-size: 13px; background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 6px; padding: 3px 10px; cursor: pointer; }
.show-all:hover { color: var(--text); border-color: var(--muted); }

/* tables */
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); font-weight: 700; user-select: none; background: var(--card2); }
th.sortable { cursor: pointer; }
th.sortable:hover { color: var(--text); }
th .arrow { font-size: 10px; margin-left: 3px; color: var(--accent); }
td.num, th.num { text-align: right; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255,255,255,.025); }
:root[data-theme="light"] tbody tr:hover td { background: rgba(0,0,0,.02); }
tbody tr.link { cursor: pointer; }
tbody tr.link:hover td { background: var(--accent-soft); }
tr.zero td { background: var(--zero); }

.g0 { color: var(--g0); } .g1 { color: var(--g1); } .g2 { color: var(--g2); } .g3 { color: var(--g3); }
.up { color: var(--up); } .down { color: var(--down); }
.warn { color: var(--down); font-weight: 700; }
.health { display: inline-block; min-width: 38px; text-align: center; font-weight: 800; border-radius: 6px; padding: 1px 7px; background: var(--card2); border: 1px solid currentColor; cursor: help; }

/* bars and charts */
.stack { display: inline-flex; width: 130px; height: 8px; border-radius: 4px; overflow: hidden; vertical-align: middle; background: var(--line); }
.stack span { display: block; height: 100%; }
.stack .s0 { background: var(--g0); } .stack .s1 { background: var(--g1); } .stack .s2 { background: var(--g2); } .stack .s3 { background: var(--g3); }
.stack-label { font-size: 13px; color: var(--muted); margin-left: 8px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin: 8px 2px 0; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.bar { display: inline-block; height: 8px; background: var(--bar); border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.bar.prev { background: var(--prev); height: 5px; }
.pair { line-height: 1.25; }
.pair .prevrow { font-size: 12px; color: var(--muted); }
.spark { display: block; overflow: visible; }

/* tags and chips */
.tag { font-size: 11px; border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; color: var(--muted); margin-left: 6px; white-space: nowrap; }
.tag.drop { color: var(--down); border-color: var(--down); }
.tag.role { color: var(--bar); border-color: var(--bar); }
.tag.role.owner { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.tag.pill-on { color: var(--up); border-color: var(--up); background: rgba(52,211,153,.08); }
.tag.pill-after { color: var(--g2); border-color: var(--g2); }
.sub-owner { font-size: 12px; color: var(--muted); }
.leaders { display: grid; gap: 8px; }
.leaders .lbl { display: inline-block; min-width: 110px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 700; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 18px; }
.chip { text-decoration: none; padding: 5px 11px; border-radius: 6px; border: 1px solid var(--line); background: var(--card); font-size: 14px; }
.chip:hover { border-color: var(--muted); color: var(--text); }
.chip.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.moves { margin: 0 0 12px; }
.moves b { font-weight: 600; }
.search { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); font: inherit; width: 240px; margin-bottom: 10px; }
.search:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.meter { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 6px 0 4px; }
.meter span { display: block; height: 100%; background: linear-gradient(90deg, var(--bar), var(--accent)); }
.moves-list { margin: 0; padding-left: 18px; }
.moves-list li { padding: 2px 0; }

/* charts */
.chart-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 8px 4px; overflow-x: auto; box-shadow: var(--shadow); }
.barchart { display: block; }
.barchart .bar-val { font-size: 10px; fill: var(--muted); }
.barchart .bar-lbl { font-size: 10px; fill: var(--muted); }
h3.subhead { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 18px 0 8px; }

/* roadmap page */
button.chip { font: inherit; font-size: 14px; color: var(--text); cursor: pointer; }
button.chip.active { color: var(--accent-text); }
.chip.small { font-size: 13px; padding: 3px 10px; }
.chip-n { opacity: .65; font-size: 12px; margin-left: 2px; }
.prio, .flag { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.prio-high { background: rgba(248,113,113,.14); color: var(--down); }
.prio-medium { background: rgba(251,191,36,.15); color: var(--g2); }
.prio-low { background: var(--line); color: var(--muted); }
.flag-in-progress { background: var(--accent); color: var(--accent-text); }
.flag-planned { background: var(--accent-soft); color: var(--accent); }
.flag-idea { border: 1px dashed var(--muted); color: var(--muted); padding: 1px 8px; }
.flag-done { background: rgba(52,211,153,.12); color: var(--up); }
.flag-done::before { content: "✓ "; }
.flag-scrapped { background: var(--line); color: var(--muted); text-decoration: line-through; }
td .rm-title { font-weight: 600; white-space: normal; }
td .rm-text { font-size: 14px; color: var(--muted); white-space: normal; max-width: 620px; }
.rm-note { font-style: italic; }
tr.rm-done .rm-title, tr.rm-scrapped .rm-title { color: var(--muted); }
tr.rm-scrapped .rm-title { text-decoration: line-through; }

/* progress page */
.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 16px 20px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }
.timeline .when { font-size: 12px; color: var(--muted); }
.timeline .what { font-weight: 600; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.steps h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 0 0 8px; }
.steps ul { margin: 0; padding: 0; list-style: none; }
.steps li { padding: 8px 0; border-top: 1px solid var(--line); }
.steps li:first-child { border-top: 0; }
.steps .t { font-weight: 600; }
.steps .d { font-size: 14px; color: var(--muted); }
.status { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.status.done { background: rgba(52,211,153,.12); color: var(--up); }
.status.next { background: rgba(251,191,36,.15); color: var(--g2); }
.status.blocked { background: rgba(248,113,113,.12); color: var(--down); }
.dates { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 12px; }

.foot { max-width: 1180px; margin: 0 auto; padding: 0 16px 32px; font-size: 13px; color: var(--muted); }
.foot button { font: inherit; background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 6px; padding: 2px 8px; cursor: pointer; }

/* phones: tighter spacing, minor table columns hidden (class hide-sm) */
@media (max-width: 700px) {
  .top-inner { gap: 12px; padding: 8px 12px; }
  .brand span:last-child { display: none; }
  main { padding: 16px 12px 32px; }
  h1 { font-size: 28px; }
  .hero { padding: 18px 16px 16px; }
  .hero h1 { font-size: 36px; }
  .av-lg { width: 54px; height: 54px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi .value { font-size: 22px; }
  .search { width: 100%; }
  .hide-sm { display: none !important; }
  /* on phones every table row becomes a small card: name on top, then one line per value */
  .table-wrap { overflow: visible; }
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
  .table-wrap thead { display: none; }
  .table-wrap tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .table-wrap tr:last-child { border-bottom: 0; }
  .table-wrap td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; text-align: right; white-space: normal; background: none !important; }
  .table-wrap td::before { content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; text-align: left; flex: none; padding-top: 3px; }
  .table-wrap td > .td-v { min-width: 0; flex: 1 1 auto; }
  .table-wrap td .rm-text { max-width: none; }
  .table-wrap code { word-break: break-all; }
  .table-wrap td:first-child { display: block; text-align: left; padding-bottom: 6px; font-size: 15px; }
  .table-wrap td:first-child::before { content: none; }
  .table-wrap td .c-sub { text-align: right; }
  .table-wrap td:first-child .c-sub { text-align: left; }
  .table-wrap tr.zero { background: var(--zero); }
  .stack { width: 64px; }
  .stack-label, .sub-owner { display: none; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { white-space: nowrap; }
}
