/* ── Metrik font-face ───────────────────────────────────────── */
@font-face {
  font-family: "Metrik";
  src: url("uploads/metrik-trial/MetrikTrial-Light.otf") format("opentype");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Metrik";
  src: url("uploads/metrik-trial/MetrikTrial-LightItalic.otf") format("opentype");
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Metrik";
  src: url("uploads/metrik-trial/MetrikTrial-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Metrik";
  src: url("uploads/metrik-trial/MetrikTrial-Italic.otf") format("opentype");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Metrik";
  src: url("uploads/metrik-trial/MetrikTrial-Medium.otf") format("opentype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Metrik";
  src: url("uploads/metrik-trial/MetrikTrial-MediumItalic.otf") format("opentype");
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Metrik";
  src: url("uploads/metrik-trial/MetrikTrial-Bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Metrik";
  src: url("uploads/metrik-trial/MetrikTrial-BoldItalic.otf") format("opentype");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Metrik";
  src: url("uploads/metrik-trial/MetrikTrial-Black.otf") format("opentype");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Metrik";
  src: url("uploads/metrik-trial/MetrikTrial-BlackItalic.otf") format("opentype");
  font-weight: 900;
  font-style: italic;
  font-display: swap;
}

/* ── Broker Portal shared styles ────────────────────────────── */
:root {
  --bg: #fafaf7;
  --panel: #ffffff;
  --ink: #14121d;
  --ink-2: #36322f;
  --muted: #76787f;
  --line: #e6e3dc;
  --line-2: #efece5;
  --accent: #F0EE54;
  --accent-ink: #14121d;
  --good: #09bd87;
  --bad: #e23b3b;
  --warn: #e8930a;
  --info: #2267ea;
  --info-tint: #ebf3f9;
  --purple: #7857d2;
  --tint: #fffbea;
  --shadow: 0 1px 2px rgba(20,18,29,.04), 0 8px 24px rgba(20,18,29,.06);
  --shadow-sm: 0 1px 2px rgba(20,18,29,.05);
  --shadow-lg: 0 20px 56px rgba(20,18,29,.18);
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Metrik", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "Metrik", ui-monospace, "SF Mono", Menlo, monospace;
  --sidebar-w: auto;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font); background: var(--bg); color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
  letter-spacing: -0.005em;
}
::selection { background: var(--accent); color: var(--accent-ink); }
button, table, th, td, input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }

.app { min-height: 100vh; display: grid; grid-template-columns: max-content 1fr; }

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  background: var(--ink); color: #fff;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 18px 14px;
}
.brand {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 4px 8px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 16px;
}
.brand-wordmark {
  display: block;
  width: 124px;
  height: auto;
  max-width: 100%;
}
.brand-text { display: flex; align-items: center; }
.brand-collapse {
  background: transparent;
  border: 0;
  width: 28px; height: 28px;
  border-radius: 6px;
  display: grid; place-items: center;
  cursor: pointer;
  color: rgba(255,255,255,0.7);
}
.brand-collapse:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

/* Collapsed sidebar (icon-only) */
.sidebar.is-collapsed { padding: 18px 8px; width: 64px; }
.sidebar.is-collapsed .brand {
  justify-content: center;
  padding: 4px 0 14px;
}
.sidebar.is-collapsed .brand-text { display: none; }
.sidebar.is-collapsed .nav-section { gap: 2px; }
.sidebar.is-collapsed .nav-item,
.sidebar.is-collapsed .nav-subitem {
  justify-content: center;
  padding: 9px 0;
  width: 100%;
}
.sidebar.is-collapsed .nav-item > span,
.sidebar.is-collapsed .nav-subitem > span,
.sidebar.is-collapsed .nav-chev,
.sidebar.is-collapsed .nav-subitem-add,
.sidebar.is-collapsed .nav-item .badge { display: none; }
.sidebar.is-collapsed .nav-subgroup { display: none; }
.sidebar.is-collapsed .nav-item.is-active::before { left: -8px; }
.sidebar.is-collapsed .persona-switch {
  padding: 6px;
  justify-content: center;
}
.sidebar.is-collapsed .persona-switch .who,
.sidebar.is-collapsed .persona-switch .chev { display: none; }
.sidebar.is-collapsed .persona-pop {
  left: calc(100% + 8px);
  right: auto;
  bottom: 0;
  width: 240px;
}

.persona-wrap { position: relative; }
.persona-switch {
  padding: 8px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; transition: background 120ms;
  width: 100%;
  border: 0;
  text-align: left;
  font: inherit;
  color: inherit;
}
.persona-switch:hover { background: rgba(255,255,255,0.08); }
.persona-switch.is-open { background: rgba(255,255,255,0.10); }
.persona-switch .av {
  width: 28px; height: 28px; border-radius: 6px;
  background: var(--accent); color: var(--ink);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600; flex-shrink: 0;
}
.persona-switch .who { flex: 1; min-width: 0; }
.persona-switch .who b { display: block; font-size: 12.5px; font-weight: 600; color: #fff; }
.persona-switch .who span { display: block; font-size: 10.5px; color: rgba(255,255,255,0.5); margin-top: 1px; }
.persona-switch .chev { color: rgba(255,255,255,0.6); flex-shrink: 0; transition: transform 160ms ease; }
.persona-switch .chev svg { width: 12px; height: 12px; display: block; }
.persona-switch.is-open .chev { transform: rotate(180deg); }

.persona-pop {
  position: absolute;
  left: 0; right: 0;
  bottom: calc(100% + 8px);
  background: #1b1924;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.45), 0 2px 8px rgba(0,0,0,0.3);
  z-index: 50;
  display: flex; flex-direction: column; gap: 2px;
  animation: persona-pop-in 140ms ease;
}
@keyframes persona-pop-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.persona-pop-head {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  padding: 8px 8px 4px;
}
.persona-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 8px;
  border-radius: 7px;
  text-decoration: none;
  color: inherit;
  background: transparent;
  border: 0;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: background 120ms;
}
.persona-opt:hover { background: rgba(255,255,255,0.06); }
.persona-opt.is-current { background: rgba(255,255,255,0.04); cursor: default; }
.persona-opt .av {
  width: 30px; height: 30px; border-radius: 7px;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600; flex-shrink: 0;
  background: rgba(255,255,255,0.10);
  color: #fff;
}
.persona-opt.is-current .av { background: var(--accent); color: var(--ink); }
.persona-opt .who { flex: 1; min-width: 0; }
.persona-opt .who b {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.persona-opt .who span {
  display: block;
  font-size: 10.5px;
  color: rgba(255,255,255,0.55);
  margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.persona-opt .check {
  color: var(--accent);
  flex-shrink: 0;
}
.persona-opt .check svg { width: 14px; height: 14px; display: block; }

.nav-section {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  overflow-y: auto;
}

.nav-group-head {
  border: 0;
  outline: 0;
  font: inherit;
  text-align: left;
  width: 100%;
  background: transparent;
  color: rgba(255,255,255,0.72);
}
.nav-group-head:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}
.nav-group-head .nav-chev {
  margin-left: auto;
  width: 14px; height: 14px;
  color: rgba(255,255,255,0.6);
  transform: rotate(-90deg);
  transition: transform 120ms;
}
.nav-group.is-open .nav-group-head .nav-chev {
  transform: rotate(0);
}
.nav-subgroup {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 0 4px 8px;
}
.nav-subitem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px 7px 28px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  transition: all 120ms;
  position: relative;
}
.nav-subitem:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-subitem.is-active {
  background: rgba(240,238,84,0.12);
  color: #F0EE54;
}
.nav-subitem.is-active svg { opacity: 1; }
.nav-subitem svg {
  width: 16px; height: 16px;
  flex-shrink: 0;
  opacity: 0.9;
}
.nav-subitem-add {
  margin-left: auto;
  color: rgba(255,255,255,0.5);
  font-size: 14px;
  font-weight: 700;
  width: 16px; height: 16px;
  display: grid; place-items: center;
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,0.72);
  cursor: pointer; transition: all 120ms;
  margin-bottom: 2px;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.is-active {
  background: rgba(255,255,255,0.10); color: #fff;
}
.nav-item.is-active::before {
  content: ""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.9; }
.nav-item .badge {
  margin-left: auto; background: var(--accent); color: var(--ink);
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 99px;
  font-family: var(--mono);
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* ── Main canvas ──────────────────────────────────────────── */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 12px 28px; min-height: 56px;
  display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 8;
}
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--muted);
}
.breadcrumb a:hover { color: var(--ink); }
.breadcrumb b { color: var(--ink); font-weight: 600; font-size: 16px; letter-spacing: -0.018em; }
.breadcrumb .sep { opacity: 0.5; }
.topbar-spacer { flex: 1; }
.topbar-title {
  font-size: 15px; font-weight: 600; color: var(--ink);
  letter-spacing: -0.015em; white-space: nowrap;
}
.topbar-search {
  position: relative; flex: 0 1 320px;
}
.topbar-search input {
  width: 100%; padding: 7px 12px 7px 32px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  font-family: inherit; font-size: 12.5px; color: var(--ink);
}
.topbar-search input:focus { outline: 0; border-color: var(--ink-2); background: var(--panel); box-shadow: 0 0 0 3px var(--tint); }
.topbar-search .ico {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted);
}
.topbar-search .ico svg { width: 14px; height: 14px; display: block; }
.topbar-kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-size: 10px; color: var(--muted);
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px;
  padding: 1px 5px;
}

.topbar-icon-btn {
  width: 34px; height: 34px; border: 0; border-radius: 8px;
  background: transparent; color: var(--ink-2); cursor: pointer;
  display: grid; place-items: center; position: relative;
}
.topbar-icon-btn:hover { background: var(--line-2); color: var(--ink); }
.topbar-icon-btn svg { width: 16px; height: 16px; }
.topbar-icon-btn.topbar-bell { border: 1.5px solid var(--line); background: var(--panel); width: 30px; height: 30px; border-radius: 8px; }
.topbar-icon-btn.topbar-bell svg { width: 16px; height: 16px; }
.topbar-icon-btn .badge-dot {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--bad); border: 2px solid var(--panel);
}
.topbar .user-av {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--ink); color: var(--bg);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600;
}

.canvas { padding: 24px 28px 60px; flex: 1; min-width: 0; width: 100%; }

/* ── Page header ──────────────────────────────────────────── */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; margin-bottom: 18px;
}
.page-head h1 {
  margin: 0 0 6px; font-size: 24px; font-weight: 600;
  letter-spacing: -0.018em;
}
.page-head p {
  margin: 0; max-width: 64ch;
  font-size: 13px; color: var(--muted); line-height: 1.55;
}
.page-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn-primary, .btn-secondary, .btn-ghost, .btn-sm, .btn-danger {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; font-size: 13px; font-weight: 500;
  border-radius: 9px; cursor: pointer; font-family: inherit;
  transition: all 120ms;
  letter-spacing: 0.005em; border: 1px solid transparent;
  text-decoration: none; color: inherit;
  height: 34px; box-sizing: border-box;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { background: color-mix(in oklab, var(--accent) 88%, black); box-shadow: 0 4px 14px rgba(240,238,84,.45); }
.btn-primary:disabled { background: var(--line); color: var(--muted); border-color: var(--line); cursor: not-allowed; box-shadow: none; }
.btn-secondary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-secondary:hover { background: color-mix(in oklab, var(--accent) 88%, black); box-shadow: 0 4px 14px rgba(240,238,84,.45); }
.btn-secondary:disabled { background: var(--line); color: var(--muted); border-color: var(--line); cursor: not-allowed; box-shadow: none; }
.btn-ghost { background: var(--panel); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--line-2); border-color: var(--ink-2); }
.btn-danger { background: transparent; color: var(--bad); border-color: var(--line); }
.btn-danger:hover { border-color: var(--bad); background: color-mix(in oklab, var(--bad) 8%, var(--panel)); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-ico { display: inline-flex; }
.btn-ico svg { width: 14px; height: 14px; }
.btn-icon-only { padding: 8px 10px; }
.btn-icon-only .btn-ico svg { width: 16px; height: 16px; }

/* ── Pills / status ──────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 5px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.01em;
  white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.no-dot::before { display: none; }

/* Quote request statuses */
.pill.qst-draft       { color: var(--muted); background: var(--line-2); }
.pill.qst-rfq-sent    { color: var(--info); background: var(--info-tint); }
.pill.qst-received    { color: var(--purple); background: color-mix(in oklab, var(--purple) 12%, transparent); }
.pill.qst-submitted   { color: var(--info); background: color-mix(in oklab, var(--info) 14%, transparent); }
.pill.qst-accepted    { color: var(--good); background: color-mix(in oklab, var(--good) 14%, transparent); }
.pill.qst-rejected    { color: var(--bad); background: color-mix(in oklab, var(--bad) 12%, transparent); }
.pill.qst-expired     { color: var(--ink-2); background: var(--line-2); }
.pill.qst-order       { color: var(--good); background: color-mix(in oklab, var(--good) 14%, transparent); }

.pill.is-warn  { color: var(--warn); background: color-mix(in oklab, var(--warn) 14%, transparent); }
.pill.is-good  { color: var(--good); background: color-mix(in oklab, var(--good) 14%, transparent); }
.pill.is-bad   { color: var(--bad);  background: color-mix(in oklab, var(--bad) 12%, transparent); }
.pill.is-info  { color: var(--info); background: var(--info-tint); }
.pill.is-neutral { color: var(--ink-2); background: var(--line-2); border: 1px solid var(--line); }

/* ── Cards / Table ────────────────────────────────────────── */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 18px 20px; }
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--line-2);
}
.card-head h3 { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: -0.005em; }
.card-head .sub {
  font-size: 11px; color: var(--muted); font-family: var(--mono);
  letter-spacing: -0.005em;
}
.card-head .spacer { flex: 1; }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
.data thead th {
  text-align: left; padding: 10px 14px;
  font-size: 10.5px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em;
  border-bottom: 1px solid var(--line); background: var(--line-2);
  white-space: nowrap;
}
.data thead th .set-filter-label {
  text-transform: none; letter-spacing: 0.03em;
}
.data tbody td {
  padding: 14px; border-bottom: 1px solid var(--line-2);
  color: var(--ink); vertical-align: middle;
}
.data tbody tr { cursor: pointer; transition: background 120ms; }
.data tbody tr:hover { background: var(--tint); }
.data tbody tr.is-attn { background: color-mix(in oklab, var(--bad) 4%, transparent); }
.data tbody tr.is-attn:hover { background: color-mix(in oklab, var(--bad) 8%, transparent); }
.data tbody tr:last-child td { border-bottom: 0; }

/* Route cell */
.route-cell { font-size: 13px; }
.route-cell .top { font-weight: 500; display: flex; align-items: center; gap: 6px; }
.route-cell .arrow { color: var(--muted); }
.route-cell .stops { font-size: 11px; color: var(--muted); margin-top: 2px; font-family: var(--mono); }

/* Shipper cell */
.shipper-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.shipper-av {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--line-2); color: var(--ink);
  display: grid; place-items: center; font-size: 10px; font-weight: 600;
  flex-shrink: 0;
}
.shipper-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.shipper-name { font-weight: 500; }
.shipper-meta { font-size: 11px; color: var(--muted); font-family: var(--mono); }

/* MABD cell */
.mabd-cell { display: flex; flex-direction: column; gap: 2px; }
.mabd-cell .d { font-family: var(--mono); font-size: 12px; color: var(--ink); }
.mabd-cell .r { font-size: 11px; color: var(--muted); }
.mabd-cell.is-warn .r { color: var(--warn); font-weight: 500; }
.mabd-cell.is-bad .d, .mabd-cell.is-bad .r { color: var(--bad); font-weight: 500; }

/* Responses indicator */
.responses-cell { display: flex; flex-direction: column; gap: 3px; }
.responses-pip {
  display: inline-flex; gap: 2px; align-items: center;
}
.responses-pip .p {
  width: 6px; height: 6px; border-radius: 50%; background: var(--good);
}
.responses-pip .p.empty { background: var(--line); }
.responses-pip .lbl {
  font-size: 12px; color: var(--ink); font-family: var(--mono); margin-left: 4px;
}
.responses-best { font-size: 11px; color: var(--muted); font-family: var(--mono); }
.responses-best b { color: var(--ink); font-weight: 600; }

/* ── Routing Settings page ───────────────────────────────── */
.rs-rule-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rs-rule-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  overflow: hidden;
}
.rs-rule-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  cursor: pointer;
  transition: background 120ms;
}
.rs-rule-summary:hover { background: var(--tint); }
.rs-rule-summary-main {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.rs-rule-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 200px;
}
.rs-rule-chev {
  width: 14px;
  height: 14px;
  display: inline-flex;
  color: var(--muted);
}
.rs-rule-chev svg { width: 14px; height: 14px; }
.rs-rule-route {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rs-state-pill {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  background: var(--line-2);
  color: var(--ink);
  border-radius: 5px;
  min-width: 32px;
  text-align: center;
}
.rs-rule-summary-meta {
  display: flex;
  gap: 22px;
  align-items: center;
}
.rs-meta-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 60px;
}
.rs-meta-item .lbl {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.rs-meta-item .val {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.rs-rule-body {
  padding: 16px 22px 22px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.rs-rule-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.rs-rule-row .ar-field { min-width: 80px; }
.rs-rule-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}
.rs-rule-actions .btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ar-rule-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ar-rule-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ar-rule-name {
  flex: 1;
  border: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  font-family: inherit;
  padding: 4px 0;
  letter-spacing: -0.005em;
}
.ar-rule-name:focus {
  outline: 0;
  border-bottom: 1px solid var(--ink);
}
.ar-rule-remove {
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.ar-rule-remove:hover {
  background: color-mix(in oklab, var(--bad) 12%, transparent);
  color: var(--bad);
}
.ar-rule-remove svg {
  width: 14px;
  height: 14px;
}
.ar-rule-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
.ar-arrow {
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 9px;
}
.ar-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 70px;
}
.ar-field label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ar-field input {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-family: inherit;
  font-size: 12.5px;
  background: var(--panel);
  color: var(--ink);
}
.ar-field input:focus {
  outline: 0;
  border-color: var(--ink-2);
  box-shadow: 0 0 0 3px var(--tint);
}
.ar-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.ar-pill {
  padding: 4px 9px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 99px;
  font-family: inherit;
  font-size: 11.5px;
  color: var(--ink-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.ar-pill:hover {
  border-color: var(--ink-2);
}
.ar-pill.is-on {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.ar-pill.is-on svg {
  width: 11px;
  height: 11px;
  color: var(--accent);
}
.ar-add-rule {
  align-self: flex-start;
  padding: 8px 14px;
  border: 1px dashed var(--line);
  background: transparent;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ar-add-rule:hover {
  background: var(--tint);
  border-color: var(--ink-2);
  color: var(--ink);
}
.ar-add-rule svg {
  width: 13px;
  height: 13px;
}
.auto-route-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  transition: all 120ms;
}
.auto-route-toggle:hover {
  border-color: var(--ink-2);
}
.auto-route-toggle input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
}
.auto-route-track {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 99px;
  background: var(--line);
  transition: background 120ms;
  flex-shrink: 0;
}
.auto-route-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--panel);
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
  transition: transform 160ms cubic-bezier(.2,.7,.3,1);
}
.auto-route-toggle input:checked + .auto-route-track {
  background: #18181B;
}
.auto-route-toggle input:checked + .auto-route-track .auto-route-thumb {
  transform: translateX(16px);
  background: #FFFFFF;
}
.auto-route-label {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.15;
}
.auto-route-label b {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  font-style: normal;
}
.auto-route-label em {
  font-size: 10.5px;
  color: var(--muted);
  font-style: normal;
  font-family: var(--mono);
  letter-spacing: -0.01em;
}
.modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(20,18,29,.24);
  z-index: 105;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: scalein .18s ease;
}
@keyframes scalein {
  from { transform: translate(-50%, -50%) scale(.96); opacity: 0; }
  to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
.modal-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.modal-head h2 svg {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
}
.modal-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.modal-head p {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
}
.modal-body {
  padding: 18px 22px;
  overflow-y: auto;
  flex: 1;
}
.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: var(--line-2);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* When modal is over the drawer, raise the scrim too */
.scrim + .modal,
.drawer ~ .scrim + .modal {
  z-index: 1200;
}
.scrim {
  position: fixed; inset: 0; background: rgba(20,18,29,.32); backdrop-filter: blur(2px);
  z-index: 900; animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 425px; max-width: 100vw;
  background: var(--panel); border-left: 1px solid var(--line);
  box-shadow: -12px 0 48px rgba(20,18,29,.14);
  z-index: 901; display: flex; flex-direction: column;
  animation: slidein .22s cubic-bezier(.2,.7,.3,1);
}
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.drawer-head {
  padding: 14px 22px 0;
  border-bottom: 1px solid var(--line);
}
.drawer-head-top { display: flex; align-items: flex-start; gap: 12px; justify-content: space-between; }
.drawer-head h2 {
  margin: 0 0 2px; font-size: 18px; font-weight: 600; letter-spacing: -0.015em;
  display: flex; align-items: center; gap: 10px;
}
.drawer-head .sub {
  font-size: 12px; color: var(--muted); font-family: var(--mono);
  display: flex; align-items: center; gap: 8px;
}
.drawer-head .sub .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted); }
.drawer-close {
  margin-left: auto; width: 32px; height: 32px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer;
  display: grid; place-items: center;
}
.drawer-close:hover { background: var(--line-2); color: var(--ink); }
.drawer-close svg { width: 16px; height: 16px; }

.drawer-tabs { display: flex; gap: 0; margin-top: 8px; }
.drawer-tabs button {
  background: transparent; border: 0; padding: 10px 14px;
  font-size: 12.5px; color: var(--muted); cursor: pointer;
  font-family: inherit; font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: all 120ms;
}
.drawer-tabs button:hover { color: var(--ink); }
.drawer-tabs button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--ink); }

.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px; }
.drawer-foot {
  padding: 14px 22px; border-top: 1px solid var(--line); background: var(--line-2);
  display: flex; gap: 10px; align-items: center;
}

/* drawer sections */
.section { margin-bottom: 22px; }
.section-title {
  font-size: 10.5px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.07em; margin: 0 0 10px;
}
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kv-card {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px;
  background: var(--panel);
}
.kv-card.full { grid-column: 1 / -1; }
.kv-card .l {
  font-size: 10.5px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.06em; font-weight: 600; margin-bottom: 6px;
}
.kv-card .v { font-size: 14px; color: var(--ink); font-weight: 500; }
.kv-card .v.is-mono { font-family: var(--mono); letter-spacing: -0.01em; }
.kv-card .v.is-big { font-size: 18px; font-weight: 600; letter-spacing: -0.015em; }
.kv-card .sub { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* Mini-route */
.route-mini {
  display: flex; align-items: center; gap: 12px;
  padding: 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); margin-bottom: 18px;
}
.route-mini .end {
  flex: 1; min-width: 0;
}
.route-mini .end .city { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.route-mini .end .zip { font-size: 12px; color: var(--muted); font-family: var(--mono); margin-top: 2px; }
.route-mini .line {
  width: 90px;
  border-top: 2px dashed var(--ink-2); position: relative;
  height: 1px;
  margin: 0 auto;
}
.route-mini .line::after {
  content: ""; position: absolute; right: -3px; top: -5px;
  border: 5px solid transparent; border-left-color: var(--ink-2);
}
.route-mini .miles {
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  background: var(--line-2); padding: 2px 7px; border-radius: 4px;
}

/* CTA card (Source pricing) */
.cta-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.cta-card {
  border: 1px solid var(--line); border-radius: 12px; padding: 14px;
  background: var(--panel); cursor: pointer;
  transition: all 120ms; position: relative;
  display: flex; flex-direction: column; gap: 6px;
}
.cta-card:hover { border-color: var(--ink-2); background: var(--tint); transform: translateY(-1px); }
.cta-card.is-recommended {
  border-color: color-mix(in oklab, var(--accent) 60%, var(--line));
  background: color-mix(in oklab, var(--accent) 10%, var(--panel));
}
.cta-card.is-recommended:hover { background: color-mix(in oklab, var(--accent) 18%, var(--panel)); }
.cta-card .ribbon {
  position: absolute; top: 10px; right: 10px;
  background: var(--accent); color: var(--ink);
  font-size: 9.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; padding: 2px 7px; border-radius: 99px;
}
.cta-card .ico {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--ink); color: var(--accent);
  display: grid; place-items: center; margin-bottom: 4px;
}
.cta-card.is-recommended .ico { background: var(--accent); color: var(--ink); }
.cta-card .ico svg { width: 16px; height: 16px; }
.cta-card b { font-size: 14px; font-weight: 600; letter-spacing: -0.005em; }
.cta-card span { font-size: 12px; color: var(--muted); line-height: 1.45; }
.cta-card .arrow {
  margin-top: 6px;
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 500; color: var(--ink);
}
.cta-card .arrow svg { width: 12px; height: 12px; transition: transform 120ms; }
.cta-card:hover .arrow svg { transform: translateX(2px); }

/* Activity log */
.activity { display: flex; flex-direction: column; gap: 8px; }
.activity-item {
  display: flex; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid var(--line-2);
}
.activity-item:last-child { border-bottom: 0; }
.activity-time {
  font-family: var(--mono); font-size: 11px; color: var(--muted); min-width: 78px;
}
.activity-body { flex: 1; font-size: 12.5px; }
.activity-body b { font-weight: 600; }
.activity-source {
  display: inline-block; padding: 1px 5px; border-radius: 4px;
  background: var(--line-2); font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  color: var(--ink-2); margin-left: 6px; letter-spacing: 0.02em; text-transform: uppercase;
}

/* ── Table pane head (above table) ───────────────────────── */
.table-pane-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  background: var(--tint);
}
.table-count {
  font-family: var(--mono); font-size: 12px; color: var(--muted);
}

/* ── Filters / toolbar (inbox) ────────────────────────────── */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding-bottom: 14px;
}
.toolbar-spacer { flex: 1; }
.tools-search { position: relative; flex: 0 0 320px; max-width: 100%; }
.tools-search input {
  width: 100%; padding: 8px 12px 8px 34px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px;
  font-family: inherit; font-size: 13px; color: var(--ink);
}
.tools-search input:focus { outline: 0; border-color: var(--ink-2); box-shadow: 0 0 0 3px var(--tint); }
.tools-search .ico {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted);
}
.tools-search .ico svg { width: 15px; height: 15px; display: block; }
.select {
  padding: 8px 30px 8px 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px;
  font-family: inherit; font-size: 13px; color: var(--ink);
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%2376706a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center;
  height: 34px; box-sizing: border-box;
}
.tools-search input, .topbar-search input {
  height: 34px; box-sizing: border-box;
}

/* ── View toggle ──────────────────────────────────────────── */
.view-toggle {
  display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
}
.view-toggle-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 34px; background: var(--panel); border: none;
  cursor: pointer; color: var(--muted); transition: background 120ms, color 120ms;
}
.view-toggle-btn:hover { background: var(--line-2); color: var(--ink); }
.view-toggle-btn.is-active { background: var(--ink); color: var(--panel); }
.view-toggle-btn + .view-toggle-btn { border-left: 1px solid var(--line); }

/* ── Kanban board ─────────────────────────────────────────── */
.kb-board {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  min-height: 400px; align-items: start;
}
.kb-column {
  background: var(--line-2); border-radius: var(--radius);
  display: flex; flex-direction: column; min-height: 200px;
  overflow: hidden;
}
/* Column color-coding */
.kb-column:nth-child(1) { background: #f6f5f2; }
.kb-column:nth-child(2) { background: #f5f5f3; }
.kb-column:nth-child(3) { background: #f6f5f1; }
.kb-column:nth-child(4) { background: #f4f6f4; }
.kb-col-head {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 14px 12px; font-size: 12px; font-weight: 500;
  color: var(--muted); letter-spacing: 0.04em;
  border-bottom: 2px solid color-mix(in oklab, var(--line) 60%, transparent);
  text-transform: uppercase;
}
.kb-column:nth-child(1) .kb-col-head { border-bottom-color: #a88a7a; background: rgba(168,138,122,0.07); }
.kb-column:nth-child(2) .kb-col-head { border-bottom-color: #7a8ea8; background: rgba(122,142,168,0.07); }
.kb-column:nth-child(3) .kb-col-head { border-bottom-color: #a89a60; background: rgba(168,154,96,0.07); }
.kb-column:nth-child(4) .kb-col-head { border-bottom-color: #6a9a80; background: rgba(106,154,128,0.07); }
.kb-col-count {
  margin-left: auto; font-size: 11px; font-weight: 600;
  font-family: var(--mono); color: var(--muted);
  background: var(--panel); border-radius: 99px;
  padding: 1px 8px; min-width: 20px; text-align: center;
}
.kb-col-body {
  padding: 8px; display: flex; flex-direction: column; gap: 6px;
  flex: 1; overflow-y: auto;
}
.kb-empty {
  display: flex; align-items: center; justify-content: center;
  flex: 1; min-height: 80px; font-size: 12px; color: var(--muted);
  font-style: italic;
}

/* Kanban card */
.kb-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px;
  cursor: pointer; transition: box-shadow 120ms, border-color 120ms;
}
.kb-card:hover {
  box-shadow: 0 2px 10px rgba(0,0,0,0.07);
  border-color: var(--ink-2);
}
.kb-card.is-open {
  border-color: var(--accent);
  box-shadow: 0 0 0 1.5px var(--accent), 0 2px 10px rgba(0,0,0,0.06);
}
.kb-card.is-priority {
  border-left: 3px solid #F0EE54;
}
.kb-card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.kb-card-id {
  font-family: var(--mono); font-size: 11.5px; font-weight: 600;
  color: var(--ink); letter-spacing: -0.01em;
}
.kb-card-age {
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
}
.kb-card-route {
  font-size: 12.5px; font-weight: 500; color: var(--ink);
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  margin-bottom: 6px; line-height: 1.4;
}
.kb-arrow { color: var(--muted); font-size: 11px; }
.kb-card-meta {
  font-size: 11px; color: var(--muted); display: flex;
  align-items: center; gap: 4px; flex-wrap: wrap;
}
.kb-dot { opacity: 0.4; }
.kb-shipper { font-weight: 500; color: var(--ink-2); }
.kb-card-quotes {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--line-2);
}

/* ── KPI strip ────────────────────────────────────────────── */
.kpi-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; margin-bottom: 18px;
}
.kpi {
  background: var(--panel); padding: 16px 18px; cursor: pointer;
  transition: background 120ms; text-align: left; border: 0; font-family: inherit;
}
.kpi:hover { background: var(--tint); }
.kpi[aria-pressed="true"] { background: color-mix(in oklab, var(--accent) 14%, var(--panel)); }
.kpi-label {
  font-size: 10.5px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.kpi-label .dot { width: 7px; height: 7px; border-radius: 50%; }
.kpi-num {
  font-family: var(--mono); font-size: 26px; font-weight: 600;
  color: var(--ink); letter-spacing: -0.02em; line-height: 1;
}
.kpi-sub-row { display: flex; align-items: center; gap: 5px; margin-top: 4px; }
.kpi-sub { font-size: 11px; color: var(--muted); }
.kpi-who {
  display: inline-flex; align-items: center;
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  padding: 1px 6px; border-radius: 99px;
  flex-shrink: 0;
}
.kpi-who.is-you     { background: #f0ee54; color: #1a1a0a; }
.kpi-who.is-carrier { background: #dbeafe; color: #1e40af; }
.kpi-who.is-shipper { background: #e9d5ff; color: #6b21a8; }

/* ── Filter cards (icon + title + sub + count) ──────────────── */
.filter-cards {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 12px; margin-bottom: 16px;
}
.fcard {
  background: var(--panel); border: 1.5px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px;
  cursor: pointer; transition: all 150ms;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow-sm); user-select: none;
  font-family: inherit; text-align: left; width: 100%;
  position: relative;
}
.fcard:hover { border-color: color-mix(in oklab, var(--ink) 30%, var(--line)); }
.fcard.is-active {
  border-color: var(--accent); background: var(--tint);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 22%, transparent), var(--shadow-sm);
}
.fcard-icon {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  background: var(--line-2); display: grid; place-items: center;
  color: var(--ink-2); transition: all 150ms;
}
.fcard-icon svg { width: 20px; height: 20px; max-width: 20px; max-height: 20px; }
.fcard.is-active .fcard-icon { background: var(--accent); color: var(--ink); }
.fcard-body  { flex: 1; min-width: 0; }
.fcard-title { font-size: 13.5px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.fcard-sub   { font-size: 11px; color: var(--muted); margin-top: 3px; }
.fcard-count {
  font-size: 34px; font-weight: 700; color: var(--ink);
  font-family: var(--mono); letter-spacing: -0.04em;
  flex-shrink: 0; line-height: 1;
}
.fcard-badge {
  position: absolute; top: 10px; right: 12px;
  background: #f0ee54; color: #1a1a0a;
  font-size: 10px; font-weight: 700; letter-spacing: 0.02em;
  padding: 3px 8px; border-radius: 99px;
}
.fcard-badge-inline {
  display: inline-flex; align-items: center;
  background: #f0ee54; color: #1a1a0a;
  font-size: 10px; font-weight: 700; letter-spacing: 0.02em;
  padding: 3px 8px; border-radius: 99px;
  white-space: nowrap;
}

.dot.is-rfq-sent { background: var(--info); }
.dot.is-received { background: var(--purple); }
.dot.is-submitted { background: var(--info); }
.dot.is-accepted { background: var(--good); }
.dot.is-attn { background: var(--bad); }
.dot.is-offline { background: var(--muted); }

/* ── Validity countdown ──────────────────────────────────── */
.countdown {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 7px; border-radius: 4px; font-family: var(--mono);
  font-size: 11px; font-weight: 600;
}
.countdown.is-fresh { background: color-mix(in oklab, var(--good) 14%, transparent); color: var(--good); }
.countdown.is-warn  { background: color-mix(in oklab, var(--warn) 14%, transparent); color: var(--warn); }
.countdown.is-cold  { background: color-mix(in oklab, var(--bad) 14%, transparent); color: var(--bad); }
.countdown.is-expired { background: var(--line-2); color: var(--muted); text-decoration: line-through; }
.countdown svg { width: 10px; height: 10px; }

/* ── Toast ────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 12px 18px;
  border-radius: 10px; font-size: 13px; z-index: 60;
  box-shadow: 0 12px 32px rgba(20,18,29,.32);
  display: flex; align-items: center; gap: 10px;
  animation: toastin .22s cubic-bezier(.2,.7,.3,1);
}
@keyframes toastin {
  from { transform: translateX(-50%) translateY(6px); opacity: 0; }
  to { transform: translateX(-50%); opacity: 1; }
}

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
  padding: 60px 20px; text-align: center; color: var(--muted); font-size: 13px;
}

/* ── Tooltip ──────────────────────────────────────────────── */
.app.is-compact .data tbody td { padding: 8px 14px; font-size: 12.5px; }
.app.is-compact .shipper-av { width: 24px; height: 24px; font-size: 9px; }
.app.is-compact .data tbody td .driver-info,
.app.is-compact .data tbody td .shipper-info { font-size: 12px; }


/* ── Form inputs ──────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; font-weight: 500; color: var(--ink-2); }
.field .hint { font-size: 11px; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel); color: var(--ink); font-size: 13px;
  font-family: inherit;
}
.field textarea { resize: vertical; min-height: 78px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 0; border-color: var(--ink-2); box-shadow: 0 0 0 3px var(--tint);
}

/* ── Stepper ──────────────────────────────────────────────── */
.stepper {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 18px;
}
.stepper .step {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--muted);
}
.stepper .step .num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--line-2); color: var(--muted);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700; font-family: var(--mono);
}
.stepper .step.is-done .num { background: var(--good); color: #fff; }
.stepper .step.is-active .num { background: var(--ink); color: var(--bg); }
.stepper .step.is-active { color: var(--ink); font-weight: 500; }
.stepper .step.is-done { color: var(--ink-2); }
.stepper .step-sep {
  flex: 1; border-top: 1px dashed var(--line); height: 1px; min-width: 40px;
}
.stepper .step-sep.is-done { border-top-color: var(--good); border-top-style: solid; }

/* ── Routing Settings — AG-Grid-style table ─────────────────── */
.rs-grid {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  font-size: 13px;
}

.rs-grid-head {
  display: grid;
  /* Lanes · Stops · From · To · Carrier · Service · Notes · Actions */
  grid-template-columns:
    minmax(120px, 0.9fr)
    minmax(160px, 1.1fr)
    minmax(170px, 1.1fr)
    minmax(170px, 1.1fr)
    minmax(150px, 1fr)
    minmax(150px, 1fr)
    minmax(220px, 1.4fr)
    72px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in oklab, var(--line-2) 60%, var(--panel));
  position: sticky;
  top: 0;
  z-index: 2;
}

.rs-grid-th {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px 0 14px;
  height: 40px;
  cursor: pointer;
  user-select: none;
}
.rs-grid-th.is-focused {
  outline: 1.5px solid color-mix(in oklab, var(--info) 60%, transparent);
  outline-offset: -2px;
  border-radius: 4px;
}
.rs-grid-th-label {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rs-grid-th-icobtn,
.rs-grid-th-menu {
  width: 22px;
  height: 22px;
  border: 0;
  background: transparent;
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  flex-shrink: 0;
}
.rs-grid-th-icobtn:hover,
.rs-grid-th-menu:hover {
  background: var(--line);
  color: var(--ink);
}
.rs-grid-th-icobtn svg { width: 13px; height: 13px; }
.rs-grid-th-menu svg { width: 13px; height: 13px; }

.rs-grid-th-sep {
  position: absolute;
  right: -0.5px;
  top: 9px;
  bottom: 9px;
  width: 1px;
  background: var(--line);
}
.rs-grid-th-actions { background: transparent; cursor: default; }
.rs-grid-th-actions:hover { background: transparent; }

/* Body */
.rs-grid-body {
  display: flex;
  flex-direction: column;
}
.rs-grid-row {
  display: grid;
  grid-template-columns:
    minmax(120px, 0.9fr)
    minmax(160px, 1.1fr)
    minmax(170px, 1.1fr)
    minmax(170px, 1.1fr)
    minmax(150px, 1fr)
    minmax(150px, 1fr)
    minmax(220px, 1.4fr)
    72px;
  border-bottom: 1px solid var(--line-2);
  cursor: pointer;
  transition: background 100ms;
  min-height: 44px;
}
.rs-grid-row:last-child { border-bottom: 0; }
.rs-grid-row:hover { background: color-mix(in oklab, var(--accent) 6%, transparent); }

.rs-grid-cell {
  display: flex;
  align-items: center;
  padding: 8px 14px;
  font-size: 12.5px;
  color: var(--ink);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rs-cell-empty { color: var(--muted); font-family: var(--mono); font-size: 11.5px; }

.rs-grid-cell-notes {
  display: block;
  padding: 8px 14px;
  align-content: center;
}
.rs-note-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.rs-notes-text {
  display: block;
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.5;
}
.rs-note-toggle {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: var(--info);
  line-height: 1.4;
}
.rs-note-toggle:hover { text-decoration: underline; }

.rs-grid-cell-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
  padding-right: 12px;
}
.rs-row-action {
  width: 26px;
  height: 26px;
  border: 0;
  background: transparent;
  border-radius: 5px;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.rs-row-action:hover { background: var(--line); color: var(--ink); }
.rs-row-action.is-danger:hover { color: var(--bad); background: color-mix(in oklab, var(--bad) 10%, transparent); }
.rs-row-action svg { width: 14px; height: 14px; }

/* Chip chain (Lanes / Stops columns) */
.rs-chip-chain-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}
.rs-chip-stops {
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
  padding-left: 1px;
}
.rs-chip-chain {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}
.rs-code-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.02em;
  line-height: 1.4;
}
.rs-chip-slot {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.rs-chip-zip {
  font-size: 9.5px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
  line-height: 1.2;
}
.rs-chip-arrow {
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}

/* Service type pills */
.rs-svc-row {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.rs-svc-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.45;
  white-space: nowrap;
}
.rs-svc-pill.is-info   { background: color-mix(in oklab, var(--purple) 18%, transparent); color: var(--purple); }
.rs-svc-pill.is-purple { background: color-mix(in oklab, var(--accent) 40%, transparent); color: var(--accent-ink); }
.rs-svc-pill.is-warn   { background: color-mix(in oklab, var(--info) 16%, transparent); color: var(--info); }
.rs-svc-pill.is-good   { background: color-mix(in oklab, var(--good) 16%, transparent); color: var(--good); }
.rs-svc-pill.is-neutral { background: var(--line-2); color: var(--ink-2); }

/* Empty state */
.rs-grid-empty {
  padding: 60px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.rs-grid-empty b {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.rs-grid-empty span {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 10px;
}

/* Footer */
.rs-grid-foot {
  padding: 10px 18px;
  text-align: right;
  font-size: 11.5px;
  color: var(--muted);
  background: var(--panel);
  border-top: 1px solid var(--line-2);
}
.rs-grid-foot b {
  color: var(--ink);
  font-weight: 700;
  font-family: var(--mono);
}

/* ── Edit modal ───────────────────────────────────────────── */
.rs-modal-scrim {
  position: fixed; inset: 0;
  background: rgba(20,18,29,0.4);
  backdrop-filter: blur(2px);
  z-index: 100;
  animation: fade .18s ease;
}
.rs-modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 760px; max-width: 94vw;
  max-height: 90vh;
  background: var(--panel);
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(20,18,29,0.24);
  z-index: 101;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.rs-modal-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
}
.rs-modal-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.rs-modal-head .sub {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
}
.rs-modal-close {
  width: 30px; height: 30px;
  border: 0;
  background: transparent;
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
  display: grid; place-items: center;
  margin-left: auto;
}
.rs-modal-close:hover { background: var(--line-2); color: var(--ink); }
.rs-modal-close svg { width: 16px; height: 16px; }
.rs-modal-body {
  padding: 18px 22px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.rs-modal-body .rs-rule-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.rs-modal-body .rs-rule-row .ar-field { flex: 1; min-width: 90px; }
.rs-modal-foot {
  padding: 14px 22px;
  background: var(--line-2);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Responsive ─────────────────────────────────────────────── */

/* 1280px — tighten padding */
@media (max-width: 1280px) {
  .canvas { padding: 20px 20px 48px; }
  .topbar { padding: 10px 20px; }
}

/* 1100px — hide Notes column */
@media (max-width: 1100px) {
  .canvas { padding: 18px 16px 40px; }
  table.data thead th:nth-child(7),
  table.data tbody td:nth-child(7) { display: none; }
  .table-pane-head { flex-wrap: wrap; row-gap: 8px; }
  .table-pane-head > div:last-child { width: 100%; }
  .table-pane-head > div:last-child input { width: 100% !important; }
}

/* 960px — collapse sidebar, hide Service column */
@media (max-width: 960px) {
  .sidebar {
    padding: 18px 8px !important;
    width: 56px;
    overflow: hidden;
  }
  .sidebar .brand { justify-content: center; padding: 4px 0 14px; }
  .sidebar .brand-text,
  .sidebar .nav-item > span,
  .sidebar .nav-subitem > span,
  .sidebar .nav-chev,
  .sidebar .nav-subitem-add,
  .sidebar .nav-item .badge,
  .sidebar .nav-subgroup,
  .sidebar .persona-switch .who,
  .sidebar .persona-switch .chev { display: none !important; }
  .sidebar .nav-item,
  .sidebar .nav-subitem { justify-content: center; padding: 9px 0; width: 100%; }
  .sidebar .persona-switch { padding: 6px; justify-content: center; }

  .canvas { padding: 14px 14px 36px; }
  .topbar { padding: 10px 14px; }

  table.data thead th:nth-child(6),
  table.data tbody td:nth-child(6) { display: none; }
}

/* 768px — hide Stops column, stack table toolbar, narrow modal */
@media (max-width: 768px) {
  .canvas { padding: 10px 10px 28px; }
  .topbar { padding: 8px 10px; min-height: 48px; }
  .topbar-title { font-size: 13.5px; }

  table.data thead th:nth-child(4),
  table.data tbody td:nth-child(4) { display: none; }

  .table-pane-head {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 12px;
  }
  .table-pane-head > * { margin-left: 0 !important; width: 100% !important; }

  .rs-modal {
    width: calc(100vw - 24px) !important;
    max-height: 96vh !important;
    top: 12px !important;
    transform: translate(-50%, 0) !important;
  }
  .rs-modal-scrim { align-items: flex-start; }

  .page-head { flex-direction: column; align-items: flex-start; gap: 10px; }
}

/* 560px — hide To column, keep only Lane · From · Carrier · Actions */
@media (max-width: 560px) {
  table.data thead th:nth-child(3),
  table.data tbody td:nth-child(3) { display: none; }

  .data tbody td { padding: 10px 10px; }
  .data thead th { padding: 8px 10px; }
}

/* ══ Shared mobile top bar (opt-in via .ft-mstatus/.ft-mtop) ═══════
   Any page that renders the mobile status + breadcrumb rows gets
   consistent styling AND hides the desktop sidebar/topbar on mobile.
   Pages without .ft-mstatus in the DOM are unaffected. */
.ft-mstatus, .ft-mtop { display: none; }
.dray-tl-chevron { display: none; }

@media (max-width: 768px) {
  .app:has(.ft-mstatus) { grid-template-columns: 1fr; }
  .app:has(.ft-mstatus) > .sidebar { display: none !important; }
  .app:has(.ft-mstatus) .topbar { display: none !important; }

  .ft-mstatus {
    display: flex; align-items: center; justify-content: flex-start;
    height: 44px; padding: 0 16px;
    background: rgb(36,36,36); color: #fff; flex-shrink: 0;
  }
  .ft-mstatus-btn {
    width: 28px; height: 28px; padding: 0;
    background: transparent; border: 0; cursor: pointer;
    color: #fff; display: grid; place-items: center;
  }

  .ft-mtop {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 16px 10px;
    background: #fff; flex-shrink: 0;
  }
  .ft-mtop-btn {
    position: relative; width: 24px; height: 24px; padding: 0;
    background: transparent; border: 0; cursor: pointer;
    color: var(--ink); display: grid; place-items: center;
  }
  .ft-mtop-crumbs {
    flex: 1; min-width: 0;
    display: flex; align-items: center; gap: 4px;
    overflow: hidden; margin-left: 4px;
  }
  .ft-mtop-crumb {
    font-family: var(--font);
    font-size: 14px; font-weight: 500; line-height: 1.2;
    color: var(--ink);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .ft-mtop-sep { color: var(--ink); flex-shrink: 0; }
  .ft-mtop-bell .ft-mtop-badge {
    position: absolute; top: -3px; right: -4px;
    min-width: 15px; height: 15px; padding: 0 4px;
    border-radius: 999px;
    background: var(--bad, #e0413a); color: #fff;
    font-size: 10px; font-weight: 700; line-height: 15px;
    text-align: center; box-sizing: border-box;
  }
}


/* ── AI agent (sidebar pill + floating bar) ─────────────────── */
.ai-ask-pill {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; width: 100%; height: 33px;
  padding: 8px; border-radius: 999px;
  cursor: pointer;
  color: #fff; font: inherit;
  margin-bottom: 4px;
  border: 1px solid transparent;
  background-image:
    linear-gradient(rgb(13,19,24), rgb(13,19,24)),
    linear-gradient(90deg, #5386EF 0%, #8FEFFF 50%, #D58FFF 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
}
.ai-ask-pill:hover { background: rgba(255,255,255,0.06); }
.ai-ask-pill.is-active { background: rgba(255,255,255,0.10); }
.ai-ask-pill,
.ai-ask-pill:link,
.ai-ask-pill:visited { text-decoration: none; }
.ai-ask-pill-l { display: flex; align-items: center; gap: 4px; min-width: 0; }
.ai-ask-sparkles { width: 16px; height: 16px; flex-shrink: 0; }
.ai-ask-pill-text {
  font-weight: 700; font-size: 14px; line-height: 1.2;
  white-space: nowrap; color: #fff;
}
.ai-ask-chev { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.9; }
.sidebar.is-collapsed .ai-ask-pill { justify-content: center; padding: 8px 0; }
.sidebar.is-collapsed .ai-ask-pill-text,
.sidebar.is-collapsed .ai-ask-chev { display: none; }

.ai-agent-wrap {
  position: fixed;
  /* Center on the main content area (right of the sidebar), so this stays
     visually aligned with in-page controls like the Card/Table view switcher
     which center on .main. Sidebar is 240px expanded, 64px collapsed. */
  left: calc(50% + 120px);
  bottom: 30px;
  transform: translateX(-50%);
  width: 425px;
  z-index: 900;
  display: flex; flex-direction: column; gap: 12px;
  align-items: stretch;
}
.app:has(.sidebar.is-collapsed) .ai-agent-wrap { left: calc(50% + 32px); }
@media (max-width: 768px) {
  .ai-agent-wrap { left: 50% !important; }
}

/* ── View switcher (floating Map/Table/Card pill) ────────────
   Shared style used across Freight Map, Freight Table, Dispatch,
   All Shipments, Broker Routing, Quoting, Network, Postal, Container,
   Trackers. Centers on the main content area (matches .ai-agent-wrap). */
.view-switcher {
  position: fixed;
  bottom: 24px; left: calc(50% + 120px); transform: translateX(-50%);
  z-index: 800;
  display: flex; align-items: center; gap: 2px;
  padding: 3px;
  background: color-mix(in oklab, var(--panel) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: 99px;
  box-shadow: 0 4px 20px rgba(20,18,29,.12), 0 1px 4px rgba(20,18,29,.07);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.app:has(.sidebar.is-collapsed) .view-switcher { left: calc(50% + 32px); }
@media (max-width: 768px) {
  .view-switcher { left: 50% !important; }
}
.view-switcher-btn {
  height: 24px;
  padding: 0 16px;
  background: transparent; border: 0;
  color: var(--ink-2);
  font-family: inherit;
  font-size: 13px; font-weight: 450;
  letter-spacing: -0.01em;
  border-radius: 99px;
  cursor: pointer;
  transition: background 150ms, color 150ms, box-shadow 150ms;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex; align-items: center;
}
.view-switcher-btn:hover { color: var(--ink); }
.view-switcher-btn.is-active {
  background: var(--ink);
  color: var(--panel);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(20,18,29,.18);
}
.ai-agent-panel {
  max-height: 360px;
  overflow-y: auto;
  padding: 16px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(0,0,0,0.10);
  display: flex; flex-direction: column; gap: 10px;
  border: 1px solid transparent;
  background-image:
    linear-gradient(#fff, #fff),
    linear-gradient(90deg, #5386EF 0%, #8FEFFF 50%, #D58FFF 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
}
.ai-msg {
  font-size: 14px; line-height: 1.4;
  padding: 8px 12px;
  border-radius: 12px;
  max-width: 85%;
  white-space: pre-wrap;
}
.ai-msg-user { background: #F4F4F5; color: #14121d; align-self: flex-end; }
.ai-msg-ai   { background: #fff; color: #14121d; align-self: flex-start; }

.ai-agent-bar {
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(0,0,0,0.10);
  display: flex; flex-direction: column;
  box-sizing: border-box;
  cursor: text;
  border: 1px solid transparent;
  background-image:
    linear-gradient(#fff, #fff),
    linear-gradient(90deg, #5386EF 0%, #8FEFFF 50%, #D58FFF 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  transition: border-radius 180ms ease, box-shadow 180ms ease;
}
.ai-agent-bar.has-attach {
  border-radius: 30px;
  box-shadow: 0 0 50px rgba(0,0,0,0.10);
}
.ai-agent-bar-row {
  height: 66px;
  display: flex; flex-direction: row;
  align-items: center; justify-content: space-between;
  padding: 12px 20px;
  box-sizing: border-box;
}
.ai-agent-attachments {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 20px 20px 0;
}
.ai-agent-attach-card {
  position: relative;
  width: 70px; height: 70px;
  border-radius: 12px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgb(235,243,249);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  overflow: hidden;
}
.ai-agent-attach-card.has-image { box-shadow: inset 0 0 0 1px rgb(235,243,249); }
.ai-agent-attach-x {
  position: absolute; top: 8px; right: 8px;
  width: 18px; height: 18px;
  display: grid; place-items: center;
  background: transparent; border: 0; padding: 0;
  color: rgb(169,169,169);
  cursor: pointer;
  border-radius: 50%;
}
.ai-agent-attach-card.has-image .ai-agent-attach-x {
  color: #fff;
  background: rgba(20,18,29,0.55);
  backdrop-filter: blur(4px);
}
.ai-agent-attach-x:hover { color: #14121d; }
.ai-agent-attach-card.has-image .ai-agent-attach-x:hover { background: rgba(20,18,29,0.75); color: #fff; }
.ai-agent-attach-x svg { width: 18px; height: 18px; }
.ai-agent-attach-body {
  position: absolute;
  left: 8px; bottom: 8px;
  display: flex; flex-direction: column; gap: 2px;
  align-items: flex-start;
}
.ai-agent-attach-title {
  font-family: "Metrik Trial", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-weight: 700; font-size: 12px; line-height: 0.8;
  color: rgb(83,83,83);
}
.ai-agent-attach-meta {
  font-family: "Metrik Trial", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-weight: 500; font-size: 12px; line-height: 0.8;
  color: rgb(169,169,169);
  white-space: nowrap;
}
.ai-agent-attach-card.is-recording { box-shadow: inset 0 0 0 1px #FF483B; }
.ai-agent-attach-card.is-recording .ai-agent-attach-title { color: #FF483B; }
.ai-agent-attach-rec-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #FF483B;
  animation: ai-agent-rec-pulse 1.2s ease-in-out infinite;
  margin-bottom: 4px;
}
.ai-agent-bar-l {
  display: flex; align-items: center; gap: 6px;
  flex: 1; min-width: 0;
}
.ai-agent-sparkles { width: 18px; height: 18px; flex-shrink: 0; }
.ai-agent-input {
  flex: 1; min-width: 0;
  border: 0; outline: 0; background: transparent;
  font-family: "Metrik Trial", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.2;
  color: #14121d;
  padding: 0;
}
.ai-agent-input::placeholder { color: rgb(169,169,169); opacity: 1; }
.ai-agent-input-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}
.ai-agent-input-wrap .ai-agent-input { flex: 1; width: 100%; }
.ai-agent-input.has-hint { color: transparent; caret-color: #14121d; }
.ai-agent-input-ghost {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  font-family: "Metrik Trial", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.2;
  white-space: pre;
  overflow: hidden;
}
.ai-agent-input-ghost .ghost-typed { color: #14121d; }
.ai-agent-input-ghost .ghost-sep { color: rgb(200,200,200); }
.ai-agent-input-ghost .ghost-hint { color: rgb(169,169,169); }
.ai-agent-bar-r {
  display: flex; align-items: center; gap: 0px;
  flex-shrink: 0;
}
.ai-agent-icon-btn {
  width: 42px; height: 42px;
  border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; cursor: pointer;
  color: rgb(83,83,83);
  padding: 12px;
  box-sizing: border-box;
}
.ai-agent-icon-btn:hover { background: rgba(0,0,0,0.04); }
.ai-agent-icon-btn svg { width: 18px; height: 18px; }
.ai-agent-icon-btn.is-recording {
  background: #FF483B;
  color: #fff;
  animation: ai-agent-rec-pulse 1.2s ease-in-out infinite;
}
.ai-agent-icon-btn.is-recording:hover { background: #E63A2E; }
@keyframes ai-agent-rec-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,72,59,0.5); }
  50%      { box-shadow: 0 0 0 6px rgba(255,72,59,0); }
}

@media (max-width: 640px) {
  .ai-agent-wrap { width: calc(100% - 32px); }
}

/* ── AI Agent side panel (docks right when a chat starts) ── */
.ai-side-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 400px;
  background: #fff;
  border-left: 1px solid #E2E2E2;
  z-index: 900;
  display: flex; flex-direction: column;
  box-shadow: -24px 0 60px rgba(20,18,29,0.08);
  animation: ai-side-in 260ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
@keyframes ai-side-in {
  from { transform: translateX(24px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
.ai-side-head {
  height: 56px; padding: 0 16px 0 20px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid #F1F1F1;
  flex-shrink: 0;
}
.ai-side-title {
  font-family: "Metrik Trial", -apple-system, sans-serif;
  font-weight: 700; font-size: 18px; color: #14121D;
  margin: 0;
}
.ai-side-head-actions { display: flex; align-items: center; gap: 2px; }
.ai-side-icon-btn {
  width: 28px; height: 28px; padding: 0;
  border: 0; background: transparent; cursor: pointer;
  border-radius: 6px;
  display: grid; place-items: center;
  color: #535353;
}
.ai-side-icon-btn:hover { background: #f4f4f2; color: #14121D; }
.ai-side-icon-btn svg { width: 16px; height: 16px; }

.ai-side-messages {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 20px 20px 12px;
  display: flex; flex-direction: column; gap: 14px;
}

.ai-side-row { display: flex; flex-direction: column; gap: 6px; max-width: 100%; }
.ai-side-row-user { align-items: flex-end; }
.ai-side-row-ai   { align-items: flex-start; }

.ai-side-bubble {
  padding: 12px 16px;
  font-family: "Metrik Trial", sans-serif;
  font-weight: 400; font-size: 14px; line-height: 1.35;
  color: #14121D;
  max-width: 85%;
}
.ai-side-bubble-user {
  background: #fff;
  box-shadow: inset 0 0 0 1px #EBF3F9;
  border-radius: 12px 0 12px 12px;
}
.ai-side-bubble-ai {
  background: #F8F7F5;
  border-radius: 0 12px 12px 12px;
}

.ai-side-msg-actions { display: flex; gap: 10px; padding-left: 2px; }
.ai-side-msg-actions button {
  width: 16px; height: 16px; padding: 0;
  border: 0; background: transparent; cursor: pointer;
  color: #A9A9A9;
  display: grid; place-items: center;
}
.ai-side-msg-actions button:hover { color: #14121D; }

/* Shipment card (reused visual language from AI Agent page) */
.ai-side-shipcard {
  width: 100%;
  background: #F8F7F5;
  border-radius: 0 12px 12px 12px;
  padding: 12px;
  display: flex; flex-direction: column; gap: 12px;
}
.ai-side-shipcard-top { display: flex; gap: 8px; }
.ai-side-shipcard-icon {
  width: 28px; height: 28px; border-radius: 6px;
  background: #fff; flex-shrink: 0;
  display: grid; place-items: center;
}
.ai-side-shipcard-body { flex: 1; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ai-side-shipcard-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.ai-side-shipcard-eyebrow {
  font-family: "Metrik Trial", sans-serif;
  font-weight: 700; font-size: 11px; color: #535353;
  line-height: 1;
}
.ai-side-shipcard-title {
  font-family: "Metrik Trial", sans-serif;
  font-weight: 700; font-size: 14px; color: #14121D;
  margin-top: 2px;
}
.ai-side-badge {
  display: inline-flex; align-items: center;
  height: 20px; padding: 0 8px;
  font-family: "Metrik Trial", sans-serif;
  font-weight: 700; font-size: 11px; letter-spacing: 0.02em;
  border-radius: 99px;
  color: #007AFF; background: rgba(0,122,255,0.10);
  flex-shrink: 0;
}
.ai-side-shipcard-facts {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px;
}
.ai-side-fact { display: flex; align-items: baseline; gap: 6px; }
.ai-side-fact-l {
  font-family: "Metrik Trial", sans-serif;
  font-weight: 700; font-size: 11px; color: #535353;
}
.ai-side-fact-v {
  font-family: "Metrik Trial", sans-serif;
  font-weight: 700; font-size: 13px; color: #14121D;
}
.ai-side-shipcard-link {
  align-self: flex-end;
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none;
  font-family: "Metrik Trial", sans-serif;
  font-weight: 700; font-size: 13px; color: #007AFF;
}
.ai-side-shipcard-link:hover { text-decoration: underline; }

/* CTA row */
.ai-side-cta-row {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 0 0 10px;
}
.ai-side-cta {
  height: 34px; padding: 0 12px;
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 8px;
  border: 1px solid #E2E2E2; background: #fff;
  font-family: "Metrik Trial", sans-serif;
  font-weight: 500; font-size: 13px; color: #14121D;
  cursor: pointer;
}
.ai-side-cta:hover { background: #f4f4f2; }
.ai-side-cta.is-primary { background: #14121D; color: #fff; border-color: #14121D; }
.ai-side-cta.is-primary:hover { background: #000; }
.ai-side-cta svg { width: 14px; height: 14px; }

/* Composer inside side panel */
.ai-side-composer-wrap {
  padding: 12px 16px 16px;
  flex-shrink: 0;
}
.ai-side-composer {
  border-radius: 14px; background: #fff;
  border: 1px solid #DCE7F1;
  overflow: hidden;
}
.ai-side-attachments {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 12px 12px 0;
}
.ai-side-attach-card {
  position: relative;
  width: 56px; height: 56px;
  border-radius: 10px;
  background: #fff;
  box-shadow: inset 0 0 0 1px #EBF3F9;
  background-size: cover; background-position: center;
  flex-shrink: 0; overflow: hidden;
}
.ai-side-attach-x {
  position: absolute; top: 4px; right: 4px;
  width: 16px; height: 16px;
  display: grid; place-items: center;
  background: transparent; border: 0; padding: 0;
  color: #A9A9A9; cursor: pointer; border-radius: 50%;
}
.ai-side-attach-card.has-image .ai-side-attach-x {
  color: #fff; background: rgba(20,18,29,0.55); backdrop-filter: blur(4px);
}
.ai-side-attach-x svg { width: 14px; height: 14px; }
.ai-side-attach-body {
  position: absolute; left: 6px; bottom: 6px;
  display: flex; flex-direction: column; gap: 2px;
}
.ai-side-attach-title {
  font-family: "Metrik Trial", sans-serif;
  font-weight: 700; font-size: 10px; color: #535353; line-height: 1;
}
.ai-side-attach-meta {
  font-family: "Metrik Trial", sans-serif;
  font-weight: 500; font-size: 10px; color: #A9A9A9; line-height: 1;
}
.ai-side-composer-top {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
}
.ai-side-composer-top .ai-side-sparkles { width: 18px; height: 18px; flex-shrink: 0; }
.ai-side-composer-input {
  flex: 1; min-width: 0;
  border: 0; outline: 0; background: transparent;
  font-family: "Metrik Trial", sans-serif;
  font-size: 14px; color: #14121D;
}
.ai-side-composer-input::placeholder { color: #A9A9A9; }
.ai-side-composer-audio {
  width: 28px; height: 28px; border-radius: 6px;
  background: transparent; border: 0; padding: 0; cursor: pointer;
  display: grid; place-items: center; color: #535353;
}
.ai-side-composer-audio:hover { background: #f4f4f2; }
.ai-side-composer-bot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px 10px;
}
.ai-side-composer-attach {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: 0; padding: 0; cursor: pointer;
  font-family: "Metrik Trial", sans-serif;
  font-size: 13px; color: #535353;
}
.ai-side-composer-attach:hover { color: #14121D; }
.ai-side-composer-send {
  border: 0; background: transparent; padding: 0; cursor: pointer;
  display: inline-flex; align-items: center;
}
.ai-side-composer-send img { height: 32px; display: block; }

/* Thinking dots */
.ai-side-thinking {
  background: #F8F7F5;
  border-radius: 0 12px 12px 12px;
  padding: 14px 16px;
  display: inline-flex; align-items: center; gap: 6px;
}
.ai-side-thinking span {
  width: 6px; height: 6px; border-radius: 50%;
  background: #A9A9A9;
  animation: ai-side-dot 1.2s ease-in-out infinite;
}
.ai-side-thinking span:nth-child(2) { animation-delay: 0.15s; }
.ai-side-thinking span:nth-child(3) { animation-delay: 0.30s; }

/* Expand dialog (in-page overlay with AI Agent full view) */
.ai-side-expand-overlay {
  position: fixed; inset: 0;
  z-index: 1000;
  background: rgba(20,18,29,0.55);
  backdrop-filter: blur(4px);
  padding: 32px;
  display: grid; place-items: center;
  animation: ai-side-in 200ms ease-out both;
}
.ai-side-expand-frame {
  width: 100%; height: 100%;
  max-width: 1440px;
  border: 0; border-radius: 16px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(0,0,0,0.35);
}
.ai-side-expand-close {
  position: absolute; top: 20px; right: 24px;
  width: 36px; height: 36px; border-radius: 999px;
  background: #fff; border: 0; cursor: pointer;
  display: grid; place-items: center;
  color: #14121D;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1;
}
.ai-side-expand-close:hover { background: #f4f4f2; }
@keyframes ai-side-dot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30%           { opacity: 1;   transform: translateY(-3px); }
}

/* ─── Table-view pages: viewport-fit + sticky header + internal scroll ─── */
/* Applies to any page whose canvas contains a .table-pane with a scrollable body. */
html:has(.app .table-pane .table-pane-body),
html:has(.app .table-pane .table-pane-body) body { height: 100%; overflow: hidden; }
.app:has(.table-pane .table-pane-body) { height: 100vh; min-height: 0; overflow: hidden; }
/* Some pages wrap the main column in an outer scroll div — neutralize its scroll */
.app:has(.table-pane .table-pane-body) > div[style*="height:100vh"],
.app:has(.table-pane .table-pane-body) > div[style*="height: 100vh"] { height: 100vh !important; overflow: hidden !important; min-height: 0; }
.app:has(.table-pane .table-pane-body) > .main,
.app:has(.table-pane .table-pane-body) > div[style*="height:100vh"] > .main,
.app:has(.table-pane .table-pane-body) > div[style*="height: 100vh"] > .main { min-height: 0; overflow: hidden; height: 100%; }
.app:has(.table-pane .table-pane-body) .canvas { display: flex; flex-direction: column; min-height: 0; overflow: hidden; flex: 1 1 auto; }
.app:has(.table-pane .table-pane-body) .table-pane { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.app:has(.table-pane .table-pane-body) .table-pane > .table-pane-head { flex: 0 0 auto; }
.app:has(.table-pane .table-pane-body) .table-pane-body { flex: 1 1 auto; min-height: 0; overflow: auto; }
/* Ensure sticky headers stick relative to the internal scroller */
.app:has(.table-pane .table-pane-body) .table-pane-body table.freight thead th,
.app:has(.table-pane .table-pane-body) .table-pane-body table.data thead th { position: sticky; top: 0; z-index: 3; }
