:root {
  --bg: #f5f6f8; --surface: #ffffff; --text: #1b1f24; --muted: #5d6673; --line: #dfe3e8;
  --accent: #1f5fbf; --accent-text: #ffffff; --danger: #b42318; --warn-bg: #fff4e5; --warn: #8a4b00;
  --chip: #eef2f7; --flag: #fde7e7; --flag-text: #9b1c1c; --ok: #1e7b45;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111418; --surface: #1a1f25; --text: #e7eaee; --muted: #9aa4b1; --line: #2c333c;
    --accent: #5b9bff; --accent-text: #0b1220; --danger: #ff8a80; --warn-bg: #3a2a12; --warn: #ffc56b;
    --chip: #242b33; --flag: #4a1e1e; --flag-text: #ffb4b4; --ok: #6fd39a; color-scheme: dark; }
}
/* ===== New look (optional, switch in the header; default is the classic look) ===== */
:root[data-ui="new"] {
  --bg: #f4f2ea; --surface: #ffffff; --text: #1c2411; --muted: #5f6550; --line: #dedccf;
  --accent: #3f5a1f; --accent-text: #ffffff; --danger: #b42318; --warn-bg: #fff4e5; --warn: #8a4b00;
  --chip: #ecebdf; --flag: #fde7e7; --flag-text: #9b1c1c; --ok: #1e7b45;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root[data-ui="new"] { --bg: #12160d; --surface: #1b2114; --text: #e9ebe0; --muted: #a3a891; --line: #2e3524;
    --accent: #c9a032; --accent-text: #1c2411; --danger: #ff8a80; --warn-bg: #3a2a12; --warn: #ffc56b;
    --chip: #262d1c; --flag: #4a1e1e; --flag-text: #ffb4b4; --ok: #6fd39a; color-scheme: dark; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: clamp(14px, calc(0.45vw + 8.5px), 19px); }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 1rem; line-height: 1.45; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); padding: 7px 14px; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button.ghost { background: transparent; }
input, select { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.muted { color: var(--muted); }
.error { color: var(--danger); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.banner { background: var(--warn-bg); color: var(--warn); padding: 6px 16px; font-size: 0.929rem; text-align: center; }

.login { min-height: 90vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); padding: 28px; display: grid; gap: 14px; }
.login-card h1 { margin: 0; font-size: 1.571rem; }
.login-card p { margin: 0; }
.login-card label { display: grid; gap: 5px; font-weight: 500; }

.topbar { display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-size: 1.143rem; }
.tabs { display: flex; gap: 4px; }
.tabs button { border: none; background: none; padding: 6px 12px; border-radius: 6px; color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--chip); color: var(--text); font-weight: 600; }
.spacer { flex: 1; }

.page { padding: clamp(12px, 1.4vw, 32px); max-width: none; margin: 0; }
.searchbar { display: flex; gap: 8px; }
.searchbar input { font-size: 1.143rem; padding: 12px 14px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.split.has-detail { grid-template-columns: minmax(0, 1fr) minmax(22em, 32em); }
@media (max-width: 900px) { .split.has-detail { grid-template-columns: 1fr; } }

.results { display: grid; gap: 8px; }
.group-title { margin: 14px 0 2px; font-size: 0.857rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.row { display: grid; grid-template-columns: 7.5em minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 14px; text-align: left; width: 100%; }
.split.has-detail .row { grid-template-columns: 90px minmax(0, 1fr); }
.split.has-detail .row .row-end, .split.has-detail .row > .chips { grid-column: 2; }
.split.has-detail .row .chips { justify-content: flex-start; }
.row:hover { border-color: var(--accent); }
.row.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.row .type { font-size: 0.857rem; color: var(--muted); }
.row .num { font-weight: 600; font-family: ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }
.row .sub { color: var(--muted); font-size: 0.929rem; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--chip); font-size: 0.857rem; white-space: nowrap; }
.chip.flag { background: var(--flag); color: var(--flag-text); }
.chip.flag.ata-flag { outline: 1px dashed var(--flag-text); white-space: normal; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.detail { padding: 16px; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
.detail h2 { margin: 0 0 4px; font-size: 1.214rem; font-family: ui-monospace, Consolas, monospace; }
.detail-head { display: flex; justify-content: space-between; align-items: start; gap: 8px; margin-bottom: 10px; }
.fields { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 4px 12px; margin: 0; font-size: 0.929rem; }
.fields dt { color: var(--muted); overflow-wrap: anywhere; }
.fields dd { margin: 0; overflow-wrap: anywhere; }
.filter { margin: 8px 0 12px; }

.board-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--chip); border-radius: 10px; padding: 10px; min-height: 120px; }
.col h3 { margin: 2px 4px 10px; font-size: 0.929rem; display: flex; justify-content: space-between; }
.col .row { grid-template-columns: 1fr; gap: 4px; margin-bottom: 8px; }
.col .chips { justify-content: flex-start; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5em, 1fr)); gap: 10px; margin: 8px 0 16px; }
.tile { display: grid; gap: 2px; padding: 12px 14px; text-decoration: none; color: inherit; }
.tile:hover { border-color: var(--accent); }
.tile-num { font-size: 1.714rem; font-weight: 700; }
.tile.attention .tile-num { color: var(--danger); }
.cc { display: grid; gap: 14px; }
.cc-section { padding: 14px 16px; }
.cc-section h3 { margin: 0; font-size: 1.071rem; }
.small { font-size: 0.857rem; margin: 2px 0 10px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.929rem; }
th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
tbody tr { cursor: pointer; }
tbody tr:hover, tbody tr:focus { background: var(--chip); outline: none; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 8px; }
.toolbar label { display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.toolbar select, .toolbar input[type="search"] { width: auto; }
.toolbar input[type="search"] { flex: 1; min-width: 180px; }
.check input { width: auto; }
.note { background: var(--warn-bg); color: var(--warn); padding: 8px 12px; border-radius: 8px; }
.mono { font-family: ui-monospace, Consolas, monospace; white-space: nowrap; }
.warn-row td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.edit-row td { background: var(--chip); cursor: default; }
.edit-grid { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.edit-grid label { display: flex; gap: 6px; align-items: center; }
.edit-grid input { width: auto; }
.small-btn { padding: 4px 10px; font-size: 0.929rem; }
.ok { color: var(--ok); }
.bulk { padding: 14px 16px; margin-bottom: 12px; display: grid; gap: 10px; }
.bulk h3 { margin: 0; font-size: 1.071rem; }
.bulk-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.bulk-row select { width: auto; }
.bulk textarea { width: 100%; font: 13px ui-monospace, Consolas, monospace; padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); }
#arr-table td { vertical-align: top; }
#arr-table td:nth-child(n+3):nth-child(-n+7) { white-space: nowrap; }
#arr-table .chip { margin: 0 4px 4px 0; }
#arr-table td.editable { cursor: text; user-select: none; }
#arr-table td.editable:hover { outline: 1px dashed var(--accent); outline-offset: -3px; border-radius: 4px; }
.empty { padding: 24px; text-align: center; color: var(--muted); }
@media (max-width: 600px) {
  .page { padding: 12px 16px; }
  .row { grid-template-columns: 1fr; }
  .chips { justify-content: flex-start; }
}
.copy-wrap { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.copy-btn { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); font-size: 0.857rem; line-height: 1; cursor: pointer; user-select: none; flex: none; }
.copy-btn:hover, .copy-btn:focus-visible { color: var(--accent); border-color: var(--accent); outline: none; }
.copy-btn.copied { color: var(--ok); border-color: var(--ok); }

/* v0.4: overview polish */
.num-cell { font-variant-numeric: tabular-nums; white-space: nowrap; }
.boxes { display: inline-flex; align-items: center; gap: 8px; }
.bar { display: inline-block; width: 70px; height: 6px; border-radius: 3px; background: var(--chip); overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); }
.bar-fill.full { background: var(--ok); }
.chip.info { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
button.tile { text-align: left; font: inherit; color: inherit; cursor: pointer; }
.tile.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cc-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.cc-head h3 { display: flex; align-items: center; gap: 8px; }
.cc-head .small { margin: 0; }
.count { display: inline-block; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--chip); color: var(--muted); font-size: 0.857rem; font-weight: 600; text-align: center; margin-left: 8px; }
.cc-table { table-layout: fixed; }
.cc-table th:nth-child(1), .cc-table td:nth-child(1) { width: 22%; }
.cc-table th:nth-child(2), .cc-table td:nth-child(2) { width: 14%; }
.cc-table th:nth-child(3), .cc-table td:nth-child(3) { width: 8%; }
.cc-table th:nth-child(4), .cc-table td:nth-child(4) { width: 18%; }
.cc-table th:nth-child(5), .cc-table td:nth-child(5) { width: 20%; }
.empty-line { margin: 4px 0; }
tbody tr:nth-child(even):not(.day-row):not(.edit-row) td { background: color-mix(in srgb, var(--chip) 45%, transparent); }
.day-row td { background: var(--bg) !important; font-weight: 700; font-size: 0.929rem; padding-top: 14px; cursor: default; border-bottom: 2px solid var(--line); }
.when { display: inline-flex; flex-direction: column; line-height: 1.25; font-variant-numeric: tabular-nums; }
.when .rel { font-size: 0.786rem; color: var(--muted); }
.facts { padding: 10px 12px; margin: 10px 0; background: var(--chip); border-radius: 8px; }
.facts dt { color: var(--muted); }
.facts dd { font-weight: 500; }
.all-fields { margin-top: 6px; }
.all-fields summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: 6px 0; }

/* v0.5: start clearance + alerts */
.clear-btn { display: inline-block; padding: 4px 10px; border-radius: 6px; background: var(--accent); color: var(--accent-text); font-size: 0.857rem; font-weight: 600; cursor: pointer; white-space: nowrap; user-select: none; }
.clear-btn:hover, .clear-btn:focus-visible { filter: brightness(1.1); outline: 2px solid var(--accent); outline-offset: 1px; }
.action-cell { text-align: right; width: 1%; white-space: nowrap; }
.row-end { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.split.has-detail .row .row-end { justify-content: flex-start; }
.badge { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 0.786rem; font-weight: 700; line-height: 18px; text-align: center; }
.dialog { width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; padding: 18px 20px; color: var(--text); background: var(--surface); border: 1px solid var(--line); }
.wide-dialog { width: min(860px, calc(100vw - 32px)); }
.land-table select { max-width: 130px; }
.land-table td, .land-table th { padding: 4px 6px; }
.dialog::backdrop { background: rgb(0 0 0 / 40%); }
.dialog h2 { margin: 0; font-size: 1.286rem; }
.dlg-block { margin: 12px 0; }
.dlg-block ol, .dlg-block ul { margin: 6px 0 0 18px; padding: 0; }
.stack { display: grid; gap: 6px; font-weight: 600; }
.code-input { width: 110px; margin-left: 6px; text-transform: uppercase; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.dlg-result { margin-top: 10px; }
.error-note { background: var(--flag); color: var(--flag-text); }
.error-note ul { margin: 6px 0 0 18px; }
.sps-msg { margin-top: 6px; }
.ok.big { font-size: 1.071rem; font-weight: 600; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50; max-width: min(420px, calc(100vw - 32px)); }
.toast { padding: 10px 14px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 6px 20px rgb(0 0 0 / 15%); font-size: 0.929rem; }
.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.ok { border-color: var(--ok); color: var(--ok); }
.ok-chip { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.small-line { font-size: 0.786rem; margin-top: 2px; }
.flight-row { cursor: pointer; }
.flight-detail > td { background: var(--chip); padding: 8px 12px; }
table.inner { width: 100%; font-size: 0.929rem; }
table.inner tr { cursor: pointer; }
/* Handover */
.ho-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 12px; }
@media (max-width: 900px) { .ho-grid { grid-template-columns: 1fr; } }
#ho-note { width: 100%; box-sizing: border-box; margin-top: 8px; font: inherit; }
.ho-card { margin-bottom: 10px; padding: 10px 14px; }
.ho-card h3 { display: flex; justify-content: space-between; margin: 0 0 6px; font-size: 1.071rem; }
.ho-card.ho-open { border-left: 3px solid var(--flag-text); }
.ho-list { list-style: none; margin: 0; padding: 0; font-size: 0.929rem; }
.ho-list li { padding: 3px 0; cursor: pointer; }
/* History */
.history { margin: 12px 0; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: 0.929rem; }
.timeline > li { border-left: 2px solid var(--chip); padding: 4px 0 8px 10px; }
.tl-changes { margin: 2px 0 0; padding-left: 16px; }

.tile .tile-short { display: block; font-size: 0.786rem; color: var(--muted, #6b7280); margin-top: 2px; }
.fyco-download { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; }

/* Today: start screen with only what needs action */
.today-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }
.today-head .spacer { flex: 1; }
.today-summary { display: flex; gap: 6px; flex-wrap: wrap; }
.pill-danger, .pill-warn, .pill-ok { font-size: 0.929rem; padding: 3px 10px; border-radius: 999px; }
.pill-danger { background: var(--flag); color: var(--flag-text); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-ok { background: var(--chip); color: var(--ok); }
.today-list { padding: 0; overflow: hidden; }
.today-item { display: grid; grid-template-columns: 6.5em minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.today-item:last-child { border-bottom: none; }
.today-item.lvl-danger { border-left: 3px solid var(--danger); }
.today-item.lvl-warn { border-left: 3px solid var(--warn); }
.today-item.lvl-info { border-left: 3px solid var(--line); }
.today-tag { font-size: 0.857rem; padding: 2px 8px; border-radius: 6px; text-align: center; background: var(--chip); }
.today-tag.tag-danger { background: var(--flag); color: var(--flag-text); }
.today-tag.tag-warn { background: var(--warn-bg); color: var(--warn); }
.today-title { font-weight: 600; }
.today-action { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; max-width: 38em; }
.today-action .fyco-download { margin: 0; }
.ata-ctl { display: flex; flex-direction: column; gap: 4px; min-width: 21em; }
.ata-btns { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.time-input { width: 11.5em; font-variant-numeric: tabular-nums; }
.ata-btns .time-input { padding: 5px 8px; }
@media (max-width: 760px) { .today-item { grid-template-columns: 1fr; } .today-action { justify-content: flex-start; } .ata-ctl { min-width: 0; } }
.docs { margin: 12px 0; }
.docs-title { font-weight: 600; margin-bottom: 6px; }
.doc-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.action-cell > * + * { margin-left: 6px; }
.fyco-counts { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5em, 1fr)); gap: 10px; margin: 0 0 12px; }
.fyco-search { max-width: 26em; }
label.inline { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
label.inline select, label.inline input[type=checkbox] { width: auto; }
.fyco-list { padding: 0; }
.fyco-chips { justify-content: flex-start; }
.pre-line { white-space: pre-line; margin-bottom: 6px; }
/* FYCO table: own, flexible columns (the CC check widths are for other columns); status chips may wrap. */
.cc-table.fyco-table { table-layout: auto; }
.cc-table.fyco-table th, .cc-table.fyco-table td { width: auto; }
.fyco-table .fyco-chips { flex-wrap: wrap; }
/* Narrow screens: tables keep a readable minimum width and scroll sideways inside their box instead of overlapping. */
@media (max-width: 900px) {
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .table-wrap > table { min-width: 720px; }
  .table-wrap > table.inner, .flight-detail .table-wrap > table { min-width: 640px; }
}
/* CC check table (fixed column widths): chips and the action buttons may wrap inside their cell instead of overlapping. */
.cc-table .chip { white-space: normal; }
.cc-table td.action-cell { white-space: normal; }
.cc-table td.action-cell > * { margin: 2px 0 2px 6px; }
.cc-table:not(.fyco-table) th:nth-child(6), .cc-table:not(.fyco-table) td:nth-child(6) { width: 13%; }
.cc-table:not(.fyco-table) th:nth-child(7), .cc-table:not(.fyco-table) td:nth-child(7) { width: 9.5em; }
.cc-table td.action-cell { text-align: right; }
@media (max-width: 1100px) { .table-wrap > table.cc-table:not(.fyco-table) { min-width: 940px; } }

/* ===== Header v2 (variant A, chosen 27-11): dark green bar, stamp logo, grouped button tabs with live sub-lines ===== */
:root[data-ui="new"] { --brand: #1f2a14; --brand-2: #2a3820; --brand-3: #34452a; --brand-line: #3b4a27; --cream: #f1eedf; --gold: #c9a032; --sage: #a9b08f;
  --font-ui: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-logo: Impact, Haettenschweiler, 'Arial Narrow Bold', 'Arial Black', sans-serif; }
:root[data-ui="new"] .topbar { display: block; background: var(--brand); border-bottom: none; padding: 10px clamp(12px, 1.4vw, 32px) 12px; gap: 0; }
:root[data-ui="new"] .topline { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
:root[data-ui="new"] .logo { display: flex; align-items: center; gap: 10px; color: var(--cream); user-select: none; }
:root[data-ui="new"] .logo-stamp { border: 2px solid var(--cream); border-radius: 5px; padding: 2px; display: inline-flex; }
:root[data-ui="new"] .logo-stamp span { border: 1px solid var(--cream); border-radius: 2px; padding: 1px 6px 0; font-family: var(--font-logo); font-size: 1.15rem; letter-spacing: 1px; line-height: 1.1; }
:root[data-ui="new"] .logo-word { display: flex; flex-direction: column; line-height: 1; }
:root[data-ui="new"] .logo-my { font-family: var(--font-ui); font-weight: 500; font-size: 0.6rem; letter-spacing: 3px; color: var(--gold); }
:root[data-ui="new"] .logo-cc { font-family: var(--font-logo); font-size: 1.3rem; letter-spacing: 1.5px; }
:root[data-ui="new"] .who { color: #c9cdb8; font-size: 0.86rem; }
:root[data-ui="new"] .topbar .logout { border-color: #56693b; color: var(--cream); background: transparent; }
:root[data-ui="new"] .topbar .logout:hover { background: var(--brand-3); }
:root[data-ui="new"] .tabs { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
:root[data-ui="new"] .navgrp { display: flex; flex-direction: column; gap: 4px; }
:root[data-ui="new"] .navgl { font-family: var(--font-ui); font-size: 0.68rem; letter-spacing: 2px; color: #8d9774; padding-left: 4px; }
:root[data-ui="new"] .navgb { display: flex; gap: 6px; }
:root[data-ui="new"] .tabs button.navbtn { display: flex; align-items: center; gap: 9px; min-width: 8.6em; padding: 6px 12px 6px 6px; border-radius: 10px;
  background: var(--brand-2); border: 1px solid var(--brand-line); box-shadow: 0 3px 0 #121a0b; color: var(--cream); font-family: var(--font-ui);
  text-align: left; cursor: pointer; transition: background .12s, transform .06s, box-shadow .06s; }
:root[data-ui="new"] .navbtn .nav-ic { width: 2.15em; height: 2.15em; border-radius: 8px; background: #3a4b2a; color: #d7dcc3; display: flex; align-items: center; justify-content: center; flex: none; }
:root[data-ui="new"] .navbtn .nav-ic svg { width: 1.2em; height: 1.2em; }
:root[data-ui="new"] .navbtn .nav-txt { display: flex; flex-direction: column; min-width: 0; }
:root[data-ui="new"] .navbtn .nav-t { font-size: 0.93rem; font-weight: 500; line-height: 1.15; color: var(--cream); }
:root[data-ui="new"] .navbtn .nav-s { font-size: 0.78rem; line-height: 1.2; color: var(--sage); white-space: nowrap; }
:root[data-ui="new"] .navbtn .nav-s.alert { color: #ff9b8f; font-weight: 500; }
:root[data-ui="new"] .navbtn .badge { display: none; }
:root[data-ui="new"] .tabs button.navbtn:hover { background: var(--brand-3); border-color: #5b6f3f; }
:root[data-ui="new"] .tabs button.navbtn:active { transform: translateY(2px); box-shadow: 0 1px 0 #121a0b; }
:root[data-ui="new"] .tabs button.navbtn:focus-visible { outline: 2px dashed var(--gold); outline-offset: 2px; }
:root[data-ui="new"] .tabs button.navbtn[aria-selected="true"] { background: var(--cream); border-color: var(--gold); box-shadow: inset 0 0 0 2px var(--gold), 0 1px 0 #121a0b; transform: translateY(2px); font-weight: inherit; }
:root[data-ui="new"] .navbtn[aria-selected="true"] .nav-ic { background: var(--gold); color: var(--brand); }
:root[data-ui="new"] .navbtn[aria-selected="true"] .nav-t { color: var(--brand); }
:root[data-ui="new"] .navbtn[aria-selected="true"] .nav-s { color: #5f6550; }
:root[data-ui="new"] .navbtn[aria-selected="true"] .nav-s.alert { color: #b3261e; }
/* Phones and narrow windows: one row of buttons that scrolls sideways, without group labels. */
@media (max-width: 760px) {
  :root[data-ui="new"] .tabs { flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
  :root[data-ui="new"] .navgl { display: none; }
  :root[data-ui="new"] .tabs button.navbtn { min-width: auto; }
  :root[data-ui="new"] .who { display: none; }
}

/* Sign out in the green header (more specific than button.ghost). */
:root[data-ui="new"] .topbar button.logout { background: transparent; border: 1px solid #56693b; color: var(--cream); }
:root[data-ui="new"] .topbar button.logout:hover { background: var(--brand-3); }

/* ===== Classic look with the same header markup: one row as in v0.14.1 ===== */
:root:not([data-ui="new"]) .topline { display: contents; }
:root:not([data-ui="new"]) .logo, :root:not([data-ui="new"]) .navgl, :root:not([data-ui="new"]) .nav-ic, :root:not([data-ui="new"]) .nav-s { display: none; }
:root:not([data-ui="new"]) .brand-classic { order: 0; }
:root:not([data-ui="new"]) .tabs { order: 1; flex-wrap: wrap; }
:root:not([data-ui="new"]) .navgrp, :root:not([data-ui="new"]) .navgb { display: contents; }
:root:not([data-ui="new"]) .topline .spacer { order: 2; }
:root:not([data-ui="new"]) .ui-switch { order: 3; }
:root:not([data-ui="new"]) .who { order: 4; color: var(--muted); }
:root:not([data-ui="new"]) .logout { order: 5; }
:root[data-ui="new"] .brand-classic { display: none; }
.ui-switch { font-size: 0.857rem; padding: 4px 10px; }
:root[data-ui="new"] .topbar .ui-switch { background: transparent; border: 1px solid #56693b; color: var(--cream); }
:root[data-ui="new"] .topbar .ui-switch:hover { background: var(--brand-3); }

/* ===== New look, 27-11 "teveel wit": warmer and less white, compact Today rows, actions in one aligned column ===== */
:root[data-ui="new"] { --bg: #e8e5d6; --surface: #fbfaf3; --line: #d6d2bf; --chip: #e6e3d2; }
@media (prefers-color-scheme: dark) { :root[data-ui="new"] { --bg: #12160d; --surface: #1b2114; --line: #2e3524; --chip: #262d1c; } }
:root[data-ui="new"] .page { padding: 10px clamp(10px, 1.2vw, 24px); }
:root[data-ui="new"] .today-head { margin: 0 0 8px; }
:root[data-ui="new"] .today-list { border-radius: 8px; }
:root[data-ui="new"] .today-item { grid-template-columns: 5.6em minmax(0, 1fr) minmax(20em, 34em); gap: 10px; padding: 6px 12px; }
:root[data-ui="new"] .today-item:nth-child(even) { background: color-mix(in srgb, var(--surface) 70%, var(--bg)); }
:root[data-ui="new"] .today-title { font-size: 0.95rem; }
:root[data-ui="new"] .today-tag { font-size: 0.72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding: 3px 4px; }
:root[data-ui="new"] .today-action { justify-content: flex-start; max-width: none; }
:root[data-ui="new"] .ata-ctl { min-width: 0; width: 100%; }
:root[data-ui="new"] .ata-form { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
:root[data-ui="new"] .ata-form > .error:empty { display: none; }
:root[data-ui="new"] .ata-form .error { flex-basis: 100%; }
:root[data-ui="new"] .ata-form .ata-btns .muted.small { display: none; }  /* "Quick:" label */
:root[data-ui="new"] .ata-form .time-input { width: 10.5em; padding: 4px 8px; }
:root[data-ui="new"] .ata-form .small-btn { padding: 4px 10px; }
:root[data-ui="new"] .topbar { padding: 8px clamp(10px, 1.2vw, 24px) 10px; }
:root[data-ui="new"] .topline { margin-bottom: 6px; }
:root[data-ui="new"] .topbar button.ui-switch, :root[data-ui="new"] .topbar button.logout { font-size: 0.86rem; padding: 5px 12px; border-radius: 6px; }
@media (max-width: 760px) { :root[data-ui="new"] .today-item { grid-template-columns: 1fr; } }
:root:not([data-ui="new"]) .top-right { display: contents; }

/* ===== New look, round 2 (27-11): one colour language, compact tables/cards on every tab, shorter header ===== */
/* Status colours in the olive family: brick for errors, ochre for warnings, olive for ok. */
:root[data-ui="new"] { --danger: #a8321d; --flag: #f2ddd2; --flag-text: #8a2a17; --warn-bg: #f1e5c0; --warn: #6b5010; --ok: #3f6a1f; }
@media (prefers-color-scheme: dark) { :root[data-ui="new"] { --danger: #f08a70; --flag: #4a2318; --flag-text: #f0b8a6; --warn-bg: #3b3217; --warn: #e5c76b; --ok: #9cc46e; } }
:root[data-ui="new"] .pill-danger, :root[data-ui="new"] .pill-warn, :root[data-ui="new"] .pill-ok { font-size: 0.85rem; font-weight: 500; padding: 2px 10px; border-radius: 6px; }
:root[data-ui="new"] .pill-danger { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--flag-text) 25%, transparent); }
:root[data-ui="new"] .pill-warn { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warn) 25%, transparent); }
:root[data-ui="new"] .chip { border-radius: 6px; padding: 1px 7px; }
:root[data-ui="new"] .badge { background: var(--danger); }
:root[data-ui="new"] .today-item.lvl-warn { border-left-color: #b8901f; }

/* Cards, sections and tables: compact, one style on every tab. */
:root[data-ui="new"] .card { border-radius: 8px; }
:root[data-ui="new"] .cc { gap: 10px; }
:root[data-ui="new"] .cc-section, :root[data-ui="new"] .bulk { padding: 10px 12px; }
:root[data-ui="new"] .cc-section h3, :root[data-ui="new"] .bulk h3, :root[data-ui="new"] .ho-card h3 { font-size: 0.98rem; }
:root[data-ui="new"] .small { margin: 2px 0 6px; }
:root[data-ui="new"] th { background: var(--chip); color: var(--muted); font-size: 0.74rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; padding: 5px 8px; border-bottom: 1px solid var(--line); }
:root[data-ui="new"] td { padding: 5px 8px; }
:root[data-ui="new"] tbody tr:hover td, :root[data-ui="new"] tbody tr:focus td { background: color-mix(in srgb, var(--gold) 14%, var(--surface)) !important; }
:root[data-ui="new"] .day-row td { background: color-mix(in srgb, var(--accent) 10%, var(--bg)) !important; padding-top: 8px; font-size: 0.86rem; letter-spacing: .02em; }
:root[data-ui="new"] .flight-detail > td, :root[data-ui="new"] .edit-row td { background: color-mix(in srgb, var(--chip) 60%, var(--surface)); }
:root[data-ui="new"] .tiles, :root[data-ui="new"] .fyco-counts { gap: 8px; margin: 4px 0 10px; }
:root[data-ui="new"] .tile { padding: 7px 12px; border-top: 3px solid var(--accent); }
:root[data-ui="new"] .tile-num { font-size: 1.4rem; line-height: 1.15; }
:root[data-ui="new"] .tile.attention { border-top-color: var(--danger); }
:root[data-ui="new"] .tile.selected { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
:root[data-ui="new"] .board { gap: 8px; }
:root[data-ui="new"] .col { background: color-mix(in srgb, var(--chip) 70%, var(--bg)); border-radius: 8px; padding: 8px; }
:root[data-ui="new"] .col h3 { font-size: 0.74rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin: 2px 4px 8px; }
:root[data-ui="new"] .col .row { margin-bottom: 6px; padding: 7px 10px; }
:root[data-ui="new"] .row { padding: 7px 12px; }
:root[data-ui="new"] .group-title { margin: 10px 0 2px; }
:root[data-ui="new"] .ho-grid { gap: 10px; margin-top: 8px; }
:root[data-ui="new"] .ho-card { padding: 8px 12px; margin-bottom: 8px; }
:root[data-ui="new"] .ho-card.ho-open { border-left-color: var(--danger); }
:root[data-ui="new"] .facts { padding: 8px 10px; margin: 8px 0; }
:root[data-ui="new"] .detail { padding: 12px; }
:root[data-ui="new"] .note { border-radius: 6px; padding: 6px 10px; }
:root[data-ui="new"] .searchbar input { padding: 9px 12px; }

/* Header: legible logo, better contrast, buttons spread over the full width. */
:root[data-ui="new"] .logo-my { font-size: 0.72rem; letter-spacing: 3px; }
:root[data-ui="new"] .navbtn .nav-s { color: #c3c9ab; overflow: hidden; text-overflow: ellipsis; }
:root[data-ui="new"] .navgl { color: #a3ad88; font-size: 0.64rem; }
:root[data-ui="new"] .top-right { display: flex; align-items: center; gap: 10px; }
@media (min-width: 761px) {
  :root[data-ui="new"] .tabs { flex-wrap: nowrap; }
  :root[data-ui="new"] .navgrp:nth-child(1) { flex: 3 1 0; } :root[data-ui="new"] .navgrp:nth-child(2) { flex: 2 1 0; }
  :root[data-ui="new"] .navgrp:nth-child(3) { flex: 1 1 0; } :root[data-ui="new"] .navgrp:nth-child(4) { flex: 2 1 0; }
  :root[data-ui="new"] .navgrp { min-width: 0; }
  :root[data-ui="new"] .navgb .navbtn { flex: 1 1 0; min-width: 0; }
  :root[data-ui="new"] .navbtn .nav-txt { overflow: hidden; }
  :root[data-ui="new"] .navbtn .nav-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
/* Wide screens: logo, buttons and sign-out on ONE row (about 80 px instead of 140 px). */
@media (min-width: 100000px) { /* one-row header retired 29-11: the top row holds the search box */
  :root[data-ui="new"] .topbar { display: flex; flex-wrap: nowrap; align-items: flex-end; gap: 18px; padding: 6px clamp(10px, 1.2vw, 24px) 8px; }
  :root[data-ui="new"] .topline { display: contents; }
  :root[data-ui="new"] .topline .spacer { display: none; }
  :root[data-ui="new"] .logo { order: 0; align-self: center; flex: none; }
  :root[data-ui="new"] .tabs { order: 1; flex: 1 1 auto; min-width: 0; }
  :root[data-ui="new"] .top-right { order: 2; align-self: center; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
  :root[data-ui="new"] .top-right .who { order: -1; }
  :root[data-ui="new"] .top-right { display: grid; grid-template-columns: auto auto; justify-items: end; }
  :root[data-ui="new"] .top-right .who { grid-column: 1 / -1; }
  :root[data-ui="new"] .top-right:has(.settings-btn:not([hidden])) { grid-template-columns: auto auto auto; }
}

/* Phones (27-11): grid columns must not grow with a wide table (min-width 720/940px), otherwise the whole page becomes
   ~990px wide and the phone zooms out; the tables scroll inside their own box instead. */
.cc, .ho-grid { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 901px) { .ho-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.cc > *, .ho-grid > *, .split > *, .table-wrap { min-width: 0; }
.table-wrap { max-width: 100%; }
@media (max-width: 600px) { .board-head { flex-wrap: wrap; } .board-head > p { flex: 1 1 100%; margin: 0 0 4px; } .board-head .spacer { display: none; } }

/* Frozen column headers (Migle 29-11): each table scrolls inside its own box, so the header row stays visible.
   Nested detail tables (table.inner) keep normal headers. */
.table-wrap { max-height: max(320px, calc(100vh - 150px)); overflow: auto; overscroll-behavior: contain; }
.table-wrap > table > thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); box-shadow: inset 0 -1px 0 var(--line); }
:root[data-ui="new"] .table-wrap > table > thead th { background: var(--chip); }
.dialog .table-wrap { max-height: none; }

/* Dashboards tab (Metabase embeds). */
.mb-switch { display: flex; flex-wrap: wrap; gap: 6px; }
.mb-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
a.mb-open { display: inline-block; border: 1px solid var(--line); border-radius: 6px; padding: 7px 14px; color: inherit; text-decoration: none; }
.mb-frames { padding: 0; overflow: hidden; }
.mb-frame { display: block; width: 100%; height: max(480px, calc(100vh - 170px)); border: 0; background: var(--surface); }
.mb-note { padding: 24px 16px; margin: 0; }
:root[data-ui="new"] .navgrp:nth-child(4) { flex-grow: 3; }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.pk-sum { padding: 10px 14px 0; margin: 0 0 8px; }
.mb-native .table-wrap { max-height: max(320px, calc(100vh - 230px)); }
.pk-table td.num { white-space: nowrap; }

/* CC check > Interceptions: release after the balance check. */
.rel-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 8px; }
.rel-confirm { flex: 1 1 100%; border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; background: var(--warn-bg); color: var(--text); }
.rel-confirm p { margin: 4px 0; }
.rel-btns { display: flex; gap: 8px; margin-top: 6px; }
.rel-table th:first-child, .rel-table td.sel-cell { width: 2.4em; }
.rel-table th:nth-child(2), .rel-table td:nth-child(2) { width: 20%; }
.sel-cell input { width: auto; transform: scale(1.2); }
.ok-text { color: var(--ok); font-weight: 600; }

/* Settings page (admins). */
.set-title { margin: 0; font-size: 1.2rem; }
.set-intro { margin: 0 0 10px; }
.set-list { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); max-width: 760px; }
.set-card { padding: 14px 16px; }
.set-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.set-switch { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.set-switch input { width: auto; transform: scale(1.3); }
.set-label { display: block; margin: 8px 0 4px; font-weight: 600; }
.set-users { width: 100%; box-sizing: border-box; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); resize: vertical; }
.set-btns { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.chip.set-on { background: var(--ok); color: var(--surface); }
#settings-btn[aria-pressed="true"] { font-weight: 600; text-decoration: underline; }
:root:not([data-ui="new"]) .settings-btn { order: 4; }
.settings-btn { font-size: 0.857rem; padding: 4px 10px; }
:root[data-ui="new"] .topbar .settings-btn { background: transparent; border: 1px solid #56693b; color: var(--cream); font-size: 0.86rem; padding: 5px 12px; border-radius: 6px; }
:root[data-ui="new"] .topbar .settings-btn:hover { background: var(--brand-3); }
.ata-missing { margin: 2px 0 1px; color: var(--danger); } .ata-missing .copy-btn { margin-left: 2px; }
.rel-table.no-sel th:first-child, .rel-table.no-sel td:first-child { width: 20%; }
.rel-table.no-sel th:nth-child(2), .rel-table.no-sel td:nth-child(2) { width: auto; }
#cc-status.stale { color: var(--danger); }
.bulk-list { margin: 4px 0; padding-left: 18px; } .bulk-list li { margin: 2px 0; } .row-pick { width: auto; margin-right: 6px; vertical-align: middle; transform: scale(1.15); }
.toast.warn { border-color: var(--warn); color: var(--warn); background: var(--warn-bg); }

/* Documents: cards with a file-type icon. */
.doc-btns { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 8px; margin-bottom: 6px; }
.doc-card { display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); min-width: 0; }
.doc-card:hover { border-color: var(--accent); background: var(--chip); }
.doc-card:disabled { opacity: .6; cursor: progress; }
.doc-ic { flex: none; display: inline-flex; width: 30px; height: 30px; }
.doc-ic svg { width: 100%; height: 100%; }
.doc-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.doc-txt strong { font-size: 0.93rem; }
.doc-txt .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-dl { flex: none; color: var(--accent); font-size: 1.05rem; }
button .doc-ic { width: 16px; height: 16px; margin-right: 5px; vertical-align: -3px; }
.doc-card .doc-ic { width: 30px; height: 30px; margin: 0; vertical-align: middle; }
.doc-dl { display: inline-flex; width: 20px; height: 20px; }
.doc-dl svg { width: 100%; height: 100%; }
.docs-btn { display: inline-flex; align-items: center; white-space: nowrap; }
#docs-dialog { width: min(720px, calc(100vw - 32px)); }

/* Repertoire tab. */
.rep-body { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.rep-card { padding: 14px 16px; }
.rep-card h3 { margin: 0 0 4px; }
.rep-no { width: 12em; }
.rep-card .time-input { width: 11em; }
@media (min-width: 761px) { :root[data-ui="new"] .navgrp:nth-child(3) { flex-grow: 2; } }

.rep-switch { margin: 0 0 10px; }
.rep-tools input[type=search] { flex: 1 1 260px; min-width: 0; width: auto; }
.rep-tools input[type=date] { width: auto; }
.rm-table td { white-space: nowrap; }
.rm-pager { align-items: center; justify-content: flex-end; }
.rep-time { display: flex; gap: 6px; align-items: center; } .rep-time .time-input { flex: 1 1 auto; min-width: 9em; }
.status-list { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 6px; } .status-list li { font-size: 0.93rem; }

/* Status button (everyone): dot shows the connection state. */
.status-btn { display: inline-flex; align-items: center; gap: 6px; font-size: 0.857rem; padding: 4px 10px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.status-btn[data-level="ok"] .status-dot { background: var(--ok); }
.status-btn[data-level="warn"] .status-dot { background: #d08a00; }
.status-btn[data-level="bad"] .status-dot { background: var(--danger); }
:root:not([data-ui="new"]) .status-btn { order: 4; }
:root[data-ui="new"] .topbar .status-btn { background: transparent; border: 1px solid #56693b; color: var(--cream); font-size: 0.86rem; padding: 5px 12px; border-radius: 6px; }
:root[data-ui="new"] .top-right:has(.status-btn) { grid-template-columns: repeat(4, auto); }
:root[data-ui="new"] .top-right:has(.settings-btn[hidden]) { grid-template-columns: repeat(3, auto); }
.status-btn { padding: 4px 8px; min-width: 30px; justify-content: center; }
.status-dot { width: 11px; height: 11px; }
:root[data-ui="new"] .topbar .status-btn { padding: 5px 9px; }
/* 0.16.0 header with the status dot: a bit less space between header items (classic) and 4 button columns (new look). */
:root:not([data-ui="new"]) .topbar { column-gap: 10px; }
@media (min-width: 100000px) { /* one-row header retired 29-11: the top row holds the search box */ :root[data-ui="new"] .top-right:has(.status-btn):has(.settings-btn:not([hidden])) { grid-template-columns: repeat(4, auto); } }

/* Back + Refresh now (header). */
.nav-btn { font-size: 0.857rem; padding: 4px 10px; white-space: nowrap; }
:root:not([data-ui="new"]) .nav-btn { order: 4; }
:root[data-ui="new"] .topbar .nav-btn { background: transparent; border: 1px solid #56693b; color: var(--cream); font-size: 0.86rem; padding: 5px 10px; border-radius: 6px; }
.nav-btn.spinning { opacity: .6; cursor: progress; }
@media (min-width: 100000px) { /* one-row header retired 29-11: the top row holds the search box */ :root[data-ui="new"] .top-right:has(.status-btn):has(.settings-btn:not([hidden])) { grid-template-columns: repeat(6, auto); } :root[data-ui="new"] .top-right:has(.status-btn):has(.settings-btn[hidden]) { grid-template-columns: repeat(5, auto); } }
.nav-btn { min-width: 32px; font-size: 1rem; padding: 3px 9px; }
:root:not([data-ui="new"]) .tabs button { padding: 6px 9px; }
.who { max-width: 11em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Classic look: the right-hand buttons stay together as one group; when the row is full the whole group moves
   right-aligned to a second row (instead of one loose button). */
:root:not([data-ui="new"]) .top-right { display: flex; align-items: center; gap: 10px; margin-left: auto; order: 3; flex-wrap: nowrap; }

/* Clean-up 29-11: Flights view switch; CC lists without the repeated Customs column. */
.fl-views { margin: 0 0 10px; }
.cc-table.no-status th:nth-child(1), .cc-table.no-status td:nth-child(1) { width: 20%; }
.cc-table.no-status th:nth-child(2), .cc-table.no-status td:nth-child(2) { width: 15%; }
.cc-table.no-status th:nth-child(3), .cc-table.no-status td:nth-child(3) { width: 7%; }
.cc-table.no-status th:nth-child(4), .cc-table.no-status td:nth-child(4) { width: 17%; }
.cc-table.no-status th:nth-child(5), .cc-table.no-status td:nth-child(5) { width: 16%; }
.cc-table.no-status th:nth-child(6), .cc-table.no-status td:nth-child(6) { width: auto; }
@media (min-width: 761px) { :root[data-ui="new"] .navgrp:nth-child(2) { flex-grow: 1; } :root[data-ui="new"] .navgrp:nth-child(4) { flex-grow: 2; } }

/* Narrow windows and phones (29-11): the header buttons wrap instead of making the page wider than the screen
   (that made phones zoom out). */
@media (max-width: 600px) {
  .top-right { flex-wrap: wrap !important; justify-content: flex-end; row-gap: 6px; max-width: 100%; min-width: 0; }
  :root:not([data-ui="new"]) .top-right { flex: 1 1 100%; }
  :root[data-ui="new"] .topline { flex-wrap: wrap; row-gap: 6px; }
  :root[data-ui="new"] .top-right { flex: 1 1 auto; }
  .topbar { padding-left: 12px; padding-right: 12px; }
}
@media (max-width: 600px) {
  .top-right { gap: 5px !important; }
  .top-right button, :root[data-ui="new"] .topbar .top-right button { font-size: 0.8rem !important; padding: 4px 7px !important; min-width: 0; }
  .top-right .status-btn { padding: 4px 6px !important; }
}
/* Tablets (29-11): CC lists without the Customs column need less width (fewer sideways-scrolling tables). */
@media (max-width: 1100px) { .table-wrap > table.cc-table.no-status:not(.fyco-table) { min-width: 680px; } }
/* New look between phone and wide screen: the 8 screen buttons shrink to fit one row (no 120 px minimum, no icons below 1100 px). */

@media (min-width: 761px) and (max-width: 1099px) {
  :root[data-ui="new"] .navbtn .nav-ic { display: none; }
  :root[data-ui="new"] .tabs button.navbtn { padding: 6px 8px; }
  :root[data-ui="new"] .tabs { gap: 8px; }
}
@media (max-width: 1100px) {
  .table-wrap > table.cc-table:not(.fyco-table):not(:has(thead th:nth-child(5))) { min-width: 520px; } /* short tables (4 columns) */
  .table-wrap > table.pk-table { min-width: 640px; }
}
/* New look: logo, screen buttons and header buttons on one row only from 1900 px (below that the 8 screen buttons get the full width). */
@media (min-width: 761px) {
  :root[data-ui="new"] .tabs button.navbtn { min-width: 0; gap: 6px; padding: 6px 8px 6px 5px; }
  :root[data-ui="new"] .navgrp { flex: 1 1 auto !important; }
  :root[data-ui="new"] .navgb .navbtn { flex: 1 1 auto; }
  :root[data-ui="new"] .tabs { gap: 8px; }
  :root[data-ui="new"] .navbtn .nav-ic { width: 1.85em; height: 1.85em; }
}
/* Interceptions table: column widths that add up to less than 100 % (it scrolled sideways by a few px on wide screens). */
.rel-table:not(.no-sel) th:nth-child(3), .rel-table:not(.no-sel) td:nth-child(3) { width: 10%; }
.rel-table:not(.no-sel) th:nth-child(4), .rel-table:not(.no-sel) td:nth-child(4) { width: 18%; }
.rel-table:not(.no-sel) th:nth-child(5), .rel-table:not(.no-sel) td:nth-child(5) { width: 15%; }
.rel-table:not(.no-sel) th:nth-child(6), .rel-table:not(.no-sel) td:nth-child(6) { width: 13%; }
.rel-table:not(.no-sel) th:nth-child(7), .rel-table:not(.no-sel) td:nth-child(7) { width: 8%; }
.rel-table:not(.no-sel) th:nth-child(8), .rel-table:not(.no-sel) td:nth-child(8) { width: auto; }
@media (min-width: 761px) { :root[data-ui="new"] .navgrp { flex: 1 1 auto !important; } :root[data-ui="new"] .navgb .navbtn { flex: 1 1 auto; } :root[data-ui="new"] .tabs button.navbtn { min-width: 0; } }

/* Live check 29-11 (real data, 1366 px): the action column fits the Documents button; interceptions without the release
   checkboxes get room for the Bond sheet status + duty. */
.cc-table:not(.fyco-table):not(.rel-table):not(.no-status) th:nth-child(7), .cc-table:not(.fyco-table):not(.rel-table):not(.no-status) td:nth-child(7) { width: max(11em, 140px); }
.rel-table.no-sel th:nth-child(1), .rel-table.no-sel td:nth-child(1) { width: 17%; }
.rel-table.no-sel th:nth-child(2), .rel-table.no-sel td:nth-child(2) { width: 12%; }
.rel-table.no-sel th:nth-child(3), .rel-table.no-sel td:nth-child(3) { width: 18%; }
.rel-table.no-sel th:nth-child(4), .rel-table.no-sel td:nth-child(4) { width: 15%; }
.rel-table.no-sel th:nth-child(5), .rel-table.no-sel td:nth-child(5) { width: 14%; }
.rel-table.no-sel th:nth-child(6), .rel-table.no-sel td:nth-child(6) { width: 9%; }
.rel-table.no-sel th:nth-child(7), .rel-table.no-sel td:nth-child(7) { width: auto; }
.cc-table.no-status td.num-cell { white-space: normal; }

/* Bond sheet tab (29-11). */
.bd-table td.num { text-align: right; white-space: nowrap; }
.bd-table td { white-space: nowrap; }

/* Header search box (29-11). */
.hdr-search { display: flex; flex: 1 1 260px; max-width: 640px; min-width: 0; gap: 0; margin: 0 auto; }
.hdr-search input { flex: 1 1 auto; min-width: 0; border-radius: 6px 0 0 6px; padding: 4px 10px; font-size: 0.93rem; }
.hdr-search .hdr-go { border-radius: 0 6px 6px 0; padding: 4px 12px; white-space: nowrap; }
:root:not([data-ui="new"]) .hdr-search { order: 2; margin: 0 0 0 auto; }
:root[data-ui="new"] .hdr-search input { background: #f6f3e7; border: 1px solid #56693b; color: #1f2a14; }
:root[data-ui="new"] .hdr-search input::placeholder { color: #6f7660; }
:root[data-ui="new"] .hdr-search .hdr-go { background: var(--gold); color: var(--brand); border: 1px solid var(--gold); font-weight: 600; }
@media (max-width: 760px) { .hdr-search { order: 5 !important; flex: 1 1 100%; max-width: none; margin: 4px 0 0; } }
.day-input { width: 8.5em; }

/* Transfers without number: next number box, search, GHA list (29-11). */
.tr-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 6px; }
.next-box { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 8px 14px; border: 2px solid #56693b; border-radius: 8px; background: #f3f6ea; }
.next-lbl { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #56693b; }
.next-no { font-size: 1.5rem; font-weight: 700; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; color: #1f2a14; line-height: 1.2; }
.next-last { flex-basis: 100%; color: #4a5040; }
.tr-tools { margin: 6px 0 8px; align-items: center; } .tr-tools input[type=search] { flex: 0 1 380px; min-width: 0; }
.tr-gha { max-width: 15em; } .tr-gha.changed { outline: 2px solid #c9a227; }
.tr-dt { margin-top: 2px; white-space: nowrap; }
@media (prefers-color-scheme: dark) { .next-box { background: #26301a; } .next-no { color: #f1f5e6; } .next-lbl, .next-last { color: #c8d3b0; } }

/* Customs e-mail per transfer (29-11). */
.tm-mail { border: 1px solid var(--line, #d8d8d0); border-radius: 6px; padding: 8px 12px; margin: 8px 0; max-height: 50vh; overflow: auto; }
.tm-table td { padding: 2px 8px; }

button.danger { background: #b3261e; border: 1px solid #b3261e; color: #fff; }
button.danger:hover { background: #8f1e18; }
.tm-mail h3, #rep-dialog h3 { margin: 12px 0 4px; }
#rep-dialog .note, #rep-dialog .error { overflow-wrap: anywhere; }
.bd-actions { white-space: nowrap; } .bd-actions .small-btn + .small-btn { margin-left: 4px; }
/* Transfers without number: compact rows (Gani 30-11) */
.tr-table th, .tr-table td { padding: 4px 6px; vertical-align: middle; }
.tr-table td { line-height: 1.25; }
.tr-table select, .tr-table input[type=text] { padding: 3px 6px; min-height: 0; height: 28px; font-size: 13px; }
.tr-table .tr-gha { width: 11.5em; }
.tr-table .rep-no { width: 9.5em; } .tr-table .time-input { width: 9.5em; }
.tr-table .rep-time { flex-wrap: nowrap; gap: 4px; }
.tr-table .small-btn { padding: 3px 8px; white-space: nowrap; font-size: 12.5px; }
.tr-table .tr-dt { font-size: 11.5px; margin-top: 1px; }
.tr-table td:nth-child(3) { white-space: nowrap; font-size: 13px; }
/* Narrow screens (Gani 30-11: nothing may run over each other): the CC check tables scroll sideways inside their box,
   so let the columns take the width their content needs instead of fixed percentages (text and bars overlapped). */
@media (max-width: 1100px) {
  .table-wrap > table.cc-table { table-layout: auto; }
  .table-wrap > table.cc-table th, .table-wrap > table.cc-table td { width: auto; }
}
.tr-table .tr-dt { white-space: normal; max-width: 14em; }
/* Classic look on a phone: the screen menu on one line that scrolls sideways (it took 2 lines + half the screen). */
@media (max-width: 760px) {
  :root:not([data-ui="new"]) .tabs { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; padding-bottom: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
  :root:not([data-ui="new"]) .tabs button { white-space: nowrap; flex: 0 0 auto; padding: 6px 10px; }
  :root:not([data-ui="new"]) .topbar { padding: 8px 12px; gap: 8px; }
}
body.on-search .hdr-search { display: none; }
/* Interceptions with the per-row "Release" (Gani 30-11): room for the time column and the button */
.rel-table:not(.no-sel) th:nth-child(2), .rel-table:not(.no-sel) td:nth-child(2) { width: 17%; }
.rel-table:not(.no-sel) th:nth-child(4), .rel-table:not(.no-sel) td:nth-child(4) { width: 14%; }
.rel-table:not(.no-sel) th:nth-child(5), .rel-table:not(.no-sel) td:nth-child(5) { width: 13%; }
.rel-table:not(.no-sel) th:nth-child(6), .rel-table:not(.no-sel) td:nth-child(6) { width: 12%; }
.rel-table:not(.no-sel) th:nth-child(9), .rel-table:not(.no-sel) td:nth-child(9) { width: 6.5em; }
.rel-table td.action-cell .small-btn { white-space: nowrap; }
/* Today with tiles per kind (Gani 30-11) */
.today-summary { flex: 1 1 100%; display: block; }
.today-tiles { grid-template-columns: repeat(auto-fill, minmax(10.5em, 1fr)); gap: 8px; margin: 0; }
.today-tiles .tile { padding: 8px 12px; text-align: left; cursor: pointer; border-left-width: 4px; }
.today-tiles .tile-num { font-size: 1.5rem; line-height: 1.1; }
.today-tiles .tile-label { font-weight: 600; }
.today-tiles .t-danger { border-left-color: var(--danger); } .today-tiles .t-danger .tile-num { color: var(--danger); }
.today-tiles .t-warn { border-left-color: var(--warn); } .today-tiles .t-warn .tile-num { color: var(--warn); }
.today-tiles .t-info, .today-tiles .t-all { border-left-color: var(--line); }
/* one kind shown: the tag column is the tile already, so leave it out and keep the rows tight */
.today-list.one-kind .today-tag { display: none; }
.today-list.one-kind .today-item { grid-template-columns: minmax(0, 1fr) auto; padding-top: 6px; padding-bottom: 6px; }
:root[data-ui="new"] .today-list.one-kind .today-item { grid-template-columns: minmax(0, 1fr) minmax(20em, 34em); }
@media (max-width: 760px) { .today-list.one-kind .today-item, :root[data-ui="new"] .today-list.one-kind .today-item { grid-template-columns: 1fr; }
  .today-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .today-tiles .tile-short { display: none; } }
@media (max-width: 760px) {
  .today-tiles { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 8.2em; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
  .today-tiles .tile { padding: 6px 10px; } .today-tiles .tile-num { font-size: 1.2rem; } .today-tiles .tile-label { font-size: 0.82rem; line-height: 1.2; }
}
.today-summary, .today-tiles { min-width: 0; max-width: 100%; }
/* Compact tiles (Gani 30-11: "nemen onnodig ruimte in"): number and label on one line, the explanation as tooltip */
.today-tiles .tile, :root[data-ui="new"] .today-tiles .tile { display: flex; align-items: baseline; gap: 6px; padding: 5px 10px; min-height: 0; }
.today-tiles .tile-num, :root[data-ui="new"] .today-tiles .tile-num { font-size: 1.15rem; line-height: 1.2; }
.today-tiles .tile-label { font-size: 0.86rem; line-height: 1.2; white-space: nowrap; }
.today-tiles .tile-short { display: none !important; }
.today-tiles { grid-template-columns: repeat(auto-fill, minmax(12.5em, 1fr)); gap: 6px; }
@media (max-width: 760px) { .today-tiles { grid-auto-columns: max-content; } }
/* Blocked before clicking (Gani 30-11) + WhatsApp alert button */
.blocked-why { margin-top: 3px; font-size: 0.82rem; color: var(--danger); white-space: normal; max-width: 34em; }
.blocked-why .chip { font-weight: 600; }
.noa-warn { color: var(--warn); margin-top: 2px; }
.wa-btn .wa-ico { color: var(--danger); font-weight: 700; }
.today-listbar { display: flex; justify-content: flex-end; padding: 6px 12px; border-bottom: 1px solid var(--line); }
/* balance check before release */
.bal-check { margin: 6px 0; }
.bal-table { border-collapse: collapse; font-size: 0.86rem; }
.bal-table th, .bal-table td { padding: 3px 10px 3px 0; text-align: left; white-space: nowrap; }
.bal-table td:nth-child(n+2), .bal-table th:nth-child(n+2) { text-align: right; }
.bal-table tr.neg td { color: var(--danger); font-weight: 600; }
.pk-bar { display: flex; justify-content: flex-end; margin: 0 0 6px; }
.stale-ata { color: var(--danger); font-weight: 600; margin-top: 2px; }
/* Today: shift numbers + "I'm on it" (Gani 30-11) */
.today-stats { font-size: 0.86rem; color: var(--muted); margin: 0 0 6px; }
.today-stats b { color: var(--text); }
.claim-other { background: var(--warn-bg); color: var(--warn); font-weight: 600; white-space: nowrap; }
.claim-me { background: #e3f1e7; color: var(--ok); font-weight: 600; white-space: nowrap; }
.claim-mine { display: inline-flex; gap: 4px; align-items: center; }
