:root {
  --navy: #173a63; --navy-2: #0f2744; --ink: #1d2733; --ink-2: #4a5663; --muted: #6b7785;
  --line: #dde3ea; --bg: #f4f6f9; --card: #ffffff; --track: #e8edf3; --link: #1f5f9e;
  --imt: #2f6fb5; --nm: #6f35a5; --biz: #c55a11; --na: #9aa3ad;
  --p1: #b3261e; --p2: #d9730d; --p3: #4f7fb0; --p4: #9aa3ad;
  --team: #2f6fb5; --bizact: #4f7f35; --gov: #6f35a5; --pend: #9aa3ad;
  --warn-bg: #fff5e9; --warn: #c55a11; --good: #4f7f35; --bad: #b3261e;
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.45 "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif; }
a { color: var(--link); }
button { font: inherit; }

/* header */
header.top { background: linear-gradient(120deg, var(--navy-2), var(--navy) 60%, #24558b); color: #fff; padding: 18px 26px 14px; }
.top-row { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
header h1 { margin: 0 0 4px; font-size: 24px; font-weight: 700; letter-spacing: -.2px; }
header .sub { color: #d6e2f0; font-size: 14px; max-width: 980px; }
.sync-box { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: #d6e2f0; flex-wrap: wrap; justify-content: flex-end; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.badge.live { background: #2e7d32; color: #fff; } .badge.xml { background: #f0b429; color: #2a2100; }
.badge.err { background: #b3261e; color: #fff; }
.btn { border: 1px solid var(--link); background: #fff; color: var(--link); border-radius: 6px; padding: 6px 14px; cursor: pointer; }
.btn:hover { background: #eef4fb; }
.btn.primary { background: #fff; color: var(--navy); border-color: #fff; font-weight: 600; }
.btn.ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.6); }
.btn:disabled { opacity: .55; cursor: default; }
.persp { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.persp button { background: rgba(255,255,255,.1); color: #e8f0f9; border: 1px solid rgba(255,255,255,.25); border-radius: 999px; padding: 5px 14px; cursor: pointer; font-size: 13px; }
.persp button.on { background: #fff; color: var(--navy); border-color: #fff; font-weight: 600; }
.persp .lbl { color: #b9cbe0; font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; align-self: center; margin-right: 4px; }

nav.tabs { background: var(--navy-2); display: flex; overflow-x: auto; padding: 0 18px; position: sticky; top: 0; z-index: 20; }
nav.tabs button { background: none; border: 0; color: #dbe5f1; padding: 12px 14px; cursor: pointer; white-space: nowrap; border-bottom: 3px solid transparent; }
nav.tabs button.on { background: var(--navy); color: #fff; border-bottom-color: #e98b3a; }

.filters { background: #fff; border-bottom: 1px solid var(--line); padding: 10px 20px 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px 12px; position: sticky; top: 45px; z-index: 15; }
.filters label { display: block; font-size: 10.5px; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.filters select, .filters input { width: 100%; padding: 6px 8px; border: 1px solid #c9d2dc; border-radius: 5px; background: #fff; font: inherit; font-size: 13px; color: var(--ink); }
.filters .actions { display: flex; align-items: flex-end; gap: 8px; }
.filters .actions .btn { width: 100%; }
.active-filters { padding: 6px 22px 0; font-size: 12.5px; color: var(--ink-2); min-height: 6px; }
.chip { display: inline-flex; gap: 6px; align-items: center; background: #e7eef7; border-radius: 999px; padding: 2px 10px; margin: 2px 4px 2px 0; }
.chip b { font-weight: 600; } .chip button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0; }

main { padding: 8px 22px 40px; max-width: 1560px; margin: 0 auto; }
section.page { display: none; } section.page.on { display: block; }
h2.sec { font-size: 21px; margin: 18px 0 2px; color: var(--navy); }
p.lead { margin: 0 0 14px; color: var(--ink-2); }
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(520px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 16px; min-width: 0; }
.card h3 { margin: 0; font-size: 16px; color: var(--ink); }
.card .hint { color: var(--muted); font-size: 12.5px; margin: 2px 0 10px; }
.card.span { grid-column: 1 / -1; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 10px 0 12px; }
.kpi { background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--imt); border-radius: var(--radius); padding: 10px 14px; cursor: pointer; text-align: left; }
.kpi:hover { box-shadow: 0 2px 8px rgba(20,40,70,.08); }
.kpi .v { font-size: 26px; font-weight: 700; color: var(--navy); }
.kpi .l { font-size: 12.5px; color: var(--ink-2); }
.kpi .s { font-size: 11.5px; color: var(--muted); }

.legend { font-size: 12px; color: var(--ink-2); margin: 4px 0 10px; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }

/* bars */
.bars { display: grid; grid-template-columns: minmax(120px, 34%) 1fr 48px; gap: 5px 12px; align-items: center; }
.bars .lab { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; color: var(--link); }
.bars .lab:hover { text-decoration: underline; }
.bars .trk { background: var(--track); height: 16px; border-radius: 3px; display: flex; overflow: hidden; }
.bars .seg { height: 100%; cursor: pointer; transition: filter .1s; }
.bars .seg:hover { filter: brightness(1.15); }
.bars .tot { text-align: right; font-weight: 600; cursor: pointer; color: var(--link); font-size: 13.5px; }
.more { font-size: 12px; margin-top: 8px; color: var(--muted); }
.more button { border: 0; background: none; color: var(--link); cursor: pointer; padding: 0; font-size: 12px; }

/* heatmap */
.heat { overflow-x: auto; }
.heat table { border-collapse: collapse; font-size: 12.5px; width: 100%; }
.heat th { font-weight: 600; color: var(--ink-2); padding: 4px 6px; text-align: center; vertical-align: bottom; }
.heat th.rh { text-align: left; white-space: nowrap; }
.heat td { text-align: center; padding: 5px 6px; border: 2px solid #fff; cursor: pointer; min-width: 44px; }
.heat td.rl { text-align: left; background: #fff !important; color: var(--link); white-space: nowrap; cursor: pointer; }
.heat td.tot { font-weight: 700; background: #f3f5f8; }

/* tables */
.tbl-wrap { overflow-x: auto; max-height: 560px; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; }
table.tbl { border-collapse: collapse; width: 100%; font-size: 12.8px; }
.tbl th { position: sticky; top: 0; background: #eef2f7; text-align: left; padding: 7px 8px; font-weight: 600; cursor: pointer; white-space: nowrap; border-bottom: 1px solid var(--line); z-index: 1; }
.tbl td { padding: 6px 8px; border-bottom: 1px solid #edf0f4; vertical-align: top; }
.tbl tr:hover td { background: #f7fafd; }
.tbl tr.clk { cursor: pointer; }
.tbl td.num, .tbl th.num { text-align: right; }
.tbl .sum { max-width: 420px; }
.pill { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11.5px; font-weight: 600; color: #fff; white-space: nowrap; }
.toolbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin: 6px 0 8px; flex-wrap: wrap; }
.toolbar input { padding: 6px 9px; border: 1px solid #c9d2dc; border-radius: 5px; min-width: 260px; font: inherit; }

.callout { background: var(--warn-bg); border-left: 4px solid var(--warn); padding: 12px 16px; border-radius: 4px; margin: 6px 0 16px; }
.callout.info { background: #eef4fb; border-left-color: var(--imt); }
ul.insights { margin: 6px 0 0; padding-left: 20px; } ul.insights li { margin: 5px 0; }
.svgchart { width: 100%; height: auto; display: block; }
.svgchart text { font-size: 11px; fill: var(--ink-2); }
.svgchart .hit { cursor: pointer; }
.svgchart .hit:hover { opacity: .8; }
.empty { color: var(--muted); font-style: italic; padding: 12px 0; }
footer { color: var(--muted); font-size: 12px; padding: 10px 22px 30px; max-width: 1560px; margin: 0 auto; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(12, 25, 45, .45); display: none; z-index: 50; }
.modal-bg.on { display: flex; align-items: flex-start; justify-content: center; padding: 30px 16px; }
.modal { background: #fff; border-radius: 10px; width: min(1320px, 100%); max-height: calc(100vh - 60px); display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal .mh { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); gap: 12px; }
.modal .mh h3 { margin: 0; font-size: 17px; }
.modal .mb { padding: 12px 18px 18px; overflow: auto; }
.x { border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); }
.detail { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 18px; font-size: 13px; margin-bottom: 12px; }
.detail div b { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.desc { white-space: pre-wrap; background: #f7f9fb; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; font-size: 13px; max-height: 240px; overflow: auto; }
.cmt { border-left: 3px solid var(--line); padding: 4px 10px; margin: 8px 0; font-size: 13px; white-space: pre-wrap; }
.defs td:first-child { font-weight: 600; white-space: nowrap; }
.toast { position: fixed; right: 20px; bottom: 20px; background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.2); display: none; z-index: 60; max-width: 420px; }

@media (max-width: 700px) {
  .g2, .g3 { grid-template-columns: 1fr; }
  .bars { grid-template-columns: 38% 1fr 40px; }
  main { padding: 8px 12px 40px; }
  .filters { position: static; }
}
@media print {
  nav.tabs, .filters, .sync-box, .persp { display: none; }
  section.page { display: block !important; page-break-after: always; }
}

.btn.tiny { padding: 2px 8px; font-size: 12px; white-space: nowrap; }
.tbl tr.synced td { background: #eaf6e9; }
.tbl td a { white-space: nowrap; }

/* Sprint board: shortcuts between its sections */
.jumpbar { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin: 2px 0 12px; font-size: 13px; color: var(--muted, #5d6874); }
.jumpbar b { color: var(--navy, #173a63); }
.linkbtn { border: 0; background: none; padding: 0; font: inherit; color: #1f5f9e; cursor: pointer; border-bottom: 1px dotted #1f5f9e; }
.linkbtn:hover { color: #173a63; border-bottom-style: solid; }
h2.sec[id^="spr-"] { scroll-margin-top: 12px; }

/* Grooming: multi-select filter drop-downs */
.gms { position: relative; }
.gms summary { list-style: none; padding: 5px 10px; border: 1px solid #c9d2dc; border-radius: 5px; background: #fff; cursor: pointer; white-space: nowrap; }
.gms summary::-webkit-details-marker { display: none; }
.gms summary::after { content: " ▾"; color: #5d6874; }
.gms[open] summary, .gms.on summary { border-color: #1f5f9e; }
.gms.on summary { background: #eef4fb; }
.gms-pop { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; width: 290px; max-width: calc(100vw - 40px); background: #fff; border: 1px solid #c9d2dc; border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.12); padding: 8px; }
.gms-q { width: 100%; padding: 5px 8px; border: 1px solid #c9d2dc; border-radius: 4px; margin-bottom: 6px; font: inherit; }
.gms-list { max-height: 280px; overflow: auto; }
.gms-list label { display: block; padding: 3px 4px; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.gms-list label[hidden] { display: none; }
.gms-list label:hover { background: #eef2f7; }
.gms-foot { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12px; }

/* Grooming pop-up: estimates */
.gest { width: 70px; padding: 3px 6px; border: 1px solid #c9d2dc; border-radius: 4px; font: inherit; }
.gest-bar { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin: 8px 0; padding: 8px 10px; background: #f6f8fb; border: 1px solid #e3e8ee; border-radius: 6px; }

/* who is signed in (header) */
.who { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; }
.who a { color: inherit; }
.who-role { padding: 1px 8px; border-radius: 999px; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.35); font-weight: 600; }
/* Team capacity (Sprint board) */
.caplb { position: relative; display: inline-block; height: 10px; background: #edf0f4; border-radius: 5px; vertical-align: middle; }
.caplb i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; }
.caplb b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #173a63; }
.capt td.over { color: #b3261e; font-weight: 700; }
.capt tr.off td, .cape tr.off td { color: #9aa3ad; }
.cape th.d, .cape td.d { text-align: center; padding: 4px 3px; min-width: 34px; font-size: 12px; }
.cape td.hol { background: #fdf3e2; color: #8a5a00; }
.cape td.d.out { background: #fde8e6; }
.cape input[type=checkbox] { cursor: pointer; }
.cape td.d.half { background: #fff4e5; }
.cape .dcell { width: 30px; height: 22px; padding: 0; border: 1px solid #c9d2dc; border-radius: 4px; background: #fff; font: inherit; font-size: 11px; font-weight: 700; color: #b3261e; cursor: pointer; }
.cape td.d.half .dcell { color: #b45309; }
.cape .dcell:disabled { cursor: default; opacity: .4; }
.capt td.num.over { color: #b3261e; font-weight: 700; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 700; font-size: 15px; letter-spacing: .3px; margin-bottom: 6px; }
.brand b { color: #f59e3b; font-weight: 700; } .brand img { border-radius: 6px; box-shadow: 0 0 0 1px rgba(255,255,255,.25); }
