:root {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: #1c2733;
  background: #f3f5f7;
  font-size: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 1100px; }
.auth-required { display: none; }
.auth-required.authenticated { display: grid; }
.login-screen { min-height: 100vh; display: grid; place-items: center; background: #eef2f4; }
.login-screen.hidden { display: none; }
.login-panel { width: 390px; display: grid; gap: 18px; padding: 28px; background: #fff; border: 1px solid #d6dfe3; border-radius: 7px; box-shadow: 0 18px 50px #23333d18; }
.login-panel label { display: grid; gap: 6px; color: #4c5b64; }
.login-panel input, .login-panel button { width: 100%; }
.login-panel p { margin-top: 6px; color: #6c7881; }
.login-brand { color: #1c2733; padding: 0 0 18px; border-bottom-color: #dfe5e8; }
.login-error { min-height: 20px; color: #b03434; }
.language-switch { display: inline-flex; width: max-content; padding: 2px; border: 1px solid #bdc8ce; border-radius: 5px; background: #fff; }
.language-switch button { min-height: 28px; padding: 0 9px; border: 0; background: transparent; color: #52616a; }
.language-switch button.active { color: #fff; background: #176b78; }
.login-panel > .language-switch { justify-self: end; margin-top: -62px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.button-link { display: inline-flex; align-items: center; justify-content: center; min-height: 34px; border-radius: 4px; padding: 0 13px; text-decoration: none; }
.app-shell { grid-template-columns: 228px 1fr; min-height: 100vh; }
.sidebar { background: #17232b; color: #e8eef1; padding: 20px 14px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; border-bottom: 1px solid #31414b; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 7px; overflow: hidden; background: #146c73; }
.brand-mark img { display: block; width: 100%; height: 100%; }
.brand strong, .brand small { display: block; }
.brand small { color: #9eafb8; margin-top: 3px; }
nav { padding-top: 16px; }
.nav-item { width: 100%; text-align: left; border: 0; border-radius: 5px; padding: 10px 12px; margin: 2px 0; color: #cbd6db; background: transparent; }
.nav-item:hover, .nav-item.active { color: #fff; background: #2a3c47; }
.nav-item.active { box-shadow: inset 3px 0 #e3a21a; }
.nav-label { color: #81939d; font-size: 12px; text-transform: uppercase; padding: 18px 12px 6px; }
.main { padding: 0 26px 36px; overflow: hidden; }
.topbar { min-height: 82px; display: flex; align-items: center; justify-content: space-between; }
h1, h2, p { margin: 0; }
h1 { font-size: 23px; }
h2 { font-size: 16px; }
.topbar p, .panel-header p { color: #6c7881; margin-top: 5px; }
.system-status { color: #56636c; font-size: 13px; }
.system-status i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #2e9b63; margin-right: 6px; }
.user-session { display: flex; align-items: center; gap: 10px; color: #56636c; }
.user-session span { font-weight: 600; }
.page { display: none; }
.page.active { display: block; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.metric, .panel { background: #fff; border: 1px solid #dce2e6; border-radius: 7px; }
.metric { padding: 18px; border-top: 3px solid #3d768a; }
.metric span { display: block; color: #69767f; }
.metric strong { display: block; font-size: 28px; margin-top: 8px; }
/* Warehouse strip: one short card per warehouse with its four pipeline figures in a row, so the
   Suggested Focus lists below stay near the top of the page. */
.dashboard-warehouse-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.dashboard-warehouse-card { background: #fff; border: 1px solid #dce2e6; border-top: 4px solid #176b78; border-radius: 7px; overflow: hidden; }
.dashboard-card-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid #e5e9ec; background: #f8fafb; }
.dashboard-card-header h2 { font-size: 16px; }
.dashboard-card-header span { color: #fff; background: #176b78; border-radius: 4px; padding: 3px 8px; font-size: 12px; font-weight: 700; }
.warehouse-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.warehouse-metrics div { padding: 12px 16px; border-right: 1px solid #edf0f2; }
.warehouse-metrics div:last-child { border-right: 0; }
.warehouse-metrics span { display: block; color: #68757d; font-size: 12px; }
.dashboard-metric-link { display: inline-block; min-height: 0; margin-top: 4px; padding: 0; border: 0; border-radius: 0; background: transparent; color: #176b78; font-size: 22px; font-weight: 800; line-height: 1.15; text-align: left; cursor: pointer; }
.dashboard-metric-link:hover, .dashboard-metric-link:focus-visible { color: #d89a16; text-decoration: underline; }
/* Suggested Focus: a 車次 / 訂單 tab pair (with counts) over one paged table; the header's warehouse chips
   narrow both lists and the active tab's "view all" link opens the full list on its own page. */
.dashboard-focus-panel { margin-top: 4px; }
.dashboard-warehouse-filter button { min-width: 0; min-height: 30px; padding: 0 12px; }
#dashboard-focus { padding: 0; }
.focus-tabs { display: flex; align-items: center; gap: 4px; padding: 6px 16px 0; border-bottom: 1px solid #e5e9ec; }
.focus-tab { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 14px; border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: transparent; color: #56636c; font-weight: 700; }
.focus-tab:hover { color: #1c2733; }
.focus-tab.active { color: #176b78; border-bottom-color: #176b78; }
.focus-count { padding: 2px 8px; border-radius: 11px; background: #edf2f4; color: #47545c; font-size: 12px; font-weight: 700; white-space: nowrap; }
.focus-tab.active .focus-count { color: #fff; background: #176b78; }
.focus-view-all { margin-left: auto; font-size: 13px; }
.focus-pagination { border-top: 1px solid #e4e8eb; }
.focus-table th, .focus-table td { padding: 9px 13px; }
.focus-table tbody tr.focus-row-link { cursor: pointer; }
.focus-table tbody tr.focus-row-link:hover { background: #eaf4f6; }
.dashboard-empty-focus { margin: 0; padding: 4px 16px 17px; }
.age-pill, .reason-pill { display: inline-block; border-radius: 4px; padding: 3px 7px; font-size: 12px; font-weight: 700; color: #47545c; background: #edf2f4; white-space: nowrap; }
.age-pill.warn, .reason-pill.stale { color: #855617; background: #fbefd9; }
.age-pill.critical, .reason-pill.overdue { color: #a02f2f; background: #f8e4e4; }
/* The filter row under the tabs (one wrapping line) and the sortable column headers. */
.focus-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 12px; padding: 10px 16px; border-bottom: 1px solid #e5e9ec; background: #f8fafb; }
.focus-filters label { display: grid; gap: 4px; color: #4c5b64; font-size: 12px; }
.focus-filters input { height: 30px; width: 150px; }
.focus-filter-actions { display: flex; gap: 8px; }
.focus-filters button { min-height: 30px; }
.sort-header { display: inline-flex; align-items: center; gap: 4px; min-height: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: inherit; font: inherit; text-transform: inherit; cursor: pointer; }
.sort-header:hover { color: #1c2733; }
.sort-mark { display: inline-block; width: 10px; text-align: center; font-size: 9px; color: #176b78; }
/* Column widths come from each table's colgroup, so sorting or paging never reflows them; long
   cells clip with an ellipsis, and the table scrolls inside .table-wrap on narrow screens. */
.focus-table { table-layout: fixed; min-width: 960px; }
.focus-table th, .focus-table td { overflow: hidden; text-overflow: ellipsis; }
/* The waiting-days threshold: inline in the panel subtitle and inside the quick-filter checkbox. */
.stale-days-input { width: 60px; height: 26px; padding: 0 6px; text-align: center; }
.status-checkboxes .stale-days-input { width: 54px; height: 22px; cursor: text; }
.stale-filter .status-checkboxes label { height: auto; min-height: 28px; flex-wrap: wrap; }
.panel { margin-bottom: 14px; }
.panel-header, .toolbar { min-height: 56px; padding: 13px 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #e4e8eb; }
.toolbar { gap: 16px; }
.toolbar-actions { display: flex; gap: 8px; white-space: nowrap; }
.toolbar-actions .selection-summary { align-self: center; }
.warehouse-switch { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.warehouse-switch button { min-width: 150px; }
.warehouse-switch button.active { color: #fff; background: #176b78; border-color: #176b78; }
.dispatch-warehouse-panel .panel-header { border-bottom: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
input, select { height: 34px; border: 1px solid #cbd3d8; border-radius: 4px; padding: 0 9px; background: #fff; color: #26343d; }
textarea { border: 1px solid #cbd3d8; border-radius: 4px; padding: 8px 9px; resize: vertical; color: #26343d; }
textarea[name="special_instructions"] { min-height: 90px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bdd9e2; border-color: #3d768a; }
button { min-height: 34px; border-radius: 4px; padding: 0 13px; border: 1px solid transparent; }
.primary { color: #fff; background: #176b78; border-color: #176b78; }
.primary:hover { background: #105d69; }
.primary:disabled { opacity: .45; cursor: not-allowed; }
.secondary { color: #2b3942; background: #fff; border-color: #bdc8ce; }
.dispatch-page #generate-dispatch,
#generate-dispatch,
.recalculate-truck {
  color: #17232b;
  background: #f3b21a;
  border-color: #f3b21a;
  font-weight: 700;
}
.dispatch-page #generate-dispatch:hover,
#generate-dispatch:hover,
.recalculate-truck:hover {
  background: #dda112;
  border-color: #dda112;
}
.time-table-plan,
.shipping-slip-plan {
  color: #17232b;
  background: #f3b21a;
  border-color: #f3b21a;
  font-weight: 700;
}
.time-table-plan:hover,
.shipping-slip-plan:hover {
  background: #dda112;
  border-color: #dda112;
}
.add-orders,
.add-plan-orders,
.add-plan-manual-group {
  color: #fff;
  background: #176b78;
  border-color: #176b78;
}
.add-orders:hover,
.add-plan-orders:hover,
.add-plan-manual-group:hover {
  background: #105d69;
  border-color: #105d69;
}
.danger { color: #b03434; background: #fff; border-color: #d9b3b3; min-height: 28px; padding: 0 9px; }
.yellow-action { color: #17232b; background: #f3b21a; border-color: #f3b21a; }
.yellow-action:hover { background: #dda112; border-color: #dda112; }
.solid-danger { color: #fff; background: #c93636; border-color: #c93636; }
.solid-danger:hover { background: #a92525; border-color: #a92525; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th { color: #52616a; background: #f7f8f9; font-size: 12px; text-transform: uppercase; text-align: left; }
th, td { padding: 11px 13px; border-bottom: 1px solid #e5e9ec; vertical-align: top; white-space: nowrap; }
/* Reference-data management lists (Trade, POC, address, warehouse, holiday, dockdoor, truck type, shipment
   unit, pipe cart, user) put single-line text next to 34px action buttons: centre their cells so the text does
   not hug the top of the row. The order pool, dispatch and truck plan tables keep the default top alignment
   for their multi-line cells. */
#page-trades td, #page-pocs td, #page-addresses td, #page-warehouses td, #page-holidays td, #page-dockdoors td,
#page-trucks td, #page-units td, #page-pipe-carts td, #page-users td { vertical-align: middle; }
/* Row action buttons (the Edit / Delete pairs in the order pool, Trade, POC, address, warehouse, dockdoor,
   truck type, shipment unit, pipe cart, holiday and user tables): one height, one padding and one minimum
   width, so the Chinese and English labels render as an equal-sized pair. */
.edit-order, .delete-order, .edit-trade, .delete-trade, .edit-poc, .delete-poc, .edit-address, .delete-address,
.edit-warehouse, .delete-warehouse, .edit-dockdoor, .delete-dockdoor, .edit-truck-type, .delete-truck-type,
.edit-unit, .delete-unit, .edit-pipe-cart, .delete-pipe-cart, .edit-holiday, .delete-holiday,
.edit-user, .reset-user-password, .delete-user { min-height: 34px; padding: 0 10px; min-width: 62px; transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
/* Hover feedback for the same buttons: Edit tints grey with a darker border, Delete tints red. */
.edit-order:hover, .edit-trade:hover, .edit-poc:hover, .edit-address:hover, .edit-warehouse:hover, .edit-dockdoor:hover,
.edit-truck-type:hover, .edit-unit:hover, .edit-pipe-cart:hover, .edit-holiday:hover, .edit-user:hover,
.reset-user-password:hover { background: #e9eff2; border-color: #7f97a3; color: #17232b; }
.delete-order:hover, .delete-trade:hover, .delete-poc:hover, .delete-address:hover, .delete-warehouse:hover, .delete-dockdoor:hover,
.delete-truck-type:hover, .delete-unit:hover, .delete-pipe-cart:hover, .delete-holiday:hover,
.delete-user:hover { background: #fbe9e9; border-color: #c97a7a; color: #962b2b; }
.order-pool-wrap { max-height: calc(100vh - 325px); position: relative; }
.order-pool-table { min-width: 1964px; table-layout: fixed; border-collapse: separate; border-spacing: 0; }
.order-pool-table th { position: sticky; top: 0; z-index: 5; }
.order-pool-table th:first-child,
.order-pool-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 4;
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  background: #fff;
  box-shadow: 1px 0 0 #dce2e6;
}
.order-pool-table th:nth-child(2),
.order-pool-table td:nth-child(2) {
  position: sticky;
  left: 44px;
  z-index: 4;
  width: 120px;
  min-width: 120px;
  max-width: 120px;
  background: #fff;
  box-shadow: 1px 0 0 #dce2e6;
}
.order-pool-table th:nth-child(3),
.order-pool-table td:nth-child(3) {
  position: sticky;
  left: 164px;
  z-index: 4;
  width: 140px;
  min-width: 140px;
  max-width: 140px;
  background: #fff;
  box-shadow: 1px 0 0 #dce2e6;
}
.order-pool-table th:nth-child(4),
.order-pool-table td:nth-child(4) {
  position: sticky;
  left: 304px;
  z-index: 4;
  width: 210px;
  min-width: 210px;
  max-width: 210px;
  background: #fff;
  box-shadow: 1px 0 0 #dce2e6;
}
.order-pool-table th:first-child,
.order-pool-table th:nth-child(2),
.order-pool-table th:nth-child(3),
.order-pool-table th:nth-child(4) {
  z-index: 7;
  background: #f7f8f9;
}
.order-pool-table th:last-child,
.order-pool-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 4;
  width: 160px;
  min-width: 160px;
  max-width: 160px;
  background: #fff;
  box-shadow: -1px 0 0 #dce2e6;
}
.order-pool-table th:last-child { z-index: 7; background: #f7f8f9; }
.order-pool-table th:nth-child(16),
.order-pool-table td:nth-child(16) {
  position: sticky;
  right: 160px;
  z-index: 4;
  width: 136px;
  min-width: 136px;
  max-width: 136px;
  background: #fff;
  box-shadow: -1px 0 0 #dce2e6;
}
.order-pool-table th:nth-child(16) { z-index: 7; background: #f7f8f9; }
.order-pool-table tbody tr:hover td { background: #fafcfc; }
.order-pool-table tbody tr:hover td:first-child,
.order-pool-table tbody tr:hover td:nth-child(2),
.order-pool-table tbody tr:hover td:nth-child(3),
.order-pool-table tbody tr:hover td:nth-child(4),
.order-pool-table tbody tr:hover td:nth-child(16),
.order-pool-table tbody tr:hover td:last-child { background: #fafcfc; }
.order-pool-table tbody tr.selected td:first-child,
.order-pool-table tbody tr.selected td:nth-child(2),
.order-pool-table tbody tr.selected td:nth-child(3),
.order-pool-table tbody tr.selected td:nth-child(4),
.order-pool-table tbody tr.selected td:nth-child(16),
.order-pool-table tbody tr.selected td:last-child { background: #eaf4f6; }
.order-pool-table th:nth-child(5), .order-pool-table td:nth-child(5) { width: 170px; }
.order-pool-table td.order-no-cell,
.order-pool-table td.order-no-cell strong {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
}
.order-pool-table th:nth-child(6), .order-pool-table td:nth-child(6) { width: 130px; }
.order-pool-table th:nth-child(n+7):nth-child(-n+13),
.order-pool-table td:nth-child(n+7):nth-child(-n+13) { width: 92px; text-align: right; }
.order-pool-table th:nth-child(14), .order-pool-table td:nth-child(14) { width: 310px; }
.order-pool-table th:nth-child(15), .order-pool-table td:nth-child(15) { width: 230px; }
/* The order pool is table-layout: fixed, so a column never widens to fit its text, and with the
   default white-space: nowrap a long value ran out of its cell: a long Trade name printed over the
   倉庫 column and a long email slid under the sticky 狀態 column. Every body cell wraps inside its
   own column instead, splitting a word only when the word alone is wider than the column (an
   email). 狀態 (above) is 136px so the longest status badge, "Awaiting Pickup", stays on one line. */
.order-pool-table td { white-space: normal; overflow-wrap: anywhere; }
td.address { white-space: normal; min-width: 250px; line-height: 1.4; }
tbody tr:hover { background: #fafcfc; }
.badge { display: inline-block; border-radius: 4px; padding: 3px 7px; font-size: 12px; font-weight: 600; background: #edf2f4; }
.badge.active, .badge.unassigned { color: #176344; background: #e3f3eb; }
.badge.pending { color: #47545c; background: #e8edef; }
.badge.dispatched, .badge.completed { color: #176344; background: #e3f3eb; }
.badge.cancelled { color: #a02f2f; background: #f8e4e4; }
.badge.onsite { color: #145e79; background: #e3f1f6; }
.badge.offsite { color: #855617; background: #fbefd9; }
/* Self Pick page: the category (Self Pick / Prefab) and the pickup status. */
.badge.self_pick { color: #145e79; background: #e3f1f6; }
.badge.prefab { color: #5b3c8c; background: #eee7f8; }
.badge.awaiting_pickup { color: #855617; background: #fbefd9; }
.badge.picked_up { color: #176344; background: #e3f3eb; }
#alerts { padding: 8px 16px 16px; }
.alert-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #edf0f2; }
.alert-row:last-child { border: 0; }
.workflow ol { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 0; padding: 18px 18px 18px 44px; }
.workflow li { padding-right: 18px; line-height: 1.5; }
.dispatch-flow { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 42px 20px; }
.dispatch-flow span { padding: 12px 16px; border: 1px solid #b8c8ce; background: #f8fafb; border-radius: 5px; }
.dispatch-flow b { color: #8a979e; font-size: 18px; }
.pending-pool { max-height: 280px; }
.pending-pool thead th,
.add-order-list thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f7f8f9;
  box-shadow: 0 1px 0 #dce2e6;
}
.pending-pool tbody tr.selected, .order-pool-table tbody tr.selected, .self-pick-table tbody tr.selected { background: #eaf4f6; }
.pending-pool input[type="checkbox"], .add-order-list input[type="checkbox"], .order-pool-table input[type="checkbox"], .plans-table input[type="checkbox"], .self-pick-table input[type="checkbox"] { height: auto; }
.warehouse-section { margin-top: 18px; }
.warehouse-title { display: flex; align-items: baseline; gap: 10px; margin: 0 0 10px; }
.warehouse-title h2 { font-size: 19px; }
.warehouse-title span { color: #71808a; }
.truck-card { position: relative; background: #fff; border: 2px solid #687b85; border-radius: 7px; margin-bottom: 14px; overflow: visible; }
.truck-card.overload { border-color: #c83d3d; box-shadow: 0 0 0 1px #c83d3d22; }
.truck-card.low-load { border-color: #d68b18; box-shadow: 0 0 0 1px #d68b1822; }
.truck-card.flash-highlight { animation: truck-flash 5s ease-in-out; }
@keyframes truck-flash {
  0%, 24%, 52%, 100% { box-shadow: 0 0 0 0 rgba(20, 108, 115, 0); }
  10%, 38% { box-shadow: 0 0 0 4px rgba(243, 178, 26, .8); border-color: #f3b21a; }
}
.close-truck { position: absolute; top: -11px; right: -11px; z-index: 3; width: 28px; height: 28px; min-height: 28px; padding: 0; border: 2px solid #fff; border-radius: 50%; background: #c93636; color: #fff; font-size: 18px; font-weight: 800; line-height: 1; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(18, 34, 42, .22); cursor: pointer; }
.close-truck:hover { background: #a92525; }
.truck-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; background: #f5f8f9; border-bottom: 1px solid #d7dfe3; }
.truck-identity { display: flex; align-items: center; gap: 10px; }
.truck-type { color: #fff; border-radius: 4px; padding: 4px 8px; font-weight: 700; }
.truck-type.box-truck { background: #278052; }
.truck-type.flatbed { background: #2673aa; }
.truck-stats { display: flex; align-items: center; gap: 14px; }
.truck-stats .recalculate-truck { min-height: 30px; padding: 0 10px; }
.capacity-bar { width: 160px; height: 8px; background: #dfe6e9; border-radius: 4px; overflow: hidden; }
.capacity-bar i { display: block; height: 100%; background: #2d8b65; }
.capacity-bar i.low { background: #d99a25; }
.capacity-bar i.over { background: #bf3d3d; }
.truck-warning { color: #9b5d0a; font-weight: 700; }
.truck-warning.over { color: #b32d2d; }
.order-lines span { display: block; line-height: 1.45; }
.dispatch-table th, .dispatch-table td { padding-top: 8px; padding-bottom: 8px; }
.dispatch-table tbody tr.dragging { opacity: .4; }
.dispatch-table tbody tr.drag-over { box-shadow: inset 0 2px #176b78; }
.dispatch-table .destination { white-space: normal; min-width: 270px; }
.quantity-button { min-height: 0; padding: 2px 5px; border: 1px dashed #91a5ae; background: #fff; color: #176b78; }
.truck-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 10px 14px; border-top: 1px solid #e1e6e8; }
.truck-actions .spacer { flex: 1; }
.add-order-list { max-height: 420px; }
.pipe-cart-assignment-panel { display: grid; gap: 10px; padding: 12px; border: 1px solid #d9e2e6; background: #f8fafb; border-radius: 5px; }
.pipe-cart-assignment-title { display: grid; gap: 3px; }
.pipe-cart-assignment-list { display: grid; gap: 10px; max-height: 360px; overflow: auto; }
.pipe-cart-assignment-item { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(240px, 1fr); gap: 12px; padding: 10px; border: 1px solid #dde5e8; background: #fff; border-radius: 5px; }
.pipe-cart-select-grid { display: grid; grid-template-columns: repeat(2, minmax(130px, 1fr)); gap: 8px; }
.pipe-cart-select-grid label, .pipe-cart-slot { display: grid; gap: 5px; color: #4c5b64; }
/* Searchable Pipe Cart picker: the box filters the cart list as you type; the menu is fixed-positioned
   (placed from JS) so it is not clipped by the scrolling assignment list or the dialog. */
.pipe-cart-picker { position: relative; }
.pipe-cart-picker-input { width: 100%; padding-right: 28px; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' fill='none' stroke='%237b878e' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>"); background-repeat: no-repeat; background-position: right 9px center; }
.pipe-cart-picker-menu { position: fixed; z-index: 20; max-height: 220px; overflow: auto; padding: 4px; border: 1px solid #cbd3d8; border-radius: 4px; background: #fff; box-shadow: 0 8px 24px rgba(18, 34, 42, .18); }
.pipe-cart-picker-option { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 30px; padding: 0 8px; border: 0; border-radius: 3px; background: transparent; color: #26343d; text-align: left; cursor: pointer; }
.pipe-cart-picker-option.active { background: #e8f1f3; }
.pipe-cart-picker-option:disabled { color: #a0abb1; cursor: not-allowed; background: transparent; }
.pipe-cart-picker-option .muted { font-size: 12px; white-space: nowrap; }
.pipe-cart-picker-empty { padding: 6px 8px; }
.plan-filter-grid { display: grid; grid-template-columns: repeat(4, minmax(160px, 1fr)); gap: 12px; padding: 14px 16px; border-bottom: 1px solid #e4e8eb; }
.plan-filter-grid label, .order-filter-grid label { display: grid; gap: 6px; color: #4c5b64; }
.plan-status-filter, .order-status-filter { display: grid; gap: 6px; color: #4c5b64; }
.status-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 34px;
  padding: 5px;
  border: 1px solid #cbd3d8;
  border-radius: 4px;
  background: #fff;
}
.status-checkboxes label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 86px;
  height: 28px;
  padding: 0 9px;
  border: 1px solid #d7dfe3;
  border-radius: 4px;
  background: #f8fafb;
  color: #26343d;
  cursor: pointer;
}
.status-checkboxes input { width: auto; height: auto; margin: 0; }
.status-checkboxes label:has(input:checked) {
  border-color: #1c7787;
  background: #e4f2f5;
  color: #0f5360;
  font-weight: 600;
}
.order-filter-grid { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 12px; padding: 14px 16px; border-bottom: 1px solid #e4e8eb; }
.master-filter-grid { display: grid; grid-template-columns: minmax(220px, 2fr) minmax(150px, 1fr) minmax(120px, .7fr); gap: 12px; padding: 14px 16px; border-bottom: 1px solid #e4e8eb; }
.master-filter-grid label { display: grid; gap: 6px; color: #4c5b64; }
.address-filter-grid { grid-template-columns: repeat(4, minmax(150px, 1fr)) minmax(120px, .7fr); }
.order-toolbar { border-top: 0; }
.filter-action { align-self: end; }
.filter-action button { width: 100%; }
.filter-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.plans-table { table-layout: fixed; min-width: 0; }
/* The header holds the select-all checkbox next to single-line labels: centre the cells so the labels do not
   sit at the top of a taller row (the checkbox also gets height: auto above, like the order pool's). */
.plans-table thead th { vertical-align: middle; }
.plans-table th, .plans-table td { padding-left: 8px; padding-right: 8px; }
.plans-table th, .plans-table td {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.25;
}
.plans-table > thead th:nth-child(1) { width: 34px; }
.plans-table > thead th:nth-child(2) { width: 132px; }
.plans-table > thead th:nth-child(3) { width: 82px; }
.plans-table > thead th:nth-child(4) { width: 112px; }
.plans-table > thead th:nth-child(5) { width: 125px; }
.plans-table > thead th:nth-child(6) { width: 94px; }
.plans-table > thead th:nth-child(7) { width: 118px; }
.plans-table > thead th:nth-child(8) { width: 68px; }
.plans-table > thead th:nth-child(9) { width: 82px; }
.plans-table > thead th:nth-child(10) { width: 190px; }
.plans-table .truck-type { display: inline-block; max-width: 100%; white-space: normal; line-height: 1.15; }
.pagination-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 12px 16px; border-top: 1px solid #e4e8eb; }
.pagination-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; color: #4c5b64; }
.page-size-control { display: flex; align-items: center; gap: 8px; }
.page-size-control select { width: 84px; }
.pagination-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pagination-controls button { min-width: 34px; padding: 0 9px; }
.pagination-controls button.active { color: #fff; background: #176b78; border-color: #176b78; }
.pagination-controls button:disabled { opacity: .45; cursor: not-allowed; }
.pagination-ellipsis { padding: 0 4px; color: #7b878e; }
.pagination-status { margin-left: 8px; color: #4c5b64; }
.plan-row { border-bottom: 1px solid #dde4e7; }
.expand-plan { width: 27px; min-height: 27px; padding: 0; border: 1px solid #aebbc2; background: #fff; font-size: 18px; }
.plan-number { display: flex; align-items: center; gap: 8px; }
.truck-no-link { padding: 0; border: 0; background: none; color: #176b78; font-weight: 700; text-decoration: underline dotted; text-underline-offset: 3px; }
.truck-no-link:hover, .truck-no-link:focus-visible { color: #0f4e58; text-decoration-style: solid; }
.plan-detail-row { display: none; }
.plan-detail-row.expanded { display: table-row; }
.plan-detail-cell { padding: 10px 14px 14px 48px; background: #f7f9fa; }
/* The nested shipment table is auto-layout with nowrap cells (~1270px minimum), while the outer plans table is
   fixed-layout and stops at 1037px on small screens. Scroll the nested table inside the expanded cell instead of
   letting it spill past the outer table's right edge. */
.plan-detail-scroll { overflow-x: auto; }
.plan-detail-cell table { background: #fff; border: 1px solid #d7e0e4; table-layout: auto; }
.plan-detail-cell tbody tr.dragging { opacity: .4; }
.plan-detail-cell tbody tr.drag-over { box-shadow: inset 0 2px #176b78; }
.plan-detail-cell th, .plan-detail-cell td { white-space: nowrap; }
.plan-detail-cell .address { white-space: normal; min-width: 300px; }
.plan-detail-cell .recipient-cell { white-space: normal; min-width: 150px; }
.plan-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.plan-actions button { min-height: 26px; padding: 0 6px; font-size: 12px; white-space: normal; line-height: 1.15; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
/* Self Pick page: its own fixed column widths (the Order Pool's are tied to its column
   positions), a header that stays put while the list scrolls, and a toolbar that wraps.
   建立日期 and 倉庫 are 120px so their English labels (Import Date / Warehouse) and the sort
   mark fit; narrower, the next sticky header covered the mark. */
.self-pick-toolbar .toolbar-actions { flex-wrap: wrap; justify-content: flex-end; }
.self-pick-wrap { max-height: max(360px, calc(100vh - 390px)); }
.self-pick-table { min-width: 1560px; table-layout: fixed; border-collapse: separate; border-spacing: 0; }
.self-pick-table thead th { position: sticky; top: 0; z-index: 3; background: #f7f8f9; box-shadow: 0 1px 0 #dce2e6; }
.self-pick-table td { white-space: normal; overflow-wrap: anywhere; }
.self-pick-table th:nth-child(1) { width: 40px; }
.self-pick-table th:nth-child(2) { width: 120px; }
.self-pick-table th:nth-child(3) { width: 140px; }
.self-pick-table th:nth-child(4) { width: 96px; }
.self-pick-table th:nth-child(5) { width: 140px; }
.self-pick-table th:nth-child(6) { width: 120px; }
.self-pick-table th:nth-child(7) { width: 130px; }
.self-pick-table th:nth-child(8) { width: 170px; }
.self-pick-table th:nth-child(9) { width: 190px; }
.self-pick-table th:nth-child(10) { width: 150px; }
.self-pick-table th:nth-child(11) { width: 150px; }
.self-pick-table th:nth-child(12) { width: 108px; }
.self-pick-table th:nth-child(13) { width: 146px; }
.self-pick-table td.address { min-width: 0; }
.edit-self-pick, .history-self-pick { min-height: 30px; padding: 0 10px; }
.import-pickup-note { margin: 0 0 8px; color: #145e79; }
.drag-handle { color: #7c8990; font-size: 17px; cursor: grab; }
.empty-state { padding: 60px; text-align: center; color: #68757d; }
.empty-state h2 { color: #26343d; margin-bottom: 8px; }
dialog { width: 620px; border: 0; border-radius: 7px; padding: 0; box-shadow: 0 18px 50px #0004; }
.wide-dialog { width: min(820px, calc(100vw - 60px)); }
#batch-email-dialog { width: min(1100px, calc(100vw - 60px)); }
#batch-email-dialog td:nth-child(4), #batch-email-dialog td:nth-child(5), #batch-email-dialog td:nth-child(7) { white-space: normal; min-width: 200px; max-width: 360px; overflow-wrap: anywhere; }
dialog::backdrop { background: #13212a99; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid #dfe5e8; }
.icon-button { width: 32px; padding: 0; border: 0; background: transparent; font-size: 22px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 18px; }
.form-grid label { display: grid; gap: 6px; color: #4c5b64; }
.form-grid input, .form-grid select { width: 100%; }
.form-grid textarea { width: 100%; }
.form-grid .email-kind-options { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; color: #4c5b64; }
.form-grid .email-kind-option { display: inline-flex; align-items: center; gap: 6px; color: #26343d; }
.form-grid .email-kind-option input { width: auto; }
.form-grid .email-kind-options[hidden] { display: none; }
#order-form label[hidden] { display: none; }
.email-meta { display: grid; gap: 4px; }
.email-body-preview { background: #f7f9fa; }
.span-2 { grid-column: 1 / -1; }
.time-window-list { display: grid; gap: 8px; }
.time-window-row { display: grid; grid-template-columns: 1fr auto 1fr 32px; align-items: center; gap: 8px; }
.small-button { min-height: 32px; padding: 6px 10px; justify-self: start; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid #dfe5e8; }
.import-body { padding: 18px; }
.file-drop { min-height: 112px; display: grid; place-items: center; align-content: center; gap: 6px; border: 1px dashed #8ca0aa; background: #f7fafb; border-radius: 6px; cursor: pointer; }
.file-drop span, .import-columns span { color: #697780; }
.file-drop input { height: auto; margin-top: 8px; }
.import-columns { display: grid; gap: 5px; margin-top: 14px; padding: 12px; background: #f3f6f7; border-radius: 5px; }
.import-summary { display: flex; gap: 24px; padding: 14px 0 8px; }
.import-summary strong { font-size: 20px; display: block; }
.import-summary span { color: #697780; }
.import-issue-summary { border: 1px solid #e0e5e8; padding: 10px 12px; margin: 8px 0; background: #fbfcfc; }
.import-issue-summary ul { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.import-issue-summary li { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.import-issue-summary li strong { color: #0f2028; }
.import-result-section { margin: 8px 0; }
.import-result-section h3 { margin: 0; padding: 9px 12px; border: 1px solid #e0e5e8; border-bottom: 0; background: #f6f8f9; font-size: 13px; color: #17232b; }
.import-result-section-warning h3 { border-color: #f0c36a; background: #fff8e8; }
.import-errors { max-height: 230px; overflow: auto; border: 1px solid #e0e5e8; }
.import-warnings { border-color: #f0c36a; }
.import-errors td:last-child { white-space: normal; }
#toast { position: fixed; right: 24px; bottom: 24px; color: #fff; background: #24343d; padding: 11px 16px; border-radius: 5px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s; }
#toast.show { opacity: 1; transform: translateY(0); }
.muted { color: #7b878e; }
.recipient-line { display: grid; gap: 2px; line-height: 1.35; }
.recipient-line + .recipient-line { margin-top: 6px; padding-top: 6px; border-top: 1px solid #e4eaed; }
.recipient-cell { min-width: 150px; white-space: normal; }
.app-shell.master-readonly .edit-dockdoor,
.app-shell.master-readonly .delete-dockdoor,
.app-shell.master-readonly .edit-truck-type,
.app-shell.master-readonly .delete-truck-type,
.app-shell.master-readonly .edit-unit,
.app-shell.master-readonly .delete-unit {
  display: none;
}
@media (max-width: 1200px) {
  .main { padding-left: 18px; padding-right: 18px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
}

/* TSPT BOOKING# is hidden on request (order pool, auto dispatch, truck plans: columns, search filter, order form field).
   The markup and data are untouched; delete this block to show it again. */
.tspt-booking { display: none !important; }
.order-pool-table { min-width: 1704px; }
.order-pool-table th:nth-child(4),
.order-pool-table td:nth-child(4) { left: 164px; }
