/* Apollo-style shell — palette, typography, sidebar, top bar, KPI tiles,
   filter accordions, data tables, side drawers. The aesthetic is dense,
   left-filter-driven, with strong active states (black background on the
   selected sidebar item) and money as the headline. */

:root {
  /* Apollo palette */
  --bg-app:          #FAF9FC;        /* main content background — pale lavender */
  --bg-sidebar:      #FFFFFF;
  --bg-card:         #FFFFFF;
  --bg-soft:         #F5F4F0;        /* cream — for hover, light fills */
  --bg-hover:        #F9FAFB;
  --rule:            #E5E7EB;
  --rule-strong:     #D1D5DB;

  --fg-primary:      #0A0A0A;        /* primary text + active nav bg */
  --fg-secondary:    #1F1F1F;        /* body */
  --fg-muted:        #6B7280;        /* secondary */
  --fg-faint:        #9CA3AF;        /* metadata */

  --accent-teal:     #0F4C3A;        /* brand */
  --accent-yellow:   #F5E50A;        /* primary CTA */
  --accent-yellow-h: #E5D509;
  --accent-purple:   #A78BFA;        /* AI features */
  --accent-purple-soft: #EDE9FE;
  --accent-green:    #10B981;        /* verified / "Access email" buttons */
  --accent-mint:     #D1FAE5;
  --accent-blue:     #3B82F6;
  --accent-blue-soft:#DBEAFE;
  --accent-rose:     #DC2626;
  --accent-rose-soft:#FEE2E2;
  --accent-amber:    #D97706;
  --accent-amber-soft:#FEF3C7;

  --tier-1:          #6D28D9;
  --tier-1-soft:     #EDE9FE;
  --tier-2:          #0D9488;
  --tier-2-soft:     #CCFBF1;
  --tier-3:          #6B7280;
  --tier-3-soft:     #F3F4F6;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg-app); color: var(--fg-primary);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--fg-muted); }
.faint { color: var(--fg-faint); }
a { color: inherit; text-decoration: none; }

/* ============================================================
   App grid: sidebar (240px) | content; top bar pinned across
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
.app::before {
  /* 3px deep teal accent stripe pinned to the top of the viewport */
  content: ""; position: fixed; top: 0; left: 0; right: 0; height: 3px;
  background: var(--accent-teal); z-index: 100;
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--rule);
  padding: 18px 10px 16px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 8px 18px;
}
.brand .logo {
  width: 24px; height: 24px; border-radius: 5px;
  background: var(--accent-teal); color: white;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
}
.brand .name { font-weight: 600; font-size: 14px; }

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-section { margin-top: 14px; display: flex; flex-direction: column; gap: 1px; }
.nav-section-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--fg-faint); padding: 4px 10px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 6px;
  color: var(--fg-secondary); font-size: 13px;
  cursor: pointer; text-decoration: none;
}
.nav-item:hover { background: var(--bg-soft); }
.nav-item.active { background: var(--fg-primary); color: white; font-weight: 500; }
.nav-item .ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; color: currentColor; opacity: 0.85;
}
.nav-item.active .ico { opacity: 1; }
.nav-item .label { flex: 1; }
.nav-item .count {
  font-size: 11px; color: var(--fg-faint);
  background: var(--bg-soft); padding: 1px 6px; border-radius: 8px;
  min-width: 20px; text-align: center;
}
.nav-item.active .count { color: rgba(255,255,255,0.7); background: rgba(255,255,255,0.12); }

.sidebar-footer { margin-top: auto; padding: 14px 10px 0; }
.sidebar-version {
  font-family: ui-monospace,Menlo,Consolas,monospace;
  font-size: 11px; color: var(--fg-faint);
}

/* ============================================================
   Top bar
   ============================================================ */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--rule);
  padding: 8px 24px;
  display: flex; align-items: center; gap: 14px;
}
.topbar .search {
  flex: 1; max-width: 520px;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-soft);
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px; color: var(--fg-muted);
}
.topbar .search:focus-within { background: white; border-color: var(--rule-strong); }
.topbar .search input {
  flex: 1; border: 0; background: transparent; outline: 0;
  font-size: 13px; font-family: inherit; color: var(--fg-primary);
}
.topbar .search .kbd {
  background: white; border: 1px solid var(--rule);
  border-radius: 4px; padding: 1px 6px;
  font-family: ui-monospace,Menlo,Consolas,monospace; font-size: 10px;
  color: var(--fg-muted);
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.btn-ai {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-purple-soft); color: #5b21b6;
  border: 1px solid transparent; border-radius: 6px;
  padding: 5px 11px; font-size: 13px; font-weight: 500;
  cursor: pointer; text-decoration: none;
}
.btn-ai:hover { background: #e0d7fa; }

.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-teal); color: white;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12px;
}

/* ============================================================
   Page chrome
   ============================================================ */
.page {
  padding: 28px 32px 80px;
}
.page-title { font-size: 28px; font-weight: 700; color: var(--fg-primary); margin: 0; }
.page-sub { color: var(--fg-muted); font-size: 14px; margin: 8px 0 24px; max-width: 720px; }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 4px;
}

.crumbs { font-size: 13px; color: var(--fg-muted); margin-bottom: 6px; }
.crumbs a { color: var(--fg-muted); }
.crumbs a:hover { color: var(--fg-primary); }
.crumbs .sep { margin: 0 6px; color: var(--fg-faint); }
.crumbs .current { color: var(--fg-primary); font-weight: 500; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 6px;
  font-size: 13px; font-weight: 500;
  border: 1px solid var(--rule-strong);
  background: white; color: var(--fg-primary);
  cursor: pointer; transition: all 80ms;
  text-decoration: none;
}
.btn:hover { background: var(--bg-soft); }
.btn-primary {
  background: var(--accent-yellow); color: var(--fg-primary);
  border-color: var(--accent-yellow);
}
.btn-primary:hover { background: var(--accent-yellow-h); }
.btn-dark {
  background: var(--fg-primary); color: white; border-color: var(--fg-primary);
}
.btn-dark:hover { background: #000; }
.btn-confirm {
  background: var(--accent-green); color: white; border-color: var(--accent-green);
}
.btn-confirm:hover { background: #047857; }
.btn-danger { color: var(--accent-rose); }
.btn-danger:hover { background: var(--accent-rose-soft); border-color: var(--accent-rose); }
.btn-sm { padding: 3px 9px; font-size: 12px; }
.btn-icon-only {
  padding: 5px 7px; color: var(--fg-muted);
}
.btn-icon-only:hover { color: var(--fg-primary); }

.btn-pill {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--accent-mint); color: var(--accent-green);
  border: 0; border-radius: 14px; padding: 3px 11px;
  font-size: 12px; font-weight: 500; cursor: pointer;
}
.btn-pill:hover { background: #bbf7d0; }
.btn-pill-teal {
  background: var(--tier-2-soft); color: var(--tier-2);
}
.btn-pill-teal:hover { background: #99f6e4; }

/* ============================================================
   KPI tiles
   ============================================================ */
.kpi-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px; background: var(--rule);
  border: 1px solid var(--rule); border-radius: 8px; overflow: hidden;
  margin-bottom: 20px;
}
.kpi { background: var(--bg-card); padding: 14px 18px; }
.kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--fg-muted); margin-bottom: 4px; }
.kpi-value { font-size: 22px; font-weight: 700; }
.kpi-sub { font-size: 12px; color: var(--fg-faint); margin-top: 2px; }

/* KPI as tab — used on the events list ("All | Active | Closed") */
.kpi-tabs {
  display: flex; align-items: stretch;
  border: 1px solid var(--rule); border-radius: 8px; overflow: hidden;
  background: var(--bg-card); margin-bottom: 14px;
  width: fit-content;
}
.kpi-tab {
  padding: 8px 18px; border-right: 1px solid var(--rule);
  cursor: pointer; text-decoration: none; color: inherit;
}
.kpi-tab:last-child { border-right: 0; }
.kpi-tab.active { background: var(--accent-blue-soft); }
.kpi-tab .kpi-label { font-size: 10px; }
.kpi-tab .kpi-value { font-size: 16px; }

/* ============================================================
   View controls bar — sits above the table
   ============================================================ */
.view-bar {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.view-bar .left { display: flex; align-items: center; gap: 8px; flex: 1; }
.view-bar .right { display: flex; align-items: center; gap: 8px; }
.view-bar input.search-table {
  border: 1px solid var(--rule-strong); border-radius: 6px;
  padding: 5px 10px; font-size: 13px; font-family: inherit;
  background: white;
  min-width: 180px;
}

/* ============================================================
   Two-column data layout: filter sidebar + main table
   ============================================================ */
.data-shell {
  display: grid; grid-template-columns: 240px 1fr;
  gap: 18px; align-items: start;
}
@media (max-width: 1100px) { .data-shell { grid-template-columns: 1fr; } }

.filter-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--rule); border-radius: 8px;
  padding: 4px 0;
  position: sticky; top: 60px;
  max-height: calc(100vh - 80px); overflow-y: auto;
}
.filter-section { border-bottom: 1px solid var(--rule); }
.filter-section:last-child { border-bottom: 0; }
.filter-section-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  font-size: 13px; cursor: pointer; user-select: none;
}
.filter-section-header .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-blue); display: none;
}
.filter-section.has-value .filter-section-header .dot { display: inline-block; }
.filter-section-header .ico { width: 16px; text-align: center; color: var(--fg-muted); }
.filter-section-header .label { flex: 1; }
.filter-section-header .badge-beta {
  background: var(--accent-mint); color: var(--accent-green);
  font-size: 10px; padding: 1px 6px; border-radius: 8px; font-weight: 600;
}
.filter-section-header .lock { color: var(--fg-faint); font-size: 12px; }
.filter-section-header .chev { color: var(--fg-faint); font-size: 11px; transition: transform 100ms; }
.filter-section.collapsed .chev { transform: rotate(-90deg); }
.filter-section.collapsed .filter-section-body { display: none; }
.filter-section-body { padding: 0 14px 12px; }

.filter-option {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0; font-size: 13px;
  cursor: pointer;
}
.filter-option input[type=checkbox], .filter-option input[type=radio] {
  margin: 0; cursor: pointer;
}
.filter-option .label { flex: 1; }
.filter-option .count { color: var(--fg-muted); font-size: 12px; }

.filter-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--accent-blue-soft); color: var(--accent-blue);
  padding: 2px 8px; border-radius: 12px;
  font-size: 12px; margin: 4px 4px 0 0;
}
.filter-chip .x { cursor: pointer; opacity: 0.7; }
.filter-chip .x:hover { opacity: 1; }

/* ============================================================
   Data tables (Apollo-style dense)
   ============================================================ */
table.data { width: 100%; border-collapse: collapse; background: var(--bg-card); border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
table.data thead th {
  text-align: left; font-weight: 500; color: var(--fg-muted);
  font-size: 11px; letter-spacing: 0.03em; text-transform: uppercase;
  padding: 9px 12px; border-bottom: 1px solid var(--rule);
  background: var(--bg-card);
  white-space: nowrap;
}
table.data thead th.right { text-align: right; }
table.data tbody tr { border-bottom: 1px solid var(--rule); cursor: pointer; }
table.data tbody tr:last-child { border-bottom: 0; }
table.data tbody tr:hover { background: var(--bg-hover); }
table.data tbody td { padding: 10px 12px; font-size: 13px; vertical-align: middle; }
table.data tbody td.right { text-align: right; font-variant-numeric: tabular-nums; }

.cell-attendee { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.cell-attendee .av {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg-soft); color: var(--fg-primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; flex-shrink: 0;
}
.cell-attendee .name { font-weight: 500; }
.cell-attendee .role { color: var(--fg-muted); font-size: 12px; }

/* ============================================================
   Pills + badges
   ============================================================ */
.pill {
  display: inline-block; padding: 2px 8px; border-radius: 12px;
  font-size: 11px; font-weight: 500; line-height: 1.4;
  white-space: nowrap;
}
.pill-tier_1   { background: var(--tier-1-soft);  color: var(--tier-1); }
.pill-tier_2   { background: var(--tier-2-soft);  color: var(--tier-2); }
.pill-tier_3   { background: var(--tier-3-soft);  color: var(--tier-3); }
.pill-tier_none { color: var(--fg-faint); font-style: italic; }
.pill-pending  { background: var(--accent-amber-soft); color: var(--accent-amber); }
.pill-confirmed{ background: var(--accent-mint);    color: var(--accent-green); }
.pill-rejected { background: var(--accent-rose-soft);color: var(--accent-rose); }
.pill-modified { background: var(--accent-purple-soft); color: #5b21b6; }
.pill-skipped  { background: var(--bg-soft); color: var(--fg-muted); }
.pill-info     { background: var(--accent-blue-soft); color: var(--accent-blue); }

.tier-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 6px;
}
.tier-dot.tier_1 { background: var(--tier-1); }
.tier-dot.tier_2 { background: var(--tier-2); }
.tier-dot.tier_3 { background: var(--tier-3); }
.tier-dot.insufficient_data { background: transparent; border: 1.5px dashed var(--fg-faint); }

/* Confidence indicator: three dots */
.conf-dots {
  display: inline-flex; gap: 2px; vertical-align: middle;
  margin-left: 4px;
}
.conf-dots .d {
  width: 5px; height: 5px; border-radius: 50%; background: var(--rule);
}
.conf-dots .d.on { background: var(--accent-teal); }

/* RSVP and action accent text colors (used inline) */
.rsvp-Confirmed { color: var(--accent-green); font-weight: 500; }
.rsvp-Pending   { color: var(--fg-muted); }
.rsvp-Declined  { color: var(--accent-rose); }
.rsvp-No-show   { color: var(--accent-rose); }
.action-PushHard { color: var(--accent-rose); font-weight: 500; }
.action-Nurture  { color: var(--accent-amber); }
.action-Deflect  { color: var(--fg-muted); }
.action-Skip     { color: var(--fg-faint); }

/* ============================================================
   Side drawer
   ============================================================ */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.25); z-index: 50;
  display: none;
}
.drawer-backdrop.open { display: block; }
.drawer {
  position: fixed; right: 0; top: 0; bottom: 0;
  width: min(60vw, 700px);
  background: var(--bg-app); border-left: 1px solid var(--rule);
  z-index: 51; overflow-y: auto;
  transform: translateX(100%); transition: transform 160ms ease-out;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  padding: 18px 24px;
  border-bottom: 1px solid var(--rule);
  background: white;
  position: sticky; top: 0; z-index: 1;
}
.drawer-head .av {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--bg-soft); color: var(--fg-primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 600;
}
.drawer-body { padding: 18px 24px 60px; }

.hero-money { font-size: 32px; font-weight: 700; color: var(--accent-teal); }
.hero-money-sub { font-size: 12px; color: var(--fg-muted); }

.section { padding: 18px 0; border-bottom: 1px solid var(--rule); }
.section:last-child { border-bottom: 0; }
.section h2 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--fg-muted); font-weight: 500; margin: 0 0 12px; }

/* ============================================================
   Form
   ============================================================ */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.form-grid label { display: block; font-size: 12px; }
.form-grid label .lbl { color: var(--fg-muted); display: block; margin-bottom: 4px; }
.form-grid input, .form-grid select, .form-grid textarea {
  display: block; width: 100%;
  border: 1px solid var(--rule-strong); border-radius: 6px;
  padding: 6px 10px; font-size: 13px; font-family: inherit;
  background: var(--bg-card);
}
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus {
  outline: 2px solid var(--accent-blue); outline-offset: -1px; border-color: transparent;
}

/* ============================================================
   Empty state card
   ============================================================ */
.empty-card {
  border: 1px solid var(--rule); border-radius: 10px;
  padding: 36px; text-align: center; max-width: 560px; margin: 12px auto;
  background: var(--bg-card);
}
.empty-card .h { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.empty-card .p { color: var(--fg-muted); font-size: 13px; margin-bottom: 18px; max-width: 460px; margin-left: auto; margin-right: auto; }
.empty-card .illustration {
  width: 64px; height: 64px; margin: 0 auto 14px;
  background: var(--bg-soft); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}

/* ============================================================
   Flow ribbon + bulk action bar (carried over from previous PR)
   ============================================================ */
.flow-ribbon {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 0;
  border: 1px solid var(--rule); border-radius: 8px; overflow: hidden;
  background: var(--bg-card); margin-bottom: 18px;
}
.flow-stage { padding: 12px 14px; position: relative; border-right: 1px solid var(--rule); }
.flow-stage:last-child { border-right: 0; }
.flow-stage .flow-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-muted); font-weight: 500; }
.flow-stage .flow-count { font-size: 22px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.flow-stage.active .flow-count { color: var(--accent-blue); }
.flow-stage.zero .flow-count { color: var(--fg-faint); }

.bulk-bar {
  position: sticky; bottom: 16px;
  background: var(--fg-primary); color: white;
  border-radius: 8px; padding: 10px 16px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; z-index: 5;
}
.bulk-bar .btn { background: rgba(255,255,255,0.12); color: white; border-color: rgba(255,255,255,0.18); }
.bulk-bar .btn:hover { background: rgba(255,255,255,0.22); }

/* Helpers */
.row { display: flex; align-items: center; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.gap-16 { gap: 16px; }
.mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.hidden { display: none !important; }
