/* admin-core.css — the new /admin-platform shell.
 *
 * Idiom = the student dashboard, NOT a SaaS admin: bare ground (no boxed cards),
 * hairline rules, small-caps section labels, Fraunces numerals, underline-quiet
 * actions, generous space. Tokens only; dark-native for free.
 * All selectors under .apx- so nothing collides with the retired admin-screens.
 */

/* ---- page frame -------------------------------------------------------- */
.apx-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 1.6rem) 5rem;
  color: var(--ink);
}

/* ---- masthead: brand | doors | tools ---------------------------------- */
.apx-masthead {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.6rem 0 1rem;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.apx-mast-left {
  flex: 0 0 auto;
}
.apx-eyebrow {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.apx-doors {
  display: flex;
  gap: 0.2rem;
  margin: 0 auto;
  flex: 1 1 auto;
  justify-content: center;
}
.apx-door {
  appearance: none;
  background: none;
  border: 0;
  padding: 0.35rem 0.2rem 0.5rem;
  margin: 0 0.7rem;
  font: inherit;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.18rem;
  letter-spacing: -0.01em;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.16s ease, border-color 0.16s ease;
}
.apx-door:hover {
  color: var(--ink-soft);
}
.apx-door.is-on {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.apx-mast-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
}

/* the one badge in the shell */
.apx-badge {
  appearance: none;
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.32rem 0.7rem;
  font: inherit;
  font-size: 0.82rem;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
}
.apx-badge:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}
.apx-badge.is-live {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-wash);
}
.apx-badge b {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

/* Test as / Settings menu buttons */
.apx-menu-btn {
  appearance: none;
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0.32rem 0.7rem;
  font: inherit;
  font-size: 0.82rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
}
.apx-menu-btn:hover {
  color: var(--ink);
  background: var(--surface-soft);
}
.apx-menu-btn span {
  color: var(--muted);
}

/* ---- underline nav ----------------------------------------------------- */
.apx-nav {
  display: flex;
  gap: 0.2rem;
  padding: 0.9rem 0 0;
  margin-bottom: 1.6rem;
  border-bottom: 1px solid var(--line);
}
.apx-navtab {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 0.4rem 0.15rem 0.7rem;
  margin: 0 1.1rem 0 0;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.16s ease, border-color 0.16s ease;
}
.apx-navtab:hover {
  color: var(--ink-soft);
}
.apx-navtab.is-on {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---- body / empty state ----------------------------------------------- */
.apx-body {
  min-height: 40vh;
}
.apx-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  padding: clamp(2.4rem, 8vh, 4rem) 0;
  color: var(--muted);
}
.apx-empty b {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}
/* the examiner's pen stroke under an emphasised word (spec: empty state) */
.apx-empty b em {
  font-style: italic;
  color: var(--accent);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 12' preserveAspectRatio='none'%3E%3Cpath d='M3 9 C 30 4 80 3.5 117 6.5' fill='none' stroke='%23891d1a' stroke-width='2.4' stroke-linecap='round' opacity='0.8'/%3E%3C/svg%3E") no-repeat bottom center / 100% 0.3em;
  padding-bottom: 0.14em;
}
.apx-empty span {
  font-size: 0.95rem;
  line-height: 1.55;
  max-width: 48ch;
}

/* ---- shared primitives: quiet & danger buttons ------------------------ */
.apx-quiet-btn {
  appearance: none;
  background: none;
  border: 0;
  padding: 0.35rem 0.1rem;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1.5px;
  text-decoration-color: rgba(137, 29, 26, 0.4);
  transition: color 0.16s ease, text-decoration-color 0.16s ease;
}
.apx-quiet-btn:hover {
  color: var(--accent-strong);
  text-decoration-color: currentColor;
}
.apx-quiet-btn:disabled {
  color: var(--muted);
  cursor: default;
  text-decoration: none;
}
.apx-danger-btn {
  appearance: none;
  background: var(--accent);
  color: var(--on-accent);
  border: 0;
  border-radius: 8px;
  padding: 0.45rem 0.85rem;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}
.apx-danger-btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.apx-faint {
  color: var(--muted);
}

/* ---- keyboard hint pill (shared) -------------------------------------- */
.apx-kbd {
  display: inline-block;
  min-width: 1.1em;
  padding: 0.05em 0.4em;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface-soft);
  font-family: "Fraunces", Georgia, serif;
  font-size: 0.78rem;
  color: var(--ink-soft);
  text-align: center;
}

/* ---- drawer (Test as / Settings) -------------------------------------- */
.apx-drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(33, 7, 6, 0.5);
  display: flex;
  justify-content: flex-end;
  animation: apx-fade 0.14s ease;
}
@keyframes apx-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.apx-drawer {
  width: min(460px, 94vw);
  height: 100%;
  overflow-y: auto;
  background: var(--surface);
  border-left: 1px solid var(--line-strong);
  box-shadow: -18px 0 48px rgba(33, 7, 6, 0.16);
  z-index: 1201;
  display: flex;
  flex-direction: column;
  animation: apx-slide 0.18s ease;
}
@keyframes apx-slide {
  from { transform: translateX(24px); opacity: 0.4; }
  to { transform: translateX(0); opacity: 1; }
}
.apx-drawer-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem clamp(1rem, 4vw, 1.5rem) 0.9rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  z-index: 1;
}
.apx-drawer-head h2 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.apx-drawer-x {
  appearance: none;
  background: none;
  border: 0;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0.3rem 0.4rem;
  border-radius: 6px;
}
.apx-drawer-x:hover {
  color: var(--ink);
  background: var(--surface-soft);
}
.apx-drawer-body {
  padding: 1.1rem clamp(1rem, 4vw, 1.5rem) 2.4rem;
}
.apx-drawer-note {
  margin: 0 0 1.2rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--muted);
}

/* ---- personas list ---------------------------------------------------- */
.apx-persona-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.apx-persona {
  padding: 0.95rem 0;
  border-bottom: 1px dashed var(--line-strong);
}
.apx-persona:last-child {
  border-bottom: 0;
}
.apx-persona-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
}
.apx-persona-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}
.apx-persona-when {
  font-size: 0.76rem;
  color: var(--muted);
  white-space: nowrap;
}
.apx-persona-desc {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--ink-soft);
}
.apx-persona-state {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.apx-persona-state.is-flag {
  color: var(--warn-deep);
  font-weight: 600;
}
.apx-persona-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.7rem;
}
.apx-persona-enter {
  appearance: none;
  background: var(--accent);
  color: var(--on-accent);
  border: 0;
  border-radius: 8px;
  padding: 0.45rem 0.95rem;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.16s ease;
}
.apx-persona-enter:hover {
  background: var(--accent-strong);
}
.apx-persona-enter:disabled {
  opacity: 0.6;
  cursor: default;
}
.apx-persona-err {
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
  color: var(--accent-strong);
}

/* ---- settings drawer -------------------------------------------------- */
.apx-set-block {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
}
.apx-set-block:last-child {
  border-bottom: 0;
}
.apx-set-line {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink-soft);
}
.apx-set-line b {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.apx-set-line a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.apx-set-ok {
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
  color: var(--warn-deep);
}
.apx-fold {
  margin-top: 0.7rem;
}
.apx-fold > summary {
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.3rem 0;
  list-style: none;
}
.apx-fold > summary::-webkit-details-marker {
  display: none;
}
.apx-fold > summary::before {
  content: "▸ ";
  color: var(--accent);
}
.apx-fold[open] > summary::before {
  content: "▾ ";
}

/* per-model spend table */
.apx-tablewrap {
  overflow-x: auto;
  margin-top: 0.5rem;
}
.apx-set-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.apx-set-table th {
  text-align: left;
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid var(--line);
}
.apx-set-table td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px dashed var(--line);
  color: var(--ink-soft);
}
.apx-set-model {
  font-family: "Fraunces", Georgia, serif;
}
.apx-set-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* bookings config fold */
.apx-bk-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  margin: 0.6rem 0;
}
.apx-bk-f {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted);
}
.apx-bk-f.wide {
  grid-column: 1 / -1;
}
.apx-bk-f.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}
.apx-bk-f input,
.apx-bk-f textarea {
  font: inherit;
  font-size: 0.88rem;
  font-weight: 400;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--plate);
  color: var(--ink);
}
html[data-theme="dark"] .apx-bk-f input,
html[data-theme="dark"] .apx-bk-f textarea {
  background: var(--surface-soft);
}
.apx-bk-f input:focus,
.apx-bk-f textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.apx-bk-f.checkbox input {
  width: auto;
  padding: 0;
}
.apx-bk-tznote {
  margin: 0.2rem 0 0.7rem;
  font-size: 0.78rem;
}
.apx-bk-bo-list {
  list-style: none;
  margin: 0.4rem 0;
  padding: 0;
}
.apx-bk-bo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.4rem 0;
  border-bottom: 1px dashed var(--line);
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.apx-bk-gtest {
  display: inline-block;
  margin-left: 0.6rem;
  font-size: 0.82rem;
}
.apx-bk-gtest.ok {
  color: var(--warn-deep);
}
.apx-bk-gtest.bad {
  color: var(--accent-strong);
}
.apx-set-links {
  display: flex;
  gap: 1.4rem;
  flex-wrap: wrap;
}
.apx-set-link {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}
.apx-set-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---- toast + sr-live -------------------------------------------------- */
.apx-toast {
  position: fixed;
  left: 50%;
  bottom: 1.6rem;
  transform: translate(-50%, 1rem);
  z-index: 1300;
  padding: 0.55rem 1rem;
  border-radius: 10px;
  background: var(--ink);
  color: var(--surface);
  font-size: 0.86rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(33, 7, 6, 0.24);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.apx-toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}
.apx-sr-live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- mobile (390px): masthead reflows, doors stay centred ------------- */
@media (max-width: 620px) {
  .apx-masthead {
    gap: 0.6rem;
    padding-top: 1.1rem;
  }
  .apx-mast-left {
    order: 1;
  }
  .apx-mast-right {
    order: 2;
    margin-left: auto;
    gap: 0.35rem;
  }
  .apx-doors {
    order: 3;
    flex-basis: 100%;
    margin: 0.3rem 0 0;
    justify-content: flex-start;
  }
  .apx-door {
    margin: 0 1.2rem 0 0;
  }
  .apx-menu-btn,
  .apx-badge {
    padding: 0.3rem 0.55rem;
    font-size: 0.78rem;
  }
  .apx-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .apx-navtab {
    white-space: nowrap;
  }
  .apx-bk-grid {
    grid-template-columns: 1fr;
  }
}
