/* Office dispatch site. Colours, buttons and status tags come from /shared/theme.css. */
html, body { height: 100%; }
body { display: flex; flex-direction: column; overflow: hidden; font-size: 13px; }
[hidden] { display: none !important; }
.spacer { flex: 1; }
.ell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pad { padding: 12px; }
.label { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.warn { color: var(--danger); font-weight: 600; }
.error { color: var(--danger); min-height: 1.4em; font-weight: 600; }
.small { padding: 3px 9px; font-size: 12px; }
.muted-light { color: var(--muted); font-size: 12px; }

/* header */
.app { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.top { background: var(--surface); color: var(--text); display: flex; align-items: stretch; gap: 14px; padding: 0 16px; min-height: 48px; border-bottom: 1px solid var(--line); flex-wrap: nowrap; }
.top > * { align-self: center; }
.logo { display: block; height: 28px; width: auto; }
.tabs { display: flex; gap: 4px; align-self: stretch; }
.tab { background: transparent; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--muted); padding: 0 7px; font-weight: 600; font-size: 13px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--nf-blue); border-bottom-color: var(--nf-blue); }
.top .fms { display: flex; align-items: center; gap: 10px; }
.who { font-weight: 600; padding-left: 12px; border-left: 1px solid var(--line); }

main { flex: 1; min-height: 0; position: relative; display: flex; }
.page { flex: 1; overflow: auto; padding: 20px 24px; }
.page h2 { margin-bottom: 12px; font-size: 18px; }

/* tables */
.tbl { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); }
.tbl th, .tbl td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { background: var(--surface-2); color: var(--muted); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; }
.tbl.small th, .tbl.small td { padding: 5px 8px; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover { background: var(--nf-blue-soft); }
.tbl tr.inactive { color: var(--muted); }
.actions { display: flex; gap: 6px; }
/* In a table the buttons cell must stay a table cell, or it drifts out of line with its row (flex turns it into a loose box). */
td.actions { display: table-cell; white-space: nowrap; }
td.actions > * + * { margin-left: 6px; }
.conlink { font-weight: 600; color: var(--nf-blue); }

/* forms */
label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 10px; }
label.check { flex-direction: row; align-items: center; gap: 6px; font-size: 13px; align-self: center; color: var(--text); }
input, select, textarea { border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 6px 8px; background: var(--surface); font-weight: 400; font-size: 13px; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--nf-blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--nf-blue) 18%, transparent); }
input[type="search"] { min-width: 320px; }
.form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin: 8px 0 12px; }
.form-row label { margin-bottom: 0; }
.dialog { border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 12px 40px rgba(16, 24, 40, .18); padding: 20px; width: 380px; }
.dialog::backdrop { background: rgba(16, 24, 40, .45); }

/* sign in */
.signin { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; z-index: 50; }
.signin-box { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--nf-blue); border-radius: 6px; box-shadow: 0 12px 40px rgba(16, 24, 40, .08); padding: 28px; width: 320px; display: flex; flex-direction: column; gap: 12px; }
.signin-box .logo { height: 48px; margin: 0 auto 4px; }
.signin-box input { font-size: 22px; text-align: center; letter-spacing: .4em; padding: 8px; }
.pad-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.key { font-size: 16px; font-weight: 500; padding: 10px 0; box-shadow: none; }
.wide { width: 100%; padding: 10px; font-size: 14px; }

/* schedule board */
.board { flex: 1; display: flex; min-width: 0; }
.unalloc { width: 296px; flex: none; display: flex; flex-direction: column; background: var(--surface-2); border-right: 1px solid var(--line); padding: 12px; gap: 10px; }
.unalloc h2, .unalloc h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.unalloc.over { outline: 2px dashed var(--nf-blue); outline-offset: -2px; }
.unalloc input { min-width: 0; width: 100%; }
.unalloc-list { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.board-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.toolbar { display: flex; gap: 6px; align-items: center; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.range { margin: 0 10px; font-weight: 600; }
.seg { box-shadow: none; }
.seg.on { background: var(--nf-blue-soft); color: var(--nf-blue); border-color: var(--nf-blue); }
.grid-wrap { flex: 1; overflow: auto; background: var(--surface); }
.grid { display: grid; }
.drv.inactive { background: var(--warn-soft); }
.hd { position: sticky; top: 0; z-index: 2; background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; padding: 7px 10px; border-bottom: 1px solid var(--line-strong); border-right: 1px solid var(--line); }
.hd.weekend { background: #f1f2f5; }
.hd.today { color: var(--nf-blue); box-shadow: inset 0 2px 0 var(--nf-blue); background: var(--nf-blue-soft); }
.hd.corner { left: 0; z-index: 3; }
.drv { position: sticky; left: 0; z-index: 1; background: var(--surface); padding: 8px 10px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line-strong); }
.drv strong, .drv b { font-weight: 600; }
.cell { min-height: 80px; padding: 4px; display: flex; flex-direction: column; gap: 4px; background: var(--surface); border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); min-width: 0; }
.cell.weekend { background: var(--surface-2); }
.cell.today { background: color-mix(in srgb, var(--nf-blue) 4%, var(--surface)); }
.cell.over { outline: 2px dashed var(--nf-blue); outline-offset: -2px; background: var(--nf-blue-soft); }
.card { background: var(--surface); border: 1px solid var(--line-strong); border-left: 3px solid var(--muted); border-radius: 3px; padding: 5px 8px; font-size: 12px; line-height: 1.4; cursor: pointer; min-width: 0; }
.card[draggable="true"] { cursor: grab; }
.card:hover { border-color: var(--nf-blue); box-shadow: 0 2px 6px rgba(16, 24, 40, .1); }
.card strong, .card b { font-weight: 600; }
.card[data-status="allocated"] { border-left-color: var(--st-allocated); }
.card[data-status="accepted"] { border-left-color: var(--st-accepted); }
.card[data-status="in_progress"] { border-left-color: var(--st-in_progress); }
.card[data-status="delivered"] { border-left-color: var(--st-delivered); }
.card[data-status="invoiced"] { border-left-color: var(--st-invoiced); }
.card .pill { font-size: 9.5px; padding: 0 5px; }
.wait { display: inline-block; margin-top: 3px; background: var(--danger-soft); color: var(--danger); border-radius: 3px; padding: 0 6px; font-size: 11px; font-weight: 600; }

/* con note panel */
.detail { position: absolute; top: 0; right: 0; bottom: 0; width: min(600px, 100%); background: var(--surface); box-shadow: -8px 0 30px rgba(16, 24, 40, .12); overflow: auto; z-index: 10; border-left: 1px solid var(--line-strong); }
.detail .close { position: sticky; top: 10px; float: right; margin: 10px; z-index: 1; }
.detail-body { padding: 20px 24px 40px; }
.detail-body h2 { font-size: 22px; color: var(--text); }
.detail-body section { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 12px; }
.detail-body h3 { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 8px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; margin-top: 12px; }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; padding: 8px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.four { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.timebox { border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 8px; background: var(--surface-2); }
.timebox strong { display: block; font-size: 18px; font-weight: 600; }
.tick { padding: 2px 0; color: var(--muted); }
.tick.on { color: var(--ok); font-weight: 600; }
.callout { background: var(--warn-soft); border-left: 3px solid var(--nf-orange); border-radius: 0 var(--radius) var(--radius) 0; padding: 8px 12px; margin-top: 12px; white-space: pre-wrap; }
.detail textarea { width: 100%; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 4px 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.when { display: inline-block; width: 120px; color: var(--muted); }
.sig { display: block; max-width: 100%; max-height: 160px; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 6px; background: var(--surface); }
.detail a.btn { display: inline-block; margin-top: 8px; text-decoration: none; color: var(--nf-blue); }

/* messages */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--nf-black); color: #fff; padding: 9px 16px; border-radius: var(--radius); box-shadow: 0 8px 24px rgba(16, 24, 40, .25); z-index: 100; max-width: 80vw; font-weight: 500; }
.toast.bad { background: var(--danger); }

@media (max-width: 1100px) {
  .unalloc { width: 240px; }
  input[type="search"] { min-width: 200px; }
}

/* tablets */
.enrol { text-align: center; padding: 8px 0; }
.qr svg { width: 260px; height: 260px; display: block; margin: 0 auto; }
.code { font: 600 30px/1.3 Consolas, "Courier New", monospace; letter-spacing: .25em; margin: 8px 0 2px; }
.countdown { color: var(--muted); font-weight: 600; }
.done { color: var(--ok); background: var(--ok-soft); border-radius: var(--radius); padding: 24px; font-size: 20px; font-weight: 600; margin: 0; }
.dialog:has(.enrol) { width: 420px; }

/* fleet, audit, conflicts */
.nowrap { white-space: nowrap; }
.tel { color: var(--nf-blue); text-decoration: none; }
.tel:hover { text-decoration: underline; }
.linkish { border: 0; background: none; padding: 0; color: var(--nf-blue); font-size: 12px; }
.fleet { font-weight: 600; font-size: 11px; }
.clash { color: var(--warn); background: var(--warn-soft); border-radius: 3px; padding: 0 6px; font-size: 11px; font-weight: 600; margin-top: 3px; }
.strip { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 6px 12px; background: var(--warn-soft); border-bottom: 1px solid var(--line); color: var(--warn); font-weight: 600; }
.strip summary { cursor: pointer; }
.strip ul { margin: 6px 0 0; padding-left: 18px; font-weight: 400; color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line-strong); background: var(--surface-2); border-radius: 3px; padding: 1px 4px 1px 8px; font-weight: 600; }
.chip button { border: 0; background: none; color: var(--muted); padding: 0 4px; }
details.history > summary { cursor: pointer; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
details.history .tbl { margin-top: 8px; }

/* alerts, live, availability */
.alertbar { display: flex; gap: 16px; align-items: flex-start; padding: 8px 16px; background: var(--danger-soft); border-left: 4px solid var(--danger); border-bottom: 1px solid var(--line); }
.alertbar .count { color: var(--danger); white-space: nowrap; }
.alertbar .alert-lines { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.alert-line { display: flex; gap: 8px; align-items: center; }
.alert-line > span { flex: 0 1 auto; }
.alert-line .btn { margin-left: auto; }
.alertbar.flash { animation: flash 1s ease-in-out 3; }
@keyframes flash { 50% { background: color-mix(in srgb, var(--danger) 28%, var(--surface)); } }
.livedriver { background: var(--surface); border: 1px solid var(--line); margin-bottom: 12px; }
.livedriver > .row { padding: 8px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.livejob { display: grid; grid-template-columns: 260px 1fr 220px; gap: 16px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.livejob:last-child { border-bottom: 0; }
.track { display: flex; gap: 2px; }
.step { flex: 1; text-align: center; font-size: 10.5px; padding: 4px 2px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step.done { background: var(--nf-blue-soft); border-color: var(--nf-blue); color: var(--nf-blue); }
.step.now { background: var(--nf-blue); border-color: var(--nf-blue); color: #fff; font-weight: 600; }
.avail { margin-bottom: 24px; }
.avail .row { margin-bottom: 8px; }
.cell.away { background: repeating-linear-gradient(135deg, var(--surface-2), var(--surface-2) 6px, var(--line) 6px, var(--line) 7px); }
.awaylabel { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.top .fms { min-width: 0; }
.top .fms .muted-light { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .btn { white-space: nowrap; }
.who { white-space: nowrap; padding-left: 10px; }
.top { gap: 10px; }
.top .fms { gap: 8px; flex: 0 1 auto; }

/* legs */
.card .row .ell { min-width: 0; flex: 1; }
.leg { border: 1px solid var(--line); border-left: 3px solid var(--nf-blue); border-radius: var(--radius); padding: 8px 12px; margin: 10px 0; background: var(--surface-2); }
.legplaces { margin: 4px 0; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.legmark { display: block; font-weight: 600; }

/* schedule parity: sections, other work, holidays */
.sect { grid-column: 1 / -1; position: sticky; left: 0; padding: 4px 10px; background: var(--nf-blue-soft); border-bottom: 1px solid var(--line-strong); font-weight: 600; }
.sectbtn { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--nf-blue); }
.drv .etag { margin-left: 4px; }
.etag { display: inline-block; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 3px; padding: 0 5px; }
.etag.warn { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.entry { background: color-mix(in srgb, var(--muted) 7%, var(--surface)); border: 1px solid var(--line-strong); border-left: 3px solid var(--muted); border-radius: 3px; padding: 4px 8px; font-size: 12px; cursor: pointer; min-width: 0; }
.entry[draggable="true"] { cursor: grab; }
.entry.tentative { border-style: dashed; }
.entry.cont { padding: 2px 8px; color: var(--muted); }
.entry strong { font-weight: 600; display: block; }
.cellplus { position: absolute; right: 3px; bottom: 3px; width: 20px; height: 20px; padding: 0; line-height: 1; border: 1px solid var(--line-strong); border-radius: 3px; background: var(--surface); color: var(--muted); opacity: 0; }
.cell { position: relative; }
.cell:hover .cellplus, .cellplus:focus-visible { opacity: 1; }
.empty { display: none; }
.dragging-entry .cell.empty { display: flex; }
.dragging-entry .drv.empty { display: block; }
.drv.wait, .cell.wait { background: var(--warn-soft); }
.hd.holiday, .cell.holiday { background: color-mix(in srgb, var(--nf-orange) 9%, var(--surface)); }
.holname { font-size: 10px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--warn); }

/* menus, wide dialogs */
.menu { position: fixed; z-index: 200; min-width: 150px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(16, 24, 40, .15); padding: 3px; display: flex; flex-direction: column; }
.menuitem { text-align: left; border: 0; background: none; padding: 6px 10px; border-radius: 3px; font-size: 13px; }
.menuitem:hover, .menuitem:focus { background: var(--nf-blue-soft); outline: 0; }
.dialog.wide { width: 480px; }
.dialog textarea { width: 100%; }

/* lost work and competencies */
.breakdown { width: auto; min-width: 280px; }
.matrix-page { display: flex; flex-direction: column; }
.matrix-wrap { overflow: auto; flex: 1; border: 1px solid var(--line); background: var(--surface); }
.matrix { border-collapse: separate; border-spacing: 0; }
.matrix th, .matrix td { padding: 4px 6px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); background: var(--surface); }
.matrix thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); vertical-align: bottom; min-width: 92px; max-width: 110px; font-size: 11px; text-align: left; }
.matrix th.who, .matrix thead th:first-child { position: sticky; left: 0; z-index: 1; min-width: 190px; text-align: left; white-space: nowrap; }
.matrix thead th:first-child { z-index: 3; }
.compname { white-space: normal; font-weight: 600; }
.matrix tr.sect td { background: var(--nf-blue-soft); font-weight: 600; color: var(--nf-blue); }
.matrix select.status { border: 1px solid var(--line); padding: 2px 2px; font-size: 12px; width: 88px; }
.matrix select[data-status="passed"] { background: var(--ok-soft); color: var(--ok); }
.matrix select[data-status="in_training"] { background: var(--warn-soft); color: var(--warn); }
.matrix select[data-status="failed"] { background: var(--danger-soft); color: var(--danger); }
.matrix select[data-status="not_assessed"] { background: var(--surface-2); color: var(--muted); }
.matrix select[data-status="na"] { background: var(--surface); border-color: var(--line); }
.saved { color: var(--ok); font-weight: 700; margin-left: 3px; }
.breakdown { margin-bottom: 16px; }
/* a long stage name must stay inside its card */
/* flex-shrink 0: with overflow hidden a card may otherwise be squeezed flat when a list is long; the list scrolls instead */
.card { overflow: hidden; flex-shrink: 0; }
.card .pill { max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }

/* notes the driver never sees: blue rule instead of orange, so the two boxes are told apart at a glance */
.callout.office-only { background: var(--nf-blue-soft); border-left-color: var(--nf-blue); }
