/* ─── ASAP Brand Palette ──────────────────────────────────────── */
:root {
  --green-500: #61B212;
  --green-600: #288F00;
  --green-700: #006808;
  --green-100: #E8F5E9;
  --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;
  --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; }

/* ─── 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-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-supp-pending  { background: #fef3c7; color: #92400e; }
.chip-supp-approved { background: #dbeafe; color: #1e40af; }
.chip-supp-paid     { background: #d1fae5; color: #065f46; }

/* ─── 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);
}
.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; }

/* ─── Toast ───────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 88px; right: 28px;
  background: var(--gray-800); color: white;
  padding: 12px 20px; border-radius: 8px; font-size: .875rem;
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
  opacity: 0; transform: translateY(10px); transition: all .3s;
  z-index: 999; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--red); }

/* ─── 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);
}
