/* ============================================================
   Admin Console — dark slate + amber
   Self-contained. No external libraries.
   ============================================================ */

:root {
  --bg: #0b1120;
  --bg-raised: #0f172a;
  --panel: #16213a;
  --panel-2: #1e293b;
  --border: #2b3a55;
  --border-soft: #24324c;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --text-faint: #64748b;
  --accent: #f59e0b;
  --accent-hi: #fbbf24;
  --accent-ink: #1a1305;
  --accent-soft: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.12);
  --info: #38bdf8;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 10px 30px rgba(2, 6, 23, 0.55);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", "Cascadia Code", Consolas, "Liberation Mono", monospace;
  --sidenav-w: 232px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(245, 158, 11, 0.07), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(56, 189, 248, 0.05), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  padding: 1px 5px;
  border-radius: 5px;
  color: var(--accent-hi);
}

/* ---------- Login gate ---------- */

.login-gate {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(900px 500px at 70% 20%, rgba(245, 158, 11, 0.1), transparent 55%),
    var(--bg);
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.login-brand h1 { margin: 0; font-size: 18px; letter-spacing: -0.01em; }
.login-brand p { margin: 2px 0 0; color: var(--text-dim); font-size: 12.5px; }

.login-card label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.login-card input {
  width: 100%;
  margin-bottom: 12px;
}

.login-error {
  color: var(--danger);
  font-size: 13px;
  margin: 0 0 12px;
}

.login-hint {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--text-faint);
}

/* ---------- Brand mark ---------- */

.brand-mark {
  flex: none;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #d97706);
  color: var(--accent-ink);
  font-weight: 800;
  font-size: 18px;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}

/* ---------- Shell layout ---------- */

.shell {
  display: flex;
  min-height: 100vh;
}

.sidenav {
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  width: var(--sidenav-w);
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--bg-raised);
  border-right: 1px solid var(--border-soft);
  padding: 18px 12px;
  z-index: 20;
}

.sidenav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 18px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 14px;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 14px; }
.brand-text span { font-size: 11.5px; color: var(--text-dim); }

/* The list scrolls on its own so the foot (switch + sign out) can never be
   pushed below a short or zoomed-in window. */
.sidenav-nav { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: thin; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover { background: var(--panel-2); color: var(--text); }

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-hi);
  box-shadow: inset 2px 0 0 var(--accent);
}

.nav-ico { width: 18px; text-align: center; font-size: 11px; opacity: 0.9; }

.sidenav-foot {
  flex: none;
  border-top: 1px solid var(--border-soft);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ---- Learn | Buzz: which admin console the sidebar shows ----
   A segmented control at the top of the sidebar. It never leaves the page;
   leaving for the public site is the "Go to the site" links in the foot. */
.ws-switch {
  display: flex;
  gap: 3px;
  padding: 3px;
  margin: 0 0 12px;
  border-radius: 11px;
  background: var(--bg);
  border: 1px solid var(--border-soft);
}
.ws-tab {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 13.5px;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.ws-tab:hover { color: var(--text); background: var(--panel); }
.ws-tab.active {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.28);
}
.ws-tab:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }
.ws-tab .nav-count { margin-left: 0; }
.ws-tab.active .nav-count { background: var(--accent-ink); color: var(--accent-hi); }

.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group[hidden] { display: none; }
.nav-label {
  padding: 12px 12px 4px;
  color: var(--text-faint);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.nav-group .nav-label:first-child { padding-top: 2px; }
.nav-text { flex: 1 1 auto; min-width: 0; }
.nav-count {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-hi);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.nav-count[hidden] { display: none; }
.nav-item[aria-current="page"] .nav-count { background: var(--accent); color: var(--accent-ink); }

.page-kicker {
  margin: 0 0 2px;
  color: var(--accent-hi);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---- Leave the console: plain links to the public site ---- */
.site-exit { display: flex; flex-direction: column; gap: 6px; padding: 2px 2px 4px; }
.site-exit-label { color: var(--text-faint); font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding: 0 10px; }
.site-exit-links { display: flex; gap: 6px; }
.site-exit-link {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
}
.site-exit-link:hover { border-color: var(--text-dim); background: var(--panel-2); }
.site-exit-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.site-exit-link .exit-arrow { color: var(--text-faint); }
.nav-signout { justify-content: center; }

.main {
  flex: 1;
  min-width: 0;
  padding: 26px 30px 60px;
  outline: none;
}

/* ---------- Page header ---------- */

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

.page-head h2 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -0.02em;
}

.page-head .sub {
  margin: 4px 0 0;
  color: var(--text-dim);
  font-size: 13px;
}

.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  white-space: nowrap;
}

.btn:hover { background: #253451; border-color: #3b4d70; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); }

.btn-danger {
  background: transparent;
  border-color: rgba(239, 68, 68, 0.45);
  color: #f87171;
}
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--panel-2); color: var(--text); border-color: transparent; }

.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-block { width: 100%; }

.btn-icon {
  padding: 5px 8px;
  font-size: 13px;
  line-height: 1;
}

/* ---------- Inputs ---------- */

input[type="text"],
input[type="url"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="password"],
input[type="search"],
select,
textarea {
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

input.invalid, select.invalid, textarea.invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

textarea { resize: vertical; min-height: 90px; line-height: 1.55; }

select { cursor: pointer; }
select option { background: var(--bg-raised); }

::placeholder { color: var(--text-faint); }

/* ---------- Panels, cards ---------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel + .panel { margin-top: 18px; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(15, 23, 42, 0.45);
}

.panel-head h3 { margin: 0; font-size: 14px; font-weight: 600; }

.panel-body { padding: 16px; }

/* Stat cards */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 15px 16px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent);
  opacity: 0.85;
}

.stat-card .stat-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
}

.stat-card .stat-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 4px;
}

.stat-card .stat-note { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

.stat-card.stat-meta::before { background: var(--info); }
.stat-card.stat-meta .stat-value { font-size: 18px; }

/* ---------- Tables ---------- */

.table-wrap {
  overflow: auto;
  max-height: 62vh;
}

table.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table.grid thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #182238;
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table.grid tbody td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}

table.grid tbody tr:hover { background: rgba(30, 41, 59, 0.5); }
table.grid tbody tr:last-child td { border-bottom: none; }

table.grid td.num, table.grid th.num { text-align: right; }
table.grid td.actions { text-align: right; white-space: nowrap; }
table.grid td.actions .btn { margin-left: 6px; }

table.grid .cell-input { width: 100%; min-width: 90px; }
table.grid .cell-input.narrow { min-width: 54px; width: 70px; }

.row-title { font-weight: 600; }
.row-sub { color: var(--text-faint); font-size: 12px; }

.empty-state {
  padding: 38px 20px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13.5px;
}

/* Badges */

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-beginner { background: var(--success-soft); color: #4ade80; border-color: rgba(34, 197, 94, 0.35); }
.badge-intermediate { background: var(--accent-soft); color: var(--accent-hi); border-color: rgba(245, 158, 11, 0.35); }
.badge-advanced { background: var(--danger-soft); color: #f87171; border-color: rgba(239, 68, 68, 0.35); }
.badge-neutral { background: var(--panel-2); color: var(--text-dim); border-color: var(--border-soft); }

/* ---------- Toolbar (search / filters) ---------- */

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.toolbar input[type="search"] { min-width: 220px; flex: 1; max-width: 340px; }

/* ---------- Forms ---------- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px 14px;
}

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.span-12 { grid-column: span 12; }
.field.span-8 { grid-column: span 8; }
.field.span-6 { grid-column: span 6; }
.field.span-4 { grid-column: span 4; }
.field.span-3 { grid-column: span 3; }

.field > label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.field .req { color: var(--accent); }

.field-err {
  color: var(--danger);
  font-size: 12px;
  min-height: 0;
}
.field-err:empty { display: none; }

.form-section {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: rgba(15, 23, 42, 0.4);
  margin-top: 18px;
  overflow: hidden;
}

.form-section > .fs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(30, 41, 59, 0.55);
  border-bottom: 1px solid var(--border-soft);
}

.form-section > .fs-head h4 { margin: 0; font-size: 13px; font-weight: 600; }
.form-section > .fs-head .fs-hint { font-size: 12px; color: var(--text-faint); font-weight: 400; }
.form-section > .fs-body { padding: 14px; }

/* Repeatable rows */

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

.row-line {
  display: flex;
  gap: 8px;
  align-items: center;
}

.row-line input { flex: 1; min-width: 0; }
.row-line .row-remove { flex: none; }

.rows-add { margin-top: 10px; }

/* Tag input (chips) */

.tag-input {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 7px 9px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: text;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tag-input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.tag-input.invalid { border-color: var(--danger); }

.tag-input .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  color: var(--accent-hi);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 999px;
  padding: 2px 6px 2px 10px;
  font-size: 12.5px;
  font-weight: 500;
}

.tag-input .chip button {
  all: unset;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 1px 4px;
  border-radius: 999px;
  color: inherit;
  opacity: 0.75;
}
.tag-input .chip button:hover { opacity: 1; background: rgba(245, 158, 11, 0.25); }

.tag-input input {
  flex: 1;
  min-width: 120px;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 3px 2px;
}

/* Quiz editor */

.quiz-q {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: rgba(11, 17, 32, 0.45);
}
.quiz-q + .quiz-q { margin-top: 12px; }

.quiz-q .q-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-weight: 600;
  font-size: 13px;
  color: var(--accent-hi);
}

.quiz-opt {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 7px;
}

.quiz-opt input[type="radio"] { accent-color: var(--accent); width: 15px; height: 15px; flex: none; cursor: pointer; }
.quiz-opt input[type="text"] { flex: 1; }
.quiz-opt .opt-letter { flex: none; width: 18px; color: var(--text-faint); font-size: 12px; font-weight: 600; }

.quiz-hint { font-size: 12px; color: var(--text-faint); margin-top: 8px; }

/* ---------- Drawer ---------- */

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.65);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  z-index: 100;
}

.drawer-overlay.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(860px, 96vw);
  background: var(--bg-raised);
  border-left: 1px solid var(--border);
  box-shadow: -18px 0 50px rgba(2, 6, 23, 0.6);
  transform: translateX(102%);
  transition: transform 0.26s cubic-bezier(0.32, 0.72, 0.35, 1);
  z-index: 110;
  display: flex;
  flex-direction: column;
}

.drawer.open { transform: translateX(0); }

.drawer-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--panel);
}

.drawer-head h3 { margin: 0; font-size: 16px; letter-spacing: -0.01em; }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px 30px;
}

.drawer-foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 22px;
  border-top: 1px solid var(--border-soft);
  background: var(--panel);
}

.drawer-foot .foot-err { color: var(--danger); font-size: 13px; flex: 1; }
.drawer-foot .foot-actions { display: flex; gap: 8px; }

/* ---------- Modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 6, 23, 0.7);
  backdrop-filter: blur(2px);
  animation: fadeIn 0.16s ease;
}

.modal {
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  animation: popIn 0.18s ease;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-soft);
}

.modal-head h3 { margin: 0; font-size: 15.5px; }

.modal-body { padding: 18px 20px; }

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 13px 20px;
  border-top: 1px solid var(--border-soft);
}

.confirm-text { margin: 0; color: var(--text-dim); font-size: 14px; }
.confirm-text strong { color: var(--text); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ---------- Toasts ---------- */

.toasts {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(400px, calc(100vw - 40px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--success);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 13.5px;
  box-shadow: var(--shadow);
  animation: toastIn 0.22s cubic-bezier(0.32, 0.72, 0.35, 1);
}

.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-error .toast-dot { background: var(--danger); }

.toast .toast-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--success);
  margin-top: 5px;
}

.toast.leaving { animation: toastOut 0.2s ease forwards; }

@keyframes toastIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(16px); } }

/* ---------- Roadmap editor ---------- */

.phase-card {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--panel);
  margin-bottom: 14px;
  overflow: hidden;
}

.phase-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: rgba(30, 41, 59, 0.55);
  border-bottom: 1px solid var(--border-soft);
}

.phase-head .phase-no {
  flex: none;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-hi);
  font-weight: 700;
  font-size: 13px;
}

.phase-head .phase-title-preview { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phase-head .phase-tools { display: flex; gap: 4px; flex: none; }

.phase-body { padding: 14px; }

.dual-list {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: stretch;
  margin-top: 6px;
}

.dual-list .dl-col { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.dual-list .dl-col label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); }

.dual-list select {
  height: 168px;
  width: 100%;
  padding: 6px;
  font-size: 12.5px;
}

.dual-list select option { padding: 3px 6px; border-radius: 4px; }

.dual-list .dl-btns {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}

.roadmap-warnings {
  border: 1px solid rgba(245, 158, 11, 0.4);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--accent-hi);
}

.roadmap-warnings ul { margin: 6px 0 0; padding-left: 18px; }
.roadmap-warnings li { margin: 2px 0; }

.roadmap-savebar {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 0;
  background: linear-gradient(to top, var(--bg) 65%, transparent);
  z-index: 10;
}

/* ---------- Workbook / project list cards ---------- */

.item-list { display: flex; flex-direction: column; gap: 10px; }

.item-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 13px 16px;
  transition: border-color 0.15s;
}

.item-card:hover { border-color: #3b4d70; }

.item-card .item-main { flex: 1; min-width: 0; }
.item-card .item-title { font-weight: 600; font-size: 14px; }
.item-card .item-desc {
  color: var(--text-dim);
  font-size: 12.5px;
  margin-top: 2px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.item-card .item-meta { display: flex; gap: 8px; align-items: center; flex: none; }
.item-card .item-actions { display: flex; gap: 6px; flex: none; }

/* ---------- Track badges ---------- */

.badge-track-core { background: rgba(56, 189, 248, 0.13); color: #7dd3fc; border-color: rgba(56, 189, 248, 0.35); }
.badge-track-engineering { background: var(--accent-soft); color: var(--accent-hi); border-color: rgba(245, 158, 11, 0.35); }
.badge-track-business { background: var(--success-soft); color: #4ade80; border-color: rgba(34, 197, 94, 0.35); }
.badge-track-prompt { background: rgba(167, 139, 250, 0.14); color: #c4b5fd; border-color: rgba(167, 139, 250, 0.38); }

/* ---------- Toggle switch ---------- */

.switch {
  flex: none;
  position: relative;
  width: 44px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
}

.switch .switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-dim);
  box-shadow: 0 1px 3px rgba(2, 6, 23, 0.6);
  transition: transform 0.18s ease, background 0.18s ease;
}

.switch[aria-checked="true"] {
  background: var(--accent);
  border-color: var(--accent);
}

.switch[aria-checked="true"] .switch-knob {
  transform: translateX(20px);
  background: var(--accent-ink);
}

.switch:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }
.switch:disabled { opacity: 0.42; cursor: not-allowed; }
.switch.is-busy { opacity: 0.6; cursor: progress; }

/* ---------- Settings ---------- */

.settings-list { display: flex; flex-direction: column; }

.settings-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
}

.settings-row + .settings-row { border-top: 1px solid var(--border-soft); }

.settings-row .set-logo {
  flex: none;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
}

.settings-row .set-logo svg { width: 19px; height: 19px; display: block; }

.settings-row .set-main { flex: 1; min-width: 0; }
.settings-row .set-name { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.settings-row .set-desc { color: var(--text-dim); font-size: 12.5px; margin-top: 2px; }
.settings-row .set-hint { color: var(--text-faint); font-size: 12px; margin-top: 6px; line-height: 1.45; }
.settings-row .set-hint code { font-size: 11.5px; }
.settings-row .set-ctl { flex: none; padding-top: 4px; }

/* Prompt Lab spend caps — three numbers and a save button, on one line until
   it will not fit. */
.spend-caps {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-top: 12px;
}
.spend-caps label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-faint);
}
.spend-caps input {
  width: 130px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: var(--panel-2);
  color: var(--text);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.spend-caps input:focus { outline: none; border-color: var(--accent); }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: var(--panel-2);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-pill.pill-on { background: var(--success-soft); color: #4ade80; border-color: rgba(34, 197, 94, 0.35); }
.status-pill.pill-off { background: var(--panel-2); color: var(--text-faint); border-color: var(--border-soft); }
.status-pill.pill-na { background: var(--danger-soft); color: #f87171; border-color: rgba(239, 68, 68, 0.3); }

.settings-banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(245, 158, 11, 0.4);
  background: var(--accent-soft);
  color: var(--accent-hi);
  font-size: 13px;
  line-height: 1.5;
}

.settings-banner strong { color: var(--accent-hi); }
.settings-banner .sb-ico { flex: none; font-size: 15px; line-height: 1.2; }

.settings-updated {
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-faint);
}

.settings-unavailable {
  padding: 26px 20px;
  text-align: center;
  color: var(--text-dim);
}

.settings-unavailable h3 { margin: 0 0 6px; font-size: 15px; color: var(--text); }
.settings-unavailable p { margin: 0 auto 14px; max-width: 460px; font-size: 13px; line-height: 1.55; }

/* Sign-in mini summary (overview) */
.signin-summary { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; }
.signin-summary .ss-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.signin-summary .ss-row .ss-name { flex: 1; min-width: 0; }
.signin-summary .ss-note { color: var(--text-faint); font-size: 12px; margin-top: 2px; }

/* ---------- Track tabs (roadmap assigned side) ---------- */

.track-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.track-tab {
  padding: 4px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.track-tab:hover { color: var(--text); border-color: var(--border); }

.track-tab[aria-selected="true"] {
  background: var(--accent-soft);
  border-color: rgba(245, 158, 11, 0.45);
  color: var(--accent-hi);
}

.dl-col .dl-filter { margin-bottom: 6px; width: 100%; }

/* ============================================================
   Access codes (spec v4)
   ============================================================ */

/* Monospace, click-to-copy code cell */

.code-cell {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent-hi);
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 4px 9px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.code-cell:hover { border-color: var(--accent); background: var(--accent-soft); }
.code-cell:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }

.code-cell .cc-copy {
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-faint);
  opacity: 0;
  transition: opacity 0.15s;
}

.code-cell:hover .cc-copy { opacity: 1; }

.code-cell.copied {
  border-color: rgba(34, 197, 94, 0.5);
  background: var(--success-soft);
  color: #4ade80;
}

.code-cell.copied .cc-copy { opacity: 1; color: #4ade80; }

/* Status pills for codes */

.status-pill.pill-active { background: var(--accent-soft); color: var(--accent-hi); border-color: rgba(245, 158, 11, 0.4); }
.status-pill.pill-redeemed { background: var(--success-soft); color: #4ade80; border-color: rgba(34, 197, 94, 0.35); }
.status-pill.pill-revoked { background: var(--danger-soft); color: #f87171; border-color: rgba(239, 68, 68, 0.35); }
.status-pill.pill-expired { background: var(--panel-2); color: var(--text-faint); border-color: var(--border-soft); }

/* Generate results */

.gen-results { border-color: rgba(245, 158, 11, 0.35); }
.gen-results .panel-head { background: var(--accent-soft); }
.gen-results .panel-head h3 { color: var(--accent-hi); }

.code-drop {
  max-height: 210px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
}

.code-drop .cd-item {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--accent-hi);
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  text-align: center;
  letter-spacing: 0.04em;
}

.gen-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 16px;
}

.gen-actions .gen-hint {
  color: var(--text-faint);
  font-size: 12px;
  flex: 1;
  min-width: 180px;
}

/* Bulk selection bar */

.bulk-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 9px 12px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.bulk-bar .bulk-count { font-weight: 600; color: var(--accent-hi); flex: 1; min-width: 120px; }

table.grid td.sel-cell,
table.grid th.sel-cell { width: 34px; padding-right: 0; text-align: center; }

table.grid input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  cursor: pointer;
  vertical-align: middle;
}

/* Waiting-for-access + unavailable states */

.wait-email { font-family: var(--mono); font-size: 12.5px; }

.codes-unavailable {
  padding: 34px 20px;
  text-align: center;
}

.codes-unavailable h3 { margin: 0 0 6px; font-size: 15px; color: var(--text); }
.codes-unavailable p { margin: 0 auto 14px; max-width: 480px; font-size: 13px; line-height: 1.55; color: var(--text-dim); }

.panel-note {
  padding: 10px 16px;
  color: var(--text-faint);
  font-size: 12.5px;
  border-top: 1px solid var(--border-soft);
}

.stat-card.stat-access::before { background: var(--success); }
.stat-card.stat-access { cursor: pointer; }
.stat-card.stat-access:hover { border-color: #3b4d70; }

/* ---------- Scrollbars ---------- */

* { scrollbar-width: thin; scrollbar-color: #33415c transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: #33415c; border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
  :root { --sidenav-w: 190px; }
  .main { padding: 20px 18px 50px; }
  .field.span-4, .field.span-3 { grid-column: span 6; }
}

@media (max-width: 820px) {
  .shell { flex-direction: column; }

  /* Two rows: brand + switch + sign out on top (always on screen), the
     section tabs underneath, scrolling sideways. */
  .sidenav {
    position: sticky;
    top: 0;
    height: auto;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-right: none;
    border-bottom: 1px solid var(--border-soft);
  }

  .sidenav-brand { order: 0; border: none; margin: 0; padding: 0 8px 0 0; min-width: 0; }
  .brand-text span { display: none; }

  .sidenav-foot { order: 1; margin-left: auto; border: none; padding: 0; flex-direction: row; align-items: center; }
  .sidenav-foot .admin-who { display: none; }
  .site-exit { flex-direction: row; align-items: center; padding: 0; }
  .site-exit-label { display: none; }
  .site-exit-link { min-height: 32px; padding: 5px 9px; }
  .nav-signout { width: auto; }

  /* Second row: the Learn | Buzz switch, full width. Third: its sections. */
  .ws-switch { order: 2; flex: 1 1 100%; margin: 0; }
  .sidenav-nav { order: 3; flex: 1 1 100%; flex-direction: row; overflow-x: auto; overflow-y: hidden; }
  .nav-group { flex-direction: row; gap: 2px; }
  .nav-label { display: none; }

  .nav-item { white-space: nowrap; padding: 7px 10px; }
  .nav-item.active { box-shadow: inset 0 -2px 0 var(--accent); }
  .nav-ico { display: none; }

  .drawer { width: 100vw; }
  .field.span-6, .field.span-8 { grid-column: span 12; }
  .dual-list { grid-template-columns: 1fr; }
  .dual-list .dl-btns { flex-direction: row; }
}

@media (max-width: 520px) {
  .brand-text { display: none; }
  /* Keep the outward arrow, drop the product icon: on a phone the two
     links sit right above the Learn | Buzz switch and must not look like it. */
  .site-exit-link svg:not(.exit-arrow) { display: none; }
  .site-exit-link .exit-arrow { color: var(--text-dim); }
}

/* ---------------- subscribers (email update preferences) ----------------
   Reuses .stat-grid / .grid / .status-pill from the access-codes section;
   only the column rhythm is specific to this table. */

#subRows td:first-child {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#subRows td .status-pill { min-width: 44px; justify-content: center; }

/* ---- People / roles ---- */
.role-select { padding: 4px 8px; font-size: 13px; min-width: 110px; }
.role-select:disabled { opacity: 0.55; cursor: progress; }

/* The Access column carries four stacked lines (state pill, how it was
   granted, when, and an optional note), so it needs a little more room than a
   plain cell and tighter leading than the default row. */
#peopleRows td:nth-child(5) { min-width: 210px; }
#peopleRows td:nth-child(5) .row-sub { line-height: 1.35; }
#peopleRows td:nth-child(5) .status-pill { min-width: 62px; justify-content: center; }
#peopleRows .btn:disabled { opacity: 0.55; cursor: progress; }

/* Organizations (enterprise access by domain) */
.org-explainer p { margin: 0 0 8px; color: var(--text-dim); font-size: 13.5px; line-height: 1.55; max-width: 80ch; }
.org-explainer p:last-child { margin-bottom: 0; }
.meta-faint { color: var(--text-faint); font-size: 12.5px; margin: 4px 0 0; line-height: 1.45; }
.form-grid > .span-12:not(.field) { grid-column: 1 / -1; }
.field > label.check-row {
  display: flex; align-items: center; gap: 8px;
  text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 500; color: var(--text);
}
@media (max-width: 640px) { .field.span-6 { grid-column: span 12; } }

/* ============================================================
   Buzz (public/js/admin-buzz.js)
   ============================================================ */
.bzq-tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 18px; align-items: start; }
.bzq-tool { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.bzq-tool .meta-faint { font-size: 12px; line-height: 1.45; }
.bzq-tool-out { grid-column: 1 / -1; margin: 0; }
.bzq-tool-out:empty { display: none; }
.bzq-tabs { margin: 16px 0 12px; }
.bzq-tabs .track-tab { font-size: 12.5px; padding: 6px 12px; }
.bzq-count { margin-left: 6px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; }
.bzq-all { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-dim); }
.bzq-row { align-items: flex-start; }
.bzq-row > input[type="checkbox"] { margin-top: 4px; flex: none; }
.bzq-row .item-title { font-size: 14.5px; margin: 6px 0 2px; }
.bzq-badges { display: flex; flex-wrap: wrap; gap: 5px; }
.bzq-summary { margin-top: 6px; color: var(--text); font-size: 13px; line-height: 1.5; }
.bzq-summary:empty { display: none; }
.bzq-excerpt { margin-top: 6px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent-hi); font-size: 12.5px; line-height: 1.5; }
.bzq-reports { margin-top: 6px; color: #f87171; font-size: 12.5px; }
.bzq-acts { flex-wrap: wrap; justify-content: flex-end; max-width: 42%; }
.bzq-nets { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 6px 0; }
.bzq-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); text-transform: none; letter-spacing: 0; font-weight: 500; cursor: pointer; }
.bzq-checks .bzq-inline { margin-top: 4px; }
.bzq-off { color: var(--text-faint); }
.bzq-span { grid-column: span 12; }
.bzq-span[hidden], .field[hidden] { display: none; }
.bzq-syn-list { margin: 10px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.7; }
.bzq-syn-list a { color: var(--accent-hi); margin-left: 4px; }
.bzq-save { display: flex; justify-content: flex-end; margin: 4px 0 30px; }
.bzq-body > .panel { margin-bottom: 14px; }
@media (max-width: 820px) {
  .bzq-row { flex-wrap: wrap; }
  .bzq-acts { max-width: none; justify-content: flex-start; width: 100%; }
}

.bzq-body input[type="datetime-local"], #drawer input[type="datetime-local"] { color-scheme: dark; }
input[type="date"], input[type="datetime-local"] { color-scheme: dark; }
.page-actions a.btn { text-decoration: none; }
.bzq-acts a.btn { text-decoration: none; }
