/* ARQVANT · gallery white and gold
   Black = text, buttons and links · Gold = actual progress and the brand line, nothing else · Amber = attention · Green = done / on track · Red = behind / risk */
:root {
  --stripe: #B08A3E;
  --bg: #F5F4F1; --surface: #FFFFFF; --surface-2: #FAF9F7; --ink: #151515; --muted: #6F6B66;
  --line: #E6E2DC; --rule: #A8A39C;
  --accent: #151515; --accent-ink: #FFFFFF; --accent-soft: #F1EEE8;
  --progress: #B08A3E; --plan: #151515;
  --primary: #151515; --primary-ink: #FFFFFF;
  --brass: #C98F00; --brass-soft: #FFF1D1; --brass-ink: #8A5A00;
  --good: #1E7A46; --good-soft: #E3F2E8;
  --warn: #A87700; --warn-soft: #FFF1D1;
  --bad: #B93A26; --bad-soft: #FBE4DF;
  --neutral-soft: #EFEDE9; --plan-bar: #ECE9E4;
  --scrim: rgba(21, 21, 21, 0.45);
  --shadow: 0 1px 2px rgba(21, 21, 21, 0.05), 0 8px 24px rgba(21, 21, 21, 0.07);
  --f-display: "Sora", "Manrope", "Segoe UI", system-ui, sans-serif;
  --f-body: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "Manrope", "Segoe UI", system-ui, sans-serif;
  --f-brand: "Michroma", "Eurostile", "Arial", sans-serif;
  font-synthesis: style;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --stripe: #D1AE66;
    --bg: #0F0F0F; --surface: #1A1A1A; --surface-2: #212121; --ink: #F4F2EE; --muted: #A19D97;
    --line: #2E2E2E; --rule: #5C5955; --accent: #F4F2EE; --accent-ink: #0F0F0F; --accent-soft: #262523;
    --progress: #D1AE66; --plan: #F4F2EE; --primary: #F4F2EE; --primary-ink: #0F0F0F;
    --brass: #F2BE4A; --brass-soft: #3A2C10; --brass-ink: #F2BE4A; --good: #5CC489; --good-soft: #13301F; --warn: #F2BE4A;
    --warn-soft: #3A2C10; --bad: #F08A6C; --bad-soft: #42211A; --neutral-soft: #262626; --plan-bar: #2E2E2E;
    --scrim: rgba(0, 0, 0, 0.6); --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}
/* a contractor's brand colour (Business) drives buttons, links and progress on their screens */
.branded { --primary: var(--accent); --primary-ink: var(--accent-ink); --progress: var(--accent); }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 400 15px/1.5 var(--f-body); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; }
[hidden] { display: none !important; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--f-mono); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.eyebrow { font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.boot { padding: 40px 16px; color: var(--muted); text-align: center; }

.app { max-width: 1240px; margin: 0 auto; padding-inline: clamp(16px, 3vw, 32px);
  padding-block: env(safe-area-inset-top, 0px) calc(56px + env(safe-area-inset-bottom, 0px)); }

/* top bar */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--bg); display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding-block: 12px 14px; }
.topbar::after, .fc-line { content: ""; display: block; height: 3px; background: var(--stripe); }
.topbar::after { position: absolute; left: 0; right: 0; bottom: 0; }
.fc-line { width: 132px; margin-block: 4px 2px; }
.brand { display: flex; align-items: center; gap: 10px; margin-inline-end: auto; text-decoration: none; color: inherit; min-width: 0; }
.brand-name, .wordmark { font-family: var(--f-brand); font-weight: 400; letter-spacing: .14em; text-transform: uppercase; }
.brand-name { font-size: 18px; line-height: 1; }
@media (max-width: 520px) { .brand-name { font-size: 15px; letter-spacing: .12em; } }
.auth .eyebrow.wordmark { font-size: 14px; color: var(--ink); }
.powered .wordmark { font-size: 11px; color: var(--ink); margin-inline-start: 2px; }
.brand-co { font-size: 13.5px; color: var(--muted); border-inline-start: 1px solid var(--line); padding-inline-start: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo { flex: none; }
.who { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.lang { font-weight: 600; }
.lang[lang="ar"] { font-family: "IBM Plex Sans Arabic", var(--f-body); }
.who b { font-weight: 600; }

.pill { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; background: var(--brass-soft); color: var(--brass-ink); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 999px; font-weight: 600; color: var(--muted); font-size: 13.5px; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 14px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: var(--rule); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { filter: brightness(1.12); }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.danger { color: var(--bad); }
.btn.block { width: 100%; }
.btn.confirming { background: var(--bad); border-color: var(--bad); color: var(--accent-ink); }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* forms */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-weight: 600; font-size: 14px; }
.field .help { font-size: 13px; color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="tel"], input[type="search"], input[type="url"], select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: var(--surface); min-height: 40px; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.error { color: var(--bad); font-size: 14px; font-weight: 600; }
.note { padding: 10px 14px; border-radius: 10px; background: var(--brass-soft); font-size: 14px; }
.note.info { background: var(--accent-soft); }
.preview-bar { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; border: 1px solid var(--brass); position: sticky; top: 8px; z-index: 5; }

/* auth pages */
.auth { min-height: 80vh; display: grid; place-items: center; align-content: center; gap: 16px; padding-block: 32px; }
.auth-motto { margin: 0; max-width: 420px; text-align: center; font-family: var(--f-display); font-size: 14.5px; font-weight: 500; letter-spacing: -.005em; color: var(--ink); }
.auth-motto .motto-dot { color: var(--brass); }   /* the catch phrase: the full stops in gold, as on the brand image */
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 26px 24px; display: flex; flex-direction: column; gap: 18px; }
.auth-card h1 { font-family: var(--f-display); font-size: 26px; font-weight: 600; line-height: 1.15; letter-spacing: -.01em; }
.auth-card .links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: 14px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* page heads */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: 22px; }
.page-head h1 { font-family: var(--f-display); font-weight: 600; font-size: clamp(23px, 2.8vw, 30px); line-height: 1.12; letter-spacing: -.01em; }

/* title block */
.titleblock { margin-top: 18px; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 2fr); border: 1px solid var(--rule); background: var(--surface); }
.tb-main { padding: 18px 20px; border-inline-end: 1px solid var(--rule); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tb-main h1 { font-family: var(--f-display); font-weight: 600; font-size: clamp(22px, 2.8vw, 30px); line-height: 1.15; letter-spacing: -.01em; overflow-wrap: anywhere; }
.tb-main p { margin: 0; color: var(--muted); max-width: 52ch; }
.tb-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }
.tb-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; }
.tb-grid > div { padding: 12px 16px; border-bottom: 1px solid var(--line); border-inline-start: 1px solid var(--line); min-width: 0; }
.tb-grid > div:nth-child(3n+1) { border-inline-start: 0; }
.tb-grid > div:nth-last-child(-n+3) { border-bottom: 0; }
.tb-grid dt { font-family: var(--f-mono); font-weight: 700; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.tb-grid dd { margin: 4px 0 0; font-family: var(--f-display); font-weight: 600; font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }

/* tabs */
.tabs { margin-top: 18px; display: flex; flex-wrap: nowrap; gap: 0; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; border-bottom: 1px solid var(--line); }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: 0 0 auto; padding: 10px 9px; font-weight: 600; color: var(--muted); white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.tabs .count { display: inline-block; min-width: 18px; padding: 0 5px; margin-inline-start: 6px; border-radius: 999px; background: var(--bad-soft); color: var(--bad); font-size: 11.5px; line-height: 18px; text-align: center; }
.view { margin-top: 18px; display: flex; flex-direction: column; gap: 16px; }

/* cards & chips */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; min-width: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; margin-bottom: 12px; }
.card-head h2 { font-family: var(--f-display); font-weight: 600; font-size: 17px; letter-spacing: -.005em; line-height: 1.25; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 9px 2px 8px; border-radius: 999px; white-space: nowrap; background: var(--neutral-soft); color: var(--muted); }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.warn { background: var(--warn-soft); color: var(--brass-ink); }   /* --warn on --warn-soft is too faint to read (3.5:1) */
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.brass { background: var(--brass-soft); color: var(--brass-ink); }
.chip.plain::before { display: none; }
.chip { max-width: 100%; }
.chip.plain { display: inline-block; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }   /* a long activity or subcontractor name never pushes the page sideways; the full name is in the tooltip */

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi .val { font-family: var(--f-display); font-weight: 600; font-size: 32px; line-height: 1.05; letter-spacing: -.02em; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.kpi .val small { font-size: 15px; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.kpi .val.val-money { font-size: 30px; }
.kpi .sub { font-size: 13.5px; color: var(--muted); }
.kpi ul { margin: 2px 0 0; padding: 0; list-style: none; font-size: 13.5px; display: flex; flex-direction: column; gap: 3px; }
.kpi li { display: flex; gap: 8px; align-items: baseline; }
.meter { display: block; position: relative; height: 8px; border-radius: 99px; background: var(--plan-bar); margin-top: 6px; }
.meter i { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 99px; background: var(--progress); }
.meter b { position: absolute; top: -4px; width: 2px; height: 16px; background: var(--plan); border-radius: 1px; }

.grid-ov { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (max-width: 960px) { .grid-ov { grid-template-columns: minmax(0, 1fr); } }

/* charts */
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 18px; height: 3px; border-radius: 2px; display: inline-block; }
.legend b { color: var(--ink); font-weight: 600; }
svg.chart { width: 100%; height: auto; display: block; }
svg.chart .gl { stroke: var(--line); stroke-width: 1; }
svg.chart .ax { fill: var(--muted); font: 500 11px var(--f-body); }
svg.chart .plan { fill: none; stroke: var(--plan); stroke-width: 2; stroke-dasharray: 6 5; }
svg.chart .act { fill: none; stroke: var(--progress); stroke-width: 2.6; stroke-linejoin: round; }
svg.chart .area { fill: var(--progress); opacity: .12; }
svg.chart .nowline { stroke: var(--rule); stroke-width: 1; stroke-dasharray: 3 3; }
svg.chart .nowlbl { fill: var(--muted); font: 600 11px var(--f-body); }
svg.chart .dot-a { fill: var(--progress); stroke: var(--surface); stroke-width: 2; }
svg.chart .dot-p { fill: var(--plan); stroke: var(--surface); stroke-width: 2; }
svg.chart .bar-p { fill: var(--plan-bar); }
svg.chart .bar-a { fill: var(--progress); }

.phases { display: flex; flex-direction: column; gap: 12px; }
.phase-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: baseline; }
.phase-row .meter { grid-column: 1 / -1; margin-top: 4px; }
.phase-row span { font-weight: 600; min-width: 0; }

.list { display: flex; flex-direction: column; }
.list-row { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding-block: 9px; border-top: 1px solid var(--line); }
.list-row:first-child { border-top: 0; padding-top: 0; }
.list-row .when { font-family: var(--f-mono); font-size: 12.5px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--muted); }
.list-row .what { min-width: 0; font-weight: 600; line-height: 1.3; }
.list-row .what small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); font-size: 14px; padding-block: 8px; margin: 0; }

/* feed */
.feed { display: flex; flex-direction: column; }
.post { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 4px 12px; padding-block: 14px; border-top: 1px solid var(--line); }
.post:first-child { border-top: 0; padding-top: 0; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--accent-soft); color: var(--accent); }
.avatar.client { background: var(--brass-soft); color: var(--brass-ink); }
.post .avatar { grid-row: span 2; }
.post-meta { min-height: 22px; padding-top: 2px; }
.post-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: 13.5px; }
.post-meta b { font-weight: 700; }
.post-body { grid-column: 2; min-width: 0; }
.post-body p { margin: 4px 0 0; overflow-wrap: anywhere; white-space: pre-line; }
.post-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.photos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.photo { width: 128px; max-width: 100%; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); display: block; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.quick-post { display: flex; flex-wrap: wrap; gap: 8px; }

/* gantt */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar .spacer { margin-inline-start: auto; }
.fchip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.fchip[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); background: var(--surface-2); }
.gantt-scroll { direction: ltr; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
/* on a computer the chart scrolls inside its own window: the sideways scrollbar is always on screen at its foot
   and the week header stays at its top, however narrow the window (on a phone the page scrolls and the header
   follows it, see keepHeader; a finger swipes sideways anywhere on the chart) */
@media (min-width: 700px), (pointer: fine) {
  .gantt-scroll { overflow: auto; scrollbar-gutter: stable; scroll-margin-top: calc(var(--topbar-h, 64px) + 8px);
    max-height: calc(100vh - var(--topbar-h, 64px) - 20px); max-height: calc(100dvh - var(--topbar-h, 64px) - 20px); }
  .gantt-scroll .g-row.head { position: sticky; top: 0; transform: none !important; box-shadow: 0 1px 0 var(--line), 0 2px 6px rgba(0,0,0,.08); }
}
/* the week header follows the page scroll (set by keepHeader in programme.js), so you always know which week you're in */
.g-row.head { position: relative; z-index: 3; will-change: transform; }
.g-row.head.pinned { box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.g-row.head .g-name { z-index: 4; }
.g-days { display: none; }
.gantt.days .g-days { display: grid; grid-template-columns: repeat(7, 1fr); margin-top: 3px; font-family: var(--f-mono); font-size: 9.5px; line-height: 1; color: var(--muted); }
.gantt.days .g-days i { font-style: normal; } .gantt.days .g-days i.off { color: transparent; } .gantt.days .g-days i.pre { opacity: .45; }
.gantt { --nw: 300px; --cw: 46px; min-width: max-content; }
.g-row { display: grid; grid-template-columns: var(--nw) calc(var(--weeks) * var(--cw)); border-top: 1px solid var(--line); }
.g-row:first-child { border-top: 0; }
.g-name { position: sticky; left: 0; z-index: 2; background: var(--surface); padding: 9px 14px; border-right: 1px solid var(--line); min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.g-name .nm { font-weight: 600; line-height: 1.25; font-size: 14px; overflow-wrap: anywhere; }
.g-name .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12.5px; color: var(--muted); }
.g-time { position: relative; min-height: 54px; background-image: repeating-linear-gradient(to right, transparent 0 calc(var(--cw) - 1px), var(--line) calc(var(--cw) - 1px) var(--cw)); }
.g-row.act { cursor: pointer; }
.g-row.act:hover .g-name, .g-row.act:hover .g-time { background-color: var(--surface-2); }
.g-row.act:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.g-row.head .g-name, .g-row.head .g-time { background-color: var(--surface-2); min-height: 0; }
.g-weeks { display: flex; height: 100%; }
.g-weeks div { width: var(--cw); flex: none; padding: 6px 0; text-align: center; font-size: 11px; line-height: 1.25; color: var(--muted); border-right: 1px solid var(--line); }
.g-weeks div b { display: block; font-family: var(--f-mono); font-weight: 500; color: var(--ink); font-size: 11px; }
.g-weeks div.cur { background: var(--brass-soft); }
/* a phase heading reads as a heading: tinted band, brass edge, bold title, its own summary bracket; activities sit indented under it */
.gantt { --phase-bg: color-mix(in srgb, var(--brass) 12%, var(--surface)); }
.g-row.phase { border-top: 1px solid color-mix(in srgb, var(--brass) 45%, var(--line)); }
.g-row.phase .g-name { background: var(--phase-bg); box-shadow: inset 4px 0 0 var(--brass); padding-inline-start: 16px; }
.g-row.phase .g-time { background-color: var(--phase-bg); min-height: 40px; }
.g-row.phase .nm { font-family: var(--f-display); font-weight: 700; font-size: 12.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink); }
.g-row.phase .meta { color: var(--brass-ink); font-weight: 600; }
.g-row.act .g-name { padding-inline-start: 30px; }
.g-row.act .nm { font-weight: 500; }
[dir="rtl"] .g-row.phase .g-name { box-shadow: inset -4px 0 0 var(--brass); }
.bar { position: absolute; top: 50%; height: 16px; transform: translateY(-50%); border-radius: 4px; background: var(--plan-bar); overflow: hidden; }
.bar i { position: absolute; inset: 0 auto 0 0; background: var(--progress); }
.bar.late { box-shadow: inset 0 0 0 1.5px var(--bad); }
.g-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--brass); z-index: 1; pointer-events: none; }
.g-pct { position: absolute; top: 50%; transform: translateY(-50%); font-size: 11.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }

/* approvals */
.appr { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 4px 14px; padding-block: 14px; border-top: 1px solid var(--line); align-items: start; }
.appr:first-child { border-top: 0; padding-top: 2px; }
.appr.clickable { cursor: pointer; }
.appr.clickable:hover h3 { color: var(--accent); }
.appr .mark { width: 14px; height: 14px; border-radius: 50%; margin-top: 4px; border: 2px solid var(--rule); background: var(--surface); }
.appr .mark.done { border-color: var(--good); background: var(--good); }
.appr .mark.live { border-color: var(--warn); background: var(--warn-soft); }
.appr .mark.bad { border-color: var(--bad); background: var(--bad-soft); }
.appr h3 { font-size: 15.5px; font-weight: 700; }
.appr .by { font-size: 13.5px; color: var(--muted); }
.appr .note-t { font-size: 13.5px; margin-top: 4px; }
.appr .right { text-align: end; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 13px; color: var(--muted); }
@media (max-width: 560px) { .appr { grid-template-columns: 20px minmax(0, 1fr); } .appr .right { grid-column: 2; align-items: flex-start; text-align: start; } }

/* tables */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 560px; font-size: 14px; }
th { text-align: start; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td.r, th.r { text-align: end; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
td .row-actions { justify-content: flex-end; }
.bad-row td { background: var(--bad-soft); }

/* projects */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.proj { text-align: start; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: var(--ink); }
.proj:hover { border-color: var(--rule); box-shadow: var(--shadow); }
.proj .h3 { font-family: var(--f-display); font-weight: 600; font-size: 17px; line-height: 1.25; overflow-wrap: anywhere; }
.proj .row { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; color: var(--muted); width: 100%; }
.proj .big { font-family: var(--f-display); font-weight: 600; font-size: 26px; line-height: 1.05; letter-spacing: -.02em; color: var(--ink); }
.empty-card { border: 1px dashed var(--rule); border-radius: 12px; padding: 28px 20px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.empty-card h2 { font-family: var(--f-display); font-weight: 600; font-size: 19px; line-height: 1.25; }

.trades { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.trade { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.trade b { font-family: var(--f-display); font-weight: 600; font-size: 21px; line-height: 1.05; }

/* drawer */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; }
.drawer { position: fixed; top: 0; inset-inline-end: 0; bottom: 0; width: min(460px, 100%); background: var(--surface); border-inline-start: 1px solid var(--line); box-shadow: var(--shadow); z-index: 41; overflow-y: auto; padding: calc(18px + env(safe-area-inset-top, 0px)) 22px calc(24px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 16px; animation: slidein .22s ease-out; }
.drawer > * { flex-shrink: 0; }
@keyframes slidein { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes slidein-rtl { from { transform: translateX(-24px); opacity: .6; } to { transform: none; opacity: 1; } }
[dir="rtl"] .drawer { animation-name: slidein-rtl; }
@media (max-width: 640px) {
  .drawer, [dir="rtl"] .drawer { top: auto; height: 90%; width: 100%; border-inline-start: 0; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; animation-name: slideup; }
  @keyframes slideup { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
}
.dr-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.dr-head h2 { font-family: var(--f-display); font-weight: 600; font-size: 21px; line-height: 1.2; margin-top: 4px; overflow-wrap: anywhere; }
.dr-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; font-size: 14px; margin: 0; }
.dr-facts dt { font-family: var(--f-mono); font-weight: 700; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.dr-facts dd { margin: 1px 0 0; font-weight: 600; }
.dr-pct { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.dr-pct .big { font-family: var(--f-display); font-weight: 600; font-size: 44px; line-height: 1; letter-spacing: -.02em; }
.dr-section { border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.dr-section h3 { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.filebtn { position: relative; display: inline-flex; align-items: center; gap: 8px; border: 1px dashed var(--rule); border-radius: 8px; padding: 9px 12px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; }
.filebtn input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.filebtn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.toast.err { background: var(--bad); color: #fff; }

@media (max-width: 760px) {
  .titleblock { grid-template-columns: minmax(0, 1fr); }
  .tb-main { border-inline-end: 0; border-bottom: 1px solid var(--rule); }
  .tb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tb-grid > div, .tb-grid > div:nth-child(3n+1) { border-inline-start: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .tb-grid > div:nth-child(2n+1) { border-inline-start: 0; }
  .tb-grid > div:nth-last-child(-n+3) { border-bottom: 1px solid var(--line); }
  .tb-grid > div:nth-last-child(-n+2) { border-bottom: 0; }
  .gantt { --nw: 178px; --cw: 40px; }
  .kpi .val { font-size: 28px; }
  .brand-co { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* plans, branding and alerts */
.co-logo { display: block; height: 34px; width: auto; max-width: 200px; object-fit: contain; }
.co-logo.small { height: 26px; max-width: 130px; border-inline-start: 1px solid var(--line); padding-inline-start: 10px; }
.branded .topbar::after, .branded .fc-line { background: var(--accent); }
.bell { position: relative; padding-inline: 8px; }
.bell .count { position: absolute; top: -5px; inset-inline-end: -5px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.note.bad { background: var(--bad-soft); }
.plan-bar { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; }
.powered { margin: 28px 0 8px; text-align: center; font-size: 12.5px; color: var(--muted); }
.plan-usage { margin: 0 0 12px; font-weight: 600; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin-top: 12px; }
.plan-card { border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.plan-card.featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.plan-card.current { background: var(--surface-2); }
.plan-card > .btn { margin-top: auto; }
.plan-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plan-top h3 { font-family: var(--f-display); font-size: 19px; font-weight: 600; }
.plan-price .num { font-family: var(--f-display); font-size: 26px; font-weight: 600; letter-spacing: -.01em; }
.plan-limit { font-weight: 600; font-size: 14px; }
.plan-points { margin: 0; padding-inline-start: 18px; font-size: 14px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.warn-t { color: var(--bad); margin: 0; }
.brand-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.lbl { font-weight: 600; font-size: 14px; }
.logo-box { min-height: 74px; border: 1px dashed var(--rule); border-radius: 10px; display: grid; place-items: center; padding: 10px; background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 16px 16px; }
.logo-box img { max-height: 60px; max-width: 100%; object-fit: contain; }
input[type="color"] { width: 52px; height: 40px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; }
.brand-preview { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; max-width: 420px; background: var(--bg); }
.bp-top { display: flex; align-items: center; min-height: 52px; padding: 10px 14px; border-bottom: 3px solid var(--accent); background: var(--bg); }
.bp-top img { max-height: 34px; max-width: 200px; object-fit: contain; }
.bp-body { display: flex; flex-direction: column; gap: 8px; padding: 14px; background: var(--surface); }
.bp-title { font-family: var(--f-display); font-weight: 600; font-size: 17px; }
.alerts-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.alert { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); color: inherit; text-decoration: none; }
.alert:hover { border-color: var(--rule); }
.alert.unread { background: var(--accent-soft); border-color: transparent; }
.alert b { font-weight: 600; }
.alert-body { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; white-space: pre-line; }       /* a digest lists one change a line (migration 039) */
.admin-table tr.clickable { cursor: pointer; }
.admin-table tr.clickable:hover td { background: var(--surface-2); }
.admin-table td { vertical-align: top; }
.req { color: var(--bad); font-weight: 700; margin-top: 4px; }
.arch-list { list-style: none; margin: 0; padding: 0; }
.arch-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.arch-list a { display: flex; flex-direction: column; color: inherit; text-decoration: none; min-width: 0; }
.proj-foot { margin-top: 16px; }
.pack-head .pack-logo { order: -1; flex: 0 0 100%; height: 56px; width: auto; max-width: 100%; object-fit: contain; object-position: left center; }
[dir="rtl"] .pack-head .pack-logo { object-position: right center; }
@media (max-width: 640px) { .who-name { display: none; } .co-logo { max-width: 140px; } }
[dir="rtl"] :is(.alert b, .alert-body, .plan-points li) { unicode-bidi: plaintext; }

/* selections, payments, documents */
.tabs a.locked { color: var(--rule); }
.lock-ico { margin-inline-start: 5px; vertical-align: -1px; }
.locked-card { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; max-width: 640px; }
.locked-card h2 { font-family: var(--f-display); font-weight: 600; font-size: 20px; line-height: 1.25; }
.locked-card p { margin: 0; }
.locked-card .row-actions { margin-top: 6px; }
.sel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.sel-card { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; background: var(--surface); }
.sel-card:hover { border-color: var(--rule); }
.sel-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sel-img { width: 76px; height: 76px; aspect-ratio: auto; border-radius: 10px; }
.sel-swatch { display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-family: var(--f-display); font-weight: 600; font-size: 26px; }
.sel-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sel-title { font-size: 16px; overflow-wrap: anywhere; }
.sel-opts { display: flex; flex-direction: column; gap: 10px; }
.sel-opt { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.sel-opt.chosen { border-color: var(--good); box-shadow: 0 0 0 1px var(--good) inset; }
.sel-opt .photos { margin-top: 0; }
.sel-opt p { margin: 0; }
.sel-opt .help { font-size: 13px; color: var(--muted); }
.sel-opt-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.sel-card.picked { border-color: var(--line); background: var(--surface); }
.sel-pick { display: flex; gap: 6px; align-items: baseline; font-weight: 700; font-size: 14.5px; color: var(--ink); overflow-wrap: anywhere; }
.sel-pick i { font-style: normal; color: var(--good); }
.sel-chosen { border: 1px solid var(--good); box-shadow: 0 0 0 1px var(--good) inset; border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 6px; background: var(--good-soft); }
.sel-chosen .photos { margin: 0 0 4px; }
.sel-chosen p { margin: 0; }
.sel-chosen-name { font-family: var(--f-display); font-weight: 600; font-size: 18px; overflow-wrap: anywhere; }
.sel-change { margin-top: 4px; }
.sel-hist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.sel-hist li { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; align-items: baseline; }
.sel-hist li div { display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.dr-sub { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 4px 0 0; }
.opt-list { display: flex; flex-direction: column; gap: 12px; }
.opt-row { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 12px; margin: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.opt-row legend { font-weight: 700; font-size: 13px; padding: 0 4px; color: var(--muted); }
.opt-row .photos { margin-top: 0; }
.opt-row .help { font-size: 13px; color: var(--muted); margin: 0; }
/* quantity × rate = total on each option */
.opt-measure { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1fr) minmax(0, 1.3fr); gap: 10px; align-items: end; }
.opt-measure > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.opt-measure label { font-weight: 600; font-size: 14px; }
.o-qty:disabled { opacity: .55; }
@media (max-width: 560px) { .opt-measure { grid-template-columns: repeat(2, minmax(0, 1fr)); } .opt-measure > div:nth-child(3) { grid-column: 1 / -1; } }
.o-total-box { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; padding: 8px 10px; border-radius: 8px; background: var(--accent-soft); font-size: 14px; }
.o-total-box span { color: var(--muted); font-weight: 600; }
.o-total { font-weight: 700; }
.sel-qty { font-size: 13px; color: var(--muted); }
.sel-units { display: flex; flex-direction: column; gap: 6px; }
.sel-units dl { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.sel-units dl div { display: grid; grid-template-columns: 5.5em minmax(0, 1fr); gap: 8px; }
.sel-units dt { font-weight: 700; }
.sel-units dd { margin: 0; }
.photo-x { position: absolute; top: 2px; inset-inline-end: 2px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .65); color: #fff; font-size: 15px; line-height: 22px; padding: 0; }
.pay-table tr.clickable { cursor: pointer; }
.pay-table tr.clickable:hover td { background: var(--surface-2); }
.pay-table td { vertical-align: top; }
.pay-table tr.total td { border-top: 2px solid var(--rule); }
.plan-lines { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.plan-lines li span { display: flex; flex-direction: column; }
.plan-lines li { padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.plan-lines b { font-weight: 600; }
.doc-filter { margin-bottom: 8px; }
.doc-group { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 16px 0 4px; }
.docs { list-style: none; margin: 0; padding: 0; }
.doc { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.doc-ico { width: 44px; height: 52px; border-radius: 6px; border: 1px solid var(--rule); display: grid; place-items: center; font-family: var(--f-mono); font-size: 10.5px; font-weight: 600; color: var(--muted); background: var(--surface-2); }
.doc-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.doc-main b { overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; }
}
@media (max-width: 640px) { .doc { grid-template-columns: 44px minmax(0, 1fr); } .doc-act { grid-column: 2; } }
[dir="rtl"] :is(.sel-title, .sel-opt-head b, .doc-main b, .plan-lines span) { unicode-bidi: plaintext; }
html[lang="ar"] .doc-group { font-size: 13.5px; }

/* delays, aftercare, weekly report */
fieldset.bare { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.delays { list-style: none; margin: 0; padding: 0; }
.delay { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.delay[role="button"] { cursor: pointer; }
.delay[role="button"]:hover b { color: var(--accent); }
.delay-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 320px; }
.dlp-card { border-color: var(--good); }
.stage-seg { align-self: flex-start; }
.alerts-tools { justify-content: space-between; }
.report .rep-big { font-family: var(--f-display); font-weight: 600; font-size: 36px; line-height: 1.05; letter-spacing: -.02em; }
.rep-kpis .val { font-size: 28px; }
.rep-kpis .val.val-date { font-size: 30px; }
.rep-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.rep-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.rep-list li > span:first-child, .rep-list li > span:nth-child(2):not(.num) { flex: 1 1 260px; min-width: 0; }
.rep-list li > .chip, .rep-list li > span.chip:first-child { flex: 0 0 auto; }
.rep-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.rep-photos figure { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.rep-photos .photo { width: 100%; }
.rep-photos figcaption { font-size: 12px; color: var(--muted); }
.rep-note { white-space: pre-wrap; font-size: 15.5px; }
.rep-diary { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.rep-diary li { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px; }
.rep-diary p { margin: 2px 0 0; }
@media print { .report textarea { border: 0; padding: 0; resize: none; min-height: 0; } .report .no-print-empty:has(textarea:placeholder-shown) { display: none; } .rep-photos { grid-template-columns: repeat(4, 1fr); }
  .rep-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } .rep-kpis .val { font-size: 24px; } .rep-kpis .val.val-date { font-size: 19px; } }
[dir="rtl"] :is(.delay-main b, .rep-list span, .rep-note, .rep-diary p) { unicode-bidi: plaintext; }

/* Arabic */
html[lang="ar"] { --f-body: "IBM Plex Sans Arabic", "Manrope", "Segoe UI", Tahoma, sans-serif; --f-display: "Sora", "IBM Plex Sans Arabic", sans-serif; --f-mono: "IBM Plex Sans Arabic", "Manrope", sans-serif; }
html[lang="ar"] * { letter-spacing: 0 !important; }
html[lang="ar"] body { font-size: 15.5px; line-height: 1.6; }
html[lang="ar"] .eyebrow { font-size: 12.5px; }
html[lang="ar"] .tb-grid dt, html[lang="ar"] .dr-facts dt { font-family: var(--f-body); font-size: 12px; }
html[lang="ar"] .tb-grid dd { font-size: 17px; }
html[lang="ar"] .card-head h2, html[lang="ar"] .empty-card h2 { font-weight: 700; font-size: 18px; }
html[lang="ar"] .g-row.phase .nm { font-family: var(--f-body); font-size: 14px; }
[dir="rtl"] .g-name { direction: rtl; text-align: right; }
[dir="rtl"] :is(.tb-grid dd, .pack-facts dd, .dr-facts dd) { text-align: right; }
/* user-entered text (often English) keeps its own direction inside the Arabic layout */
[dir="rtl"] :is(p, h1, h2, h3, td, dd, li, figcaption, .nm, .what, .what small, .by, .note-t, .snag-main b, .snag-main small, .post-meta b, .h3) { unicode-bidi: plaintext; }
.steps-list { margin: 0; padding-inline-start: 18px; display: flex; flex-direction: column; gap: 4px; }
input[type="email"], input[type="password"] { text-align: start; }

/* snags */
.grid-snag { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 960px) { .grid-snag { grid-template-columns: minmax(0, 1fr); } }
.snags { display: flex; flex-direction: column; }
.snag { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 4px 12px; align-items: start; padding-block: 12px; border-top: 1px solid var(--line); cursor: pointer; }
.snag:first-child { border-top: 0; padding-top: 2px; }
.snag:hover .snag-main b { color: var(--accent); }
.snag:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.snag-no { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.s-open { background: var(--bad); color: #fff; }
.s-fixed { background: var(--brass); color: #151515; }
.s-closed { background: var(--good); color: #fff; }
.snag-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.snag-main b { font-weight: 700; overflow-wrap: anywhere; }
.snag-main small { color: var(--muted); font-size: 13px; }
.snag-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.photo.thumb { width: 72px; }
.plan-view { position: relative; direction: ltr; width: 100%; min-height: 80px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.plan-view img { display: block; width: 100%; height: 100%; object-fit: contain; }
.plan-view.pick { cursor: crosshair; touch-action: manipulation; }
.plan-view.small { max-height: 320px; }
.pin { position: absolute; transform: translate(-50%, -50%); width: 26px; height: 26px; padding: 0; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); font: 700 11.5px/22px var(--f-body); text-align: center; z-index: 1; cursor: pointer; }
#pp-pin { pointer-events: none; }
.legend i.lg { width: 12px; height: 12px; border-radius: 50%; }
.sub-h { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.plan-row { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px 14px; align-items: start; }
.plan-row .plan-view { grid-row: span 2; }
.plan-row .row-actions { grid-column: 2; }

/* handover pack */
.pack-bar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-top: 18px; }
.pack-out { display: inline-flex; flex-wrap: wrap; gap: 8px; margin-inline-start: auto; }
/* Save or print screen (js/views/saveprint.js): the PDF's pages as a preview, with Download, Print, Share, Open */
.sp-card { display: flex; flex-direction: column; gap: 14px; }
.sp-file { display: flex; gap: 14px; align-items: center; min-width: 0; }
.sp-icon { width: 40px; height: 48px; flex: 0 0 auto; color: var(--ink); }
.sp-what { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sp-name { font-family: var(--f-display); font-weight: 600; font-size: 17px; line-height: 1.3; overflow-wrap: anywhere; unicode-bidi: plaintext; }
.sp-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sp-help { margin: -4px 0 0; }
.sp-pages { display: flex; flex-direction: column; align-items: center; gap: 18px; padding-bottom: 24px; }
.sp-pages img { display: block; width: 100%; max-width: 794px; height: auto; background: #fff; border: 1px solid var(--line); box-shadow: 0 8px 28px rgba(21, 21, 21, .10); }
.sp-src { height: 0; overflow: hidden; visibility: hidden; }
@media (max-width: 560px) { .sp-actions .btn { flex: 1 1 calc(50% - 4px); justify-content: center; text-align: center; } .sp-actions .btn.primary { flex-basis: 100%; } }
.pack { margin-top: 18px; background: var(--surface); border: 1px solid var(--rule); padding: clamp(16px, 4vw, 40px); display: flex; flex-direction: column; gap: 26px; }
.pack-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; border-bottom: 3px solid var(--ink); padding-bottom: 14px; }
.pack-head h1 { font-family: var(--f-display); font-weight: 600; font-size: clamp(24px, 3.2vw, 34px); line-height: 1.12; letter-spacing: -.01em; margin-top: 4px; }
.pack-head p { margin: 6px 0 0; max-width: 60ch; }
.pack-date { text-align: end; }
.pack-date b { display: block; font-size: 18px; }
.pack-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; border: 1px solid var(--line); }
.pack-facts > div { padding: 10px 14px; border-bottom: 1px solid var(--line); border-inline-start: 1px solid var(--line); min-width: 0; }
.pack-facts > div:nth-child(3n+1) { border-inline-start: 0; }
.pack-facts > div:nth-last-child(-n+3) { border-bottom: 0; }
.pack-facts dt { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.pack-facts dd { margin: 2px 0 0; font-weight: 700; font-size: 16px; overflow-wrap: anywhere; }
.pack-sec h2 { font-family: var(--f-display); font-weight: 600; font-size: 19px; margin-bottom: 10px; }
.pack-sec > p { margin: 0 0 10px; }
.pack-table { min-width: 640px; font-size: 13px; }
.pack-table th { padding: 6px 8px; white-space: normal; }
.pack-table td { padding: 7px 8px; vertical-align: top; }
.pack-table tr.total td { border-top: 2px solid var(--rule); }
.pack-table td.num, .pack-table td.r, .pack-table td.mono { white-space: nowrap; }
.pack-plan .plan-view { max-width: 760px; }
.pack-photos { display: flex; gap: 4px; }
.pack-photos .photo { width: 56px; margin: 0; }
.pack-plan { margin: 0 0 18px; }
.pack-plan figcaption { font-weight: 600; margin-top: 6px; }
.sign-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; margin-top: 10px; }
.sign { display: flex; flex-direction: column; gap: 4px; }
.sign span { border-bottom: 1px solid var(--rule); color: var(--muted); font-size: 13px; padding-top: 26px; }
@media (max-width: 640px) {
  .pack-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pack-facts > div, .pack-facts > div:nth-child(3n+1) { border-inline-start: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .pack-facts > div:nth-child(2n+1) { border-inline-start: 0; }
  .pack-facts > div:nth-last-child(-n+2) { border-bottom: 0; }
  .sign-grid { grid-template-columns: minmax(0, 1fr); }
  .plan-row { grid-template-columns: minmax(0, 1fr); }
  .plan-row .plan-view { grid-row: auto; }
  .plan-row .row-actions { grid-column: auto; }
}
@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #f6f6f6; --ink: #111; --muted: #555; --line: #ccc; --rule: #888;
    --good: #1E7A46; --bad: #B93A26; --warn: #A87700; --accent: #151515; --progress: #B08A3E; --plan: #151515; --primary: #151515; --primary-ink: #fff; --stripe: #B08A3E;
    --accent-ink: #fff; --accent-soft: #F1EEE8; --brass: #C98F00; --brass-soft: #FFF1D1; --brass-ink: #8A5A00; --good-soft: #E3F2E8; --warn-soft: #FFF1D1;
    --bad-soft: #FBE4DF; --neutral-soft: #EFEDE9; --plan-bar: #ECE9E4; color-scheme: light; }
  @page { size: A4; margin: 14mm; }
  body { background: #fff; color: #111; font-size: 12px; }
  .topbar, .no-print, .toast, .scrim, .drawer { display: none !important; }
  .app { max-width: none; padding: 0; }
  .pack { border: 0; padding: 0; margin: 0; gap: 18px; }
  .table-scroll { overflow: visible; }
  .pack-table { min-width: 0; }
  .pack-table tr, .pack-plan, .sign-grid, .pack-facts { break-inside: avoid; }
  .pack-sec h2 { break-after: avoid; }
  .pack-plan .plan-view { max-height: 230mm; border-color: #999; }
  .pin { box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .s-open, .s-fixed, .s-closed { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  /* Save or print: each page picture fills one sheet (the screen sets the page margin to 0) */
  .view.sp { margin: 0; gap: 0; }
  .sp-pages { display: block; padding: 0; }
  .sp-pages img { display: block; height: 296mm; width: auto; max-width: 100%; margin: 0 auto; border: 0; box-shadow: none; break-after: page; }
  .sp-pages img:last-child { break-after: auto; }
}
/* Download PDF: the same look as print, for the hidden A4 frame the PDF is drawn from (js/pdf.js) */
html.pdf { --bg: #fff; --surface: #fff; --surface-2: #f6f6f6; --ink: #111; --muted: #555; --line: #ccc; --rule: #888;
  --good: #1E7A46; --bad: #B93A26; --warn: #A87700; --accent: #151515; --progress: #B08A3E; --plan: #151515; --primary: #151515; --primary-ink: #fff; --stripe: #B08A3E;
  --accent-ink: #fff; --accent-soft: #F1EEE8; --brass: #C98F00; --brass-soft: #FFF1D1; --brass-ink: #8A5A00; --good-soft: #E3F2E8; --warn-soft: #FFF1D1;
  --bad-soft: #FBE4DF; --neutral-soft: #EFEDE9; --plan-bar: #ECE9E4; --shadow: none; color-scheme: light; overflow: hidden; background: #fff; }
html.pdf body { background: #fff; color: #111; font-size: 12px; }
html.pdf :is(.topbar, .no-print, .toast, .scrim, .drawer) { display: none !important; }
html.pdf .app { max-width: none; padding: 0; margin: 0; }
html.pdf .pack { border: 0; padding: 0; margin: 0; gap: 18px; }
html.pdf .table-scroll { overflow: visible; }
html.pdf .pack-table { min-width: 0; }
html.pdf .pack-plan .plan-view { max-height: 230mm; border-color: #999; }
html.pdf .pin { box-shadow: none; }
html.pdf .rep-photos { grid-template-columns: repeat(4, 1fr); }
html.pdf .rep-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
html.pdf .rep-kpis .val { font-size: 24px; }
html.pdf .rep-kpis .val.val-date { font-size: 19px; }
.photo.thumb { position: relative; }
.photo.thumb .more { position: absolute; inset-inline-end: 4px; bottom: 4px; background: rgba(0, 0, 0, .65); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 5px; border-radius: 6px; }
.trial-line { margin: 8px 0 0; font-weight: 600; font-size: 14px; color: var(--good); }

/* drawing register (js/views/drawings.js) */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dw-tools { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.dw-tools input[type=search] { width: 100%; max-width: 420px; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; background: var(--surface); color: var(--ink); -webkit-appearance: none; appearance: none; }
.dw-filter { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.dw-filter::-webkit-scrollbar { display: none; }
.chip-btn { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chip-btn span { color: var(--muted); font-weight: 600; }
.chip-btn:hover { border-color: var(--rule); }
.chip-btn.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip-btn.on span { color: var(--bg); opacity: .7; }
.dw-group + .dw-group { margin-top: 18px; }
.dw-group .sub-h .muted { font-weight: 600; }
.dw-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.dw-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 6px 14px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.dw-row:hover { background: var(--surface-2); }
.dw-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.dw-thumb { width: 96px; height: 68px; border: 1px solid var(--line); border-radius: 6px; background: #fff; overflow: hidden; display: grid; place-items: center; }
.dw-thumb img { width: 100%; height: 100%; object-fit: contain; }
.dw-thumb:not(.photo) img { display: none; }
.dw-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.dw-line { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; min-width: 0; }
.dw-no { font-size: 15px; }
.dw-title { font-weight: 600; overflow-wrap: anywhere; }
.dw-tags { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.chip.rev { background: var(--ink); color: var(--bg); font-family: var(--f-mono); letter-spacing: .02em; }
.chip.rev::before { display: none; }
@media (max-width: 640px) {
  .dw-row { grid-template-columns: 72px minmax(0, 1fr); }
  .dw-thumb { width: 72px; height: 52px; }
  .dw-tags { grid-column: 2; justify-content: flex-start; }
}

/* viewer and upload screens: full screen over the app */
html.dv-open, html.dv-open body { overflow: hidden; }
.dv-screen { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); }
.dv-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 10px 16px; padding: 12px clamp(12px, 3vw, 24px); border-bottom: 1px solid var(--line); border-top: 3px solid var(--stripe); background: var(--surface); }
.dv-id { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.dv-id h2 { font-family: var(--f-display); font-weight: 600; font-size: clamp(17px, 2.2vw, 22px); line-height: 1.25; overflow-wrap: anywhere; }
.dv-id h2 .mono { margin-inline-end: 6px; }
.dv-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dv-acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dv-acts a[aria-disabled="true"] { opacity: .55; }
.dv-super { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 10px clamp(12px, 3vw, 24px); background: var(--bad-soft); color: var(--bad); font-size: 14px; border-bottom: 1px solid var(--line); }
.dv-super .btn { margin-inline-start: auto; }
.dv-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 360px; }
.dv-stage { position: relative; overflow: hidden; background: #DEDBD5; min-height: 0; }
.dv-host { position: absolute; inset: 0; }
.dv { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.dv:active { cursor: grabbing; }
.dv:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.dv-base { position: absolute; left: 0; top: 0; transform-origin: 0 0; background: #fff; box-shadow: 0 2px 18px rgba(0, 0, 0, .18); }
.dv-hi { position: absolute; left: 0; top: 0; pointer-events: none; visibility: hidden; }
.dv-tools { position: absolute; inset-inline-end: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 6px; z-index: 2; }
.dv-tools .btn { min-width: 40px; height: 38px; font-size: 18px; box-shadow: var(--shadow); }
.dv-tools .btn[data-z="fit"] { font-size: 13px; }
.dv-stamp { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 1; overflow: hidden; }
.dv-stamp span { transform: rotate(-28deg); font: 800 clamp(40px, 9vw, 120px)/1 var(--f-display); letter-spacing: .08em; color: rgba(185, 58, 38, .30); border: clamp(4px, .8vw, 9px) solid rgba(185, 58, 38, .30); padding: .1em .3em; border-radius: 12px; }
.dv-loading { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; font-size: 14px; pointer-events: none; text-align: center; padding: 20px; }
.dv-side { overflow-y: auto; border-inline-start: 1px solid var(--line); background: var(--surface); padding: 16px 18px calc(24px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 22px; }
.dv-sec { display: flex; flex-direction: column; gap: 10px; }
.dv-sec h3 { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.dv-sec .form { gap: 10px; }
.dv-sec .row-actions { flex-wrap: wrap; }
.dv-revs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.dv-revs button { width: 100%; text-align: start; display: flex; flex-direction: column; gap: 4px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); cursor: pointer; }
.dv-revs li.on button { border-color: var(--ink); box-shadow: inset 3px 0 0 var(--stripe); }
[dir="rtl"] .dv-revs li.on button { box-shadow: inset -3px 0 0 var(--stripe); }
.dv-rev-top { display: flex; flex-wrap: wrap; gap: 6px; }
.dv-note { color: var(--ink); }
.dv-seen { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.dv-seen li { display: flex; gap: 10px; align-items: center; }
.dv-seen li > span:last-child { display: flex; flex-direction: column; }
.dv-seen .avatar { width: 30px; height: 30px; font-size: 12px; flex: 0 0 auto; }
.dv-side-btn { display: none; }
.filebtn.small { padding: 6px 10px; font-size: 13px; }
.filebtn.busy { opacity: .6; pointer-events: none; }
@media (max-width: 900px) {
  .dv-body { grid-template-columns: minmax(0, 1fr); position: relative; }
  .dv-side { position: absolute; inset: auto 0 0 0; max-height: 72%; border-inline-start: 0; border-top: 1px solid var(--line); border-radius: 14px 14px 0 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, .2); z-index: 3; transform: translateY(105%); transition: transform .2s ease-out; }
  .dv-screen.side-open .dv-side { transform: none; }
  .dv-side-btn { display: inline-flex; }
}
@media (max-width: 560px) {
  .dv-head { padding: 10px 12px; }
  .dv-acts { width: 100%; }
  .dv-acts .btn { flex: 1 1 auto; }
}
@media (prefers-color-scheme: dark) { .dv-stage { background: #2B2B2B; } }

/* upload drawings */
.up-body { flex: 1; overflow-y: auto; padding: 16px clamp(12px, 3vw, 24px) 24px; display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 1100px; margin: 0 auto; }
.up-pick { display: flex; flex-direction: column; gap: 10px; }
.up-pick .filebtn.up-main { border-style: solid; border-color: var(--primary); background: var(--primary); color: var(--primary-ink); }
.up-status { margin: 0; font-weight: 600; }
.up-status:empty, .up-cads:empty { display: none; }
.up-batch .sub-h { margin: 0 0 10px; }
.up-list { display: flex; flex-direction: column; gap: 10px; }
.up-row { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 10px 16px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 0; background: var(--surface); min-width: 0; }
.up-thumb { grid-row: span 2; background: #fff; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; display: grid; place-items: center; aspect-ratio: 1.414; align-self: start; }
.up-thumb img { width: 100%; height: 100%; object-fit: contain; }
.up-fields { grid-template-columns: minmax(0, 1fr) 110px; align-items: end; }
.up-fields .check { padding-bottom: 8px; }
.up-state { margin: 0; font-weight: 600; }
.up-state.good { color: var(--good); }
.up-state.bad { color: var(--bad); }
.up-state.brass { color: var(--brass-ink); }
.up-state.muted { color: var(--muted); font-weight: 500; }
.up-row:has(.u-on:not(:checked)) { opacity: .6; }
.up-foot { display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 12px clamp(12px, 3vw, 24px) calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: var(--surface); }
@media (max-width: 640px) {
  .up-row { grid-template-columns: minmax(0, 1fr); }
  .up-thumb { grid-row: auto; max-height: 220px; }
  .up-fields { grid-template-columns: minmax(0, 1fr) 90px; }
  .up-foot .btn { flex: 1; }
}

/* ---------------------------------------------------------------- offline mode */
.net-bar { margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; background: var(--accent-soft); }
.net-bar.off { background: var(--brass-soft); border: 1px solid var(--brass); }
.net-bar.bad { border: 1px solid var(--bad); }
.net-bar .row-actions { margin: 0; }
.install-tip { margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; }
.install-tip .row-actions { margin: 0; }
body.is-offline form:not([data-offline-ok]) button[type="submit"], body.is-offline [data-choose-opt], body.is-offline [data-decide] { opacity: .45; }
.outbox { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.outbox li { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; }
.outbox li.bad { border-color: var(--bad); }
.outbox li.muted { border-style: dashed; }
.outbox .ob-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 220px; }
.outbox .ob-label { overflow-wrap: anywhere; }
.outbox .row-actions { margin: 0; }
.photo.missing { background: repeating-linear-gradient(45deg, var(--line) 0 6px, transparent 6px 12px); }
.photo.missing img { visibility: hidden; }

/* suggestions under a text field (instead of <datalist>) */
.suggest { position: relative; }
.suggest > input { width: 100%; }
.suggest-list { position: absolute; inset-inline: 0; top: calc(100% + 4px); z-index: 45; margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); max-height: 240px; overflow-y: auto; overscroll-behavior: contain; }
.suggest-list.up { top: auto; bottom: calc(100% + 4px); }
.suggest-list[hidden], .suggest-list li[hidden] { display: none; }
.suggest-list li { padding: 9px 10px; border-radius: 7px; cursor: pointer; font-size: 14px; line-height: 1.3; }
.suggest-list li:hover, .suggest-list li.on { background: var(--surface-2); }
.suggest-list li.on { outline: 1px solid var(--line); }

.opt-row.locked input[readonly], .opt-row.locked select:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }

/* ---------------------------------------------------------------- small windows and phones
   On a narrow or short window the project header shrinks so each tab opens on its own content:
   the full details stay on Overview, other tabs get a one-line header, and the tabs sit in one scrolling row. */
@media (max-width: 960px), (max-height: 760px) {
  .titleblock { margin-top: 12px; }
  .tb-main { padding: 14px 16px; gap: 4px; }
  .tb-main h1 { font-size: clamp(20px, 2.6vw, 26px); }
  .tb-tags { margin-top: 4px; }
  .tb-grid > div { padding: 9px 12px; }
  .tb-grid dd { font-size: 14.5px; margin-top: 2px; }
  .titleblock.tb-slim { grid-template-columns: minmax(0, 1fr); border-color: var(--line); }
  .titleblock.tb-slim .tb-main { border: 0; padding: 10px 14px; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
  .titleblock.tb-slim .eyebrow { flex-basis: 100%; }
  .titleblock.tb-slim h1 { font-size: 19px; flex: 1 1 auto; min-width: 0; }
  .titleblock.tb-slim .fc-line, .titleblock.tb-slim .tb-desc, .titleblock.tb-slim .tb-grid { display: none; }
  .titleblock.tb-slim .tb-tags { margin-top: 0; }
  .tabs { margin-top: 12px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
  .tabs a { padding: 10px 11px; }
  .view { margin-top: 14px; }
  .plan-bar { margin-top: 10px; padding: 8px 12px; flex-wrap: nowrap; font-size: 13.5px; }
  .plan-bar .pb-more { display: none; }
  .plan-bar .btn { flex-shrink: 0; }
}
@media (max-width: 760px) {
  .tb-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tb-grid > div, .tb-grid > div:nth-child(2n+1) { border-inline-start: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .tb-grid > div:nth-child(3n+1) { border-inline-start: 0; }
  .tb-grid > div:nth-last-child(-n+3) { border-bottom: 0; }
  .tb-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 14px; }
}
@media (max-width: 520px) {
  .tb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tb-grid > div:nth-child(3n+1) { border-inline-start: 1px solid var(--line); }
  .tb-grid > div:nth-child(2n+1) { border-inline-start: 0; }
  .tb-grid > div:nth-last-child(-n+3) { border-bottom: 1px solid var(--line); }
  .tb-grid > div:nth-last-child(-n+2) { border-bottom: 0; }
  .tb-grid dt { font-size: 9.5px; }
  .plan-bar { font-size: 13px; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpis > .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .kpi { padding: 11px 12px; }
  .kpi .val { font-size: 22px; gap: 4px; }
  .kpi .val.val-money { font-size: 18px; white-space: nowrap; }
  .kpi .val small { font-size: 13px; }
  .kpi .help, .kpi .muted, .kpi .small { font-size: 12.5px; }
}
@media (max-width: 420px) { .kpi .val { font-size: 19px; } }
/* the tab bar is always one line (12 tabs never wrap into a second row); when it's too long it scrolls (see hscroll below) */

/* variations: revisions and cancellations */
.vo-note { margin-top: 3px; color: var(--muted); font-style: italic; overflow-wrap: anywhere; }
tr.vo-cancelled td { color: var(--muted); }
tr.vo-cancelled .vo-val { text-decoration: line-through; }
.vo-now { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.vo-now .muted { margin-top: 4px; display: flex; gap: 6px; align-items: center; }

/* change history */
.au-list { list-style: none; margin: 0; padding: 0; }
.au-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 4px 16px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.au-row:last-child { border-bottom: 0; }
.au-when { color: var(--muted); font-size: 13px; }
.au-what { min-width: 0; overflow-wrap: anywhere; }
.au-delete .au-label { text-decoration: line-through; text-decoration-color: var(--bad); }
.au-ch { list-style: none; margin: 4px 0 0; padding: 0; font-size: 13px; display: grid; gap: 2px; }
@media (max-width: 560px) { .au-row { grid-template-columns: minmax(0, 1fr); } }

/* two-step sign-in */
.mfa-steps { margin: 14px 0 0; padding-inline-start: 20px; display: grid; gap: 14px; }
.mfa-qr { margin: 10px 0 8px; width: 200px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.mfa-qr img { display: block; width: 184px; height: 184px; }
.mfa-secret { font-family: var(--f-mono); font-size: 13px; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; overflow-wrap: anywhere; }
.mfa-verify { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
input.mfa-code { width: 9.5ch; font-family: var(--f-mono); font-size: 20px; letter-spacing: .18em; text-align: center; }
.auth-card input.mfa-code { width: 100%; }
a.who-name { text-decoration: none; }
a.who-name:hover { text-decoration: underline; color: var(--ink); }
form.mfa-verify { flex-direction: row; justify-content: flex-start; }

/* 3D views (renders) */
.rd-area { margin-top: 16px; }
.rd-area:first-of-type { margin-top: 6px; }
.rd-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 10px; }
.rd-head .sub-h { margin: 0; }
.rd-acts { display: inline-flex; gap: 6px; margin-inline-start: auto; }
.rd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.rd-tile { display: flex; flex-direction: column; gap: 6px; padding: 0; border: 0; background: none; text-align: start; cursor: pointer; color: inherit; font: inherit; min-width: 0; }
.rd-img { width: 100%; max-width: none; aspect-ratio: 16 / 10; border-radius: 10px; }
.rd-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s ease; }
.rd-tile:hover .rd-img img, .rd-tile:focus-visible .rd-img img { transform: scale(1.03); }
.rd-cap { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 13.5px; font-weight: 600; min-width: 0; }
.rd-cap > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) { .rd-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .rd-acts { margin-inline-start: 0; } }

.rd-screen { position: fixed; inset: 0; z-index: 50; background: #0d0d0d; color: #f4f2ee; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); }
.rd-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 10px 14px; }
.rd-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-width: 0; }
.rd-title .muted { color: #a19d97; }
.rd-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.rd-screen .btn.ghost { color: #f4f2ee; border-color: #3a3a3a; background: transparent; }
.rd-screen .btn.ghost.danger { color: #ff8f80; }
.rd-replace.busy { opacity: .5; pointer-events: none; }
.rd-stage { flex: 1; min-height: 0; display: grid; grid-template-columns: 56px minmax(0, 1fr) 56px; align-items: center; touch-action: pan-y; user-select: none; }
.rd-frame { position: relative; height: 100%; display: grid; place-items: center; min-width: 0; }
.rd-full { max-width: 100%; max-height: 100%; object-fit: contain; transition: opacity .15s; }
.rd-full.dim { opacity: .35; }
.rd-loading { position: absolute; color: #a19d97; font-size: 14px; }
.rd-nav { height: 64px; width: 44px; margin: auto; border: 0; border-radius: 10px; background: rgba(255,255,255,.08); color: #fff; font-size: 34px; line-height: 1; cursor: pointer; }
.rd-nav:hover { background: rgba(255,255,255,.16); }
.rd-strip { display: flex; gap: 6px; overflow-x: auto; padding: 10px 14px calc(12px + env(safe-area-inset-bottom, 0px)); scrollbar-width: thin; }
.rd-thumb { flex: 0 0 auto; width: 96px; aspect-ratio: 16 / 10; padding: 0; border: 2px solid transparent; border-radius: 6px; overflow: hidden; background: #222; cursor: pointer; opacity: .6; }
.rd-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rd-thumb.on { border-color: var(--brass, #C9A45C); opacity: 1; }
.rd-rename { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rd-rename input { min-height: 34px; padding: 5px 8px; width: 200px; color: var(--ink); }
.rd-rename .suggest { width: 200px; }
@media (max-width: 640px) {
  .rd-stage { grid-template-columns: minmax(0, 1fr); }
  .rd-nav { display: none; }
  .rd-thumb { width: 72px; }
}
.rd-new { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rd-new-row { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.rd-new-row img { width: 72px; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.rd-new-row.with-date { grid-template-columns: 72px minmax(0, 1fr) 9.5em auto; }
.rd-new-row input[type=date] { min-width: 0; }
@media (max-width: 520px) {
  .rd-new-row.with-date { grid-template-columns: 64px minmax(0, 1fr) auto; }
  .rd-new-row.with-date img { grid-row: span 2; width: 64px; }
  .rd-new-row.with-date input[type=date] { grid-column: 2; grid-row: 2; }
  .rd-new-row.with-date [data-rd-drop] { grid-column: 3; grid-row: 1; }
}

/* who has seen the snag list */
.seen-line { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; color: var(--ink); }
.seen-who { white-space: nowrap; }
.snag-cta { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; border-color: var(--brass); }

/* selections: switch between selections and the approved materials schedule */
.sel-switch { align-self: flex-start; max-width: 100%; flex-wrap: wrap; }
@media (max-width: 480px) { .sel-switch a { padding: 6px 11px; font-size: 13px; } }
.sel-switch a { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--muted); white-space: nowrap; }
.sel-switch a:hover { color: var(--ink); }
.sel-switch a.on { background: var(--ink); color: var(--bg); }
.sel-switch a .muted { font-weight: 500; }
.sel-switch a.on .muted { color: var(--bg); opacity: .7; }
.sel-switch .count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--bad-soft); color: var(--bad); font-size: 11.5px; line-height: 18px; text-align: center; }
/* approved materials */
.mat-group { margin-top: 16px; }
.mat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.mat-card { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.mat-card:hover, .mat-card:focus-visible { border-color: var(--rule); }
.mat-img { width: 76px; height: 76px; max-width: none; aspect-ratio: auto; border-radius: 8px; }
.mat-img img { width: 100%; height: 100%; object-fit: cover; }
.mat-swatch { display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; font-family: var(--f-mono); font-weight: 700; color: var(--muted); }
.mat-swatch.sm { width: 56px; height: 40px; }
.mat-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mat-code { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; color: var(--muted); }
.mat-name { line-height: 1.25; overflow-wrap: anywhere; }
.mat-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.mat-ph { width: 100%; max-width: none; aspect-ratio: 1; }
.mat-ph img { width: 100%; height: 100%; object-fit: cover; }
.mat-spec { white-space: pre-wrap; color: var(--ink); background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
.mat-new { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mat-new-row { display: grid; grid-template-columns: 56px 90px minmax(0, 1fr) minmax(0, .8fr) auto; gap: 6px; align-items: center; }
.mat-new-row img { width: 56px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.mat-new-row input { min-height: 36px; padding: 6px 8px; }
@media (max-width: 560px) {
  .mat-grid { grid-template-columns: minmax(0, 1fr); }
  .mat-new-row { grid-template-columns: 56px minmax(0, 1fr) auto; }
  .mat-new-row [data-f=code], .mat-new-row [data-f=brand] { grid-column: 2; }
  .mat-new-row [data-mt-drop] { grid-column: 3; grid-row: 1; }
}

/* quality checks (QA) */
.qa-row { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; gap: 6px 14px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.qa-row:hover { background: var(--surface-2); }
.qa-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.qa-thumb.photo { width: 84px; }
.qa-main { display: grid; gap: 2px; min-width: 0; }
.qa-main b { overflow-wrap: anywhere; }
.qa-tags { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.qa-filter { margin-bottom: 8px; }
.qa-usage { margin: 12px 0 0; }
@media (max-width: 620px) {
  .qa-row { grid-template-columns: 64px minmax(0, 1fr); }
  .qa-thumb.photo { width: 64px; }
  .qa-tags { grid-column: 2; justify-content: flex-start; }
}
.qa-items { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.qa-items legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.qa-items #qa-items { display: grid; gap: 6px; }
.qa-add-item { display: flex; gap: 6px; }
.qa-add-item input { flex: 1; min-width: 0; }
.qa-new-photos { margin-top: 8px; }
.qa-pick { position: relative; width: 96px; }
.qa-status { display: flex; flex-wrap: wrap; gap: 6px; }
.qa-note { margin: 0; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; font-size: 14px; white-space: pre-line; }
.qa-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.qa-fig { position: relative; margin: 0; }
.qa-fig .qa-img.photo { width: 100%; aspect-ratio: auto; }
.qa-fig .qa-img img { height: auto; object-fit: initial; }
.qa-fig figcaption { font-size: 12px; color: var(--muted); margin-top: 3px; }
.qa-box { position: absolute; border: 2.5px solid var(--warn); border-radius: 6px; pointer-events: none; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .7); }
.qa-box.major { border-color: var(--bad); }
.qa-box.dismissed, .qa-pin.dismissed { opacity: .35; border-style: dashed; }
.qa-box.accepted { border-color: var(--good); }
.qa-box i, .qa-pin i { position: absolute; top: -10px; left: -10px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); color: var(--bg); font: 700 11.5px/20px var(--f-body, inherit); text-align: center; font-style: normal; }
.qa-pin { position: absolute; top: 8px; left: 8px; width: 20px; height: 20px; }
.qa-pin i { top: 0; left: 0; }
.qa-more { align-self: start; justify-self: start; }
.qa-ai { display: grid; gap: 8px; }
.qa-ai .sub-h { margin: 0; }
.qa-summary { margin: 0; }
.busy-note { display: flex; gap: 10px; align-items: center; }
.qa-spin, .busy-note .spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: qa-spin .8s linear infinite; flex-shrink: 0; }
@keyframes qa-spin { to { transform: rotate(360deg); } }
.note.warn { background: var(--warn-soft, var(--brass-soft)); }
.qa-findings { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.qa-f { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 4px; }
.qa-f.undecided { border-color: var(--warn); }
.qa-f.dismissed { opacity: .7; }
.qa-f p { margin: 0; }
.qa-f-head { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.qa-num { width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: var(--bg); font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; flex-shrink: 0; }
.qa-accept { margin-top: 6px; padding-top: 8px; border-top: 1px dashed var(--line); }
.qa-items-list { list-style: none; margin: 0; padding: 0; }
.qa-item { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.qa-item-label { flex: 1 1 220px; }
.qa-item-label .chip { margin-inline-start: 4px; }
.qa-item .seg button { padding: 4px 10px; font-size: 13px; }
.seg .seg-b.on.pass { background: var(--good); color: #fff; }
.seg .seg-b.on.fail { background: var(--bad); color: #fff; }
.warn-text { color: var(--bad); margin: 0; }
.qa-sign .row-actions { flex-wrap: wrap; }
.qa-del { margin-top: 4px; }
html:not(.qa-ai-on) .ai-only, html.qa-ai-on .no-ai { display: none !important; }
.tb-pm, .tb-contract { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); margin-top: 4px; font-variant-numeric: normal; }
.tb-pm a { color: inherit; }
.pt-table input[type=tel] { width: 100%; min-width: 120px; padding: 5px 8px; }
.pt-table select { max-width: 100%; }

/* programme: critical path, milestones, baseline (migration 023) */
.bar.crit { box-shadow: inset 0 0 0 2px var(--bad); }
.bar.crit.late { box-shadow: inset 0 0 0 2px var(--bad); }
.bar.base { top: calc(50% + 11px); height: 4px; background: var(--muted); opacity: .45; transform: none; border-radius: 2px; }
/* float (owner and PM): the room after the bar before the handover would move */
:root { --float: #2E7DA6; --float-soft: rgba(46,125,166,.14); }
@media (prefers-color-scheme: dark) { :root { --float: #6FB3D6; --float-soft: rgba(111,179,214,.18); } }
.bar.float { height: 8px; border-radius: 0 4px 4px 0; background: repeating-linear-gradient(135deg, var(--float-soft) 0 4px, transparent 4px 8px); box-shadow: inset 0 0 0 1px var(--float); opacity: .9; }
.legend i.lg-float { height: 8px; width: 18px; border-radius: 0 3px 3px 0; background: repeating-linear-gradient(135deg, var(--float-soft) 0 4px, transparent 4px 8px); box-shadow: inset 0 0 0 1px var(--float); }
.g-ms { position: absolute; top: 50%; width: 14px; height: 14px; margin-left: -7px; transform: translateY(-50%) rotate(45deg); background: var(--ink); border-radius: 2px; }
.g-ms.crit { background: var(--bad); }
.g-ms.done { background: var(--good); }
.legend i.lg-crit { height: 12px; width: 18px; border-radius: 3px; background: var(--plan-bar); box-shadow: inset 0 0 0 2px var(--bad); }
.legend i.lg-base { height: 4px; background: var(--muted); opacity: .6; }
.legend i.lg-ms { width: 10px; height: 10px; background: var(--ink); transform: rotate(45deg); border-radius: 1px; }
.prog-sum { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; margin: 0; }
.prog-stale { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; justify-content: space-between; }

/* programme editor */
.pe-head .card-head { align-items: center; }
.pe-sum { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; margin-bottom: 10px; }
.pe-cal { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.pe-lab { font-size: 13px; font-weight: 600; color: var(--muted); }
.pe-days button { padding: 5px 9px; font-size: 13px; }
.pe-days { flex-wrap: wrap; max-width: 100%; }
@media (max-width: 480px) { .pe-days button { padding: 5px 7px; font-size: 12.5px; } }
.pe-cal .spacer { flex: 1; }
#pe-err { margin-top: 10px; }
.pe-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.pe-grid { width: 100%; min-width: 1180px; border-collapse: collapse; font-size: 13.5px; }
.pe-grid th { position: sticky; top: 0; background: var(--surface-2); text-align: start; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 7px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; z-index: 1; }
.pe-grid td { border-bottom: 1px solid var(--line); padding: 0; height: 34px; vertical-align: middle; }
.pe-grid td input { width: 100%; height: 34px; border: 0; background: transparent; padding: 0 6px; font: inherit; color: var(--ink); border-radius: 0; min-width: 0; }
.pe-grid td input:focus { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--surface); }
.pe-grid td.bad input, .pe-grid td.bad { background: var(--bad-soft); }
.pe-grid .pe-n { width: 34px; text-align: center; color: var(--muted); font-size: 12px; }
.pe-grid tr.crit .pe-n { color: #fff; background: var(--bad); }
.pe-grid tr.ms td.pe-name input { font-weight: 700; }
.pe-grid tr.done td input { color: var(--muted); }
.pe-grid .pe-code { width: 70px; } .pe-grid .pe-name { min-width: 230px; } .pe-grid .pe-phase { width: 150px; } .pe-grid .pe-trade { width: 120px; }
.pe-grid .pe-dur, .pe-grid .pe-weight, .pe-grid .pe-crew { width: 64px; } .pe-grid .pe-dur input, .pe-grid .pe-weight input, .pe-grid .pe-crew input { text-align: end; }
.pe-grid .pe-value { width: 96px; } .pe-grid .pe-value input { text-align: end; } .pe-grid .pe-totv { font-weight: 600; text-align: end; white-space: nowrap; }
.pe-grid .pe-start { width: 140px; } .pe-grid .pe-preds { width: 120px; }
.pe-grid .pe-ro, .pe-grid .pe-fin, .pe-grid .pe-fl { padding: 0 6px; white-space: nowrap; color: var(--muted); font-size: 13px; }
.pe-grid .pe-ro { color: var(--ink); font-style: italic; }
.pe-grid .pe-fl .chip { font-size: 11px; }
.pe-grid .pe-act { width: 60px; white-space: nowrap; text-align: center; }
.pe-b { border: 0; background: transparent; width: 26px; height: 26px; border-radius: 6px; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; }
.pe-b:hover { background: var(--surface-2); color: var(--ink); }
.pe-b.danger:hover { color: var(--bad); }
.pe-b.confirming { background: var(--bad); color: #fff; }
.pe-h-add { display: flex; gap: 6px; }
.pe-hols { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.pe-hols li { display: flex; align-items: center; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.pe-hols li .muted { flex: 1; }

/* programme downloads */
.dl-opt { display: grid; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.dl-opt p { margin: 3px 0 0; }
.dl-act { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dl-more { display: grid; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.dl-more .field { max-width: 360px; }
/* programme editor: the % of work total */
.pe-grid tfoot td { padding: 8px 6px; border-top: 2px solid var(--line); background: var(--surface-2); font-size: 13px; }
.pe-grid .pe-tot-lab { text-align: end; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-size: 11.5px; }
.pe-grid .pe-tot { font-weight: 700; text-align: end; }
.pe-grid .pe-tot-act { white-space: nowrap; } .pe-grid .pe-tot-act .btn + .btn { margin-inline-start: 6px; }
.ok-t { color: var(--good); }
/* fit-out library: pick a template */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-bottom: 14px; }
.lib-card { display: flex; flex-direction: column; gap: 4px; text-align: start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: inherit; font: inherit; cursor: pointer; }
.lib-card[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.lib-card b { font-size: 15px; } .lib-card .lib-meta { color: var(--muted); margin-top: 2px; }
.lib-h { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 6px 0 8px; }
.lib-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px 16px; margin-bottom: 12px; }
#lib-form .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 480px) { #lib-form .grid2 { grid-template-columns: 1fr; } }
/* new project: the kind of project and its drafted programme */
.np-h { margin: 18px 0 4px; font-size: 15px; } .np-p { margin: 0 0 10px; }
.np-kinds .lib-card[data-kind=""] { border-style: dashed; }
.np-box { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; background: var(--surface-2); }
.np-sum { margin: 4px 0 8px; }
.np-phases { margin: 0; padding-inline-start: 18px; display: grid; gap: 6px; } .np-phases li b { display: block; font-size: 13px; } .np-phases li span { display: block; line-height: 1.4; }
/* editor: a linked activity its links push later than its typed date */
.pe-grid td.pe-start.pushed { position: relative; }
.pe-grid td.pe-start.pushed input { color: var(--muted); text-decoration: line-through; }
.pe-grid td.pe-start.pushed::after { content: "→ " attr(data-when); position: absolute; right: 6px; bottom: 1px; font-size: 10px; color: var(--warn, #B07A12); pointer-events: none; }
.float-t { color: var(--float); font-weight: 600; }
/* programme recovery */
.recovery { gap: 14px; }
.rc-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.rc-head h2 { margin: 2px 0 4px; }
.rc-banner { padding-bottom: 0; }
.rc-wait { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
#rc-body { display: flex; flex-direction: column; gap: 16px; }
.rc-kpis .val.val-date { font-size: 24px; }
.kpi.bad .val { color: var(--bad); } .kpi.good .val { color: var(--good); }
.rc-split { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--neutral-soft); margin: 4px 0 8px; }
.rc-split i, .rc-legend i { display: block; }
.rc-split i.client, .rc-legend i.client { background: var(--brass); }
.rc-split i.neutral, .rc-legend i.neutral { background: var(--rule); }
.rc-split i.contractor, .rc-legend i.contractor { background: var(--bad); }
.rc-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13.5px; align-items: center; }
.rc-legend span { display: inline-flex; gap: 6px; align-items: center; }
.rc-legend i { width: 10px; height: 10px; border-radius: 3px; }
.rc-imp td { vertical-align: top; }
.rc-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.rc-opt { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); min-width: 0; }
.rc-opt.rec { border-color: var(--good); box-shadow: inset 0 0 0 1px var(--good); }
.rc-opt.chosen { border-color: var(--brass); box-shadow: inset 0 0 0 1px var(--brass); }
.rc-opt.off { background: var(--surface-2); color: var(--muted); }
.rc-opt header { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.rc-opt h3 { margin: 0; font-size: 16px; }
.rc-opt p { margin: 0; }
.rc-tags { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.rc-meter { display: inline-block; width: 46px; height: 6px; border-radius: 3px; background: var(--neutral-soft); overflow: hidden; vertical-align: middle; }
.rc-meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--good), var(--warn) 50%, var(--bad)); background-size: 46px 100%; }
.rc-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rc-nums > div, .rc-sum > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rc-nums b { font-size: 15px; }
.rc-why, .rc-steps, .rc-risks, .rc-impl { margin: 0; padding-inline-start: 18px; font-size: 13.5px; display: grid; gap: 4px; }
.rc-opt details summary { cursor: pointer; font-size: 13.5px; font-weight: 600; }
.rc-opt details ul { margin-top: 6px; }
.rc-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); margin: 10px 0; }
.rc-sum b { font-size: 15px; }
.rc-cmp { width: 100%; font-size: 13.5px; margin: 8px 0; } .rc-cmp th { text-align: start; font-weight: 600; }
.rc-plan { display: flex; flex-direction: column; gap: 10px; }
.rc-plan h3 { margin: 8px 0 2px; font-size: 15px; }
.rc-note { border-inline-start: 3px solid var(--brass); padding: 4px 12px; background: var(--brass-soft); border-radius: 0 8px 8px 0; }
[dir="rtl"] .rc-note { border-radius: 8px 0 0 8px; }
.rc-note p { margin: 4px 0 0; white-space: pre-wrap; }
.rc-sigs { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.rc-sigs .sig { border: 1px dashed var(--rule); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.rc-sigs .sig.done { border-style: solid; border-color: var(--good); background: var(--good-soft); }
.rc-plans { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rc-plans li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.rc-plans li a { display: flex; flex-direction: column; gap: 2px; color: inherit; text-decoration: none; min-width: 0; }
.rc-plans li a b { text-decoration: underline; text-underline-offset: 3px; }
.rc-all summary { cursor: pointer; font-weight: 600; margin: 6px 0 10px; }
.good-t { color: var(--good); font-weight: 600; }
.vo-time { color: var(--brass-ink); margin-top: 2px; }
@media (max-width: 600px) { .rc-nums { grid-template-columns: 1fr 1fr; } .rc-opts { grid-template-columns: 1fr; } }

/* BoQ & purchasing (Selections tab): the bill, the calculator and purchase requests */
.boq-table, .pr-table, .pi-table, .to-table { min-width: 0; }
.boq-table .boq-sec td, .pack-table .boq-sec td { background: var(--surface-2, var(--bg)); font-size: 12.5px; padding: 6px 10px; }
.boq-row, .pr-row { cursor: pointer; }
.boq-row:hover td, .pr-row:hover td { background: var(--line); }
.boq-text { white-space: pre-line; color: var(--muted); border-inline-start: 3px solid var(--line); padding: 4px 10px; margin: 8px 0; max-height: 14em; overflow: auto; }
.to-table td, .pi-table td { padding: 8px 6px; vertical-align: top; }
.to-table input, .to-table select, .pi-table input { padding: 5px 7px; font-size: 13.5px; }
.to-table td:nth-child(2), .pi-table td:nth-child(2) { min-width: 15em; }
.to-table select { min-width: 5.5em; }
.to-table .to-qty, .pi-table .pi-qty { width: 6.5em; }
.to-basis { display: inline-block; max-width: 36ch; }
.to-notes { margin: 8px 0 0; padding-inline-start: 18px; }
.to-add { margin-top: 10px; align-items: center; }
.to-add select { max-width: 18em; }
.pr-pack .pack-table { font-size: 12px; }
.pr-pack .pack-table td.small { font-size: 11.5px; }

/* ---- sideways scrolling (js/hscroll.js): arrows at each end where there's more, a fade over the hidden edge, a thin bar on computers.
   Works with a mouse, a touchpad, a touchscreen, the keyboard, a tablet or half a split screen.
   The arrows sit in a zero-size layer placed just before the element and positioned over it (the element is not wrapped). */
.hs-layer { position: absolute; width: 0; height: 0; z-index: 4; pointer-events: none; display: none; }
.hs-layer.hs-on { display: block; }
.hs-layer > * { position: absolute; }
.hs-btn { z-index: 2; display: none; align-items: center; justify-content: center; width: 36px; padding: 0; border: 0; cursor: pointer; pointer-events: auto;
  color: var(--ink); background: transparent; -webkit-tap-highlight-color: transparent; }
.hs-btn svg { position: relative; z-index: 1; width: 26px; height: 26px; padding: 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); box-sizing: border-box; }
.hs-btn:hover svg { border-color: var(--ink); }
.hs-btn:focus-visible svg { outline: 2px solid var(--accent); outline-offset: 2px; }
.hs-btn.prev { left: var(--hs-pin, 0px); } .hs-btn.next { right: 0; }
.hs-strip .hs-btn.prev { background: linear-gradient(90deg, var(--hs-bg, var(--bg)) 40%, transparent); justify-content: flex-start; }
.hs-strip .hs-btn.next { background: linear-gradient(270deg, var(--hs-bg, var(--bg)) 40%, transparent); justify-content: flex-end; }
.hs-rtl .hs-btn.prev { left: auto; right: 0; } .hs-rtl .hs-btn.next { right: auto; left: 0; }
.hs-rtl .hs-btn svg { transform: scaleX(-1); }
.hs-strip.hs-rtl .hs-btn.prev { background: linear-gradient(270deg, var(--hs-bg, var(--bg)) 40%, transparent); justify-content: flex-end; }
.hs-strip.hs-rtl .hs-btn.next { background: linear-gradient(90deg, var(--hs-bg, var(--bg)) 40%, transparent); justify-content: flex-start; }
.hs-layer.hs-can-prev > .hs-btn.prev, .hs-layer.hs-can-next > .hs-btn.next { display: flex; }
/* tables and charts: a shadow on the side that hides columns, under the arrow */
.hs-fade { top: 0; bottom: 0; width: 18px; z-index: 1; opacity: 0; transition: opacity .15s; }
.hs-fade.prev { left: var(--hs-pin, 0px); background: linear-gradient(90deg, rgba(0,0,0,.14), transparent); border-radius: 12px 0 0 12px; }
.hs-fade.next { right: 0; background: linear-gradient(270deg, rgba(0,0,0,.14), transparent); border-radius: 0 12px 12px 0; }
.hs-pane.hs-can-prev:not(.hs-rtl) > .hs-fade.prev, .hs-pane.hs-can-next:not(.hs-rtl) > .hs-fade.next,
.hs-pane.hs-rtl.hs-can-prev > .hs-fade.next, .hs-pane.hs-rtl.hs-can-next > .hs-fade.prev { opacity: 1; }
/* a computer gets a thin scrollbar you can grab under every strip and table that scrolls */
@media (pointer: fine) {
  :is(.tabs, .dw-filter, .rd-strip)[data-hs-on] { scrollbar-width: thin; scrollbar-color: var(--rule) transparent; padding-bottom: 2px; }
  :is(.tabs, .dw-filter, .rd-strip)[data-hs-on]::-webkit-scrollbar { display: block; height: 6px; }
  :is(.tabs, .dw-filter, .rd-strip)[data-hs-on]::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 6px; }
  :is(.gantt-scroll, .pe-scroll, .table-scroll)[data-hs-on] { scrollbar-width: thin; scrollbar-color: var(--muted) transparent; }
}
:is(.gantt-scroll, .pe-scroll, .table-scroll):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media print { .hs-layer { display: none !important; } }

/* handed-over jobs and the request to reopen them (migration 035) */
.handed-bar { margin: 0 0 14px; }
.reopen-reason { margin: 8px 0; padding: 8px 12px; border-inline-start: 3px solid var(--line); background: var(--accent-soft, transparent); border-radius: 6px; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.reopen-card { margin-bottom: 14px; }
.reopen-admin li { align-items: flex-start; flex-wrap: wrap; }
.reopen-admin li > div { flex: 1 1 280px; display: flex; flex-direction: column; gap: 4px; }
#f-reopen textarea { width: 100%; resize: vertical; }

/* a handed-over job is locked (migration 035): the controls that would change it are hidden on every tab but
   snags (aftercare), payments (retention), people and settings. The database refuses the changes anyway. */
body.job-locked :is(
  #f-note, #f-progress, [data-del-update],
  [data-add-act], [data-del-act], [data-del-all], [data-import], [data-do-import], [data-library], [data-lib-go], [data-template],
  [data-prog-update], [data-do-p], a[href*="programme?edit=1"], [data-delay-new], [data-delay-del], [data-delay-claim],
  [data-delay-withdraw], [data-eot-yes], [data-eot-no], [data-eot-reject], [data-rc-choose], [data-rc-decline], [data-rc-sign],
  [data-rc-withdraw], [data-rc-rates],
  [data-add-appr], [data-del-appr], [data-appr],
  [data-dw-upload], [data-dv-deldw], [data-dv-delrev], [data-dv-newrev], [data-r-add], [data-rv-del], [data-rv-rename],
  [data-rv-replace], [data-r-share],
  [data-sel-new], [data-sel-edit], [data-sel-del], [data-sel-send], [data-sel-draft], [data-sel-changes], [data-choose-opt],
  [data-open-form], [data-mat-add], [data-mat-edit], [data-mat-del], [data-mat-csv], [data-mat-change], [data-mat-vis], [data-mat-spec],
  [data-vo-new], [data-vo-edit], [data-del-vo], [data-vo-send], [data-send], [data-vo-approve], [data-vo-decline], [data-vo-change],
  [data-doc-new], [data-doc-edit], [data-del-doc],
  [data-qa-new], [data-qa-del], [data-qa-ai], [data-qa-sign], [data-qa-reopen], [data-qa-accept], [data-qa-dismiss],
  [data-qa-add-item], [data-qa-undo], [data-qa-visible],
  [data-boq-add], [data-boq-csv], [data-boq-paste], [data-line-edit], [data-line-del], [data-pr-new], [data-pr-del], [data-pr-sent],
  [data-pr-sign], [data-items-save], [data-item-del],
  #drawer form, #drawer [type=submit]
) { display: none !important; }
.ho-reason { width: 100%; margin-top: 6px; }

/* after handover (migration 038): only the client logs new defects; payments can be invoiced and paid, not added or changed */
body.job-handed-staff :is([data-add-snag], [data-pay-new], [data-make-plan], [data-pay-plan], [data-del-pay], [data-invite-client], #f-inv-client, #f-inv-sub) { display: none !important; }
.pe-notify { display: block; margin-top: 4px; }

/* Attention Engine and Project health (overview; js/health.js) */
.grid-health { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); margin-bottom: 16px; }
.attention-card .at-list, .at-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.at-row { border-top: 1px solid var(--line); }
.at-row:first-child { border-top: 0; }
.at-row a { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 0; color: inherit; text-decoration: none; }
.at-row a:hover .at-text { text-decoration: underline; text-underline-offset: 3px; }
.at-text { font-size: 14px; line-height: 1.35; min-width: 0; }
.at-level .chip { font-size: 11px; }
.at-red .at-text { font-weight: 600; }
.health-card .card-head { align-items: flex-start; }
.hl-score { display: flex; align-items: baseline; gap: 6px; flex: none; }
.hl-big { font-family: var(--f-display); font-size: 40px; font-weight: 600; line-height: 1; letter-spacing: -.02em; }
.hl-big.good { color: var(--good); } .hl-big.warn { color: var(--warn, #c98a00); } .hl-big.bad { color: var(--bad); }
.hl-of { color: var(--muted); font-size: 13px; }
.hl-rows { display: flex; flex-direction: column; gap: 6px; }
.hl-row { display: grid; grid-template-columns: minmax(0, 11em) 1fr 2.5em; gap: 8px; align-items: center; font-size: 13px; }
.hl-label { line-height: 1.25; }   /* wraps rather than cutting the area name short */
.hl-bar { display: block; height: 7px; border-radius: 99px; background: var(--plan-bar); overflow: hidden; }
.hl-bar i { display: block; height: 100%; border-radius: 99px; background: var(--good); }
.hl-bar i.warn { background: var(--warn, #c98a00); } .hl-bar i.bad { background: var(--bad); }
.hl-num { text-align: end; }
.hl-cap { margin: 10px 0 0; color: var(--bad); }
.hl-why { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.hl-why li { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; padding: 4px 0; border-top: 1px solid var(--line); }
.hl-why li:first-child { border-top: 0; }
.hl-why b { color: var(--bad); flex: none; }
.hl-chip { text-decoration: none; }
@media (max-width: 760px) { .grid-health { grid-template-columns: 1fr; } .at-row a { grid-template-columns: auto minmax(0, 1fr); } .at-level { display: none; } }
.ol-table .ol-mat { width: 100%; min-width: 12em; }
.ol-table .ol-qty, .ol-table .ol-rate, .gr-table input[type=number] { width: 6.5em; }
@media (max-width: 600px) { .health .hl-top { grid-template-columns: 1fr; } .bd-nums { grid-template-columns: 1fr; } }

/* Material loop (migration 040): BoQ vs drawing decision, purchase orders, deliveries */
.bad-t { color: var(--bad); font-weight: 600; }
.bd-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.bd-nums > div { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.bd-form { margin-top: 6px; }
.ol-table td { padding: 6px 4px; vertical-align: top; }
.ol-table input, .ol-table select, .gr-table input { padding: 5px 7px; font-size: 13.5px; }
.ol-table .ol-mat, .ol-table .ol-spec { display: block; width: 100%; min-width: 12em; }
.ol-table .ol-spec { margin-top: 4px; }
.ol-table .ol-qty, .ol-table .ol-rate, .gr-table .gr-qty, .gr-table .gr-rej { width: 6.5em; }
.gr-table .gr-note { display: block; width: 100%; margin-top: 4px; }
.grn { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-top: 8px; }
.grn-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.grn-head .linkbtn { margin-inline-start: auto; }
.grn-lines { margin: 6px 0 0; padding-inline-start: 18px; }
/* Cost control (migration 041) */
.kpi .val.cv { font-size: 24px; }
.cost-table { min-width: 560px; }
.cost-table td, .cost-table th { padding: 8px 8px; }
.cost-table tr.total td { border-top: 2px solid var(--rule); }
.bud-fill { align-items: center; }
/* RFIs (migration 042) */
.rfi-card { margin-top: 14px; }
.rfi-row { cursor: pointer; grid-template-columns: 74px minmax(0, 1fr) auto; }
.rfi-row:hover { background: var(--line); }
.rfi-tags { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.rfi-text { white-space: pre-wrap; margin: 0; }
@media (max-width: 600px) { .bd-nums { grid-template-columns: 1fr 1fr; } .rfi-row { grid-template-columns: 64px minmax(0, 1fr); } .rfi-tags { grid-column: 2; justify-content: flex-start; } }

/* Ask ARQVANT (migration 044, function project-assistant): shown only when the AI is switched on */
html:not(.ask-ai-on) .ask-only { display: none !important; }
.ask-turns { display: flex; flex-direction: column; gap: 14px; max-height: 52vh; overflow-y: auto; }
.ask-turn { display: flex; flex-direction: column; gap: 8px; }
.ask-q { margin: 0; align-self: flex-end; max-width: 88%; background: var(--surface-2, var(--line)); border-radius: 12px; padding: 8px 12px; font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.ask-a { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.ask-sum { margin: 0; font-size: 14.5px; line-height: 1.5; }
.ask-find { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.ask-find li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; align-items: baseline; font-size: 13.5px; line-height: 1.45; }
.ask-a h4 { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ask-next { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }
.ask-sugg { display: flex; flex-wrap: wrap; gap: 6px; }
.ask-sugg .chip-btn { white-space: normal; text-align: start; font-weight: 500; }
.ask-form { display: flex; flex-direction: column; gap: 8px; }
.ask-form textarea { width: 100%; resize: vertical; font-size: 16px; }

/* Site map (migration 043): rooms and areas on the floor plans, under the snag pins */
.zone { position: absolute; padding: 0; margin: 0; border: 2px solid var(--muted); background: color-mix(in srgb, var(--muted) 8%, transparent); border-radius: 4px; cursor: pointer; z-index: 0; display: block; text-align: start; font: inherit; color: var(--ink); }
.zone:hover, .zone:focus-visible { background: color-mix(in srgb, currentColor 14%, transparent); outline: none; }
.zone.z-good { border-color: var(--good); background: color-mix(in srgb, var(--good) 10%, transparent); }
.zone.z-warn { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.zone.z-bad { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }
.zone-tag { position: absolute; top: 2px; inset-inline-start: 2px; max-width: calc(100% - 4px); display: inline-flex; align-items: center; gap: 4px; background: rgba(255, 255, 255, .92); color: #151515; border-radius: 4px; padding: 1px 5px; font-size: 11px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.zone-tag b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.zone-sn { background: var(--bad); color: #fff; border-radius: 999px; padding: 0 5px; font-weight: 700; }
.zone.ghost { border-style: dashed; cursor: default; pointer-events: none; opacity: .6; }
.zone.drawing { border-color: var(--accent); border-style: solid; background: color-mix(in srgb, var(--accent) 12%, transparent); pointer-events: none; }
.plan-view.draw { cursor: crosshair; touch-action: none; user-select: none; -webkit-user-select: none; }
.plan-view.draw img { pointer-events: none; -webkit-user-drag: none; }
.legend i.lg.z-good { background: var(--good); border-radius: 2px; } .legend i.lg.z-warn { background: var(--warn); border-radius: 2px; } .legend i.lg.z-bad { background: var(--bad); border-radius: 2px; }
/* rooms as outlines (migration 047): the button is a clear box that fits the room; the SVG draws the outline and takes the taps */
.zone.poly { border: 0; background: none; border-radius: 0; pointer-events: none; color: var(--muted); }
.zone.poly svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.zone.poly polygon { fill: color-mix(in srgb, var(--muted) 8%, transparent); stroke: var(--muted); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; pointer-events: visiblePainted; cursor: pointer; }
.zone.poly.z-good { color: var(--good); } .zone.poly.z-good polygon { fill: color-mix(in srgb, var(--good) 12%, transparent); stroke: var(--good); }
.zone.poly.z-warn { color: var(--warn); } .zone.poly.z-warn polygon { fill: color-mix(in srgb, var(--warn) 16%, transparent); stroke: var(--warn); }
.zone.poly.z-bad { color: var(--bad); } .zone.poly.z-bad polygon { fill: color-mix(in srgb, var(--bad) 16%, transparent); stroke: var(--bad); }
.zone.poly:hover polygon, .zone.poly:focus-visible polygon { fill: color-mix(in srgb, currentColor 24%, transparent); }
.zone.poly:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.zone.poly .zone-tag { inset-inline-start: auto; top: auto; transform: translate(-50%, -50%); max-width: 90%; }
.zone.poly.ghost polygon { stroke-dasharray: 5 4; pointer-events: none; }
.zn-draw { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.zn-draw svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.zn-draw polygon, .zn-draw polyline { fill: color-mix(in srgb, var(--accent) 16%, transparent); stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.zn-draw polyline { fill: none; }
.zn-draw .pt { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); box-sizing: border-box; }
.zn-draw .pt.last { background: var(--accent); }
/* finishes placed on the plan (migration 048): an arrow whose tip is the spot, with the approved code in the label */
.fpin { position: absolute; z-index: 2; width: 0; height: 0; padding: 0; margin: 0; border: 0; background: none; cursor: pointer; font: inherit; }
.fpin-b { position: absolute; bottom: 8px; left: 0; transform: translateX(-50%); white-space: nowrap; font: 700 12.5px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace; color: #fff; background: var(--accent); border-radius: 4px; padding: 3px 8px; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); }
.fpin-b::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -6px; border: 6px solid transparent; border-top-color: var(--accent); border-bottom: 0; }
.fpin.f-ok .fpin-b { background: var(--good); } .fpin.f-ok .fpin-b::after { border-top-color: var(--good); }
.fpin.f-no .fpin-b { background: #6b6b6b; border: 1px dashed #fff; text-decoration: line-through; } .fpin.f-no .fpin-b::after { border-top-color: #6b6b6b; }
.fpin:hover .fpin-b, .fpin:focus-visible .fpin-b { outline: 2px solid var(--ink); outline-offset: 1px; }
.fpin.draft { pointer-events: none; }
.legend i.lg.f-ok { background: var(--good); border-radius: 2px; } .legend i.lg.f-no { background: #6b6b6b; border-radius: 2px; }
.fin-photo { display: block; max-width: 100%; border-radius: 8px; overflow: hidden; }
.fin-photo img { display: block; width: 100%; max-height: 240px; object-fit: cover; }
.fin-facts { margin: 0; }
.fin-list li { align-items: center; }
.link-btn { background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; text-align: start; cursor: pointer; }
.link-btn:hover b { text-decoration: underline; }
.zone-legend { margin-top: 6px; }
.zone-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.zone-bar { position: relative; height: 8px; border-radius: 4px; background: var(--line); overflow: visible; }
.zone-bar i { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--progress, var(--good)); border-radius: 4px; }
.zone-bar b { position: absolute; top: -3px; width: 2px; height: 14px; background: var(--ink); }
.zone-list, .zone-snags { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.zone-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13.5px; padding: 4px 0; border-top: 1px solid var(--line); }
.zone-list li:first-child { border-top: 0; }
.zone-snags a { display: flex; gap: 8px; align-items: center; font-size: 13.5px; color: inherit; text-decoration: none; }
.zone-snags .snag-no { flex: none; }
.zone-acts { border: 0; padding: 0; margin: 0; max-height: 260px; overflow-y: auto; }
.zone-acts legend { font-weight: 600; font-size: 13.5px; margin-bottom: 6px; }
.zone-ph { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }

/* Sections: the ten groups on the tab bar, and each group's pages in a quieter second row */
.subtabs { display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; padding: 10px 0 2px; }
.subtabs::-webkit-scrollbar { display: none; }
.subtabs a { flex: 0 0 auto; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 13.5px; font-weight: 600; white-space: nowrap; text-decoration: none; }
.subtabs a:hover { color: var(--ink); border-color: var(--rule); }
.subtabs a[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.subtabs a.locked { color: var(--rule); }
.subtabs .count { display: inline-block; min-width: 18px; padding: 0 5px; margin-inline-start: 6px; border-radius: 999px; background: var(--bad-soft); color: var(--bad); font-size: 11px; line-height: 17px; text-align: center; }
.subtabs a[aria-current="page"] .count { background: var(--bad); color: #fff; }
.subtabs .lock-ico { margin-inline-start: 4px; }
@media (max-width: 760px) { .subtabs { margin-inline: -16px; padding-inline: 16px; } }

/* Programme: Day numbers from mobilisation; the Pre-construction page */
.g-day { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.pc-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0; }
.pc-facts > div { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.pc-facts dt { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pc-facts dd { margin: 2px 0 0; font-weight: 600; }
.pc-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.pc-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 3.2em auto; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.pc-row:first-child { border-top: 0; }
.pc-name { display: flex; flex-direction: column; min-width: 0; }
.pc-name b { font-weight: 600; overflow-wrap: anywhere; }
.pc-dates { color: var(--muted); font-size: 13px; white-space: nowrap; }
.pc-pct { text-align: end; }
@media (max-width: 760px) { .pc-facts { grid-template-columns: 1fr 1fr; } .pc-row { grid-template-columns: minmax(0, 1fr) auto; } .pc-dates, .pc-pct { grid-column: 1; } }

/* a row opened from a badge, an alert or the Attention list: highlighted for a moment */
@keyframes flash-row { 0%, 40% { background: color-mix(in srgb, var(--accent) 22%, transparent); box-shadow: inset 3px 0 0 var(--accent); } 100% { background: transparent; box-shadow: none; } }
.flash { animation: flash-row 2.6s ease-out; }
@media (prefers-reduced-motion: reduce) { .flash { animation: none; outline: 2px solid var(--accent); outline-offset: 2px; } }

/* a new alert pops up at the top corner; tapping it opens the item */
.alert-pop { position: fixed; top: 64px; inset-inline-end: 16px; z-index: 60; width: min(360px, calc(100vw - 32px)); background: var(--card, #fff); color: var(--ink); border: 1px solid var(--line); border-inline-start: 4px solid var(--accent); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); }
.alert-pop[hidden] { display: none; }
.alert-pop-card { display: flex; flex-direction: column; gap: 3px; padding: 12px 40px 12px 14px; color: inherit; text-decoration: none; }
.alert-pop-card:hover b { text-decoration: underline; }
.alert-pop-card .alert-body { font-size: 13px; color: var(--muted); }
.alert-pop-x { position: absolute; top: 8px; inset-inline-end: 8px; border: 0; background: none; font-size: 16px; line-height: 1; padding: 4px 6px; cursor: pointer; color: var(--muted); }

/* a new version is live: offer a reload */
.update-bar { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 70; display: flex; align-items: center; gap: 12px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-top: 3px solid var(--brass, #C98F00); padding: 10px 12px 10px 16px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); font-size: 14px; width: max-content; max-width: calc(100vw - 32px); }

/* admin: the summary cards open the customer list they count */
a.kpi-link { color: inherit; text-decoration: none; cursor: pointer; transition: border-color .15s; }
a.kpi-link:hover, a.kpi-link:focus-visible, a.kpi-link.on { border-color: var(--accent); }

/* rooms found from the plan's names, before they're added */
.zone.poly.found { pointer-events: none; }
.zone.poly.found polygon { fill: color-mix(in srgb, var(--c) 22%, transparent); stroke: var(--c); pointer-events: none; cursor: default; }
.zone.poly.found .zone-tag b { color: #fff; background: var(--c); border-radius: 999px; padding: 0 6px; }
.found-view { margin: 8px 0; }
.found-list li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; }
.found-list .found-name { min-width: 0; padding: 6px 8px; }
.found-n { display: inline-block; min-width: 20px; text-align: center; color: #fff; border-radius: 999px; font-size: 12px; padding: 1px 6px; }
.zn-modes { margin-bottom: 6px; }

/* site diary: pick updates to send as one message */
.share-bar { position: sticky; top: 0; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 10px; margin: 0 0 10px; background: var(--card, #fff); border: 1px solid var(--accent); border-radius: 8px; }
.share-bar[hidden] { display: none; }
.share-bar .btn.disabled { opacity: .5; }
.post-pick { float: inline-end; margin: 2px 0 0 8px; }
.post-pick[hidden] { display: none; }
.post-pick input { width: 20px; height: 20px; }

/* view as another tier (owners and operations managers) */
.view-as { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 0 0 0 7px; color: var(--muted); height: 29px; box-sizing: border-box; }
.view-as select, .view-as select:focus { width: auto; min-width: 0; field-sizing: content; height: 27px; min-height: 0; padding: 0 2px; font-size: 13px; line-height: 1; font-weight: 600; border: 0; border-radius: 8px; background: var(--surface); color: var(--ink); box-shadow: none; }
.view-as select option { background: var(--surface); color: var(--ink); }
.view-as .va-sep { width: 1px; align-self: stretch; margin: 6px 2px; background: var(--line); }
@media (max-width: 440px) { .view-as:not(.plan-on) :is(.va-sep, [data-view-plan]) { display: none; } .view-as > svg { display: none; } .view-as { padding-left: 4px; } .who { gap: 6px; } }
.lbl-short { display: none; }
@media (max-width: 440px) { .lbl-long { display: none; } .lbl-short { display: inline; } .who { flex-wrap: wrap; justify-content: flex-end; row-gap: 6px; } }   /* plans are for demos on a laptop; a phone keeps the bar on one line */
.view-as.on { border-color: var(--progress); }
.view-as-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-inline-start: 4px solid var(--accent); }
body.viewing-as :is(button.primary, .btn.primary, button[type=submit], [data-note], .quick-post, [data-share-pick], [data-rooms], [data-find-rooms], [data-fin-new], [data-plans-open], [data-pr-new], [data-po-new], [data-boq-add], [data-boq-paste], [data-vo-new], [data-pay-new], [data-sel-new], [data-doc-new], [data-mat-add], [data-mobilise], [data-stages], [data-invite], .filebtn):not([data-view-as-off]) { pointer-events: none; opacity: .45; }
/* what's used of the plan (migration 053) */
.plan-meters { list-style: none; padding: 0; margin: 8px 0 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.plan-meters li { display: inline-flex; gap: 8px; align-items: baseline; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; background: var(--surface-2); font-size: 13px; }
.plan-meters li span { color: var(--muted); }

/* ---- overview: the three measures (physical progress, programme performance, health in words) */
.kpi .val.kv-good { color: var(--good); } .kpi .val.kv-warn { color: var(--warn); } .kpi .val.kv-bad { color: var(--bad); }
.grid-health:has(> :only-child) { grid-template-columns: minmax(0, 1fr); }
.hl-score { align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.hl-score .chip { font-size: 14px; padding: 5px 12px; }
.hl-num-line { white-space: nowrap; }
.hl-reason { margin: 4px 0 12px; display: grid; gap: 10px; }
.hl-reason div { display: grid; gap: 2px; }
.hl-reason dt { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.hl-reason dd { margin: 0; font-size: 14px; line-height: 1.45; }
.hl-more summary { cursor: pointer; color: var(--muted); margin-bottom: 8px; }
.hl-more[open] summary { margin-bottom: 10px; }

/* ---- the first-hour checklist on a new project's overview */
.start-card { border-color: var(--brass, #b08a3e); }
.start-list { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 2px; }
.start-list li a { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 4px; border-radius: 8px; color: inherit; text-decoration: none; }
.start-list li a:hover { background: var(--neutral-soft, #f2f1ee); }
.start-tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--rule, #ccc); display: inline-grid; place-items: center; font-size: 13px; font-weight: 700; }
.start-list li.done .start-tick { background: var(--good); border-color: var(--good); color: #fff; }
.start-list li.done .start-what { color: var(--muted); text-decoration: line-through; }
.start-what small { display: block; color: var(--muted); font-size: 12.5px; text-decoration: none; }
.start-go { font-size: 13px; font-weight: 600; white-space: nowrap; }

/* ---- Today on site: the site team's daily page */
.today .td-h { font-size: 17px; margin: 18px 0 8px; display: flex; gap: 8px; align-items: baseline; }
.td-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.td-card { display: grid; gap: 10px; margin: 0; }
.td-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.td-top h3 { margin: 2px 0 0; font-size: 16px; line-height: 1.3; }
.td-pct { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.td-pct .big { font-size: 30px; font-weight: 600; font-family: var(--f-display); }
.td-arrow { font-size: 20px; color: var(--accent); }
.td-quick { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.td-quick .btn { justify-content: center; padding-inline: 4px; min-height: 40px; }
.td-card textarea { min-height: 44px; height: 44px; }
.td-card textarea:focus, .td-card textarea:not(:placeholder-shown) { height: 84px; }
.td-foot { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.td-foot .btn { margin-inline-start: auto; min-width: 88px; justify-content: center; }
.td-card .photos:empty { display: none; }
.td-done { margin: 0; color: var(--good); font-weight: 600; }
.td-posted { border-color: var(--good); }
.td-share .card-head { align-items: center; }
@media (max-width: 520px) { .td-list { grid-template-columns: minmax(0, 1fr); } }

.tb-more { display: none; }
/* ---- phone: a compact project header, so the first screen shows the work, not the paperwork */
@media (max-width: 640px) {
  .titleblock .tb-desc { display: none; }
  .titleblock .tb-grid > div:nth-child(-n+4) { display: none; }
  .titleblock .tb-sec { display: none; }
  .titleblock.tb-open .tb-grid > div { display: block; }
  .titleblock.tb-open .tb-desc, .titleblock.tb-open .tb-sec { display: revert; }
  .titleblock .tb-more { display: inline-flex; }
}

ul.hl-why li a { color: inherit; text-decoration: none; } ul.hl-why li a:hover .hl-go { text-decoration: underline; }
.hl-go { color: var(--accent); font-weight: 600; font-size: 12.5px; white-space: nowrap; }

/* ---- BoQ upload from Excel */
.filebtn-plain { position: relative; cursor: pointer; }
.bu-sheets, .bu-doubt { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.bu-doubt li { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }

/* ---- contracts (migration 054) */
.ct-doc { max-width: 860px; }
.ct-text h3 { font-size: 15px; margin: 18px 0 6px; }
.ct-text p { margin: 0 0 10px; line-height: 1.6; }
.ct-body { font-family: var(--f-mono, monospace); font-size: 13px; min-height: 360px; }
.sig-pad { width: 100%; max-width: 520px; height: 150px; border: 1px dashed var(--rule, #bbb); border-radius: 10px; background: #fff; touch-action: none; display: block; }
.sig-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.sig-grid > div { display: grid; gap: 4px; align-content: start; }
.sig-img { max-width: 260px; height: 90px; object-fit: contain; object-position: left; background: #fff; border-bottom: 1px solid var(--line); }
@media print { .no-print, .topbar, header, nav { display: none !important; } .ct-doc { border: 0; box-shadow: none; max-width: none; } }

.start-show { margin: 0 0 10px; }

/* the contract drawer (from the project Details): contracts, uploads and the terms ARQVANT works to */
.ct-sec { padding: 14px 0; border-bottom: 1px solid var(--line); }
.ct-sec h3 { margin: 0 0 8px; font-size: 15px; }
.ct-sec .row-actions { margin-top: 10px; }
.ct-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ct-item { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ct-item > span:first-child { flex: 1 1 180px; min-width: 0; overflow-wrap: anywhere; }
.ct-terms { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); margin: 10px 0 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.ct-terms > div { display: contents; }
.ct-terms dt, .ct-terms dd { margin: 0; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 13.5px; overflow-wrap: anywhere; }
.ct-terms dt { color: var(--muted); background: var(--surface-2); }
.ct-terms > div:last-child dt, .ct-terms > div:last-child dd { border-bottom: 0; }
.ct-found { margin: 4px 0 0; color: var(--muted); font-style: italic; overflow-wrap: anywhere; }
.ct-found b { font-style: normal; }
.tb-contract .linkbtn { font-size: inherit; margin-inline-start: 4px; }
label.filebtn.busy { opacity: .6; pointer-events: none; }
@media (max-width: 560px) { .ct-terms { grid-template-columns: 1fr; } .ct-terms dt { border-bottom: 0; padding-bottom: 2px; } .ct-terms dd { padding-top: 2px; } }

/* phones: money tables become one card per row, so the amount and the action stay on screen (payments, variations) */
@media (max-width: 600px) {
  .table-scroll:has(> table.cards-sm) { overflow: visible; }
  table.cards-sm { min-width: 0; display: block; }
  table.cards-sm thead { display: none; }
  table.cards-sm tbody { display: block; }
  table.cards-sm tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 10px; align-items: start; padding: 12px 2px; border-bottom: 1px solid var(--line); }
  table.cards-sm td { display: block; padding: 0; border: 0; text-align: start; min-width: 0; }
  table.cards-sm td:empty { display: none; }
  table.cards-sm td:nth-child(1) { grid-column: 1; grid-row: 1; color: var(--muted); font-size: 13px; padding-top: 2px; }
  table.cards-sm td:nth-child(2) { grid-column: 2; grid-row: 1; font-weight: 600; overflow-wrap: anywhere; }
  /* the amount, top right */
  table.pay-cards td:nth-child(4), table.vo-cards td:nth-child(4) { grid-column: 3; grid-row: 1; text-align: end; font-weight: 700; white-space: nowrap; }
  /* the date under the name */
  table.cards-sm td:nth-child(3) { grid-column: 2 / 4; grid-row: 2; color: var(--muted); font-size: 13px; }
  /* status and actions under that */
  table.pay-cards td:nth-child(5), table.vo-cards td:nth-child(5) { grid-column: 2 / 4; grid-row: 3; }
  table.pay-cards td:nth-child(6) { grid-column: 2 / 4; grid-row: 4; }
  table.cards-sm td .row-actions { justify-content: flex-start; flex-wrap: wrap; }
  table.cards-sm td.r:not(:nth-child(4)) { text-align: start; }
  table.pay-cards tr.total { border-bottom: 0; border-top: 2px solid var(--rule); }
  table.pay-cards tr.total td { border: 0; }
}

/* project sections: six tabs and the setup cog (October 2026). Computers: a row along the top, the cog at the end.
   Phones: an app bar along the bottom, icon and name, all six within reach of the thumb and none hidden. */
/* fault 19 (Oct 2026): the sections sit in one bordered bar and the open one is filled, so it reads at a glance */
@media (min-width: 601px) {
  .tabs { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 4px; gap: 4px; margin-inline: 0; }
  .tabs a { border: 0; margin: 0; border-radius: 8px; padding: 8px 14px; color: var(--muted); }
  .tabs a:hover { background: var(--surface-2); color: var(--ink); }
  .tabs a[aria-current="page"] { background: var(--ink); color: var(--bg); border: 0; }
  .tabs a[aria-current="page"] .count { background: var(--bad); color: #fff; }
  .tabs a:focus-visible { outline: 2px solid var(--brass); outline-offset: 1px; }
}
.tabs .tab-ico { display: none; }
.tabs a.tab-gear { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 4px; padding-inline: 10px; }
.tabs a.tab-gear .gear-ico { display: block; }
@media (max-width: 600px) {
  .tabs { position: fixed; inset-inline: 0; bottom: 0; z-index: 35; margin: 0; overflow: visible; border-bottom: 0; border-top: 1px solid var(--line);
    background: var(--surface); padding: 2px 2px calc(2px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -6px 18px rgba(0, 0, 0, .07); }
  .tabs a { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; position: relative;
    padding: 7px 0 6px; margin: 0; border-bottom: 0; font-size: 9.5px; font-weight: 600; letter-spacing: -.015em; line-height: 1.15; text-align: center; white-space: normal; min-height: 54px; }
  .tabs a .tab-label { display: block; max-width: 100%; }                      /* whole words: Arabic names wrap at a space */
  html:not([lang="ar"]) .tabs a .tab-label { white-space: nowrap; }
  .tabs a[aria-current="page"] { color: var(--ink); background: var(--brass-soft); box-shadow: inset 0 3px 0 var(--brass); font-weight: 700; }
  .tabs a[aria-current="page"] .tab-ico { color: var(--brass); }
  .tabs .tab-ico { display: block; }
  .tabs a.tab-gear { flex: 0 0 30px; margin: 0; padding-inline: 0; }
  .tabs .count { position: absolute; top: 3px; inset-inline-start: calc(50% + 5px); margin: 0; min-width: 16px; padding: 0 4px; font-size: 10px; line-height: 16px; background: var(--bad); color: #fff; }
  .tabs a.locked .lock-ico { position: absolute; top: 6px; inset-inline-start: calc(50% + 7px); }
  body:has(nav.tabs) { padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px)); }
  body:has(nav.tabs) .toast, body:has(nav.tabs) .update-bar { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}
/* a narrow window on a computer: the programme's own scroll window ends above the app bar, so its scrollbar shows */
@media (max-width: 600px) and (pointer: fine) {
  body:has(nav.tabs) .gantt-scroll { max-height: calc(100vh - var(--topbar-h, 64px) - 88px); max-height: calc(100dvh - var(--topbar-h, 64px) - 88px - env(safe-area-inset-bottom, 0px)); }
}
@media print { .tabs { display: none !important; } }

/* ---- batch 2 (October 2026): a slim top bar on phones, the client's to-dos first, buttons a thumb can hit */
.menu-btn { display: none; }
.who-more { display: contents; }
.at-do { justify-self: end; white-space: nowrap; font-size: 13px; font-weight: 700; color: var(--accent-ink); background: var(--accent); border-radius: 8px; padding: 7px 12px; }
.at-row a:hover .at-do { filter: brightness(1.12); }
.client-todo { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 760px) { .at-row a .at-do { grid-column: 2; justify-self: start; margin-top: 2px; } }
@media (max-width: 600px) {
  /* the top bar in one line: the mark and name, the bell and the menu; everything else is in the menu */
  .topbar { flex-wrap: nowrap; justify-content: space-between; padding-block: 8px 11px; }
  .topbar .who { position: relative; flex-wrap: nowrap; gap: 6px; }
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  .who-more { display: none; }
  .topbar.menu-open .who-more { display: flex; flex-direction: column; align-items: stretch; gap: 8px; position: absolute; top: calc(100% + 8px); inset-inline-end: 0; z-index: 30;
    min-width: 220px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
  .topbar.menu-open .who-more > * { width: 100%; justify-content: center; }
  .topbar.menu-open .who-more .who-name { display: block; text-align: center; padding: 4px 0; }
  .topbar.menu-open .who-more .view-as { justify-content: center; }
  /* the project facts sit behind Details; the measures on the overview carry the dates */
  .titleblock .tb-grid { display: none; }
  .titleblock.tb-open .tb-grid { display: grid; }
  /* buttons a thumb can hit on site */
  .btn.small, select:not([multiple]) { min-height: 36px; }
  .btn.small { padding-inline: 12px; }
  .chip { font-size: 12.5px; }
}
.who [data-signout] { order: 10; }                 /* sign out last, on a computer and in the phone menu */
.who .menu-btn { order: 11; }

/* "More": the less-used actions. A computer shows them in the row (the menu is open and its button hidden); a phone
   shows a More button and a small pop-up list, with Delete all apart at the bottom */
.more-menu { display: contents; }
.more-menu > summary { list-style: none; cursor: pointer; }
.more-menu > summary::-webkit-details-marker { display: none; }
.more-pop { display: contents; }
.more-sep { width: 14px; }
@media (min-width: 601px) { .more-menu > summary { display: none; } }
@media (max-width: 600px) {
  .more-menu { display: inline-block; position: relative; }
  .more-menu[open] .more-pop { display: flex; flex-direction: column; align-items: stretch; gap: 6px; position: absolute; top: calc(100% + 6px); inset-inline-end: 0; z-index: 25;
    min-width: 190px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
  .more-menu[open] .more-pop .btn { justify-content: flex-start; }
  .more-sep { width: auto; height: 1px; background: var(--line); margin: 4px 0; }
}

/* Today on site: on a phone each card is short (activity, %, plan) until "Update progress" opens its controls */
.td-more > summary { list-style: none; cursor: pointer; }
.td-more > summary::-webkit-details-marker { display: none; }
.td-more .td-body { display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 601px) { .td-more > summary { display: none; } }
@media (max-width: 600px) {
  .td-more > summary { width: 100%; min-height: 42px; }
  .td-more[open] > summary { display: none; }
  .td-more .td-foot button[type=submit] { min-height: 42px; flex: 1 1 auto; }
}

/* long help text: one line and ⓘ to open it */
.clamp1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.help-more { border: 0; background: none; padding: 0 4px; margin-inline-start: 2px; color: var(--muted); font-size: 15px; line-height: 1; cursor: pointer; vertical-align: middle; min-height: 0 !important; }
.help-more:hover, .help-more[aria-expanded="true"] { color: var(--ink); }
.card-head > div:has(> .clamp1), .card-head > div:has(> .help-more) { min-width: 0; }

/* the top bar at every width (October 2026): the brand on the left; the bell, the language and the menu on the right.
   View as, plan, name and sign out are in the menu */
.topbar { flex-wrap: nowrap; justify-content: space-between; }
.topbar .who { position: relative; flex-wrap: nowrap; gap: 6px; }
.menu-btn { display: inline-flex; align-items: center; justify-content: center; }
.who-more { display: none; }
.topbar.menu-open .who-more { display: flex; flex-direction: column; align-items: stretch; gap: 8px; position: absolute; top: calc(100% + 8px); inset-inline-end: 0; z-index: 30;
  min-width: 240px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.topbar.menu-open .who-more > * { width: 100%; justify-content: center; }
.topbar.menu-open .who-more .who-name { display: block; text-align: center; padding: 4px 0; }
.topbar.menu-open .who-more .view-as { justify-content: center; flex-wrap: wrap; }
.topbar.menu-open .who-more .lbl-long { display: inline; } .topbar.menu-open .who-more .lbl-short { display: none; }

/* the brand never runs under the bell: the right-hand group keeps its size, the brand takes what is left and
   shrinks (smaller mark and name on a phone) instead of overlapping */
.topbar { column-gap: 12px; }
.topbar .who { flex: none; }
.topbar .brand { flex: 1 1 0; overflow: hidden; }
.topbar .brand-name { flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: clip; }
@media (max-width: 600px) {
  .topbar { column-gap: 14px; }
  .topbar .brand { gap: 8px; }
  .topbar .brand .logo { width: 26px; height: 26px; }
  .topbar .brand .co-logo.small, .topbar .brand .brand-co { display: none; }
}
@media (max-width: 400px) {
  .topbar .brand-name { font-size: 13px; letter-spacing: .08em; }
  .topbar .brand .logo { width: 24px; height: 24px; }
  .topbar .who { gap: 4px; }
}
@media (max-width: 340px) {
  .topbar .brand-name { font-size: 11.5px; letter-spacing: .05em; }
}

/* reports: the programme's Gantt pages, fact lists, tables and the report switch (October 2026) */
.rep-switch { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.rep-gantt-pages { display: flex; flex-direction: column; gap: 10px; }
.rep-gantt-img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.rep-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0; margin: 0 0 12px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.rep-facts > div { padding: 9px 12px; border-bottom: 1px solid var(--line); border-inline-end: 1px solid var(--line); }
.rep-facts dt { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.rep-facts dd { margin: 3px 0 0; font-size: 14px; }
.rep-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 4px 0 12px; }
.rep-table th { text-align: start; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 6px 8px; border-bottom: 1.5px solid var(--rule); white-space: nowrap; }
.rep-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.rep-table .r { text-align: end; }
.report .pack-sec .sub-h { margin: 14px 0 6px; }
.stage-report .note { margin: 12px 0; }
@media print {
  .rep-gantt-img { break-inside: avoid; border-color: #ccc; }
  .rep-table, .rep-facts { break-inside: auto; }
  .rep-table tr, .rep-facts > div { break-inside: avoid; }
  .rep-gantt-sec { break-inside: avoid; }
}
/* the two-week look-ahead: the date column says whether it is a start or a finish */
.la-row { grid-template-columns: 74px minmax(0, 1fr); }
.la-row .when small { display: block; font-family: var(--f-body, inherit); font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }

/* the BoQ linked to the programme */
.boq-link-sum { margin: 0 0 10px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2, var(--bg)); }
.drawer:has(.lk-form) { width: min(860px, 100%); }
.lk-form { gap: 12px; }
.lk-table td { vertical-align: middle; }
.lk-table select { width: 100%; min-width: 180px; max-width: 340px; }
.lk-table .check { white-space: nowrap; margin: 0; }
.lk-table td.r { white-space: nowrap; }
.lk-table tr.lk-sug { background: color-mix(in srgb, var(--brass, #b08d57) 10%, transparent); }
.lk-table tr.lk-none select { color: var(--muted); }
@media (max-width: 640px) {
  .lk-table thead { display: none; }
  .lk-table tr[data-lk] { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .lk-table tr[data-lk] td { border: 0; padding: 0; }
  .lk-table tr[data-lk] td:first-child { grid-column: 1 / -1; }
  .lk-table select { max-width: none; min-width: 0; }
}

/* Back (fault 18): first thing in the top bar on every page below the project list */
.back-btn { display: inline-flex; align-items: center; gap: 4px; padding-inline: 8px 12px; font-weight: 600; flex: 0 0 auto; }
.back-btn .back-arrow { font-size: 20px; line-height: 1; margin-top: -2px; }
html[dir="rtl"] .back-btn .back-arrow { transform: scaleX(-1); }
@media (max-width: 420px) { .back-btn .back-lbl { display: none; } .back-btn { padding-inline: 8px; } }
