/* BBTruck 貨況可視化 demo — 設計系統 */
:root {
  --font: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #16202c;
  --ink-2: #5b6878;
  --ink-3: #8b96a5;
  --line: #e3e8ee;
  --line-2: #cfd7e0;
  --accent: #1f5eff;
  --accent-ink: #0d3fc4;
  --accent-soft: #e8efff;
  --nav-bg: #0f1b2d;
  --nav-ink: #c6d0de;
  --nav-active: #1f5eff;
  /* 狀態色（固定；一律附圖示＋文字） */
  --verified: #0aac23;
  --verified-soft: #e3f7e6;
  --reported: #d28e05;
  --reported-soft: #fff4d6;
  --conflict: #dc3c3d;
  --conflict-soft: #fde4e4;
  --pending: #9aa5b1;
  --pending-soft: #eef1f4;
  /* 嚴重度 */
  --sev-critical: #dc3c3d;
  --sev-high: #f18a59;
  --sev-medium: #fbb315;
  --sev-low: #6b7a8c;
  /* 貨件狀態（類別色，固定順序） */
  --st-pre: #7b8794;
  --st-transit: #257de0;
  --st-port: #00b894;
  --st-inland: #f47230;
  --st-delivered: #008a17;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 32, 44, .06), 0 4px 16px rgba(16, 32, 44, .06);
  --sidebar-w: 224px;
  --topbar-h: 56px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg.ic { width: 18px; height: 18px; vertical-align: -4px; flex: none; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--ink-2); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- 殼層 ---------- */
.app { min-height: 100%; }
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { background: var(--nav-bg); color: var(--nav-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 18px; color: #fff; font-weight: 700; font-size: 15px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand svg { width: 26px; height: 26px; color: #6ea0ff; }
.brand small { display: block; font-weight: 400; font-size: 11px; color: var(--nav-ink); }
.nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-title { font-size: 11px; letter-spacing: .08em; color: #7d8ba0; padding: 14px 10px 6px; text-transform: uppercase; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--nav-ink); font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav a.active { background: var(--nav-active); color: #fff; }
.nav a .badge { margin-left: auto; }
.sidebar-foot { margin-top: auto; padding: 14px 18px; font-size: 11px; color: #7d8ba0; border-top: 1px solid rgba(255,255,255,.08); }
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 0 20px; position: sticky; top: 0; z-index: 20; }
.topbar .title { font-weight: 700; font-size: 16px; margin-right: auto; display: flex; align-items: center; gap: 8px; }
.menu-btn { display: none; background: none; border: 0; padding: 6px; border-radius: 6px; }
.content { padding: 20px; flex: 1; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; margin: 0; }
.page-head p { margin: 2px 0 0; color: var(--ink-2); }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 6px; color: var(--ink-2); font-weight: 500; }
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg button:hover:not(.active) { color: var(--ink); }
.search { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; height: 36px; width: 260px; }
.search input { border: 0; background: transparent; outline: none; width: 100%; }
.search svg { color: var(--ink-3); }
.clock { font-size: 12px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.clock b { color: var(--ink); font-weight: 600; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; font-size: 12px; }

/* ---------- 元件 ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 600; }
.card-h .sub { font-weight: 400; color: var(--ink-2); font-size: 12px; }
.card-b { padding: 16px; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: var(--surface); padding: 7px 12px; border-radius: 8px; font-weight: 500; white-space: nowrap; line-height: 1.2; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn.ghost { border-color: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.danger { color: var(--conflict); border-color: #f1b3b3; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 18px; white-space: nowrap; }
.chip svg { width: 13px; height: 13px; }
.chip.verified { background: var(--verified-soft); color: #06791a; }
.chip.reported { background: var(--reported-soft); color: #8a5d00; }
.chip.conflict { background: var(--conflict-soft); color: #b01f20; }
.chip.pending { background: var(--pending-soft); color: var(--ink-2); }
.chip.neutral { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.chip.accent { background: var(--accent-soft); color: var(--accent-ink); }
.chip.st-pre_departure { background: #eef1f4; color: #4e5a68; }
.chip.st-in_transit { background: #e3eefc; color: #16509a; }
.chip.st-at_port { background: #dcf7f0; color: #0b6f5a; }
.chip.st-inland { background: #ffe8db; color: #a34412; }
.chip.st-delivered { background: #e3f7e6; color: #06791a; }
.chip.sev-critical { background: var(--conflict-soft); color: #b01f20; }
.chip.sev-high { background: #ffe6d9; color: #a84b1c; }
.chip.sev-medium { background: #fff1c9; color: #8a5d00; }
.chip.sev-low { background: var(--pending-soft); color: var(--ink-2); }
.chip.cs-released { background: var(--verified-soft); color: #06791a; }
.chip.cs-filed { background: #e3eefc; color: #16509a; }
.chip.cs-inspection { background: #fff1c9; color: #8a5d00; }
.chip.cs-held { background: var(--conflict-soft); color: #b01f20; }
.chip.cs-docs_pending { background: #ffe8db; color: #a34412; }
.chip.cs-not_started { background: var(--pending-soft); color: var(--ink-2); }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--conflict); color: #fff; font-size: 11px; font-weight: 700; }
.badge.amber { background: var(--reported); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 13px; }
.kv dt { color: var(--ink-2); margin: 0; }
.kv dd { margin: 0; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--ink); }
.tbl th .arr { color: var(--accent); margin-left: 3px; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr.lnk:hover td { background: #f6f9ff; cursor: pointer; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-wrap { overflow: auto; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 11.5px; color: var(--ink-2); font-weight: 500; }
.field select, .field input, .field textarea { border: 1px solid var(--line-2); border-radius: 7px; padding: 6px 9px; background: var(--surface); min-width: 120px; height: 34px; }
.field textarea { height: auto; min-height: 60px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.empty { text-align: center; padding: 48px 20px; color: var(--ink-2); }
.empty svg { width: 42px; height: 42px; color: var(--ink-3); margin-bottom: 10px; }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.note { background: #fff8e6; border: 1px solid #ffe2a1; color: #6b4b00; padding: 10px 14px; border-radius: 8px; font-size: 13px; }
.note.info { background: var(--accent-soft); border-color: #c5d6ff; color: #1e3d8f; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: #16202c; color: #fff; padding: 10px 14px; border-radius: 8px; font-size: 13px; box-shadow: var(--shadow); animation: toast-in .2s ease; max-width: 360px; }
.toast.ok { border-left: 4px solid var(--verified); }
.toast.err { border-left: 4px solid var(--conflict); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.skeleton { background: linear-gradient(90deg, #eceff3 25%, #f6f7f9 50%, #eceff3 75%); background-size: 200% 100%; animation: sk 1.1s infinite; border-radius: 8px; }
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
pre.code { background: #0f1b2d; color: #d9e2f0; padding: 14px 16px; border-radius: 8px; font-family: var(--mono); font-size: 12.5px; overflow: auto; line-height: 1.55; margin: 0; }
pre.code .k { color: #8ab4ff; }
pre.code .s { color: #9be3a6; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 16px; }
.tabs button { border: 0; background: none; padding: 11px 12px; color: var(--ink-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--accent-ink); border-color: var(--accent); }
.tabs button .cnt { margin-left: 5px; font-size: 11px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 0 6px; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; transition: box-shadow .15s; position: relative; }
.kpi:hover { box-shadow: var(--shadow); }
.kpi .lbl { font-size: 12px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.kpi .val { font-size: 28px; font-weight: 650; letter-spacing: -.01em; line-height: 1.1; }
.kpi .sub { font-size: 12px; color: var(--ink-2); }
.kpi .ind { position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; }
.kpi.active { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ---------- 地圖頁 ---------- */
.map-layout { display: grid; grid-template-columns: 1fr 340px; gap: 14px; height: calc(100vh - var(--topbar-h) - 40px - 92px); min-height: 480px; }
.map-card { position: relative; overflow: hidden; background: #0b1f3a; border-radius: var(--radius); border: 1px solid #1d3356; }
.map-svg { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.map-svg.dragging { cursor: grabbing; }
.map-land { fill: #223a5a; stroke: #3b5a86; stroke-width: .6; vector-effect: non-scaling-stroke; }
.map-grat { stroke: rgba(255,255,255,.05); fill: none; vector-effect: non-scaling-stroke; }
.route { fill: none; stroke: rgba(120, 170, 255, .28); stroke-width: 1.3; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.route.air { stroke-dasharray: 5 4; }
.route.sel { stroke: #7fb0ff; stroke-width: 2.4; }
.route.done { stroke: rgba(120, 170, 255, .14); }
.port-dot { fill: #9db5d6; stroke: #0b1f3a; stroke-width: 1; }
.port-lbl { fill: #b7c9e4; font-size: 11px; font-family: var(--font); pointer-events: none; paint-order: stroke; stroke: #0b1f3a; stroke-width: 3px; stroke-linejoin: round; }
.mk { cursor: pointer; }
.mk circle.halo { fill: none; stroke-width: 1.5; opacity: .35; }
.mk circle.core { stroke: #fff; stroke-width: 1.5; }
.mk.sel circle.halo { opacity: .9; stroke-width: 2.5; }
.mk .ico { fill: #fff; pointer-events: none; }
.mk text { font-size: 10.5px; font-weight: 700; fill: #fff; text-anchor: middle; pointer-events: none; font-family: var(--font); }
.cl circle { stroke: #fff; stroke-width: 1.5; }
.map-ctl { position: absolute; left: 12px; top: 12px; display: flex; flex-direction: column; gap: 4px; }
.map-ctl button { width: 32px; height: 32px; border-radius: 7px; border: 1px solid rgba(255,255,255,.15); background: rgba(15, 27, 45, .9); color: #fff; display: grid; place-items: center; }
.map-ctl button:hover { background: #1f5eff; }
.map-legend { position: absolute; left: 12px; bottom: 12px; background: rgba(15, 27, 45, .88); border: 1px solid rgba(255,255,255,.12); border-radius: 8px; padding: 8px 12px; color: #d9e2f0; font-size: 11.5px; display: flex; gap: 12px; flex-wrap: wrap; }
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.map-attr { position: absolute; right: 10px; bottom: 8px; color: rgba(217,226,240,.5); font-size: 10.5px; }
.map-hint { position: absolute; right: 12px; top: 12px; background: rgba(15, 27, 45, .88); color: #d9e2f0; font-size: 11.5px; padding: 6px 10px; border-radius: 7px; border: 1px solid rgba(255,255,255,.12); }
.map-tip { position: absolute; pointer-events: none; background: #fff; color: var(--ink); padding: 8px 10px; border-radius: 8px; box-shadow: var(--shadow); font-size: 12px; min-width: 160px; z-index: 5; }
.map-side { display: flex; flex-direction: column; min-height: 0; }
.map-side .card-b { overflow: auto; flex: 1; padding: 8px; }
.ship-item { display: flex; gap: 10px; padding: 9px 10px; border-radius: 8px; cursor: pointer; align-items: flex-start; }
.ship-item:hover { background: var(--surface-2); }
.ship-item.sel { background: var(--accent-soft); }
.ship-item .st { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex: none; }
.ship-item .t { font-weight: 600; font-size: 13px; display: flex; gap: 6px; align-items: center; }
.ship-item .d { font-size: 12px; color: var(--ink-2); }
.sel-card { padding: 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.sel-card h3 { margin: 0 0 6px; font-size: 14px; }
.prog { height: 6px; background: var(--pending-soft); border-radius: 3px; overflow: hidden; margin: 8px 0; }
.prog i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

/* ---------- 時間軸 ---------- */
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { display: grid; grid-template-columns: 34px 1fr; gap: 10px; position: relative; padding-bottom: 18px; }
.tl li::before { content: ""; position: absolute; left: 16px; top: 30px; bottom: 0; width: 2px; background: var(--line); }
.tl li:last-child::before { display: none; }
.tl li.verified::before { background: var(--verified); }
.tl li.reported::before { background: var(--reported); }
.tl .nd { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--pending); background: var(--surface); color: var(--pending); position: relative; z-index: 1; }
.tl .nd svg { width: 16px; height: 16px; }
.tl li.verified .nd { background: var(--verified); border-color: var(--verified); color: #fff; }
.tl li.reported .nd { background: var(--reported-soft); border-color: var(--reported); color: var(--reported); }
.tl li.conflict .nd { background: var(--conflict); border-color: var(--conflict); color: #fff; }
.tl li.current .nd { box-shadow: 0 0 0 4px var(--accent-soft); }
.tl .ttl { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-top: 5px; flex-wrap: wrap; }
.tl .ttl .idx { color: var(--ink-3); font-weight: 500; font-size: 12px; }
.tl .lines { margin-top: 4px; display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--ink-2); }
.tl .lines .ln { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tl .lines .ln b { color: var(--ink); font-weight: 600; }
.tl .lines .ln.rep b { color: #8a5d00; }
.tl .lines .ln.ver b { color: #06791a; }
.tl .lines .ln.cf { color: #b01f20; }
.tl .lines .ln.cf b { color: #b01f20; }
.conf-card { border: 1px solid #f1b3b3; background: #fff7f7; border-radius: 8px; padding: 12px; margin-bottom: 10px; }
.conf-card.handled { border-color: var(--line); background: var(--surface-2); }
.conf-card h4 { margin: 0 0 6px; font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.conf-card table { width: 100%; font-size: 12.5px; border-collapse: collapse; margin: 6px 0; }
.conf-card td { padding: 3px 0; border-bottom: 1px dashed #f1d1d1; }
.conf-card td:last-child { font-family: var(--mono); font-size: 12px; text-align: right; }
.audit { font-size: 12.5px; }
.audit .ch { font-family: var(--mono); font-size: 11.5px; }
.detail-head { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: start; }
.detail-head h1 { margin: 0; font-size: 20px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.refs { display: flex; gap: 8px 18px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-top: 8px; }
.refs b { color: var(--ink); font-family: var(--mono); font-weight: 500; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.doc-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.doc-row:last-child { border-bottom: 0; }
.doc-row .nm { font-weight: 500; flex: 1; }
.doc-row .meta { color: var(--ink-2); font-size: 12px; }
.sevbar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; gap: 2px; background: transparent; }
.sevbar i { display: block; height: 100%; }

/* ---------- 對外頁（廠商／客戶） ---------- */
.ext { min-height: 100vh; background: var(--bg); }
.ext-head { background: var(--nav-bg); color: #fff; padding: 14px 18px; display: flex; align-items: center; gap: 10px; }
.ext-head svg { width: 24px; height: 24px; color: #6ea0ff; }
.ext-head b { font-size: 15px; }
.ext-head small { display: block; color: var(--nav-ink); font-size: 11.5px; }
.ext-head .back { margin-left: auto; color: var(--nav-ink); font-size: 12px; white-space: nowrap; }
.ext-body { max-width: 720px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.ext .card-b { padding: 14px; }
.trip-card { border: 2px solid var(--accent); }
.trip-card .card-h { background: var(--accent-soft); border-radius: var(--radius) var(--radius) 0 0; }
.v-ship { padding: 12px 14px; border-top: 1px solid var(--line); }
.v-ship .t { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.v-steps { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 4px; }
.v-step { font-size: 11.5px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); display: inline-flex; gap: 4px; align-items: center; }
.v-step.verified { background: var(--verified-soft); color: #06791a; border-color: #bfe8c5; }
.v-step.reported { background: var(--reported-soft); color: #8a5d00; border-color: #f2d894; }
.v-step.conflict { background: var(--conflict-soft); color: #b01f20; border-color: #f1b3b3; }
.v-step.next { border-style: dashed; color: var(--accent-ink); border-color: var(--accent); }
.form { display: grid; gap: 10px; }
.form .field select, .form .field input { min-width: 0; width: 100%; height: 40px; }
.form .btn { height: 42px; justify-content: center; }
.file-drop { border: 1.5px dashed var(--line-2); border-radius: 8px; padding: 12px; text-align: center; color: var(--ink-2); font-size: 12.5px; background: var(--surface-2); }
.file-drop { display: block; cursor: pointer; }
.file-drop:hover { border-color: var(--accent); color: var(--accent-ink); }
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.file-err { color: var(--conflict); font-size: 12.5px; display: flex; gap: 6px; align-items: center; }
.file-ok { color: #06791a; font-size: 12.5px; display: flex; gap: 6px; align-items: center; }
.track-status { text-align: center; padding: 18px 10px 8px; }
.track-status .big { font-size: 22px; font-weight: 700; }
.track-steps { list-style: none; margin: 0; padding: 0 4px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.track-steps li { text-align: center; font-size: 11px; color: var(--ink-2); }
.track-steps li i { display: block; height: 6px; border-radius: 3px; background: var(--pending-soft); margin-bottom: 4px; }
.track-steps li.done i { background: var(--verified); }
.track-steps li.rep i { background: var(--reported); }
.track-steps li.cur { color: var(--accent-ink); font-weight: 600; }
.track-tl { list-style: none; margin: 0; padding: 0; }
.track-tl li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.track-tl li:last-child { border-bottom: 0; }
.track-tl .ico { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; flex: none; margin-top: 1px; }
.track-tl .ico svg { width: 12px; height: 12px; }
.track-tl li.done .ico { background: var(--verified); color: #fff; }
.track-tl li.rep .ico { background: var(--reported-soft); color: var(--reported); border: 1.5px solid var(--reported); }
.track-tl li.todo .ico { border: 1.5px solid var(--pending); color: var(--pending); }
.track-tl .when { margin-left: auto; color: var(--ink-2); font-size: 12px; white-space: nowrap; }

/* ---------- 整合頁 ---------- */
.int-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
.int-grid > div, .grid-2 > *, .grid-3 > *, .detail-grid > * { min-width: 0; }
.int-nav { position: sticky; top: calc(var(--topbar-h) + 20px); display: flex; flex-direction: column; gap: 2px; }
.int-nav a { padding: 8px 12px; border-radius: 7px; color: var(--ink-2); font-weight: 500; }
.int-nav a:hover { background: var(--surface); text-decoration: none; }
.int-nav a.active { background: var(--accent-soft); color: var(--accent-ink); }
.ep { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.ep:last-child { border-bottom: 0; }
.ep .m { font-family: var(--mono); font-weight: 700; font-size: 11.5px; width: 56px; text-align: center; border-radius: 5px; padding: 2px 0; }
.ep .m.get { background: #dcf7f0; color: #0b6f5a; }
.ep .m.post { background: #e3eefc; color: #16509a; }
.ep .m.patch { background: #fff1c9; color: #8a5d00; }
.ep .p { font-family: var(--mono); font-size: 12.5px; }
.ep .d { color: var(--ink-2); margin-left: auto; text-align: right; }
.tool { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.tool .n { font-family: var(--mono); font-weight: 600; font-size: 13px; }
.tool .d { font-size: 12.5px; color: var(--ink-2); margin: 2px 0 6px; }

/* ---------- 響應式 ---------- */
@media (max-width: 1180px) {
  .map-layout { grid-template-columns: 1fr 300px; }
  .detail-grid { grid-template-columns: 1fr; }
  .int-grid { grid-template-columns: 1fr; }
  .int-nav { position: static; flex-direction: row; flex-wrap: wrap; }
}
@media (max-width: 1000px) {
  :root { --sidebar-w: 64px; }
  .brand span, .nav a span, .nav-title, .sidebar-foot { display: none; }
  .nav a { justify-content: center; padding: 10px; }
  .nav a .badge { display: none; }
  .search { width: 180px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .map-layout { grid-template-columns: 1fr; height: auto; }
  .map-card { height: 460px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 240px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  :root { --sidebar-w: 240px; }
  .brand span, .nav a span, .nav-title, .sidebar-foot { display: block; }
  .nav a { justify-content: flex-start; padding: 9px 12px; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar .title small { display: none; }
  .search { width: 140px; }
  .clock { display: none; }
  .content { padding: 12px; }
  .kpis { gap: 8px; }
  .kpi .val { font-size: 22px; }
  .filters { gap: 8px; }
  .field select, .field input { min-width: 100px; }
}
@media print { .sidebar, .topbar { display: none; } .shell { grid-template-columns: 1fr; } }
