:root {
  color: #162d34;
  background: #edf3f2;
  font: 16px/1.5 "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  --muted: #4b656b;
  --border: #c9d9d7;
  --accent: #076458;
  --dark: #112f35;
  --warning: #903824;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
.stage-filter { display: inline-flex; align-items: center; gap: .5rem; margin-bottom: .65rem; font-size: .9rem; }
.stage-filter select { color: inherit; background: white; border: 1px solid #aec9c5; border-radius: 5px; padding: .3rem .5rem; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, .qr a { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #1b8374; outline-offset: 3px; }
button:disabled { cursor: wait; opacity: .64; }
button {
  border: 1px solid var(--border); border-radius: 7px; color: var(--dark);
  background: #f6faf9; padding: 8px 14px;
}
button:hover { background: #e5f1ee; }
.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.primary:hover { background: #075247; }
.type-search form, .type-search li { display:flex; align-items:end; gap:.65rem; flex-wrap:wrap; }
.type-search label { display:grid; gap:.35rem; }
.type-search input, .type-search select { border:1px solid var(--border); border-radius:7px; padding:8px 10px; color:inherit; }
.type-search form > label input { width:min(26rem, 75vw); }
.type-search ul { padding:0; margin:0; }
.type-search li { align-items:center; padding:.6rem 0; border-bottom:1px solid var(--border); overflow-wrap:anywhere; }
.type-search li span { flex:1 1 20rem; }
.type-search li small { color:var(--warning); }
.type-search section:not(:empty) { margin-top:1rem; }
[data-station-metrics] { margin:.75rem 0; }
[data-station-metrics] .station-metrics { gap:.75rem; }
[data-station-metrics] .station-metric-group { width:auto; flex:1 1 auto; flex-wrap:wrap; color:#eef6f6; }
[data-station-metrics] .station-metric { gap:.4rem; padding:.25rem .6rem; }
[data-station-metrics] .station-metric small { font-size:.9rem; }
[data-station-metrics] .station-metric strong { font-size:1.36rem; }
[data-station-metrics] .station-metric .station-text-value { font-size:.9rem; }
.workstation-table [data-station-vehicle] { vertical-align:top; }
.workstation-table .station-stock > td:not([data-station-vehicle]) { background:#e2e7e8; color:#24383d; }
.workstation-table .station-waiting > td:not([data-station-vehicle]) { background:#fff0ef; }
.workstation-table .station-ready > td:not([data-station-vehicle]) { background:#e8f5ed; }
[data-station-items] p { margin:.35rem 0; }
.masthead {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 13px clamp(16px, 3vw, 56px); background: var(--dark); color: #e4f0ef;
}
.brand, .masthead-right { display: flex; gap: 10px; align-items: center; }
.brand b { color: #fff; margin-left: 8px; }
.brand-mark { width: 21px; height: 16px; border: solid #6ed2bf; border-width: 3px 0; transform: skew(-20deg); }
.masthead-right { gap: 18px; color: #c0d9d5; font-size: .9rem; }
.masthead time, .duration, .metric strong, td time { font-variant-numeric: tabular-nums; }
#main { max-width: 1880px; margin: auto; padding: 0 clamp(16px, 3vw, 56px) 28px; }
.screen-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0 0; min-height: 16px; }
.screen-tabs { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.screen-tabs button, .screen-tabs a { padding: 4px 10px; font-size: .85rem; }
.screen-tabs a { color: var(--dark); text-decoration: none; border: 1px solid var(--border); border-radius: 7px; background: #f6faf9; }
.screen-tabs a:hover { background: #e5f1ee; }
.settled-search { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.settled-search label { display: grid; gap: 5px; font-size: .9rem; }
.settled-search input[type=search] { min-height: 42px; width: min(280px, 72vw); border: 1px solid var(--border); border-radius: 7px; padding: 8px 10px; }
.settled-search .check { display: flex; align-items: center; min-height: 42px; }
.screen-body > [role=status]:not(:empty) { margin: 10px 0; }
.screen-tabs [aria-current="true"] { background: var(--accent); color: white; border-color: var(--accent); }
[data-play-toggle] { flex-shrink: 0; padding: 4px 10px; font-size: .85rem; }
.screen-body { padding-top: 14px; }
.rotating .screen-body { overflow: auto; max-height: calc(100dvh - 113px); scrollbar-gutter: stable; padding-right: 6px; }
.screen-title { display: flex; gap: 15px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.8rem, 3.25vw, 3.05rem); line-height: 1.16; letter-spacing: -.035em; }
h2 { font-size: clamp(1rem, 1.33vw, 1.3rem); margin-bottom: 9px; }
.screen-footer { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:16px; margin-top:24px; padding:16px 0; border-top:1px solid var(--border); color:var(--muted); }
.screen-footer .sources { margin:9px 0 0; }
.screen-footer .board-updated { margin-top:5px; }
.volume-summary { display:flex; flex-wrap:wrap; gap:8px 20px; margin:0 0 16px; }
.volume-summary > div { display:flex; flex-wrap:wrap; gap:8px; align-items:baseline; }
.volume-summary span { white-space:nowrap; color:var(--muted); font-size:.88rem; }
.volume-summary button { font-size:1rem; font-weight:700; }
.screen-title p, .subtitle { color: var(--muted); margin-top: 5px; }
.qr { text-align: center; flex-shrink: 0; margin: 0; color: var(--accent); }
.qr canvas { display: block; margin: auto; width: 135px; height: 135px; background: white; image-rendering: pixelated; }
.qr a { color: var(--accent); font-weight: 650; font-size: .86rem; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.sources { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 13px; }
.source { background: #e1ebe9; color: #305259; padding: 3px 8px; border-radius: 4px; font-size: .79rem; }
.source.warn, .warning { color: var(--warning); font-weight: 700; }
.source.warn { background: #f5e5d9; }
.notice { padding: 8px 12px; margin: 0 0 11px; border: 1px solid #ebcab6; background: #fff3e8; color: #753827; border-radius: 6px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(136px, 1fr)); gap: 9px; margin-bottom: 15px; }
.metric, .panel, .phone { background: #fff; border: 1px solid var(--border); border-radius: 9px; }
.metric { padding: 10px 14px; }
.metric span { display: block; color: var(--muted); font-size: .87rem; }
button.metric { text-align:left; cursor:pointer; }
button.metric:hover, tr:has(.stage-link):hover {background:#edf7f4;}
tr:has(.stage-link) {cursor:pointer;}
.stage-link {background:transparent;color:var(--accent);border:0;padding:2px 0;text-align:left;text-decoration:underline;text-underline-offset:3px;}
#group-detail {width:min(870px,95vw);max-height:85dvh;}
#group-detail>header {display:flex;align-items:center;justify-content:space-between;gap:10px;}
#group-close {width:auto;margin:0;}
#group-content .subtitle {margin:8px 0 14px;}
#group-content .vehicle-link {width:auto;margin:0;}
.metric strong { display: block; font-size: clamp(1.15rem, 2.4vw, 2.45rem); line-height: 1.25; color: #124e49; margin-top: 3px; }
.metric strong[data-uncertain] { font-size: clamp(1rem, 1.45vw, 1.45rem); }
.panel { margin: 0 0 12px; padding: 13px 15px; min-width: 0; }
.layout { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: clamp(.86rem, 1.06vw, 1.15rem); }
th, td { padding: 8px 10px; vertical-align: top; border-bottom: 1px solid #e1eae8; }
th { color: #3f5b5d; background: #eef5f3; font-weight: 650; }
td small { display: block; color: var(--muted); margin-top: 3px; font-size: .82em; }
.duration { white-space: nowrap; }
.duration b { color: #15574f; }
.vehicle-link { display:block; padding:0; border:0; background:transparent; color:inherit; text-align:left; font:inherit; cursor:pointer; }
.vehicle-link b,.presence-link { color:#09645d; text-decoration:underline; text-underline-offset:3px; }
tr:has(.vehicle-link) { cursor:pointer; }
tr:has(.vehicle-link):hover { background:#f0f7f5; }
.presence-link { display:inline-block; margin-top:8px; font-size:.9rem; }
#vehicle-detail { position:fixed; inset:0 0 0 auto; margin:0; box-sizing:border-box; width:min(540px,100%); height:100dvh; max-width:100%; max-height:100dvh; padding:0; border:0; border-radius:0; background:#f4f8f7; box-shadow:-6px 0 38px #193c3d29; overflow:auto; }
#vehicle-detail::backdrop { background:#17353860; }
#vehicle-detail>header { position:sticky; top:0; z-index:1; background:#143337; color:white; padding:18px 20px; display:flex; justify-content:space-between; align-items:center; gap:12px; }
#vehicle-title { margin:4px 0 0; }
#vehicle-close { width:auto; margin:0; }
#vehicle-content { padding:16px; }
.detail-facts { display:grid; grid-template-columns:1fr 1fr; gap:12px 16px; margin:0 0 14px; padding:15px; border:1px solid var(--border); border-radius:8px; background:white; }
.detail-facts dt { font-size:.82rem; color:var(--muted); }
.detail-facts dd { margin:3px 0 0; overflow-wrap:anywhere; }
.detail-facts dd small { display:block; }
.empty { color: var(--muted); padding: 14px; background: #f4f8f7; border-radius: 6px; }
#main > .empty, #main > .notice { margin-top: 18px; }
.phone { max-width: 500px; margin: 20px auto 0; padding: clamp(16px, 5vw, 26px); }
.phone h1, dialog h1 { font-size: clamp(1.6rem, 5vw, 2.1rem); margin-bottom: 12px; }
.phone h2 { font-size: 1.05rem; }
.phone label, dialog label { display: block; margin: 12px 0 4px; font-weight: 650; }
.phone input, .phone select, .phone textarea, dialog input {
  width: 100%; padding: 9px 10px; color: inherit; background: #fff; border: 1px solid #a8c1bd; border-radius: 6px;
}
.phone textarea { min-height: 88px; resize: vertical; }
.phone button, dialog button { min-height: 43px; }
.lookup-line { display: grid; grid-template-columns: 1fr auto; gap: 7px; }
.phone form { margin: 0; }
.phone > section, #feedback-form, #parts06-form { margin-top: 17px; }
.matches { display: grid; gap: 6px; max-height: 42vh; overflow-y: auto; }
.matches button { text-align: left; }
.matches button[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 3px 0 var(--accent); background: #e6f3ef; }
#feedback-form .primary, #parts06-form .primary { margin-top: 13px; width: 100%; }
#lookup-status, #feedback-status, #parts06-status { margin-top: 10px; }
.receipt { color: #07584d; padding: 10px; border-radius: 5px; background: #e2f3ee; }
dialog { width: min(425px, calc(100% - 28px)); padding: 20px; border: 1px solid var(--border); border-radius: 9px; color: var(--dark); }
dialog::backdrop { background: #112f35b8; }
dialog button { width: 100%; margin-top: 12px; }
#signin-error { margin-top: 10px; }
#employee-signin { display: block; padding: 12px 0 2px; text-align: center; }
@media (max-width: 740px) {
  .masthead-right { gap: 6px; }
  .masthead time { display: none; }
  .layout { grid-template-columns: 1fr; gap: 0; }
  .screen-top { align-items: start; }
  .rotating .screen-body { max-height: calc(100dvh - 145px); }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qr canvas { width: 103px; height: 103px; }
  th, td { min-width: 89px; }
}


.overview-metrics { grid-template-columns: repeat(6,minmax(0,1fr)); }
.business-panels { display:grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap:14px; }
.business-panels .metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
@media (max-width:740px) {
  .overview-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .business-panels { grid-template-columns:1fr; }
}

.tv-office :focus-visible {outline: 3px solid #008982; outline-offset: -3px;}
.tv-office #employee-signin {display:none;}

.stage-source {display:inline-block!important;white-space:nowrap;font-size:.72em;font-weight:650;margin:0 0 0 .34em!important;vertical-align:baseline}
.source-dms {color:#455963}.source-dispatch {color:#075aa3}.source-rework {color:#bb202e;font-weight:800}
.tv-office .compact-panel {padding:.55rem .7rem}
.compact-panel h2,.compact-panel .stage-filter {display:inline-flex;align-items:center;margin:.18rem .8rem .45rem 0}
.tv-office .tv-compact {width:100%;table-layout:fixed;min-width:0;font-size:clamp(15px,1.25vw,26px);line-height:1.28}
.tv-compact th,.tv-compact td {white-space:nowrap;word-break:normal;padding:.35em .28em}
.tv-compact th:first-child {width:23%}.tv-compact th:nth-child(2){width:7%}.tv-compact th:nth-child(3){width:12%}
.tv-compact th:nth-child(4){width:13%}.tv-compact th:nth-child(5){width:19%}
.tv-compact .compact-duration {width:13%;white-space:normal;overflow-wrap:anywhere;text-align:right;
  font-variant-numeric:tabular-nums;padding-inline:.55em}
.tv-compact button {color:inherit;background:transparent;border:0;padding:0;min-height:0;font:inherit;max-width:100%;text-align:left}
.tv-compact .compact-car {display:flex;align-items:baseline;gap:.4em;width:100%}
.compact-car b {flex:none;color:#12665d}.compact-model {overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.compact-car.repeated {visibility:hidden}.tv-compact .warning {color:#955700}.tv-compact tr[hidden]{display:none}
