:root {
  --bg: oklch(16% 0.03 250);
  --bg-1: oklch(20% 0.03 250);
  --bg-2: oklch(10% 0.03 250);
  --panel: oklch(18% 0.03 250 / 0.78);
  --panel-strong: oklch(16% 0.03 250 / 0.96);
  --panel-soft: oklch(100% 0 0 / 0.045);
  --border: oklch(100% 0 0 / 0.12);
  --text: oklch(92% 0.02 250);
  --muted: oklch(88% 0.02 250);
  --faint: oklch(53% 0.02 250);
  --accent: oklch(68% 0.15 250);
  --accent-2: oklch(85% 0.15 205);
  --success: oklch(82% 0.14 145);
  --danger: oklch(72% 0.17 25);
  --warning: oklch(84% 0.14 85);
  --shadow-none: 0 0 0 0 transparent;
  --shadow-focus-accent: 0 0 0 4px oklch(85% 0.15 205 / 0.12);
  --shadow-focus-primary: 0 0 0 3px oklch(68% 0.15 250 / 0.12);
  --shadow-surface: 0 28px 90px oklch(0% 0 0 / 0.30);
  --shadow-accent: 0 0 18px oklch(85% 0.15 205 / 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 10%, color-mix(in oklch, var(--accent) 24%, transparent), transparent 32%),
    radial-gradient(circle at 85% 0%, color-mix(in oklch, var(--accent-2) 14%, transparent), transparent 26%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg) 42%, var(--bg-2) 100%);
}

.admin-shell {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

.admin-hero,
.admin-card,
.status-card,
.metric-card {
  border: 1px solid var(--border);
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.82), rgba(8, 15, 29, 0.78));
  box-shadow: var(--shadow-surface);
}

.admin-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: start;
  padding: 30px;
  overflow: hidden;
  position: relative;
}

.admin-hero::after {
  content: "";
  position: absolute;
  inset: auto -80px -130px auto;
  width: 360px;
  height: 260px;
  border-radius: 999px;
  background: color-mix(in oklch, var(--accent) 16%, transparent);
  filter: blur(10px);
}

.hero-copy,
.admin-actions { position: relative; z-index: 1; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
p { margin-top: 0; }

h1 {
  margin-bottom: 12px;
  font-size: clamp(44px, 7vw, 76px);
  line-height: 0.92;
  letter-spacing: -0.07em;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  letter-spacing: -0.03em;
}

p {
  color: var(--muted);
  line-height: 1.55;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 15px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { border-color: rgba(79, 156, 249, 0.62); }
.btn:focus-visible { outline: 2px solid rgba(34, 211, 238, 0.72); outline-offset: 2px; }
.btn:disabled { cursor: progress; opacity: 0.55; }
.btn.primary { border-color: rgba(79, 156, 249, 0.64); background: linear-gradient(135deg, rgba(79, 156, 249, 0.30), rgba(34, 211, 238, 0.16)); }
.btn.ghost { background: rgba(255, 255, 255, 0.045); }
.btn.is-active { border-color: color-mix(in oklch, var(--accent-2) 58%, transparent); color: var(--accent-2); background: color-mix(in oklch, var(--accent-2) 10%, transparent); }

.status-card {
  margin: 18px 0;
  padding: 13px 16px;
  color: var(--muted);
  border-radius: 18px;
}

.status-card[data-state="error"] { color: var(--danger); border-color: rgba(248, 113, 113, 0.35); }
.status-card[data-state="success"] { color: var(--success); border-color: rgba(134, 239, 172, 0.32); }

.admin-auth-gate[hidden],
.admin-dashboard[hidden],
.admin-page[hidden] { display: none; }

.admin-auth-gate {
  min-height: calc(100vh - 68px);
  background: var(--bg);
}

.admin-auth-gate .login-shell {
  display: grid;
  grid-template-columns: minmax(0, 390px);
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 68px);
  gap: 46px;
  padding: 34px;
}

.admin-auth-gate .login-panel {
  width: 100%;
}

.admin-auth-gate .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 46px;
}

.admin-auth-gate .brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(34, 211, 238, 0.42);
  border-radius: 8px;
  background: rgba(34, 211, 238, 0.12);
  color: var(--accent-2);
  font-size: 15px;
  font-weight: 800;
  box-shadow: var(--shadow-accent);
}

.admin-auth-gate .brand-name,
.admin-auth-gate .brand-sub,
.admin-auth-gate .login-copy p,
.admin-auth-gate .login-copy h1,
.admin-auth-gate .field label,
.admin-auth-gate .field-error,
.admin-auth-gate .form-status {
  margin: 0;
}

.admin-auth-gate .brand-name {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.admin-auth-gate .brand-sub {
  margin-top: 2px;
  color: var(--faint);
  font-size: 11px;
}

.admin-auth-gate .login-copy {
  margin-bottom: 28px;
}

.admin-auth-gate .eyebrow {
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.admin-auth-gate .login-copy h1 {
  margin-top: 8px;
  color: var(--text);
  font-size: 34px;
  font-weight: 760;
  line-height: 1.1;
}

.admin-auth-gate .login-copy p:last-child {
  max-width: 32ch;
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.admin-auth-gate .login-form {
  display: grid;
  gap: 16px;
}

.admin-auth-gate .field {
  display: grid;
  gap: 7px;
}

.admin-auth-gate .field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.admin-auth-gate .field input {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  color: var(--text);
  outline: none;
  background: rgba(255, 255, 255, 0.055);
  padding: 0 13px;
}

.admin-auth-gate .field input:hover,
.admin-auth-gate .field input:focus {
  border-color: rgba(34, 211, 238, 0.58);
  background-color: rgba(255, 255, 255, 0.075);
  box-shadow: var(--shadow-focus-accent);
}

.admin-auth-gate .field input:disabled {
  border-color: rgba(148, 163, 184, 0.16);
  cursor: not-allowed;
  opacity: 1;
  background: rgba(15, 23, 42, 0.72);
  color: rgba(148, 163, 184, 0.36);
  box-shadow: var(--shadow-none);
  filter: grayscale(0.65) saturate(0.65);
}

.admin-auth-gate .field-error {
  min-height: 16px;
  color: var(--danger);
  font-size: 11px;
  line-height: 1.35;
}

.admin-auth-gate .submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(16, 185, 129, 0.38);
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.16);
  color: var(--success);
  cursor: pointer;
  font-size: 13px;
  font-weight: 760;
}

.admin-auth-gate .submit-btn:hover,
.admin-auth-gate .submit-btn:focus-visible {
  background: rgba(16, 185, 129, 0.24);
  border-color: rgba(16, 185, 129, 0.54);
  color: color-mix(in oklch, var(--success) 85%, white);
}

.admin-auth-gate .submit-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.admin-auth-gate .form-status {
  min-height: 19px;
  color: var(--success);
  font-size: 12px;
  line-height: 1.5;
}

.admin-auth-gate .form-status.is-error {
  color: var(--danger);
}

.invite-form {
  display: grid;
  gap: 12px;
  align-items: end;
}

.invite-form { grid-template-columns: minmax(220px, 1fr) 120px auto; }

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 11px 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}

input:focus { border-color: color-mix(in oklch, var(--accent) 72%, transparent); box-shadow: var(--shadow-focus-primary); }

.admin-page {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.access-page {
  grid-template-columns: 1fr;
}

.availability-card {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
}

.availability-actions {
  display: grid;
  justify-items: end;
  gap: 10px;
  min-width: 190px;
}

.availability-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid rgba(34, 211, 238, 0.24);
  border-radius: 999px;
  color: var(--accent-2);
  background: rgba(34, 211, 238, 0.08);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.availability-card .subtle { max-width: 34ch; text-align: right; }


.admin-card {
  padding: 22px;
  background: var(--panel-strong);
}

.invites-page { grid-template-columns: 1fr; }

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-pill.pending { color: var(--warning); border-color: color-mix(in oklch, var(--warning) 28%, transparent); }
.status-pill.accepted { color: var(--success); border-color: rgba(134, 239, 172, 0.28); }

td strong { display: block; }

td span,
.subtle {
  color: var(--muted);
  font-size: 12px;
}

.empty-state {
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  padding: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 14px 12px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--faint);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

td input { width: 112px; }
.admin-cap { color: var(--success); font-weight: 800; }
.run-toggle {
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
}
.run-toggle-cell { width: 42px; text-align: center; }
.user-runs-row > td { background: rgba(255, 255, 255, 0.025); }
.runs-table { min-width: 720px; }
.runs-table th,
.runs-table td { padding: 10px 12px; }
.delete-question {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(248, 113, 113, 0.32);
  border-radius: 999px;
  color: var(--danger);
  background: rgba(248, 113, 113, 0.08);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.delete-question:hover { background: rgba(248, 113, 113, 0.16); }
.delete-question:disabled { cursor: progress; opacity: 0.55; }

@media (max-width: 900px) {
  .admin-hero,
  .admin-page,
  .invites-page,
  .access-page { grid-template-columns: 1fr; }
  .admin-actions { justify-content: flex-start; }
  .invite-form { grid-template-columns: 1fr; }
  .availability-card { flex-direction: column; }
  .availability-actions { justify-items: start; min-width: 0; }
  .availability-card .subtle { text-align: left; }
}

@media (max-width: 600px) {
  .admin-shell { width: min(100% - 24px, 1240px); padding-top: 18px; }
  h1 { font-size: 42px; }
}
