/* ─── ASAP Brand Palette ──────────────────────────────────────── */
:root {
  --green-500: #61B212;
  --green-600: #288F00;
  --green-700: #006808;
  --green-300: #B9E89B;
  --green-100: #E8F5E9;
  --blue-100:  #E1F5FE;
  --blue-600:  #007ECA;
  --blue-700:  #005689;
  --purple-100: #F1EBFF;
  --purple-500: #4702DA;
  --purple-700: #190050;
  --red-500:   #D73030;
  --red-600:   #B00020;
  --red-700:   #830018;
  --gray-0:    #FFFFFF;
  --gray-100:  #F8F8FB;
  --gray-200:  #EBECF2;
  --gray-250:  #DFE1EB;
  --gray-300:  #CFD2DC;
  --gray-500:  #A2A6B3;
  --gray-600:  #5D6273;
  --gray-700:  #3E424D;
  --gray-800:  #22242A;
  --gray-900:  #191A1F;
  --gray-1000: #000000;
  --drawer-w:  309px;
  --drawer-w-collapsed: 64px;
  --appbar-h:  68px;
  --blue:      #1976D2;
  --orange:    #FF9800;
  --red:       #D32F2F;
  --red-light: #FFEBEE;
  --yellow:    #F59E0B;
  --yellow-light: #FFFBEB;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Ubuntu', sans-serif; background: var(--gray-100); color: var(--gray-800); }

/* ─── AppBar ──────────────────────────────────────────────────── */
.appbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--appbar-h);
  background: var(--gray-0); box-shadow: 0 2px 8px rgba(0,0,0,.12);
  display: flex; align-items: center; z-index: 200;
}
.appbar-logo {
  display: flex; align-items: center; padding: 0 32px 0 24px;
  height: 100%; gap: 10px;
}
.appbar-logo-img { height: 32px; }
.appbar-logo-text { font-size: 15px; font-weight: 700; color: var(--green-600); letter-spacing: .5px; }
.appbar-spacer { flex: 1; }
.appbar-user {
  display: flex; align-items: center; gap: 12px;
  background: #f5f5f5; height: 100%; padding: 0 24px;
  font-size: 13px; color: var(--gray-600);
}
.appbar-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--gray-300); display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 500; color: var(--gray-600);
}

/* ─── Drawer ──────────────────────────────────────────────────── */
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--drawer-w); background: var(--gray-900);
  z-index: 100; overflow-y: auto; overflow-x: hidden;
}
.drawer-nav { padding-top: 100px; }
.nav-item {
  display: flex; align-items: center; gap: 16px;
  padding: 12.5px 25px; cursor: pointer; color: var(--gray-0);
  font-size: 1rem; letter-spacing: .03125rem; line-height: 1.25rem;
  border-left: 3px solid transparent; transition: background .15s;
  text-decoration: none;
}
.nav-item:hover { background: var(--gray-1000); }
.nav-item:hover .nav-label { color: var(--green-500); }
.nav-item:hover .nav-icon { color: var(--green-500); }
.nav-item.active {
  background: var(--gray-1000); border-left-color: var(--green-500);
  padding-left: 22px;
}
.nav-item.active .nav-label { color: var(--green-500); font-weight: 500; }
.nav-item.active .nav-icon { color: var(--green-500); }
.nav-icon { font-size: 20px; width: 25px; text-align: center; flex-shrink: 0; }
.nav-divider { border: none; border-top: 1px solid #333; margin: 8px 24px; }

/* ─── Collapsed drawer (icon rail) ────────────────────────────────
   body.drawer-collapsed swaps the width variable's consumers; the drawer
   and .main reflow together. Which items RENDER is untouched — page-access
   filtering toggles display on the same elements in both states, and the
   permanently-hidden unlaunched items keep their inline display:none.
   Labels come back on hover via the native title attr (set in JS when
   collapsed) — a CSS flyout would be clipped by the drawer's
   overflow-x:hidden. Preference persists in localStorage. */
body.drawer-collapsed .drawer { width: var(--drawer-w-collapsed); }
body.drawer-collapsed .main { margin-left: var(--drawer-w-collapsed); }
body.drawer-collapsed .nav-label { display: none; }
body.drawer-collapsed .nav-item {
  justify-content: center; gap: 0; padding-left: 0; padding-right: 0;
}
/* Active keeps its green left border + green icon; padding-left stays 0 so
   the icon remains centered (the expanded 22px trick compensates the border
   against 25px text padding, which no longer applies). */
body.drawer-collapsed .nav-item.active { padding-left: 0; }
body.drawer-collapsed .nav-divider { margin: 8px 14px; }

/* The collapse handle: a small pill straddling the drawer's right edge,
   vertically centered (pane-boundary idiom — clear of the logo/appbar
   cluster and reachable at any drawer width). position:fixed sibling of
   .drawer so its overflow-x:hidden cannot clip it; left tracks the width
   variable so it rides the boundary in both states. Quiet by default,
   lights up on hover. z-index between drawer (100) and appbar (200). */
.drawer-toggle {
  position: fixed; top: 50%; left: var(--drawer-w);
  transform: translate(-50%, -50%);
  width: 22px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  background: var(--gray-0); border: 1px solid var(--gray-300);
  border-radius: 999px; cursor: pointer;
  color: var(--gray-500); font-size: 15px; line-height: 1; padding: 0 0 2px 0;
  opacity: .7; z-index: 150;
  transition: opacity .15s, color .15s, border-color .15s, box-shadow .15s;
}
.drawer-toggle:hover {
  opacity: 1; color: var(--green-600); border-color: var(--green-500);
  box-shadow: 0 1px 6px rgba(0,0,0,.2);
}
body.drawer-collapsed .drawer-toggle { left: var(--drawer-w-collapsed); }


/* ─── Main ────────────────────────────────────────────────────── */
.main {
  margin-left: var(--drawer-w);
  margin-top: var(--appbar-h);
  padding: 24px;
  min-height: calc(100vh - var(--appbar-h));
}

/* ─── Page header ─────────────────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-title { font-size: 1.75rem; font-weight: 500; color: var(--gray-800); }
.page-subtitle { font-size: .875rem; color: var(--gray-600); margin-top: 2px; }

/* ─── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--gray-0); border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 1rem; font-weight: 500; color: var(--gray-800); }
.card-body { padding: 20px; }

/* ─── Chips / Badges ──────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: 16px; font-size: .75rem; font-weight: 500;
}
.chip-green  { background: var(--green-100); color: var(--green-700); }
.chip-red    { background: var(--red-light); color: var(--red); }
.chip-yellow { background: var(--yellow-light); color: #92400E; }
.chip-blue   { background: #E3F2FD; color: #1565C0; }
.chip-gray   { background: var(--gray-200); color: var(--gray-600); }
.chip-audit  { background: #E0F2F1; color: #00695C; border: 1px solid #4DB6AC; }
.chip-orange { background: #FFF3E0; color: #E65100; }
.chip-escalated { background: #fef3c7; color: #92400e; border: 1px solid #f59e0b; }
.chip-inbound  { background: #dbeafe; color: #1d4ed8; }
.chip-outbound { background: #ede9fe; color: #6d28d9; }
.chip-vendor   { background: #fef3c7; color: #92400e; }
.chip-pt       { background: #ccfbf1; color: #0f766e; }
.chip-airspace  { background: #e0e7ff; color: #3730a3; }
.chip-commander { background: #dcfce7; color: #166534; }
.chip-supp-pending  { background: #fef3c7; color: #92400e; }
.chip-supp-approved { background: #dbeafe; color: #1e40af; }
.chip-supp-paid     { background: #d1fae5; color: #065f46; }

/* Internal-note flag toggles (Add Note composer + Flagged Notes filters).
   Pill buttons that read as inactive chips until toggled .active. */
.note-flag-toggle {
  background: white; border: 1px solid var(--gray-300); color: var(--gray-600);
  border-radius: 16px; padding: 3px 10px; font-size: .75rem; cursor: pointer;
  font-family: inherit;
}
.note-flag-toggle:hover { border-color: var(--gray-400); }
.note-flag-toggle.active {
  background: #E3F2FD; border-color: #1565C0; color: #1565C0; font-weight: 500;
}

/* @mention picker — dropdown anchored under the Add Note textarea. */
.mention-picker {
  position: absolute; left: 0; top: 100%; z-index: 30;
  min-width: 260px; max-height: 220px; overflow-y: auto;
  background: white; border: 1px solid var(--gray-300); border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
}
.mention-option {
  padding: 7px 12px; font-size: .85rem; cursor: pointer;
}
.mention-option:hover { background: var(--gray-100); }

/* ─── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: 8px; font-size: .875rem;
  font-weight: 500; font-family: 'Ubuntu', sans-serif;
  cursor: pointer; border: none; transition: background .15s; text-transform: none;
}
.btn-primary { background: var(--green-600); color: white; }
.btn-primary:hover { background: var(--green-700); }
.btn-outline { background: transparent; color: var(--green-600); border: 1px solid var(--green-600); }
.btn-outline:hover { background: var(--green-100); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #B71C1C; }
.btn-ghost { background: transparent; color: var(--gray-600); border: 1px solid var(--gray-300); }
.btn-ghost:hover { background: var(--gray-100); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ─── Tables ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead tr { background: var(--gray-100); }
th { padding: 10px 14px; text-align: left; font-size: .75rem; font-weight: 500; color: var(--gray-600); text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--gray-200); }
td { padding: 12px 14px; border-bottom: 1px solid var(--gray-200); color: var(--gray-800); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-100); }
.mono { font-family: 'Roboto Mono', monospace; font-size: .8rem; }

/* ─── Progress stepper ────────────────────────────────────────── */
.stepper { display: flex; align-items: center; gap: 0; margin-bottom: 28px; }
.step { display: flex; align-items: center; flex: 1; }
.step-dot {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 500; flex-shrink: 0; z-index: 1;
}
.step-dot.done   { background: var(--green-600); color: white; }
.step-dot.active { background: var(--blue); color: white; }
.step-dot.waiting{ background: var(--gray-200); color: var(--gray-600); }
.step-line { flex: 1; height: 2px; background: var(--gray-250); margin: 0 -1px; }
.step-line.done { background: var(--green-600); }
.step-info { margin-left: 10px; }
.step-name { font-size: .8rem; font-weight: 500; color: var(--gray-800); }
.step-sub  { font-size: .7rem; color: var(--gray-600); }
.stepper-wrap { overflow-x: auto; padding-bottom: 4px; }

/* ─── Tabs ────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--gray-200); margin-bottom: 20px; }
.tab {
  padding: 10px 20px; font-size: .875rem; font-weight: 500; cursor: pointer;
  color: var(--gray-600); border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color .15s;
}
.tab:hover { color: var(--gray-800); }
.tab.active { color: var(--green-600); border-bottom-color: var(--green-600); }

/* ─── Summary stats ───────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--gray-0); border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.stat-value { font-size: 2rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: .8rem; color: var(--gray-600); margin-top: 4px; }
.stat-green { color: var(--green-600); }
.stat-red   { color: var(--red); }
.stat-yellow{ color: var(--yellow); }
.stat-blue  { color: var(--blue); }

/* ─── Analysis panel ─────────────────────────────────────────── */
.analysis-panel { border: 1px solid var(--gray-250); border-radius: 8px; overflow: hidden; margin-top: 16px; }
.analysis-header {
  padding: 12px 16px; font-size: .875rem; font-weight: 500;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; user-select: none;
}
.analysis-header.dispute { background: var(--red-light); color: var(--red); }
.analysis-header.approve { background: var(--green-100); color: var(--green-700); }
.analysis-header.escalate{ background: var(--yellow-light); color: #92400E; }
.analysis-body { padding: 16px; border-top: 1px solid var(--gray-200); font-size: .875rem; display: none; }
.analysis-body.open { display: block; }
.analysis-section { margin-bottom: 14px; }
.analysis-section-title { font-size: .75rem; font-weight: 500; color: var(--gray-600); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.analysis-text { color: var(--gray-700); line-height: 1.65; font-size: .875rem; }
.analysis-text.formatted-paragraphs p { margin: 0 0 10px; }
.analysis-text.formatted-paragraphs p:last-child { margin-bottom: 0; }
.analysis-text.escalation-box {
  color: #92400E; background: var(--yellow-light);
  padding: 12px 14px; border-radius: 6px; border-left: 3px solid var(--yellow);
}
.analysis-text.escalation-box p { margin: 0 0 8px; }
.analysis-text.escalation-box p:last-child { margin-bottom: 0; }
.analysis-text.escalation-box ol { color: #92400E; }
.flag-list { display: flex; flex-direction: column; gap: 6px; }
.flag-item { display: flex; gap: 8px; align-items: flex-start; }
.flag-icon { color: var(--red); font-size: 14px; margin-top: 2px; flex-shrink: 0; }

/* ─── Approve actions ────────────────────────────────────────── */
.approve-row {
  display: flex; align-items: center; gap: 10px; margin-top: 12px;
  padding: 12px 16px; background: var(--gray-100); border-radius: 8px;
}
.approve-label { font-size: .8rem; color: var(--gray-600); flex: 1; }

/* ─── Invoice header info ────────────────────────────────────── */
.invoice-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.meta-item { }
.meta-key { font-size: .75rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }
.meta-val { font-size: .9rem; font-weight: 500; color: var(--gray-800); }

/* ─── Dispute email preview ─────────────────────────────────── */
.email-preview {
  background: #FAFAFA; border: 1px solid var(--gray-250); border-radius: 6px;
  padding: 14px 16px; font-size: .8rem; color: var(--gray-700);
  font-family: 'Roboto Mono', monospace; line-height: 1.7; white-space: pre-wrap;
}

/* ─── Feedback FAB ────────────────────────────────────────────── */
.feedback-fab {
  position: fixed; bottom: 28px; right: 28px;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--green-600); color: white; border: none;
  font-size: 1.25rem; cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
  z-index: 400;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .15s, box-shadow .15s;
}
.feedback-fab:hover {
  background: var(--green-700);
  transform: scale(1.08);
  box-shadow: 0 6px 16px rgba(0,0,0,.3);
}
/* Audit log sender_type filter chips */
.audit-filter-chip.active {
  background: var(--gray-200);
  color: var(--gray-900);
  font-weight: 600;
}
.fb-screenshot-zone {
  border: 2px dashed var(--gray-300); border-radius: 6px;
  padding: 12px; cursor: pointer; text-align: center;
  transition: border-color .15s, background .15s;
  min-height: 48px; display: flex; align-items: center; justify-content: center;
}
.fb-screenshot-zone:hover { border-color: var(--green-500); background: rgba(97,178,18,.04); }
.fb-screenshot-zone.has-image { border-style: solid; border-color: var(--gray-200); cursor: default; }
#fb-screenshot-placeholder { display: flex; align-items: center; gap: 8px; }

/* ─── Toasts (design turn 9g: consistent anatomy) ─────────────────
   White card, colored left edge (green success / red error / gray
   neutral), leading glyph, optional action (Undo / Open case), ✕
   dismiss. Stacked bottom-right; errors stay until dismissed. */
#toast-stack {
  position: fixed; bottom: 88px; right: 28px; z-index: 999;
  display: flex; flex-direction: column; gap: 12px; align-items: flex-end;
}
.toast-card {
  background: white; border: 1px solid var(--gray-200);
  border-left: 3px solid var(--gray-500); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  padding: 12px 14px; display: flex; gap: 10px; align-items: center;
  font-size: .85rem; color: var(--gray-800); max-width: 420px; min-width: 260px;
  opacity: 0; transform: translateY(10px); transition: opacity .3s, transform .3s;
}
.toast-card.show { opacity: 1; transform: translateY(0); }
.toast-card.success { border-left-color: var(--green-600); }
.toast-card.error   { border-left-color: var(--red-500); }
.toast-card .toast-glyph { font-weight: 700; flex-shrink: 0; }
.toast-card.success .toast-glyph { color: var(--green-600); }
.toast-card.error   .toast-glyph { color: var(--red-600); }
.toast-card .toast-msg { flex: 1; min-width: 0; }
.toast-card .toast-msg a { color: var(--green-600); font-weight: 500; }
.toast-card .toast-action {
  margin-left: auto; padding: 3px 12px; border-radius: 6px; font-size: .78rem;
  font-weight: 500; font-family: 'Ubuntu', sans-serif; background: transparent;
  color: var(--green-600); border: 1px solid var(--green-600); cursor: pointer;
  white-space: nowrap; flex-shrink: 0;
}
.toast-card .toast-action:hover { background: var(--green-100); }
.toast-card .toast-x {
  color: var(--gray-500); cursor: pointer; flex-shrink: 0; padding: 0 2px;
  background: none; border: none; font-size: .9rem; font-family: inherit;
}
.toast-card .toast-x:hover { color: var(--gray-800); }

/* ─── Modal ───────────────────────────────────────────────────── */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 500; display: none; align-items: center; justify-content: center; }
.overlay.open { display: flex; }
.modal { background: white; border-radius: 12px; width: 560px; max-width: 95vw; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--gray-200); font-size: 1.125rem; font-weight: 500; display: flex; align-items: center; justify-content: space-between; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: 10px; }
.close-btn { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--gray-500); padding: 4px; }

/* ─── View selector (top right) ──────────────────────────────── */
.view-pill {
  display: flex; background: var(--gray-200); border-radius: 8px; padding: 3px; gap: 2px;
}
.view-pill-item {
  padding: 6px 14px; border-radius: 6px; font-size: .8rem; font-weight: 500;
  cursor: pointer; color: var(--gray-600); transition: all .15s;
}
.view-pill-item.active { background: white; color: var(--gray-800); box-shadow: 0 1px 3px rgba(0,0,0,.1); }

/* ─── Upload drop zone ───────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--gray-300); border-radius: 10px;
  padding: 40px 24px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--green-600); background: var(--green-100);
}
.drop-zone-icon { font-size: 2.5rem; margin-bottom: 10px; }
.drop-zone-text { font-size: .875rem; color: var(--gray-600); }
.drop-zone-sub  { font-size: .75rem; color: var(--gray-500); margin-top: 4px; }

/* ─── Pipeline progress ──────────────────────────────────────── */
.pipeline-step {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border-radius: 8px; margin-bottom: 8px; background: var(--gray-100);
  font-size: .875rem;
}
.pipeline-step.active { background: #E3F2FD; }
.pipeline-step.done   { background: var(--green-100); }
.pipeline-step.error  { background: var(--red-light); }
.pipeline-step-icon { font-size: 1.2rem; width: 28px; text-align: center; flex-shrink: 0; }
.pipeline-step-text { flex: 1; }
.pipeline-step-label { font-weight: 500; }
.pipeline-step-detail { font-size: .75rem; color: var(--gray-600); margin-top: 2px; }

/* ─── Responsive helpers ──────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: .875rem; }
.text-xs { font-size: .75rem; }
.text-muted { color: var(--gray-600); }
.font-medium { font-weight: 500; }
.w-full { width: 100%; }

/* ─── Autopay-specific ────────────────────────────────────────── */
.chip-ap-sent { background: #F3E8FF; color: #7C3AED; }
.chip-stamped { background: #dbeafe; color: #1e40af; border: 1px solid #3b82f6; }

.card-body.ap-collapsed { display: none; }

.btn-disabled-phase {
  position: relative;
}
.btn-disabled-phase:hover::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-800);
  color: white;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: .75rem;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
}

@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.4; } }
@keyframes spin { to { transform: rotate(360deg); } }
.spin { display:inline-block; animation: spin .8s linear infinite; }

.progress-bar-wrap { height:4px; background:var(--gray-200); border-radius:2px; overflow:hidden; margin-top:12px; }
.progress-bar-indeterminate { height:100%; width:40%; background:var(--blue); border-radius:2px; animation: indeterminate 1.4s ease-in-out infinite; }
@keyframes indeterminate { 0% { transform:translateX(-100%); } 100% { transform:translateX(350%); } }

/* ─── Autopay Review ─────────────────────────────────────────── */
.review-bulk-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; margin-bottom: 16px;
  background: var(--gray-0); border: 1px solid var(--gray-250);
  border-radius: 8px;
}

.review-table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .5px; color: var(--gray-600); }
.review-table td { vertical-align: top; padding: 10px 8px; }
.review-table tbody tr { border-bottom: 1px solid var(--gray-200); }
.review-table tbody tr:nth-child(even) { background: var(--gray-100); }

.review-row-approved { background: #E8F5E9 !important; }
.review-row-disputed { background: #FFF3E0 !important; }
.review-row-readonly { opacity: .6; }

.review-vendor-card .card-header { background: var(--gray-100); }

.review-adj-input {
  width: 100px; padding: 4px 8px;
  border: 1px solid var(--gray-300); border-radius: 4px;
  font-size: .85rem; font-family: 'Roboto Mono', monospace;
  text-align: right;
}
.review-adj-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 2px rgba(25,118,210,.15); }

.review-action-btns { display: flex; gap: 4px; }
.btn-sm { padding: 4px 10px; font-size: .75rem; border-radius: 4px; cursor: pointer; border: 1px solid var(--gray-300); background: var(--gray-0); }
.review-btn-approve { color: var(--green-600); border-color: var(--green-500); }
.review-btn-approve.active { background: var(--green-500); color: white; border-color: var(--green-600); }
.review-btn-dispute { color: var(--orange); border-color: var(--orange); }
.review-btn-dispute.active { background: var(--orange); color: white; }

.review-dispute-reason { margin-top: 6px; }
.review-reason-input {
  width: 100%; padding: 4px 8px;
  border: 1px solid var(--orange); border-radius: 4px;
  font-size: .8rem;
}
.review-reason-input:focus { outline: none; box-shadow: 0 0 0 2px rgba(255,152,0,.2); }

/* AI recommendation badges */
.ai-badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: .7rem; font-weight: 600; cursor: default;
}
.ai-badge-accept { background: var(--green-100); color: var(--green-700); }
.ai-badge-reject { background: var(--red-light); color: var(--red); }
.ai-badge-counter { background: var(--yellow-light); color: #92400E; }
.ai-badge-na { background: var(--gray-200); color: var(--gray-600); }

/* ─── Disputes ──────────────────────────────────────────────── */
.dispute-msg-thread { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.dispute-message {
  border: 1px solid var(--gray-200); border-radius: 8px; padding: 12px 14px;
  background: var(--gray-0);
}
.dispute-msg-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.dispute-msg-body {
  font-size: .875rem; color: var(--gray-700); line-height: 1.6; white-space: pre-wrap;
}
.dispute-msg-form {
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--gray-200);
}

/* ── Qualification Card ──────────────────────────────────────────────── */
.qualification-card {
  margin-top: 16px; border-radius: 8px; background: var(--gray-0);
  box-shadow: 0 1px 4px rgba(0,0,0,.08); overflow: hidden;
}
.qualification-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--gray-200);
}
.qualification-card-title {
  font-size: .9375rem; font-weight: 600; color: var(--gray-800);
}
.qualification-overall {
  display: inline-block; padding: 3px 12px; border-radius: 12px;
  font-size: .8rem; font-weight: 600; letter-spacing: .02em;
}
.qualification-overall.pass { background: var(--green-100); color: var(--green-700); }
.qualification-overall.fail { background: var(--red-light); color: var(--red); }
.criterion-row {
  display: grid; grid-template-columns: 28px 1fr 1fr 1fr;
  gap: 8px; align-items: center; padding: 10px 20px;
  font-size: .8125rem; border-bottom: 1px solid var(--gray-100);
}
.criterion-row:last-child { border-bottom: none; }
.criterion-icon { font-size: 1rem; text-align: center; }
.criterion-pass { color: var(--green-600); }
.criterion-fail { color: var(--red); }
.criterion-name { font-weight: 500; color: var(--gray-800); }
.criterion-value { color: var(--gray-600); }
.criterion-detail { color: var(--gray-500); font-size: .75rem; }
.qualification-close {
  background: none; border: none; cursor: pointer; font-size: 1rem;
  color: var(--gray-500); padding: 2px 6px;
}
.qualification-close:hover { color: var(--gray-800); }

/* ── SLA Monitoring ─────────────────────────────────────────────── */
.sla-metrics-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px;
}
.sla-card {
  background: var(--gray-0); border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08); overflow: hidden;
}
.sla-card-header {
  padding: 12px 16px; font-size: .8125rem; font-weight: 600;
  color: var(--gray-600); border-bottom: 1px solid var(--gray-100);
  text-transform: uppercase; letter-spacing: .04em;
}
.sla-card-body {
  display: flex; gap: 0; padding: 16px;
}
.sla-stat {
  flex: 1; text-align: center;
  border-right: 1px solid var(--gray-100);
}
.sla-stat:last-child { border-right: none; }
.sla-stat-value {
  display: block; font-size: 1.5rem; font-weight: 700; color: var(--gray-800);
  font-family: 'Roboto Mono', monospace; line-height: 1.2;
}
.sla-stat-label {
  display: block; font-size: .6875rem; color: var(--gray-500); margin-top: 2px;
  text-transform: uppercase; letter-spacing: .03em;
}
.sla-card-count {
  padding: 6px 16px 10px; font-size: .75rem; color: var(--gray-400); text-align: center;
}

/* Aging bar */
.sla-aging-bar {
  display: flex; height: 24px; border-radius: 6px; overflow: hidden;
  background: var(--gray-100);
}
.sla-aging-segment {
  transition: width .3s ease;
}
.sla-aging-segment:first-child { border-radius: 6px 0 0 6px; }
.sla-aging-segment:last-child { border-radius: 0 6px 6px 0; }

/* Trend chart */
.sla-trend-chart { min-height: 180px; }
.sla-trend-bars {
  display: flex; align-items: flex-end; gap: 4px; height: 160px; position: relative;
  padding-bottom: 40px;
}
.sla-trend-col {
  flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0;
}
.sla-trend-bar-wrap {
  width: 100%; height: 120px; display: flex; align-items: flex-end; justify-content: center;
}
.sla-trend-bar {
  width: 70%; max-width: 40px; background: var(--blue); border-radius: 4px 4px 0 0;
  transition: height .3s ease; min-height: 2px;
}
.sla-trend-bar-breach { background: var(--red); }
.sla-trend-label {
  font-size: .625rem; color: var(--gray-500); margin-top: 4px; white-space: nowrap;
}
.sla-trend-value {
  font-size: .625rem; color: var(--gray-600); font-weight: 500;
  font-family: 'Roboto Mono', monospace;
}
.sla-trend-sla-line {
  position: absolute; left: 0; right: 0; height: 1px;
  border-top: 2px dashed var(--red); opacity: .5; pointer-events: none;
}
.sla-trend-sla-label {
  position: absolute; right: 4px; font-size: .625rem; color: var(--red);
  font-weight: 500; transform: translateY(-100%); pointer-events: none;
}

/* Breach rows */
.sla-breach-warn { background: rgba(230, 168, 23, .06); }
.sla-breach-critical { background: rgba(220, 38, 38, .06); }
.sla-breach-warn td:nth-child(3) { color: #e6a817; }
.sla-breach-critical td:nth-child(3) { color: var(--red); }

@media (max-width: 768px) {
  .sla-metrics-grid { grid-template-columns: 1fr; }
}

/* ─── Vendor Health Dashboard ────────────────────────────────── */
.vh-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.vh-table thead { background: var(--gray-50); border-bottom: 2px solid var(--gray-200); }
.vh-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: .75rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .03em;
  white-space: nowrap;
  user-select: none;
}
.vh-th-sortable { cursor: pointer; }
.vh-th-sortable:hover { color: var(--gray-700); }
.vh-sort-icon { font-size: .65rem; margin-left: 2px; color: var(--gray-400); }
.vh-th-sortable.asc .vh-sort-icon::after { content: ' \25B2'; }
.vh-th-sortable.desc .vh-sort-icon::after { content: ' \25BC'; }
.vh-table tbody tr {
  border-bottom: 1px solid var(--gray-150);
  transition: background .1s ease;
}
.vh-table tbody tr:hover { background: var(--gray-50); }
.vh-table tbody tr.alert { background: var(--yellow-light); }
.vh-table tbody tr.onboarding { background: #eff6ff; }
.vh-table td { padding: 12px 16px; vertical-align: middle; }

.vh-vendor-name { font-weight: 600; font-size: .875rem; color: var(--gray-800); }
.vh-vendor-slug { font-size: .7rem; color: var(--gray-500); font-family: 'Roboto Mono', monospace; }

.vh-badge {
  display: inline-block; font-size: .6rem; font-weight: 600; padding: 2px 6px;
  border-radius: 4px; text-transform: uppercase; letter-spacing: .03em;
  white-space: nowrap; vertical-align: middle; margin-left: 8px; flex-shrink: 0;
}
.vh-badge.onboarding { background: #dbeafe; color: #1d4ed8; }
.vh-badge.declining { background: #fef3c7; color: #92400e; }

.accuracy-rate { font-weight: 700; font-size: .9375rem; }
.accuracy-rate.high { color: #22c55e; }
.accuracy-rate.medium { color: #f59e0b; }
.accuracy-rate.low { color: #ef4444; }
.accuracy-rate.na { color: #94a3b8; font-weight: 500; }

.trend-indicator { font-size: .8rem; font-weight: 500; }
.trend-indicator.improving { color: #22c55e; }
.trend-indicator.declining { color: #ef4444; }
.trend-indicator.stable { color: #6b7280; }

/* Detail panel */
.vh-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.vh-section-title { font-size: .75rem; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.vh-stat-row { display: flex; gap: 24px; }
.vh-stat-value { font-size: 1.25rem; font-weight: 700; color: var(--gray-800); }
.vh-stat-label { font-size: .7rem; color: var(--gray-500); }

/* Confidence bar */
.vh-conf-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--gray-200); }
.vh-conf-seg.high { background: #22c55e; }
.vh-conf-seg.medium { background: #f59e0b; }
.vh-conf-seg.low { background: #ef4444; }

/* Sparkline */
.vh-sparkline { display: flex; align-items: flex-end; gap: 6px; min-height: 90px; }
.vh-sparkline-col { display: flex; flex-direction: column; align-items: center; flex: 1; min-width: 0; }
.vh-sparkline-bar { width: 100%; max-width: 32px; border-radius: 3px 3px 0 0; min-height: 2px; }
.vh-sparkline-val { font-size: .625rem; font-weight: 500; color: var(--gray-600); margin-bottom: 2px; font-family: 'Roboto Mono', monospace; }
.vh-sparkline-label { font-size: .575rem; color: var(--gray-500); margin-top: 3px; white-space: nowrap; }

@media (max-width: 768px) {
  .vh-detail-grid { grid-template-columns: 1fr; }
  .vh-table th:nth-child(4), .vh-table td:nth-child(4),
  .vh-table th:nth-child(5), .vh-table td:nth-child(5) { display: none; }
}

/* Pass-through Rate Metrics */
.passthrough-metrics { margin-top: 8px; }
.passthrough-rates { display: flex; gap: 16px; margin-bottom: 6px; }
.passthrough-rate-item { font-size: .75rem; color: var(--gray-500); }
.passthrough-rate-value { font-weight: 600; font-size: .85rem; }
.passthrough-rate-value.high { color: #f59e0b; }
.passthrough-rate-value.normal { color: #22c55e; }

.threshold-recommendation {
  background: #fffbeb;
  border: 1px solid #f59e0b;
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 6px;
  font-size: .75rem;
  line-height: 1.5;
  color: #92400e;
}
.threshold-recommendation .apply-btn {
  background: #f59e0b;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 2px 10px;
  cursor: pointer;
  margin-left: 6px;
  font-size: .7rem;
  font-weight: 500;
}
.threshold-recommendation .apply-btn:hover { background: #d97706; }

/* ── Finance Summary ──────────────────────────────────────────── */
.fin-filters {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.fin-filter-input {
  padding: 7px 10px; border: 1px solid var(--gray-300); border-radius: 6px;
  font-size: .8125rem; font-family: inherit; background: white; color: var(--gray-800);
}

.fin-metrics-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px;
}
.fin-metric-card {
  background: var(--gray-0); border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  padding: 16px; text-align: center;
}
.fin-metric-value {
  font-size: 1.5rem; font-weight: 700; line-height: 1.2;
}
.fin-metric-label {
  font-size: .8125rem; color: #6b7280; margin-top: 4px;
}
.fin-metric-sub {
  font-size: .75rem; color: var(--gray-400); margin-top: 2px;
}
.fin-metric-card.approved .fin-metric-value { color: #22c55e; }
.fin-metric-card.disputed .fin-metric-value { color: #ef4444; }
.fin-metric-card.pending .fin-metric-value { color: #f59e0b; }

.finance-table { width: 100%; border-collapse: collapse; }
.finance-table th,
.finance-table td {
  padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--gray-200);
  font-size: .8125rem; white-space: nowrap;
}
.finance-table th {
  font-size: .7rem; font-weight: 600; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: .03em;
}
.finance-table td.mono { font-family: 'Roboto Mono', monospace; font-size: .8rem; }
.finance-table tr:hover { background: var(--gray-100); }
.amount-approved { color: #22c55e; }
.amount-disputed { color: #ef4444; }
.amount-pending { color: #f59e0b; }

.btn-warning {
  color: #92400e;
  border-color: #f59e0b;
}
.btn-warning:hover {
  background: #fef3c7;
}
.override-warning {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 6px;
  padding: 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: #92400e;
}

.dispute-case-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.dispute-case-chip {
  font-size: .7rem; padding: 2px 8px; border-radius: 9999px;
  background: #fee2e2; color: #991b1b; cursor: pointer;
  white-space: nowrap;
}
.dispute-case-chip:hover { background: #fecaca; }

/* ─── Dispute Attachments ─────────────────────────────────────── */
.message-attachments {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.attachment-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  background: #f1f5f9;
  border-radius: 4px;
  font-size: 0.8rem;
  color: #1e40af;
  text-decoration: none;
}
.attachment-link:hover {
  background: #e2e8f0;
}

@media (max-width: 900px) {
  .fin-metrics-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .fin-metrics-grid { grid-template-columns: 1fr; }
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #cbd5e1;
  border-radius: 20px;
  transition: background 0.2s;
}
.toggle-slider:before {
  content: "";
  position: absolute;
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle-switch input:checked + .toggle-slider {
  background: #22c55e;
}
.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(16px);
}

/* ── Payment Action Buttons (Finance) ──────────────────────────── */
.payment-action-group {
  display: inline-flex; border: 1px solid var(--gray-300); border-radius: 4px; overflow: hidden;
}
.payment-action-btn {
  padding: 4px 8px;
  border: none; border-right: 1px solid var(--gray-300);
  background: white;
  cursor: pointer;
  font-size: .7rem; font-family: inherit;
  color: var(--gray-600);
  transition: all 0.15s;
  white-space: nowrap;
}
.payment-action-btn:last-child { border-right: none; }
.payment-action-btn:hover {
  background: var(--gray-100);
}
.payment-action-btn.active {
  font-weight: 600;
}
.payment-action-btn.short_pay.active {
  background: #fef3c7;
  color: #92400e;
}
.payment-action-btn.hold.active {
  background: #fee2e2;
  color: #991b1b;
}
.payment-action-btn.pay_in_full.active {
  background: #d1fae5;
  color: #065f46;
}

/* ── Vendor Pattern Alerts ────────────────────────────────────── */
.alert-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}
.alert-warning {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  color: #92400e;
}
.alert-critical {
  background: #fee2e2;
  border: 1px solid #ef4444;
  color: #991b1b;
}
.alert-info {
  background: #dbeafe;
  border: 1px solid #3b82f6;
  color: #1e40af;
}
.alert-content p {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
}
.alert-vendor {
  font-weight: 600;
  margin-right: 0.5rem;
}

/* ── Escalation SLA Chips ────────────────────────────────────── */
.chip-overdue {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #ef4444;
  animation: pulse-border 2s infinite;
}
.chip-deadline {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #3b82f6;
}
.chip-warning {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #f97316;
}
@keyframes pulse-border {
  0%, 100% { border-color: #ef4444; }
  50% { border-color: #fca5a5; }
}

/* ── Airline Upload ─────────────────────────────────────────── */
.carrier-select {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--gray-300, #ddd);
  border-radius: 4px;
  font-size: .85rem;
  background: white;
}

/* ── Airline Review (Story 07) ─────────────────────────────── */
.airline-review-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.airline-review-hint {
  font-size: .8rem;
  color: var(--gray-500);
  margin-bottom: 12px;
}

/* ── Airline Batch Detail (Story 08) ───────────────────────── */
.airline-batch-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.airline-filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.airline-filter-bar select,
.airline-filter-bar input {
  padding: 6px 10px;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  font-size: .85rem;
  background: white;
}
.airline-filter-bar input {
  min-width: 200px;
}

.airline-sortable {
  cursor: pointer;
  user-select: none;
}
.airline-sortable:hover {
  background: var(--gray-100);
}
.airline-sortable.sort-asc::after { content: ' \25B2'; font-size: .6rem; }
.airline-sortable.sort-desc::after { content: ' \25BC'; font-size: .6rem; }

.text-warning { color: #E65100; font-weight: 600; }

.airline-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}
.airline-pagination button {
  padding: 4px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  background: white;
  cursor: pointer;
  font-size: .8rem;
}
.airline-pagination button:disabled {
  opacity: .4;
  cursor: not-allowed;
}
.airline-pagination .page-info {
  font-size: .8rem;
  color: var(--gray-600);
}

/* ─── Merlin/PT UI toggle ─────────────────────────────────────── */
/* Toggle is hidden for now — only Merlin UI is exposed to users. The
   PT-mode code paths (pt-bundle, applyUiModeTo*) are left intact so
   the toggle can be turned back on by removing the rule below. */
.view-header { display: none !important; }
.view-header--keep {
  display: flex; align-items: center; justify-content: flex-end;
  margin-bottom: 16px;
}
.ui-toggle {
  display: inline-flex; align-items: center;
  background: var(--gray-200); border-radius: 999px;
  padding: 3px; gap: 2px;
}
.ui-toggle button {
  border: none; background: transparent;
  color: var(--gray-700);
  font: 500 .75rem/1 'Roboto', sans-serif;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 6px 16px; border-radius: 999px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.ui-toggle button:hover { color: var(--gray-900); }
.ui-toggle button[aria-pressed="true"] {
  background: var(--gray-0); color: var(--gray-900);
  box-shadow: 0 1px 2px rgba(0,0,0,.12);
}

/* Disputed line-items table: anchor every cell's content to the top so the
   variance delta stacking under the Vendor Proposed control (an extra line
   in that one cell) never re-centers and shifts the row's other controls —
   inputs stay aligned whether or not a delta renders. */
.li-table td { vertical-align: top; }
/* The detail page's two-column grid (design 6e) can squeeze the fixed-layout
   line-items table below its columns' natural widths — force a floor so the
   .table-wrap scrolls horizontally instead of columns overlapping. */
.li-table { min-width: 980px; }

/* ─── Create Dispute Case modal (two-path flow) ───────────────── */
/* One form, two mutually exclusive paths: Order ID on top, Party +
   Invoice Number below an "or" divider. Whichever path has input becomes
   .active (green border + pill); the other goes .muted (dimmed, inert). */
.cc-path { border: 1px solid var(--gray-250); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.cc-path.active { border: 1.5px solid var(--green-600); padding: 15.5px; }
.cc-path.muted { opacity: .45; pointer-events: none; }
.cc-path-title { display: flex; align-items: center; gap: 8px; font-size: .72rem; font-weight: 700; color: var(--gray-600); text-transform: uppercase; letter-spacing: .08em; }
.cc-path.active .cc-path-title { color: var(--green-700); }
.cc-pill { display: none; padding: 2px 8px; border-radius: 999px; font-size: .65rem; font-weight: 400; background: var(--green-100); border: 1px solid var(--green-300); color: var(--green-700); text-transform: none; letter-spacing: 0; }
.cc-path.active .cc-pill { display: inline-flex; }
.cc-divider { display: flex; align-items: center; gap: 12px; color: var(--gray-500); font-size: .75rem; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; }
.cc-divider::before, .cc-divider::after { content: ""; flex: 1; height: 1px; background: var(--gray-250); }
.cc-label { display: block; font-size: .72rem; font-weight: 500; color: var(--gray-600); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 5px; }
.cc-input { width: 100%; padding: 9px 12px; border: 1px solid var(--gray-300); border-radius: 6px; font-size: .875rem; font-family: 'Ubuntu', sans-serif; box-sizing: border-box; }
.cc-input.mono { font-family: 'Ubuntu Mono', monospace; }
.cc-input.invalid { border: 1.5px solid var(--red-500); padding: 8.5px 11.5px; }
.cc-label.invalid { color: var(--red-700); }
.cc-field-err { margin-top: 4px; font-size: .72rem; color: var(--red-600); }
.cc-btn-find { padding: 9px 18px; border-radius: 8px; font-size: .875rem; font-weight: 500; font-family: 'Ubuntu', sans-serif; background: transparent; color: var(--green-600); border: 1px solid var(--green-600); cursor: pointer; white-space: nowrap; }
.cc-btn-find:hover { background: var(--green-100); }
.cc-placeholder { border: 1.5px dashed var(--gray-300); border-radius: 8px; padding: 14px; text-align: center; color: var(--gray-500); font-size: .8rem; }
.cc-error { padding: 10px 12px; background: var(--red-light, #FFEBEE); border: 1px solid var(--red-300, #FF9B9B); border-radius: 6px; color: var(--red-700); font-size: .85rem; }

/* Billing-parties table */
.cc-parties { border: 1px solid var(--gray-250); border-radius: 8px; overflow: hidden; }
.cc-parties-head { display: grid; grid-template-columns: 34px 74px 1fr 76px 92px; gap: 8px; align-items: center; padding: 8px 12px; background: var(--gray-100); font-size: .7rem; font-weight: 500; color: var(--gray-500); text-transform: uppercase; letter-spacing: .05em; }
.cc-party-row { display: grid; grid-template-columns: 34px 74px 1fr 76px 92px; gap: 8px; align-items: center; padding: 10px 12px; border-top: 1px solid var(--gray-200); font-size: .85rem; cursor: pointer; }
.cc-party-row:hover { background: var(--gray-100); }
.cc-party-row.selected { background: var(--green-100); border-top: 1px solid var(--green-600); }
.cc-party-row.selected + .cc-party-row, .cc-party-row.selected + .cc-notlisted-row { border-top: 1px solid var(--green-600); }
.cc-party-row.selected .cc-party-name { font-weight: 500; }
.cc-party-charges { color: var(--gray-600); }
.cc-party-total { text-align: right; font-family: 'Ubuntu Mono', monospace; }
.cc-notlisted-row { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-top: 1px solid var(--gray-200); background: var(--gray-100); font-size: .85rem; cursor: pointer; }
.cc-notlisted-row .cc-nl-label { font-weight: 500; color: var(--gray-700); }
.cc-notlisted-row .cc-nl-hint { font-size: .75rem; color: var(--gray-500); }
.cc-notlisted-row.selected { background: var(--green-100); border-top: 1px solid var(--green-600); }
.cc-notlisted-row.selected .cc-nl-label { color: var(--green-700); }

/* Segment badge (PU / DL / FLIGHT / other) */
.cc-seg { display: inline-flex; padding: 2px 8px; border-radius: 4px; font-size: .68rem; font-weight: 500; }
.cc-seg.pu { background: var(--blue-100); color: var(--blue-700); border: 1px solid var(--blue-600); }
.cc-seg.dl { background: var(--green-100); color: var(--green-700); border: 1px solid var(--green-600); }
.cc-seg.flight { background: var(--purple-100); color: var(--purple-700); border: 1px solid var(--purple-500); }
.cc-seg.other { background: var(--gray-200); color: var(--gray-700); border: 1px solid var(--gray-500); }

.cc-derived { font-size: .75rem; color: var(--green-700); }
.cc-note { font-size: .75rem; color: var(--gray-500); }
.cc-footer-hint { margin-right: auto; font-size: .75rem; color: var(--gray-500); align-self: center; }

/* Partner search (vendor table) — used by "Partner not listed" and the
   no-Order-ID Party picker. Input on top; results attach beneath. */
.cc-psearch { position: relative; }
.cc-psearch-box { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--gray-300); border-radius: 6px; font-size: .875rem; background: white; }
.cc-psearch-box:focus-within { border: 1.5px solid var(--green-600); padding: 8.5px 11.5px; }
.cc-psearch-box.open { border-radius: 6px 6px 0 0; }
.cc-psearch-box .cc-psearch-icon { color: var(--gray-500); }
.cc-psearch-box input { flex: 1; border: none; outline: none; font-size: .875rem; font-family: 'Ubuntu', sans-serif; background: transparent; }
.cc-psearch-results { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; border: 1px solid var(--gray-250); border-top: none; border-radius: 0 0 6px 6px; box-shadow: 0 8px 24px rgba(0,0,0,.12); background: white; overflow: hidden; }
.cc-psearch-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; font-size: .85rem; }
.cc-psearch-row + .cc-psearch-row { border-top: 1px solid var(--gray-200); }
.cc-psearch-row:hover, .cc-psearch-row.hl { background: var(--green-100); }
.cc-psearch-row .cc-pid { font-family: 'Ubuntu Mono', monospace; font-size: .75rem; color: var(--gray-600); white-space: nowrap; }
.cc-psearch-foot { padding: 7px 12px; border-top: 1px solid var(--gray-200); font-size: .72rem; color: var(--gray-500); background: var(--gray-100); }
.cc-psearch-selected { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; border: 1px solid var(--gray-300); border-radius: 6px; font-size: .875rem; background: white; cursor: pointer; }
.cc-psearch-selected .cc-pid { font-family: 'Ubuntu Mono', monospace; font-size: .75rem; color: var(--gray-600); margin-left: 6px; }
.cc-psearch-selected .caret { color: var(--gray-500); }

/* ─── Case Manager redesign (design turns 6–9) ────────────────── */

/* Segmented pill tabs (case list buckets, Queued tab, Flagged Notes hub,
   Unseen/Seen toggles) — replaces the underline tab strip. */
.pill-tabs {
  display: inline-flex; gap: 2px; background: var(--gray-100);
  border-radius: 8px; padding: 3px; flex-wrap: wrap;
}
.ptab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px; border-radius: 6px; font-size: .82rem;
  color: var(--gray-600); cursor: pointer; border: none; background: none;
  font-family: 'Ubuntu', sans-serif; white-space: nowrap;
}
.ptab:hover { color: var(--gray-800); }
.ptab.active {
  font-weight: 500; background: white; color: var(--green-700);
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.ptab-badge {
  display: inline-flex; padding: 0 7px; border-radius: 999px;
  font-size: .7rem; background: var(--gray-200); color: var(--gray-600);
}
.ptab.active .ptab-badge { background: var(--green-100); color: var(--green-700); }
.ptab .ptab-badge.alert { background: var(--red-light); color: var(--red); }
.ptab.sm { padding: 4px 12px; font-size: .78rem; }

/* Case-list rows: actions appear on hover only (design 6b). */
.cm-row { cursor: pointer; }
.cm-row .row-actions { visibility: hidden; }
.cm-row:hover .row-actions { visibility: visible; }
.cm-row.escalated { box-shadow: inset 3px 0 0 var(--red-500); }
.cm-subline { font-size: .72rem; color: var(--gray-500); margin-top: 2px; }

/* Skeleton loading rows (design 6c) — shimmer blocks replace "Loading...". */
@keyframes skel-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skel {
  display: block; border-radius: 4px;
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.4s ease-in-out infinite;
}
.skel.pill { border-radius: 999px; }
.skel-toolbar {
  padding: 10px 14px; border-bottom: 1px solid var(--gray-200);
  display: flex; gap: 8px;
}
.skel-row {
  display: grid; grid-template-columns: 130px 70px 70px 1fr 90px 60px;
  gap: 12px; padding: 11px 14px; align-items: center;
}

/* Callouts (design turn 9 modals + detail banners). */
.callout {
  padding: 9px 12px; border-radius: 6px; font-size: .8rem;
  border: 1px solid transparent;
}
.callout-blue   { background: var(--blue-100); border-color: #7CC7F0; color: var(--blue-700); }
.callout-green  { background: var(--green-100); border-color: var(--green-300); color: var(--green-700); }
.callout-red    { background: var(--red-light); border-color: #F5A9A9; color: var(--red-700); }
.callout-yellow { background: #fef3c7; border-color: #f59e0b; color: var(--gray-700); }

/* Case detail (design 6e): sticky action header + main/rail grid. */
.case-sticky-header {
  position: sticky; top: calc(var(--appbar-h) + 8px); z-index: 40;
  background: white; border: 1px solid var(--gray-200); border-radius: 10px;
  padding: 12px 16px; display: flex; align-items: center; gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06); margin-bottom: 14px; flex-wrap: wrap;
}
.case-detail-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 340px;
  gap: 14px; align-items: start;
}
@media (max-width: 1100px) {
  .case-detail-grid { grid-template-columns: 1fr; }
}
.rail-kv { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: .83rem; }
.rail-kv .k { color: var(--gray-500); }
.edit-pencil { color: var(--gray-500); cursor: pointer; }
.edit-pencil:hover { color: var(--gray-800); }

/* Timeline rail (design 6e): dot-and-line milestones. */
.tl-item { display: flex; gap: 10px; }
.tl-rail { display: flex; flex-direction: column; align-items: center; }
.tl-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green-600); margin-top: 4px; flex-shrink: 0; }
.tl-dot.pending { background: var(--gray-300); }
.tl-line { width: 1.5px; flex: 1; background: var(--gray-250); }
.tl-body { padding-bottom: 12px; font-size: .8rem; }
.tl-body .tl-when { color: var(--gray-500); font-size: .72rem; }

/* Flagged Notes hub (design 8b): note-first rows. */
.note-row { display: flex; gap: 14px; padding: 14px 16px; }
.note-row + .note-row { border-top: 1px solid var(--gray-200); }
.note-row .note-main { flex: 1; min-width: 0; }
.note-row .note-text { font-size: .85rem; color: var(--gray-700); line-height: 1.5; white-space: pre-wrap; }
.note-row .note-meta {
  display: flex; gap: 10px; align-items: center; margin-top: 7px;
  font-size: .75rem; color: var(--gray-500); flex-wrap: wrap;
}
.note-row .note-meta a { font-family: 'Ubuntu Mono', monospace; color: var(--green-600); text-decoration: none; }
.note-row .note-meta a:hover { text-decoration: underline; }
.note-row .note-side { flex: none; display: flex; align-items: center; }
.chip-at-you { background: var(--green-100); color: var(--green-700); padding: 1px 7px; border-radius: 999px; font-size: .68rem; display: inline-flex; }

/* Dashboard (design 7b). */
.kpi-card {
  background: white; border: 1px solid var(--gray-200); border-radius: 10px;
  padding: 14px 16px; cursor: pointer;
}
.kpi-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.kpi-card .kpi-label {
  font-size: .72rem; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: .05em;
}
.kpi-card .kpi-value { font-size: 1.7rem; font-weight: 700; font-family: 'Roboto Mono', monospace; }
.kpi-card .kpi-sub { font-size: .72rem; color: var(--gray-500); }
.kpi-card.kpi-alert { border: 1.5px solid var(--red-500); }
.kpi-card.kpi-alert .kpi-label { color: var(--red-600); font-weight: 700; }
.overdue-chip {
  display: inline-flex; gap: 8px; align-items: center; background: white;
  border: 1px solid #F5A9A9; border-radius: 8px; padding: 6px 10px;
  font-size: .78rem; cursor: pointer;
}
.overdue-chip:hover { box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.aging-row {
  display: grid; grid-template-columns: 70px 1fr 30px; gap: 10px;
  align-items: center; cursor: pointer; font-size: .8rem;
}
.aging-bar { height: 14px; border-radius: 4px; }
