/* Crewmark application, wide screens first. The phone app layout is in mobile.css. */
.app-body { --bar: 40px; }
.app-body .demo-bar { position: sticky; top: 0; z-index: 15; height: var(--bar); flex-wrap: nowrap; white-space: nowrap; }
.pill { margin-left: auto; }
.pill { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 99px; background: var(--soft); color: var(--ink); font-size: 12px; font-weight: 600; line-height: 20px; text-align: center; }
.pill-accent { background: var(--accent); color: #fff; }
.sidebar-foot { display: grid; gap: 6px; margin-top: auto; }
.whoami { display: flex; align-items: center; gap: 10px; padding: 12px 4px 4px; border-top: 1px solid #45484d; line-height: 1.3; }
.whoami strong { display: block; color: #fff; font-size: 14.5px; }
.whoami div span { font-size: 13px; color: #b4b6ba; }
.avatar { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 8px; background: var(--accent-tint); color: var(--accent-dark); font-size: 13.5px; font-weight: 700; }
.side-btn { display: flex; align-items: center; gap: 9px; min-height: 34px; padding: 0 8px; border: 0; border-radius: 6px; background: none; color: #cbcbc6; font-size: 14px; cursor: pointer; text-align: left; }
.side-btn:hover { background: #35383c; color: #fff; }
.scrim { display: none; }
.workspace { min-width: 0; }
.topbar { position: sticky; top: var(--bar); z-index: 10; display: flex; align-items: center; gap: 14px; height: 60px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--bg); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.menu-btn { display: none; }
.global-search { position: relative; flex: 1; max-width: 430px; }
.global-search > .icon { position: absolute; left: 12px; top: 11px; color: var(--ink-2); }
.global-search input { width: 100%; height: 40px; padding: 0 12px 0 38px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.results, .popover { position: absolute; z-index: 20; top: 46px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: 0 14px 32px -12px rgba(32, 33, 36, .35); }
.results { left: 0; right: 0; padding: 6px; }
.results a, .popover li a { display: block; padding: 8px 10px; border-radius: 6px; color: var(--ink); text-decoration: none; }
.results a:hover, .popover li a:hover { background: var(--accent-tint); }
.results span, .popover li span { display: block; font-size: 13.5px; color: var(--ink-2); }
.results .none { padding: 8px 10px; color: var(--ink-2); }
.site-chip { display: inline-flex; align-items: center; gap: 7px; margin-left: auto; color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.bell-wrap { position: relative; }
.popover { right: 0; width: min(340px, calc(100vw - 28px)); padding: 12px; }
.popover h2 { font-size: 14.5px; padding: 0 10px 6px; }
.popover p { padding: 0 10px 8px; }
.popover-all { display: block; padding: 8px 10px 2px; font-weight: 600; font-size: 14px; }
.dot { position: absolute; top: -6px; right: -6px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 11.5px; font-weight: 700; line-height: 19px; text-align: center; }

.content { max-width: 1280px; padding: 22px 24px 56px; }
.content > * + * { margin-top: 16px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.page-head h1, .record-head h1, .locked h1 { font: 700 29px/1.15 var(--head); letter-spacing: .002em; }
.page-head p { color: var(--ink-2); margin-top: 2px; }
.page-actions, .actionbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.actionbar:empty { display: none; }
.back { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; font-weight: 600; text-decoration: none; font-size: 14.5px; }
.back + .record-head { margin-top: 4px; }
.record-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.record-head > div:first-child { min-width: 0; }
.record-head p { color: var(--ink-2); }
.record-id { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 2px; }
.record-id .sku { font-size: 14px; color: var(--ink); }
.section-title, .card h2, .card-head h2 { font: 700 18px/1.25 var(--head); letter-spacing: .005em; }

.card { min-width: 0; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin-bottom: 10px; }
.card-head a { font-size: 14px; font-weight: 600; }
.card h2 + * { margin-top: 10px; }
.card-head + * { margin-top: 0; }
.columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.columns-wide { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.columns-one { grid-template-columns: minmax(0, 1fr); }
.column { display: grid; gap: 16px; min-width: 0; }
.muted { color: var(--ink-2); }
.hint { margin-top: 10px; color: var(--ink-2); font-size: 14px; }
.late { color: var(--danger); font-weight: 600; }
.upnote { color: var(--info); }
.up { color: var(--ok); }
.down { color: var(--danger); }
.nowrap { white-space: nowrap; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.stat { display: flex; flex-direction: column; padding: 13px 18px; color: var(--ink); text-decoration: none; box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); }
.stat:hover { background: #fdf1ea; }
.stat-name { font-size: 14px; color: var(--ink-2); font-weight: 500; }
.stat-value { font: 700 32px/1.2 var(--head); font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 13.5px; color: var(--ink-2); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 5px; font-size: 13px; font-weight: 600; line-height: 1.55; white-space: nowrap; }
.badge .icon { width: 13px; height: 13px; }
.tone-ok { background: var(--ok-tint); color: var(--ok); }
.tone-neutral { background: var(--soft); color: #3c3e43; }
.tone-warn { background: var(--warn-tint); color: var(--warn); }
.tone-danger { background: var(--danger-tint); color: var(--danger); }
.tone-info { background: var(--info-tint); color: var(--info); }
.tone-wait { background: var(--wait-tint); color: var(--wait); }

/* Filters */
.filterbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; }
.filter-selects { display: flex; flex-wrap: wrap; gap: 10px; }
.filter-selects:empty { display: none; }
.filter { display: grid; gap: 2px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.filter select { min-height: 40px; max-width: 100%; padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); color: var(--ink); font-size: 14.5px; font-weight: 400; }
.filter-inline select { min-height: 36px; }
.searchfield { display: flex; align-items: center; gap: 9px; flex: 1 1 250px; max-width: 380px; min-height: 40px; padding: 0 12px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); color: var(--ink-2); }
.searchfield:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-tint); }
.searchfield input { flex: 1; min-width: 0; height: 38px; border: 0; background: none; color: var(--ink); outline: none; }
.tabs { display: flex; gap: 4px; max-width: 100%; padding: 4px; overflow-x: auto; background: var(--soft); border-radius: 10px; scrollbar-width: none; overscroll-behavior-x: contain; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 7px; flex: none; min-height: 34px; padding: 0 12px; border: 0; border-radius: 7px; background: none; color: var(--ink-2); font-size: 14.5px; font-weight: 600; white-space: nowrap; cursor: pointer; user-select: none; }
.tab.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(32, 33, 36, .18); }
.segmented { display: inline-flex; gap: 3px; padding: 4px; border-radius: 10px; background: var(--soft); }
.segmented button { min-height: 38px; padding: 0 18px; border: 0; border-radius: 7px; background: none; color: var(--ink-2); font-weight: 600; cursor: pointer; }
.segmented button.is-on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(32, 33, 36, .18); }
.content > .segmented { display: flex; width: fit-content; max-width: 100%; }
.list-count { margin-bottom: 8px; color: var(--ink-2); font-size: 14px; }

/* Tables */
.table-wrap { overflow-x: auto; overscroll-behavior-x: contain; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; font-variant-numeric: tabular-nums; }
th { padding: 10px 10px; background: #f8f9fa; border-bottom: 1px solid var(--line); color: var(--ink-2); font-size: 13px; font-weight: 600; text-align: left; white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th:first-child, td:first-child { padding-left: 16px; }
th:last-child, td:last-child { padding-right: 16px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr[data-href] { cursor: pointer; }
tbody tr:hover { background: #fcf3ee; }
.num { text-align: right; }
.grow { width: 34%; min-width: 180px; }
@media (min-width: 761px) { td:not(.grow) { white-space: nowrap; } }
th button { display: inline-flex; align-items: center; gap: 5px; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
th button i { width: 0; height: 0; border-inline: 4px solid transparent; }
th button i.up { border-bottom: 5px solid var(--accent); }
th button i.down { border-top: 5px solid var(--accent); }
.cell-main { display: block; line-height: 1.35; }
.cell-main small { display: block; color: var(--ink-2); font-size: 13px; }
.qty { display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px; }
.qty .icon { width: 14px; height: 14px; }
.qty-low { color: var(--warn); font-weight: 700; }
.qty-out { color: var(--danger); font-weight: 700; }
.card:not(.card-flush) > .table-wrap { margin-inline: -18px; }
.card > .table-wrap th:first-child, .card > .table-wrap td:first-child { padding-left: 18px; }
.card > .table-wrap th:last-child, .card > .table-wrap td:last-child { padding-right: 18px; }
.list-empty { padding: 8px; }
.empty { padding: 22px 16px; text-align: center; }
.empty h3 { font-size: 16px; }
.empty p { color: var(--ink-2); margin: 2px 0 0; }
.empty .btn { margin-top: 12px; }
.meter-wrap { display: grid; gap: 3px; min-width: 96px; }
.meter { display: block; height: 6px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); }
.meter-wrap small { font-size: 13px; color: var(--ink-2); white-space: nowrap; }

/* Lists on dashboards */
.feed-icon { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 8px; background: var(--soft); color: var(--accent-dark); }
.feed > li { display: flex; align-items: flex-start; gap: 12px; padding: 9px 0; }
.feed > li + li, .queue > li + li, .approve-list > li + li, .alert-list > li + li, .doc-list > li + li { border-top: 1px solid var(--line); }
.feed > li > div { display: grid; flex: 1; min-width: 0; line-height: 1.4; }
.feed > li > div > span { font-size: 14.5px; }
.feed small { color: var(--ink-2); font-size: 13px; }
.feed > li > b, .feed-end { font-variant-numeric: tabular-nums; }
.feed > li > b { font-size: 16px; }
.feed-end { display: grid; justify-items: end; }
.feed-end b { font-size: 16px; }
.queue a { display: flex; align-items: center; gap: 12px; padding: 11px 0; color: var(--ink); text-decoration: none; }
.queue a:hover strong { color: var(--accent-dark); }
.queue-main { display: grid; flex: 1; min-width: 0; line-height: 1.38; }
.queue-main span { color: var(--ink-2); font-size: 14.5px; }
.queue-main small { font-size: 13px; color: var(--ink-2); }
.queue-main small.late { color: var(--danger); }
.queue-go { display: inline-flex; align-items: center; gap: 2px; flex: none; color: var(--accent-dark); font-weight: 700; font-size: 14.5px; }
.approve-list > li { display: flex; flex-wrap: wrap; gap: 10px 12px; padding: 12px 0; }
.approve-list > li:first-child, .alert-list > li:first-child, .doc-list > li:first-child, .queue > li:first-child a, .feed > li:first-child { padding-top: 2px; }
.approve-main { display: grid; flex: 1 1 220px; min-width: 0; line-height: 1.4; }
.approve-main small { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.approve-main a { font-weight: 700; color: var(--ink); text-decoration: none; }
.approve-main a:hover { color: var(--accent-dark); text-decoration: underline; }
.approve-main span { color: var(--ink-2); font-size: 14.5px; }
.approve-actions { display: flex; gap: 6px; align-self: center; }
.alert-list > li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 10px 0; }
.alert-list > li > a { display: grid; flex: 1 1 230px; min-width: 0; color: var(--ink); text-decoration: none; line-height: 1.4; }
.alert-list > li > a strong { font-size: 15px; font-weight: 600; }
.alert-list small { color: var(--ink-2); font-size: 13.5px; }
.alert-list small .sku { margin-right: 6px; color: var(--ink); }
.alert-list > li > div { display: flex; align-items: center; gap: 8px; }
.doc-list > li > a { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; color: var(--ink); text-decoration: none; }
.doc-list > li > a > span:first-child { display: grid; min-width: 0; line-height: 1.4; }
.doc-list small { color: var(--ink-2); font-size: 13.5px; }
.doc-end { display: grid; justify-items: end; flex: none; font-size: 14px; font-weight: 600; }
.doc-end em { font-style: normal; color: var(--danger); font-size: 13px; }
.lane { display: flex; align-items: center; gap: 7px; }
.lane .icon { width: 16px; height: 16px; color: var(--accent); }

.locked { max-width: 520px; margin: 48px auto; text-align: center; }
.locked > .icon { width: 36px; height: 36px; margin: 0 auto 12px; color: var(--accent); }
.locked p { margin: 8px 0 18px; color: var(--ink-2); }

/* Role choice */
.signin { max-width: 760px; margin: 0 auto; padding: 44px 20px 64px; text-align: center; }
.signin h1 { margin-top: 30px; font: 700 clamp(28px, 4vw, 38px)/1.12 var(--head); }
.signin-sub { max-width: 52ch; margin: 8px auto 0; color: var(--ink-2); }
.roles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 24px; text-align: left; }
.role { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; width: 100%; height: 100%; padding: 22px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; text-align: left; cursor: pointer; transition: border-color .15s, transform .15s; }
.role:hover { border-color: var(--accent); transform: translateY(-2px); }
.role-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 10px; background: var(--accent-tint); color: var(--accent-dark); }
.role-icon .icon { width: 24px; height: 24px; }
.role-title { margin-top: 10px; font: 700 22px/1.2 var(--head); }
.role-name { color: var(--accent-dark); font-weight: 600; }
.role-points { display: grid; gap: 7px; margin-top: 12px; color: var(--ink-2); }
.role-points > span { display: flex; gap: 8px; }
.role-points .icon { width: 16px; height: 16px; margin-top: 3px; color: var(--ok); }
.noscript { padding: 40px; text-align: center; }

/* Popups: the title and buttons stay in view while the fields scroll */
dialog { width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: 12px; color: var(--ink); overflow: hidden; box-shadow: 0 30px 70px -20px rgba(32, 33, 36, .55); }
dialog::backdrop { background: rgba(28, 29, 32, .58); }
dialog form { display: flex; flex-direction: column; max-height: calc(100dvh - 24px); }
.modal-head { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font: 700 20px/1.2 var(--head); }
.modal-body { min-height: 0; padding: 16px 18px; overflow-y: auto; overscroll-behavior: contain; }
.modal-body > * + * { margin-top: 12px; }
.modal-foot { display: flex; flex: none; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.wide { grid-column: 1 / -1; }
.modal-note { color: var(--ink-2); }
.modal-note strong { color: var(--ink); }
.field { display: grid; gap: 4px; min-width: 0; }
.field > span { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.field em { font-style: normal; font-weight: 400; }
.field input, .field select, .field textarea { width: 100%; min-width: 0; min-height: 42px; padding: 8px 11px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); }
.field input:disabled { background: var(--soft); }
.field textarea { resize: vertical; }
.field [aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.error { display: block; color: var(--danger); font-size: 13.5px; font-weight: 600; }
.error:empty { display: none; }
.form-error { padding: 9px 12px; border-radius: var(--radius); background: var(--danger-tint); color: var(--danger); font-weight: 600; }
.linerows { display: grid; gap: 10px; }
.linerow { display: grid; grid-template-columns: minmax(0, 1fr) 100px 40px; gap: 8px; align-items: start; }
.linerow.has-cost { grid-template-columns: minmax(0, 1fr) 92px 112px 40px; }
.linerow-x { margin-top: 23px; height: 42px; }
.check { display: flex; align-items: flex-start; gap: 10px; min-height: 40px; padding: 8px 0; cursor: pointer; }
.check input { flex: none; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); }
.checklist legend, .sitegrid legend { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.checklist > div { margin-top: 4px; border-top: 1px solid var(--line); }
.checklist .check { border-bottom: 1px solid var(--line); }
.checklist .sku { margin-right: 6px; color: var(--accent-dark); }
.sitegrid > .form-grid { margin-top: 10px; }
.sitegrid .hint { margin-top: 2px; }

.toasts { position: fixed; z-index: 60; right: 16px; bottom: 16px; display: grid; gap: 8px; max-width: min(400px, calc(100vw - 32px)); pointer-events: none; }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 15px; border-radius: var(--radius); background: var(--navy); color: #fff; box-shadow: 0 12px 28px -12px rgba(32, 33, 36, .6); }
.toast .icon { margin-top: 2px; color: #9fd6a6; }
.toast-warn .icon { color: #ffc35c; }

@media (max-width: 1240px) {
  .hide-md { display: none; }
}
@media (max-width: 1120px) {
  .columns, .columns-wide { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sitecards-3 dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .loc-grid, .supplier-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sitecards-1 dl { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
    .loc-grid { grid-template-columns: minmax(0, 1fr); }
  .sitecards-3, .sitecards-2 { grid-template-columns: minmax(0, 1fr); }
  .sitecards-3 dl, .sitecards-2 dl { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .roles { grid-template-columns: minmax(0, 1fr); }
  .linerow, .linerow.has-cost { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
  .linerow-item { grid-column: 1 / -1; }
  .linerow:not(.has-cost) > .field:nth-of-type(2) { grid-column: 1 / 3; }
  .linerow-x { width: 44px; height: 44px; }
}

.role-short { display: none; }

/* ---------------- Crewmark: dispatcher rail, schedule board, work order ---------------- */
.shell { display: grid; grid-template-columns: 88px minmax(0, 1fr); min-height: calc(100vh - var(--bar)); }
.rail { position: sticky; top: var(--bar); align-self: start; display: flex; flex-direction: column; align-items: stretch; gap: 10px; height: calc(100vh - var(--bar)); padding: 10px 6px; background: var(--navy); overflow-y: auto; scrollbar-width: none; }
.rail .brand { flex-direction: column; gap: 4px; color: #fff; font-size: 14px; }
.rail nav ul { display: grid; gap: 2px; }
.rail nav a, .rail-foot button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; width: 100%; min-height: 51px; padding: 4px 2px; border: 0; border-radius: var(--radius); background: none; color: #c3cad0; font-size: 12px; font-weight: 500; line-height: 1.15; text-align: center; text-decoration: none; cursor: pointer; }
.rail nav a:hover, .rail-foot button:hover { background: #333a40; color: #fff; }
.rail nav a.is-active { background: var(--accent); color: #fff; font-weight: 600; }
.rail .icon { width: 19px; height: 19px; }
.rail nav a b { position: absolute; top: 3px; right: 8px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: #fff; color: var(--ink); font-size: 11px; line-height: 17px; }
.rail-foot { display: grid; gap: 2px; margin-top: auto; padding-top: 8px; border-top: 1px solid #444c53; }
.rail-foot button { min-height: 44px; }
.rail-me { display: grid; justify-items: center; gap: 3px; color: #fff; font-size: 12px; }
.content { width: 100%; max-width: 1380px; padding: 20px 22px 48px; }
.content-wide { max-width: 1600px; }
.avatar { border-radius: var(--radius); }
.page-head { align-items: center; }
.ref { font: 600 15px/1 var(--head); color: var(--ink-2); }
.record-head h1 { text-wrap: balance; }
.tagline { display: inline-flex; flex-wrap: wrap; gap: 5px; }
.skills { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.skills span { padding: 0 7px; border: 1px solid var(--line-2); border-radius: 4px; font-size: 12.5px; line-height: 20px; white-space: nowrap; color: var(--ink-2); background: var(--surface); }
.stats { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); }
.stat + .stat { border-left: 1px solid var(--line); }
.facts > div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px; padding: 7px 0; }
.facts > div + div { border-top: 1px solid var(--line); }
.facts dt { color: var(--ink-2); font-size: 14px; }
.facts dd { overflow-wrap: anywhere; }
.card h3 { margin: 16px 0 6px; font: 700 16px/1.3 var(--head); }
.card h3:first-of-type { margin-top: 4px; }
.cardfoot { margin-top: 10px; }
.callout { display: flex; gap: 9px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius); background: var(--info-tint); color: var(--info); font-size: 14.5px; }
.callout-warn { background: var(--warn-tint); color: var(--warn); }
.callout .icon { margin-top: 2px; }

/* Dashboard */
.crew li + li, .todo li + li, .mini-list li + li, .agenda li + li { border-top: 1px solid var(--line); }
.crew a { display: grid; grid-template-columns: 36px minmax(0, 1fr) minmax(80px, 190px) 74px; align-items: center; gap: 12px; padding: 9px 0; color: var(--ink); text-decoration: none; }
.crew-who { display: grid; line-height: 1.35; min-width: 0; }
.crew-who small { overflow: hidden; color: var(--ink-2); font-size: 13px; white-space: nowrap; text-overflow: ellipsis; }
.crew .badge, .crew-count { justify-self: end; }
.crew-count { color: var(--ink-2); font-size: 13px; }
.mini { position: relative; height: 14px; border-radius: 3px; background: var(--soft); }
.mini i { position: absolute; top: 0; bottom: 0; border: 1px solid #fff; border-radius: 3px; }
.todo a { display: flex; align-items: center; gap: 11px; padding: 9px 0; color: var(--ink); text-decoration: none; }
.todo a > span:nth-child(2) { display: grid; flex: 1; min-width: 0; line-height: 1.35; }
.todo small, .mini-list small, .agenda small, .timeline small { color: var(--ink-2); font-size: 13px; }
.todo a > .icon { color: var(--ink-2); }
.todo-ico { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: var(--radius); }
.mini-list a, .mini-list li > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; color: var(--ink); text-decoration: none; }
.mini-list li span:first-child { display: grid; min-width: 0; line-height: 1.4; }
.mini-list a > .badge { flex: none; }
.agenda a { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; color: var(--ink); text-decoration: none; }
.agenda time { display: grid; font: 600 15px/1.25 var(--head); }
.agenda a > span:nth-of-type(1) { display: grid; line-height: 1.38; }
.week { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr)); gap: 12px; align-items: start; }

/* Job status colours, shared by the board, the mini tracks and the key */
.st-scheduled { --st: #1a547f; --st-bg: #e0edf7; }
.st-en_route { --st: #51407f; --st-bg: #ebe6f7; }
.st-on_site { --st: #9a370a; --st-bg: #fbe2d3; }
.st-completed { --st: #7d4a00; --st-bg: #fcecc2; }
.st-reviewed { --st: #1f6134; --st-bg: #deefe2; }
.st-invoiced { --st: #525b63; --st-bg: #e8eaec; }
.mini i, .b-key i { background: var(--st); }

/* Schedule board */
.datenav { display: flex; align-items: center; gap: 6px; }
.datenav input { height: 40px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); }
.dispatch { display: grid; grid-template-columns: 246px minmax(0, 1fr); gap: 14px; align-items: start; }
.queue-col h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font: 700 18px/1.25 var(--head); }
.queue-col ul, .q-list { display: grid; gap: 8px; }
.q-card { display: grid; gap: 4px; padding: 10px 11px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); line-height: 1.35; }
.q-card[draggable] { cursor: grab; }
.q-card.pr-emergency { border-color: var(--danger); box-shadow: inset 0 3px 0 var(--danger); }
.q-card.is-picked { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.q-top { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.q-top a { font: 600 14px var(--head); }
.q-top > span:last-child { margin-left: auto; color: var(--ink-2); }
.q-card small { color: var(--ink-2); font-size: 13px; }
.q-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.board-col { display: grid; gap: 10px; min-width: 0; }
.board-scroll { overflow-x: auto; border: 1px solid var(--line-2); border-radius: var(--radius-lg); background: var(--surface); }
.board { min-width: 820px; }
.b-row { display: grid; grid-template-columns: 142px minmax(0, 1fr); }
.b-row + .b-row { border-top: 1px solid var(--line); }
.b-who { position: sticky; left: 0; z-index: 3; display: grid; align-content: center; padding: 6px 10px; border-right: 1px solid var(--line-2); background: var(--surface); line-height: 1.3; }
.b-who a { color: var(--ink); font-weight: 600; font-size: 14px; text-decoration: none; }
.b-who small { color: var(--ink-2); font-size: 12px; }
.b-who em { color: var(--danger); font-style: normal; font-weight: 600; }
.b-head { background: #f8f9fa; }
.b-head .b-who { background: #f8f9fa; color: var(--ink-2); font-size: 13px; font-weight: 600; }
.b-hours { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); }
.b-hours span { padding: 8px 4px; border-left: 1px solid var(--line); color: var(--ink-2); font: 600 12.5px var(--head); }
.b-hours span:first-child { border-left: 0; }
.b-track { position: relative; min-height: 68px; background: repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px calc(100% / 11)); }
.b-track.is-off { background-color: var(--soft); }
.b-off { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-2); font-size: 13px; font-weight: 600; }
.b-job { position: absolute; top: 5px; bottom: 5px; display: flex; flex-direction: column; justify-content: center; min-width: 0; padding: 3px 6px; overflow: hidden; border: 1px solid var(--st); border-left-width: 4px; border-radius: 5px; background: var(--st-bg); color: var(--ink); text-align: left; line-height: 1.25; cursor: pointer; }
.b-job strong, .b-job span { display: block; width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12.5px; }
.b-job span { color: #3d464e; font-size: 12px; }
.b-job[draggable="true"] { cursor: grab; }
.b-job:hover { box-shadow: 0 2px 8px -2px rgba(20, 25, 30, .45); }
.b-job.is-picked { outline: 2px dashed var(--accent); outline-offset: 1px; }
.slots { position: absolute; inset: 0; z-index: 2; display: grid; grid-template-columns: repeat(22, minmax(0, 1fr)); }
.slots button { padding: 0; border: 0; border-left: 1px dotted rgba(60, 70, 80, .25); background: transparent; color: transparent; font: 600 12px var(--head); cursor: pointer; }
.slots button.is-ok { background: rgba(194, 72, 15, .13); }
.slots button.is-no { cursor: not-allowed; }
.slots button:hover, .slots button:focus-visible { background: var(--accent); color: #fff; outline-offset: -3px; }
.slots button.is-no:hover { background: var(--danger); }
.is-placing .b-job { opacity: .8; }
.b-row.is-lack .b-track { background-color: #eceef0; }
.b-row.is-lack .b-who { background: #f4f5f6; }
.b-key { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--ink-2); font-size: 13px; }
.b-key li { display: flex; align-items: center; gap: 5px; }
.b-key i { width: 11px; height: 11px; border-radius: 3px; }
.placing, .clash { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--radius); }
.placing { justify-content: space-between; background: var(--navy); color: #fff; }
.placing div { display: grid; }
.placing span { color: #d5dade; font-size: 14px; }
.clash { border: 1px solid var(--danger); background: var(--danger-tint); color: var(--danger); font-weight: 600; }
.clash span { flex: 1; }
.clash .icon-btn { width: 34px; height: 34px; border: 0; background: transparent; color: inherit; }
.areamap { display: grid; grid-template-columns: 180px minmax(0, 1fr); align-items: center; gap: 12px; margin: 4px 0 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.areamap figcaption { display: grid; gap: 4px; align-self: start; }
.areamap figcaption span { color: var(--ink-2); font-size: 13px; }
.areamap svg { width: 100%; max-width: 640px; height: auto; border-radius: var(--radius); background: #f1f2f0; }
.areamap .roads path { fill: none; stroke: #fff; stroke-width: 6; stroke-linecap: round; }
.areamap .hills path { fill: #dfe2dc; }
.areamap text { fill: #5c656c; font: 500 12px var(--font); }
.areamap .spot circle { fill: #8b949b; }
.areamap .spot.is-on circle { fill: var(--accent); stroke: #fff; stroke-width: 2; }
.areamap .spot.is-on text { fill: var(--ink); font-weight: 600; }
.areamap .spot text.n { fill: #fff; }

/* Work order */
.flow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.flow li { padding-top: 8px; border-top: 4px solid var(--line-2); color: var(--ink-2); font: 600 13.5px/1.25 var(--head); }
.flow li.is-done { border-color: var(--navy); color: var(--ink); }
.flow li.is-now { border-color: var(--accent); color: var(--accent-dark); }
.checks li + li { border-top: 1px solid var(--line); }
.checks .check { min-height: 44px; align-items: center; }
.checks li.is-done span { color: var(--ink-2); }
.check input:disabled + span { cursor: default; }
.partlist li { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.partlist li + li { border-top: 1px solid var(--line); }
.partlist li > span { display: grid; flex: 1; min-width: 0; line-height: 1.38; }
.partlist small { color: var(--ink-2); font-size: 13px; }
.partlist b { min-width: 26px; text-align: right; }
.partlist b::before { content: "x "; color: var(--ink-2); font-weight: 400; }
.partlist em { min-width: 82px; font-style: normal; text-align: right; }
.signoff { display: grid; gap: 12px; }
.signoff .card-head { margin: 0; }
.handover { padding-top: 12px; border-top: 1px dashed var(--line-2); font-weight: 600; }
.btn-block { width: 100%; min-height: 48px; }
.signed { padding: 8px 0 0; }
.signature { display: inline-block; min-width: 220px; padding-bottom: 3px; border-bottom: 1.5px solid var(--ink); font: italic 500 22px/1.3 var(--head); }
.signed small { display: block; color: var(--ink-2); }
.timeline li { display: grid; position: relative; padding: 0 0 12px 18px; line-height: 1.4; }
.timeline li::before { content: ""; position: absolute; left: 0; top: 6px; width: 8px; height: 8px; border-radius: 99px; background: var(--line-2); }
.timeline li:first-child::before { background: var(--accent); }
.timeline strong { font-weight: 500; font-size: 14.5px; }
.now { display: grid; gap: 8px; padding: 18px; border: 1px solid var(--line-2); border-top: 5px solid var(--accent); border-radius: var(--radius-lg); background: var(--surface); }
.now-top { display: flex; align-items: center; gap: 8px; }
.now-top > span:last-child { margin-left: auto; font: 600 15px var(--head); color: var(--ink-2); }
.now h2 { font: 700 24px/1.2 var(--head); }
.now-time { font-weight: 600; }
.now-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.now-actions .btn { flex: 1 1 160px; min-height: 48px; }

/* Documents */
.card .doc { margin: 0; }
.doc td { white-space: normal; }
.sums { display: grid; justify-content: end; gap: 3px; margin-top: 12px; }
.sums > div { display: grid; grid-template-columns: auto 110px; gap: 20px; text-align: right; }
.sums dt { color: var(--ink-2); }
.sums .is-total { font-weight: 700; font-size: 17px; }
.sums .is-total dt { color: var(--ink); }
.paper-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.paper-head > div { display: grid; line-height: 1.4; }
.paper-head strong { font: 700 18px var(--head); }
.paper-head span, .paper-head small { color: var(--ink-2); font-size: 14px; }
.ready { display: grid; gap: 8px; }
.ready > div { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; padding: 10px 14px; border: 1px solid var(--ok); border-radius: var(--radius); background: var(--ok-tint); }
.ready span { display: grid; }
.ready small { font-size: 13.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { display: inline-flex; align-items: center; gap: 4px; padding-left: 10px; border: 1px solid var(--line-2); border-radius: var(--radius); font-size: 14px; }
.chips button { display: grid; place-items: center; width: 36px; height: 36px; border: 0; background: none; cursor: pointer; }
.skillbox > div { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); column-gap: 10px; }
.skillbox legend { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.skillbox .check { align-items: center; }
.popup-actions { display: grid; gap: 8px; }
.linerow { grid-template-columns: minmax(0, 1fr) 82px 104px 42px; }
.skeleton { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.skeleton i { height: 220px; border-radius: var(--radius-lg); background: var(--soft); animation: pulse 1s ease-in-out infinite alternate; }
.skeleton i:first-child { grid-column: 1 / -1; height: 90px; }
@keyframes pulse { to { opacity: .5; } }

@media (max-width: 1180px) {
  .dispatch { grid-template-columns: minmax(0, 1fr); }
  .queue-col ul { grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); }
}
@media (min-width: 761px) and (max-width: 1023px) {
  .shell { grid-template-columns: 76px minmax(0, 1fr); }
  .rail { padding-inline: 4px; }
  .content { padding: 16px 14px 48px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .flow li { font-size: 12.5px; }
  .areamap { grid-template-columns: minmax(0, 1fr); }
  td:not(.grow) { white-space: normal; }
}
@media (max-width: 900px) { .crew a { grid-template-columns: 36px minmax(0, 1fr) 74px; } .crew .mini { display: none; } }
@media print { .demo-bar, .rail, .actionbar, .back, .toasts, .preview { display: none !important; } .shell { display: block; } }
.xc { --xc-bar: #c2480f; --xc-bar-hi: #9a370a; --xc-b2: #4a5964; --xc-b2-hi: #23282c; --xc-grid: #e5e8ea; --xc-base: #aab2b8; }
@media (min-width: 761px) and (max-height: 880px) { .rail { gap: 6px; padding-block: 6px; } .rail nav a { min-height: 45px; } .rail nav ul, .rail-foot { gap: 1px; } .rail-foot button { min-height: 40px; } .rail-me { display: none; } }

/* Sidebar spacing: a clear gap between every option */
@media (min-width: 761px) {
  .rail nav ul, .rail-foot { gap: 8px; }
  .rail { gap: 16px; }
}
/* Wide screens: icon beside its label, so each option has room to breathe */
@media (min-width: 1180px) {
  .shell { grid-template-columns: 212px minmax(0, 1fr); }
  .rail { gap: 20px; padding: 16px 12px; }
  .rail .brand { flex-direction: row; justify-content: flex-start; gap: 10px; padding: 0 6px; font-size: 20px; }
  .rail nav a, .rail-foot button { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 42px; padding: 0 12px; font-size: 14.5px; }
  .rail nav a b { position: static; margin-left: auto; }
  .rail-me { display: flex; align-items: center; justify-content: flex-start; gap: 10px; padding: 0 8px 4px; font-size: 14px; }
}
@media (min-width: 1180px) and (max-height: 760px) {
  .rail { gap: 12px; padding-block: 10px; }
  .rail nav ul, .rail-foot { gap: 4px; }
  .rail nav a, .rail-foot button { min-height: 37px; }
  .rail-me { display: none; }
}

/* Loading placeholder shown while a screen opens */
.page-skel { display: grid; grid-column: 1 / -1; align-content: start; gap: 14px; width: 100%; min-width: 0; padding: 2px; }
.page-skel i { display: block; height: 96px; border-radius: var(--radius-lg, 8px); background: linear-gradient(90deg, rgba(100, 112, 128, .13) 25%, rgba(100, 112, 128, .05) 50%, rgba(100, 112, 128, .13) 75%); background-size: 200% 100%; animation: skel-shimmer 1s linear infinite; }
.page-skel .sk-title { width: min(280px, 70%); height: 30px; }
.page-skel .sk-line { width: min(420px, 90%); height: 14px; }
.page-skel > div { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.page-skel .sk-block { height: 280px; }
@keyframes skel-shimmer { to { background-position: -200% 0; } }
@media (max-width: 760px) { .page-skel > div { grid-template-columns: minmax(0, 1fr); } .page-skel > div i { height: 68px; } }
.page-in > * { animation: page-in .3s ease-out both; }
@keyframes page-in { from { opacity: 0; } }
/* Short screens keep at least a 6px gap */
@media (min-width: 761px) and (max-width: 1179px) and (max-height: 820px) {
  .rail { gap: 8px; padding-block: 6px; }
  .rail nav ul, .rail-foot { gap: 6px; }
  .rail nav a { min-height: 42px; gap: 1px; }
  .rail-foot button { min-height: 38px; gap: 1px; }
  .rail .brand span, .rail-me { display: none; }
}
@media (min-width: 1180px) and (max-height: 760px) {
  .rail nav ul, .rail-foot { gap: 6px; }
  .rail nav a, .rail-foot button { min-height: 35px; }
}
.page-skel.is-flush { box-sizing: border-box; padding: 22px 24px; }
