/* ─────────────────────────────────────────────────────────────────────────
   Atlacis Control Portal — Premium CSS
   Brand system mirrors atlacis-web/src/lib/brand.ts
   ───────────────────────────────────────────────────────────────────────── */

/* ── Variables — Dark Premium Theme (matches atlacis.com) ─────────────── */
:root {
  --sidebar-w: 240px;
  --sidebar-bg: #0a1220;
  --sidebar-border: #162032;
  --sidebar-text: #7a8a9e;
  --sidebar-text-hover: #e2e8f0;
  --sidebar-active-bg: rgba(20,184,166,.08);
  --sidebar-active-text: #14B8A6;
  --sidebar-active-bar: #0D9488;

  --brand: #0D9488;
  --brand-light: #14B8A6;
  --brand-dark: #0a7c72;
  --brand-glow: rgba(13,148,136,.15);
  --accent: #0D9488;

  --navy: #0a1220;
  --navy-light: #0f1b2d;
  --navy-mid: #162032;
  --navy-surface: #1a2742;

  --bg: #0c1526;
  --bg-2: #0f1b2d;
  --card: #111e32;
  --card-hover: #162642;
  --border: #1e2d45;
  --border-light: #1a2840;

  --text: #e2e8f0;
  --text-2: #c1cdd9;
  --text-3: #7a8a9e;
  --text-4: #4e6078;

  --green: #10b981;
  --green-bg: rgba(16,185,129,.10);
  --green-text: #6ee7b7;

  --amber: #f59e0b;
  --amber-bg: rgba(245,158,11,.10);
  --amber-text: #fcd34d;

  --blue: #0D9488;
  --blue-bg: rgba(13,148,136,.10);
  --blue-text: #5eead4;

  --red: #ef4444;
  --red-bg: rgba(239,68,68,.10);
  --red-text: #fca5a5;

  --violet: #8b5cf6;
  --violet-bg: rgba(139,92,246,.10);

  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.2);
  --shadow: 0 2px 8px rgba(0,0,0,.3), 0 1px 3px rgba(0,0,0,.2);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.4), 0 2px 8px rgba(0,0,0,.2);
  --transition: .15s ease;
  --focus-ring: 0 0 0 3px rgba(13,148,136,.25);

  /* Spacing scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
}

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

html { font-size: 14px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

/* ── Sidebar ───────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow: hidden;
  z-index: 50;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--sidebar-border);
}

.brand-icon {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

.brand-name {
  font-size: 14px;
  font-weight: 700;
  color: #e2e8f0;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.brand-sub {
  font-size: 10px;
  font-weight: 500;
  color: var(--sidebar-text);
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
  position: relative;
}

.nav-item:hover {
  background: rgba(255,255,255,.04);
  color: var(--sidebar-text-hover);
}

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--sidebar-active-bar);
  border-radius: 0 2px 2px 0;
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  flex-shrink: 0;
}

.nav-label { flex: 1; }

.nav-badge {
  background: var(--brand);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 8px;
  min-width: 18px;
  text-align: center;
}

/* Footer */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--navy-light);
  color: #F1F5F9;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: #F1F5F9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 10.5px;
  color: var(--sidebar-text);
  text-transform: uppercase;
  letter-spacing: .03em;
}

.sidebar-logout {
  color: var(--sidebar-text);
  padding: 6px;
  border-radius: 6px;
  transition: color var(--transition), background var(--transition);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.sidebar-logout:hover {
  color: var(--red);
  background: rgba(185,28,28,.1);
}

/* ── Main content ──────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 32px 36px;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Page header ───────────────────────────────────────────────────────── */
.page-header {
  margin-bottom: 28px;
}

.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 3px;
}

/* ── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .01em;
}

.card-body { padding: 20px; }

/* ── KPI Grid ──────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: box-shadow var(--transition), border-color var(--transition);
}

.kpi-card:hover { box-shadow: var(--shadow); }

a.kpi-clickable { text-decoration: none; cursor: pointer; }
a.kpi-clickable:hover { box-shadow: var(--shadow); border-color: var(--brand); }

a.status-pill:hover { opacity: .85; }
a.status-bar-row:hover { opacity: .8; }

.kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 20px;
}

.kpi-icon.purple  { background: var(--blue-bg); color: var(--blue-text); }
.kpi-icon.amber   { background: var(--amber-bg); color: var(--amber-text); }
.kpi-icon.green   { background: var(--green-bg); color: var(--green-text); }
.kpi-icon.red     { background: var(--red-bg); color: var(--red-text); }
.kpi-icon.blue    { background: var(--blue-bg); color: var(--blue-text); }

.kpi-body { min-width: 0; }

.kpi-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.03em;
  line-height: 1;
  margin-bottom: 4px;
}

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ── Dashboard Grid ────────────────────────────────────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  margin-bottom: 28px;
}

/* Force 2-col grid for stat pills inside the narrow status breakdown column */
.dash-grid > .card:last-child .resp-grid-4 {
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (max-width: 900px) {
  .dash-grid { grid-template-columns: 1fr; }
}

/* ── Status breakdown chart ────────────────────────────────────────────── */
.status-bars { display: flex; flex-direction: column; gap: 14px; }

.status-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-bar-label {
  width: 72px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  text-transform: capitalize;
  flex-shrink: 0;
}

.status-bar-track {
  flex: 1;
  height: 8px;
  background: var(--border-light);
  border-radius: 99px;
  overflow: hidden;
}

.status-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .6s ease;
}

.status-bar-fill.pending  { background: var(--amber); }
.status-bar-fill.approved { background: var(--green); }
.status-bar-fill.held     { background: var(--blue); }
.status-bar-fill.rejected { background: var(--red); }

.status-bar-count {
  width: 28px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
  text-align: right;
  flex-shrink: 0;
}

/* ── Tables ────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  background: var(--navy-light);
  color: var(--text-3);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-2);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tbody tr {
  transition: background var(--transition);
}

tbody tr:hover { background: rgba(255,255,255,.03); }

.table-link {
  color: var(--brand);
  font-weight: 600;
  transition: color var(--transition);
}

.table-link:hover { color: var(--brand-dark); }

.customer-name { font-weight: 600; color: var(--text); }
.customer-email { font-size: 12px; color: var(--text-3); }

/* ── Badges ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
}

.badge-pending  { background: var(--amber-bg); color: var(--amber-text); }
.badge-approved { background: var(--green-bg); color: var(--green-text); }
.badge-held     { background: rgba(59,130,246,.12); color: #93c5fd; }
.badge-rejected { background: var(--red-bg);   color: var(--red-text); }
.badge-returned { background: var(--violet-bg); color: #5b21b6; }
.badge-completed { background: var(--green-bg); color: var(--green-text); }
.badge-disputed  { background: var(--red-bg); color: var(--red-text); }

/* Risk score badges */
.risk-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}

.risk-low  { background: var(--green-bg); color: var(--green-text); }
.risk-med  { background: var(--amber-bg); color: var(--amber-text); }
.risk-high { background: var(--red-bg);   color: var(--red-text); }

/* ── Filters / Tabs ────────────────────────────────────────────────────── */
.filter-tabs {
  display: flex;
  gap: 2px;
  background: var(--border-light);
  border-radius: 6px;
  padding: 3px;
  width: fit-content;
}

.filter-tab {
  padding: 5px 14px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  transition: all var(--transition);
  cursor: pointer;
}

.filter-tab:hover { color: var(--text-2); }

.filter-tab.active {
  background: var(--navy-surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 14px; }
.btn-full { width: 100%; }

.btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  box-shadow: 0 0 12px var(--brand-glow);
}
.btn-primary:hover { background: var(--brand-light); border-color: var(--brand-light); box-shadow: 0 0 20px var(--brand-glow), 0 2px 8px rgba(13,148,136,.3); }
.btn-primary:active { background: #087b6f; box-shadow: inset 0 1px 3px rgba(0,0,0,.15); }

.btn-approve {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
.btn-approve:hover { background: #065F46; border-color: #065F46; box-shadow: 0 2px 8px rgba(4,120,87,.2); }
.btn-approve:active { background: #064E3B; box-shadow: inset 0 1px 3px rgba(0,0,0,.15); }

.btn-hold {
  background: var(--navy-light);
  color: #fff;
  border-color: var(--navy-light);
}
.btn-hold:hover { background: var(--navy); border-color: var(--navy); box-shadow: 0 2px 8px rgba(15,27,45,.2); }
.btn-hold:active { background: #0a1320; box-shadow: inset 0 1px 3px rgba(0,0,0,.15); }

.btn-reject {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.btn-reject:hover { background: #991B1B; border-color: #991B1B; box-shadow: 0 2px 8px rgba(185,28,28,.2); }
.btn-reject:active { background: #7F1D1D; box-shadow: inset 0 1px 3px rgba(0,0,0,.15); }

.btn-outline {
  background: transparent;
  color: var(--text-2);
  border-color: var(--border);
}
.btn-outline:hover { background: rgba(255,255,255,.04); border-color: var(--text-4); }
.btn-outline:active { background: rgba(255,255,255,.06); }

.btn-ghost {
  background: transparent;
  color: var(--brand-light);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--blue-bg); }
.btn-ghost:active { background: rgba(13,148,136,.15); }

.btn-pdf {
  background: var(--navy-light);
  color: #F1F5F9;
  border-color: var(--navy-light);
}
.btn-pdf:hover { background: var(--navy); border-color: var(--navy); }
.btn-pdf:active { background: #0a1320; }

/* Focus states for accessibility */
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.form-input:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(13,148,136,.12); border-color: var(--brand); }
.nav-item:focus-visible { outline: 2px solid var(--sidebar-active-text); outline-offset: -2px; }

/* ── Case detail layout ─────────────────────────────────────────────────── */
.case-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 900px) {
  .case-grid { grid-template-columns: 1fr; }
}

/* Risk gauge */
.risk-gauge {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 20px;
  gap: 8px;
}

.risk-number {
  font-size: 64px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.04em;
}
.risk-number.risk-low  { color: var(--green); }
.risk-number.risk-med  { color: var(--amber); }
.risk-number.risk-high { color: var(--red); }

.risk-label-text { font-size: 12px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }

.risk-bar-container {
  width: 100%;
  height: 8px;
  background: linear-gradient(to right, var(--green), var(--amber), var(--red));
  border-radius: 99px;
  position: relative;
  margin-top: 4px;
}

.risk-bar-pointer {
  position: absolute;
  top: -4px;
  width: 16px;
  height: 16px;
  background: var(--card);
  border: 3px solid currentColor;
  border-radius: 50%;
  transform: translateX(-50%);
}

/* Fraud patterns */
.pattern-list { display: flex; flex-direction: column; gap: 10px; }

.pattern-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--red-bg);
  border: 1px solid rgba(239,68,68,.2);
  border-radius: var(--radius-sm);
}

.pattern-icon { flex-shrink: 0; margin-top: 1px; display: flex; align-items: center; color: var(--red-text); }

.pattern-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--red-text);
  margin-bottom: 2px;
}

.pattern-desc { font-size: 12px; color: var(--red-text); }

/* Detail rows */
.detail-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13.5px;
}

.detail-row:last-child { border-bottom: none; }

.detail-key {
  width: 150px;
  min-width: 150px;
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 500;
}

.detail-val { color: var(--text); font-weight: 500; }

/* Notes */
.note-item {
  padding: 14px 16px;
  background: var(--navy-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 10px;
}

.note-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.note-author {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand);
}

.note-time {
  font-size: 11.5px;
  color: var(--text-4);
}

.note-content { font-size: 13.5px; color: var(--text-2); line-height: 1.55; }

/* Notes form */
.notes-form textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text);
  resize: vertical;
  min-height: 90px;
  transition: border-color var(--transition);
  outline: none;
  background: var(--navy-light);
}

.notes-form textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(13,148,136,.10); }

/* ── Forms ─────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 7px;
  letter-spacing: .01em;
}

.form-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--navy-light);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(13,148,136,.10);
}

.form-input::placeholder { color: var(--text-4); }

/* ── Alerts ────────────────────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 18px;
}

.alert-error {
  background: var(--red-bg);
  color: var(--red-text);
  border: 1px solid rgba(239,68,68,.25);
}

/* ── Login page ────────────────────────────────────────────────────────── */
.login-body {
  background: linear-gradient(180deg, #0a1220 0%, #0c1526 50%, #0f1b2d 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-wrapper {
  width: 100%;
  max-width: 400px;
}

.login-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(0,0,0,.3);
  border: 1px solid var(--border);
  padding: 36px 32px 28px;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 8px;
}

.login-logo {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.login-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.03em;
}

.login-subtitle {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-top: 2px;
}

.login-tagline {
  text-align: center;
  font-size: 13px;
  color: var(--text-4);
  margin-bottom: 28px;
  font-style: italic;
}

.login-form { margin-top: 8px; }

.login-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-4);
  margin-top: 20px;
}

.login-hint code {
  background: var(--border-light);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 11.5px;
  color: var(--brand);
}

/* ── Empty state ───────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-3);
}

.empty-state-icon { margin-bottom: 12px; color: var(--text-4); }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.empty-state p { font-size: 13.5px; }

/* ── Action panel ──────────────────────────────────────────────────────── */
.action-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.action-separator {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-4);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  margin: 4px 0;
}

.action-separator::before,
.action-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Breadcrumb ────────────────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 16px;
}

.breadcrumb a { color: var(--brand); font-weight: 500; }
.breadcrumb a:hover { color: var(--brand-dark); }
.breadcrumb-sep { color: var(--text-4); }

/* ── Misc utilities ─────────────────────────────────────────────────────── */
.flex   { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2  { margin-top: 8px; }
.mt-4  { margin-top: 16px; }
.mt-6  { margin-top: 24px; }
.mb-2  { margin-bottom: 8px; }
.mb-4  { margin-bottom: 16px; }
.text-sm { font-size: 12.5px; }
.text-muted { color: var(--text-3); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

code {
  background: var(--navy-surface);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  color: var(--brand-light);
}

/* ── Global Range Selector ─────────────────────────────────────────────── */
.range-form { display:flex; align-items:center; gap:10px; }
.range-label { font-size:12px; color: var(--text-2); }
.range-select {
  font-size: 12px;
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--navy-light);
  color: var(--text);
}

/* ── Scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--navy-surface); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-4); }

/* ── Enterprise overrides ─────────────────────────────────────────────── */
.brand-icon  { background: var(--navy-mid); box-shadow: none; border-radius: 6px; }
.user-avatar { background: var(--navy-surface); }

.main-content { padding: 0; }
.content-pad  { padding: 28px 32px; }

th { background: var(--navy-light); font-size: 10px; letter-spacing: .08em; }

/* Portal card subtle hover — no transforms (prevents shake) */
.card { transition: box-shadow var(--transition), border-color var(--transition); }
.kpi-card { transition: box-shadow var(--transition), border-color var(--transition); }

/* Disable tap highlight on mobile */
button, a, .nav-item, .conv-item, .filter-tab, .top-bar-btn, .btn { -webkit-tap-highlight-color: transparent; }

/* Nav section label */
.nav-section-label {
  margin: 12px 16px 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-4);
  letter-spacing: .08em;
}

/* Prevent accidental zoom on iOS inputs */
@media (max-width: 768px) {
  input, select, textarea { font-size: 16px !important; }
}

/* ── Top Utility Bar ──────────────────────────────────────────────────── */
.top-utility-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 32px;
  background: var(--navy-light);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-3);
}

.top-bar-brand {
  font-weight: 600;
  font-size: 11.5px;
  color: var(--text-3);
  letter-spacing: .15em;
  text-transform: uppercase;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 2px;
}

/* Mobile hamburger button (hidden on desktop) */
.mobile-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-2);
  padding: 6px;
  cursor: pointer;
  border-radius: 6px;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s;
}
.mobile-hamburger:hover { background: rgba(255,255,255,.06); }

/* Sync status pills — semantic classes replace inline styles */
.sync-status-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9px;
  cursor: default;
  letter-spacing: .02em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.sync-status-online { background: rgba(34,197,94,.12); color: #86efac; }
.sync-status-offline { background: rgba(239,68,68,.12); color: #fca5a5; }
.sync-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.sync-dot-online { background: #22c55e; }
.sync-dot-offline { background: #ef4444; }

/* Global range bar — semantic classes replace inline styles */
.global-range-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 32px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.range-bar-org { font-size: 13px; font-weight: 700; color: var(--text); }
.range-bar-badge { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 3px; letter-spacing: .03em; }
.range-bar-badge-demo { background: rgba(245,158,11,.12); color: #fcd34d; }
.range-bar-badge-pilot { background: rgba(59,130,246,.12); color: #93c5fd; }

/* Drawer overlay */
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 199;
  opacity: 0;
  transition: opacity .25s ease;
}
.drawer-overlay.open {
  display: block;
  opacity: 1;
}

.top-bar-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  border-radius: 5px;
  transition: background .15s, color .15s;
  position: relative;
}

.top-bar-btn:hover { background: rgba(255,255,255,.06); color: var(--text); }

.top-bar-sync {
  background: var(--brand);
  color: #fff !important;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
}

.top-bar-sync:hover { background: var(--brand-light); }

.top-bar-badge {
  position: absolute;
  top: 1px;
  right: 2px;
  width: 15px;
  height: 15px;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.top-bar-dropdown-wrap { position: relative; }

.top-bar-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  min-width: 200px;
  overflow: hidden;
}

.top-bar-dropdown-wrap.open > .top-bar-dropdown { display: block; }

.notif-dropdown { min-width: 300px; }

.notif-header {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px solid var(--border-light);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  transition: background .15s;
}

.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: rgba(255,255,255,.04); }

.notif-title { font-size: 12px; font-weight: 500; color: var(--text-2); line-height: 1.4; }
.notif-time  { font-size: 11px; color: var(--text-4); margin-top: 2px; }
.notif-item > svg { flex-shrink: 0; margin-top: 2px; }

.top-bar-user-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--navy);
  color: #F1F5F9;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.top-bar-user-email {
  font-size: 12px;
  color: var(--text-3);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  transition: background .15s;
  cursor: pointer;
}

.dropdown-item:hover { background: rgba(255,255,255,.04); }
.dropdown-item-danger { color: #fca5a5; }
.dropdown-item-danger:hover { background: rgba(239,68,68,.1); }

.dropdown-divider { height: 1px; background: var(--border-light); margin: 4px 0; }

.sync-toast {
  position: fixed;
  top: 52px;
  right: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--navy);
  color: #F1F5F9;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  animation: toastSlide .2s ease;
}

@keyframes toastSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Login — Enterprise ───────────────────────────────────────────────── */
.login-logo { background: transparent; box-shadow: none; }

.login-heading {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  letter-spacing: -.02em;
  margin-bottom: 4px;
}

.login-desc {
  font-size: 13px;
  color: var(--text-3);
  text-align: center;
  margin-bottom: 24px;
}

.login-divider {
  position: relative;
  text-align: center;
  margin: 20px 0 16px;
}

.login-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
}

.login-divider span {
  position: relative;
  background: var(--card);
  padding: 0 12px;
  font-size: 11px;
  color: var(--text-4);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.sso-buttons { display: flex; flex-direction: column; gap: 8px; }

.btn-sso {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--navy-light);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all .15s;
}

.btn-sso:hover { background: var(--navy-mid); border-color: var(--text-4); }

.login-footer { margin-top: 28px; text-align: center; }

.login-footer-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.login-footer-links a { font-size: 11.5px; color: var(--text-4); transition: color .15s; }
.login-footer-links a:hover { color: var(--text-3); }

.login-copyright { margin-top: 10px; font-size: 11px; color: var(--text-4); }

/* ═══════════════════════════════════════════════════════════════════════════
   Responsive App Shell — Mobile, Tablet, Desktop
   ═══════════════════════════════════════════════════════════════════════════ */

/* Prevent body horizontal overflow on ALL screens */
html { overflow-x: hidden; }
body { overflow-x: hidden; max-width: 100vw; }

/* Mobile bottom nav (hidden on desktop) */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--sidebar-bg);
  border-top: 1px solid var(--sidebar-border);
  padding: 4px 0 max(4px, env(safe-area-inset-bottom));
}

.mobile-bottom-nav-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  color: var(--sidebar-text);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .01em;
  border-radius: 8px;
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.mobile-nav-item.active { color: var(--sidebar-active-text); }

.mobile-nav-badge {
  position: absolute;
  top: 0;
  right: 2px;
  width: 16px;
  height: 16px;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Inline element visibility helpers */
.desktop-only-inline { display: inline-flex; }

/* ── Responsive grid utility classes ── */
.resp-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.resp-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.resp-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ── Tablet (768–1024): Collapsible sidebar ── */
@media (min-width: 769px) and (max-width: 1024px) {
  .sidebar {
    width: 64px;
    min-width: 64px;
    --sidebar-w: 64px;
  }
  .sidebar-brand { padding: 16px 0; justify-content: center; }
  .brand-text { display: none; }
  .nav-label, .nav-badge { display: none; }
  .nav-item { justify-content: center; padding: 10px; border-radius: 8px; }
  .nav-item.active::before { display: none; }
  .nav-section-label { display: none; }
  .sidebar-footer { padding: 10px 8px; flex-direction: column; gap: 8px; }
  .user-meta { display: none; }
  .sidebar-logout { margin: 0; }
  .sidebar-user { justify-content: center; }
  .main-content { margin-left: 64px; }

  /* Responsive grids on tablet */
  .resp-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* ── Mobile (<768px): Drawer + Bottom nav ── */
@media (max-width: 768px) {
  /* BULLETPROOF sidebar hide — display:none + transform */
  .sidebar {
    transform: translateX(-100%) !important;
    transition: transform .25s ease;
    z-index: 200;
    visibility: hidden;
  }
  .sidebar.drawer-open {
    transform: translateX(0) !important;
    visibility: visible;
  }

  /* Force full-width content */
  .layout { display: flex; flex-direction: column; }
  .main-content { margin-left: 0 !important; width: 100% !important; max-width: 100vw !important; }

  /* Show hamburger button */
  .mobile-hamburger { display: flex; }

  /* Show mobile bottom nav */
  .mobile-bottom-nav { display: block; }

  /* Adjust content padding for bottom nav */
  .content-pad { padding: 20px 16px 80px; }

  /* Top utility bar mobile */
  .top-utility-bar { padding: 6px 12px; }
  .top-bar-user-email { display: none; }
  .top-bar-brand { font-size: 10px; letter-spacing: .1em; }
  .top-bar-logo { display: none; }
  .sync-label { display: none; }
  .sync-status-text { display: none; }
  .btn-text-label { display: none; }

  /* Hide desktop-only elements */
  .desktop-only-inline { display: none !important; }

  /* Global range bar mobile */
  .global-range-bar { padding: 8px 12px; flex-wrap: wrap; gap: 6px; }
  .range-bar-org { font-size: 12px; }

  /* Page header mobile */
  .page-header { margin-bottom: 20px; }
  .page-header-row { flex-direction: column; gap: 10px; }
  .page-title { font-size: 18px; }
  .page-subtitle { font-size: 12px; }

  /* KPI grid mobile: 2 cols */
  .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }
  .kpi-card { padding: 14px 14px; }
  .kpi-value { font-size: 20px; }
  .kpi-icon { width: 34px; height: 34px; }
  .kpi-label { font-size: 10.5px; }

  /* Responsive grid utilities → mobile stacking */
  .resp-grid-4 { grid-template-columns: repeat(2, 1fr) !important; gap: 12px; }
  .resp-grid-3 { grid-template-columns: 1fr !important; gap: 12px; }
  .resp-grid-2 { grid-template-columns: 1fr !important; gap: 16px; }

  /* Dashboard grid mobile */
  .dash-grid { grid-template-columns: 1fr !important; gap: 16px; }

  /* Case grid mobile */
  .case-grid { grid-template-columns: 1fr !important; }

  /* Tables mobile — horizontal scroll */
  .table-wrap { margin: 0 -16px; padding: 0 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 600px; }

  /* Filter tabs → scroll */
  .filter-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; width: 100%; }

  /* Chat grid mobile — show conv list by default, thread on tap */
  .chat-layout-grid { grid-template-columns: 1fr !important; height: auto !important; min-height: 400px; }
  .chat-conv-list { display: block; border-right: none; border-bottom: 1px solid var(--border); max-height: 50vh; overflow-y: auto; }
  .chat-thread { display: none; }
  .chat-thread:only-child,
  .chat-layout-grid .chat-thread[style*="flex"] { display: flex !important; }
  .chat-messages { min-height: 260px; }
  .chat-input-bar { padding: 10px 12px; }
  .chat-back-btn { display: flex; }
  .chat-action-btns { flex-direction: column; gap: 4px; }
  .chat-action-btns .btn { padding: 6px 8px; font-size: 11px; }

  /* Reports grid mobile */
  .reports-grid { grid-template-columns: 1fr !important; }

  /* Cards — reduce padding */
  .card-header { padding: 14px 16px; }
  .card-body { padding: 16px; }

  /* Info banners — stack on mobile */
  .info-banner { flex-direction: column !important; align-items: flex-start !important; gap: 8px !important; }
  .info-banner > span:last-child { margin-left: 0 !important; }

  /* Forms — stack on mobile */
  .filter-form-inline { flex-direction: column !important; align-items: stretch !important; }
  .filter-form-inline input,
  .filter-form-inline select { width: 100% !important; }
  .invite-form-inline { flex-direction: column !important; align-items: stretch !important; }

  /* Action buttons — full width */
  .btn-pdf { font-size: 12px; padding: 8px 14px; }

  /* Hide elements marked mobile-hidden */
  .mobile-hidden { display: none !important; }

  /* Notification dropdown — prevent overflow */
  .notif-dropdown { min-width: 260px; right: -40px; }

  /* Top bar dropdown — better mobile placement */
  .top-bar-dropdown { right: -8px; min-width: 220px; }

  /* ── Mobile Executive View (Phase 2) ── */
  .mobile-exec-actions { display: block; margin-bottom: 16px; }
  .mobile-exec-alerts { display: flex; gap: 10px; margin-bottom: 16px; }

  /* Hide verbose desktop content on mobile */
  .governance-panel { display: none; }
  .chart-row-desktop { display: none; }
}

/* ── iPhone SE / very small screens (<390px) ── */
@media (max-width: 390px) {
  .kpi-grid { grid-template-columns: 1fr !important; }
  .resp-grid-4 { grid-template-columns: 1fr !important; }
  .content-pad { padding: 16px 12px 88px; }
  .top-utility-bar { gap: 2px; }
  .top-bar-sync { padding: 5px 8px; }
  .chat-agent-rail { flex-direction: column; align-items: flex-start; gap: 8px; }
  .mobile-case-card { padding: 12px; }
  .page-title { font-size: 16px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Phase 5 — Agent AI Chat Upgrade Styles
   ═══════════════════════════════════════════════════════════════════════════ */

.chat-layout-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  height: 600px;
  background: var(--card);
}

/* Conversation list */
.chat-conv-list {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  background: var(--navy-light);
}

.chat-conv-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-conv-header-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.chat-conv-count {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--blue-bg);
  color: var(--blue-text);
}

.conv-item {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background .15s;
}

.conv-item:hover { background: rgba(255,255,255,.04); }
.conv-item.active { background: rgba(13,148,136,.08); border-left: 3px solid var(--brand); padding-left: 15px; }

.conv-customer {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.conv-time {
  font-size: 10px;
  color: var(--text-4);
}

.conv-preview {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 4px;
}

.conv-unread-badge {
  display: inline-block;
  margin-top: 6px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--brand);
  color: #fff;
}

/* Thread area */
.chat-thread {
  display: flex;
  flex-direction: column;
}

.chat-thread-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
}

.chat-thread-customer {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.chat-thread-case {
  font-size: 11px;
  color: var(--text-4);
  margin-left: 10px;
  padding: 2px 8px;
  background: var(--bg);
  border-radius: 4px;
  font-weight: 500;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--bg);
}

/* Message bubbles */
.chat-msg {
  display: flex;
  gap: 10px;
  max-width: 80%;
}

.chat-msg-agent { align-self: flex-start; }
.chat-msg-customer { align-self: flex-end; flex-direction: row-reverse; }

.chat-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
}

.chat-msg-agent .chat-msg-avatar {
  background: var(--navy);
  color: #F1F5F9;
}

.chat-msg-customer .chat-msg-avatar {
  background: var(--border-light);
  color: var(--text-3);
}

.chat-msg-bubble {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.55;
  border-radius: 12px;
}

.chat-msg-agent .chat-msg-bubble {
  background: var(--card);
  border: 1px solid var(--border);
  border-top-left-radius: 4px;
}

.chat-msg-customer .chat-msg-bubble {
  background: var(--blue-bg);
  border: 1px solid rgba(13,148,136,.2);
  border-top-right-radius: 4px;
}

.chat-msg-sender {
  font-size: 10px;
  font-weight: 700;
  margin-bottom: 4px;
}

.chat-msg-agent .chat-msg-sender { color: var(--brand); }
.chat-msg-customer .chat-msg-sender { color: var(--text-3); text-align: right; }

.chat-msg-time {
  font-size: 10px;
  color: var(--text-4);
  margin-top: 6px;
}

.chat-msg-agent .chat-msg-time { text-align: left; }
.chat-msg-customer .chat-msg-time { text-align: right; }

/* Typing indicator */
.chat-typing {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 11px;
  color: var(--text-4);
  font-weight: 500;
}

.chat-typing-dots {
  display: flex;
  gap: 3px;
}

.chat-typing-dot {
  width: 5px;
  height: 5px;
  background: var(--text-4);
  border-radius: 50%;
  animation: chatTyping 1.4s infinite;
}

.chat-typing-dot:nth-child(2) { animation-delay: .2s; }
.chat-typing-dot:nth-child(3) { animation-delay: .4s; }

@keyframes chatTyping {
  0%, 60%, 100% { opacity: .3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

/* Agent presence indicator */
.chat-agent-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
}

.chat-agent-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 2px var(--green-bg);
}

/* Chat input bar */
.chat-input-bar {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--card);
}

.chat-input-bar .form-input { flex: 1; margin: 0; }

/* ── Mobile Executive View Components ── */
.mobile-exec-actions { display: none; }
.mobile-exec-alerts { display: none; }
.mobile-alert-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.mobile-alert-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mobile-alert-title { font-size: 10px; font-weight: 600; color: var(--text-4); text-transform: uppercase; letter-spacing: .04em; }
.mobile-alert-value { font-size: 14px; font-weight: 800; color: var(--text); }

/* Chat action buttons */
.chat-action-btns {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

/* Guardrails microcopy */
.chat-guardrails {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  margin-bottom: 16px;
  background: var(--green-bg);
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  color: var(--green-text);
}

/* Confidence badge */
.chat-confidence-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--green-bg);
  color: var(--green-text);
}

/* Chat disabled state */
.chat-disabled-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 400px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  text-align: center;
  padding: 20px;
}
.chat-disabled-state h3 { font-size: 16px; font-weight: 700; color: var(--text); margin: 16px 0 8px; }
.chat-disabled-state p { font-size: 13px; color: var(--text-3); max-width: 400px; margin-bottom: 20px; }

/* Chat back button (mobile only) */
.chat-back-btn {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--text-3);
  border-radius: 4px;
  -webkit-tap-highlight-color: transparent;
}
.chat-back-btn:hover { background: var(--bg); }

/* ── Mobile Case Cards (shown on mobile instead of table) ── */
.mobile-case-cards { display: none; }

@media (max-width: 768px) {
  .mobile-case-cards { display: flex; flex-direction: column; gap: 10px; }
  .cases-table-desktop { display: none; }

  .mobile-case-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-case-card:active { border-color: var(--brand); box-shadow: inset 0 1px 3px rgba(0,0,0,.06); }

  .mobile-case-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }
  .mobile-case-ref {
    font-family: 'SF Mono', monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--brand);
  }
  .mobile-case-card-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }
  .mobile-case-customer {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }
  .mobile-case-amount {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    flex-shrink: 0;
  }
  .mobile-case-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }
  .mobile-case-sla {
    font-size: 11px;
    font-weight: 600;
  }
}

/* ── Lara Agent Status Rail ── */
.chat-agent-rail {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  margin-bottom: 12px;
  background: var(--navy);
  border-radius: var(--radius);
  border: 1px solid var(--navy-light);
}
.chat-agent-rail-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--navy-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 800;
  color: #F1F5F9;
}
.chat-agent-rail-info { flex: 1; min-width: 0; }
.chat-agent-rail-name {
  font-size: 13px;
  font-weight: 700;
  color: #e2e8f0;
}
.chat-agent-rail-desc {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 1px;
}
.chat-agent-rail-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 600;
  color: #86efac;
  flex-shrink: 0;
}
.chat-agent-rail-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e;
}

/* ── Global anti-shake: no transforms on interactive elements ── */
.btn:active, .kpi-card:active, .card:active, a:active { transform: none !important; }

/* ═══════════════════════════════════════════════════════════════════════════
   Phase 6 — Reports Page Upgrade Styles
   ═══════════════════════════════════════════════════════════════════════════ */

.reports-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.report-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--transition), border-color var(--transition);
}

.report-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--text-4);
}

.report-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.report-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.report-card-format {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--bg);
  color: var(--text-4);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.report-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.report-card-desc {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.5;
  margin-bottom: 18px;
  flex: 1;
}

.report-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.report-card-meta {
  font-size: 10px;
  color: var(--text-4);
  display: flex;
  align-items: center;
  gap: 4px;
}

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

@media (max-width: 600px) {
  .reports-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Landing Page — Public Marketing
   ═══════════════════════════════════════════════════════════════════════════ */

.landing-body {
  background: var(--bg);
  min-height: 100vh;
}

/* ── Nav ── */
.landing-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,18,32,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.landing-nav-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.landing-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.landing-brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.landing-nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}

.landing-nav-link {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-3);
  transition: color var(--transition);
}

.landing-nav-link:hover { color: var(--text); }

.landing-nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Hero ── */
.landing-hero {
  padding: 80px 32px 64px;
  text-align: center;
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 100%);
}

.landing-hero-inner {
  max-width: 720px;
  margin: 0 auto;
}

.landing-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  background: var(--blue-bg);
  color: var(--blue-text);
  font-size: 12px;
  font-weight: 600;
  border-radius: 99px;
  letter-spacing: .02em;
  margin-bottom: 28px;
}

.landing-hero-title {
  font-size: 52px;
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -.04em;
  color: var(--text);
  margin-bottom: 20px;
}

.landing-hero-accent {
  background: linear-gradient(135deg, #0D9488, #14B8A6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.landing-hero-desc {
  font-size: 17px;
  line-height: 1.65;
  color: var(--text-3);
  max-width: 580px;
  margin: 0 auto 36px;
}

.landing-hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 56px;
}

.landing-cta-hero {
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(13,148,136,.25);
}

.landing-cta-hero:hover {
  box-shadow: 0 6px 20px rgba(13,148,136,.35);
  transform: translateY(-1px);
}

.landing-hero-proof {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
}

.landing-proof-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.landing-proof-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.03em;
}

.landing-proof-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-4);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.landing-proof-divider {
  width: 1px;
  height: 40px;
  background: var(--border);
}

/* ── Sections ── */
.landing-section {
  padding: 80px 32px;
}

.landing-section-alt {
  background: var(--bg);
}

.landing-section-inner {
  max-width: 1120px;
  margin: 0 auto;
}

.landing-section-header {
  text-align: center;
  margin-bottom: 52px;
}

.landing-section-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--brand);
  margin-bottom: 12px;
}

.landing-section-title {
  font-size: 34px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.03em;
  line-height: 1.2;
  margin-bottom: 12px;
}

.landing-section-desc {
  font-size: 15px;
  color: var(--text-3);
  max-width: 500px;
  margin: 0 auto;
}

/* ── Features Grid ── */
.landing-features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

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

.landing-feature-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  transition: box-shadow var(--transition), transform var(--transition);
}

.landing-feature-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.landing-feature-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

.landing-feature-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.landing-feature-desc {
  font-size: 13.5px;
  color: var(--text-3);
  line-height: 1.6;
}

/* ── Steps ── */
.landing-steps {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 20px;
}

@media (max-width: 768px) {
  .landing-steps { flex-direction: column; align-items: center; }
  .landing-step-arrow { transform: rotate(90deg); }
}

.landing-step {
  flex: 1;
  max-width: 280px;
  text-align: center;
  padding: 28px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.landing-step-number {
  width: 40px;
  height: 40px;
  margin: 0 auto 16px;
  background: var(--brand);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.landing-step-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.landing-step-desc {
  font-size: 13.5px;
  color: var(--text-3);
  line-height: 1.6;
}

.landing-step-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-4);
  padding-top: 44px;
  flex-shrink: 0;
}

/* ── Pricing ── */
.landing-pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  align-items: start;
}

@media (max-width: 768px) {
  .landing-pricing-grid { grid-template-columns: 1fr; max-width: 400px; margin: 0 auto; }
}

.landing-pricing-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  position: relative;
}

.landing-pricing-featured {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand), var(--shadow);
}

.landing-pricing-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 99px;
  letter-spacing: .02em;
  white-space: nowrap;
}

.landing-pricing-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.landing-pricing-price {
  font-size: 40px;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -.04em;
  line-height: 1;
  margin-bottom: 8px;
}

.landing-pricing-price span {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0;
}

.landing-pricing-desc {
  font-size: 13.5px;
  color: var(--text-3);
  margin-bottom: 24px;
  line-height: 1.5;
}

.landing-pricing-features {
  list-style: none;
  padding: 0;
  margin: 0 0 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.landing-pricing-features li {
  font-size: 13.5px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.landing-pricing-features li::before {
  content: '';
  width: 18px;
  height: 18px;
  background: var(--green-bg);
  border-radius: 50%;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23047857' stroke-width='3'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 10px;
}

/* ── CTA Section ── */
.landing-section-cta {
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  padding: 80px 32px 96px;
}

.landing-cta-box {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

.landing-cta-title {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.03em;
  margin-bottom: 12px;
}

.landing-cta-desc {
  font-size: 15px;
  color: var(--text-3);
  margin-bottom: 32px;
  line-height: 1.6;
}

.landing-cta-form-wrap {
  max-width: 480px;
  margin: 0 auto;
}

.landing-cta-form-row {
  display: flex;
  gap: 10px;
}

.landing-cta-input {
  flex: 1;
}

.landing-cta-success {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--green-text);
  background: var(--green-bg);
  border-radius: var(--radius-sm);
}

/* ── Footer ── */
.landing-footer {
  border-top: 1px solid var(--border);
  padding: 32px;
  background: var(--navy-light);
}

.landing-footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.landing-footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.landing-footer-links {
  display: flex;
  gap: 20px;
}

.landing-footer-links a {
  font-size: 12.5px;
  color: var(--text-4);
  transition: color var(--transition);
}

.landing-footer-links a:hover { color: var(--text-2); }

.landing-footer-copy {
  font-size: 11.5px;
  color: var(--text-4);
}

/* ── Responsive Landing ── */
@media (max-width: 640px) {
  .landing-hero-title { font-size: 34px; }
  .landing-hero-proof { flex-direction: column; gap: 16px; }
  .landing-proof-divider { width: 40px; height: 1px; }
  .landing-nav-links { display: none; }
  .landing-cta-form-row { flex-direction: column; }
  .landing-footer-inner { flex-direction: column; text-align: center; }
}
