:root {
  --primary: #1a56db;
  --primary-hover: #1447c0;
  --highlight: #dce8ff;
  --topbar: #0d1a3a;
  --bg: #f4f6f9;
  --panel: #ffffff;
  --text: #161b2e;
  --muted: #5a6479;
  --border: #e3e7ef;
  --shadow: 0 1px 3px rgba(13, 26, 58, 0.06), 0 8px 24px rgba(13, 26, 58, 0.06);
  --green: #16a34a;
  --red: #d23030;
  --accent: #f97316;
  --code-bg: #f1f4f9;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Satoshi', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

/* ─── Topbar ─────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(180deg, #0a1530, #0d1a3a);
  color: #fff;
  padding: 16px 24px;
}
.topbar::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, rgba(26,86,219,0.55) 30%, rgba(249,115,22,0.45) 70%, transparent 100%);
  pointer-events: none;
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-family: 'Cabinet Grotesk', sans-serif;
  font-weight: 800;
  font-size: 32px;
  letter-spacing: -0.015em;
}
.brand-name { color: #fff; }
.brand-name .accent { color: #4f86f7; }
.brand img.brand-mark {
  height: 30px;
  width: auto;
  display: block;
}
.topbar nav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.topbar nav a {
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  font-family: 'Satoshi', sans-serif;
  font-weight: 500;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 999px;
  transition: background 0.15s ease, color 0.15s ease;
  cursor: pointer;
}
.topbar nav a:hover { color: #fff; background: rgba(255,255,255,0.06); }
.topbar nav a.active { color: #fff; background: rgba(255,255,255,0.09); }

/* ─── Body ─────────────────────────── */
main {
  flex: 1;
  display: block;
  padding: 40px 20px;
}
.shell {
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}
.center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 32px 32px;
}
.card.center-card {
  max-width: 480px;
  width: 100%;
}
.eyebrow {
  display: inline-block;
  background: var(--highlight);
  color: var(--primary);
  font-family: 'Cabinet Grotesk', sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 999px;
  margin-bottom: 14px;
}
h1 {
  font-family: 'Cabinet Grotesk', sans-serif;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
  font-weight: 800;
}
h2 {
  font-family: 'Cabinet Grotesk', sans-serif;
  font-size: 20px;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
  font-weight: 700;
}
p.lead { color: var(--muted); font-size: 16px; margin: 0 0 18px; }
.muted { color: var(--muted); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.spacer-md { height: 18px; }
.spacer-lg { height: 28px; }

/* ─── Form ─────────────────────────── */
.field { display: block; margin: 0 0 12px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.field .field-hint {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  margin: -2px 0 6px;
  line-height: 1.45;
}
.field label .label-optional {
  font-weight: 400;
  color: var(--muted);
}
.field input[type=email],
.field input[type=text],
.input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  font-family: inherit;
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus,
.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.12);
}
.checkbox-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13.5px;
  color: var(--text);
  margin: 8px 0 16px;
}
.checkbox-row input { margin-top: 3px; }
.checkbox-row a { color: var(--primary); text-decoration: none; font-weight: 600; }
.checkbox-row a:hover { text-decoration: underline; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 999px;
  font-family: 'Satoshi', sans-serif;
  font-weight: 700;
  font-size: 14.5px;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background-color .15s, border-color .15s, color .15s, opacity .15s;
  cursor: pointer;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary[disabled] { background: var(--muted); cursor: not-allowed; opacity: 0.7; }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger { background: transparent; color: var(--red); border-color: var(--border); }
.btn-danger:hover { background: #fef2f2; border-color: #fecaca; }
.btn-ghost { background: transparent; color: var(--muted); border: none; padding: 8px 12px; font-weight: 500; }
.btn-ghost:hover { color: var(--text); background: var(--bg); }

/* ─── Status banners ───────────────── */
.banner {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  margin: 0 0 14px;
  border: 1px solid transparent;
}
.banner.success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.banner.error   { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.banner.info    { background: var(--highlight); color: var(--primary); border-color: #c7daff; }
.banner.warning { background: #fff7ed; color: #9a3412; border-color: #fed7aa; }

/* ─── Account view tiles ─────────── */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin: 0 0 18px;
}
.tile {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 18px;
  box-shadow: var(--shadow);
}
.tile h3 {
  font-family: 'Cabinet Grotesk', sans-serif;
  font-size: 14px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
  font-weight: 700;
}
.tile .value {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}
.tile .subvalue { font-size: 13px; color: var(--muted); margin-top: 4px; }
.role-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.role-pill.member { background: var(--highlight); color: var(--primary); }
.role-pill.lifetime { background: #ddd6fe; color: #5b21b6; }
.role-pill.master { background: #fef3c7; color: #92400e; }
/* Lifecycle stage variants (Phase 5.15) */
.role-pill.live     { background: #dcfce7; color: #166534; }
.role-pill.wrapup   { background: #fed7aa; color: #9a3412; }
.role-pill.archived { background: #e5e7eb; color: #4b5563; }

/* ─── Master tabs + table ─────────── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin: 0 0 20px;
  overflow-x: auto;
}
.tab {
  padding: 10px 16px;
  font-weight: 600;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  background: none;
  border-top: none; border-left: none; border-right: none;
  font-family: inherit;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.table-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-x: auto;
  box-shadow: var(--shadow);
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.data th, table.data td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.data th {
  background: #fafbfd;
  font-family: 'Cabinet Grotesk', sans-serif;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  position: sticky;
  top: 0;
}
table.data tr:last-child td { border-bottom: none; }
table.data code {
  background: var(--code-bg);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
}
.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 4px 0;
  font-size: 13px;
  color: var(--muted);
}
.filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 14px;
}
.filter-row input {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 13px;
  font-family: inherit;
  min-width: 180px;
}

/* ─── Footer ─────────────────────── */
footer {
  padding: 32px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}
.footer-tagline {
  font-family: 'Cabinet Grotesk', sans-serif;
  font-weight: 500;
  letter-spacing: 0.06em;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}
.footer-meta { margin: 8px 0 0; font-size: 13px; }
.footer-links { margin: 8px 0 0; font-size: 13px; }
.footer-links a { color: var(--muted); margin: 0 8px; font-weight: 500; text-decoration: none; }
.footer-links a:hover { color: var(--primary); }
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--primary); }

/* ─── Mobile ─────────────────────── */
@media (max-width: 720px) {
  .topbar { position: relative; padding: 14px 16px; }
  .topbar nav { gap: 2px; }
  .topbar nav a { font-size: 13px; padding: 6px 9px; }
  .brand { font-size: 22px; gap: 8px; }
  .brand img.brand-mark { height: 22px; width: auto; padding: 0; }
  main { padding: 24px 14px; }
  .card { padding: 22px 18px; }
  h1 { font-size: 22px; }
}

/* ─── Master action buttons ─────── */
.btn-sm { padding: 6px 10px; font-size: 13px; }
.actions-cell { white-space: nowrap; }
.actions-cell .btn { margin-right: 6px; }
.actions-cell .btn:last-child { margin-right: 0; }
.actions-cell .btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ─── Create event form ─────────── */
.create-event-form .field { margin-bottom: 14px; }
.create-event-form input[type="datetime-local"],
.create-event-form select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  background: #fff;
  font-family: inherit;
  color: var(--text);
}
.create-event-form select:focus,
.create-event-form input[type="datetime-local"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(20, 110, 180, 0.12);
}

/* ─── Event detail page (Phase 1: Live tab) ──────────────────── */
.event-detail { max-width: 1200px; }

.event-header { margin-bottom: 18px; }
.breadcrumb {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
}
.breadcrumb:hover { color: var(--primary); }

.event-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.event-name { margin: 0 0 4px; font-size: 28px; line-height: 1.2; }
.event-meta { font-size: 13px; }
.event-header-right { display: flex; gap: 8px; }

.event-tile { transition: border-color .15s, box-shadow .15s; }
.event-tile:hover { border-color: var(--primary); box-shadow: var(--shadow); }

/* Tabs */
.event-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.event-tab {
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.event-tab:hover { color: var(--text); }
.event-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.event-tab.stub::after {
  content: '·';
  margin-left: 6px;
  opacity: 0.5;
}
.event-tab.stub.active { color: var(--text); border-bottom-color: var(--muted); }

.event-body { min-height: 200px; }

/* ─── Live monitor ─────────────────────────────────── */
.live-monitor { display: flex; flex-direction: column; gap: 18px; }

.live-header-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.live-indicator { display: flex; align-items: center; gap: 8px; }
.live-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--green);
  position: relative;
  box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.6);
  animation: live-pulse 2s infinite;
}
@keyframes live-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.5); }
  70%  { box-shadow: 0 0 0 8px rgba(22, 163, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}
.live-label { font-weight: 600; font-size: 14px; }
.live-generated { font-size: 12px; }
.live-retry-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #fff3e0;
  color: #b45309;
  margin-left: 6px;
}

.live-controls { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.live-poll-select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
}
.live-refresh { padding: 4px 10px; font-size: 12px; }

/* KPIs */
.live-kpis {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 720px) { .live-kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.kpi-accent { border-color: rgba(249, 115, 22, 0.4); }
.kpi-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.kpi-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
  margin-top: 4px;
  color: var(--text);
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
}
.kpi-value-accent { color: var(--accent); }
.kpi-value-string { font-size: 18px; }
.kpi-hint { font-size: 11px; margin-top: 2px; }
.tabular { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }

/* Stale banner */
.live-stale-banner {
  background: #fffaf0;
  border: 1px solid rgba(249, 115, 22, 0.4);
  border-radius: 10px;
  padding: 10px 14px;
}
.live-stale-lead { font-weight: 700; font-size: 14px; color: var(--text); }
.live-stale-banner .muted { font-size: 12px; margin-top: 2px; }

/* Two-column body */
.live-two-col { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 1024px) { .live-two-col { grid-template-columns: minmax(0, 1fr) 320px; } }

.live-section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.live-section-head h2 { font-size: 14px; margin: 0; }
.live-section-head .muted { font-size: 12px; }

.live-vendors-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}
@media (min-width: 600px) { .live-vendors-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1280px) { .live-vendors-grid { grid-template-columns: repeat(3, 1fr); } }

.vendor-card { padding: 12px; transition: border-color .15s; }
.vendor-card.vendor-stale { border-color: rgba(249, 115, 22, 0.5); }
.vendor-card.vendor-hot   { border-color: rgba(22, 163, 74, 0.45); }

.vendor-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.vendor-card-left { min-width: 0; flex: 1; }
.vendor-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vendor-sub { font-size: 11px; }
.vendor-card-right { text-align: right; }
.vendor-today { font-size: 22px; font-weight: 800; line-height: 1.1; }
.vendor-today-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.vendor-card-bottom {
  margin-top: 12px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}
.vendor-since { text-align: right; font-size: 11px; }
.vendor-since-val { font-weight: 600; color: var(--text); }
.vendor-since-val.warn { color: #b45309; }
.vendor-since .muted { font-size: 11px; }

.vendor-sparkline { color: var(--accent); }
.sparkline-bar { fill: currentColor; }
.sparkline-bar-empty { fill: rgba(0, 0, 0, 0.12); }
.sparkline-placeholder {
  font-size: 10px;
  fill: var(--muted);
  font-family: inherit;
}

/* Top companies */
.live-companies-list { padding: 10px; }
.live-companies-ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.live-company-row { font-size: 12px; }
.live-company-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.live-company-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.live-company-count { color: var(--muted); flex-shrink: 0; }
.live-company-track {
  height: 6px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.06);
  overflow: hidden;
}
.live-company-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
}

.live-error { border-color: rgba(210, 48, 48, 0.4); }

/* ─── Settings tab + Account settings (Phase 2 / 2.5) ─────────────────── */
.settings-form { display: block; max-width: 520px; }
.settings-form .field { margin-bottom: 16px; }
.settings-form button { margin-top: 8px; }
.settings-status:empty { display: none; }
.settings-status .banner { margin: 6px 0 0; }
.settings-meta { line-height: 1.6; }
.settings-meta div { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

/* ─── Phase 3: Vendors tab + shared modal ─────────────────────────────── */
.vendors-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.vendors-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.vendors-status:empty { display: none; }
.vendors-table-host { margin-top: 16px; }

.vendors-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.vendors-table th,
.vendors-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.vendors-table th {
  font-weight: 600;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.vendors-table tbody tr:last-child td { border-bottom: 0; }
.vendors-table .col-code { width: 14%; }
.vendors-table .col-name { width: 22%; }
.vendors-table .col-status { width: 10%; }
.vendors-table .col-scan { width: 18%; }
.vendors-table .col-leads { width: 8%; text-align: right; }
.vendors-table .col-actions { width: 28%; text-align: right; }
.vendors-table td.num,
.vendors-table th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Phase 4 polish #210 — inactive rows are muted but still legible. */
.vendors-table tbody tr.row-inactive { background: var(--bg, #f4f6f9); }
.vendors-table tbody tr.row-inactive td { color: var(--muted, #5a6479); }
.vendors-table tbody tr.row-inactive td.mono { color: var(--muted, #5a6479); }

/* Pills */
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  line-height: 1.4;
}
.pill-active { color: #14532d; background: #dcfce7; border-color: #bbf7d0; }
.pill-inactive { color: #4a5568; background: #f1f5f9; border-color: #e2e8f0; }
.pill-demo { color: #7c2d12; background: #ffedd5; border-color: #fed7aa; }

/* Mono / small / num utilities */
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }

/* Row actions */
.row-actions {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Button modifiers */
.btn-xs {
  padding: 3px 8px;
  font-size: 11px;
  border-radius: 4px;
  line-height: 1.4;
}
.btn-danger-text { color: var(--red); }
.btn-danger-text:hover { background: rgba(210, 48, 48, 0.08); }

/* PIN reveal */
.pin-reveal {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 10px 12px;
  margin: 8px 0;
}
.pin-reveal-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.pin-digits {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--text);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(13, 26, 58, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal-dialog {
  background: var(--panel);
  border-radius: 10px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 20px;
}
.modal-dialog h3 { margin-top: 0; }
.modal-form .field { margin-bottom: 12px; }
.modal-form label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
}
.modal-form input[type="text"],
.modal-form input[type="email"],
.modal-form textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
  background: var(--panel);
  color: var(--text);
}
.modal-form textarea { min-height: 140px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.modal-form .checkbox-row { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.modal-status:empty { display: none; }
.modal-status .banner { margin: 8px 0; }

@media (max-width: 640px) {
  .vendors-table { font-size: 12px; }
  .vendors-table th,
  .vendors-table td { padding: 6px 6px; }
  .vendors-table .col-code,
  .vendors-table .col-status { width: auto; }
  .vendors-table .col-scan { display: none; }
  .vendors-table .col-scan-h { display: none; }
}

/* ─── Phase 5.10: Lifecycle status card ─────────────────────────────── */
.lifecycle-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, #f7f9fc 0%, #fff 60%);
}
.lifecycle-card.loading { background: #f7f9fc; }
.lifecycle-card.stage-live   { background: linear-gradient(180deg, #ecfdf5 0%, #fff 60%); border-color: #bbf7d0; }
.lifecycle-card.stage-setup  { background: linear-gradient(180deg, #f0f9ff 0%, #fff 60%); border-color: #bae6fd; }
.lifecycle-card.stage-wrap_up{ background: linear-gradient(180deg, #fff7ed 0%, #fff 60%); border-color: #fed7aa; }
.lifecycle-card.stage-archived{ background: linear-gradient(180deg, #f4f6f9 0%, #fff 60%); border-color: var(--border); }
.lifecycle-left { display: flex; flex-direction: column; gap: 6px; }
.lifecycle-pill {
  display: inline-block;
  font-family: 'Cabinet Grotesk', system-ui, sans-serif;
  font-size: 16px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--highlight);
  color: var(--primary);
  letter-spacing: 0.02em;
  width: fit-content;
}
.lifecycle-pill.stage-live   { background: #dcfce7; color: var(--green); }
.lifecycle-pill.stage-setup  { background: #dbeafe; color: var(--primary); }
.lifecycle-pill.stage-wrap_up{ background: #ffedd5; color: #9a3412; }
.lifecycle-pill.stage-archived{ background: #e5e7eb; color: var(--muted); }
.lifecycle-reason { font-size: 13px; }
.lifecycle-stats {
  display: flex;
  gap: 18px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}
.lifecycle-stat b {
  display: block;
  font-size: 18px;
  color: var(--text);
  font-family: 'Cabinet Grotesk', system-ui, sans-serif;
  font-weight: 700;
}
.lifecycle-actions { display: flex; gap: 8px; }
.lifecycle-fallback {
  display: flex; gap: 12px; align-items: center;
}

@media (max-width: 720px) {
  .lifecycle-card { grid-template-columns: 1fr; gap: 12px; }
  .lifecycle-actions { justify-content: flex-start; }
}

/* ─── Phase 5.10: Archive button ───────────────────────────────────── */
.btn.btn-archive {
  background: #b91c1c;
  color: #fff;
  border-color: #b91c1c;
}
.btn.btn-archive:hover { background: #991b1b; border-color: #991b1b; }
.btn.btn-archive:disabled { opacity: 0.5; cursor: not-allowed; }

.archive-tile { background: #fff7ed; border-color: #fed7aa; }
.archive-tile h3 { color: #9a3412; }

/* ─── Phase 5.10: Past activities table ────────────────────────────── */
table.data.past-activities td:first-child { white-space: nowrap; color: var(--muted); }

/* ─── Phase 5.10: Wrap-up wizard modal ─────────────────────────────── */
.wizard-scrim {
  position: fixed;
  inset: 0;
  background: rgba(13, 26, 58, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.wizard-dialog {
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(13, 26, 58, 0.2);
  padding: 22px 24px;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}
.wizard-steps {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.wizard-step {
  padding: 4px 10px;
  border-radius: 999px;
  background: #f4f6f9;
  border: 1px solid var(--border);
}
.wizard-step.active { background: var(--highlight); color: var(--primary); border-color: #c7daff; }
.wizard-step.done   { background: #dcfce7; color: var(--green); border-color: #bbf7d0; }
.wizard-list { padding-left: 18px; margin: 8px 0 12px; }
.wizard-list li { margin: 4px 0; }
.wizard-confirm-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 14px;
  margin-top: 4px;
}
.wizard-confirm-input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(210, 48, 48, 0.18);
}
.wizard-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* ─── Stats tab (Phase 5.28-C) ──────────────────────────────────────── */
.stats-tab { display: flex; flex-direction: column; gap: 18px; }
.stats-header-strip {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap;
}
.stats-indicator { display: flex; align-items: center; gap: 8px; }
.stats-tile { padding: 16px; }
.stats-tile h2.stats-h2 { margin: 0 0 8px; font-size: 16px; }
.stats-tile .live-section-head { margin-bottom: 12px; }

.stats-chart-host { position: relative; min-height: 180px; }
.stats-timeseries-svg { width: 100%; height: auto; max-height: 220px; }
.stats-grid-line { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 3; }
.stats-axis-label { fill: var(--muted); font-size: 10px; font-family: inherit; }
.stats-bar-scan { fill: var(--accent); }
.stats-bar-manual { fill: var(--primary); }

.stats-legend { display: flex; gap: 14px; margin-top: 8px; font-size: 12px; flex-wrap: wrap; }
.stats-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.stats-legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--muted); }
.stats-color-scan   { background: var(--accent); fill: var(--accent); color: var(--accent); }
.stats-color-manual { background: var(--primary); fill: var(--primary); color: var(--primary); }
.stats-color-import { background: #16a34a; fill: #16a34a; }
.stats-color-other  { background: #94a3b8; fill: #94a3b8; }

.stats-two-col {
  display: grid; gap: 18px; grid-template-columns: 1fr;
}
@media (min-width: 880px) {
  .stats-two-col { grid-template-columns: 320px 1fr; }
}

/* Donut */
.stats-mix-host { display: flex; justify-content: center; }
.stats-donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.stats-donut { width: 160px; height: 160px; }
.stats-donut-empty { fill: var(--border); }
.stats-donut-hole { fill: var(--panel); }
.stats-donut-total { font-size: 22px; font-weight: 800; fill: var(--text); font-family: inherit; }
.stats-donut-sub { font-size: 11px; fill: var(--muted); font-family: inherit; text-transform: uppercase; letter-spacing: 0.06em; }
.stats-donut-legend { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 12px; justify-content: center; }
.stats-donut-legend li { display: inline-flex; align-items: center; gap: 6px; text-transform: capitalize; }
.stats-legend-count { color: var(--muted); margin-left: 4px; }

/* Heatmap */
.stats-heatmap-host { overflow-x: auto; }
.stats-heatmap { display: inline-flex; flex-direction: column; gap: 8px; }
.stats-heatmap-grid {
  display: grid;
  grid-template-columns: 32px repeat(24, 14px);
  gap: 2px;
  font-size: 10px;
}
.stats-heatmap-corner { }
.stats-heatmap-hour { color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.stats-heatmap-dow { color: var(--muted); padding-right: 4px; align-self: center; }
.stats-heatmap-cell {
  width: 14px; height: 14px;
  border-radius: 2px;
  background: var(--border);
  display: inline-block;
}
.stats-heatmap-step-0 { background: var(--border); opacity: 0.4; }
.stats-heatmap-step-1 { background: rgba(249, 115, 22, 0.18); }
.stats-heatmap-step-2 { background: rgba(249, 115, 22, 0.36); }
.stats-heatmap-step-3 { background: rgba(249, 115, 22, 0.54); }
.stats-heatmap-step-4 { background: rgba(249, 115, 22, 0.74); }
.stats-heatmap-step-5 { background: rgba(249, 115, 22, 0.95); }
.stats-heatmap-legend { display: flex; align-items: center; gap: 4px; font-size: 11px; }
.stats-heatmap-legend .stats-heatmap-cell { width: 12px; height: 12px; }

/* Vendor sparklines */
.stats-sparkline-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.stats-sparkline-row {
  display: grid;
  grid-template-columns: 1fr auto 56px;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 6px;
}
.stats-sparkline-row:nth-child(odd) { background: rgba(0, 0, 0, 0.02); }
.stats-sparkline-name { font-weight: 600; font-size: 13px; }
.stats-sparkline-total { text-align: right; font-weight: 700; }

/* ─── Activity tab (Phase 5.28-C) ───────────────────────────────────── */
.activity-tab { display: flex; flex-direction: column; gap: 18px; }
.activity-tile { padding: 12px 8px 16px; }
.activity-host { padding: 0 4px; }
.activity-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.activity-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.04);
  font-size: 14px;
  color: var(--text);
}
.activity-source-auth  .activity-icon { background: rgba(37, 99, 235, 0.12);  color: #1d4ed8; }
.activity-source-slack .activity-icon { background: rgba(124, 58, 237, 0.12); color: #6d28d9; }
.activity-source-audit .activity-icon { background: rgba(249, 115, 22, 0.14); color: #b45309; }
.activity-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.activity-label { font-weight: 600; font-size: 14px; color: var(--text); }
.activity-actor { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.activity-archived {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(148, 163, 184, 0.2);
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 6px;
  font-weight: 700;
  vertical-align: middle;
}
.activity-empty { padding: 24px 8px; color: var(--muted); text-align: center; }
.activity-more-row { display: flex; justify-content: center; margin-top: 12px; }


/* ─── Identity locked-row (Phase 5.34-G) ─────────────────────────── */
.identity-locked-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f9fafc;
  min-height: 42px;
}
.identity-locked-value {
  font-size: 15px;
  color: var(--text);
  word-break: break-word;
  flex: 1 1 auto;
  min-width: 0;
}
.identity-edit-btn {
  flex: 0 0 auto;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}
.identity-edit-btn:hover {
  background: var(--highlight);
  border-color: #c7daff;
}

/* ─── End Event button + modal (Phase 5.36) ──────────────────────────── */
.btn-end-event {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.btn-end-event:hover {
  background: #b81f1f;
  border-color: #b81f1f;
}
.btn-end-event-confirm {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.btn-end-event-confirm:hover { background: #b81f1f; border-color: #b81f1f; }
.btn-end-event-confirm[disabled] {
  background: #e9b8b8;
  border-color: #e9b8b8;
  color: #fff;
  cursor: not-allowed;
  opacity: 0.7;
}

.end-event-body { display: flex; flex-direction: column; gap: 10px; }
.end-event-bullets {
  margin: 0;
  padding-left: 18px;
  color: var(--ink, #1f2937);
  font-size: 14px;
  line-height: 1.5;
}
.end-event-bullets li { margin-bottom: 4px; }

.end-event-vendor-list {
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 220px;
  overflow-y: auto;
  background: #fff;
}
.end-event-vendor-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}
.end-event-vendor-row:last-child { border-bottom: none; }
.end-event-vendor-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.end-event-vendor-name {
  font-weight: 600;
  color: var(--ink, #1f2937);
  font-size: 14px;
}
.end-event-vendor-meta .small { font-size: 12px; }

.end-event-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}
.end-event-tag.tag-ok   { background: #ecfdf5; color: #065f46; }
.end-event-tag.tag-skip { background: #f1f5f9; color: #475569; }
.end-event-tag.tag-fail { background: #fef2f2; color: #991b1b; }

.end-event-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 4px 0;
}
.end-event-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px;
  background: #f8fafc;
  border-radius: 8px;
}
.end-event-stat b { font-size: 22px; font-weight: 700; color: var(--ink, #1f2937); }
.end-event-stat .muted { font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; }

#end-event-confirm {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  letter-spacing: 0.5px;
}
#end-event-confirm:focus { outline: 2px solid var(--primary); outline-offset: 1px; }

@media (max-width: 480px) {
  .end-event-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ─── Wrap-up audit-trail line (Phase 5.36 PR-4) ──── */
.lifecycle-audit-line {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 8px;
	font-size: 13px;
	color: var(--muted);
	flex-basis: 100%;
}
.lifecycle-audit-icon {
	display: inline-block;
	min-width: 14px;
	text-align: center;
	color: var(--muted);
}

/* ─── Phase 5.39 (Mock B): purchased-codes chip strip on Create-event ─── */
.code-chips {
  margin-top: 8px;
}
.code-chips-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.code-chips-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.code-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  line-height: 1.4;
}
.code-chip:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}
.code-chip.selected {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}
.code-chip-prefix {
  font-size: 12px;
  color: #1e293b;
  letter-spacing: 0.04em;
}

/* Tier-coded pills for chips. Mirror the existing .pill base. */
.pill-tier { text-transform: uppercase; }
.pill-tier-starter  { color: #475569; background: #f1f5f9; border-color: #e2e8f0; }
.pill-tier-standard { color: #1d4ed8; background: #dbeafe; border-color: #bfdbfe; }
.pill-tier-plus     { color: #6b21a8; background: #ede9fe; border-color: #ddd6fe; }
.pill-tier-pro      { color: #92400e; background: #fef3c7; border-color: #fde68a; }

.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ─── Mobile hamburger nav ────────────────────────────────────────────── */
.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  width: 40px;
  height: 40px;
  padding: 0;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
}
.nav-toggle:hover { background: rgba(255, 255, 255, 0.06); }
.nav-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.nav-toggle-bar {
  display: block;
  width: 18px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 21, 48, 0.55);
  backdrop-filter: blur(2px);
  z-index: 49;
}

@media (max-width: 720px) {
  .topbar { padding: 14px 16px; }
  .topbar-inner { gap: 12px; }
  .brand { font-size: 26px; }
  .brand-mark { height: 26px; width: auto; }

  .nav-toggle {
    display: inline-flex;
    margin-left: auto;
  }

  .topbar nav {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(80vw, 320px);
    background: linear-gradient(180deg, #0a1530, #0d1a3a);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 80px 14px 24px;
    transform: translateX(100%);
    transition: transform 0.22s ease;
    z-index: 50;
    box-shadow: -12px 0 24px rgba(0, 0, 0, 0.32);
  }
  .topbar nav[data-mobile-open="true"] {
    transform: translateX(0);
  }
  .topbar nav a {
    font-size: 16px;
    padding: 14px 16px;
    border-radius: 12px;
    width: 100%;
  }

  .nav-backdrop[data-visible="true"] {
    display: block;
  }
}

