:root {
  --ink: #182126;
  --muted: #687177;
  --line: #dce1e3;
  --soft: #f3f5f5;
  --paper: #ffffff;
  --green: #18794e;
  --green-soft: #e7f4ec;
  --amber: #9a5b00;
  --amber-soft: #fff4d9;
  --red: #b42318;
  --red-soft: #fdeceb;
  --cyan: #0c7182;
  --cyan-soft: #e4f4f6;
  --sidebar: #20282c;
  --sidebar-soft: #2b353a;
  --radius: 6px;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", Arial, sans-serif;
  color: var(--ink);
  background: var(--soft);
  letter-spacing: 0;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--soft); }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: 3px solid rgba(12, 113, 130, .26); outline-offset: 2px; }
.hidden { display: none !important; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; color: #f7f9f9; background: var(--sidebar); border-right: 1px solid #13191c; }
.brand { min-height: 88px; display: flex; align-items: center; gap: 12px; padding: 18px; border-bottom: 1px solid #384247; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; color: #102b33; background: #8fd3db; border-radius: 4px; font-family: "Arial Narrow", Arial, sans-serif; font-weight: 900; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; }
.brand small { margin-top: 4px; color: #9eaaaf; font-size: 11px; }
nav { display: grid; gap: 4px; padding: 18px 12px; }
.nav-item { min-height: 44px; display: flex; align-items: center; gap: 12px; padding: 0 12px; color: #b9c2c6; background: transparent; border: 0; border-radius: 4px; text-align: left; }
.nav-item span { width: 20px; color: #8fd3db; font-size: 18px; text-align: center; }
.nav-item:hover { color: #fff; background: #273136; }
.nav-item.active { color: #fff; background: var(--sidebar-soft); box-shadow: inset 3px 0 #8fd3db; }
.machine-rail { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-top: 1px solid #384247; }
.machine-rail strong, .machine-rail small { display: block; }
.machine-rail strong { font-family: Bahnschrift, "Arial Narrow", sans-serif; font-size: 13px; }
.machine-rail small { margin-top: 3px; color: #9eaaaf; font-size: 11px; }
.status-dot { width: 9px; height: 9px; display: inline-block; flex: 0 0 auto; border-radius: 50%; background: #9aa3a7; box-shadow: 0 0 0 3px rgba(154, 163, 167, .14); }
.status-dot.online { background: #42b883; box-shadow: 0 0 0 3px rgba(66, 184, 131, .15); }
.status-dot.offline { background: #df5b52; box-shadow: 0 0 0 3px rgba(223, 91, 82, .15); }
.workspace { min-width: 0; padding: 0 28px 48px; }
.topbar { height: 88px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 3px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 24px; line-height: 1.2; }
h2 { margin-bottom: 0; font-size: 18px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.connection { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.icon-button { width: 36px; height: 36px; display: grid; place-items: center; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 4px; font-size: 19px; }
.icon-button:hover { border-color: #aeb7bb; background: #fafbfb; }
.view { display: none; padding-top: 24px; }
.view.active { display: block; }
.metric-strip { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.metric-strip > article, .metric-strip > button { min-height: 104px; padding: 18px 20px; border: 0; border-right: 1px solid var(--line); border-radius: 0; text-align: left; }
.metric-strip > article { background: transparent; }
.metric-strip > :last-child { border-right: 0; }
.metric-strip span { display: block; color: var(--muted); font-size: 12px; }
.metric-strip strong { display: inline-block; margin-top: 9px; font-family: Bahnschrift, "Arial Narrow", sans-serif; font-size: 32px; line-height: 1; }
.metric-strip small { margin-left: 5px; color: var(--muted); }
.metric-strip .metric-alert strong { color: var(--red); }
.metric-card { position: relative; color: var(--ink); background: #fffafa; box-shadow: inset 0 3px var(--red); }
.metric-card:hover { background: var(--red-soft); }
.metric-card .metric-link { position: absolute; right: 14px; bottom: 12px; color: var(--red); font-size: 11px; font-weight: 700; }
.metric-card .metric-link b { margin-left: 3px; font-size: 16px; line-height: 0; }
.dashboard-metrics { grid-template-columns: repeat(6, minmax(130px, 1fr)); }
.dashboard-metrics .metric-today { background: #f5fbfb; box-shadow: inset 0 3px var(--cyan); }
.dashboard-metrics .metric-today strong { color: var(--cyan); }
.monitor-toolbar { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 12px; }
.monitor-toolbar > div > strong { font-size: 18px; }
.month-controls { display: grid; grid-template-columns: minmax(170px, 220px) auto; gap: 6px 8px; align-items: end; }
.month-controls label { grid-column: 1 / -1; color: var(--muted); font-size: 11px; }
.month-controls input { height: 38px; min-width: 0; padding: 0 10px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 4px; }
.production-ledger { margin-top: 16px; overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.production-ledger > header { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.production-ledger h2 { font-size: 16px; }
.production-ledger > header > span { color: var(--muted); font-family: Bahnschrift, "Arial Narrow", sans-serif; font-size: 11px; }
.production-table { overflow: auto; }
.production-table table { min-width: 560px; }
.production-table th:first-child { width: 34%; }
.production-table th:nth-child(2), .production-table th:nth-child(3) { width: 20%; }
.production-number { font-family: Bahnschrift, "Arial Narrow", sans-serif; font-size: 17px; }
.daily-share { width: min(220px, 100%); display: flex; align-items: center; gap: 10px; }
.daily-share > span { height: 7px; flex: 1; overflow: hidden; background: #e7ebec; border-radius: 99px; }
.daily-share i { height: 100%; display: block; background: var(--cyan); border-radius: inherit; }
.daily-share strong { width: 34px; color: var(--muted); font-family: Bahnschrift, "Arial Narrow", sans-serif; font-size: 11px; text-align: right; }
.recent-processing { margin-top: 16px; overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.recent-processing > header { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.recent-processing h2 { font-size: 16px; }
.live-state { display: flex; align-items: center; gap: 8px; color: var(--muted); font-family: Bahnschrift, "Arial Narrow", sans-serif; font-size: 11px; }
.recent-table { max-height: 488px; overflow: auto; }
.recent-table th, .recent-table td { height: 44px; }
.recent-table th:first-child, .recent-table td:first-child { width: 154px; }
.recent-table th:nth-child(2) { width: 31%; }
.recent-table th:nth-child(3) { width: 29%; }
.recent-table th:nth-child(4), .recent-table td:nth-child(4) { width: 94px; }
.recent-table th:nth-child(5), .recent-table td:nth-child(5) { width: 58px; }
.recent-table th:last-child, .recent-table td:last-child { width: 120px; }
.recent-state { white-space: nowrap; }
.recent-state > strong { margin-left: 8px; color: var(--ink); font-family: Bahnschrift, "Arial Narrow", sans-serif; font-size: 12px; }
.recent-board strong, .recent-board small, .recent-address strong { display: block; }
.recent-barcode { display: flex !important; align-items: center; gap: 7px; }
.recent-board small, .recent-address strong { max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
.recent-board small { margin-top: 2px; color: var(--muted); }
.recent-board .board-spec { color: #68777c; font-family: Bahnschrift, "Arial Narrow", sans-serif; font-size: 10px; }
.status-pill i { width: 7px; height: 7px; margin-right: 4px; border-radius: 50%; background: currentColor; }
.status-pill.recent-status-scanned { color: var(--amber); background: var(--amber-soft); }
.status-pill.recent-status-completed { color: var(--green); background: var(--green-soft); }
.status-pill.recent-status-replenishment { color: var(--cyan); background: var(--cyan-soft); }
.status-pill.recent-status-stopped { color: var(--red); background: var(--red-soft); }
.recent-empty { min-height: 96px; display: grid; place-content: center; color: var(--muted); font-size: 12px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 20px 0 12px; }
.segmented { display: inline-flex; padding: 3px; background: #e7ebec; border-radius: 5px; }
.segmented button { min-height: 32px; padding: 0 14px; color: #5d676c; background: transparent; border: 0; border-radius: 3px; font-size: 12px; }
.segmented button.active { color: var(--ink); background: var(--paper); box-shadow: 0 1px 2px rgba(23, 32, 37, .12); }
.search { height: 38px; min-width: 260px; display: flex; align-items: center; gap: 8px; padding: 0 11px; background: var(--paper); border: 1px solid var(--line); border-radius: 4px; }
.search span { color: var(--muted); font-size: 19px; }
.search input { width: 100%; border: 0; outline: 0; background: transparent; }
.table-surface, .detail-table, .analysis-list { overflow: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { color: #596268; background: #f7f8f8; font-size: 11px; font-weight: 700; text-align: left; }
th, td { height: 48px; padding: 8px 13px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr[data-order] { cursor: pointer; }
tbody tr:hover { background: #f8fbfb; }
.order-name strong, .order-name small { display: block; }
.order-name small { margin-top: 2px; color: var(--muted); }
.status-pill, .version-pill, .diff-pill { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.status-pill.waiting { color: var(--cyan); background: var(--cyan-soft); }
.status-pill.working { color: var(--amber); background: var(--amber-soft); }
.status-pill.completed { color: var(--green); background: var(--green-soft); }
.status-pill.cancelled { color: var(--red); background: var(--red-soft); }
.progress-cell { min-width: 190px; }
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-track { height: 7px; flex: 1; overflow: hidden; background: #e7ebec; border-radius: 99px; }
.progress-track i { height: 100%; display: block; background: var(--green); border-radius: inherit; }
.progress-row strong { width: 35px; font-family: Bahnschrift, "Arial Narrow", sans-serif; font-size: 12px; text-align: right; }
.empty-state { min-height: 260px; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); }
button.primary, button.secondary, button.success, button.danger, button.danger-outline { min-height: 38px; padding: 0 15px; border-radius: 4px; font-weight: 700; }
button.primary { color: #fff; background: var(--cyan); border: 1px solid var(--cyan); }
button.secondary { color: var(--ink); background: #fff; border: 1px solid #b9c1c5; }
button.success { color: #fff; background: var(--green); border: 1px solid var(--green); }
button.danger { color: #fff; background: var(--red); border: 1px solid var(--red); }
button.danger-outline { color: var(--red); background: #fff; border: 1px solid #d6aaa6; }
button.danger-outline:hover { background: var(--red-soft); border-color: var(--red); }
button:disabled { cursor: not-allowed; opacity: .5; }
.order-detail { position: fixed; inset: 20px 20px 20px auto; z-index: 20; width: min(860px, calc(100vw - 280px)); overflow: hidden; display: flex; flex-direction: column; background: var(--paper); border: 1px solid #cbd2d5; border-radius: 7px; box-shadow: 0 18px 60px rgba(22, 31, 36, .22); }
.order-detail > header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.detail-summary { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); }
.detail-summary div { padding: 14px 20px; border-right: 1px solid var(--line); }
.detail-summary div:last-child { border-right: 0; }
.detail-summary span, .detail-summary strong { display: block; }
.detail-summary span { color: var(--muted); font-size: 11px; }
.detail-summary strong { margin-top: 6px; font-family: Bahnschrift, sans-serif; font-size: 18px; }
.detail-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; }
.board-filter { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.board-filter select { height: 34px; min-width: 112px; padding: 0 7px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 4px; font-size: 12px; }
.detail-actions { display: flex; align-items: center; gap: 8px; }
.detail-actions button { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.detail-actions button span { font-size: 17px; line-height: 1; }
.detail-table { min-height: 180px; margin: 0 20px 12px; flex: 1; }
.detail-table table { min-width: 760px; }
.detail-table th, .detail-table td { height: 32px; padding: 4px 8px; }
.detail-table th:first-child { width: 190px; }
.detail-table th:nth-child(2) { width: 150px; }
.detail-table th:nth-child(3) { width: 86px; }
.detail-table th:nth-child(4) { width: 142px; }
.detail-table th:nth-child(5) { width: 92px; }
.detail-table th:nth-child(6) { width: 54px; }
.detail-table th:last-child { width: 74px; }
.detail-table td:not(.detail-barcode) { overflow: hidden; text-overflow: ellipsis; }
.detail-barcode { display: flex; align-items: center; gap: 7px; }
.detail-barcode strong { font-family: Bahnschrift, "Arial Narrow", sans-serif; font-size: 12px; }
.detail-scan { font-family: Bahnschrift, "Arial Narrow", sans-serif; }
.copy-barcode { min-width: 38px; height: 26px; padding: 0 5px; color: var(--cyan); background: var(--cyan-soft); border: 1px solid #bddbe0; border-radius: 3px; font-size: 10px; font-weight: 700; }
.copy-barcode:hover, .copy-barcode.copied { color: #fff; background: var(--green); border-color: var(--green); }
.detail-versions { flex: 0 0 112px; overflow: hidden; border-top: 1px solid var(--line); background: #f7faf9; }
.detail-versions > header { min-height: 42px; display: flex; align-items: center; justify-content: space-between; padding: 6px 20px; border-bottom: 1px solid var(--line); }
.detail-versions h3 { margin: 0; font-size: 14px; }
.detail-versions > header > span { color: var(--muted); font-family: Bahnschrift, "Arial Narrow", sans-serif; font-size: 11px; }
.version-history { max-height: 68px; overflow: auto; }
.version-history-row { min-height: 38px; display: grid; grid-template-columns: 44px 118px minmax(235px, 1fr) minmax(140px, .7fr) 118px; align-items: center; gap: 10px; padding: 5px 20px; border-bottom: 1px solid var(--line); font-size: 11px; }
.version-history-row:last-child { border-bottom: 0; }
.version-history-number { color: var(--cyan); font-family: Bahnschrift, "Arial Narrow", sans-serif; font-size: 13px; }
.version-history-source { display: inline-flex; justify-self: start; padding: 4px 7px; border-radius: 3px; font-weight: 700; }
.version-history-source.automatic { color: #176c51; background: #e5f2eb; }
.version-history-source.manual { color: #426e80; background: #e4f4f6; }
.version-history-change { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.version-history-folder { min-width: 0; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.version-history-row time { color: var(--muted); text-align: right; }
.detail-audit { flex: 0 0 112px; overflow: hidden; border-top: 1px solid var(--line); background: #fbfcfc; }
.detail-audit > header { min-height: 42px; display: flex; align-items: center; justify-content: space-between; padding: 6px 20px; border-bottom: 1px solid var(--line); }
.detail-audit h3 { margin: 0; font-size: 14px; }
.detail-audit > header > span { color: var(--muted); font-family: Bahnschrift, "Arial Narrow", sans-serif; font-size: 11px; }
.audit-list { max-height: 68px; overflow: auto; }
.audit-row { position: relative; min-height: 38px; display: grid; grid-template-columns: 116px 110px minmax(180px, 1fr) 118px; align-items: center; gap: 10px; padding: 5px 20px 5px 30px; border-bottom: 1px solid var(--line); font-size: 11px; }
.audit-row::before { position: absolute; left: 18px; width: 6px; height: 6px; content: ""; background: var(--cyan); border-radius: 50%; }
.audit-row:last-child { border-bottom: 0; }
.audit-kind, .audit-actor { font-weight: 700; }
.audit-kind.reset { color: var(--red); }
.audit-kind.complete { color: var(--green); }
.audit-reason { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-row time { color: var(--muted); text-align: right; }
.audit-empty { min-height: 80px; display: grid; place-items: center; color: var(--muted); font-size: 11px; }
.upload-layout { display: grid; grid-template-columns: minmax(320px, .7fr) minmax(0, 1.3fr); gap: 20px; align-items: start; }
.upload-panel, .analysis-panel { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.drop-zone { min-height: 390px; display: grid; place-content: center; justify-items: center; gap: 10px; margin: 12px; color: var(--muted); border: 2px dashed #b7c0c4; border-radius: 5px; text-align: center; transition: border-color .15s, background .15s; }
.drop-zone.dragging { color: var(--cyan); background: var(--cyan-soft); border-color: var(--cyan); }
.drop-zone.busy { pointer-events: none; opacity: .68; }
.drop-zone strong { color: var(--ink); font-size: 17px; }
.drop-symbol { width: 52px; height: 52px; display: grid; place-items: center; color: var(--cyan); background: var(--cyan-soft); border-radius: 50%; font-size: 27px; }
.upload-working { min-height: 110px; padding: 22px 24px; border-top: 1px solid var(--line); background: #f7f8f8; }
.upload-progress-heading { display: grid; grid-template-columns: 22px minmax(0, 1fr) 48px; align-items: center; gap: 10px; }
.upload-progress-heading strong { font-size: 13px; }
.upload-progress-heading > span:last-child { color: var(--cyan); font-family: Bahnschrift, sans-serif; font-size: 15px; text-align: right; }
.upload-progress-track { height: 8px; margin-top: 11px; overflow: hidden; background: #dfe4e6; border-radius: 4px; }
.upload-progress-track > span { display: block; width: 0; height: 100%; background: var(--cyan); transition: width .2s ease; }
.upload-working small { display: block; min-height: 16px; margin-top: 7px; color: var(--muted); font-size: 11px; }
.upload-working[data-status="completed"] .upload-progress-track > span { background: var(--green); }
.upload-working[data-status="completed"] .spinner { border-color: var(--green); animation: none; }
.upload-working[data-status="failed"] .upload-progress-heading strong,
.upload-working[data-status="failed"] .upload-progress-heading > span:last-child,
.upload-working[data-status="failed"] small { color: var(--red); }
.upload-working[data-status="failed"] .upload-progress-track > span { background: var(--red); }
.encoding-repair { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 13px; }
.encoding-repair input { width: 16px; height: 16px; accent-color: var(--green); }
.spinner { width: 20px; height: 20px; border: 2px solid #d8dfe1; border-top-color: var(--cyan); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.analysis-panel > header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.version-pill { color: var(--cyan); background: var(--cyan-soft); }
.analysis-metrics { display: grid; grid-template-columns: repeat(6, 1fr); border-bottom: 1px solid var(--line); }
.analysis-metrics div { padding: 12px 14px; border-right: 1px solid var(--line); }
.analysis-metrics div:last-child { border-right: 0; }
.analysis-metrics span, .analysis-metrics strong { display: block; }
.analysis-metrics span { color: var(--muted); font-size: 10px; }
.analysis-metrics strong { margin-top: 4px; font-family: Bahnschrift, sans-serif; font-size: 19px; }
.analysis-errors { margin: 14px; padding: 12px; color: var(--red); background: var(--red-soft); border: 1px solid #f4c6c2; border-radius: 4px; font-size: 12px; }
.analysis-list { max-height: 420px; margin: 14px; }
.publish-progress { padding: 13px 14px; border-top: 1px solid var(--line); background: #f7f8f8; }
.publish-progress-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.publish-progress-heading strong { color: var(--ink); font-size: 13px; }
.publish-progress-heading span { min-width: 42px; color: var(--cyan); font-family: Bahnschrift, sans-serif; font-size: 15px; text-align: right; }
.publish-progress-track { height: 8px; overflow: hidden; background: #dfe4e6; border-radius: 4px; }
.publish-progress-track span { display: block; width: 0; height: 100%; background: var(--cyan); transition: width .25s ease; }
.publish-progress small { display: block; min-height: 16px; margin-top: 7px; color: var(--muted); font-size: 11px; }
.publish-progress[data-status="completed"] .publish-progress-track span { background: var(--green); }
.publish-progress[data-status="failed"] .publish-progress-heading strong,
.publish-progress[data-status="failed"] .publish-progress-heading span,
.publish-progress[data-status="failed"] small { color: var(--red); }
.publish-progress[data-status="failed"] .publish-progress-track span { background: var(--red); }
.diff-pill.same { color: var(--green); background: var(--green-soft); }
.diff-pill.changed { color: var(--red); background: var(--red-soft); }
.diff-pill.added { color: var(--cyan); background: var(--cyan-soft); }
.publish-controls { display: grid; grid-template-columns: 150px minmax(160px, 1fr) auto auto; gap: 10px; align-items: end; padding: 14px; border-top: 1px solid var(--line); }
.publish-controls label, .test-form label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; }
.publish-controls input, .test-form input { height: 38px; padding: 0 10px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 4px; }
.event-summary { margin: -4px 0 8px; color: var(--muted); font-size: 11px; text-align: right; }
.event-list { overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.event-header, .event-row { display: grid; grid-template-columns: 112px minmax(250px, .95fr) minmax(220px, 1.25fr) 105px 58px 130px; align-items: center; padding: 8px 14px; }
.event-header { min-height: 38px; color: #596268; background: #f7f8f8; border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 700; }
.event-row { min-height: 62px; border-bottom: 1px solid var(--line); font-size: 12px; }
.event-row:last-child { border-bottom: 0; }
.event-type { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.event-type i { width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); }
.event-type.complete i { background: var(--green); }
.event-type.fail i { background: var(--red); }
.event-type.unmatched i { background: var(--amber); }
.event-type.duplicate i { background: var(--cyan); }
.event-type.unknown i { background: #879096; }
.event-subject strong, .event-subject small { display: block; }
.event-subject small { max-width: 300px; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.event-subject .event-spec { color: #68777c; font-family: Bahnschrift, "Arial Narrow", sans-serif; }
.event-message { padding-right: 12px; line-height: 1.45; white-space: normal; }
.event-row small { color: var(--muted); }
.preview-cell { display: grid; place-items: center; }
.preview-button { width: 30px; height: 30px; display: grid; place-items: center; padding: 0; color: #426e80; background: #edf6f8; border: 1px solid #c7dbe1; border-radius: 4px; }
.preview-button:hover { color: #1d4f63; background: #dceef2; border-color: #8eb5c2; }
.preview-button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.preview-button i { position: relative; width: 13px; height: 13px; display: block; border: 1.5px solid currentColor; transform: rotate(30deg) skewY(-8deg); }
.preview-button i::before, .preview-button i::after { position: absolute; display: block; content: ""; }
.preview-button i::before { width: 9px; height: 9px; margin: 1px; border-top: 1px solid currentColor; border-left: 1px solid currentColor; }
.preview-button i::after { width: 3px; height: 3px; margin: 4px; background: currentColor; border-radius: 50%; }
.preview-unavailable { color: var(--muted); }
.test-bench { display: grid; grid-template-columns: minmax(300px, .8fr) minmax(320px, 1.2fr); gap: 20px; }
.test-form, .test-result { min-height: 300px; padding: 22px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.test-form label { margin-top: 28px; }
.test-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.result-placeholder { min-height: 220px; display: grid; place-content: center; color: var(--muted); }
.result-block { display: grid; gap: 8px; padding-top: 20px; }
.result-block strong { font-size: 22px; }
.result-block dl { display: grid; grid-template-columns: 90px 1fr; gap: 8px; margin: 10px 0 0; font-size: 12px; }
.result-block dt { color: var(--muted); }
.result-block dd { margin: 0; word-break: break-all; }
.system-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.system-grid article { min-height: 110px; padding: 18px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.system-grid span, .system-grid strong { display: block; }
.system-grid span { color: var(--muted); font-size: 11px; }
.system-grid strong { display: inline-block; margin-top: 12px; font-family: Bahnschrift, sans-serif; font-size: 27px; }
.system-grid small { margin-left: 5px; color: var(--muted); }
.system-panel { margin-top: 18px; padding: 20px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.system-panel h2 { margin-bottom: 18px; }
.system-panel dl { margin: 0; }
.system-panel dl div { display: grid; grid-template-columns: 150px minmax(0, 1fr); padding: 13px 0; border-top: 1px solid var(--line); font-size: 12px; }
.system-panel dt { color: var(--muted); }
.system-panel dd { min-width: 0; margin: 0; overflow-wrap: anywhere; word-break: normal; }
.source-import-panel > header { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.source-import-panel > header h2 { margin: 0; }
.source-import-table { overflow-x: auto; }
.source-import-table table { width: 100%; min-width: 900px; border-collapse: collapse; font-size: 12px; }
.source-import-table th, .source-import-table td { padding: 11px 10px; border-top: 1px solid var(--line); text-align: left; white-space: nowrap; }
.source-import-table th { color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .04em; }
.source-import-table td strong, .source-import-table td small { display: block; }
.source-import-table td small { margin-top: 3px; color: var(--muted); }
.source-import-folder { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.source-import-result { display: inline-flex; padding: 4px 7px; border-radius: 3px; font-size: 11px; }
.source-import-result.imported { color: #176c51; background: #e5f2eb; }
.source-import-result.skipped { color: #775818; background: #f7eed6; }
.action-modal { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; padding: 18px; background: rgba(24, 33, 38, .48); }
.action-modal > section { width: min(480px, 100%); overflow: hidden; background: var(--paper); border: 1px solid #bfc7ca; border-radius: 7px; box-shadow: 0 22px 70px rgba(16, 24, 28, .28); }
.action-modal > section > header { min-height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.action-modal form { display: grid; gap: 15px; padding: 18px; }
.action-impact { margin: 0; padding: 11px 12px; color: #5d4a22; background: var(--amber-soft); border-left: 3px solid var(--amber); font-size: 12px; line-height: 1.6; }
.action-impact.danger { color: #70231d; background: var(--red-soft); border-left-color: var(--red); }
.action-modal label { display: grid; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 700; }
.action-modal select, .action-modal textarea { width: 100%; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 4px; }
.action-modal select { height: 40px; padding: 0 10px; }
.action-modal textarea { min-height: 92px; resize: vertical; padding: 10px; line-height: 1.5; }
.action-form-buttons { display: flex; justify-content: flex-end; gap: 9px; padding-top: 2px; }
.preview-modal { position: fixed; inset: 0; z-index: 44; display: grid; place-items: center; padding: 18px; background: rgba(24, 33, 38, .48); }
.preview-modal > section { width: min(880px, 100%); overflow: hidden; background: var(--paper); border: 1px solid #bfc7ca; border-radius: 7px; box-shadow: 0 22px 70px rgba(16, 24, 28, .28); }
.preview-modal > section > header { min-height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.preview-meta { display: grid; grid-template-columns: 1fr 1.35fr 1fr; border-bottom: 1px solid var(--line); }
.preview-meta div { min-width: 0; padding: 11px 16px; border-right: 1px solid var(--line); }
.preview-meta div:last-child { border-right: 0; }
.preview-meta span, .preview-meta strong { display: block; }
.preview-meta span { color: var(--muted); font-size: 10px; }
.preview-meta strong { margin-top: 4px; overflow: hidden; font-family: Bahnschrift, "Arial Narrow", sans-serif; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.preview-stage { position: relative; height: min(58vh, 510px); min-height: 280px; background: #f4f7f7; cursor: grab; touch-action: none; }
.preview-stage:active { cursor: grabbing; }
.preview-canvas { width: 100%; height: 100%; display: block; outline: 0; }
.preview-placeholder { height: 100%; display: grid; place-items: center; padding: 26px; color: var(--muted); font-size: 12px; line-height: 1.65; text-align: center; }
.preview-modal footer { min-height: 45px; display: flex; align-items: center; padding: 8px 16px; color: var(--muted); border-top: 1px solid var(--line); font-size: 11px; line-height: 1.5; }
.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: grid; gap: 8px; }
.toast { min-width: 260px; max-width: 420px; padding: 12px 14px; color: #fff; background: #263136; border-radius: 4px; box-shadow: 0 8px 24px rgba(20, 28, 32, .22); font-size: 12px; animation: toast-in .18s ease-out; }
.toast.error { background: var(--red); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 76px minmax(0, 1fr); }
  .brand { justify-content: center; padding: 16px 8px; }
  .brand > div, .nav-item:not(.active)::after, .nav-item { font-size: 0; }
  .nav-item { justify-content: center; padding: 0; }
  .nav-item span { font-size: 19px; }
  .machine-rail { justify-content: center; padding: 16px 8px; }
  .machine-rail > div { display: none; }
  .metric-strip, .system-grid { grid-template-columns: repeat(2, 1fr); }
  .metric-strip > :nth-child(2) { border-right: 0; }
  .metric-strip > :nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .dashboard-metrics { grid-template-columns: repeat(3, 1fr); }
  .dashboard-metrics > :nth-child(2) { border-right: 1px solid var(--line); }
  .dashboard-metrics > :nth-child(3) { border-right: 0; }
  .dashboard-metrics > :nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .upload-layout, .test-bench { grid-template-columns: 1fr; }
  .order-detail { right: 12px; width: calc(100vw - 24px); }
}

@media (max-height: 760px) and (min-width: 681px) {
  .order-detail { top: 8px; bottom: 8px; }
  .order-detail > header { min-height: 54px; padding: 10px 14px; }
  .detail-summary div { padding: 8px 12px; }
  .detail-toolbar { padding: 7px 12px; }
  .detail-table { margin: 0 12px 8px; }
  .detail-versions { flex-basis: 112px; }
  .detail-audit { flex-basis: 112px; }
  .version-history { max-height: 58px; }
  .audit-list { max-height: 58px; }
  .version-history-row, .audit-row { min-height: 38px; padding-top: 5px; padding-bottom: 5px; }
}

@media (max-width: 680px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; inset: auto 0 0; z-index: 30; width: 100%; height: 62px; flex-direction: row; border: 0; border-top: 1px solid #384247; }
  .brand, .machine-rail { display: none; }
  nav { width: 100%; grid-template-columns: repeat(6, 1fr); gap: 0; padding: 6px; }
  .nav-item { min-height: 50px; }
  .nav-item.active { box-shadow: inset 0 -3px #8fd3db; }
  .workspace { padding: 0 12px 86px; }
  .topbar { height: 72px; }
  .connection { display: none; }
  h1 { font-size: 20px; }
  .monitor-toolbar { align-items: stretch; flex-direction: column; gap: 12px; }
  .month-controls { grid-template-columns: minmax(0, 1fr) auto; }
  .metric-strip { grid-template-columns: 1fr 1fr; }
  .dashboard-metrics { grid-template-columns: 1fr 1fr; }
  .dashboard-metrics > :nth-child(odd) { border-right: 1px solid var(--line); }
  .dashboard-metrics > :nth-child(even) { border-right: 0; }
  .dashboard-metrics > :nth-child(-n+4) { border-bottom: 1px solid var(--line); }
  .dashboard-metrics > :nth-child(n+5) { border-bottom: 0; }
  .recent-processing > header { min-height: 58px; }
  .recent-table { max-height: 390px; }
  .recent-table table, .recent-table tbody, .recent-table tr, .recent-table td { display: block; }
  .recent-table thead { display: none; }
  .recent-table tr { position: relative; min-height: 104px; padding: 12px 96px 12px 118px; border-bottom: 1px solid var(--line); }
  .recent-table tr:last-child { border-bottom: 0; }
  .recent-table td { width: auto !important; height: auto; padding: 0; border: 0; white-space: normal; }
  .recent-table td:first-child { position: absolute; top: 14px; left: 12px; width: 94px !important; }
  .recent-state > strong { display: block; margin: 6px 0 0; }
  .recent-table td:nth-child(2), .recent-table td:nth-child(3) { min-width: 0; }
  .recent-table td:nth-child(3) { margin-top: 8px; }
  .recent-table td:nth-child(4) { position: absolute; top: 15px; right: 12px; color: var(--muted); font-size: 11px; text-align: right; }
  .recent-table td:nth-child(5) { position: absolute; right: 12px; bottom: 10px; }
  .recent-table td:last-child { position: absolute; right: 54px; bottom: 16px; color: var(--muted); font-size: 11px; text-align: right; }
  .recent-board small, .recent-address strong { white-space: nowrap; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .segmented { overflow-x: auto; }
  .search { min-width: 0; width: 100%; }
  .order-detail { inset: 8px 8px 72px; width: auto; }
  .detail-summary { grid-template-columns: 1fr 1fr; }
  .detail-toolbar { align-items: stretch; flex-direction: column; }
  .board-filter { justify-content: space-between; }
  .board-filter select { flex: 1; }
  .detail-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .detail-actions button { justify-content: center; min-width: 0; padding: 0 8px; }
  .detail-table { min-height: 150px; }
  .detail-versions { flex-basis: 194px; }
  .version-history { max-height: 140px; }
  .version-history-row { grid-template-columns: 40px minmax(0, 1fr) 98px; gap: 4px 8px; padding: 8px 14px; }
  .version-history-change, .version-history-folder { grid-column: 2 / -1; }
  .version-history-row time { grid-column: 3; grid-row: 1; }
  .detail-audit { flex-basis: 190px; }
  .audit-list { max-height: 136px; }
  .audit-row { grid-template-columns: 90px minmax(0, 1fr); gap: 4px 10px; padding-left: 28px; }
  .audit-reason, .audit-row time { grid-column: 2; text-align: left; }
  .publish-controls { grid-template-columns: 1fr 1fr; }
  .analysis-metrics { grid-template-columns: repeat(3, 1fr); }
  .event-header { display: none; }
  .event-row { grid-template-columns: 96px minmax(0, 1fr); gap: 4px 10px; }
  .event-row > *:nth-child(n+3) { grid-column: 2; }
  .preview-modal { padding: 10px; }
  .preview-meta { grid-template-columns: 1fr 1fr; }
  .preview-meta div:last-child { grid-column: 1 / -1; border-top: 1px solid var(--line); }
  .preview-stage { min-height: 250px; height: 46vh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
