/* ============================================================
   NimbusTrade Client Access — "Clear Water"
   All-white operational console — no dark mode. One brand-blue
   accent (from the NimbusTrade mark); status state (dropped/
   processing/completed/issue) uses its own semantic palette —
   grey / steel-blue / green / red — kept apart from the accent hue
   so "needs action" never reads as "on-brand". Hairline dark
   borders for definition instead of shadows or dark fills.
   ============================================================ */

:root, :root[data-theme="light"], :root[data-theme="dark"] {
  color-scheme: light;
  --bg: #ffffff;
  --bg-alt: #f4f5f3;
  --surface: #ffffff;
  --fg: #14171b;
  --fg-muted: #52585f;
  --accent: #0a558b;
  --accent-strong: #0f6aa8;
  --accent-tint: rgba(10, 85, 139, 0.1);
  --border: rgba(20, 23, 27, 0.18);
  --border-soft: rgba(20, 23, 27, 0.1);

  --chrome-bg: #ffffff;
  --chrome-bg-2: #f4f5f3;
  --chrome-fg: #14171b;
  --chrome-muted: #5c636a;
  --chrome-border: rgba(20, 23, 27, 0.14);
  --chrome-hover: rgba(20, 23, 27, 0.06);

  --green: #1f7a4d;
  --green-tint: rgba(31, 122, 77, 0.12);
  --amber: #2b6f8c;
  --amber-tint: rgba(43, 111, 140, 0.12);
  --red: #9c3223;
  --red-tint: rgba(156, 50, 35, 0.1);
  --grey: #5c636a;
  --grey-tint: rgba(92, 99, 106, 0.12);
}

:root {
  --radius: 2px;
  --radius-lg: 3px;

  --font-display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.5;
}

h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; }

button, input, select { font-family: inherit; font-size: inherit; }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 1px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius); }

.eyebrow {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 6px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.btn-primary { background: var(--accent-strong); color: #14171a; }
.btn-primary:hover { background: var(--accent); }
.btn-block { width: 100%; }

.btn-ghost-sm {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 7px 13px;
  font-size: 12px;
  font-family: var(--font-mono);
}
.btn-ghost-sm:hover { border-color: var(--accent-strong); color: var(--accent-strong); }

/* ---------- Login ---------- */
.login-screen {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--chrome-bg);
  padding: 24px;
}

.login-theme-toggle {
  position: absolute;
  top: 24px;
  right: 24px;
  border-color: var(--chrome-border);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: 100%;
  max-width: 400px;
}

.login-brand { display: flex; flex-direction: column; margin-bottom: 24px; }
.brand-logo {
  display: block;
  height: auto;
  width: calc(30px * 216 / 79);
  max-width: 100%;
  aspect-ratio: 216 / 79;
  object-fit: contain;
  object-position: left center;
}
.brand-logo-dark { display: none; }
:root[data-theme="dark"] .brand-logo-light { display: none; }
:root[data-theme="dark"] .brand-logo-dark { display: block; }

.login-eyebrow { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; font-size: 11px; font-weight: 600; color: var(--accent); margin: 0 0 8px; }
.login-card h1 { font-size: 20px; font-weight: 700; margin-bottom: 10px; }
.login-sub { color: var(--fg-muted); font-size: 13px; margin: 0 0 22px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field span { font-size: 12px; font-weight: 600; color: var(--fg-muted); }
.field input, .field select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
}
.field input:focus, .field select:focus { border-color: var(--accent-strong); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.login-error, .modal-error, .company-error {
  color: var(--red);
  background: var(--red-tint);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 12.5px;
  margin-top: 14px;
}

.form-ok {
  color: var(--green);
  background: var(--green-tint);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 12.5px;
  margin-top: 14px;
}

.login-hint {
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
  text-align: center;
}
.login-hint code { background: var(--accent-tint); padding: 2px 5px; border-radius: 3px; color: var(--accent); }

/* ---------- App shell ---------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 52px;
  background: var(--chrome-bg);
  color: var(--chrome-fg);
  border-bottom: 1px solid var(--chrome-border);
}
.app-brand { display: flex; align-items: center; gap: 10px; line-height: 1.1; }
.app-brand .brand-logo { width: calc(24px * 216 / 79); height: auto; }
.app-brand-suffix { font-family: var(--font-display); font-size: 15px; font-weight: 700; font-style: normal; color: var(--chrome-fg); border-left: 1px solid var(--chrome-border); padding-left: 10px; }
.app-header-right { display: flex; align-items: center; gap: 14px; }
.client-name { font-family: var(--font-mono); font-size: 12.5px; color: var(--chrome-muted); }
.app-header .btn-ghost-sm { color: var(--chrome-fg); border-color: var(--chrome-border); }

.theme-toggle {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--chrome-border);
  background: transparent;
  color: var(--chrome-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: none;
}
.theme-toggle:hover { border-color: var(--accent-strong); color: var(--accent-strong); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-moon { display: block; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }

.app-shell { display: flex; align-items: flex-start; }

.side-rail {
  flex: none;
  width: 74px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  padding: 14px 8px;
  background: var(--chrome-bg);
  border-right: 1px solid var(--chrome-border);
  position: sticky;
  top: 52px;
  height: calc(100vh - 52px);
}

.rail-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 2px;
  border-radius: var(--radius);
  color: var(--chrome-muted);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-align: center;
  transition: background 0.12s ease, color 0.12s ease;
}
.rail-link svg { width: 18px; height: 18px; }
.rail-link:hover, .rail-link:focus-visible { background: var(--chrome-hover); color: var(--chrome-fg); }
.rail-link.active { color: var(--accent-strong); background: rgba(74, 155, 212, 0.08); }

.app-main {
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: 1220px;
  margin: 0 auto;
  padding: 24px 24px 56px;
}

.panel, .table-wrap, .map-wrap { min-width: 0; }

.app-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.app-toolbar h2 { font-size: 21px; font-weight: 700; }
.toolbar-actions { display: flex; gap: 10px; flex: none; }

/* ---------- Stat strip (one instrument, not five cards) ---------- */
.stat-grid {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  margin-bottom: 22px;
  overflow: hidden;
}

.stat-tile {
  flex: 1;
  min-width: 0;
  border-right: 1px solid var(--border);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  position: relative;
}
.stat-tile:last-child { border-right: none; }

.stat-dot { position: absolute; top: 16px; right: 16px; width: 7px; height: 7px; border-radius: 50%; }
.stat-dropped .stat-dot { background: var(--grey); }
.stat-processing .stat-dot { background: var(--amber); }
.stat-completed .stat-dot { background: var(--green); }
.stat-issue .stat-dot { background: var(--red); }
.stat-ready .stat-dot { background: var(--amber); }
.stat-shipped .stat-dot { background: var(--green); }
.stat-waiting .stat-dot { background: var(--grey); }
.line-count { color: var(--fg-muted); font-size: 12px; white-space: nowrap; }

.stat-label { font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-muted); }
.stat-value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 25px; font-weight: 600; }

/* ---------- Panels ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px 20px;
  margin-bottom: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.panel-head h3 { font-size: 15.5px; font-weight: 700; }
.panel-sub { color: var(--fg-muted); font-size: 12.5px; margin: 0; }

.legend { display: flex; gap: 16px; font-size: 12px; color: var(--fg-muted); font-family: var(--font-mono); }
.legend .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; }
.dot-green { background: var(--green); }
.dot-amber { background: var(--amber); }
.dot-red { background: var(--red); }

/* ---------- Map (Leaflet + OpenStreetMap tiles, no API key) ---------- */
.map-wrap { position: relative; background: var(--chrome-bg); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border-soft); }
#world-map { width: 100%; height: 400px; background: var(--chrome-bg); font-family: var(--font-body); }

/* Custom divIcon markers */
.nt-marker { display: flex; align-items: center; justify-content: center; }
.nt-marker-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  opacity: 0.5;
  inset: 0;
}
.nt-marker-dot {
  position: absolute;
  border-radius: 50%;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 60%; height: 60%;
}
.nt-marker.status-green { color: var(--green); }
.nt-marker.status-green .nt-marker-dot { background: var(--green); }
.nt-marker.status-amber { color: var(--amber); }
.nt-marker.status-amber .nt-marker-dot { background: var(--amber); }
.nt-marker.status-red { color: var(--red); }
.nt-marker.status-red .nt-marker-dot { background: var(--red); }
.nt-marker.selected .nt-marker-ring { border-width: 2.5px; opacity: 0.9; }
.nt-hub-marker { width: 9px; height: 9px; border-radius: 50%; background: var(--accent-strong); box-shadow: 0 0 0 4px rgba(74, 155, 212, 0.22); }

/* Popup theming to match the dark map ground */
.leaflet-popup-content-wrapper.nt-popup { background: var(--surface); color: var(--fg); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: none; }
.leaflet-popup-tip.nt-popup-tip { background: var(--surface); }
.nt-popup .leaflet-popup-content { margin: 10px 14px; font-size: 12px; }
.nt-popup-title { display: block; font-family: var(--font-display); font-size: 14px; margin-bottom: 6px; color: var(--fg); }
.nt-popup-row { display: flex; justify-content: space-between; gap: 12px; font-family: var(--font-mono); font-size: 11px; padding: 1px 0; }
.leaflet-container a.leaflet-popup-close-button { color: var(--fg-muted); }

.map-hint { margin: 12px 0 0; font-size: 12px; color: var(--fg-muted); }
.map-hint button { border: none; background: none; color: var(--accent); font-weight: 600; cursor: pointer; padding: 0; font-size: 12px; text-decoration: underline; }

/* Market chips — the "click to filter" affordance since a map tile can't take per-pixel handlers */
.market-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.market-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-alt);
  font-family: var(--font-mono);
  font-size: 11.5px;
  cursor: pointer;
  color: var(--fg);
}
.market-chip .dot { width: 7px; height: 7px; border-radius: 50%; }
.market-chip.status-green .dot { background: var(--green); }
.market-chip.status-amber .dot { background: var(--amber); }
.market-chip.status-red .dot { background: var(--red); }
.market-chip.selected { border-color: var(--accent-strong); background: var(--accent-tint); }
.market-chip:hover { border-color: var(--accent-strong); }

/* ---------- Table ---------- */
.table-controls { display: flex; gap: 10px; }
.table-controls input, .table-controls select {
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
  color: var(--fg);
}
.table-controls input { width: 220px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border-soft); border-radius: var(--radius); }

table.orders-table { width: 100%; border-collapse: collapse; min-width: 720px; }
table.orders-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}
table.orders-table td {
  padding: 9px 14px;
  border-top: 1px solid var(--border-soft);
  font-size: 13px;
  vertical-align: middle;
}
table.orders-table tbody tr:hover { background: var(--bg-alt); }
table.orders-table tbody tr[data-id] { cursor: pointer; }
.order-detail-list { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; margin: 12px 0 4px; font-size: 13px; }
.order-detail-list dt { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--fg-muted); }
table.orders-table td:nth-child(1) { font-family: var(--font-mono); font-size: 12px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.status-pill.dropped { background: var(--grey-tint); color: var(--grey); }
.status-pill.processing { background: var(--amber-tint); color: var(--amber); }
.status-pill.completed { background: var(--green-tint); color: var(--green); }
.status-pill.issue { background: var(--red-tint); color: var(--red); }
.status-pill.ready_to_ship { background: var(--accent-tint); color: var(--accent); }
.status-pill.shipped { background: var(--green-tint); color: var(--green); }
.status-pill.in_transit { background: var(--amber-tint); color: var(--amber); }
.status-pill.arrived { background: var(--green-tint); color: var(--green); }
.status-pill.delayed { background: var(--red-tint); color: var(--red); }
.status-pill.partial { background: var(--grey-tint); color: var(--grey); }

/* ---------- Monthly trend ---------- */

.monthly-bars {
  display: flex;
  align-items: flex-end;
  gap: 32px;
  padding: 12px 6px 4px;
  min-width: 0;
  overflow-x: auto;
}
.month-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 64px;
  max-width: 120px;
}
.month-bar-track {
  width: 100%;
  height: 140px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.month-bar-fill {
  width: 100%;
  min-height: 3px;
  background: var(--grey);
  transition: height 0.4s ease;
}
.month-bar-fill.month-bar-live { background: var(--green); }
.month-total {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
}
.month-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.month-label.is-live { color: var(--green); }
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  flex: none;
  animation: nt-live-blink 1.4s ease-in-out infinite;
}
@keyframes nt-live-blink {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(63, 166, 107, 0.45); }
  50% { opacity: 0.4; box-shadow: 0 0 0 5px rgba(63, 166, 107, 0); }
}

.table-loading { text-align: center; padding: 30px; color: var(--fg-muted); }

.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 14px; font-family: var(--font-mono); font-size: 12px; }
.pagination button {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 6px 11px;
  cursor: pointer;
  color: var(--fg);
}
.pagination button.active { background: var(--accent-strong); color: #14171a; border-color: var(--accent-strong); }
.pagination button:disabled { opacity: 0.4; cursor: default; }

/* ---------- Inventory ---------- */
.inventory-grid { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }

.inv-location-tabs { display: flex; flex-wrap: wrap; background: var(--bg-alt); border-bottom: 1px solid var(--border); }
.inv-location-tab {
  flex: 1;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 11px 14px;
  border: none;
  border-right: 1px solid var(--border);
  margin-bottom: -1px;
  background: var(--bg-alt);
  color: var(--fg-muted);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
}
.inv-location-tab:last-child { border-right: none; }
.inv-location-tab span { font-family: var(--font-mono); font-size: 10px; font-weight: 500; color: var(--fg-muted); }
.inv-location-tab:hover:not(.active) { color: var(--fg); }
.inv-location-tab.active { background: var(--surface); color: var(--fg); border-bottom: 2px solid var(--accent-strong); }
.inv-location-tab.active span { color: var(--accent); }

.inv-location-panel { padding: 4px 18px 6px; }

.inv-item { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--border-soft); }
.inv-item:first-of-type { border-top: none; }
.inv-item-name { flex: 1; font-size: 12.5px; }
.inv-item-name small { display: block; color: var(--fg-muted); font-family: var(--font-mono); font-size: 10px; }
.inv-item-qty { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 13.5px; font-weight: 600; width: 50px; text-align: right; }
.inv-low-badge {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--red);
  background: var(--red-tint);
  padding: 2px 6px;
  border-radius: var(--radius);
}
.inv-threshold { display: flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: 11px; color: var(--fg-muted); }
.inv-threshold input {
  width: 46px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-align: center;
}
.inv-threshold button { border: none; background: none; color: var(--accent); cursor: pointer; font-size: 11px; font-weight: 600; padding: 2px; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 10, 12, 0.6);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  overflow-y: auto;
}
.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 440px;
  margin: auto;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}
.modal-card h3 { font-size: 18px; margin-bottom: 8px; }
.modal-sub { color: var(--fg-muted); font-size: 12.5px; margin: 0 0 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.modal-card-wide { max-width: 560px; }

/* ---------- Upload orders ---------- */
.upload-summary {
  margin: 4px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--bg-alt);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
  white-space: pre-line;
}
.today-note { margin: 0 0 14px; color: var(--fg-muted); font-size: 13px; }
.upload-actions, .row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pending-note {
  font-family: var(--font-body);
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--fg);
  min-width: 0;
  width: 160px;
}

/* ---------- Tracking ---------- */
.track-btn {
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--fg);
  border-radius: var(--radius);
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.track-btn:hover { border-color: var(--accent-strong); color: var(--accent-strong); }
.track-btn:disabled { opacity: 0.4; cursor: default; }

.tracking-timeline { list-style: none; margin: 0; padding: 0; }
.tracking-timeline li {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border-soft);
}
.tracking-timeline li:first-child { border-top: none; }
.tracking-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; background: var(--grey); }
.tracking-timeline li.done .tracking-dot { background: var(--green); }
.tracking-timeline li.issue .tracking-dot { background: var(--red); }
.tracking-event-status { font-weight: 600; font-size: 13px; text-transform: capitalize; }
.tracking-event-note { color: var(--fg-muted); font-size: 12.5px; margin-top: 2px; }
.tracking-event-time { font-family: var(--font-mono); font-size: 11px; color: var(--fg-muted); margin-top: 2px; }

.carrier-panel {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}
.carrier-panel h4 { font-size: 13px; font-weight: 700; margin: 0 0 8px; }
.carrier-unavailable {
  font-size: 12.5px;
  color: var(--fg-muted);
  background: var(--bg-alt);
  border-radius: var(--radius);
  padding: 10px 12px;
}

/* ---------- Rates ---------- */
.rates-table-wrap { display: flex; flex-direction: column; gap: 24px; }
.rate-section h4 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--accent-strong);
}
.rate-section .table-wrap { border: 1px solid var(--border-soft); border-radius: var(--radius); overflow-x: auto; margin-top: 8px; }
.rate-card-header { display: flex; flex-direction: column; gap: 4px; padding-bottom: 4px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.rates-total-row td:first-child { font-family: var(--font-body); }
.rates-total-row td { font-weight: 700; background: var(--bg-alt); }
.rate-terms { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--fg-muted); }
.rate-card-footer { font-size: 12px; color: var(--fg-muted); font-family: var(--font-mono); line-height: 1.6; }

tr.rate-row-clickable { cursor: pointer; }
tr.rate-row-clickable:hover { background: var(--bg-alt); }
tr.rate-row-clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.rate-row-hint { color: var(--fg-muted); font-size: 11px; }

.billing-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.billing-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: var(--bg-alt);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
}
.billing-stat span { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--fg-muted); }
.billing-stat strong { font-family: var(--font-mono); font-size: 16px; }
.billing-detail-tables { overflow-x: auto; }
table.rates-table.billing-breakdown-table,
table.rates-table.billing-breakdown-total { min-width: 0; width: 100%; }
.billing-breakdown-table { margin-bottom: 10px; }
.billing-breakdown-total td:first-child { font-family: var(--font-body); }
@media (max-width: 600px) {
  .billing-detail-grid { grid-template-columns: repeat(2, 1fr); }
}
table.rates-table { width: 100%; border-collapse: collapse; min-width: 620px; }
table.rates-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}
table.rates-table td {
  padding: 9px 14px;
  border-top: 1px solid var(--border-soft);
  font-size: 13px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
table.rates-table td:first-child { font-family: var(--font-body); font-weight: 600; }
.rate-not-set { color: var(--fg-muted); font-style: italic; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .stat-grid { flex-wrap: wrap; }
  .stat-tile { flex: 1 1 50%; border-bottom: 1px solid var(--border); }
  .table-controls { flex-direction: column; }
  .table-controls input { width: 100%; }
  .app-toolbar { flex-direction: column; align-items: flex-start; }
  .toolbar-actions { width: 100%; }
  .toolbar-actions .btn { flex: 1; }
  .field-row { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .monthly-bars { gap: 16px; }
  .month-col { flex: 0 0 auto; min-width: 84px; max-width: none; }
  .app-shell { flex-direction: column; }
  .side-rail {
    position: sticky;
    top: 52px;
    width: 100%;
    height: auto;
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--chrome-border);
    padding: 6px 10px;
    z-index: 10;
  }
  .rail-link { flex-direction: row; gap: 6px; padding: 8px 10px; flex: none; }
}

@media (max-width: 560px) {
  .stat-tile { flex: 1 1 100%; }
}

@media (max-width: 480px) {
  .app-header { padding: 0 14px; }
  .app-brand-suffix { display: none; }
  .app-header-right { gap: 10px; }
}

/* Shipment trails — distinct from the dashed order-presence lines */
.nt-popup-shipment { border-top: 1px solid var(--border-soft); margin-top: 6px; padding-top: 6px; }
.nt-shipment-marker { display: flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-size: 10px; }
.nt-shipment-marker.mode-air { background: var(--accent-strong); }
.nt-shipment-marker.mode-sea { background: var(--green); }
.nt-shipment-marker.mode-road { background: #6b5c3f; }
.nt-shipment-marker.status-delayed { background: var(--red); }

.chart-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 16px; }
.chart-filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--fg-muted); }
.chart-filters input, .chart-filters select { font: inherit; padding: 6px 8px; border: 1px solid var(--border); background: var(--bg); color: inherit; }
.chart-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.chart-kpi { background: var(--bg-alt); border: 1px solid var(--border); padding: 12px 14px; }
.chart-kpi span { display: block; font-size: 12px; color: var(--fg-muted); }
.chart-kpi strong { font-size: 1.4rem; font-weight: 650; }
.chart-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chart-block h4 { margin: 0 0 8px; font-size: 14px; }
.chart-empty { color: var(--fg-muted); margin: 8px 0; }
.chart-figure { font-variant-numeric: tabular-nums; font-weight: 650; }
.day-bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; }
.day-bar { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.day-bar-fill { display: block; width: 100%; background: var(--accent-strong); min-height: 0; }
@media (max-width: 768px) {
  .chart-kpis { grid-template-columns: 1fr 1fr; }
  .chart-columns { grid-template-columns: 1fr; }
}
