/* Delivery Quality — enterprise theme
   Tokens: harbour navy navigation, cool grey canvas, steel-blue actions, validated categorical chart palette. */
:root {
  --bg: #EEF1F5;
  --panel: #FFFFFF;
  --panel-2: #F7F9FB;
  --line: #DCE2EA;
  --line-2: #E8ECF1;
  --ink: #16212D;
  --ink-2: #3A4959;
  --muted: #5F6E80;
  --nav: #0F2742;
  --nav-2: #17375A;
  --nav-ink: #B4C3D5;
  --brand: #1F5FAD;
  --brand-2: #184E90;
  --brand-weak: #E7EFF9;
  --good: #11752A;  --good-bg: #E4F3E7;
  --warn: #855600;  --warn-bg: #FCF0D3;
  --serious: #A0421A; --serious-bg: #FBE8DE;
  --crit: #B42323;  --crit-bg: #FBE4E4;
  --series-1: #257de0; --series-2: #f47230; --series-3: #00b894; --series-4: #f2a600;
  --series-5: #ee7fac; --series-6: #008a17; --series-7: #6a4ce2; --series-8: #ec4647;
  --grid: #E6EAF0;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(15, 39, 66, .06);
  --font: "Segoe UI Variable Text", "Segoe UI", "Inter", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", "Consolas", "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.45 var(--font); color: var(--ink); background: var(--bg); font-variant-numeric: tabular-nums; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.005em; }
h2 { font-size: 15.5px; }
h3 { font-size: 14px; }
p { margin: 0 0 .6em; }
code, .mono, pre.code { font-family: var(--mono); font-size: 12.5px; }
pre.code { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 10px 12px; overflow: auto; max-height: 360px; margin: 6px 0 0; white-space: pre-wrap; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mt { margin-top: 14px; } .mb { margin-bottom: 12px; }
.pre { white-space: pre-wrap; }
.clip { display: inline-block; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.clip-wide { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.late { color: var(--crit); font-weight: 600; }
.up { color: var(--good); font-size: 11px; } .down { color: var(--crit); font-size: 11px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 3px; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- shell ---------- */
.side { position: fixed; inset: 0 auto 0 0; width: 236px; background: var(--nav); color: var(--nav-ink); display: flex; flex-direction: column; z-index: 30; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 18px 14px; color: #fff; text-decoration: none !important; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand span { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand strong { font-size: 15px; font-weight: 600; }
.brand small { color: var(--nav-ink); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side nav { padding: 8px 10px 24px; }
.nav-group { margin-top: 10px; }
.nav-title { display: flex; align-items: center; justify-content: space-between; padding: 5px 10px; font-size: 11.5px; color: #7F93AB; font-weight: 600; cursor: pointer; list-style: none; border-radius: 6px; user-select: none; }
.nav-title::-webkit-details-marker { display: none; }
.nav-title:hover { color: #fff; background: rgba(255,255,255,.04); }
.nav-title:focus-visible { outline: 2px solid #6FB0FF; outline-offset: 1px; }
.nav-chev { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.nav-group[open] > .nav-title .nav-chev { transform: rotate(90deg); }
.nav-tools { display: flex; justify-content: flex-end; gap: 10px; padding: 2px 10px 0; }
.nav-tools .link-btn { color: #7F93AB; font-size: 11.5px; }
.nav-tools .link-btn:hover { color: #fff; }
@media (prefers-reduced-motion: reduce) { .nav-chev { transition: none; } }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; color: var(--nav-ink); font-size: 13.5px; text-decoration: none; position: relative; }
.side nav a:hover { background: var(--nav-2); color: #fff; }
.side nav a.on { background: var(--nav-2); color: #fff; font-weight: 600; }
.side nav a.on::before { content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: #6FB0FF; }
.main { margin-left: 236px; min-height: 100vh; display: flex; flex-direction: column; }
.no-nav .main { margin-left: 0; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 10px 24px; background: var(--panel); border-bottom: 1px solid var(--line); min-height: 60px; }
.top-title { flex: 1; min-width: 0; }
.top h1 { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb { font-size: 12.5px; color: var(--muted); }
.top-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.top-actions form { margin: 0; }
.nav-toggle { display: none; }
.usermenu { position: relative; }
.usermenu summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary:hover { background: var(--panel-2); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-weak); color: var(--brand-2); display: grid; place-items: center; font-weight: 600; font-size: 12px; }
.who { display: flex; flex-direction: column; line-height: 1.15; }
.who small { color: var(--muted); font-size: 11.5px; }
.usermenu .menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(15,39,66,.14); min-width: 200px; padding: 6px; }
.usermenu .menu a, .usermenu .menu button { display: flex; gap: 8px; align-items: center; width: 100%; padding: 8px 10px; border-radius: 6px; color: var(--ink); background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.usermenu .menu a:hover, .usermenu .menu button:hover { background: var(--panel-2); text-decoration: none; }
.content { padding: 20px 24px 48px; display: flex; flex-direction: column; gap: 16px; }

/* ---------- atoms ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: 500 13.5px var(--font); cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.btn:hover { border-color: #C3CDD9; background: var(--panel-2); }
.btn .ic { width: 16px; height: 16px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn-quiet { background: transparent; }
.btn-small { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; height: 40px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; font-size: 13px; }
.link-btn:hover, .link:hover { text-decoration: underline; }
.icon-btn { background: none; border: 0; width: 34px; height: 34px; border-radius: 6px; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); font-size: 20px; }
.icon-btn:hover { background: var(--panel-2); }

.badge { display: inline-flex; align-items: center; height: 21px; padding: 0 8px; border-radius: 11px; font-size: 12px; font-weight: 500; white-space: nowrap; border: 1px solid transparent; }
.b-neutral { background: #EEF1F5; color: var(--ink-2); }
.b-quiet { background: transparent; color: var(--muted); border-color: var(--line); }
.b-blue { background: #E3EEFB; color: #1B5AA6; }
.b-violet { background: #EEEAFD; color: #4C35B5; }
.b-aqua { background: #DDF5EF; color: #0B6E59; }
.b-orange { background: #FDEBDD; color: #A2481B; }
.b-green, .b-good { background: var(--good-bg); color: var(--good); }
.b-done { background: var(--good); color: #fff; }
.b-red, .b-critical { background: var(--crit-bg); color: var(--crit); }
.b-warning { background: var(--warn-bg); color: var(--warn); }
.b-serious { background: var(--serious-bg); color: var(--serious); }

.rating { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13px; padding: 2px 10px 2px 2px; border-radius: 6px; white-space: nowrap; }
.rating b { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; font-size: 12.5px; }
.rating i { font-style: normal; font-weight: 500; font-size: 11px; padding: 1px 6px; border-radius: 9px; background: rgba(255,255,255,.7); border: 1px dashed currentColor; }
.r-0 { color: var(--muted); padding: 2px 8px; border: 1px dashed var(--line); font-weight: 500; }
.r-1 { background: var(--crit-bg); color: var(--crit); } .r-1 b { background: var(--crit); color: #fff; }
.r-2 { background: var(--serious-bg); color: var(--serious); } .r-2 b { background: #C65A26; color: #fff; }
.r-3 { background: var(--brand-weak); color: var(--brand-2); } .r-3 b { background: var(--brand); color: #fff; }
.r-4 { background: var(--good-bg); color: var(--good); } .r-4 b { background: #1C8A3A; color: #fff; }
.r-5 { background: #D5EEDC; color: #0B5A2A; } .r-5 b { background: #0B5A2A; color: #fff; }

.flash { padding: 10px 14px; border-radius: var(--radius); border: 1px solid; font-size: 13.5px; }
.flash-success { background: var(--good-bg); border-color: #BFE1C7; color: #0D5E22; }
.flash-error { background: var(--crit-bg); border-color: #F1C3C3; color: #8F1B1B; }
.flash-warning { background: var(--warn-bg); border-color: #EED79B; color: #6F4800; }
.flash-info { background: var(--brand-weak); border-color: #C9DAF0; color: var(--brand-2); }
.callout { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: var(--radius); padding: 10px 14px; color: var(--ink-2); margin: 0; font-size: 13.5px; }
.callout.warn { border-left-color: #D99A00; background: #FFFBF0; }
.callout.bad { border-left-color: var(--crit); background: #FFF7F7; }

/* freshness indicator */
.fresh { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); padding: 4px 10px; border-radius: 14px; border: 1px solid var(--line); text-decoration: none !important; white-space: nowrap; }
.fresh::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #9AA7B6; }
.f-ok::before { background: #1C9A40; } .f-warn::before { background: #E0A100; } .f-bad::before { background: var(--crit); } .f-off { color: var(--muted); }

/* ---------- panels and layout ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; overflow-x: auto; }
.panel.flush { padding: 0; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.panel-head.pad, .pad { padding: 14px 18px; margin: 0; }
.panel.flush .panel-head.pad { border-bottom: 1px solid var(--line-2); }
.row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-2.tight { gap: 12px; }
.scroll-x { overflow-x: auto; }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.empty h2, .empty h3 { color: var(--ink-2); font-size: 14.5px; margin-bottom: 4px; }
.empty p { margin: 0 auto 12px; max-width: 460px; font-size: 13px; }
.notes { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 13px; }
.notes li { margin-bottom: 6px; }

/* ---------- KPI data strips ---------- */
.dim { display: grid; grid-template-columns: 190px 1fr; gap: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); overflow: hidden; }
.dim > header { padding: 14px 16px; border-right: 1px solid var(--line-2); background: var(--panel-2); }
.dim > header h2 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.dim > header h2::before { content: ""; width: 10px; height: 10px; border-radius: 2px; background: var(--brand); }
.dim:nth-of-type(2) > header h2::before { background: #00A383; }
.dim:nth-of-type(3) > header h2::before { background: #E8742F; }
.dim:nth-of-type(4) > header h2::before { background: #6A4CE2; }
.dim > header p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.dim .kpis { margin: -1px -1px -1px 0; border: 0; border-radius: 0; box-shadow: none; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); }
.kpi { background: var(--panel); box-shadow: inset -1px 0 0 var(--line-2), inset 0 -1px 0 var(--line-2); padding: 12px 14px 12px; display: flex; flex-direction: column; gap: 2px; color: var(--ink); text-decoration: none !important; position: relative; min-width: 0; }
a.kpi:hover { background: #FAFCFF; }
a.kpi:hover .kpi-l { color: var(--brand); }
.kpi-l { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.kpi-v { font-size: 22px; font-weight: 600; line-height: 1.25; letter-spacing: -.01em; }
.kpi-v small { font-size: 13px; font-weight: 500; color: var(--muted); }
.kpi-v .badge { font-size: 13px; height: 24px; }
.kpi-c { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.kpi.warn { box-shadow: inset 3px 0 0 #E0A100, inset -1px 0 0 var(--line-2), inset 0 -1px 0 var(--line-2); }
.kpi.bad { box-shadow: inset 3px 0 0 var(--crit), inset -1px 0 0 var(--line-2), inset 0 -1px 0 var(--line-2); }
.kpi.bad .kpi-v { color: var(--crit); }
.kpis.small .kpi-v { font-size: 17px; }

/* ---------- filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; box-shadow: var(--shadow); }
.filters.slim { padding: 8px 14px; }
.filters label > span { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 3px; font-weight: 500; }
.filters select, .filters input[type=date], .filters input[type=search], .filters input[type=text] { height: 32px; min-width: 120px; }
.filters .check { align-self: center; padding-top: 14px; }
.period-label { margin-left: auto; align-self: center; font-weight: 600; color: var(--ink-2); font-size: 13px; padding-top: 14px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; height: 32px; }
.seg label { display: flex; align-items: center; padding: 0 12px; font-size: 13px; cursor: pointer; border-right: 1px solid var(--line); color: var(--ink-2); }
.seg label:last-child { border-right: 0; }
.seg label.on { background: var(--brand); color: #fff; font-weight: 500; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:focus-within { outline: 2px solid var(--brand); outline-offset: -2px; }

/* ---------- forms ---------- */
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=time], input[type=url], input[type=search], select, textarea {
  width: 100%; height: 34px; padding: 0 10px; border: 1px solid #CCD5E0; border-radius: var(--radius); background: #fff; color: var(--ink); font: 13.5px var(--font);
}
textarea { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31,95,173,.16); }
input[disabled], select[disabled], textarea[disabled] { background: var(--panel-2); color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.lbl { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.hint { font-size: 12px; color: var(--muted); }
.check { display: inline-flex; gap: 7px; align-items: center; font-size: 13.5px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; align-content: start; }
.form-grid > h2, .form-grid > h3 { margin-top: 4px; }
.form-grid.narrow { max-width: 820px; }
.form-stack { display: flex; flex-direction: column; gap: 14px; max-width: 460px; }
.span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.form-actions.sticky { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 14px 0 4px; }
.form-layout { display: flex; flex-direction: column; gap: 16px; }
fieldset.sub { border: 1px dashed var(--line); border-radius: var(--radius); padding: 10px 12px 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin: 0; }
fieldset.sub legend { font-size: 12.5px; font-weight: 600; color: var(--ink-2); padding: 0 4px; }
.inline-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0; }
.inline-form select, .inline-form input[type=text], .inline-form input[type=date] { width: auto; height: 28px; font-size: 12.5px; }
.confirm-row { display: flex; gap: 18px; flex-wrap: wrap; }
.bulk { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line-2); padding-top: 12px; margin-top: 10px; font-size: 13px; }
.bulk select, .bulk input { width: auto; height: 30px; }
.bulk input[type=text] { flex: 1; min-width: 220px; }
.bulk input[type=number] { width: 70px; }
.daypick { display: flex; gap: 6px; }
.daypick label { cursor: pointer; }
.daypick input { position: absolute; opacity: 0; }
.daypick span { display: grid; place-items: center; width: 46px; height: 32px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 13px; }
.daypick input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.daypick input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.weights { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 14px; }
.wsum { grid-column: 1 / -1; margin: 0; font-size: 13px; }
.wsum.off strong { color: var(--crit); }
.map-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 14px; }
.rules td { padding: 4px 6px; }
.rules select, .rules input { height: 30px; }

/* complexity */
.cx-grid { display: flex; flex-direction: column; gap: 8px; }
.cx-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.cx-row > span { font-size: 13px; color: var(--ink-2); }
.cx-scale { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cx-scale label { cursor: pointer; }
.cx-scale input { position: absolute; opacity: 0; }
.cx-scale span { display: grid; place-items: center; width: 34px; height: 30px; font-size: 13px; border-right: 1px solid var(--line); }
.cx-scale label:last-child span { border-right: 0; }
.cx-scale input:checked + span { background: var(--brand); color: #fff; font-weight: 600; }
.cx-scale input:focus-visible + span { box-shadow: inset 0 0 0 2px var(--brand-2); }
.cx-total { display: flex; gap: 10px; align-items: baseline; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.cx-total strong { font-size: 24px; }
.cx-bars > div { display: grid; grid-template-columns: 1fr auto 18px; gap: 10px; align-items: center; padding: 4px 0; font-size: 13px; }
.pips { display: inline-flex; gap: 3px; }
.pips i { width: 16px; height: 8px; border-radius: 2px; background: var(--line); }
.pips i.on { background: var(--brand); }
.cx-total-line { margin: 10px 0 0; }

/* ---------- tables ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: 12px; background: var(--panel-2); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.tbl.compact td { padding: 6px 10px; }
.tbl tbody tr:hover td { background: #FAFCFE; }
.tbl tr.total td { font-weight: 600; background: var(--panel-2); border-top: 1px solid var(--line); }
.tbl .num, .tbl th.num { text-align: right; white-space: nowrap; }
.tbl td.c { text-align: center; color: var(--brand); }
.tbl tr.dim-row td { color: var(--muted); }
.tbl[data-sortable] th { cursor: pointer; }
.tbl[data-sortable] th[aria-sort]::after { content: " ▾"; font-size: 10px; }
.tbl[data-sortable] th[aria-sort=ascending]::after { content: " ▴"; }
.panel > .tbl:last-child, .panel > .scroll-x:last-child .tbl { margin-bottom: -4px; }
.perm td, .perm th { text-align: center; } .perm td:first-child { text-align: left; }
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 10px 14px; font-size: 12.5px; color: var(--muted); }
.export { display: flex; gap: 6px; }

/* heat map */
.heat td.hm { min-width: 44px; font-size: 12px; }
.hm.gap { background: #FBF3F1; color: #C27C6E; }
.hm.l1, .tbl tbody tr:hover td.hm.l1 { background: #DCEBFB; } .hm.l2, .tbl tbody tr:hover td.hm.l2 { background: #9DC8F7; }
.hm.l3, .tbl tbody tr:hover td.hm.l3 { background: #4E95E6; color: #fff; } .hm.l4, .tbl tbody tr:hover td.hm.l4 { background: #1757AC; color: #fff; }
.tbl tbody tr:hover td.hm.gap { background: #FBF3F1; }
/* planned in Resource Planning but nothing logged: hatched, muted */
.hm.plan, .tbl tbody tr:hover td.hm.plan { background: repeating-linear-gradient(135deg, #F3F5F8 0 6px, #E7EBF1 6px 8px); color: #5B6878; font-style: italic; }
.hm .plan-sub, td .plan-sub { display: block; font-size: 10.5px; font-weight: 400; opacity: .8; line-height: 1.1; }
.hm small { font-size: 10.5px; }
/* hovering a heat-map row keeps the cell colours and marks the row instead */
.heat tbody tr:hover td.hm { box-shadow: inset 0 2px 0 #1757AC33, inset 0 -2px 0 #1757AC33; }
.heat tbody tr:hover td:first-child { background: #EEF4FC; font-weight: 600; }
.legend-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 10px; }
.legend-row .hm { display: inline-grid; place-items: center; width: 22px; height: 14px; border-radius: 2px; font-size: 11px; }

/* definition lists */
.dl { display: grid; grid-template-columns: 160px 1fr; gap: 7px 14px; margin: 0; font-size: 13.5px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; min-width: 0; }

/* ---------- ticket 360 ---------- */
.t-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.t-title { font-size: 18px; margin-bottom: 6px; }
.t-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.t-people { display: flex; gap: 22px; margin: 0; }
.t-people dt { font-size: 11.5px; color: var(--muted); }
.t-people dd { margin: 0; font-weight: 600; }

.rail { display: grid; grid-template-columns: 2fr 5fr 2fr 5fr 5fr 3fr auto; gap: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 18px 10px; box-shadow: var(--shadow); overflow-x: auto; }
.rail-phase { padding: 0 10px; border-left: 1px solid var(--line-2); min-width: 0; }
.rail-phase:first-child { border-left: 0; padding-left: 0; }
.rail-name { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 10px; }
.rail-steps { display: flex; align-items: center; position: relative; }
.rail-steps::before { content: ""; position: absolute; left: 6px; right: 6px; top: 6px; height: 2px; background: var(--line); }
.rs { flex: 1; display: flex; flex-direction: column; align-items: flex-start; position: relative; min-width: 16px; }
.rs:last-child { flex: 0 0 auto; }
.rs i { width: 14px; height: 14px; border-radius: 50%; background: var(--panel); border: 2px solid #C5CFDB; position: relative; z-index: 1; }
.rs em { font-style: normal; font-size: 11.5px; color: var(--muted); margin-top: 6px; white-space: nowrap; display: none; }
.rs-done i { background: var(--brand); border-color: var(--brand); }
.rs-skipped i { border-style: dashed; border-color: #9AA9BB; }
.rs-ex i { box-shadow: 0 0 0 3px #F6D98A; }
.rs-now i { background: #fff; border: 4px solid var(--brand); width: 18px; height: 18px; margin-top: -2px; box-shadow: 0 0 0 4px rgba(31,95,173,.15); }
.rs-now em { display: block; color: var(--brand-2); font-weight: 600; position: absolute; top: 18px; left: 0; }
.rail-phase:has(.rs-now) { padding-bottom: 18px; }
.rail-reopen { align-self: center; padding-left: 12px; }
.next-step { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 9px 14px; background: var(--brand-weak); border: 1px solid #CFDDF0; border-radius: 8px; font-size: 13.5px; }
.next-step.blocked { background: #FFF9EC; border-color: #F0DDA8; }
.next-step .gate { color: var(--warn); font-size: 13px; flex: 1; }
.next-step form { margin: 0 0 0 auto; }

.t360 { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 1px; background: var(--line-2); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); }
.t360 > div { background: var(--panel); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.t360 span { font-size: 11.5px; color: var(--muted); }
.t360 strong { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t360 small { font-size: 11.5px; color: var(--muted); line-height: 1.3; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--ink-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--brand-2); border-bottom-color: var(--brand); font-weight: 600; }
.tabs .count { font-size: 11px; background: #E7ECF2; color: var(--ink-2); border-radius: 9px; padding: 1px 6px; margin-left: 4px; }
.tab { display: flex; flex-direction: column; gap: 16px; }
.js .tab { display: none; }
.js .tab.on { display: flex; }

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.checklist li > div { flex: 1; display: flex; flex-direction: column; }
.ck-mark { width: 20px; height: 20px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 700; margin-top: 1px; }
.ck-pass .ck-mark { background: var(--good); } .ck-pass .ck-mark::after { content: "✓"; color: #fff; }
.ck-fail .ck-mark { background: var(--crit-bg); border: 2px solid var(--crit); } .ck-fail .ck-mark::after { content: "!"; color: var(--crit); }
.ck-na .ck-mark { border: 2px dashed #B6C1CE; } .ck-na strong { color: var(--muted); font-weight: 500; }
.ck-exception .ck-mark { background: #F6D98A; } .ck-exception .ck-mark::after { content: "E"; color: #6F4800; }

/* ---------- dialogs ---------- */
dialog.dlg { border: 0; border-radius: 10px; padding: 0; width: min(680px, calc(100vw - 32px)); box-shadow: 0 24px 64px rgba(15,39,66,.28); color: var(--ink); }
dialog.dlg::backdrop { background: rgba(15,39,66,.45); }
.dlg header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.dlg-body { padding: 16px 18px; max-height: 68vh; overflow: auto; }
.dlg footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line-2); background: var(--panel-2); }
.ev-planning { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.ev-planning .lbl { width: 100%; }

/* ---------- charts ---------- */
.chart-card { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px 10px; box-shadow: var(--shadow); min-width: 0; }
.chart-card figcaption { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-bottom: 6px; }
.chart-card figcaption strong { font-size: 14.5px; }
.chart-card figcaption span { font-size: 12px; color: var(--muted); flex: 1; }
.chart { position: relative; min-height: 220px; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { font: 11.5px var(--font); fill: var(--muted); }
.chart .axis line, .chart .grid line { stroke: var(--grid); }
.chart .lbl-val { fill: var(--ink-2); font-weight: 600; }
.chart .hit { fill: transparent; cursor: default; }
.chart .mark { transition: opacity .12s; }
.chart.hovering .mark { opacity: .45; }
.chart.hovering .mark.hot { opacity: 1; }
.c-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.c-legend span { display: inline-flex; align-items: center; gap: 6px; }
.c-legend i { width: 10px; height: 10px; border-radius: 2px; }
.c-tip { position: absolute; pointer-events: none; background: #fff; border: 1px solid var(--line); box-shadow: 0 6px 18px rgba(15,39,66,.16); border-radius: 6px; padding: 7px 10px; font-size: 12px; white-space: nowrap; z-index: 5; display: none; }
.c-tip b { display: block; margin-bottom: 3px; color: var(--ink); }
.c-tip div { display: flex; gap: 6px; align-items: center; color: var(--ink-2); }
.c-tip i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.c-empty { display: grid; place-items: center; min-height: 200px; color: var(--muted); font-size: 13px; }

/* ---------- scorecards ---------- */
.score-hero { display: grid; grid-template-columns: auto auto 1fr; gap: 28px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 18px 22px; box-shadow: var(--shadow); }
.sh-score { display: flex; align-items: baseline; gap: 6px; }
.sh-num { font-size: 44px; font-weight: 600; letter-spacing: -.02em; line-height: 1; }
.sh-of { color: var(--muted); }
.sh-rating .rating { font-size: 15px; }
.sh-rating .rating b { width: 28px; height: 28px; font-size: 15px; }
.sh-rating p { margin: 6px 0 0; max-width: 300px; }
.sh-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 18px; margin: 0; }
.sh-meta dt { font-size: 11.5px; color: var(--muted); }
.sh-meta dd { margin: 0; font-size: 13.5px; }
.components { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.comp { border: 1px solid var(--line-2); border-radius: 8px; padding: 12px 14px; }
.comp.nodata { background: var(--panel-2); }
.comp-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.meter { position: relative; height: 22px; background: #EDF1F5; border-radius: 4px; margin: 8px 0 10px; overflow: hidden; }
.meter span { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #4E95E6, var(--brand)); border-radius: 4px; }
.meter b { position: absolute; left: 8px; top: 2px; font-size: 12.5px; color: #fff; text-shadow: 0 0 2px rgba(0,0,0,.25); }
.comp.nodata .meter b { color: var(--muted); text-shadow: none; }
.comp-metrics { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0; font-size: 12.5px; }
.comp-metrics dt { color: var(--muted); }
.comp-metrics dd { margin: 0; text-align: right; }
.bands { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.bands li { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }
.r-top { align-items: stretch; }

/* ---------- reports ---------- */
.report-group h2 { margin: 6px 0 10px; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.report-card { display: flex; flex-direction: column; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; color: var(--ink); text-decoration: none !important; box-shadow: var(--shadow); }
.report-card:hover { border-color: #A9C1E2; }
.report-card:hover strong { color: var(--brand); }
.report-card span { font-size: 12.5px; color: var(--muted); }

/* ---------- login & install ---------- */
.no-nav .content { padding: 0; }
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: var(--nav); color: #DCE6F2; display: flex; flex-direction: column; justify-content: center; padding: 56px; gap: 36px; }
.login-tag { font-size: 22px; line-height: 1.4; max-width: 460px; color: #fff; font-weight: 500; }
.rail-demo { display: flex; align-items: flex-start; max-width: 520px; position: relative; }
.rail-demo::before { content: ""; position: absolute; left: 8px; right: 8px; top: 8px; height: 2px; background: #2E4C70; }
.rd-step { flex: 1; display: flex; flex-direction: column; gap: 10px; position: relative; }
.rd-step span { width: 18px; height: 18px; border-radius: 50%; background: var(--nav); border: 2px solid #4C6B90; }
.rd-step.done span { background: #6FB0FF; border-color: #6FB0FF; }
.rd-step.now span { background: var(--nav); border: 5px solid #8FE3B0; }
.rd-step em { font-style: normal; font-size: 12.5px; color: #9FB3CB; }
.rd-step.now em { color: #fff; font-weight: 600; }
.login-card { align-self: center; justify-self: center; width: min(380px, calc(100% - 48px)); display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { font-size: 24px; margin-top: 6px; }
.login-card .muted { margin: -8px 0 6px; }
.install { max-width: 880px; margin: 32px auto; padding: 0 20px; display: flex; flex-direction: column; gap: 16px; }
.install-head { display: flex; gap: 14px; align-items: center; }
.install-head h1 { font-size: 22px; }
.install-head p { margin: 0; color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 1280px) { .t360 { grid-template-columns: repeat(5, minmax(0, 1fr)); } .map-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1100px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .dim { grid-template-columns: 1fr; } .dim > header { border-right: 0; border-bottom: 1px solid var(--line-2); }
  .score-hero { grid-template-columns: 1fr 1fr; } .sh-meta { grid-column: 1 / -1; }
  .rail { grid-template-columns: repeat(6, minmax(120px, 1fr)) auto; }
}
@media (max-width: 900px) {
  .side { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .side.open { transform: none; }
  .main { margin-left: 0; }
  .nav-toggle { display: grid; }
  .who { display: none; }
  .content { padding: 16px 14px 40px; }
  .top { padding: 8px 14px; }
  .form-grid, .weights, .map-grid, fieldset.sub { grid-template-columns: 1fr; }
  .t360 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .login { grid-template-columns: 1fr; } .login-art { display: none; }
  .dl { grid-template-columns: 1fr; gap: 2px; } .dl dd { margin-bottom: 8px; }
  .period-label { margin-left: 0; width: 100%; padding-top: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- print / PDF of on-screen views ---------- */
@media print {
  body { background: #fff; font-size: 11px; }
  .side, .top-actions, .usermenu, .nav-toggle, .filters, .btn, .link-btn, .export, .pager, dialog, .tabs { display: none !important; }
  .main { margin: 0; } .top { position: static; border: 0; padding: 0 0 8px; }
  .content { padding: 0; gap: 10px; }
  .panel, .kpis, .dim, .chart-card, .t360, .rail { box-shadow: none; break-inside: avoid; }
  .js .tab { display: flex !important; }
  .grid-2, .grid-3 { grid-template-columns: 1fr 1fr; }
}

.tbl.heat th.off{background:repeating-linear-gradient(135deg,transparent 0 4px,rgba(120,120,120,.12) 4px 6px);color:var(--muted,#667)}
.desc-en,.desc-text{white-space:normal;line-height:1.55;max-width:80ch;overflow-wrap:anywhere}
.desc-en{font-size:1rem}
.desc-orig{margin-top:.5rem}.desc-orig summary{cursor:pointer;color:var(--muted,#667);font-size:.85rem}
.desc-orig .desc-text{margin-top:.4rem;padding:.5rem .75rem;border-left:3px solid var(--line,#dde);background:var(--bg-soft,#f7f8fa)}
.desc-note{margin-top:.4rem}
ul.plain{list-style:none;margin:.3rem 0 0;padding:0}ul.plain li{padding:2px 0}
/* AI Ticket Intelligence (inline on the ticket page) */
.ai-panel .ai-finding { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 15px; }
.ai-panel .ai-scores { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 8px 0; color: var(--muted); }
.ai-panel .ai-scores strong { color: var(--ink, #1d2733); }
.ai-panel .ai-summary { max-width: 80ch; line-height: 1.55; }
.ai-panel h4 { margin: 14px 0 6px; font-size: 13.5px; }
.ai-panel .ai-match { padding: 8px 0; border-top: 1px solid var(--line); }
.ai-panel .ai-match:first-child { border-top: 0; }
.ai-panel .ai-evidence summary { cursor: pointer; font-size: 12.5px; color: var(--muted); }
.ai-panel q { font-style: italic; }
.ai-panel .ai-review { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.ai-review-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-top: 6px; }
.ai-review-form .grow { flex: 1 1 220px; }
.ai-review-form .grow input { width: 100%; }
.ai-pending { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.spinner { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: #2F6FC4; border-radius: 50%; animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
form.inline { display: inline; margin: 0; }
/* Benchmark time line */
.bench-intro { max-width: 90ch; }
.bench-form { display: flex; flex-direction: column; gap: 16px; }
.tbl.bench { width: 100%; table-layout: fixed; min-width: 760px; }
.tbl.bench col.c-act { width: auto; }
.tbl.bench col.c-h { width: 118px; }
.tbl.bench td { vertical-align: top; }
.tbl.bench .bench-name { width: 100%; font-weight: 600; }
.tbl.bench .bench-alias { width: 100%; margin-top: 4px; height: 30px; font-size: 12.5px; color: var(--muted); }
.tbl.bench .bench-h { width: 100%; text-align: right; }
.tbl.bench tr.new-row .bench-name { font-weight: 400; }
.tbl.bench .bench-total { display: inline-block; min-width: 3ch; padding: 6px 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.tbl.bench tr.total td { background: var(--bg-soft, #f6f8fb); border-top: 2px solid var(--line); }
.tbl.bench tr.total .small { margin-top: 3px; }
.bench-form > .panel:last-child { max-width: 720px; }
