:root {
  color-scheme: light;
  --indigo: #24215E;
  --aqua: #80DEEA;
  --paper: #F2FBFC;
  --ink: #1D2350;
  --muted: #59647C;
  --line: #D5E9EC;
  --white: #fff;
  --green: #087443;
  --green-bg: #E8F6EF;
  --amber: #925B00;
  --amber-bg: #FFF5DB;
  --red: #B42318;
  --red-bg: #FFF0EE;
  font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; color: var(--ink); background: var(--paper); line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #C47A00; outline-offset: 3px; }
[hidden] { display: none !important; }

.skip-link {
  position: fixed; z-index: 100; top: -80px; left: 14px; padding: 10px 16px;
  color: #fff; background: var(--indigo); border-radius: 8px;
}
.skip-link:focus { top: 12px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.brand { display: inline-flex; align-items: center; gap: 11px; min-width: 0; color: var(--indigo); font-weight: 750; }
.brand img { display: block; width: 43px; height: 41px; object-fit: contain; }
.brand-divider { display: block; width: 1px; height: 28px; background: #D4D9E7; }
.brand-label { font-size: 14px; white-space: nowrap; }
.back-link, .sidebar-back { color: var(--muted); font-size: 13px; font-weight: 600; }
.back-link:hover, .sidebar-back:hover { color: var(--indigo); }

.gate-wrap { min-height: 100vh; display: flex; flex-direction: column; }
.gate-header {
  width: 100%; min-height: 76px; padding: 13px clamp(18px, 4vw, 56px);
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  background: var(--white); border-bottom: 1px solid var(--line);
}
.gate-main { width: min(100% - 32px, 520px); margin: auto; padding: 44px 0 52px; }
.gate-card {
  padding: clamp(25px, 5vw, 40px); background: var(--white); border: 1px solid var(--line);
  border-radius: 20px; box-shadow: 0 18px 48px rgba(36, 33, 94, .08);
}
.gate-kicker, .eyebrow, .topbar-eyebrow {
  display: flex; align-items: center; gap: 9px; color: #4C5382; font-size: 11px;
  font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase;
}
.secure-dot { width: 8px; height: 8px; flex: none; display: inline-block; border-radius: 50%; background: #36A77A; box-shadow: 0 0 0 3px rgba(54, 167, 122, .12); }
.gate-card h1 { margin: 17px 0 8px; color: var(--indigo); font-size: clamp(26px, 5vw, 34px); line-height: 1.18; letter-spacing: -.6px; }
.gate-intro, .gate-state p { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.gate-state { margin-top: 24px; }
.gate-state[hidden] { display: none; }
.gate-state .button { margin: 0 8px 8px 0; }
.gate-alert, .app-alert {
  margin: 18px 0 0; padding: 12px 14px; border: 1px solid #F3C5C0; border-radius: 10px;
  color: var(--red); background: var(--red-bg); font-size: 13px; overflow-wrap: anywhere;
}
.gate-note { min-height: 20px; margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.gate-footnote { margin: 18px 8px 0; color: var(--muted); font-size: 12px; text-align: center; }
.spinner {
  display: inline-block; width: 17px; height: 17px; margin-right: 8px; vertical-align: -4px;
  border: 2px solid #D7E1E9; border-top-color: var(--indigo); border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.button {
  min-height: 39px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 14px; border: 1px solid transparent; border-radius: 9px;
  font-size: 13px; line-height: 1.25; font-weight: 700; cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.button-primary { color: #fff; background: var(--indigo); border-color: var(--indigo); }
.button-primary:hover:not(:disabled) { background: #322F78; }
.button-secondary { color: var(--indigo); background: #EEF9FA; border-color: #B9E8ED; }
.button-secondary:hover:not(:disabled) { background: #E0F5F8; }
.button-quiet { color: #4F5874; background: #fff; border-color: var(--line); }
.button-quiet:hover:not(:disabled) { color: var(--indigo); background: #F7FBFC; border-color: #B6C9D5; }
.button-outline { color: var(--indigo); background: #fff; border-color: #B9C7D8; white-space: nowrap; }
.button-outline:hover:not(:disabled) { background: #F4FAFB; border-color: var(--indigo); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 232px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; min-height: 550px; display: flex; flex-direction: column;
  padding: 25px 16px 18px; background: var(--indigo); color: #fff;
}
.sidebar-brand { padding: 0 4px 29px; color: #fff; }
.sidebar-brand .brand-divider { background: rgba(255,255,255,.25); }
.sidebar-brand .brand-label { color: #EFFBFC; }
.sidebar-section-label { padding: 0 12px 9px; color: #AEB4D2; font-size: 10px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; }
.sidebar-link { min-height: 42px; display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px; color: #E7E8F4; font-size: 13px; font-weight: 650; }
.sidebar-link.active { color: var(--indigo); background: var(--aqua); }
.nav-mark { width: 21px; height: 21px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 6px; font-size: 11px; font-weight: 800; }
.sidebar-spacer { flex: 1; }
.sidebar-back { padding: 13px 9px 17px; border-bottom: 1px solid rgba(255,255,255,.15); color: #D5D7E9; }
.sidebar-back span { margin-left: 5px; }
.sidebar-security { display: flex; align-items: center; gap: 9px; padding: 15px 9px 0; color: #B9BDD4; font-size: 11px; }
.sidebar-security .secure-dot { width: 7px; height: 7px; }

.main-area { min-width: 0; }
.topbar {
  min-height: 68px; padding: 11px clamp(18px, 3.4vw, 46px); display: flex; align-items: center;
  justify-content: space-between; gap: 18px; background: #fff; border-bottom: 1px solid var(--line);
}
.topbar-context { display: flex; align-items: center; gap: 16px; min-width: 0; }
.topbar-eyebrow { color: #777E9B; font-size: 10px; letter-spacing: 1px; white-space: nowrap; }
.topbar-user { max-width: min(42vw, 460px); overflow: hidden; color: var(--indigo); font-size: 13px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.logout-button { min-height: 35px; }
.content { width: min(100%, 1460px); margin: 0 auto; padding: 30px clamp(18px, 3.4vw, 46px) 24px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 23px; }
.eyebrow { margin: 0 0 8px; color: #4D5381; font-size: 10px; letter-spacing: 1.3px; }
.page-heading h1 { margin: 0; color: var(--indigo); font-size: clamp(27px, 3vw, 35px); line-height: 1.17; letter-spacing: -.9px; }
.page-subtitle { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.refresh-button { flex: none; min-height: 38px; }
.app-alert { margin: -3px 0 17px; }
.email-config {
  display: flex; align-items: flex-start; gap: 11px; margin: 0 0 17px; padding: 12px 15px;
  border: 1px solid #C8D6E6; border-radius: 11px; color: #35435F; background: #F0F5FB; font-size: 12px;
}
.email-config p { margin: 0; overflow-wrap: anywhere; }
.email-config.config-unconfigured { color: var(--amber); background: var(--amber-bg); border-color: #F0D99B; }
.config-icon { flex: none; width: 18px; height: 18px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 50%; font-size: 11px; font-weight: 800; }

.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; margin-bottom: 18px; }
.summary-card { min-width: 0; padding: 16px 18px 14px; border: 1px solid var(--line); border-radius: 13px; background: #fff; box-shadow: 0 2px 8px rgba(36,33,94,.025); }
.summary-label { color: #626D83; font-size: 11px; font-weight: 700; }
.summary-value { display: block; margin-top: 8px; color: var(--indigo); font-size: 31px; line-height: 1; font-weight: 760; letter-spacing: -.7px; font-variant-numeric: tabular-nums; }
.summary-foot { margin-top: 8px; color: #798398; font-size: 10px; }
.notification-metrics { display: flex; align-items: flex-end; gap: 27px; margin-top: 4px; }
.notification-metrics > div { display: flex; align-items: baseline; gap: 7px; }
.compact-value { margin: 0; font-size: 27px; }
.metric-caption { color: #717D91; font-size: 11px; }

.directory-card { border: 1px solid var(--line); border-radius: 15px; background: #fff; box-shadow: 0 5px 22px rgba(36,33,94,.035); overflow: hidden; }
.directory-head { padding: 19px 20px 14px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.directory-head h2 { margin: 0; color: var(--indigo); font-size: 17px; line-height: 1.35; }
.directory-subtitle { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.directory-head .button { min-height: 36px; padding: 7px 11px; font-size: 11px; }
.filters {
  display: grid; grid-template-columns: minmax(210px, 1.4fr) minmax(200px, 1fr) minmax(145px, .7fr) auto;
  align-items: end; gap: 11px; padding: 15px 20px 17px; border-top: 1px solid #EEF3F5; border-bottom: 1px solid #E8EFF2; background: #FBFDFE;
}
.filters label { display: block; margin: 0 0 5px; color: #556079; font-size: 10px; font-weight: 750; }
.search-control { position: relative; }
.search-icon { position: absolute; top: 50%; left: 11px; color: #8792A5; font-size: 19px; line-height: 1; transform: translateY(-55%); pointer-events: none; }
.filters input, .filters select {
  width: 100%; height: 38px; padding: 8px 10px; border: 1px solid #CFDBE3; border-radius: 8px;
  color: var(--ink); background: #fff; font-size: 11px; outline: none;
}
.filters input { padding-left: 33px; }
.filters input:focus, .filters select:focus { border-color: #5A6F9B; box-shadow: 0 0 0 3px rgba(36,33,94,.08); }
.filters input::placeholder { color: #8A94A4; }
.filter-actions { display: flex; gap: 7px; }
.filter-actions .button { min-height: 38px; padding: 8px 12px; font-size: 11px; }
.clear-button { padding-inline: 10px !important; }
.table-status { min-height: 34px; padding: 8px 20px 5px; color: var(--muted); font-size: 11px; }
.table-status:empty { min-height: 7px; padding: 0; }
.table-wrap { max-width: 100%; overflow: auto; overscroll-behavior-inline: contain; }
.registrant-table { width: 100%; min-width: 1040px; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.registrant-table th { padding: 10px 12px; color: #647087; background: #F5F9FA; border-top: 1px solid #E7EEF1; border-bottom: 1px solid #E7EEF1; text-align: left; font-size: 9px; font-weight: 800; letter-spacing: .65px; text-transform: uppercase; }
.registrant-table th:first-child, .registrant-table td:first-child { padding-left: 20px; }
.registrant-table th:nth-child(1) { width: 13%; }
.registrant-table th:nth-child(2) { width: 18%; }
.registrant-table th:nth-child(3) { width: 16%; }
.registrant-table th:nth-child(4) { width: 20%; }
.registrant-table th:nth-child(5) { width: 13%; }
.registrant-table th:nth-child(6) { width: 13%; }
.registrant-table th:nth-child(7) { width: 7%; }
.registrant-table td { padding: 13px 12px; color: #39445E; border-bottom: 1px solid #EEF2F4; vertical-align: top; font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
.registrant-table tbody tr:last-child > td { border-bottom: 1px solid #E8EEF0; }
.cell-primary { display: block; color: #252E4F; font-weight: 700; }
.cell-secondary { display: block; margin-top: 3px; color: #778197; font-size: 10px; }
.contact-email { display: block; color: #343E5B; }
.ai-answer { display: -webkit-box; overflow: hidden; line-clamp: 3; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.date-text { color: #4B5670; font-variant-numeric: tabular-nums; }
.status-badge { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 8px; border-radius: 999px; font-size: 9px; font-weight: 750; white-space: nowrap; }
.status-badge::before { width: 6px; height: 6px; flex: none; content: ""; border-radius: 50%; background: currentColor; }
.status-sent { color: var(--green); background: var(--green-bg); }
.status-pending, .status-sending { color: var(--amber); background: var(--amber-bg); }
.status-failed { color: var(--red); background: var(--red-bg); }
.status-unconfigured { color: #59647C; background: #EDF1F4; }
.retry-button { display: block; min-height: 27px; margin-top: 6px; padding: 4px 8px; font-size: 9px; }
.details-cell { text-align: right; }
.row-details { text-align: left; }
.row-details summary { display: inline-flex; align-items: center; gap: 5px; color: #4A5480; cursor: pointer; font-size: 10px; font-weight: 700; }
.row-details summary:hover { color: var(--indigo); }
.details-panel {
  min-width: 260px; max-width: min(510px, 78vw); margin-top: 10px; padding: 12px;
  border: 1px solid var(--line); border-radius: 9px; background: #F9FCFD;
}
.details-list { display: grid; grid-template-columns: minmax(100px, .45fr) minmax(140px, 1fr); gap: 7px 14px; margin: 0; }
.details-list dt { color: #727E92; font-size: 10px; font-weight: 650; }
.details-list dd { min-width: 0; margin: 0; color: #343E59; font-size: 10px; overflow-wrap: anywhere; }
.empty-row td { padding: 33px 20px; color: #68748A; text-align: center; font-size: 12px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 20px; }
.pagination-count, .page-indicator { color: #69758A; font-size: 10px; }
.pagination-controls { display: flex; align-items: center; gap: 10px; }
.page-button { min-height: 32px; padding: 6px 10px; font-size: 10px; }
.content-footer { margin: 14px 2px 0; color: #8791A1; font-size: 10px; }

@media (max-width: 1150px) {
  .app-shell { grid-template-columns: 205px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .sidebar-brand { gap: 8px; }
  .filters { grid-template-columns: minmax(190px, 1.3fr) minmax(170px, 1fr) minmax(135px, .75fr); }
  .filter-actions { grid-column: 1 / -1; justify-content: flex-end; }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; min-height: 0; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0 12px; padding: 10px 17px; }
  .sidebar-brand { padding: 0; }
  .sidebar-brand img { width: 36px; height: 35px; }
  .sidebar-brand .brand-label { font-size: 12px; }
  .sidebar-brand .brand-divider { height: 23px; }
  .sidebar-section-label, .sidebar-spacer, .sidebar-security { display: none; }
  .sidebar-link { grid-column: 2; grid-row: 1; min-height: 35px; padding: 6px 9px; font-size: 11px; }
  .nav-mark { width: 18px; height: 18px; }
  .sidebar-back { grid-column: 1 / -1; padding: 7px 2px 0; border: 0; font-size: 10px; }
  .topbar { min-height: 56px; padding-inline: 17px; }
  .topbar-context { gap: 10px; }
  .topbar-eyebrow { font-size: 9px; }
  .topbar-user { max-width: 40vw; font-size: 11px; }
  .logout-button { min-height: 32px; padding: 6px 10px; font-size: 11px; }
  .content { padding: 23px 16px 20px; }
  .summary-grid { gap: 9px; }
  .summary-card { padding: 13px 12px 11px; }
  .summary-label { font-size: 10px; }
  .summary-value { font-size: 27px; }
  .compact-value { font-size: 23px; }
  .metric-caption { font-size: 9px; }
  .notification-metrics { gap: 14px; }
  .directory-head { padding: 16px 15px 12px; }
  .filters { padding: 13px 15px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .filter-search { grid-column: 1 / -1; }
  .filter-actions { grid-column: 1 / -1; }
  .table-status { padding-inline: 15px; }
  .registrant-table th:first-child, .registrant-table td:first-child { padding-left: 15px; }
  .pagination { padding: 11px 15px; }
}
@media (max-width: 500px) {
  .gate-header { min-height: 66px; padding-inline: 14px; }
  .gate-header .brand img { width: 37px; height: 36px; }
  .brand-label { font-size: 12px; }
  .back-link { font-size: 10px; white-space: nowrap; }
  .gate-main { width: min(100% - 24px, 520px); padding: 26px 0; }
  .gate-card { padding: 23px 20px; border-radius: 16px; }
  .page-heading { align-items: flex-start; gap: 12px; }
  .page-heading h1 { font-size: 27px; }
  .page-subtitle { max-width: 300px; font-size: 11px; }
  .refresh-button { min-height: 34px; padding: 7px 9px; font-size: 11px; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .summary-card:last-child { grid-column: 1 / -1; }
  .summary-notifications { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 10px; }
  .summary-notifications .summary-label { grid-column: 1 / -1; }
  .summary-notifications .notification-metrics { margin-top: 8px; }
  .summary-notifications .summary-foot { margin-top: 0; text-align: right; }
  .directory-head { align-items: flex-start; gap: 9px; }
  .directory-subtitle { max-width: 240px; }
  .directory-head .button { max-width: 125px; white-space: normal; text-align: center; }
  .pagination { align-items: flex-start; flex-direction: column; gap: 9px; }
  .pagination-controls { align-self: stretch; justify-content: space-between; gap: 6px; }
  .page-indicator { white-space: nowrap; }
  .page-button { padding-inline: 8px; }
  .topbar-context { display: block; }
  .topbar-user { display: block; max-width: 55vw; margin-top: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
