/* Gibab Blueprint — the interface shell. Light, system and dark themes; mirrors for Arabic. */

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --ink: #1a2733;
  --muted: #5b6f80;
  --line: #d5dde4;
  --accent: #0f7c9c;
  --accent-ink: #ffffff;
  --warn: #b4632a;
  --danger: #b3261e;
  --ok: #2e7d4f;
  --focus: #1b6fd1;
  --radius: 8px;
  --font: "Segoe UI", "Noto Sans", "Noto Sans Arabic", Tahoma, system-ui, sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0f161c;
  --surface: #17212a;
  --surface-2: #1f2b36;
  --ink: #e6edf2;
  --muted: #9fb2c1;
  --line: #2c3a46;
  --accent: #3fb0d0;
  --accent-ink: #0f161c;
  --warn: #e0a06a;
  --danger: #f2877f;
  --ok: #7cc79b;
  --focus: #7fb4ff;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #0f161c;
    --surface: #17212a;
    --surface-2: #1f2b36;
    --ink: #e6edf2;
    --muted: #9fb2c1;
    --line: #2c3a46;
    --accent: #3fb0d0;
    --accent-ink: #0f161c;
    --warn: #e0a06a;
    --danger: #f2877f;
    --ok: #7cc79b;
    --focus: #7fb4ff;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); }
h1, h2, h3 { margin: 0 0 8px; font-weight: 600; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.error { color: var(--danger); margin: 8px 0; }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* a filter with its label above and buttons beside it: their boxes level along the bottom, one height (2026-11-22) */
.row.filter-controls { align-items: flex-end; }
.row.filter-controls > .row { align-items: stretch; }
.filter-controls select, .filter-controls button.chip { box-sizing: border-box; height: 34px; line-height: 1.2; }

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border-radius: var(--radius); }
button.primary { background: var(--accent); color: var(--accent-ink); border: 0; padding: 7px 14px; font-weight: 600; }
button.primary:disabled { opacity: .5; cursor: not-allowed; }
button.chip { background: var(--surface-2); border: 1px solid var(--line); padding: 4px 10px; }
button.link { background: none; border: 0; padding: 4px 0; color: var(--accent); text-align: start; }
button.danger { background: none; border: 1px solid var(--danger); color: var(--danger); padding: 3px 10px; }
input, select { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 8px; min-width: 0; }

.brand { font-weight: 700; letter-spacing: 1.5px; color: var(--accent); white-space: nowrap; }
[dir="rtl"] .brand { letter-spacing: 0; }
.programme-logo { height: 46px; width: auto; display: block; background: #fff; padding: 4px 10px; border-radius: 6px; }
.programme-logo[hidden] { display: none; }
.signin-logo { height: 56px; margin: 0 auto 10px; }
/* the programme partner's logo beside the programme's (2026-10-21): wide and low, on the same white plate */
.partner-logo { height: 46px; width: auto; max-width: 220px; object-fit: contain; display: block; background: #fff; padding: 9px 10px; border-radius: 6px; }
.partner-logo[hidden] { display: none; }
.partner-logo.signin-logo { height: 42px; padding: 7px 10px; margin-top: -4px; }
@media (max-width: 860px) { .topbar .partner-logo { display: none; } }
@media (max-width: 560px) { .topbar .programme-logo { display: none; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
/* a badge says a state: flat and square-cornered, never shaped like the pill a button is (the interface review) */
.badge { font-size: 12px; background: var(--surface-2); border: 0; border-radius: 4px; padding: 1px 8px; color: var(--muted); }
.badge:empty { display: none; }

/* sign-in */
.signin { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.signin-card { width: min(380px, 100%); display: grid; gap: 12px; }
.field { display: grid; gap: 4px; }
.field > span { color: var(--muted); font-size: 13px; }

/* the shell */
.shell { height: 100%; display: grid; grid-template-rows: auto auto 1fr auto; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.search { width: 170px; }
/* on a phone two rows: the name, the language and the menu; then the project, the area and the search sharing the
   width (four rows before, the interface review of 2026-10-22) */
@media (max-width: 600px) {
  .topbar > .brand { order: 0; }
  .topbar > .spacer { order: 1; }
  .topbar > [data-action="toggle-language"] { order: 2; }
  .topbar > .user-menu { order: 3; }
  .topbar > label.compact, .topbar > .search { order: 4; flex: 1 1 28%; min-width: 0; width: auto; }
  .topbar > label.compact select { width: 100%; min-width: 0; }
  .topbar > label.compact:has(select[hidden]) { display: none; }
}
.user-menu { position: relative; }
.user-menu summary { cursor: pointer; list-style: none; padding: 4px 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu .menu { position: absolute; inset-inline-end: 0; top: calc(100% + 4px); z-index: 1000; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; display: grid; gap: 6px; min-width: 220px; max-width: calc(100vw - 16px); box-shadow: 0 6px 20px rgba(0,0,0,.15); }
/* On a phone the top bar wraps and the menu's button can sit anywhere on its line: the menu then spans the window,
   8 px in from either side, just under the button (fixed with no top keeps it where it falls), in either direction. */
@media (max-width: 600px) {
  .user-menu .menu { position: fixed; top: auto; inset-inline: 8px; min-width: 0; max-width: none; margin-top: 4px; }
}

.tabs { display: flex; gap: 2px; padding: 0 10px; background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; border-radius: 0; padding: 9px 12px; color: var(--muted); white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

/* the assistant's width is the reader's (dragged by its edge, kept in this browser); never more than 70 % of the
   window, and the page always keeps 360 px */
.body { display: grid; min-height: 0;
  grid-template-columns: minmax(0, 1fr) clamp(260px, var(--assistant-width, 320px), min(70%, calc(100% - 360px))); }
.body.assistant-collapsed { grid-template-columns: 1fr 44px; }
.body.no-assistant, .body.no-assistant.assistant-collapsed { grid-template-columns: 1fr; }
.main { overflow: auto; padding: 16px; display: grid; gap: 16px; align-content: start; min-width: 0; }
.main > * { min-width: 0; } /* a card may be narrower than its table: the table scrolls inside it (.table-wrap) */
.assistant { position: relative; border-inline-start: 1px solid var(--line); background: var(--surface); display: grid; grid-template-rows: auto auto 1fr; min-height: 0; }
/* the edge the assistant is sized by: a strip on its inner border, wider than it looks so it is easy to take, and
   inside the panel so it never covers the page's own scrollbar */
.assistant-resizer { position: absolute; top: 0; bottom: 0; inset-inline-start: -1px; width: 7px; cursor: col-resize; z-index: 5;
  touch-action: none; }
.assistant-resizer:hover, .assistant-resizer:focus-visible, .body.resizing .assistant-resizer { outline: none;
  box-shadow: inset 3px 0 0 var(--accent); }
[dir="rtl"] .assistant-resizer:hover, [dir="rtl"] .assistant-resizer:focus-visible,
[dir="rtl"] .body.resizing .assistant-resizer { box-shadow: inset -3px 0 0 var(--accent); }
.body.resizing { cursor: col-resize; user-select: none; }
.body.resizing .main { pointer-events: none; }
.body.assistant-collapsed .assistant-resizer, .body.no-assistant .assistant-resizer { display: none; }
.assistant-head { grid-row: 1; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
/* what a question is about, on a row of its own under the head: squeezed into the head's row it wrapped a Well ID
   into a tall badge and pushed the whole panel past the edge of the window */
.assistant-context { grid-row: 2; padding: 6px 10px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.assistant-context:empty, .body.assistant-collapsed .assistant-context { display: none; }
.assistant-body { grid-row: 3; display: grid; grid-template-rows: 1fr auto; min-height: 0; }
.assistant-log { overflow: auto; padding: 10px; display: grid; gap: 8px; align-content: start; }
.assistant-form { display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--line); }
.turn { display: grid; gap: 4px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.turn p { margin: 0; }
.question { font-weight: 600; }
.answer { white-space: pre-wrap; }
.small { font-size: 12px; }
.assistant-form input { flex: 1; }
.body.assistant-collapsed .assistant-body, .body.assistant-collapsed .assistant-head strong { display: none; }
/* folded to its 44 px column, the panel keeps only its unfold button: "New conversation" there pushed the page past
   the window's edge */
.body.assistant-collapsed [data-action="new-conversation"] { display: none; }
.body.assistant-collapsed .assistant-head { padding: 8px 4px; justify-content: center; min-width: 0; }
.body.assistant-collapsed [data-action="toggle-assistant"] { padding-inline: 6px; min-width: 0; }
.body.assistant-collapsed .assistant-head .spacer { display: none; }

.statusline { padding: 4px 14px; font-size: 12px; color: var(--muted); background: var(--surface); border-top: 1px solid var(--line); }
/* nothing to say: no line at all (the jobs' count is only for those who run the jobs) */
.statusline.idle:empty { display: none; }

/* content */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.empty { padding: 24px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; font-size: 15px; }
.skeleton { height: 14px; border-radius: 4px; background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; margin: 8px 0; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; white-space: nowrap; }
tr.inactive td { color: var(--muted); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; align-items: end; }

.map { height: 62vh; min-height: 360px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); }
/* the Map tab's map a little below its controls: its edge and focus ring ran over the picker (the owner, 2026-10-22) */
.map-tab { margin-top: 12px; }
.export-format, .download-format { max-width: 260px; }
/* what only the engineer and the auditor look for, folded under its own heading */
details.technical { margin-top: 8px; }
/* the survey form's sections: the same column widths in each, so they line up one under another */
.form-fields table { table-layout: fixed; width: 100%; }
.form-fields th:nth-child(1) { width: 60%; }
.form-fields th:nth-child(2) { width: 25%; }
.form-fields td { overflow-wrap: anywhere; }
/* the audit trail's filters: one row that wraps */
.audit-filters { flex-wrap: wrap; align-items: end; gap: 8px 12px; margin: 8px 0; }
.audit-filters input[type=search] { width: 160px; }
/* a package held from its seal: said as a warning, the item a click away */
button.link.warn { color: var(--warn); }
/* the lists as a card a row on a phone, each field named beside it (cardTable) */
@media (max-width: 600px) {
  .table-wrap.cards { overflow: visible; }
  .table-wrap.cards table, .table-wrap.cards tbody, .table-wrap.cards tr { display: block; width: 100%; }
  .table-wrap.cards thead { display: none; }
  .table-wrap.cards tr { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 10px;
    background: var(--surface); }
  .table-wrap.cards tr.selected { border-color: var(--accent); }
  /* a block with its name in the room kept beside it: whatever the cell holds (a badge, a word and a time, a link)
     flows on as it does in a table -- a grid made each piece a row of its own (the review of 2026-10-23) */
  .table-wrap.cards td { display: block; position: relative; padding: 3px 0; padding-inline-start: 38%; min-height: 1.5em;
    border: 0; white-space: normal; }
  .table-wrap.cards td::before { content: attr(data-label); position: absolute; inset-inline-start: 0; top: 4px; width: 35%;
    color: var(--muted); font-size: 12px; }
  .table-wrap.cards td[data-label=""] { padding-inline-start: 0; }
  .table-wrap.cards td[data-label=""]::before { content: none; }
  /* a list whose head holds a box ("tick the page"): that box, named, kept above the cards */
  .table-wrap.cards thead:has(input) { display: block; }
  .table-wrap.cards thead:has(input) tr { display: block; border: 0; padding: 0; margin: 0 0 6px; background: none; }
  .table-wrap.cards thead:has(input) th:not(:has(input)) { display: none; }
  .table-wrap.cards thead:has(input) th { display: flex; gap: 8px; align-items: center; border: 0; padding: 0; }
  .table-wrap.cards thead:has(input) th::after { content: attr(data-words); font-weight: normal; font-size: 13px; }
}
td .badge + .badge { margin-inline-start: 4px; }
@media (max-width: 600px) { .review-list td.nowrap { white-space: normal; } }
details.technical > summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--muted); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-inline-end: 4px; vertical-align: middle; }

/* deliveries and review */
textarea { font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 8px; width: 100%; resize: vertical; }
button.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
tr.selected td { background: var(--surface-2); }
/* a previous survey withdrawn: kept and listed, greyed, used nowhere */
tr.withdrawn td { color: var(--muted); }
tr.withdrawn td .withdrawn-note { color: var(--ink); }
.queue { margin: 0; padding-inline-start: 18px; display: grid; gap: 6px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-bottom: 12px; }
.photos figure { margin: 0; display: grid; gap: 4px; }
.photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); }
.photos figcaption { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.files { margin: 0 0 12px; padding-inline-start: 18px; font-size: 13px; }
.decision { display: grid; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.choices { display: grid; gap: 6px; border: 0; margin: 0; padding: 0; }
.choice { display: flex; gap: 8px; align-items: center; }
.badge.status-accepted { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.badge.status-partial, .badge.status-quarantined, .badge.status-checking { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.badge.status-rejected { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }

/* well record */
.drawing { overflow: auto; margin-bottom: 8px; }
.drawing img { display: block; width: 100%; max-width: 900px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.timeline { margin: 0; padding-inline-start: 18px; display: grid; gap: 4px; font-size: 13px; }
.reasons { margin: 0; padding-inline-start: 16px; font-size: 12px; }
.blockers { border: 1px solid var(--warn); border-radius: var(--radius); padding: 8px 12px; margin: 8px 0; color: var(--warn); }
.blockers ul { margin: 4px 0 0; padding-inline-start: 18px; }

/* packages and seal */
.badge.pkg-in_review { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.badge.pkg-sealed { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.badge.pkg-rejected { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }
.badge.warn { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
code.hash { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; overflow-wrap: anywhere; color: var(--muted); }
table.kv th { width: 30%; font-weight: 400; font-size: 13px; }
.seal-panel { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.changes { margin: 0; padding-inline-start: 18px; }
.statement { margin: 4px 0; padding: 10px 14px; border-inline-start: 3px solid var(--accent); background: var(--surface-2); border-radius: var(--radius); }

/* the 3D view and the document view */
.viewer3d { display: grid; gap: 8px; margin-bottom: 8px; }
.viewer3d-stage { height: min(62vh, 560px); min-height: 320px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface-2); touch-action: none; }
.viewer3d-stage canvas { display: block; width: 100%; height: 100%; }
.pdf-viewer { display: grid; gap: 8px; min-height: 0; }
.pdf-toolbar { background: var(--surface); padding: 2px 0; }
.pdf-pages { overflow: auto; max-height: 72vh; display: grid; justify-content: center; align-content: start; gap: 12px; padding: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); }
.pdf-page { position: relative; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .2); }
.pdf-page canvas { display: block; width: 100%; height: 100%; }
.pdf-overlay { position: absolute; inset: 0; }
.pdf-viewer.placing .pdf-overlay { cursor: crosshair; outline: 2px dashed var(--accent); outline-offset: -2px; }
.pdf-pin { position: absolute; transform: translate(-50%, -100%); min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px 12px 12px 2px; border: 2px solid #fff; background: #e07a3a; color: #fff; font-size: 12px; font-weight: 700; line-height: 20px; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
.pdf-pin.resolved { background: #2e7d4f; }
.pdf-pin.draft { background: var(--accent); pointer-events: none; }
dialog.viewer-dialog { width: min(1400px, 96vw); height: 92vh; max-height: 92vh; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); }
dialog.viewer-dialog::backdrop { background: rgba(0, 0, 0, .45); }
.viewer-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: auto minmax(0, 1fr); height: 100%; }
.viewer-head { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.viewer-body { padding: 8px 12px; min-height: 0; display: grid; }
.viewer-body .pdf-viewer { grid-template-rows: auto minmax(0, 1fr); height: 100%; }
.viewer-body .pdf-pages { max-height: none; }
.viewer-side { border-inline-start: 1px solid var(--line); padding: 8px 12px; overflow: auto; display: grid; gap: 10px; align-content: start; }

/* notes and comments */
.notes { display: grid; gap: 10px; }
.note { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: grid; gap: 6px; background: var(--surface); }
.note.resolved { background: var(--surface-2); }
.note.focused { outline: 2px solid var(--accent); outline-offset: 1px; }
.note-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.note-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.note-replies { display: grid; gap: 8px; margin: 0; padding-inline-start: 12px; border-inline-start: 2px solid var(--line); }
.note-form { display: grid; gap: 6px; }
.drawing-frame { position: relative; width: 100%; max-width: 900px; }
.drawing-pins { position: absolute; inset: 0; }
.drawing-frame.placing .drawing-pins { cursor: crosshair; outline: 2px dashed var(--accent); outline-offset: -2px; }
.drawing-tools { margin: 4px 0; }
.drawing-viewport { position: relative; width: 100%; max-width: 1200px; aspect-ratio: 594 / 420; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); touch-action: none; }
.drawing-viewport:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.drawing-viewport.zoomed { cursor: grab; }
.drawing-viewport.dragging { cursor: grabbing; }
.drawing-viewport .drawing-frame { max-width: none; width: 100%; }
.drawing-viewport .drawing-frame img { max-width: none; border: 0; border-radius: 0; }
.drawing:fullscreen { background: var(--surface); padding: 12px; overflow: auto; }
.drawing:fullscreen .drawing-viewport { max-width: none; aspect-ratio: auto; height: calc(100vh - 120px); }
.pdf-pin.focused { outline: 3px solid var(--focus); outline-offset: 2px; }
.badge.note-open { color: var(--warn); border-color: var(--warn); }
.badge.note-resolved { color: var(--ok); border-color: var(--ok); }

@media (max-width: 900px) {
  .viewer-layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr) auto; }
  .viewer-side { border-inline-start: 0; border-top: 1px solid var(--line); max-height: 38vh; }
}

@media (max-width: 900px) {
  .body, .body.assistant-collapsed { grid-template-columns: 1fr; }
  .assistant { border-inline-start: 0; border-top: 1px solid var(--line); }
  .assistant-resizer { display: none; }
}

/* the Rules tab */
.rule-form { margin: 8px 0; }
.rule-form > summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; }
.rule-fields { display: grid; gap: 10px; margin-bottom: 10px; }
.rule-fields h4 { margin: 8px 0 0; }
.rule-fields input[type="number"] { width: 7em; }
.rule-bands { display: grid; gap: 6px; margin-bottom: 6px; }
ul.plain { margin: 0; padding-inline-start: 18px; }
.badge.rule-approved { color: var(--ok); border-color: var(--ok); }
.badge.rule-draft { color: var(--warn); border-color: var(--warn); }
.badge.rule-rejected { color: var(--danger); border-color: var(--danger); }

/* long lists: where a page stands */
.pager { margin: 4px 0 8px; }

/* the well page: flowmeter recordings */
.flow-recordings { display: grid; gap: 8px; margin: 8px 0; }
.flow-recordings table { max-width: 560px; }

/* the Field tab */
.field-map { height: 56vh; min-height: 320px; }
.swatch.base-swatch { background: #ffffff; border: 3px solid #1a2733; width: 12px; height: 12px; }
.swatch.team-swatch { background: var(--accent); border: 3px solid #1a2733; width: 14px; height: 14px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 8px 0; }
.kpi { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.kpi-value { font-size: 20px; font-weight: 600; }
.kpi-label { font-size: 12px; color: var(--muted); }
.kpi.warn .kpi-value { color: var(--warn); }
.plan-form { display: grid; gap: 12px; }
.plan-days { gap: 12px; }
.replay { margin: 4px 0 8px; }
.replay input[type="range"] { flex: 1 1 220px; min-width: 0; }
td .row { flex-wrap: wrap; }
.leaflet-tooltip { font: 12px/1.35 var(--font); }
/* the base-map switch (the layers button) on every map: each name in its own direction, however often Leaflet redraws
   the list -- the name's own span only, so the radio stays at the line's start in Arabic */
.leaflet-control-layers-list label > span > span { unicode-bidi: plaintext; }
.nowrap { white-space: nowrap; }

/* Survey status: the authority's five words, an ordered ramp from not visited to approved (words always beside it) */
.survey-chip { display: inline-block; font-size: 12px; border-radius: 999px; padding: 1px 8px; white-space: nowrap; border: 1px solid var(--line); }
.survey-pending { background: #e3e8ed; color: #2b3a47; }
.survey-in_progress { background: #b9d7ea; color: #133447; }
.survey-submitted { background: #7fb3d6; color: #0d2433; }
.survey-reviewed { background: #3a86b8; color: #ffffff; }
.survey-approved { background: #1b5680; color: #ffffff; }
.status-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 2px; background: var(--surface-2); margin: 10px 0 6px; }
.status-seg { display: block; min-width: 3px; }
.legend-item { display: inline-flex; align-items: center; gap: 4px; margin-inline-end: 10px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.week-cell { display: flex; align-items: center; gap: 6px; min-width: 120px; }
.week-bar { display: inline-block; height: 8px; border-radius: 4px; min-width: 2px; }
.week-bar.received { background: var(--accent); }
.week-bar.sealed { background: var(--ok); }

/* Re-visits */
.notice.warn-box { border: 1px solid var(--warn); border-radius: var(--radius); padding: 8px 12px; background: var(--surface-2); }
.notice.warn-box p { margin: 4px 0 0; }
.notice.questions ul { margin: 6px 0 0; padding-inline-start: 18px; }
.notice.questions li { margin-bottom: 4px; }
.checklist li.info { color: var(--muted); }
.engineer-key { margin-top: 12px; }
.badge.live-badge { background: #c62828; color: #fff; }
.live-photos { display: flex; flex-wrap: wrap; gap: 8px; }
.live-photos figure { margin: 0; width: 160px; }
.live-photos img { width: 160px; height: 120px; object-fit: cover; border-radius: 6px; display: block; }
.live-visit .checklist li.warn { color: var(--warn); }
.engineer-key details summary { cursor: pointer; }
details.revisit { margin-bottom: 10px; }
details.revisit > summary { cursor: pointer; color: var(--accent); }
.revisit-form { display: grid; gap: 6px; margin-top: 6px; }
.revisit-form textarea { width: 100%; }

/* The survey form editor (ADR-013) */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; align-items: end; margin: 8px 0; }
details.form-add { margin: 10px 0; }
details.form-add > summary { cursor: pointer; color: var(--accent); }
.form-decide { display: grid; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }

/* A dashboard number that opens its wells */
button.kpi-link { text-align: start; cursor: pointer; font: inherit; color: inherit; }
button.kpi-link:hover { border-color: var(--accent); background: var(--accent-soft, var(--surface)); }
/* a tile that opens its wells says so: an arrow after its words */
button.kpi-link .kpi-label::after { content: " ›"; color: var(--accent); }
[dir="rtl"] button.kpi-link .kpi-label::after { content: " ‹"; }
#print-sheet button.kpi-link .kpi-label::after { content: none; }

/* A review item given to a person */
.row.assignee { margin: 6px 0 10px; }
/* the wells chosen for the exports, and the consolidated report (the comment sheet, item 9) */
.export-block { display: grid; gap: 6px; }
/* a heading row holding the export: everything level with the export's own line, not centred on the block with its
   "Choose the wells" beneath (the owner, 2026-11-22: Print sat lower than Export) */
@media screen {
  .row:has(> .export-block) { align-items: flex-start; }
  .row:has(> .export-block) > :not(.export-block) { min-height: 34px; display: inline-flex; align-items: center; gap: 8px; }
  .row:has(> .export-block) > h2 { margin-block: 0; }
  .export-row select, .export-row button.chip, .row:has(> .export-block) > button.chip,
  .row:has(> .export-block) > .row button.chip { box-sizing: border-box; height: 34px; }
}
.export-chosen { color: var(--accent); }
.export-status:empty { display: none; }
.export-status { display: grid; gap: 2px; overflow-wrap: anywhere; }
.export-line { margin: 0; }
.export-line.ok { color: var(--ok); }
.export-line.error { color: var(--danger); }
.export-line.muted { color: var(--muted); }
.export-line.warn { color: var(--warn); }
.export-choose > summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.export-choose[open] { border: 1px solid var(--line, #d7dee4); border-radius: 8px; padding: 8px 12px 10px; }
.export-fields { align-items: end; }
.export-fields input { max-width: 220px; }
.export-fields select { max-width: 340px; }
.export-report { margin-top: 8px; border-top: 1px dashed var(--line, #d7dee4); padding-top: 8px; }
.export-report h4 { margin: 0 0 2px; font-size: 14px; }

/* An administrator's new password for someone, in the users table */
details.inline-reset { display: inline-block; }
details.inline-reset > summary { cursor: pointer; color: var(--accent); }
details.inline-reset input { width: 12rem; }

/* Round 5: a parameter that does not apply to the chosen piping template; the codes behind the words (Details) */
.field.off { opacity: 0.45; }
.detail-code { margin-inline-start: 0.4em; font-size: 0.8em; }

/* A previous survey's columns matched by a person (the owner, 2026-10-16): each column's use, unit and values. On a
   phone each column is a block of its own -- heading, samples, "Use as", unit -- so nothing scrolls sideways. */
.pm select { max-width: 100%; }
.pm-columns select.pm-use { min-width: 12rem; }
.pm-columns tr.pm-left-out td:first-child, .pm-columns tr.pm-left-out td:nth-child(2) { color: var(--muted); }
.pm-values, .pm-fed { display: grid; gap: 6px; }
.pm-values select { width: 100%; min-width: 7rem; } /* the long "not matched" choice must not widen the table */
.pm-values h5, .pm-save h5 { margin: 8px 0 0; }
.pm-list { margin: 0; padding-inline-start: 1.2em; max-height: 16rem; overflow: auto; }
.pm-save > summary { cursor: pointer; color: var(--accent); }
@media (max-width: 600px) {
  .pm-columns thead { display: none; }
  .pm-columns table, .pm-columns tbody, .pm-columns tr, .pm-columns td { display: block; width: 100%; }
  .pm-columns tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  .pm-columns td { border: 0; padding: 2px 0; }
  .pm-columns td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font-size: 12px; }
  .pm-columns td:first-child::before { display: none; }
  .pm-columns td.pm-no-unit { display: none; }
  .pm-columns select, .pm-columns select.pm-use { width: 100%; min-width: 0; }
}
details.demo-unit { margin-top: 16px; }
details.demo-unit > summary { cursor: pointer; color: var(--muted, inherit); font-size: 0.9em; }
details.demo-unit form.decision { margin-top: 12px; }
details.demo-unit label.choice { display: flex; gap: 8px; align-items: baseline; margin: 6px 0; }

/* ── printing a map (app.js printMap) ─────────────────────────────────── */
.print-button { white-space: nowrap; }
.print-dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; max-width: min(520px, 92vw); }
.print-dialog .stack { display: grid; gap: 12px; }
#print-sheet { position: fixed; left: -100000px; top: 0; background: #fff; color: #111; font-family: inherit; }
/* a chart drawn again in the light colours for its printed picture, off the page */
.print-chart-draw { position: fixed; left: -100000px; top: 0; }
#print-sheet .print-head { display: flex; gap: 14px; align-items: center; border-bottom: 2px solid #0f7c9c; padding-bottom: 6px; margin-bottom: 8px; }
#print-sheet .print-head img { height: 44px; width: auto; }
#print-sheet .print-brand { margin: 0; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: #0f7c9c; font-weight: 700; }
#print-sheet h1 { margin: 2px 0; font-size: 20px; }
#print-sheet .print-sub { margin: 0; font-size: 12px; color: #444; }
#print-sheet .print-map { position: relative; border: 1px solid #888; }
#print-sheet .print-map .map { border-radius: 0; border: 0; min-height: 0; }
#print-sheet .print-north { position: absolute; top: 8px; right: 8px; z-index: 900; background: rgba(255,255,255,.9);
  border: 1px solid #666; border-radius: 4px; padding: 2px 6px; text-align: center; line-height: 1; font-size: 11px; }
#print-sheet .print-north b { display: block; font-size: 16px; color: #111; }
#print-sheet .print-legend { margin-top: 6px; font-size: 11px; }
#print-sheet .print-legend .legend { color: #333; }
#print-sheet .print-foot { margin-top: 4px; font-size: 10px; color: #555; }
#print-sheet .print-list { break-before: page; font-size: 11px; }
#print-sheet .print-list select, #print-sheet .print-list button:not(.link) { display: none; }
#print-sheet .print-list button.link { border: 0; background: none; padding: 0; color: #111; font: inherit; text-decoration: none; }
@page bp-A4-landscape { size: A4 landscape; margin: 10mm; }
@page bp-A4-portrait { size: A4 portrait; margin: 10mm; }
@page bp-A3-landscape { size: A3 landscape; margin: 10mm; }
@page bp-A3-portrait { size: A3 portrait; margin: 10mm; }
#print-sheet.page-A4-landscape { page: bp-A4-landscape; }
#print-sheet.page-A4-portrait { page: bp-A4-portrait; }
#print-sheet.page-A3-landscape { page: bp-A3-landscape; }
#print-sheet.page-A3-portrait { page: bp-A3-portrait; }
#print-sheet .leaflet-control-zoom, #print-sheet .leaflet-control-layers { display: none; }
/* a page printed (the comment sheet, item 3): its cards as on the screen, on white, without what only a screen uses */
/* the sheet is light whatever the screen's theme: the colour words redefined on it */
#print-sheet.print-page { --ink: #1a2733; --muted: #4a5864; --line: #c9d4de; --surface: #ffffff; --surface-2: #f2f5f7;
  --bg: #ffffff; color-scheme: light; background: #fff; color: #111; }
#print-sheet .print-content { color: #111; }
#print-sheet .print-content .card { background: #fff; color: #111; box-shadow: none; border: 1px solid #c9d4de; }
#print-sheet .print-content .kpi, #print-sheet .print-content tr, #print-sheet .print-content h2,
#print-sheet .print-content h3, #print-sheet .print-content img { break-inside: avoid; }
#print-sheet .print-content h2, #print-sheet .print-content h3 { break-after: avoid; }
#print-sheet .print-content button:not(.link):not(.kpi-link), #print-sheet .print-content input,
#print-sheet .print-content select, #print-sheet .print-content textarea,
#print-sheet .print-content [role="alert"] { display: none !important; }
#print-sheet .print-content button.link { border: 0; background: none; padding: 0; color: inherit; font: inherit;
  text-decoration: none; text-align: start; }
#print-sheet .print-content button.kpi-link { font: inherit; text-align: start; }
#print-sheet .print-content .kpi { background: #f2f5f7; color: #111; border: 1px solid #c9d4de; }
#print-sheet .print-content .drawing-frame { width: 100% !important; }
/* the dashboards' cards one under another on paper, each chart within its card */
#print-sheet .print-content .dash-grid { display: block; }
#print-sheet .print-content .dash-grid > * { height: auto; margin: 0 0 4mm; break-inside: avoid; }
#print-sheet .print-content img.print-chart { max-height: 95mm; object-fit: contain; }
#print-sheet .print-content summary { display: block !important; font-weight: 600; list-style: none; }
#print-sheet.print-page { --accent: #0f7c9c; --accent-soft: #e3f1f5; --ok: #2e7d4f; --warn: #a86412; --danger: #b3261e; }
@media print {
  #print-sheet .print-content * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
ol.steps strong { overflow-wrap: anywhere; }
#print-sheet .print-content img.print-chart { width: 100%; height: auto; }
#print-sheet .print-content table { font-size: 11px; }
/* the team leader's steps on Home (the comment sheet, item 10) */
ol.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
ol.steps li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; }
ol.steps .step-number { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  background: var(--accent); color: #fff; }
ol.steps li.done .step-number { background: var(--ok, #2e7d4f); }
ol.steps li p { margin: 2px 0 4px; }
@media print {
  body.printing > *:not(#print-sheet) { display: none !important; }
  body.printing #print-sheet { position: static; left: auto; }
  body.printing { background: #fff; }
  html:has(body.printing) { background: #fff !important; }
  #print-sheet .swatch { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #print-sheet .print-map, #print-sheet .leaflet-container { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* the team's day sheet, the list after the map (app.js daySheetList) */
#print-sheet .day-sheet h2 { font-size: 16px; margin: 0 0 4px; }
#print-sheet .day-sheet table { width: 100%; border-collapse: collapse; }
#print-sheet .day-sheet th, #print-sheet .day-sheet td { border: 1px solid #999; padding: 5px 6px; vertical-align: top; font-size: 10.5px; }
#print-sheet .day-sheet th { background: #eef3f5; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
#print-sheet .day-sheet tr { break-inside: avoid; }
#print-sheet .day-sheet .boxes { white-space: nowrap; }
#print-sheet .day-sheet .write-in { display: inline-block; min-width: 120px; min-height: 26px; }
#print-sheet .day-sheet .sign-row { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 18px; font-size: 11px; }
/* the Help tab's user types: each role on its own line, apart (the tester, 2026-10-24) */
#help-user-types .role-line + .role-line { margin-top: 6px; }
/* the Appearance dialog's three looks: today's, the beta, Gamma (2026-10-25) -- shown in any look */
.look-editions { display: grid; gap: 8px; margin: 10px 0 14px; }
.look-edition { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 12px; cursor: pointer; }
.look-edition:has(input:checked) { border-color: var(--accent); background: var(--surface-2); }
.look-edition input { margin-top: 4px; }
.look-edition > span { display: grid; gap: 2px; }

/* the route plan's hand tools (the planning review, 2026-11-12) */
.plan-capacity { margin: 4px 0 8px; padding: 8px 12px; border-radius: 8px; background: color-mix(in srgb, var(--accent) 8%, transparent); }
.plan-capacity.warn { background: color-mix(in srgb, var(--warn) 12%, transparent); }
.give-well { align-items: end; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.give-well input { max-width: 180px; }
.dropped-wells { display: grid; gap: 4px; margin-top: 6px; }
.stop-actions { gap: 4px; flex-wrap: wrap; }
.chip.icon { min-width: 30px; padding-inline: 6px; }
.team-areas { grid-column: 1 / -1; }
details.advanced > summary { cursor: pointer; color: var(--muted); font-size: 13px; }

/* ── Help: the user manual and questions to the administrators (2026-11-13) ── */
.manual-search input[type="search"] { flex: 1 1 14rem; min-width: 0; }
.manual-layout { display: grid; grid-template-columns: minmax(13rem, 18rem) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.manual-nav { position: sticky; top: 0.5rem; max-height: calc(100vh - 2rem); overflow: auto; border-inline-end: 1px solid var(--line); padding-inline-end: 0.75rem; }
.manual-nav details { margin-bottom: 0.4rem; }
.manual-nav summary { font-weight: 600; cursor: pointer; padding: 0.2rem 0; }
.manual-list { list-style: none; margin: 0.2rem 0 0.5rem; padding: 0; }
.manual-list li { margin: 0.1rem 0; }
.manual-list a { display: block; padding: 0.25rem 0.4rem; border-radius: 6px; color: var(--ink); text-decoration: none; line-height: 1.3; }
.manual-list a:hover { background: var(--surface-2); }
.manual-list a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
.manual-n { display: inline-block; min-width: 1.6rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.manual-list a[aria-current="page"] .manual-n { color: inherit; }
.manual-found { margin: 0.5rem 0 1rem; }
.manual-reading { min-width: 0; }
.manual-page { line-height: 1.55; max-width: 52rem; }
.manual-page h3 { margin-top: 0.2rem; }
.manual-page h4 { margin: 1.4rem 0 0.5rem; }
.manual-page h5 { margin: 1rem 0 0.4rem; }
.manual-page code { background: var(--surface-2); border-radius: 4px; padding: 0 0.25rem; font-size: 0.92em; }
.manual-page pre { background: var(--surface-2); border-radius: var(--radius); padding: 0.6rem 0.8rem; overflow-x: auto; }
.manual-page pre code { background: none; padding: 0; }
.manual-page aside { border-inline-start: 4px solid var(--accent); background: var(--surface-2); border-radius: 6px; padding: 0.4rem 0.9rem; margin: 0.9rem 0; }
.manual-page aside.watch, .manual-page aside.never { border-inline-start-color: var(--warn); }
.manual-page aside p { margin: 0.4rem 0; }
.manual-who { color: var(--muted); }
.manual-page a, .help-ask a, .manual-contents a { color: var(--accent); }
.manual-contents { background: var(--surface-2); border-radius: var(--radius); padding: 0.5rem 0.9rem; margin: 0.6rem 0 1rem; }
.manual-contents ul { margin: 0.3rem 0 0; padding-inline-start: 1.1rem; }
.manual-steps { margin-top: 1.5rem; border-top: 1px solid var(--line); padding-top: 0.75rem; gap: 0.5rem; flex-wrap: wrap; }
.manual-ask { margin-top: 1rem; }
@media (max-width: 760px) {
  .manual-layout { grid-template-columns: minmax(0, 1fr); }
  .manual-nav { position: static; max-height: none; border-inline-end: 0; border-bottom: 1px solid var(--line); padding: 0 0 0.5rem; }
}
.help-ask label { display: block; margin-bottom: 0.75rem; }
.help-ask input[type="text"], .help-ask textarea { display: block; width: 100%; box-sizing: border-box; margin-top: 0.25rem; }
.help-thread { list-style: none; margin: 1rem 0; padding: 0; }
.help-thread li { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.4rem 0.9rem; margin-bottom: 0.6rem; background: var(--surface); }
.help-thread li.from-admin { border-inline-start: 4px solid var(--accent); background: var(--surface-2); }
.help-words { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0.3rem 0; }
.help-subject, .help-subject button { overflow-wrap: anywhere; word-break: break-word; min-width: 0; text-align: start; }
td.help-subject { max-width: 28rem; }
.help-left { display: block; margin-top: 0.2rem; }
.help-faq { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.45rem 0.9rem; margin-bottom: 0.5rem; background: var(--surface); }
.help-faq > summary { cursor: pointer; font-weight: 600; overflow-wrap: anywhere; }
.help-faq.hidden-faq { opacity: 0.7; border-style: dashed; }
.help-faq-list { margin-top: 0.9rem; }
.help-asked-was { border-inline-start: 3px solid var(--line); padding-inline-start: 0.7rem; margin: 0.5rem 0 0.9rem; }
.tab-count { display: inline-block; min-width: 1.2rem; margin-inline-start: 0.35rem; padding: 0 0.35rem; border-radius: 999px;
  background: var(--warn); color: #fff; font-size: 0.75rem; line-height: 1.2rem; text-align: center; font-weight: 600; }
.manual-page > h3 { font-size: 1.45rem; }
.manual-list a { display: grid; grid-template-columns: 1.8rem minmax(0, 1fr); align-items: start; }
@media print {
  .manual-nav, .manual-search, .manual-ask, .manual-steps { display: none; }
  .manual-layout { display: block; }
}

/* The Help tab's topics: buttons with small rounded corners, not pills (the owner, 2026-11-19) */
.help-topics button.chip { border-radius: 8px; padding: 6px 14px; }

/* The bulk assignment dialog (2026-11-20): wide enough for its map, which fills most of the screen's height */
.bulk-dialog { max-width: min(1100px, 96vw); width: 96vw; }
.bulk-dialog .bulk-map { height: min(58vh, 560px); min-height: 280px; border: 1px solid var(--line); border-radius: var(--radius); }
.itineraries .itinerary { margin: 8px 0 12px; }
.itineraries .itinerary h4 { margin: 0 0 4px; }
.itineraries ol { margin: 0; padding-inline-start: 22px; }

/* ── the week's plan: grid, map pins, solving (the usability review of 2026-11-21) ── */
.plan-detail .kpis { margin-top: 8px; }
.kpi.bad .kpi-value { color: var(--danger); }
.badge.bad { background: var(--danger); color: #fff; }
.plan-actions { margin: 10px 0 4px; }
.solving { margin: 8px 0; }
.solving-line { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.solving-clock { font-variant-numeric: tabular-nums; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent);
  display: inline-block; animation: bp-spin 0.9s linear infinite; }
@keyframes bp-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.plan-grid-wrap { overflow-x: auto; }
.plan-grid { border-collapse: separate; border-spacing: 3px; width: 100%; min-width: 560px; }
.plan-grid th { text-align: start; font-weight: 600; font-size: 13px; white-space: nowrap; }
.plan-grid thead th { text-align: center; }
.plan-grid thead th:first-child { text-align: start; }
.plan-grid .grid-crew th { font-weight: 500; font-size: 12px; color: var(--muted); padding-top: 8px; }
.plan-grid .grid-cell { padding: 0; }
.plan-grid .grid-cell button { width: 100%; min-height: 52px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 1px; border: 1px solid transparent; border-radius: 6px; cursor: pointer; font: inherit;
  color: var(--ink); background: transparent; padding: 4px; }
.plan-grid .grid-cell.ok button { background: color-mix(in srgb, var(--ok) 16%, transparent); }
.plan-grid .grid-cell.near button { background: color-mix(in srgb, var(--warn) 22%, transparent); }
.plan-grid .grid-cell.over button { background: color-mix(in srgb, var(--danger) 26%, transparent); border-color: var(--danger); }
.plan-grid .grid-cell.idle button { background: color-mix(in srgb, var(--muted) 10%, transparent); color: var(--muted); }
.plan-grid .grid-cell.on button { outline: 3px solid var(--accent); outline-offset: 1px; }
.plan-grid .grid-wells { font-weight: 700; font-size: 16px; }
.plan-grid .grid-hours { font-size: 12px; font-variant-numeric: tabular-nums; }
.plan-grid .grid-back { font-size: 11px; color: var(--muted); }
.plan-grid .grid-total { text-align: center; font-weight: 600; }
.plan-grid .grid-team.on, .plan-grid .grid-day.on { font-weight: 700; text-decoration: underline; }
.grid-key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-inline-end: 4px; vertical-align: -1px; }
.grid-key.ok { background: color-mix(in srgb, var(--ok) 35%, transparent); }
.grid-key.near { background: color-mix(in srgb, var(--warn) 45%, transparent); }
.grid-key.over { background: color-mix(in srgb, var(--danger) 45%, transparent); border: 1px solid var(--danger); }
.grid-key.idle { background: color-mix(in srgb, var(--muted) 20%, transparent); }
.map-legend { margin: 6px 0 2px; gap: 14px; }
.map-legend > span { display: inline-flex; align-items: center; gap: 5px; }
.key-base { font-size: 14px; line-height: 1; }
.key-ring { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--accent); background: #fff; }
.key-ring.grey { border-color: #6b7b88; width: 7px; height: 7px; border-width: 1px; }
.key-pin { display: inline-flex; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700; align-items: center; justify-content: center; }
.stop-pin span { display: flex; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; color: #fff;
  font: 700 11px/1 system-ui, sans-serif; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45); }
.stop-pin.late span { border-color: #b3261e; box-shadow: 0 0 0 2px #b3261e; }
.base-pin span { display: flex; width: 22px; height: 22px; border-radius: 4px; background: #1a2733; color: #fff;
  font: 700 14px/1 system-ui, sans-serif; align-items: center; justify-content: center; border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45); }
.base-pin.new span { background: var(--accent); }
.leaflet-tooltip.base-label { font-weight: 600; padding: 1px 6px; }
.base-map { height: 300px; margin: 8px 0; border: 1px solid var(--line); border-radius: var(--radius); }
.stop-group th { text-align: start; background: color-mix(in srgb, var(--muted) 8%, transparent); font-weight: 600; padding-top: 8px; }
.stop-group.over th { background: color-mix(in srgb, var(--danger) 12%, transparent); }
tr.late td { background: color-mix(in srgb, var(--danger) 7%, transparent); }
.move-preview { margin: 4px 0 0; }
.move-preview.ok, .bulk-impact.ok, p.ok { color: var(--ok); }
.bulk-impact { min-height: 1.2em; }
.hand-tools { margin-top: 12px; }
.publish-dialog { max-width: min(640px, 94vw); }
.publish-dialog ul { margin: 6px 0; padding-inline-start: 20px; }
.setup-steps { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0; padding-inline-start: 0; list-style: none; }
.setup-steps li { display: flex; flex-direction: column; }
.setup-steps li.done strong::after { content: " ✓"; color: var(--ok); }
.bulk-dialog { max-height: 94vh; overflow: auto; }
@media (max-width: 600px) {
  .bulk-dialog .bulk-map { height: 46vh; min-height: 240px; }
  .plan-grid .grid-back { display: none; }
}
/* round 3: the grid beside the map on a wide screen; the bulk dialog's foot in view; partner pins; phone grid */
@media (min-width: 1280px) {
  .plan-workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
  .plan-workspace .plan-map-block { position: sticky; top: 8px; }
  .plan-workspace .field-map { height: 62vh; }
}
.bulk-footer { position: sticky; bottom: -1px; background: var(--surface, #fff); border-top: 1px solid var(--line);
  padding: 8px 0 4px; margin-top: 6px; z-index: 2; }
.stop-pin.partner span { width: 18px; height: 18px; font-size: 10px; opacity: 0.8; }
tr.hit td { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.plan-capacity:empty { display: none; }
@media (max-width: 600px) {
  .plan-grid { min-width: 0; border-spacing: 2px; font-size: 12px; }
  .plan-grid .grid-team .small { display: none; }
  .plan-grid .grid-cell button { min-height: 42px; padding: 2px; }
  .plan-grid .grid-wells { font-size: 14px; }
  .plan-grid .grid-total { display: none; }
  .plan-grid thead th:last-child { display: none; }
}
.toast { position: fixed; inset-inline-start: 50%; bottom: 24px; transform: translateX(-50%); z-index: 2000; max-width: min(560px, 92vw);
  background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 8px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  font-size: 14px; animation: bp-toast 7s ease forwards; pointer-events: none; }
[dir="rtl"] .toast { transform: translateX(50%); }
.toast.warn { border-inline-start: 5px solid var(--warn); }
@keyframes bp-toast { 0% { opacity: 0; } 6% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }
@media print { .toast { display: none; } }
.bulk-dialog .bulk-map { height: min(40vh, 440px); min-height: 240px; }
.bulk-dialog form.stack { gap: 6px; }
/* round 4: the bulk dialog's foot above its map's panes; the crew form's teams under its fields; the grid's team column kept */
.bulk-dialog .bulk-map { position: relative; z-index: 0; isolation: isolate; }
.bulk-footer { z-index: 1000; }
.form-grid fieldset.choices { grid-column: 1 / -1; }
.form-grid > button[type="submit"] { grid-column: 1 / -1; justify-self: start; }
.form-grid > .type-says { grid-column: 1 / -1; margin: 0; }
.form-grid > .type-says:empty { display: none; }
.plan-grid th[scope="row"] { position: sticky; inset-inline-start: 0; background: var(--surface); z-index: 1; }
.chip[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 1px; }
