/* ==========================================================================
   Vindica · Executive Western Minimalist Claims CRM Design System
   Pixel-Faithful Adaptation of Glovex v3.3 / v5.1 Design System
   Aesthetic: Attio · Linear · Stripe · Flexport Editorial Light Precision
   ========================================================================== */

:root {
  /* Surfaces — Warm Executive Alabaster + Deep Maritime Steel-Navy Rail */
  --bg-canvas: #F3F5F8;
  --bg-sidebar: #0A0F1C;
  --bg-sidebar-elevated: rgba(255, 255, 255, 0.05);
  --bg-surface: #FFFFFF;
  --bg-subtle: #F1F4F8;
  --bg-hover: #EEF2F6;
  --bg-active: #E6ECF3;

  /* Borders */
  --border-hairline: rgba(15, 23, 42, 0.07);
  --border-subtle: #E2E7EE;
  --border-strong: #C8D1DC;

  /* Ink */
  --ink-primary: #0B1120;
  --ink-secondary: #334155;
  --ink-tertiary: #475569;
  --ink-muted: #64748B;
  --ink-faint: #94A3B8;

  /* Brand & Accents */
  --brand-obsidian: #0B1120;
  --brand-obsidian-hover: #172033;
  --accent-sapphire: #1D4ED8;
  --accent-sapphire-bright: #3B82F6;
  --accent-sapphire-soft: #EFF6FF;
  --accent-sapphire-border: #BFDBFE;

  /* Semantic */
  --emerald-fg: #047857;
  --emerald-bg: #ECFDF5;
  --emerald-border: #A7F3D0;

  --amber-fg: #B45309;
  --amber-bg: #FFFBEB;
  --amber-border: #FDE68A;

  --rose-fg: #BE123C;
  --rose-bg: #FFF1F2;
  --rose-border: #FECDD3;

  --violet-fg: #5B21B6;
  --violet-bg: #F5F3FF;
  --violet-border: #DDD6FE;

  /* Elevation — Soft Architectural Depth */
  --shadow-xs: 0 1px 2px rgba(11, 17, 32, 0.04), 0 0 0 1px rgba(11, 17, 32, 0.02);
  --shadow-sm: 0 3px 10px -2px rgba(11, 17, 32, 0.06), 0 1px 3px rgba(11, 17, 32, 0.04);
  --shadow-md: 0 12px 32px -8px rgba(11, 17, 32, 0.12), 0 2px 8px rgba(11, 17, 32, 0.05);
  --shadow-lg: 0 24px 60px -12px rgba(11, 17, 32, 0.24), 0 6px 16px rgba(11, 17, 32, 0.08);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 9px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-pill: 9999px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-mono: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-brand: 'Century Gothic', 'CenturyGothic', 'Questrial', 'Futura', sans-serif;

  /* Layout */
  --sidebar-w: 256px;
  --topbar-h: 64px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  height: 100%;
  background: var(--bg-canvas);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

body.portal-body {
  overflow-y: auto;
  min-height: 100vh;
}

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

a {
  color: var(--accent-sapphire);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "zero" 0, "tnum" 1;
}

.tabular { font-variant-numeric: tabular-nums; }

svg.gx-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

/* Scrollbars */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: rgba(15, 23, 42, 0.03); border-radius: 99px; }
::-webkit-scrollbar-thumb { background: rgba(100, 116, 139, 0.28); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(37, 99, 235, 0.45); }

/* ==========================================================================
   App Shell Layout & Executive Steel-Navy Maritime Gradient Sidebar
   ========================================================================== */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

.sidebar {
  background:
    radial-gradient(340px 280px at 85% 4%, rgba(96, 165, 250, 0.2), transparent 72%),
    radial-gradient(300px 260px at 15% 96%, rgba(56, 189, 248, 0.14), transparent 72%),
    linear-gradient(168deg, #1C2B46 0%, #25385A 54%, #2F4670 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.14);
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 20px 14px 16px;
  user-select: none;
  color: #FFFFFF;
}

.brand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 6px 16px;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-logo {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-family: var(--font-brand);
  font-size: 19px;
  font-weight: 500;
  -webkit-text-stroke: 0.3px rgba(255, 255, 255, 0.72);
  letter-spacing: -0.015em;
  color: #FFFFFF;
}

.brand-sub {
  font-size: 10px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.72);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cmd-trigger {
  width: 100%;
  height: 35px;
  padding: 0 11px;
  margin-bottom: 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.78);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.16s ease;
}
.cmd-trigger:hover {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.11);
  color: #FFFFFF;
}
.cmd-trigger-left { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }

.kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-faint);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 1px 5px;
  line-height: 1.4;
}
.sidebar .kbd {
  color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 39px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: rgba(255, 255, 255, 0.92);
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  position: relative;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.11); color: #FFFFFF; }
.nav-item.active {
  background: rgba(255, 255, 255, 0.16);
  color: #FFFFFF;
  font-weight: 650;
  border-color: rgba(255, 255, 255, 0.24);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #93C5FD;
  box-shadow: 0 0 10px rgba(147, 197, 253, 0.9);
}
.nav-item-left { display: flex; align-items: center; gap: 10px; }
.nav-item svg { width: 16px; height: 16px; color: #FFFFFF; }
.nav-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.18);
  color: #FFFFFF;
}
.nav-badge.alert { background: #E11D48; color: #FFFFFF; }
.nav-item.active .nav-badge:not(.alert) { background: #2563EB; color: #FFFFFF; }

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.engine-status-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-lg);
  padding: 11px 12px;
  cursor: pointer;
  transition: all 0.16s ease;
}
.engine-status-card:hover { border-color: rgba(255, 255, 255, 0.28); background: rgba(255, 255, 255, 0.13); }
.engine-status-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.engine-status-title { font-size: 11.5px; font-weight: 600; color: #FFFFFF; }
.engine-config-link { font-size: 11px; color: #BAE6FD; font-weight: 600; }
.status-row { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: rgba(255, 255, 255, 0.92); padding: 2.5px 0; }
.status-dot-wrap { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }

.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot.live { background: #10B981; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18); }
.dot.sim { background: #F59E0B; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18); }
.dot.danger { background: #F43F5E; box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.22); }
.dot.running { background: #2563EB; animation: pulseDot 1.4s infinite; }

@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.45); }
  70% { box-shadow: 0 0 0 6px rgba(37, 99, 235, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

.sidebar-user-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.sidebar-user-info { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.sidebar-user-name { font-size: 12.5px; font-weight: 600; color: #FFFFFF; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-role { font-size: 10.5px; color: rgba(255, 255, 255, 0.76); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-logout-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease;
}
.sidebar-logout-btn:hover { background: rgba(244, 63, 94, 0.35); border-color: rgba(251, 113, 133, 0.5); }

/* ==========================================================================
   Main Column & Frosted Glass Topbar
   ========================================================================== */
.main-col {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-width: 0;
  overflow: hidden;
}

.topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.page-title { font-size: 18px; font-weight: 700; letter-spacing: -0.028em; color: var(--ink-primary); white-space: nowrap; }
.page-divider { width: 1px; height: 18px; background: var(--border-subtle); }
.page-subtitle { font-size: 12.5px; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.workspace-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-canvas);
  font-size: 12px;
  font-weight: 550;
  color: var(--ink-secondary);
}

.main-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 22px 28px 48px;
}

.container-max {
  max-width: 1460px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ==========================================================================
   Executive Button System (Exact Glovex Tokens)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 550;
  letter-spacing: -0.01em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.16s var(--ease-out);
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn:active:not(:disabled) { transform: scale(0.985); }
.btn:disabled { opacity: 0.48; cursor: not-allowed; }

.btn-primary {
  background: var(--brand-obsidian);
  color: #FFFFFF;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 1px 2px rgba(15, 23, 42, 0.2);
}
.btn-primary:hover:not(:disabled) {
  background: var(--brand-obsidian-hover);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 4px 12px rgba(15, 23, 42, 0.22);
}

.btn-ai {
  background: #EAF2FF;
  color: #1E40AF;
  border-color: #C7DCFF;
  box-shadow: 0 1px 2px rgba(30, 64, 175, 0.06);
}
.btn-ai:hover:not(:disabled) { background: #DCEAFF; border-color: #93C5FD; color: #1D4ED8; }

.btn-secondary {
  background: var(--bg-surface);
  color: var(--ink-primary);
  border-color: var(--border-subtle);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-canvas); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }

.btn-ghost { background: transparent; color: var(--ink-tertiary); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--ink-primary); }

.btn-emerald-soft { background: var(--emerald-bg); color: var(--emerald-fg); border-color: var(--emerald-border); }
.btn-emerald-soft:hover:not(:disabled) { background: #D1FAE5; }

.btn-amber-soft { background: var(--amber-bg); color: var(--amber-fg); border-color: var(--amber-border); }
.btn-amber-soft:hover:not(:disabled) { background: #FEF3C7; }

.btn-danger-soft { background: var(--rose-bg); color: var(--rose-fg); border-color: var(--rose-border); }
.btn-danger-soft:hover:not(:disabled) { background: #FFE4E6; }

.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 7px; gap: 5px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 6px; gap: 4px; }
.btn-xs svg { width: 13px; height: 13px; }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: 7px; }

/* ==========================================================================
   Cards, Segmented Controls, Hero Glacier Banner & KPI Grid
   ========================================================================== */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px 22px; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-hairline);
}
.card-title {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.015em;
  color: var(--ink-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-subtitle { font-size: 12px; color: var(--ink-muted); margin-top: 2px; }
.micro-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-muted); }

.segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--bg-subtle);
  border-radius: 9px;
  border: 1px solid rgba(15, 23, 42, 0.05);
}
.seg-btn {
  height: 30px;
  padding: 0 13px;
  border: none;
  border-radius: 6.5px;
  background: transparent;
  color: var(--ink-muted);
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.seg-btn:hover { color: var(--ink-primary); }
.seg-btn.active { background: var(--bg-surface); color: var(--ink-primary); font-weight: 600; box-shadow: var(--shadow-xs); }
.seg-count { font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); }
.seg-btn.active .seg-count { color: var(--ink-secondary); }

/* Luminous Glacier-Blue Executive Hero Card */
.hero-dispatcher {
  background:
    radial-gradient(620px 260px at 92% -10%, rgba(59, 130, 246, 0.14), transparent 66%),
    radial-gradient(480px 220px at 8% 110%, rgba(14, 165, 233, 0.1), transparent 66%),
    linear-gradient(135deg, #EEF4FC 0%, #E5EFFC 56%, #DCE9FB 100%);
  border: 1px solid #C9DCF6;
  border-radius: var(--radius-xl);
  padding: 22px 26px;
  box-shadow: 0 10px 28px -14px rgba(30, 64, 175, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.85);
  position: relative;
  overflow: hidden;
}
.hero-dispatcher::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(37, 99, 235, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.045) 1px, transparent 1px);
  background-size: 36px 36px;
  pointer-events: none;
}
.hero-dispatcher > * { position: relative; z-index: 1; }
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.hero-eyebrow { font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; letter-spacing: 0.14em; color: #1D4ED8; margin-bottom: 5px; }
.hero-heading { font-size: 20px; font-weight: 700; letter-spacing: -0.03em; color: #0B1120; }
.hero-desc { font-size: 13px; color: #334155; margin-top: 4px; max-width: 780px; }

.hero-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid #CBD5E1;
  color: #334155;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.hero-status-pill.is-live { background: #ECFDF5; border-color: #A7F3D0; color: #047857; }

/* 4-Step Workflow Strip */
.coach-step-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.coach-step-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: border-color 0.16s ease, transform 0.16s var(--ease-out);
}
.coach-step-card:hover { border-color: var(--accent-sapphire-border); transform: translateY(-1px); }
.coach-step-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.coach-step-num { font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; color: var(--accent-sapphire); }
.coach-step-title { font-size: 13.5px; font-weight: 650; color: var(--ink-primary); }
.coach-step-desc { font-size: 12px; color: var(--ink-muted); line-height: 1.48; }

/* 4-Column Executive KPI Grid */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 9px;
  transition: border-color 0.16s ease, transform 0.16s var(--ease-out), box-shadow 0.16s ease;
}
.kpi-card:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-label { font-size: 12.5px; font-weight: 550; color: var(--ink-muted); }
.kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  display: grid;
  place-items: center;
  color: var(--ink-primary);
}
.kpi-value { font-family: var(--font-mono); font-size: 28px; font-weight: 700; letter-spacing: -0.035em; color: var(--ink-primary); line-height: 1.08; }
.kpi-foot { font-size: 12px; color: var(--ink-muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ==========================================================================
   Badges, Tags, Progress & 8-Node Pipeline Visualizer
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-emerald { background: var(--emerald-bg); color: var(--emerald-fg); border-color: var(--emerald-border); }
.badge-sapphire { background: var(--accent-sapphire-soft); color: var(--accent-sapphire); border-color: var(--accent-sapphire-border); }
.badge-amber { background: var(--amber-bg); color: var(--amber-fg); border-color: var(--amber-border); }
.badge-rose { background: var(--rose-bg); color: var(--rose-fg); border-color: var(--rose-border); }
.badge-violet { background: var(--violet-bg); color: var(--violet-fg); border-color: var(--violet-border); }
.badge-neutral { background: var(--bg-subtle); color: var(--ink-secondary); border-color: var(--border-subtle); }

.port-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 5px;
  background: #F1F5F9;
  color: var(--ink-primary);
  border: 1px solid #E2E8F0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.progress-track { width: 100%; height: 6px; border-radius: 99px; background: var(--bg-subtle); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; background: var(--brand-obsidian); transition: width 0.35s var(--ease-out); }
.progress-fill.emerald { background: #10B981; }
.progress-fill.sapphire { background: #2563EB; }
.progress-fill.amber { background: #F59E0B; }
.progress-fill.rose { background: #E11D48; }

.pipeline-track {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}
.pipe-node {
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.2s var(--ease-out);
}
.pipe-node.running { background: var(--bg-surface); border-color: var(--accent-sapphire); box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1); }
.pipe-node.done { background: var(--bg-surface); border-color: var(--emerald-border); }
.pipe-node-top { display: flex; align-items: center; justify-content: space-between; }
.pipe-step { font-family: var(--font-mono); font-size: 10px; font-weight: 700; color: var(--ink-faint); }
.pipe-node.running .pipe-step { color: var(--accent-sapphire); }
.pipe-node.done .pipe-step { color: var(--emerald-fg); }
.pipe-title { font-size: 12.5px; font-weight: 650; color: var(--ink-primary); }
.pipe-desc { font-size: 11px; color: var(--ink-muted); }

/* ==========================================================================
   Tables, Inputs, Filters & Bounded Scroll Panes
   ========================================================================== */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border-hairline);
}
.toolbar-group { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }

.input, .select, .textarea {
  height: 34px;
  padding: 0 11px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--ink-primary);
  font-size: 13px;
  outline: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--ink-primary);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.06);
}
.textarea { width: 100%; height: auto; padding: 10px 12px; resize: vertical; line-height: 1.55; }

.search-wrap { position: relative; display: inline-flex; align-items: center; }
.search-wrap svg { position: absolute; left: 10px; width: 14px; height: 14px; color: var(--ink-faint); pointer-events: none; }
.input-search { width: 240px; padding-left: 32px; }

.table-wrap {
  width: 100%;
  overflow-x: auto;
}
.scroll-pane {
  overflow-y: auto;
  overflow-x: auto;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  background: var(--bg-canvas);
  padding: 9px 11px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.scroll-pane .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #F8FAFC;
  box-shadow: inset 0 -1px 0 var(--border-hairline);
}
.data-table td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--border-hairline);
  vertical-align: middle;
  font-size: 12.5px;
  color: var(--ink-secondary);
}
.break-anywhere { word-break: break-word; overflow-wrap: anywhere; }
.data-table tbody tr { transition: background 0.12s ease; }
.data-table tbody tr:hover { background: #F8FAFC; }
.data-table tbody tr:last-child td { border-bottom: none; }

.company-cell { display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.company-name-link { font-weight: 600; color: var(--ink-primary); display: inline-flex; align-items: center; gap: 6px; }
.company-name-link:hover { color: var(--accent-sapphire); }
.company-meta { font-size: 11.5px; color: var(--ink-muted); }

/* ==========================================================================
   Kanban Pipeline Board (Horizontal Glovex Stage Columns)
   ========================================================================== */
.kanban-grid {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  align-items: stretch;
}
.kanban-col {
  flex: 0 0 264px;
  background: var(--bg-subtle);
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: var(--radius-lg);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 600px;
  overflow: hidden;
}
.kanban-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 8px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}
.kanban-col-title { font-size: 12.5px; font-weight: 650; color: var(--ink-primary); display: flex; align-items: center; gap: 6px; }
.kanban-col-sum { font-family: var(--font-mono); font-size: 11px; color: var(--ink-muted); }
.kanban-col-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; padding-right: 2px; }

.deal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.deal-card:hover { border-color: var(--accent-sapphire-border); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.deal-title { font-size: 13px; font-weight: 600; color: var(--ink-primary); line-height: 1.35; }
.deal-amount { font-family: var(--font-mono); font-size: 14px; font-weight: 700; color: var(--ink-primary); }

/* ==========================================================================
   Executive Workflow Trace Timeline (Vertical Rail Audit Log)
   ========================================================================== */
.trace-panel {
  background: linear-gradient(180deg, #FAFCFF 0%, #FFFFFF 100%);
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  overflow: hidden;
}
.trace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #F8FAFC;
  border-bottom: 1px solid #EEF2F7;
}
.trace-console { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.trace-line {
  position: relative;
  display: grid;
  grid-template-columns: 18px 88px minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
}
.trace-line:hover { background: #F8FAFC; }
.trace-rail { position: relative; display: flex; justify-content: center; align-self: stretch; padding-top: 6px; }
.trace-line:not(:last-child) .trace-rail::after {
  content: '';
  position: absolute;
  top: 16px;
  bottom: -14px;
  left: 50%;
  width: 1.5px;
  transform: translateX(-50%);
  background: #E2E8F0;
}
.trace-dot { width: 7px; height: 7px; border-radius: 50%; background: #3B82F6; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14); position: relative; z-index: 1; }
.trace-line.type-EXTERNAL_UPLOAD .trace-dot { background: #10B981; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18); }
.trace-line.type-QA_COMMENT .trace-dot { background: #7C3AED; box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.18); }
.trace-line.type-SEDGWICK_CALL .trace-dot, .trace-line.type-AMAZON_REPLY .trace-dot { background: #D97706; box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.18); }
.trace-node {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #E2E8F0;
  background: #F1F5F9;
  color: #475569;
  white-space: nowrap;
}
.trace-time { font-family: var(--font-mono); font-size: 11px; color: #94A3B8; white-space: nowrap; padding-top: 2px; }

/* ==========================================================================
   Slide-Over 360° Case Drawer, Modals, Command Palette & Lightbox
   ========================================================================== */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(2px);
  z-index: 80;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }

.drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(860px, 95vw);
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  z-index: 90;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.26s var(--ease-out);
}
.drawer-panel.open { transform: translateX(0); }
.drawer-head { padding: 18px 22px 14px; border-bottom: 1px solid var(--border-subtle); display: flex; flex-direction: column; gap: 12px; background: #FFFFFF; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px 36px; display: flex; flex-direction: column; gap: 16px; background: var(--bg-canvas); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.44);
  backdrop-filter: blur(2px);
  z-index: 150;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal-box {
  position: relative;
  width: min(620px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalIn 0.16s var(--ease-out);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border-hairline); display: flex; align-items: center; justify-content: space-between; }
.modal-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; max-height: 75vh; overflow-y: auto; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--border-hairline); background: var(--bg-canvas); display: flex; align-items: center; justify-content: flex-end; gap: 8px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-secondary); }

.cmd-modal { width: min(600px, 100%); margin-top: -12vh; }
.cmd-input-row { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border-subtle); }
.cmd-input { flex: 1; border: none; outline: none; font-size: 14.5px; background: transparent; }
.cmd-results { max-height: 360px; overflow-y: auto; padding: 8px; }
.cmd-item { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; border: none; border-radius: 8px; background: transparent; cursor: pointer; text-align: left; }
.cmd-item:hover { background: var(--bg-hover); }

/* Evidence Preview Lightbox */
.lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 17, 32, 0.78);
  backdrop-filter: blur(6px);
  z-index: 220;
  display: none;
  flex-direction: column;
  padding: 20px;
}
.lightbox-backdrop.open { display: flex; }
.lightbox-bar { display: flex; align-items: center; justify-content: space-between; color: #FFFFFF; padding-bottom: 12px; }
.lightbox-stage { flex: 1; display: grid; place-items: center; overflow: auto; }
.lightbox-stage img { max-width: 92vw; max-height: 82vh; border-radius: 10px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); background: #FFFFFF; }
.lightbox-stage iframe { width: min(980px, 92vw); height: 82vh; border: none; border-radius: 10px; background: #FFFFFF; }

/* Dropzone */
.audit-dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-canvas);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.16s ease;
}
.audit-dropzone:hover, .audit-dropzone.is-dragover {
  border-color: var(--accent-sapphire);
  background: var(--accent-sapphire-soft);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* Vault Box */
.vault-box {
  background: linear-gradient(180deg, #F8FAFC 0%, #FFFFFF 100%);
  border: 1px solid #CBD5E1;
  border-radius: var(--radius-lg);
  padding: 16px;
}
.vault-revealed {
  border-color: #93C5FD;
  background: #F5F9FF;
}

/* Split Layouts & Trend Bars */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-asymmetric { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 16px; }

.trend-bars-wrap {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  height: 185px;
  padding-top: 10px;
}
.trend-bar-col { display: flex; flex-direction: column; align-items: center; height: 100%; gap: 6px; }
.trend-bar-val { font-size: 11px; color: var(--ink-muted); font-family: var(--font-mono); white-space: nowrap; }
.trend-bar-track { flex: 1; width: 100%; max-width: 38px; background: #F1F5F9; border-radius: 7px; display: flex; align-items: flex-end; overflow: hidden; padding: 2px; }
.trend-bar-fill { width: 100%; border-radius: 5px; background: linear-gradient(180deg, #60A5FA 0%, #2563EB 100%); transition: height 0.3s ease; }
.trend-bar-fill.emerald { background: linear-gradient(180deg, #34D399 0%, #059669 100%); }
.trend-bar-label { font-size: 11px; color: var(--ink-secondary); white-space: nowrap; }

/* Toast Stack */
.toast-stack { position: fixed; right: 22px; bottom: 22px; z-index: 260; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto;
  background: var(--brand-obsidian);
  color: #FFFFFF;
  padding: 11px 15px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.2s var(--ease-out);
  max-width: 420px;
}
.toast.success { border-left: 3px solid #10B981; }
.toast.error { border-left: 3px solid #F43F5E; }
.toast.info { border-left: 3px solid #3B82F6; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ==========================================================================
   Executive Split-Screen Login Screen (Exact Glovex Architecture)
   ========================================================================== */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  background:
    radial-gradient(800px 420px at 15% 10%, rgba(59, 130, 246, 0.12), transparent 65%),
    radial-gradient(700px 380px at 85% 90%, rgba(14, 165, 233, 0.1), transparent 65%),
    #EEF2F7;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}
.login-card {
  width: min(940px, 100%);
  min-height: 520px;
  background: #FFFFFF;
  border-radius: 20px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 28px 70px -18px rgba(15, 23, 42, 0.22);
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  overflow: hidden;
}
.login-brand-pane {
  background:
    radial-gradient(360px 280px at 88% 8%, rgba(96, 165, 250, 0.22), transparent 70%),
    radial-gradient(300px 260px at 12% 92%, rgba(56, 189, 248, 0.16), transparent 70%),
    linear-gradient(168deg, #1C2B46 0%, #25385A 54%, #2F4670 100%);
  padding: 38px 36px;
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
}
.login-brand-lockup { display: flex; align-items: center; gap: 12px; }
.login-brand-word {
  font-family: var(--font-brand);
  font-size: 27px;
  font-weight: 500;
  -webkit-text-stroke: 0.35px rgba(255, 255, 255, 0.72);
  letter-spacing: -0.015em;
  color: #FFFFFF;
}
.login-hero-title { font-size: 20px; font-weight: 700; line-height: 1.35; letter-spacing: -0.025em; color: #FFFFFF; }
.login-hero-sub { font-size: 13px; line-height: 1.65; color: rgba(255, 255, 255, 0.88); }
.login-feature-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, 0.14); }
.login-feature-item { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: #FFFFFF; }
.login-form-pane { padding: 38px 40px; display: flex; flex-direction: column; justify-content: center; background: #FFFFFF; }

.demo-chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.demo-chip {
  height: 26px;
  padding: 0 9px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-canvas);
  color: var(--ink-secondary);
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.14s ease;
}
.demo-chip:hover { border-color: var(--accent-sapphire); color: var(--accent-sapphire); background: var(--accent-sapphire-soft); }

.empty-state { padding: 40px 20px; text-align: center; color: var(--ink-muted); display: flex; flex-direction: column; align-items: center; gap: 8px; }

/* Standalone External Upload Portal */
.portal-header {
  background:
    radial-gradient(460px 220px at 90% 10%, rgba(96, 165, 250, 0.22), transparent 70%),
    linear-gradient(168deg, #1C2B46 0%, #25385A 54%, #2F4670 100%);
  color: #FFFFFF;
  padding: 20px 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}
.portal-container { max-width: 920px; margin: 26px auto 64px; padding: 0 20px; display: flex; flex-direction: column; gap: 18px; }

@media (max-width: 1120px) {
  .kpi-grid, .coach-step-grid, .pipeline-track { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-asymmetric, .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .app-shell { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .sidebar { height: auto; padding: 10px 14px; }
  .nav-list { flex-direction: row; overflow-x: auto; }
  .nav-item { flex-shrink: 0; }
  .sidebar-footer .engine-status-card { display: none; }
  .login-card, .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
}
