/* OCEO Management Dashboard — interface styles.
   One restrained palette, taken from the company letterhead: the red of the emblem as the accent, the
   charcoal of its lettering for the sidebar and primary actions, and the pale sky blue of the footer band
   for tinted surfaces. Status is always carried by icon + label, never colour alone, and the status colours
   (green, amber, red) keep their own meaning: the brand red is an accent and never means "critical". */
:root {
  color-scheme: light;
  /* surfaces and lines (the pale blue of the letterhead's footer band, very much lightened) */
  --bg: #f3f7fa;
  --surface: #ffffff;
  --surface-2: #f6fafc;
  --tint: #e4f4fc;            /* table headers, selected rows, quiet panels */
  --tint-2: #d4edf9;          /* the band colour itself: hover on tinted areas */
  --border: #dbe4ec;
  --border-strong: #c2cfda;
  /* text: the charcoal of the letterhead's lettering */
  --ink: #25222a;
  --ink-2: #4a464f;
  --ink-3: #66626b;
  /* sidebar and primary actions */
  --brand: #2b282f;
  --brand-2: #3a363f;
  --brand-ink: #d9d6dd;
  --brand-muted: #a9a5b0;
  /* the red of the emblem: a thin accent line, never a status */
  --accent: #e5574f;
  --accent-ink: #c4372f;
  --link: #1a6b96;
  --focus: #1d86bd;

  --green: #0ca30c;  --green-ink: #0b6410;  --green-bg: #e8f6e8;
  --amber: #fab219;  --amber-ink: #744d00;  --amber-bg: #fff3d4;
  --red: #d03b3b;    --red-ink: #a01f1f;    --red-bg: #fdeaea;
  --blue: #1a78ac;   --blue-ink: #14587c;   --blue-bg: #e4f4fc;
  --grey: #9a97a1;   --grey-ink: #4a464f;   --grey-bg: #eeedf1;
  --serious: #ec835a;

  /* measures: one colour per measure everywhere in the application */
  --m-engineering: #1a78ac;
  --m-achieved: #1baf7a;
  --m-invoiced: #6250d6;
  --m-received: #e87ba4;
  --m-planned: #898781;
  --track: #e5ebf0;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(37, 34, 42, .05), 0 1px 3px rgba(37, 34, 42, .04);
  --sidebar: 236px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* a hidden element stays hidden whatever its layout rule */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.45; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
/* a figure shown without a drill-down (the viewer has no page behind it) reads as plain text */
a:not([href]) { color: inherit; cursor: default; }
a:not([href]):hover { text-decoration: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 15px; }
h3 { font-size: 13px; }
p { margin: 0 0 8px; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
.icon.lg { width: 20px; height: 20px; }

/* ---------- shell */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar); background: var(--brand); color: var(--brand-ink); flex: none; display: flex;
  flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; border-top: 4px solid var(--accent); }
.sidebar :focus-visible { outline-color: #6cc3ee; }   /* the blue of the focus ring, lightened for the dark ground */
.brand { padding: 16px 18px 14px; display: flex; align-items: center; gap: 12px; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand:hover { text-decoration: none; }
/* the emblem is a round badge on a white margin, so it keeps its own colours on the dark sidebar */
.brand-logo { width: 48px; height: 48px; flex: none; display: block; border-radius: 50%; }
.brand-mark { font-weight: 800; font-size: 20px; letter-spacing: .14em; line-height: 1; }
.brand-sub { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--brand-muted); margin-top: 5px; }
.nav { padding: 6px 10px 16px; flex: 1; }
.nav-label { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--brand-muted); padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: var(--brand-ink); font-weight: 500; }
.nav a:hover { background: var(--brand-2); text-decoration: none; color: #fff; }
.nav a.active { background: #fff; color: var(--ink); box-shadow: inset 3px 0 0 var(--accent); }
.sidebar-foot { padding: 12px 20px 16px; font-size: 11.5px; color: var(--brand-muted); border-top: 1px solid rgba(255,255,255,.08); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; background: none; border: 1px solid var(--border); border-radius: 7px; padding: 6px 8px; cursor: pointer; color: var(--ink); }
.user { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.user .who { text-align: right; line-height: 1.25; }
.user .who span { display: block; color: var(--ink-3); font-size: 11.5px; }
.content { padding: 20px 24px 40px; max-width: 1560px; width: 100%; }
.demo-banner { background: #fff3d4; color: var(--amber-ink); border-bottom: 1px solid #f1dca4; padding: 6px 24px; font-size: 12.5px; font-weight: 600; display: flex; gap: 8px; align-items: center; }

/* ---------- page head */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 16px; }
.page-head .titles { flex: 1; min-width: 240px; }
.page-head .sub { color: var(--ink-3); margin-top: 3px; font-size: 13px; }
.crumbs { font-size: 12.5px; color: var(--ink-3); margin-bottom: 6px; }
.crumbs a { color: var(--ink-3); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 7px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 550; font-size: 13px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); }
.btn-danger { background: #fff; border-color: #e3b1b1; color: var(--red-ink); }
.btn-danger:hover { background: var(--red-bg); }
.btn-sm { padding: 4px 8px; font-size: 12px; }
.btn-link { border: 0; background: none; color: var(--link); padding: 0; font: inherit; cursor: pointer; }
.inline-form { display: inline; }
.order-buttons { display: inline-flex; gap: 4px; margin-right: 6px; vertical-align: middle; }

/* ---------- cards and grids */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; padding: 14px 16px 0; }
.card-head .hint { color: var(--ink-3); font-size: 12px; }
.card-head .more { margin-left: auto; font-size: 12.5px; white-space: nowrap; }
.card-head .quick-find { margin-left: auto; width: 220px; max-width: 100%; padding: 5px 9px; font-size: 13px; }
.card-body { padding: 12px 16px 16px; }
.card-body.flush { padding: 8px 0 4px; }
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-32 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.g-23 { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
.stack > * + * { margin-top: 16px; }
.section-title { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); font-weight: 650; margin: 18px 0 8px; }

/* ---------- KPI tiles */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; display: block; color: inherit; position: relative; min-width: 0; }
a.kpi[href]:hover { border-color: var(--border-strong); text-decoration: none; box-shadow: 0 2px 8px rgba(37,34,42,.08); }
.kpi .label { color: var(--ink-2); font-size: 12.5px; font-weight: 550; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin-top: 4px; line-height: 1.15; }
.kpi .value small { font-size: 13px; font-weight: 550; color: var(--ink-3); letter-spacing: 0; }
.kpi .note { color: var(--ink-3); font-size: 12px; margin-top: 3px; min-height: 17px; }
.kpi.tone-red .label .icon { color: var(--red); }
.kpi.tone-amber .label .icon { color: #c98500; }
.kpi.tone-green .label .icon { color: var(--green); }
.kpi.tone-blue .label .icon { color: var(--blue); }
.kpi.tone-grey .label .icon { color: var(--grey); }
.kpi.alert-red { border-left: 3px solid var(--red); }
.kpi.alert-amber { border-left: 3px solid var(--amber); }

/* ---------- hero */
.hero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 4fr); gap: 16px; margin-bottom: 16px; }
.hero-figure { font-size: 52px; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.hero-line { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.hero-line .cap { font-size: 15px; color: var(--ink-2); font-weight: 550; }

/* ---------- chips */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px 2px 6px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.5; }
.chip .icon { width: 13px; height: 13px; vertical-align: 0; }
.chip-green { background: var(--green-bg); color: var(--green-ink); }
.chip-amber { background: var(--amber-bg); color: var(--amber-ink); }
.chip-red { background: var(--red-bg); color: var(--red-ink); }
.chip-blue { background: var(--blue-bg); color: var(--blue-ink); }
.chip-grey { background: var(--grey-bg); color: var(--grey-ink); }
.tag { display: inline-block; padding: 1px 6px; border-radius: 5px; background: var(--grey-bg); color: var(--grey-ink); font-size: 11.5px; font-weight: 600; }
.tag-int { background: var(--blue-bg); color: var(--blue-ink); }

/* ---------- tables */
.table-wrap { overflow-x: auto; position: relative; }   /* positioned: keeps hidden header text inside the scroll area */
.table th { position: relative; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: 12px; padding: 8px 12px; border-bottom: 1px solid var(--border-strong); white-space: nowrap; background: var(--tint); }
.table td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #f0f8fd; }
.table th.num, .table td.num { text-align: right; }
.table .sort { color: inherit; }
.table .primary { font-weight: 600; color: var(--ink); }
.table td .sub { display: block; color: var(--ink-3); font-size: 12px; margin-top: 1px; }
.table.compact td, .table.compact th { padding: 6px 10px; }
.table tfoot td { font-weight: 650; border-top: 1px solid var(--border-strong); }
.row-overdue td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; color: var(--ink-3); font-size: 12.5px; gap: 12px; flex-wrap: wrap; }
.pager .pages { display: flex; gap: 6px; }

/* ---------- meters and bars */
.meter { height: 8px; border-radius: 4px; background: var(--track); position: relative; overflow: visible; min-width: 60px; }
.meter > .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--m-invoiced); width: 0; }
.meter > .fill.engineering { background: var(--m-engineering); }
.meter > .fill.achieved { background: var(--m-achieved); }
.meter > .fill.invoiced { background: var(--m-invoiced); }
.meter > .fill.received { background: var(--m-received); }
.meter > .fill.neutral { background: var(--blue); }
.meter > .mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); border-radius: 1px; box-shadow: 0 0 0 2px var(--surface); }
.meter.thin { height: 6px; }
.meter-cell { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.meter-cell .meter { flex: 1; }
.meter-cell .fig { width: 42px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

.measure-list { display: grid; gap: 12px; }
.measure { display: grid; grid-template-columns: 170px minmax(0, 1fr) 60px; gap: 10px; align-items: center; }
.measure .name { font-weight: 550; display: flex; align-items: center; gap: 7px; }
.measure .fig { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.measure .why { grid-column: 2 / 4; color: var(--ink-3); font-size: 12px; margin-top: -6px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.swatch.engineering { background: var(--m-engineering); } .swatch.achieved { background: var(--m-achieved); }
.swatch.invoiced { background: var(--m-invoiced); } .swatch.received { background: var(--m-received); }
.swatch.rest { background: #ccd3da; } .swatch.planned { background: var(--m-planned); }
.swatch.green { background: var(--green); } .swatch.amber { background: var(--amber); } .swatch.red { background: var(--red); }
.swatch.blue { background: var(--blue); } .swatch.grey { background: var(--grey); } .swatch.greylight { background: #ccd3da; }
.swatch.greydark { background: #625e6a; } .swatch.mark { width: 3px; height: 12px; border-radius: 1px; background: var(--ink); }

.progress-list { display: grid; gap: 9px; }
.progress-row { display: grid; grid-template-columns: minmax(150px, 1.5fr) minmax(120px, 2fr) 50px 50px; gap: 12px; align-items: center; }
.progress-row .who { min-width: 0; }
.progress-row .who a { font-weight: 600; color: var(--ink); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-row .who span { color: var(--ink-3); font-size: 12px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-head { color: var(--ink-3); font-size: 11.5px; font-weight: 600; }
.progress-row .fig { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

.rank-list { display: grid; gap: 8px; }
.rank { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(80px, 1.3fr) 30px; gap: 10px; align-items: center; }
.rank a { color: var(--ink); }
.rank .fig { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }

/* tall segmented bar: one whole split into parts */
.seg { display: flex; gap: 2px; height: 28px; width: 100%; }
.seg > .part { min-width: 6px; border-radius: 4px; color: #fff; font-size: 12px; font-weight: 650; display: flex; align-items: center; padding: 0 8px; overflow: hidden; white-space: nowrap; flex: 0 0 0; }
.seg > a.part[href]:hover { text-decoration: none; filter: brightness(1.08); }
.seg .part.narrow { padding: 0; font-size: 0; }
.part.green { background: var(--green); } .part.amber { background: var(--amber); color: #0b0b0b; }
.part.red { background: var(--red); } .part.blue { background: var(--blue); } .part.grey { background: var(--grey); color: #0b0b0b; }
.part.greylight { background: #ccd3da; color: #0b0b0b; } .part.greydark { background: #625e6a; }
.part.received { background: var(--m-received); color: #0b0b0b; } .part.invoiced { background: var(--m-invoiced); }
.part.achieved { background: var(--m-achieved); color: #0b0b0b; } .part.rest { background: #ccd3da; color: #0b0b0b; }
.part.untracked { background: #8f8c97; color: #0b0b0b; } .swatch.untracked { background: #8f8c97; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 12.5px; color: var(--ink-2); }
.legend .item { display: inline-flex; align-items: center; gap: 6px; }
.legend a { color: inherit; }
.legend b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- charts */
.chart-box { position: relative; height: 260px; }
.chart-box.short { height: 220px; }
details.table-view { margin-top: 8px; font-size: 12.5px; }
details.table-view summary { cursor: pointer; color: var(--ink-3); }
details.table-view .table-wrap { margin-top: 8px; max-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }

/* ---------- lists */
.attn { list-style: none; margin: 0; padding: 0; }
.attn li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); align-items: start; }
.attn li:last-child { border-bottom: 0; }
.attn .t a { font-weight: 600; color: var(--ink); }
.attn .t p { margin: 2px 0 0; color: var(--ink-2); font-size: 12.5px; }
.kv { display: grid; grid-template-columns: minmax(120px, 190px) minmax(0, 1fr); gap: 6px 14px; margin: 0; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.empty { padding: 22px 16px; text-align: center; color: var(--ink-3); }
.empty .icon { width: 22px; height: 22px; display: block; margin: 0 auto 6px; color: var(--grey); }
.note-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; color: var(--ink-2); font-size: 12.5px; }
.issue { display: flex; gap: 8px; padding: 8px 10px; border-radius: 8px; font-size: 12.5px; margin-bottom: 6px; align-items: flex-start; }
.issue.error { background: var(--red-bg); color: var(--red-ink); }
.issue.warning { background: var(--amber-bg); color: var(--amber-ink); }
.issue .icon { margin-top: 1px; }

/* timeline of contractual milestones */
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; }
.timeline li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; padding: 0 0 14px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 10px; top: 20px; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline .dot { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--grey-bg); color: var(--grey-ink); z-index: 1; }
.timeline .dot .icon { width: 13px; height: 13px; }
.timeline .done .dot { background: var(--green); color: #fff; }
.timeline .late .dot { background: var(--red-bg); color: var(--red-ink); }
.timeline .waived .dot { background: var(--grey-bg); color: var(--grey); }
.timeline .ttl { font-weight: 600; }
.timeline .meta { color: var(--ink-3); font-size: 12px; margin-top: 1px; }
.timeline .side { text-align: right; font-size: 12.5px; }
.timeline .side b { display: block; font-variant-numeric: tabular-nums; }

/* scopes */
details.scope { border: 1px solid var(--border); border-radius: 9px; margin-bottom: 10px; background: var(--surface); }
details.scope > summary { list-style: none; cursor: pointer; padding: 11px 14px; display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.4fr) minmax(110px, 1fr) auto; gap: 12px; align-items: center; }
details.scope > summary::-webkit-details-marker { display: none; }
details.scope > summary .caret { transition: transform .15s; color: var(--ink-3); }
details.scope[open] > summary .caret { transform: rotate(90deg); }
details.scope[open] > summary { border-bottom: 1px solid var(--border); }
details.scope .scope-body { padding: 6px 4px 10px; }
.scope-name { font-weight: 600; }
.scope-name span { display: block; font-weight: 400; color: var(--ink-3); font-size: 12px; }

/* ---------- forms */
form.stack label, .field label { font-weight: 600; font-size: 12.5px; color: var(--ink-2); display: block; margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], input[type=search], input[type=file], select, textarea {
  width: 100%; padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: 7px; font: inherit; color: var(--ink); background: #fff; min-height: 34px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--brand); vertical-align: -3px; margin: 0 6px 0 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px 20px; align-items: start; }
select { text-overflow: ellipsis; }
.section-blurb { margin: -4px 0 12px; color: var(--ink-3); font-size: 12.5px; }
.note-box.intro p { margin: 0 0 6px; }
.note-box.intro p:last-child { margin-bottom: 0; }
.note-box.intro strong { color: var(--ink); }
.field.wide { grid-column: 1 / -1; }
.field .help { color: var(--ink-3); font-size: 12px; margin-top: 4px; }
.field .help ul { margin: 4px 0 0; padding-left: 18px; }
.field .help b { color: var(--ink-2); font-weight: 600; }
.field.check label { display: inline; font-weight: 550; color: var(--ink); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--red); }
.errorlist { list-style: none; margin: 4px 0 0; padding: 0; color: var(--red-ink); font-size: 12.5px; font-weight: 550; }
.req { color: var(--red-ink); }
fieldset { border: 0; padding: 0; margin: 0 0 18px; }
legend { font-size: 13.5px; font-weight: 650; padding: 0; margin-bottom: 10px; color: var(--ink); width: 100%; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 12px; align-items: end; }
.filters label { font-size: 11.5px; font-weight: 600; color: var(--ink-3); display: block; margin-bottom: 3px; }
.filters .btns { display: flex; gap: 8px; }
details.filter-card > summary { cursor: pointer; list-style: none; padding: 10px 16px; display: flex; align-items: center; gap: 8px; font-weight: 600; }
details.filter-card > summary::-webkit-details-marker { display: none; }
details.filter-card[open] > summary { border-bottom: 1px solid var(--border); }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-weight: 400; }
.grid-form td input, .grid-form td select { min-width: 110px; padding: 5px 8px; min-height: 30px; }
.grid-form td input[type=number] { min-width: 72px; width: 80px; }
.grid-form td input[type=text] { min-width: 180px; }
.perm-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.perm-groups h3 { margin-bottom: 8px; color: var(--ink-2); }
.perm-groups label { display: block; font-weight: 500; color: var(--ink); margin-bottom: 6px; }

/* ---------- messages */
.messages { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; }
.messages li { padding: 10px 14px; border-radius: 8px; font-weight: 550; display: flex; gap: 8px; align-items: flex-start; }
.messages .success { background: var(--green-bg); color: var(--green-ink); }
.messages .error { background: var(--red-bg); color: var(--red-ink); }
.messages .warning { background: var(--amber-bg); color: var(--amber-ink); }
.messages .info { background: var(--blue-bg); color: var(--blue-ink); }
/* the points to check before an entry is saved (invoice form): read, then tick, then save */
.check-box { background: var(--amber-bg); color: var(--amber-ink); border-radius: 8px; padding: 12px 14px; margin: 0 0 16px; }
.check-box .check-title { margin: 0 0 6px; font-weight: 650; display: flex; gap: 8px; align-items: center; }
.check-box ul { margin: 0 0 10px; padding-left: 22px; display: grid; gap: 6px; }
.check-confirm { display: flex; gap: 8px; align-items: center; font-weight: 600; cursor: pointer; }
.check-confirm input[type=checkbox] { flex: none; margin: 0; }
/* a record that somebody else is editing: said at the top of the screen, with the person to contact */
.lock-box { background: var(--amber-bg); color: var(--amber-ink); border: 1px solid #f1dca4; border-radius: 8px; padding: 12px 14px; margin: 0 0 16px; }
.lock-box p { margin: 0 0 8px; }
.lock-box .lock-title { font-weight: 650; display: flex; gap: 8px; align-items: center; }
.lock-box a:not(.btn) { color: inherit; text-decoration: underline; }
.lock-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; }
.lock-actions .inline-form { display: inline-flex; }
fieldset.lock-fieldset { margin: 0; min-width: 0; }
/* "Updated by Usama, today at 14:10" under a record */
.who { color: var(--ink-3); font-size: 12px; }
.page-head .who { font-size: 13px; }
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 20px; font-weight: 650; letter-spacing: .04em; background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: 8px; padding: 12px 16px; display: inline-block; user-select: all; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }

/* ---------- auth pages */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(160deg, #25222a 0%, #2b282f 52%, #3a363f 100%); }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 14px; padding: 26px 30px 26px; box-shadow: 0 20px 50px rgba(0,0,0,.28); border-top: 4px solid var(--accent); }
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand .brand-logo { width: 80px; height: 80px; margin: 0 auto 12px; }
.auth-card .brand-mark { color: var(--brand); font-size: 24px; }
.auth-card .brand-sub { color: var(--ink-3); margin-top: 6px; }
.auth-card .field { margin-bottom: 14px; }
.auth-card .btn { width: 100%; justify-content: center; padding: 10px; }
.auth-foot { color: var(--ink-3); font-size: 12px; margin-top: 16px; text-align: center; }

/* ---------- responsive */
@media (max-width: 1180px) {
  .hero, .g-32, .g-23, .g-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  body.nav-open .scrim { display: block; }
  .menu-btn { display: inline-flex; }
  .g-2 { grid-template-columns: minmax(0, 1fr); }
  .content { padding: 16px 14px 32px; }
  .topbar { padding: 8px 14px; }
  .demo-banner { padding: 6px 14px; }
  .hero-figure { font-size: 42px; }
  .measure { grid-template-columns: 130px minmax(0, 1fr) 52px; }
  .progress-row { grid-template-columns: minmax(0, 1.4fr) minmax(70px, 1fr) 44px 44px; gap: 8px; }
  /* scope header: name and status on the first line, current stage and progress below */
  details.scope > summary { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; }
  details.scope > summary > :nth-child(1) { grid-column: 1; grid-row: 1; }
  details.scope > summary > :nth-child(4) { grid-column: 2; grid-row: 1; }
  details.scope > summary > :nth-child(2) { grid-column: 1 / -1; grid-row: 2; font-size: 12.5px; color: var(--ink-2); }
  details.scope > summary > :nth-child(3) { grid-column: 1 / -1; grid-row: 3; }
  .user .who { display: none; }
  .kpi .value { font-size: 22px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}
.scrim { display: none; position: fixed; inset: 0; background: rgba(37,34,42,.5); z-index: 40; }
@media print {
  .sidebar, .topbar, .actions, .filter-card, .demo-banner, .menu-btn { display: none !important; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; }
  .card, .kpi { box-shadow: none; break-inside: avoid; }
}
details.filter-card { margin-bottom: 16px; }
.content > .card, .content > form > .card, .content > .note-box { margin-bottom: 16px; }
.note-box { display: block; }
.card-body > .note-box { margin: 12px 0 0; }
.card-body > .kv { margin-top: 12px; }
.card-body > .issue:first-of-type { margin-top: 10px; }

/* ---------- administration */
.link-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.link-list li a { font-weight: 600; display: inline-flex; gap: 7px; align-items: center; }
.link-list li span { display: block; color: var(--ink-3); font-size: 12.5px; margin: 1px 0 0 23px; }
.link-list.cols { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.plain-list { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 8px; }
.plain-list li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 9px; align-items: start; color: var(--ink-2); }
.plain-list li .icon { margin-top: 2px; color: var(--ink-3); }
ol.steps { margin: 0 0 10px; padding-left: 20px; display: grid; gap: 5px; color: var(--ink-2); }
.danger-card { border-color: #e7c2c2; }
.perm-groups label.perm-item { display: grid; grid-template-columns: 22px minmax(0, 1fr); align-items: start; margin-bottom: 9px; cursor: pointer; }
.perm-item input { margin-top: 2px; }
.perm-item .perm-hint { grid-column: 2; color: var(--ink-3); font-size: 12px; font-weight: 400; }
.perm-item.is-admin-only { color: var(--ink-3); cursor: default; }
.audit-changes { font-size: 12.5px; min-width: 260px; }
.audit-changes > div { margin-bottom: 3px; overflow-wrap: anywhere; }
.audit-changes .k { color: var(--ink-3); margin-right: 6px; }
.audit-changes .old { color: var(--ink-3); text-decoration: line-through; }
.audit-changes .new { font-weight: 550; }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--ink-3); }
.kpi .value.text { font-size: 19px; letter-spacing: -.01em; line-height: 1.25; margin-top: 7px; overflow-wrap: anywhere; }

/* ---------- form fields that take two columns */
@media (min-width: 700px) { .field.span2 { grid-column: span 2; } }
.grid-form td input[type=checkbox] { min-width: 0; min-height: 0; width: 16px; height: 16px; padding: 0; }

/* ---------- two independent column stacks (project page) */
.cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; margin-bottom: 16px; align-items: start; }
.cols .stack > .card { margin-bottom: 0; }
@media (max-width: 1180px) { .cols { grid-template-columns: minmax(0, 1fr); } }

/* ---------- register */
.table.register th, .table.register td { padding: 9px 10px; }
.table.register th:first-child, .table.register td:first-child { padding-left: 16px; }
.table.register .col-project { min-width: 240px; max-width: 340px; }
.table.register .meter-cell { min-width: 100px; }
.table.register td .sub { line-height: 1.35; }
.table.sticky-first th:first-child, .table.sticky-first td:first-child { position: sticky; left: 0; z-index: 2; background: var(--surface); }
.table.sticky-first th:first-child { background: var(--tint); }
.table.sticky-first tbody tr:hover td:first-child { background: #f0f8fd; }
.table.actions-table td:first-child { min-width: 280px; }

/* ---------- tablets and phones: tables marked "cards" show each row as a labelled block */
@media (max-width: 900px) {
  table.table.cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.table.cards, table.table.cards tbody, table.table.cards tr, table.table.cards td { display: block; width: 100%; }
  table.table.cards tr { padding: 10px 14px; border-bottom: 1px solid var(--border); }
  table.table.cards tr:last-child { border-bottom: 0; }
  table.table.cards td { border: 0; padding: 3px 0; display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 1px 10px; text-align: left; position: static; min-width: 0; max-width: none; align-items: start; }
  table.table.cards td::before { content: attr(data-label); color: var(--ink-3); font-size: 12px; font-weight: 600; padding-top: 1px; }
  table.table.cards td.card-title { display: block; padding: 0 0 6px; }
  table.table.cards td.card-title::before { content: none; }
  table.table.cards td.num { text-align: left; }
  table.table.cards td > * { grid-column: 2; justify-self: start; }
  table.table.cards td > .meter-cell { justify-self: stretch; }
  table.table.cards td .sub { margin-top: 0; }
  table.table.cards td.card-title > * { grid-column: auto; }
  table.table.cards td:empty { display: none; }
  /* the block's title comes first whatever its column position, and markers move from the cell to the block */
  table.table.cards tr { display: flex; flex-direction: column; }
  table.table.cards td.card-title { order: -1; }
  table.table.cards .row-overdue td:first-child { box-shadow: none; }
  table.table.cards tr.row-overdue { box-shadow: inset 3px 0 0 var(--red); }
  table.table.cards tr.sub-row { padding-top: 0; margin-top: -4px; }
  table.table.cards tfoot { display: block; }
  table.table.cards td.card-actions { display: flex; flex-wrap: wrap; gap: 4px 12px; padding-top: 6px; }
  table.table.cards td.card-actions::before { content: none; }
  table.table.cards .table-only { display: none; }
  table.table.cards .cards-only { display: inline; }
  table.table.cards td input:not([type=checkbox]), table.table.cards td select, table.table.cards td textarea { width: 100%; min-width: 0; max-width: 420px; }
  /* tables that stay tables keep readable columns and scroll sideways inside their card */
  .table-wrap > table.table.wide { min-width: 640px; }
}
/* ---------- phones */
@media (max-width: 720px) {
  .attn li { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .attn.compact .t a, .attn.compact .t strong { white-space: normal; }
  /* milestone timeline: figures go under the text instead of beside it */
  .timeline li { grid-template-columns: 22px minmax(0, 1fr); }
  .timeline .side { grid-column: 2; text-align: left; display: flex; flex-wrap: wrap; gap: 0 10px; align-items: baseline; margin-top: 2px; }
  .timeline .side b, .timeline .side .sub { display: inline; }
}
.cards-only { display: none; }
/* reasons behind a classification: marker and text stay side by side at every width */
.attn.reasons li { grid-template-columns: 16px minmax(0, 1fr); gap: 8px; }
.progress-row { grid-template-columns: minmax(200px, 2.2fr) minmax(110px, 1.8fr) 52px 52px; }
.note-below { margin: 14px 0 0; }
@media (max-width: 900px) { .progress-row { grid-template-columns: minmax(0, 1.4fr) minmax(70px, 1fr) 58px 58px; gap: 8px; } }
.table.register th, .table.register td { padding: 9px 8px; }
.table.register .col-project { min-width: 240px; max-width: 420px; }
.table.register .col-project .name { display: block; color: var(--ink); margin-top: 1px; }
.table.register .meter-cell { min-width: 96px; gap: 6px; }
.table.register .meter-cell .meter { min-width: 48px; }
.table.register .meter-cell .fig { width: 38px; }
.attn.compact li { padding: 8px 0; }
.attn.compact .t a, .attn.compact .t strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attn.compact .t p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.attn .t { min-width: 0; }

/* ---------- phones: the project name takes its own line above the bar and the two figures */
@media (max-width: 720px) {
  .progress-row { grid-template-columns: minmax(0, 1fr) 56px 56px; gap: 3px 8px; }
  .progress-row .who { grid-column: 1 / -1; }
  .progress-head > div:first-child { display: none; }
  .progress-head .legend { margin: 0; }
  .progress-list { gap: 12px; }
}

/* where a project stands: a few short facts in one flowing line (Update Centre table, box above the update forms) */
.standing { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; font-size: 12.5px; line-height: 1.5; }
.standing li { display: inline-flex; flex-wrap: wrap; gap: 0 5px; align-items: baseline; min-width: 0; }
.standing .k { color: var(--ink-3); }
.standing b { font-weight: 650; font-variant-numeric: tabular-nums; }
.standing .late { color: var(--red-ink); font-weight: 600; }
.table td.standing-cell { min-width: 260px; }
.table td.card-title .name { display: block; color: var(--ink); margin-top: 1px; }
.standing-box { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--grey); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 14px; margin-bottom: 16px; }
.standing-box.tone-green { border-left-color: var(--green); }
.standing-box.tone-amber { border-left-color: var(--amber); }
.standing-box.tone-red { border-left-color: var(--red); }
.standing-title { margin-bottom: 6px; font-size: 13px; }
/* a filter whose value is taken from the chosen project: shown, but switched off */
.filters .locked input { background: var(--tint); color: var(--ink-2); border-style: dashed; cursor: not-allowed; }
.locked-note { margin: 10px 0 0; display: flex; gap: 6px; align-items: flex-start; }
.locked-note .icon { flex: none; margin-top: 2px; }
.card-note { padding: 8px 14px 12px; margin: 0; }
