/*
 * PanIQbase stylesheet. Hand-written, no build step, nothing loaded from outside static/.
 *
 * Look: the PanIQ kiosk operator app (kiosk v3, renderer/src/scss/components/_glass.scss):
 * near-black page with soft turquoise / teal / gold glows, frosted "glass" cards, pill
 * buttons, Montserrat for headings and labels, Roboto for text. Brand colours from the
 * PanIQ Room brand book 2025 (p.7). Dark is the default (like the kiosk); a light variant
 * follows the phone's setting, for reading schedules outdoors. The header stays dark in both.
 *
 * Sections
 *   1. Fonts
 *   2. Design tokens (dark, then light)
 *   3. Base elements
 *   4. Layout primitives: container, page, stack, cluster, grid
 *   5. Site header and navigation
 *   6. Components: card, button, alert/messages, badge, table, disclosure, divider, lists, empty
 *   7. Forms: field, label, help, errors, controls
 *   8. Page specifics: home, sign-in and codes, security (MFA)
 *   9. Utilities, htmx, accessibility modes
 *
 * Naming: block, block__part, block--variant (e.g. .card, .card__title, .btn--primary).
 * Spacing: prefer .stack / .cluster on the parent over margins on children.
 * Contrast: every text/background pair below is WCAG 2.2 AA (4.5:1 text, 3:1 controls and
 * focus rings) in both themes, measured on the worst case (glass over the brightest glow).
 */

/* 1. Fonts ---------------------------------------------------------------------- */

/* Brand typefaces, self-hosted Latin subsets (SIL OFL 1.1, see static/fonts/). */
@font-face {
  font-family: "Roboto";
  src: url("../fonts/roboto-latin-wght.0c13e9dcc181.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Montserrat";
  src: url("../fonts/montserrat-latin-wght.1ca498eca36f.woff2") format("woff2");
  font-weight: 500 800;
  font-style: normal;
  font-display: swap;
}

/* 2. Design tokens ---------------------------------------------------------------- */

:root {
  color-scheme: dark;

  /* Brand: identical in both themes (brand book p.7; kiosk _boostrap.scss). */
  --brand-teal: #005a64; /* deep teal: app icon, gradients */
  --brand-turquoise: #2cb9bb;
  --brand-turquoise-bright: #34c9cb; /* kiosk's accent on dark glass */
  --brand-gold: #d79632;
  --brand-ink: #070a0b; /* kiosk header / page black; also theme-color and manifest */

  /* Page and ambient glow (kiosk .kiosk-operator::before). */
  --bg: #0c0e0f;
  --glow-1: rgb(44 185 187 / 0.2);
  --glow-2: rgb(0 90 100 / 0.38);
  --glow-3: rgb(215 150 50 / 0.14);

  /* Glass surfaces. --surface-solid is the fallback without backdrop-filter. */
  --surface: rgb(17 25 27 / 0.82);
  --surface-solid: #11181a;
  --surface-sunken: #0a0f10; /* table heads, code boxes */
  --surface-hover: rgb(255 255 255 / 0.06);
  --input-bg: #0a0f10;
  --border: rgb(255 255 255 / 0.12); /* card edges, dividers (decorative) */
  --border-strong: #6b8083; /* control edges: 4.1:1 on glass */
  --edge-highlight: inset 0 1px 0 rgb(255 255 255 / 0.08);
  --shadow: 0 12px 32px rgb(0 0 0 / 0.3);
  --blur: blur(14px);

  /* Text. */
  --text: #e7eef0; /* 14.7:1 on glass */
  --text-muted: #93a6a8; /* 6.8:1 on glass, 5.5:1 on the brightest glow */
  --link: #34c9cb; /* 8.5:1 */
  --link-hover: #8ae3e4;

  /* Accent (primary actions, active states, focus): turquoise on dark. */
  --accent: #34c9cb;
  --accent-hover: #5ad6d8;
  --on-accent: #06282a; /* 7.7:1 on --accent */
  --accent-glow: 0 0 18px rgb(52 201 203 / 0.35);
  --accent-soft: rgb(52 201 203 / 0.12);
  --accent-soft-border: rgb(52 201 203 / 0.55);
  --accent-text: #34c9cb; /* 6.7:1 on --accent-soft */
  --focus: #34c9cb; /* 8.5:1 on glass */

  /* Gold highlight (kiosk timers, broker badge): manager roles, codes. */
  --gold-soft: rgb(215 150 50 / 0.14);
  --gold-soft-border: rgb(215 150 50 / 0.6);
  --gold-text: #e3a94e; /* 6.6:1 on --gold-soft */
  --code-text: #e3a94e; /* one-time code digits, like the kiosk's PIN field */

  /* Header: dark in both themes, like the kiosk and the brand's websites. */
  --header-bg: var(--brand-ink);
  --header-border: rgb(255 255 255 / 0.12);
  --header-text: #e7eef0; /* 16.9:1 */
  --header-muted: #93a6a8; /* 7.6:1 */
  --header-accent: #34c9cb; /* 9.8:1 */
  --header-hover: rgb(255 255 255 / 0.07);

  /* Status: background / border / text for alerts and badges. */
  --info-bg: rgb(52 201 203 / 0.12);
  --info-border: rgb(52 201 203 / 0.5);
  --info-text: #a6e9ea;
  --success-bg: rgb(29 158 117 / 0.16);
  --success-border: rgb(63 210 158 / 0.5);
  --success-text: #9be6c5;
  --warning-bg: rgb(215 150 50 / 0.14);
  --warning-border: rgb(215 150 50 / 0.6);
  --warning-text: #f2d3a2;
  --danger-bg: rgb(163 45 45 / 0.22);
  --danger-border: rgb(240 110 110 / 0.55);
  --danger-text: #f6b4b4;
  --danger: #a32d2d; /* kiosk $danger; white text 7:1 */
  --danger-hover: #8c2626;
  --on-danger: #ffffff;

  /* Type. rem-based so phone text-size settings scale everything. */
  --font-body: "Roboto", system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-display: "Montserrat", "Roboto", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
  --leading: 1.5;
  --leading-tight: 1.2;

  /* Space scale. */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;

  /* Shape (kiosk $card-radius 12px; buttons are pills). */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 12px;
  --radius-pill: 999px;

  /* Sizes. */
  --tap: max(44px, 2.75rem); /* minimum tap target */
  --page-max: 72rem; /* wide pages (week grid) */
  --page-medium: 46rem; /* settings and forms */
  --page-narrow: 28rem; /* sign-in */
  --gutter: var(--space-4);
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;

    --bg: #eef3f3;
    --glow-1: rgb(44 185 187 / 0.1);
    --glow-2: rgb(0 90 100 / 0.07);
    --glow-3: rgb(215 150 50 / 0.09);

    --surface: rgb(255 255 255 / 0.9);
    --surface-solid: #ffffff;
    --surface-sunken: #f2f6f6;
    --surface-hover: rgb(0 90 100 / 0.06);
    --input-bg: #ffffff;
    --border: rgb(12 20 22 / 0.12);
    --border-strong: #74888b; /* 3.7:1 on white */
    --edge-highlight: inset 0 1px 0 rgb(255 255 255 / 0.9);
    --shadow: 0 1px 2px rgb(12 20 22 / 0.05), 0 6px 20px rgb(12 20 22 / 0.06);

    --text: #0c1416; /* 18.6:1 on white */
    --text-muted: #4a5d60; /* 6.9:1 on white, 5.7:1 on the glow */
    --link: #006b75; /* 6.3:1 */
    --link-hover: #004a52;

    /* Turquoise is only 2.4:1 on white, so light mode leads with the deep brand teal. */
    --accent: #005a64; /* white text 7.9:1 */
    --accent-hover: #00474f;
    --on-accent: #ffffff;
    --accent-glow: 0 4px 14px rgb(0 90 100 / 0.28);
    --accent-soft: rgb(44 185 187 / 0.14);
    --accent-soft-border: rgb(0 90 100 / 0.45);
    --accent-text: #00515a; /* 8:1 on --accent-soft */
    --focus: #007780; /* 5.3:1 on white */

    --gold-soft: rgb(215 150 50 / 0.16);
    --gold-soft-border: rgb(215 150 50 / 0.75);
    --gold-text: #7a4f00; /* 6.2:1 on --gold-soft */
    --code-text: #0c1416;

    --info-bg: #e6f7f7;
    --info-border: rgb(0 90 100 / 0.35);
    --info-text: #00515a;
    --success-bg: #e4f3ee;
    --success-border: #8fcbb0;
    --success-text: #11603f;
    --warning-bg: #faf2e6;
    --warning-border: #e5b768;
    --warning-text: #6e4300;
    --danger-bg: #f9e9e9;
    --danger-border: #e3a1a1;
    --danger-text: #8e1c1c;
  }
}

/* 3. Base elements ----------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* iOS: follow the Dynamic Type text size from Settings (other platforms scale rem natively). */
@supports (font: -apple-system-body) and (-webkit-touch-callout: none) {
  html {
    font: -apple-system-body;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading);
  -webkit-font-smoothing: antialiased;
}

/* Ambient brand glow behind everything (kiosk .kiosk-operator::before). */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(620px 440px at 10% 0%, var(--glow-1), transparent 70%),
    radial-gradient(680px 480px at 95% 12%, var(--glow-2), transparent 70%),
    radial-gradient(560px 420px at 75% 100%, var(--glow-3), transparent 70%);
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
dd,
figure,
blockquote,
fieldset {
  margin: 0;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--leading-tight);
  text-wrap: balance;
}

h1 {
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: -0.01em;
}

h2 {
  font-size: var(--text-xl);
}

h3 {
  font-size: var(--text-lg);
}

strong,
b {
  font-weight: 700;
}

img,
svg {
  max-width: 100%;
}

a {
  color: var(--link);
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--link-hover);
  text-decoration-thickness: 2px;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 0;
}

code,
kbd,
samp {
  font-family: var(--font-mono);
  font-size: 0.95em;
}

::selection {
  background: rgb(52 201 203 / 0.35);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

/* allauth adds a <noscript> notice at the end of <body> on passkey pages. */
body > noscript {
  display: block;
  padding: var(--space-3) var(--gutter);
  color: var(--text-muted);
  text-align: center;
}

/* 4. Layout primitives -------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
}

.container--medium {
  max-width: calc(var(--page-medium) + 2 * var(--gutter));
}

.container--narrow {
  max-width: calc(var(--page-narrow) + 2 * var(--gutter));
}

/* <main>: vertical rhythm between top-level blocks. */
.page {
  flex: 1 0 auto;
  padding-block: var(--space-5) var(--space-7);
}

.page:focus {
  outline: none;
}

/* Stack: vertical spacing between children (use one of these per element).
   Plain values, not an inherited custom property, so nested stacks don't leak gaps. */
.stack > * + * {
  margin-block-start: var(--space-4);
}

.stack-sm > * + * {
  margin-block-start: var(--space-2);
}

.stack-lg > * + * {
  margin-block-start: var(--space-6);
}

.page > * + * {
  margin-block-start: var(--space-5);
}

/* Cluster: a wrapping row (buttons, badges, toolbar items). */
.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--cluster-gap, var(--space-2));
}

.cluster--between {
  justify-content: space-between;
}

/* Grid of cards: as many ~18rem columns as fit. */
.grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
  align-items: start;
}

/* 5. Site header and navigation -------------------------------------------------------- */

.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 100;
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 var(--space-5);
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-display);
  font-weight: 700;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* Phones: logo + sign out on the first row, links + name on the second.
   From 48rem: one row, logo | links | name | sign out. Signed out: logo only. */
.site-header {
  --focus: var(--brand-turquoise-bright);
  background: var(--header-bg);
  color: var(--header-text);
  border-bottom: 1px solid var(--header-border);
  box-shadow: 0 1px 0 rgb(52 201 203 / 0.15);
  padding-top: env(safe-area-inset-top);
}

.site-header__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "brand signout"
    "nav name";
  align-items: center;
  column-gap: var(--space-3);
}

.brand {
  grid-area: brand;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 3.5rem;
  color: inherit;
  text-decoration: none;
}

.brand__logo {
  display: block;
  width: auto;
  height: 20px; /* px on purpose: the logo needn't grow with text size, the links do */
  object-fit: contain; /* never squash it if the row still runs short of room */
  object-position: left center;
}

/* "Schedule" after a hairline, like the brand book's "logo | BRAND BOOK" footer. */
.brand__product {
  display: none;
  padding-inline-start: var(--space-3);
  border-inline-start: 1px solid rgb(255 255 255 / 0.3);
  color: var(--header-accent);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  line-height: 1.25rem;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Narrow phones drop it when signed in, to leave room for "Sign out". */
@media (min-width: 24rem) {
  .brand__product {
    display: inline-block;
  }
}

.site-header__inner:not(:has(.account)) .brand__product {
  display: inline-block;
}

/* The account block's children sit in the header grid directly. */
.account,
.account__form {
  display: contents;
}

.account__name {
  grid-area: name;
  justify-self: end;
  min-width: 0;
  max-width: min(14rem, 40vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--header-muted);
  font-size: var(--text-sm);
}

.site-nav {
  grid-area: nav;
  min-width: 0;
}

/* Wraps rather than scrolls, so no link hides off-screen with large text. */
.site-nav__list {
  display: flex;
  flex-wrap: wrap;
  column-gap: var(--space-1);
  margin: 0 0 0 calc(-1 * var(--space-3));
  padding: 0;
  list-style: none;
}

.site-nav__link,
.header-button {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 var(--space-3);
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: var(--header-text);
  font: inherit;
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}

.header-button {
  grid-area: signout;
  justify-self: end;
  padding: 0 var(--space-4);
  border: 1px solid rgb(255 255 255 / 0.4); /* 3.8:1 on the header */
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
}

.site-nav__link:hover,
.header-button:hover {
  background: var(--header-hover);
  color: #ffffff;
}

.header-button:hover {
  border-color: var(--header-accent);
}

/* Inside ring: an outside one would run into the header edge and the next row. */
.site-nav__link:focus-visible {
  outline-offset: -3px;
}

.site-nav__link[aria-current="page"] {
  border-bottom-color: var(--header-accent);
  color: #ffffff;
}

@media (min-width: 48rem) {
  .site-header__inner {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-areas: "brand nav name signout";
    column-gap: var(--space-5);
  }

  .brand__logo {
    height: 22px;
  }

  .site-nav__list {
    margin: 0;
  }

  .site-nav__link {
    min-height: 3.5rem;
  }
}

/* 6. Components ------------------------------------------------------------------------- */

/* Card: frosted glass (kiosk @mixin glass). */
.card {
  position: relative;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-solid);
  box-shadow: var(--edge-highlight), var(--shadow);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .card {
    background: var(--surface);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
  }
}

.card > * + * {
  margin-block-start: var(--card-gap, var(--space-3));
}

.card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.card__title {
  font-size: var(--text-lg);
}

@media (min-width: 30rem) {
  .card {
    padding: var(--space-5);
  }
}

/* Button: .btn plus one variant; pills like the kiosk's. Default looks like secondary. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--tap);
  padding: 0.625rem var(--space-5);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: var(--leading-tight);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    color 0.15s ease;
}

.btn:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
  color: var(--text);
}

.btn--primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.btn--primary:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
  box-shadow: var(--accent-glow);
  color: var(--on-accent);
}

.btn--secondary {
  border-color: var(--border-strong);
}

.btn--subtle {
  border-color: transparent;
  color: var(--link);
  font-weight: 600;
}

.btn--subtle:hover {
  border-color: transparent;
  color: var(--link-hover);
  text-decoration: underline;
}

.btn--danger {
  border-color: var(--danger);
  background: var(--danger);
  color: var(--on-danger);
}

.btn--danger:hover {
  border-color: var(--danger-hover);
  background: var(--danger-hover);
  color: var(--on-danger);
}

.btn--block {
  display: flex;
  width: 100%;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

/* Vertical group of full-width buttons (e.g. alternative sign-in options). */
.button-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.button-stack > .btn {
  width: 100%;
}

/* Alert and the messages region (Django messages + messages added by app.js). */
.alert {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--info-border);
  border-inline-start-width: 4px;
  border-radius: var(--radius);
  background: var(--info-bg);
  color: var(--info-text);
}

.alert--success {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--success-text);
}

.alert--warning {
  border-color: var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning-text);
}

.alert--error {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger-text);
}

.alert a {
  color: inherit;
  font-weight: 700;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.messages:empty {
  display: none;
}

.messages:empty + * {
  margin-block-start: 0;
}

/* Badge: small uppercase pill (kiosk .op-role). */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.625rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: var(--leading);
  text-transform: uppercase;
  white-space: nowrap;
}

.badge--accent {
  border-color: var(--accent-soft-border);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.badge--gold,
.badge--warning {
  border-color: var(--gold-soft-border);
  background: var(--gold-soft);
  color: var(--gold-text);
}

.badge--success {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--success-text);
}

.badge--danger {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger-text);
}

/* Table: wrap in .table-wrap so wide tables scroll sideways on phones. */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-solid);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  text-align: start;
  vertical-align: top;
}

.table th {
  background: var(--surface-sunken);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.table tr:last-child > td {
  border-bottom: 0;
}

.table td[align="right"] {
  text-align: end;
}

/* Disclosure (<details>) */
.disclosure {
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.disclosure > summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--tap);
  padding: 0 var(--space-4);
  color: var(--link);
  font-family: var(--font-display);
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}

.disclosure > summary::-webkit-details-marker {
  display: none;
}

.disclosure > summary::before {
  content: "";
  flex: none;
  width: 0.5em;
  height: 0.5em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

.disclosure[open] > summary::before {
  transform: rotate(45deg);
}

.disclosure__body {
  padding: 0 var(--space-4) var(--space-4);
}

/* Divider with a word in the middle ("or"). */
.divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--border);
}

/* Page header */
.page-title {
  font-size: var(--text-2xl);
}

.page-lede {
  color: var(--text-muted);
  font-size: 1.0625rem;
}

/* Small uppercase label above a group (kiosk "ROOMS · 3 CONNECTED"). */
.section-title,
.eyebrow {
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: var(--leading-tight);
  text-transform: uppercase;
}

.eyebrow {
  color: var(--accent-text);
}

@media (min-width: 48rem) {
  h1,
  .page-title {
    font-size: 2rem;
  }
}

/* Lists */
.list-plain {
  padding: 0;
  list-style: none;
}

.list-divided > li {
  padding-block: var(--space-3);
}

.list-divided > li + li {
  border-top: 1px solid var(--border);
}

.list-divided > li:first-child {
  padding-block-start: 0;
}

.list-divided > li:last-child {
  padding-block-end: 0;
}

/* Numbered steps (authenticator setup). */
.steps {
  display: grid;
  gap: var(--space-5);
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps > li {
  position: relative;
  padding-inline-start: 2.75rem;
  counter-increment: step;
}

.steps > li > * + * {
  margin-block-start: var(--space-3);
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  inset-inline-start: 0;
  top: -0.2rem;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--accent-soft-border);
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-family: var(--font-display);
  font-weight: 700;
}

.steps__title {
  font-family: var(--font-display);
  font-weight: 700;
}

/* Empty state */
.empty {
  padding: var(--space-4);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-muted);
  text-align: center;
}

.empty > * + * {
  margin-block-start: var(--space-2);
}

.empty > :first-child {
  color: var(--text);
  font-weight: 500;
}

/* 7. Forms ------------------------------------------------------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.field__label,
.field > label,
.field > legend {
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
}

.field > legend {
  padding: 0;
  margin-block-end: var(--space-1);
}

fieldset.field {
  border: 0;
  padding: 0;
  min-width: 0;
}

.field__help,
.helptext {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.errorlist {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--danger-text);
  font-size: var(--text-sm);
  font-weight: 700;
}

.alert .errorlist {
  color: inherit;
  font-size: inherit;
}

/* Checkbox / radio: control and label side by side. */
.field--check {
  flex-direction: row;
  align-items: flex-start;
  gap: var(--space-3);
}

.field--check > input {
  margin-block-start: 0.15rem;
}

.field--check label {
  font-family: var(--font-display);
  font-weight: 600;
}

/* Text-like controls. :where() keeps specificity at zero so classes win. */
:where(
    input:not(
        [type="checkbox"],
        [type="radio"],
        [type="hidden"],
        [type="submit"],
        [type="button"],
        [type="reset"],
        [type="image"],
        [type="range"],
        [type="color"],
        [type="file"]
      ),
    select,
    textarea
  ) {
  width: 100%;
  min-height: max(48px, 3rem);
  padding: var(--space-2) 0.875rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: max(1rem, 16px); /* below 16px iOS zooms the page on focus */
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

:where(input, select, textarea):focus {
  border-color: var(--accent);
}

:where(input, select, textarea):focus-visible {
  outline-offset: 1px;
}

:where(textarea) {
  min-height: 6rem;
  resize: vertical;
}

:where(input, select, textarea):disabled,
:where(input, textarea)[readonly] {
  background: var(--surface-sunken);
  color: var(--text-muted);
}

:where(input, select, textarea)[aria-invalid="true"] {
  border-color: var(--danger-text);
  border-width: 2px;
}

input[type="checkbox"],
input[type="radio"] {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
  accent-color: var(--accent);
}

::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

.form-actions {
  padding-block-start: var(--space-1);
}

/* 8. Page specifics ------------------------------------------------------------------------ */

/* Home: locations list */
.membership {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1) var(--space-3);
}

.membership__label {
  font-family: var(--font-display);
  font-weight: 700;
}

.membership__tz {
  flex-basis: 100%;
}

/* Sign-in and other allauth "entrance" pages: one centred glass card with a brand edge. */
.card--entrance {
  --card-gap: var(--space-4);
  overflow: hidden;
}

.card--entrance::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--brand-turquoise), var(--brand-teal) 60%, var(--brand-gold));
}

@media (min-width: 30rem) {
  .card--entrance {
    margin-block-start: var(--space-5);
  }
}

/* One-time code input: big, spaced digits (kiosk remote-PIN field). */
.input--code {
  color: var(--code-text);
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-variant-numeric: tabular-nums lining-nums;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-align: center;
  text-indent: 0.3em; /* balances the letter-spacing after the last digit */
}

.input--code::placeholder {
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.3em;
}

/* Forms that only carry hidden inputs (allauth's resend-code, cancel, passkey and WebAuthn
   helper forms, submitted by buttons elsewhere via form="..."): take no space.
   The ids are a fallback for browsers without :has(). */
form:not(:has(:not(input[type="hidden"]))),
#resend,
#logout-from-stage,
#mfa_login {
  display: none;
}

/* Security pages: authenticator setup key, QR code, backup codes. */
.qr {
  display: block;
  width: 100%;
  max-width: 13rem;
  height: auto;
  padding: var(--space-3);
  border-radius: var(--radius);
  background: #ffffff; /* light quiet zone so it scans in dark mode too */
}

.secret {
  display: block;
  padding: var(--space-3) var(--space-4);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--code-text);
  font-size: 1rem;
  letter-spacing: 0.08em;
  overflow-wrap: anywhere;
  -webkit-user-select: all;
  user-select: all;
}

#recovery_codes {
  color: var(--code-text);
  font-family: var(--font-mono);
  font-size: 1.0625rem;
  letter-spacing: 0.08em;
  line-height: 1.8;
}

/* Passkey list */
.key-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
}

.key-row__name {
  font-family: var(--font-display);
  font-weight: 700;
  overflow-wrap: anywhere;
}

/* Shown only on phones and tablets (e.g. "Open in authenticator app"). */
.only-touch {
  display: none !important;
}

@media (hover: none) and (pointer: coarse) {
  .only-touch {
    display: inline-flex !important;
  }
}

/* 9. Utilities, htmx, accessibility modes ---------------------------------------------------- */

.muted {
  color: var(--text-muted);
}

.small {
  font-size: var(--text-sm);
}

.mono {
  font-family: var(--font-mono);
}

.nowrap {
  white-space: nowrap;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* htmx: its built-in indicator styles are disabled (CSP), so define them here. */
.htmx-indicator {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Windows high contrast and similar: drop the glow, keep every edge visible. */
@media (forced-colors: active) {
  body::before {
    display: none;
  }

  .btn,
  .badge,
  .alert,
  .card,
  .header-button {
    border: 1px solid CanvasText;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .card {
    background: var(--surface-solid);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
