/* ============================================================
   TMS — Transportation Management System
   Theme: deep navy / indigo (distinct from the WMS red theme)
   ============================================================ */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #3b82f6;
  --accent: #06b6d4;

  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #38bdf8;

  --bg: #0b1220;
  --bg-2: #111a2e;
  --bg-3: #16223c;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.06);

  --text: #eef2ff;
  --text-2: #b6c2de;
  --text-muted: #7185a8;

  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.25);
  --sidebar-w: 250px;

  /* Brand-tint variables — overridden per company by shell.js */
  --bg-glow: #17233f;
  --brand-soft: rgba(37, 99, 235, 0.22);
  --brand-soft2: rgba(6, 182, 212, 0.14);
  --brand-ring: rgba(37, 99, 235, 0.25);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(1200px 800px at 100% -10%, var(--bg-glow) 0%, var(--bg) 55%) fixed;
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ---------- Layout ---------- */
.wrapper { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  border-right: 1px solid var(--border);
  position: fixed;
  inset: 0 auto 0 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform 0.25s ease;
}

.brand {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 1.35rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid; place-items: center;
  font-weight: 800; letter-spacing: 0.5px; font-size: 0.95rem;
  box-shadow: var(--shadow-sm);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 1.05rem; }
.brand-text span { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }

.sidebar nav { flex: 1; overflow-y: auto; padding: 0.75rem; }
.sidebar ul { list-style: none; }
.sidebar li { margin-bottom: 0.25rem; }
.sidebar a {
  display: flex; align-items: center; gap: 0.85rem;
  padding: 0.8rem 0.95rem; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500; font-size: 0.94rem;
  transition: background 0.15s, color 0.15s;
}
.sidebar a .nav-icon { font-size: 1.1rem; width: 1.4rem; text-align: center; }
.sidebar a:hover { background: var(--surface); color: var(--text); }
.sidebar a.active {
  background: linear-gradient(135deg, var(--brand-soft), var(--brand-soft2));
  color: #fff;
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.sidebar-footer { padding: 1rem; border-top: 1px solid var(--border); }

.content { flex: 1; margin-left: var(--sidebar-w); min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 900;
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--bg-2);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.page-title { font-size: 1.25rem; font-weight: 700; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 0.75rem; }
.user-chip {
  padding: 0.45rem 0.85rem; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 0.82rem; color: var(--text-2);
}
.hamburger { display: none; background: none; border: none; color: var(--text); font-size: 1.4rem; cursor: pointer; }

main { padding: 1.5rem; max-width: 1400px; }

/* ---------- Buttons ---------- */
.btn-primary, .btn-ghost, .btn-danger, .btn-sm {
  font: inherit; cursor: pointer; border-radius: var(--radius-sm);
  padding: 0.6rem 1.1rem; border: 1px solid transparent;
  font-weight: 600; transition: transform 0.05s, filter 0.15s, background 0.15s;
  display: inline-flex; align-items: center; gap: 0.45rem;
}
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-primary:active, .btn-ghost:active, .btn-danger:active { transform: translateY(1px); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.82rem; background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-sm:hover { background: var(--surface-2); }

/* ---------- Cards / panels ---------- */
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 1.25rem 1.35rem; }

.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap;
}
.section-head h2 { font-size: 1.05rem; }

/* KPI grid */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.kpi {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
  position: relative; overflow: hidden;
}
.kpi::after {
  content: ""; position: absolute; right: -20px; top: -20px;
  width: 90px; height: 90px; border-radius: 50%;
  background: radial-gradient(circle, var(--brand-soft), transparent 70%);
}
.kpi .kpi-label { color: var(--text-muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px; }
.kpi .kpi-value { font-size: 1.8rem; font-weight: 800; margin-top: 0.35rem; }
.kpi .kpi-sub { font-size: 0.8rem; color: var(--text-2); margin-top: 0.2rem; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; background: var(--bg-2); }
table.data thead th {
  text-align: left; padding: 0.85rem 1rem; font-size: 0.74rem;
  text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted);
  border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--bg-3);
  position: sticky; top: 0;
}
table.data tbody td { padding: 0.8rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr:hover { background: var(--surface); }
table.data tbody tr:last-child td { border-bottom: none; }
.row-click { cursor: pointer; }
.cell-strong { font-weight: 700; }
.cell-muted { color: var(--text-muted); }

.empty-state { padding: 3rem 1rem; text-align: center; color: var(--text-muted); }
.empty-state .big { font-size: 2.5rem; margin-bottom: 0.5rem; }

/* ---------- Badges / status ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.25rem 0.65rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 700; white-space: nowrap;
  border: 1px solid transparent;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-quoted     { background: rgba(148,163,184,0.15); color: #cbd5e1; }
.st-booked     { background: rgba(56,189,248,0.15); color: #7dd3fc; }
.st-assigned   { background: rgba(168,85,247,0.16); color: #c4b5fd; }
.st-dispatched { background: rgba(245,158,11,0.16); color: #fcd34d; }
.st-pickedup   { background: rgba(168,85,247,0.18); color: #d8b4fe; }
.st-transit    { background: rgba(37,99,235,0.2); color: #93c5fd; }
.st-delivered  { background: rgba(34,197,94,0.16); color: #86efac; }
.st-invoiced   { background: rgba(6,182,212,0.16); color: #67e8f9; }
.st-paid       { background: rgba(34,197,94,0.22); color: #4ade80; }
.st-cancelled  { background: rgba(239,68,68,0.16); color: #fca5a5; }

.type-pill { font-size: 0.72rem; font-weight: 700; padding: 0.2rem 0.55rem; border-radius: 6px; }
.type-asset { background: rgba(34,197,94,0.15); color: #86efac; }
.type-brokered { background: rgba(245,158,11,0.15); color: #fcd34d; }

.money-pos { color: #4ade80; font-weight: 700; }
.money-neg { color: #fca5a5; font-weight: 700; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem 1.15rem; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field label { font-size: 0.78rem; color: var(--text-2); font-weight: 600; }
.field input, .field select, .field textarea {
  font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 0.62rem 0.75rem;
  width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary-light);
  box-shadow: 0 0 0 3px var(--brand-ring);
}
.field textarea { resize: vertical; min-height: 70px; }
/* Checkboxes/radios must not inherit the full-width text-input styling */
.field input[type="checkbox"], .field input[type="radio"] {
  width: auto; min-width: 0; padding: 0; margin: 0; flex: 0 0 auto;
  accent-color: var(--primary); cursor: pointer;
}

/* ---------- Load detail: status strip, map tabs, action tiles ---------- */
.status-strip {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap;
  padding: 0.8rem 1rem; background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
}
.status-strip .ss-fix { display: flex; align-items: center; gap: 0.45rem; margin-left: auto; }
.status-strip .ss-fix .lbl { font-size: 0.72rem; color: var(--text-muted); }
.map-card { grid-column: 1 / -1; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--bg); }
.map-tabs { display: flex; align-items: center; gap: 0.4rem; padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.map-tab {
  border: 1px solid var(--border-strong); background: var(--bg-2); color: var(--text-2);
  padding: 0.38rem 0.9rem; border-radius: 999px; cursor: pointer; font: inherit; font-size: 0.83rem; font-weight: 600;
  transition: background .12s, color .12s, border-color .12s;
}
.map-tab:hover { border-color: var(--primary); }
.map-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.map-live-info { margin-left: auto; font-size: 0.76rem; color: var(--text-muted); text-align: right; line-height: 1.4; }
.map-pane iframe { width: 100%; height: 300px; border: 0; display: block; }
.map-pane .map-msg { padding: 1.25rem; color: var(--text-muted); font-size: 0.88rem; }
.act-tiles { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0.6rem; }
.act-tile {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.85rem 0.95rem;
  background: var(--bg-2); border: 1px solid var(--border-strong); border-radius: 12px;
  cursor: pointer; color: var(--text); font: inherit; text-align: left;
  transition: border-color .12s ease, transform .12s ease;
}
.act-tile:hover { border-color: var(--primary); transform: translateY(-1px); }
.act-tile .ico { font-size: 1.35rem; flex: 0 0 auto; }
.act-tile b { display: block; font-size: 0.9rem; }
.act-tile .sub { font-size: 0.73rem; color: var(--text-muted); }
.field-hint { font-size: 0.72rem; color: var(--text-muted); }
.form-section-title {
  grid-column: 1 / -1; font-size: 0.78rem; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--accent); font-weight: 700;
  margin-top: 0.5rem; padding-top: 0.75rem; border-top: 1px solid var(--border);
}
.modal-actions, .form-actions {
  display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 1.5rem;
  grid-column: 1 / -1;
}

/* Toolbar (search + filter + action) */
.toolbar { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.25rem; }
.toolbar input[type="search"], .toolbar select {
  font: inherit; color: var(--text); background: var(--bg-2);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 0.55rem 0.8rem;
}
.toolbar input[type="search"] { min-width: 240px; flex: 1; max-width: 360px; }
.toolbar .spacer { flex: 1; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(4, 8, 18, 0.7);
  backdrop-filter: blur(4px); display: grid; place-items: center;
  z-index: 2000; padding: 1.5rem;
}
.modal {
  background: var(--bg-2); border: 1px solid var(--border-strong);
  border-radius: var(--radius); width: 100%; max-width: 560px;
  box-shadow: var(--shadow); max-height: 90vh; display: flex; flex-direction: column;
}
.modal-wide { max-width: 880px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.15rem 1.35rem; border-bottom: 1px solid var(--border);
}
.modal-head h2 { font-size: 1.1rem; }
.modal-close { background: none; border: none; color: var(--text-2); font-size: 1.1rem; cursor: pointer; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 1.35rem; overflow-y: auto; }

/* Detail rows in modal */
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem 1.5rem; }
.detail-grid .full { grid-column: 1 / -1; }
.detail-item .dl { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }
.detail-item .dv { font-size: 0.95rem; margin-top: 0.15rem; }
.route-line { display: flex; align-items: center; gap: 0.6rem; font-weight: 600; }
.route-line .arrow { color: var(--accent); }

/* ---------- Toast ---------- */
#toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 3000; display: flex; flex-direction: column; gap: 0.6rem; }
.toast {
  padding: 0.85rem 1.1rem; border-radius: var(--radius-sm);
  background: var(--bg-3); border: 1px solid var(--border-strong);
  color: var(--text); box-shadow: var(--shadow); font-size: 0.9rem;
  opacity: 0; transform: translateX(20px); transition: all 0.3s ease;
  border-left: 4px solid var(--info); min-width: 220px;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-warn { border-left-color: var(--warning); }

/* ---------- Signin ---------- */
.signin-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.signin-card {
  width: 100%; max-width: 400px; background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 18px; padding: 2.25rem;
  box-shadow: var(--shadow);
}
.signin-card .brand { border: none; justify-content: center; padding: 0 0 1.5rem; }
.signin-card h1 { text-align: center; font-size: 1.35rem; margin-bottom: 0.35rem; }
.signin-card .sub { text-align: center; color: var(--text-muted); font-size: 0.88rem; margin-bottom: 1.75rem; }
.signin-card .field { margin-bottom: 1rem; }
.signin-card .btn-primary { width: 100%; justify-content: center; padding: 0.75rem; }
.error-msg { display: none; background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; padding: 0.7rem 0.9rem; border-radius: var(--radius-sm); font-size: 0.85rem; margin-bottom: 1rem; }

/* Dispatch board */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.board-col { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.9rem; }
.board-col h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-2); margin-bottom: 0.85rem; display: flex; justify-content: space-between; }
.board-col h3 .count { color: var(--text-muted); }
.load-card {
  background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0.85rem; margin-bottom: 0.7rem; cursor: pointer; transition: border-color 0.15s;
}
.load-card:hover { border-color: var(--primary-light); }
.load-card .lc-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; }
.load-card .lc-num { font-weight: 700; font-size: 0.9rem; }
.load-card .lc-route { font-size: 0.82rem; color: var(--text-2); }
.load-card .lc-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.4rem; display: flex; justify-content: space-between; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .content { margin-left: 0; }
  .hamburger { display: block; }
  .form-grid, .detail-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Dashboard v2 — command-center layout
   ============================================================ */
.stat-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: linear-gradient(135deg, var(--brand-soft2), transparent 58%), var(--bg-2);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.1rem; position: relative; overflow: hidden;
}
.stat-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c, var(--primary)); }
.stat-card .sc-label { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: var(--c, var(--text-2)); }
.stat-card .sc-value { font-size: 2rem; font-weight: 800; margin: 0.1rem 0; line-height: 1; }
.stat-card .sc-sub { font-size: 0.71rem; color: var(--text-muted); }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.5rem; align-items: start; }
.dash-main { display: flex; flex-direction: column; gap: 1.5rem; min-width: 0; }
.dash-rail { display: flex; flex-direction: column; gap: 1.25rem; }

.panel { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 0.75rem; padding: 0.9rem 1.2rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.panel-head .pnum { width: 24px; height: 24px; border-radius: 7px; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; display: grid; place-items: center; font-size: 0.78rem; font-weight: 800; }
.panel-head h2 { font-size: 1rem; }
.panel-head .ph-sub { color: var(--text-muted); font-size: 0.8rem; font-weight: 500; }
.panel-head .spacer { flex: 1; }
.legend { display: flex; gap: 0.9rem; flex-wrap: wrap; font-size: 0.7rem; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-red { background: #ef4444; } .dot-blue { background: #38bdf8; } .dot-green { background: #22c55e; }
.dot-amber { background: #f59e0b; } .dot-yellow { background: #eab308; } .dot-gray { background: #64748b; }

tr.u-red td:first-child { box-shadow: inset 3px 0 0 #ef4444; }
tr.u-blue td:first-child { box-shadow: inset 3px 0 0 #38bdf8; }
tr.u-green td:first-child { box-shadow: inset 3px 0 0 #22c55e; }
tr.u-amber td:first-child { box-shadow: inset 3px 0 0 #f59e0b; }
tr.u-gray td:first-child { box-shadow: inset 3px 0 0 #475569; }
.txt-red { color: #fca5a5; font-weight: 600; }

.stk { display: flex; flex-direction: column; line-height: 1.25; }
.stk .sub { font-size: 0.72rem; color: var(--text-muted); }
.stk .sub.warn { color: #fca5a5; }
.stk .sub.ok { color: #86efac; }

.act { font: inherit; cursor: pointer; border: none; border-radius: 7px; padding: 0.4rem 0.75rem; font-size: 0.77rem; font-weight: 700; color: #fff; white-space: nowrap; }
.act-red { background: #ef4444; } .act-blue { background: #2563eb; }
.act-amber { background: #f59e0b; color: #241700; } .act-green { background: #22c55e; color: #05230f; }
.act-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); }
.act:hover { filter: brightness(1.08); }
.act:active { transform: translateY(1px); }

.rail-card { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.15rem; }
.rail-card h3 { font-size: 0.73rem; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); margin-bottom: 0.85rem; }
.sum-item { display: flex; align-items: center; justify-content: space-between; padding: 0.55rem 0; border-bottom: 1px solid var(--border); font-size: 0.87rem; color: var(--text-2); }
.sum-item:last-child { border-bottom: none; }
.sum-item .si-val { font-weight: 800; color: var(--text); }
.qa-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.qa { display: flex; align-items: center; gap: 0.5rem; padding: 0.65rem 0.7rem; border-radius: 9px; background: var(--surface); border: 1px solid var(--border); font-size: 0.82rem; color: var(--text); font-weight: 600; }
.qa:hover { background: var(--surface-2); border-color: var(--border-strong); }
.mini-search { font: inherit; color: var(--text); background: var(--bg-3); border: 1px solid var(--border-strong); border-radius: 8px; padding: 0.4rem 0.7rem; font-size: 0.82rem; max-width: 200px; }

@media (max-width: 1200px) { .stat-row { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1080px) { .dash-grid { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Company switcher ---------- */
.company-switch { position: relative; width: 100%; }
.cs-btn { display: flex; align-items: center; gap: 0.65rem; width: 100%; background: none; border: none; cursor: pointer; color: var(--text); padding: 0.3rem; border-radius: 10px; text-align: left; }
.cs-btn:hover { background: var(--surface); }
.cs-chev { margin-left: auto; color: var(--text-muted); font-size: 0.75rem; }
.cs-mark { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 0.82rem; color: #fff; flex: none; box-shadow: var(--shadow-sm); }
.company-menu { position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: var(--bg-3); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow); padding: 0.4rem; z-index: 1300; display: none; }
.company-menu.open { display: block; }
.company-menu .cm-item { display: flex; align-items: center; gap: 0.6rem; width: 100%; background: none; border: none; cursor: pointer; color: var(--text); padding: 0.55rem; border-radius: 9px; font: inherit; text-align: left; }
.company-menu .cm-item:hover { background: var(--surface); }
.company-menu .cm-item.active { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border-strong); }
.company-menu .cm-item .brand-text strong { font-size: 0.92rem; }
.company-tag { font-size: 0.62rem; font-weight: 800; letter-spacing: 0.6px; text-transform: uppercase; padding: 0.15rem 0.5rem; border-radius: 999px; background: var(--brand-soft); color: var(--primary-light); border: 1px solid var(--border-strong); }

/* ---------- Multi-stop editor (Loads form) ---------- */
.stops-list { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 0.75rem; }
.stop-row {
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 0.85rem; display: grid; grid-template-columns: repeat(6, 1fr) 32px; gap: 0.6rem 0.7rem; align-items: end;
}
/* Location name and stop instructions need room — they print on the BOL. */
.stop-row .field.wide { grid-column: span 3; }
.stop-row .stop-remove { grid-row: 1; grid-column: 7; }
.stop-row .field label { font-size: 0.68rem; }
.stop-row .field input, .stop-row .field select { padding: 0.5rem 0.6rem; }
.stop-remove { background: var(--surface); border: 1px solid var(--border-strong); color: var(--danger); border-radius: 8px; height: 38px; cursor: pointer; font-size: 1rem; }
.stop-remove:hover { background: rgba(239,68,68,0.15); }
.stop-badge { font-size: 0.66rem; font-weight: 800; padding: 0.2rem 0.5rem; border-radius: 6px; text-transform: uppercase; letter-spacing: 0.4px; }
.stop-pu { background: rgba(56,189,248,0.16); color: #7dd3fc; }
.stop-del { background: rgba(34,197,94,0.16); color: #86efac; }
@media (max-width: 800px) { .stop-row { grid-template-columns: 1fr 1fr; } }

/* Stops timeline (detail view) */
.timeline { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 0; }
.tl-stop { display: grid; grid-template-columns: 28px 1fr; gap: 0.75rem; }
.tl-rail { display: flex; flex-direction: column; align-items: center; }
.tl-dot { width: 14px; height: 14px; border-radius: 50%; margin-top: 4px; flex: none; }
.tl-dot.pu { background: #38bdf8; } .tl-dot.del { background: #22c55e; } .tl-dot.stop { background: #f59e0b; }
.tl-line { width: 2px; flex: 1; background: var(--border-strong); margin: 4px 0; }
.tl-body { padding-bottom: 1rem; }
.tl-body .tl-place { font-weight: 700; }
.tl-body .tl-meta { font-size: 0.8rem; color: var(--text-muted); }

/* Route map */
.route-map { grid-column: 1 / -1; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border-strong); }
.route-map iframe { width: 100%; height: 300px; border: 0; display: block; }

/* Profit chip */
.profit-chip { display: inline-flex; align-items: baseline; gap: 0.4rem; }
.profit-chip .pc-pct { font-size: 0.75rem; color: var(--text-muted); }

/* MC lookup inline */
.mc-lookup { display: flex; gap: 0.5rem; }
.mc-lookup input { flex: 1; }

/* ---------- Documents (load detail) ---------- */
.doc-list { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.85rem; }
.doc-chip { display: flex; align-items: center; gap: 0.6rem; background: var(--bg); border: 1px solid var(--border-strong); border-radius: 8px; padding: 0.5rem 0.7rem; }
.doc-kind { font-size: 0.66rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.4px; padding: 0.18rem 0.5rem; border-radius: 5px; white-space: nowrap; }
.doc-kind.k-rc { background: rgba(56,189,248,0.16); color: #7dd3fc; }
.doc-kind.k-pod { background: rgba(34,197,94,0.16); color: #86efac; }
.doc-kind.k-other { background: rgba(148,163,184,0.16); color: #cbd5e1; }
.doc-name { flex: 1; font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-view { color: var(--primary-light); font-weight: 700; text-decoration: none; padding: 0 0.3rem; }
.doc-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.doc-up { cursor: pointer; }
.pod-missing { font-size: 0.68rem; font-weight: 800; color: #fca5a5; background: rgba(239,68,68,0.14); padding: 0.15rem 0.5rem; border-radius: 5px; }

/* ---------- Universal search + alert bell ---------- */
.global-search { position: relative; flex: 1; max-width: 460px; }
.global-search input[type="search"] {
  width: 100%; font: inherit; color: var(--text);
  background: var(--bg-2); border: 1px solid var(--border-strong);
  border-radius: 999px; padding: 0.55rem 1rem;
}
.global-search input:focus { outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px var(--brand-ring); }
.gs-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--bg-2); border: 1px solid var(--border-strong); border-radius: 12px;
  box-shadow: var(--shadow); max-height: 60vh; overflow-y: auto; display: none; z-index: 1500;
}
.gs-results.open { display: block; }
.gs-item { display: grid; grid-template-columns: 84px 1fr; grid-template-rows: auto auto; gap: 0 0.6rem; padding: 0.6rem 0.85rem; border-bottom: 1px solid var(--border); }
.gs-item:hover { background: var(--surface); }
.gs-item:last-child { border-bottom: none; }
.gs-group { grid-row: 1 / span 2; align-self: center; font-size: 0.64rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.4px; padding: 0.2rem 0.4rem; border-radius: 5px; text-align: center; }
.gs-load { background: var(--brand-soft); color: var(--primary-light); }
.gs-customer { background: rgba(56,189,248,0.16); color: #7dd3fc; }
.gs-carrier { background: rgba(245,158,11,0.16); color: #fcd34d; }
.gs-driver { background: rgba(34,197,94,0.16); color: #86efac; }
.gs-label { font-weight: 700; font-size: 0.9rem; }
.gs-sub { font-size: 0.76rem; color: var(--text-muted); }
.gs-empty { padding: 1rem; color: var(--text-muted); font-size: 0.85rem; text-align: center; }

.topbar-bell { position: relative; font-size: 1.15rem; text-decoration: none; padding: 0.35rem; border-radius: 9px; }
.topbar-bell:hover { background: var(--surface); }
.bell-count { position: absolute; top: -2px; right: -4px; background: var(--danger); color: #fff; font-size: 0.62rem; font-weight: 800; min-width: 16px; height: 16px; border-radius: 999px; display: grid; place-items: center; padding: 0 3px; }

/* ---------- Alerts page ---------- */
.alert-item { display: flex; gap: 0.85rem; align-items: flex-start; padding: 0.9rem 1.1rem; border-bottom: 1px solid var(--border); }
.alert-item:last-child { border-bottom: none; }
.alert-item:hover { background: var(--surface); }
.alert-ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-size: 1rem; flex: none; }
.sev-danger .alert-ico { background: rgba(239,68,68,0.16); }
.sev-warn .alert-ico { background: rgba(245,158,11,0.16); }
.sev-info .alert-ico { background: rgba(56,189,248,0.16); }
.alert-body { flex: 1; min-width: 0; }
.alert-title { font-weight: 700; font-size: 0.92rem; }
.alert-detail { font-size: 0.8rem; color: var(--text-muted); }
.alert-cat { font-size: 0.64rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; padding: 0.2rem 0.5rem; border-radius: 5px; background: var(--surface-2); color: var(--text-2); align-self: center; }

/* ---------- Reports page ---------- */
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.mini-bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: 0.4rem; }
.mini-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); }

/* ---------- Rate-con drop zone ---------- */
.ratecon-drop {
  display: flex; flex-direction: column; align-items: center; gap: 0.35rem;
  text-align: center; cursor: pointer;
  border: 2px dashed var(--border-strong); border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand-soft2), transparent 60%), var(--bg-2);
  padding: 1.4rem 1rem; margin-bottom: 1.25rem;
  transition: border-color 0.15s, background 0.15s;
}
.ratecon-drop:hover { border-color: var(--primary-light); }
.ratecon-drop.drag { border-color: var(--primary); background: var(--brand-soft); }
.ratecon-drop .rc-ico { font-size: 1.5rem; }
.ratecon-drop .rc-link { color: var(--primary-light); text-decoration: underline; }
.ratecon-drop .rc-hint { font-size: 0.78rem; color: var(--text-muted); max-width: 640px; }
.prefill-note {
  grid-column: 1 / -1; background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3);
  color: #86efac; border-radius: 9px; padding: 0.7rem 0.9rem; font-size: 0.85rem;
}
