/* digitaleslernen.org platform base stylesheet
 * Touch-first, tablet-friendly defaults shared across all server-rendered pages.
 * Component styles live alongside their templ partials and consume these tokens.
 */

/* Brand typefaces, self-hosted (no third-party CDN) so visitor IPs are never
 * shared with a font host — the platform's data-protection-first principle.
 * Both are SIL OFL 1.1 variable fonts; licenses live in /static/fonts/.
 * font-display: swap keeps text visible during the (tiny, ~20-40KB) fetch.
 */
@font-face {
  font-family: "Lexend";
  src: url("/static/fonts/lexend-latin-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/static/fonts/jetbrains-mono-latin-variable.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Brand palette — the single source of truth for the editorial
   * marine/mustard design language. Every platform surface (home, auth,
   * legal, catalog, admin, console) derives from these tokens; the
   * per-surface --home-, --auth-, and --legal- names are aliases onto
   * them. The platform theme picker retargets only the three base hues
   * below, so every derived step follows the active theme automatically.
   */
  --brand-marine: #000080;
  --brand-mustard: #ffdb58;
  --brand-mustard-tint: #fffbeb;
  --brand-mustard-soft: #fff1b8;
  --brand-ink: #0a0a14;
  --brand-surface: #fffdf4;
  --brand-surface-soft: #fff8df;

  /* Alpha ladder derived from the marine primary. */
  --brand-marine-08: color-mix(in srgb, var(--brand-marine) 8%, transparent);
  --brand-marine-16: color-mix(in srgb, var(--brand-marine) 16%, transparent);
  --brand-marine-24: color-mix(in srgb, var(--brand-marine) 24%, transparent);
  --brand-marine-35: color-mix(in srgb, var(--brand-marine) 35%, transparent);
  --brand-marine-55: color-mix(in srgb, var(--brand-marine) 55%, transparent);
  --brand-rule: color-mix(in srgb, var(--brand-marine) 18%, transparent);

  /* Muted text is an opaque mix with the surface (not alpha) so its
   * WCAG AA contrast on the cream background is guaranteed (~7.6:1),
   * unlike the old 55%-alpha text (~3:1). "faint" is for decorative
   * small print and still clears 4.5:1.
   */
  --brand-text-muted: color-mix(in srgb, var(--brand-marine) 72%, var(--brand-surface));
  --brand-text-faint: color-mix(in srgb, var(--brand-marine) 58%, var(--brand-surface));

  /* Neutral token layer consumed by components (admin/console chrome,
   * forms, theme picker). Mapped onto the brand so the back office and
   * the public pages read as one design language.
   */
  --color-bg: var(--brand-surface);
  --color-bg-muted: var(--brand-mustard-tint);
  --color-surface: #ffffff;
  --color-border: var(--brand-rule);
  --color-text: var(--brand-ink);
  --color-text-muted: var(--brand-text-muted);
  --color-accent: var(--brand-marine);
  --color-accent-contrast: #ffffff;
  --color-success: #1f8a4c;
  --color-warning: #b6730e;
  --color-danger: #c0392b;
  --color-focus-ring: var(--brand-marine);

  /* Typography */
  --font-sans: "Lexend", system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-size-base: 1.125rem;       /* 18px — readable on tablets */
  --font-size-sm: 1rem;
  --font-size-lg: 1.375rem;
  --font-size-xl: 1.75rem;
  --font-size-xxl: 2.25rem;
  --line-height-base: 1.55;
  --line-height-tight: 1.25;

  /* Spacing scale (rem) */
  --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;
  --space-8: 4rem;

  /* Layout — editorial language: square corners everywhere. */
  --layout-max-width: 77.5rem;
  --layout-content-width: 48rem;
  --radius-sm: 0;
  --radius-md: 0;
  --radius-lg: 0;
  --shadow-sm: 0 1px 2px color-mix(in srgb, var(--brand-marine) 7%, transparent);
  --shadow-md: 0 0.9rem 2.4rem color-mix(in srgb, var(--brand-marine) 7%, transparent);

  /* Tap targets — WCAG 2.5.5 / Apple HIG recommend ≥44px on touch surfaces */
  --tap-target-min: 44px;
}

/* Platform theme palettes — generated block. SINGLE SOURCE OF TRUTH:
 * PlatformThemes in web/templates/partials/theme_palette.go. Regenerate
 * with `go generate ./web/templates/partials/`; the Go test
 * TestPlatformThemeCSSInSync guards against drift. Do not hand-edit the
 * block between the markers below.
 */
/* platform-theme-palettes:begin */
:root {
  --platform-theme-primary: #000080;
  --platform-theme-primary-on: #ffffff;
  --platform-theme-secondary: #ffdb58;
  --platform-theme-secondary-on: #0a0a14;
  --platform-theme-bg-tint: #fffbeb;
}

:root[data-platform-theme="nature"] {
  --platform-theme-primary: #4a5d23;
  --platform-theme-primary-on: #f4d03f;
  --platform-theme-secondary: #f4d03f;
  --platform-theme-secondary-on: #1a2210;
  --platform-theme-bg-tint: #eef1de;
}

:root[data-platform-theme="sky"] {
  --platform-theme-primary: #0a2e5c;
  --platform-theme-primary-on: #a5d8f0;
  --platform-theme-secondary: #7fc7e8;
  --platform-theme-secondary-on: #0a1929;
  --platform-theme-bg-tint: #ebf3fa;
}

:root[data-platform-theme="minimal"] {
  --platform-theme-primary: #1a1a1a;
  --platform-theme-primary-on: #e0e0e0;
  --platform-theme-secondary: #cccccc;
  --platform-theme-secondary-on: #000000;
  --platform-theme-bg-tint: #efefef;
}

:root[data-platform-theme="sunset"] {
  --platform-theme-primary: #8b2238;
  --platform-theme-primary-on: #ffb45c;
  --platform-theme-secondary: #ffa94d;
  --platform-theme-secondary-on: #2d0f1a;
  --platform-theme-bg-tint: #fff1e0;
}

:root[data-platform-theme="solarize"] {
  --platform-theme-primary: #073642;
  --platform-theme-primary-on: #b58900;
  --platform-theme-secondary: #b58900;
  --platform-theme-secondary-on: #002b36;
  --platform-theme-bg-tint: #fdf6e3;
}

:root[data-platform-theme="ocean"] {
  --platform-theme-primary: #003b5c;
  --platform-theme-primary-on: #7ed4d9;
  --platform-theme-secondary: #4fb3bf;
  --platform-theme-secondary-on: #04222e;
  --platform-theme-bg-tint: #e5f0f2;
}

:root[data-platform-theme="colourful"] {
  --platform-theme-primary: #6b1f30;
  --platform-theme-primary-on: #6fbe7e;
  --platform-theme-secondary: #5ba86c;
  --platform-theme-secondary-on: #1a1a1a;
  --platform-theme-bg-tint: #f3eedf;
}

:root[data-platform-theme="unicorn"] {
  --platform-theme-primary: #5a1a8c;
  --platform-theme-primary-on: #ffc4dd;
  --platform-theme-secondary: #ffb3d9;
  --platform-theme-secondary-on: #2d1340;
  --platform-theme-bg-tint: #fbeef6;
}
/* platform-theme-palettes:end */

/* A non-default platform theme retargets the three brand hues; the whole
 * alpha ladder, muted-text mixes, and neutral layer follow via color-mix.
 */
:root[data-platform-theme]:not([data-platform-theme="mustard-marine"]) {
  --brand-marine: var(--platform-theme-primary);
  --brand-mustard: var(--platform-theme-secondary);
  --brand-mustard-tint: var(--platform-theme-bg-tint);
  --color-accent-contrast: var(--platform-theme-primary-on);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  /* The editorial palette is a light system; lock it so OS dark mode
   * cannot recolor form controls or scrollbars out from under it.
   */
  color-scheme: light;
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 var(--space-3);
  line-height: var(--line-height-tight);
  /* Editorial voice: headings carry the heavy 750 weight everywhere. */
  font-weight: 750;
}

h1 { font-size: var(--font-size-xxl); }
h2 { font-size: var(--font-size-xl); }
h3 { font-size: var(--font-size-lg); }

p { margin: 0 0 var(--space-4); }

a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

a:hover,
a:focus-visible { text-decoration-thickness: 2px; }

img,
svg,
video {
  max-width: 100%;
  height: auto;
  display: block;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Layout primitives */
.site-container {
  width: 100%;
  max-width: var(--layout-max-width);
  margin-inline: auto;
  padding-inline: var(--space-5);
}

.site-content {
  max-width: var(--layout-content-width);
  margin-inline: auto;
}

.site-main {
  padding-block: var(--space-6);
  min-height: 60vh;
}

.site-header,
.site-footer {
  background-color: var(--color-bg-muted);
  border-block-color: var(--color-border);
  border-block-style: solid;
  border-block-width: 0;
}

.site-header { border-bottom-width: 1px; padding-block: var(--space-4); }
.site-footer { border-top-width: 1px; padding-block: var(--space-5); margin-top: var(--space-7); color: var(--color-text-muted); }

/* Touch-friendly interactive controls. The editorial button: marine fill,
 * square corners, mono micro-label — the style the auth, legal, and app
 * pages already use, now defined once for every surface.
 */
.btn,
button,
[role="button"],
input[type="submit"],
input[type="button"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap-target-min);
  min-width: var(--tap-target-min);
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-accent);
  background-color: var(--color-accent);
  color: var(--color-accent-contrast);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  touch-action: manipulation;
}

.btn--secondary,
button.secondary {
  background-color: var(--color-surface);
  color: var(--color-accent);
  border-color: var(--color-accent);
}

/* Large CTA variant of the editorial button — auth submits, the
 * "continue"/"resend" auth links, and the app-detail launch action all
 * share this look. Combine with .btn for the base treatment (fill,
 * font, focus behavior); this only carries the size/spacing deltas.
 */
.btn--launch {
  gap: 0.7rem;
  min-height: 3.15rem;
  padding: 0 1rem;
}

.btn--launch:hover,
.btn--launch:focus-visible {
  background-color: var(--brand-ink);
  text-decoration: none;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="url"],
select,
textarea {
  min-height: var(--tap-target-min);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

textarea { min-height: calc(var(--tap-target-min) * 2); resize: vertical; }

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--color-accent);
}

/* Platform settings menu. The selected theme retargets the brand hue
 * tokens only; the menu itself sits in the page chrome flex row.
 */
.platform-theme {
  position: relative;
  flex: 0 0 auto;
  z-index: 1000;
  color: var(--color-text);
}

.platform-theme [hidden] {
  display: none !important;
}

.platform-theme__trigger {
  position: relative;
  z-index: 3;
  display: inline-grid;
  place-items: center;
  width: 2rem;
  min-width: 2rem;
  min-height: 2rem;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--color-border) 55%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-surface) 72%, transparent);
  color: color-mix(in srgb, var(--color-text) 72%, transparent);
  line-height: 1;
  box-shadow: none;
}

.platform-theme__trigger:hover,
.platform-theme__trigger:focus-visible {
  border-color: var(--color-accent);
  text-decoration: none;
}

.platform-theme__icon {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.platform-theme__backdrop {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: color-mix(in srgb, var(--color-text) 28%, transparent);
}

.platform-theme__dialog {
  position: absolute;
  inset-block-start: calc(100% + var(--space-2));
  /* The trigger sits at the viewport's right edge, so the dialog must
     open leftward or it overflows the screen. */
  inset-inline-start: auto;
  inset-inline-end: 0;
  z-index: 2;
  display: grid;
  gap: var(--space-4);
  width: min(27rem, calc(100vw - var(--space-6)));
  max-height: calc(100vh - 6rem);
  overflow: auto;
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
}

.platform-theme__head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: var(--space-4);
}

.platform-theme__title {
  margin: 0;
  font-size: var(--font-size-lg);
}

.platform-theme__hint {
  margin: var(--space-1) 0 0;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.platform-theme__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.platform-theme__link {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--color-bg-muted) 54%, var(--color-surface));
  color: var(--color-text);
  font-size: var(--font-size-sm);
  font-weight: 700;
  text-decoration: none;
}

.platform-theme__link:hover,
.platform-theme__link:focus-visible {
  border-color: var(--color-accent);
  text-decoration: none;
}

.platform-theme__section-title {
  margin-block-end: calc(var(--space-2) * -1);
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.platform-theme__close {
  flex: 0 0 auto;
  width: var(--tap-target-min);
  padding: 0;
  border-color: var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
}

.platform-theme__options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.platform-theme__option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  justify-content: start;
  gap: var(--space-2);
  min-height: 3.5rem;
  padding: var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  font-weight: 650;
  text-align: start;
}

.platform-theme__option:hover,
.platform-theme__option:focus-visible {
  border-color: var(--color-accent);
}

.platform-theme__option[aria-pressed="true"] {
  border-color: var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 10%, var(--color-surface));
}

.platform-theme__swatch {
  display: inline-flex;
  width: 1.75rem;
  height: 1.75rem;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 999px;
}

.platform-theme__swatch span {
  flex: 1;
}

@media (max-width: 560px) {
  .platform-theme__dialog {
    width: min(22rem, calc(100vw - var(--space-4)));
  }

  .platform-theme__options {
    grid-template-columns: 1fr;
  }
}

/* Tablet/touch tuning — bump comfortable spacing on small/medium screens */
@media (max-width: 768px) {
  :root {
    --font-size-base: 1.0625rem;
    --layout-content-width: 100%;
  }
  .site-container { padding-inline: var(--space-4); }
}

/* Reduced motion */
@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;
  }
}

/* Skip link — WCAG 2.4.1. Hidden until focused via Tab so keyboard
 * users can jump past the chrome straight into <main>. The base
 * layout pairs this with #main { tabindex="-1" } so focus actually
 * lands inside the content region.
 */
.site-skip:focus {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  padding: var(--space-2) var(--space-4);
  clip: auto;
  background-color: var(--color-accent);
  color: var(--color-accent-contrast);
}

main:focus { outline: none; }

/* Auth pages borrow the original public-platform visual language. Keep these
 * tokens local so OS dark mode in the base palette cannot recolor auth flows.
 */
/* Auth palette is an alias layer onto the brand tokens (theme-aware via
 * the single :root override). --auth-marine-55 is the muted-text role and
 * points at the opaque AA-safe mix, not the old 55% alpha.
 */
.auth-page {
  --auth-mustard: var(--brand-mustard);
  --auth-mustard-tint: var(--brand-mustard-tint);
  --auth-mustard-soft: var(--brand-mustard-soft);
  --auth-marine: var(--brand-marine);
  --auth-marine-08: var(--brand-marine-08);
  --auth-marine-16: var(--brand-marine-16);
  --auth-marine-55: var(--brand-text-muted);
  --auth-ink: var(--brand-ink);
  --auth-rule: var(--brand-rule);
  --auth-surface: var(--brand-surface);
  --auth-surface-soft: var(--brand-surface-soft);
  --auth-font: var(--font-sans);
  --auth-mono: var(--font-mono);

  color-scheme: light;
  display: grid;
  align-items: center;
  min-height: 100vh;
  padding: 4rem 1.5rem;
  background:
    radial-gradient(circle at 18% 16%, color-mix(in srgb, var(--auth-mustard) 34%, transparent), transparent 18rem),
    linear-gradient(180deg, var(--auth-surface) 0%, var(--auth-mustard-tint) 42%, var(--auth-surface) 100%);
  color: var(--auth-ink);
  font-family: var(--auth-font);
  font-feature-settings: "ss01", "ss02";
  text-rendering: optimizeLegibility;
}

.auth-page ::selection {
  background: var(--auth-mustard);
  color: var(--auth-marine);
}

.auth-page a {
  color: var(--auth-marine);
  text-underline-offset: 0.22em;
}

.auth-container {
  width: min(100%, 32rem);
  margin-inline: auto;
}

.auth-header {
  display: grid;
  gap: 0.75rem;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 2.75rem;
  color: var(--auth-marine);
  font-family: var(--auth-mono);
  font-size: 1.23rem;
  font-weight: 750;
  line-height: 1.2;
  text-decoration: none;
}

.auth-brand::before {
  content: "";
  width: 0.42rem;
  height: 0.42rem;
  margin-inline-end: 0.5rem;
  border: 1px solid var(--auth-marine);
  background: var(--auth-mustard);
}

.auth-title {
  margin: 1.75rem 0 0;
  color: var(--auth-ink);
  font-size: clamp(3.25rem, 12vw, 5.25rem);
  font-weight: 750;
  line-height: 1.03;
  letter-spacing: 0;
}

.auth-title::after {
  content: "";
  display: block;
  width: min(8rem, 42%);
  height: 0.36rem;
  margin-block-start: -0.36rem;
  background: var(--auth-mustard);
}

.auth-subtitle {
  max-width: 34rem;
  margin: 0;
  color: var(--auth-marine-55);
  font-size: 1.08rem;
  font-weight: 550;
  line-height: 1.55;
}

.auth-error,
.auth-success-detail {
  margin: 1.5rem 0 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--auth-marine);
  background: var(--auth-mustard);
  color: var(--auth-marine);
  font-weight: 750;
}

.auth-success-detail {
  background: var(--auth-surface);
  font-family: var(--auth-mono);
}

.auth-form {
  display: grid;
  gap: 1rem;
  margin-block-start: 2rem;
  padding-block-start: 1.5rem;
  border-block-start: 1px solid var(--auth-rule);
}

.auth-field {
  display: grid;
  gap: 0.45rem;
}

.auth-field__label,
.auth-checkbox__label {
  color: var(--auth-marine);
  font-family: var(--auth-mono);
  font-size: 0.82rem;
  font-weight: 750;
  letter-spacing: 0;
}

.auth-field__input {
  min-height: 3.2rem;
  border: 1px solid var(--auth-rule);
  border-radius: 0;
  background: var(--color-surface);
  color: var(--auth-ink);
  box-shadow: none;
}

.auth-field__input:-webkit-autofill,
.auth-field__input:-webkit-autofill:hover,
.auth-field__input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--auth-ink);
  box-shadow: 0 0 0 1000px var(--color-surface) inset;
}

.auth-field__input:focus-visible {
  border-color: var(--auth-marine);
  outline-color: var(--auth-marine);
}

.auth-field__input[aria-invalid="true"] {
  border-color: var(--color-danger);
}

.auth-field__hint,
.auth-field__error,
.auth-hint {
  margin: 0;
  color: var(--auth-marine-55);
  font-size: 0.88rem;
  line-height: 1.45;
}

.auth-field__error {
  color: var(--color-danger);
  font-weight: 700;
}

.auth-checkbox {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.65rem;
  margin-block-start: 0.35rem;
}

.auth-checkbox input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--auth-marine);
}

.auth-hint {
  margin-block-start: -0.55rem;
}

.auth-links {
  display: grid;
  gap: 0.6rem;
  margin-block-start: 1.75rem;
  padding-block-start: 1.5rem;
  border-block-start: 1px solid var(--auth-rule);
  font-size: 0.95rem;
}

.auth-links__row {
  margin: 0;
}

.auth-links__row--muted {
  color: var(--auth-marine-55);
}

.auth-links__row--muted a {
  color: var(--auth-marine-55);
}

@media (max-width: 640px) {
  .auth-page {
    align-items: start;
    padding: 2rem 1rem 3rem;
  }

  .auth-title {
    font-size: 3.1rem;
  }
}

/* Admin shell — chrome shared by /admin/* pages.
 * Pages render their own content inside .admin-shell__main; this
 * stylesheet only owns the surrounding header, nav, and footer.
 */
.admin-shell { background-color: var(--color-bg); }

.admin-shell__skip:focus {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  padding: var(--space-2) var(--space-4);
  clip: auto;
  background-color: var(--color-accent);
  color: var(--color-accent-contrast);
}

.admin-shell__header { padding-block: var(--space-3); }

.admin-shell__header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.admin-shell__heading {
  margin: 0;
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: 1.23rem;
  font-weight: 750;
  line-height: 1.2;
}

.admin-shell__heading a {
  display: inline-flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

/* The editorial brand mark — the mustard square the homepage and auth
 * pages lead with — anchors the back-office headers to the same brand.
 */
.admin-shell__heading a::before,
.console-shell__heading a::before {
  content: "";
  flex: 0 0 auto;
  width: 0.42rem;
  height: 0.42rem;
  margin-inline-end: 0.5rem;
  border: 1px solid var(--color-accent);
  background: var(--brand-mustard);
}

.admin-shell__signout { margin: 0; }

/* Shared nav component — used by both the /admin/* and /console/*
 * chrome (the two shells otherwise diverge in header/heading markup,
 * but the section nav is the same tab strip in both).
 */
.shell-nav {
  margin-block-start: var(--space-3);
  overflow-x: auto;
}

.shell-nav__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.shell-nav__item { margin: 0; }

.shell-nav__link {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-target-min);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: 0;
  background: var(--color-surface);
  color: var(--color-accent);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 750;
}

.shell-nav__link:hover,
.shell-nav__link:focus-visible {
  background-color: var(--color-bg-muted);
  text-decoration: underline;
}

.shell-nav__link--active {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-accent-contrast);
}

.shell-nav__link--active:hover,
.shell-nav__link--active:focus-visible {
  background-color: var(--color-accent);
  color: var(--color-accent-contrast);
  text-decoration: underline;
}

.admin-shell__main:focus { outline: none; }

/* Admin component layer (dl_org-b5pd): list tables, disclosure panels,
 * forms, status chips, and flashes for the /admin/* pages. Editorial
 * language: square corners, 1px rules, mono labels, mustard accents.
 */
.admin-apps__title,
.admin-ideas__title,
.admin-users__title,
.admin-billing__title,
.admin-audit__title {
  margin: 0;
  color: var(--color-text);
  font-size: 2rem;
  font-weight: 750;
  line-height: 1.1;
}

.admin-apps__subtitle,
.admin-ideas__subtitle,
.admin-users__subtitle,
.admin-billing__subtitle,
.admin-audit__subtitle {
  margin: var(--space-2) 0 var(--space-5);
  color: var(--color-text-muted);
}

.admin-billing__section-title {
  margin: var(--space-5) 0 var(--space-3);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 750;
  color: var(--color-accent);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  border-block-start: 2px solid var(--color-accent);
}

.admin-table th {
  padding: var(--space-2) var(--space-3);
  border-block-end: 1px solid var(--color-border);
  text-align: start;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 750;
  color: var(--color-accent);
}

.admin-table td {
  padding: var(--space-3);
  border-block-end: 1px solid var(--color-border);
  vertical-align: top;
}

.admin-table__row:hover { background: var(--color-bg-muted); }

.admin-table__meta {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.admin-table__action { margin: 0; }

.admin-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 750;
  color: var(--color-text);
}

/* The mustard square — the brand mark — doubles as the status lamp:
 * filled for live states, hollow for everything else. */
.admin-status::before {
  content: "";
  width: 0.42rem;
  height: 0.42rem;
  border: 1px solid var(--color-accent);
  background: transparent;
}

.admin-status--published::before,
.admin-status--approved::before,
.admin-status--active::before,
.admin-status--resolved::before {
  background: var(--brand-mustard);
}

.admin-panel {
  margin-block-end: var(--space-5);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}

.admin-panel--row {
  margin: 0;
  border: 0;
  background: transparent;
}

.admin-panel__summary {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-target-min);
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 750;
  color: var(--color-accent);
  list-style-position: inside;
}

.admin-panel__summary:hover,
.admin-panel__summary:focus-visible {
  background: var(--color-bg-muted);
  text-decoration: underline;
}

.admin-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: var(--space-3) var(--space-4);
  padding: var(--space-4);
  border-block-start: 1px solid var(--color-border);
}

.admin-form--inline {
  grid-template-columns: repeat(auto-fit, minmax(10rem, max-content));
  align-items: end;
  margin-block-end: var(--space-4);
  padding: 0;
  border: 0;
}

.admin-form__field {
  display: grid;
  gap: var(--space-1);
}

.admin-form__field > span {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 750;
  color: var(--color-accent);
}

.admin-form__field input,
.admin-form__field select,
.admin-form__field textarea {
  padding: var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: 0;
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
}

.admin-form__field--wide { grid-column: 1 / -1; }

.admin-form__submit { justify-self: start; }

.admin-flash {
  margin-block-end: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-accent);
  background: color-mix(in srgb, var(--brand-mustard) 18%, var(--color-surface));
}

.admin-flash__row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: 0;
  font-family: var(--font-mono);
  font-weight: 750;
}

.admin-apps__empty,
.admin-ideas__empty,
.admin-users__empty,
.admin-billing__empty,
.admin-audit__empty {
  color: var(--color-text-muted);
}


.admin-shell__footer { font-size: var(--font-size-sm); }

.admin-dashboard__idea-context {
  display: grid;
  gap: var(--space-1);
  margin: var(--space-2) 0 0;
  padding: 0;
  list-style: none;
}

.admin-dashboard__idea-context li {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.admin-dashboard__idea-context strong {
  color: var(--color-text);
}

/* Console shell — platform settings separate from operational /admin. */
.console-shell {
  background: var(--color-bg);
}

.console-shell__header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.console-shell__heading {
  margin: 0;
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: 1.23rem;
  font-weight: 750;
  line-height: 1.2;
}

.console-shell__heading a {
  display: inline-flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.console-page {
  display: grid;
  gap: var(--space-5);
}

.console-page__header {
  max-width: 48rem;
}

.console-page__header h1 {
  margin: 0;
}

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

.console-page__eyebrow {
  margin: 0 0 var(--space-2);
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
}

.console-page__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: var(--space-4);
}

.console-page__tile,
.console-intake__question {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.console-page__tile {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-5);
  color: var(--color-text);
  text-decoration: none;
}

.console-page__tile span,
.console-intake__question-head span,
.console-intake__meta span {
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
}

.console-page__tile strong {
  font-size: var(--font-size-lg);
}

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

.console-page__notice {
  width: fit-content;
  margin: 0;
  padding: var(--space-2) var(--space-4);
  border: 1px solid color-mix(in srgb, var(--color-success) 30%, var(--color-border));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-success) 10%, var(--color-surface));
  color: var(--color-success);
}

.console-page__notice--error {
  border-color: color-mix(in srgb, var(--color-danger) 30%, var(--color-border));
  background: color-mix(in srgb, var(--color-danger) 10%, var(--color-surface));
  color: var(--color-danger);
}

.console-intake__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.console-intake__meta span {
  min-height: 2rem;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  padding-inline: var(--space-3);
}

.console-intake__list {
  display: grid;
  gap: var(--space-4);
}

.console-intake__question {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-4);
}

.console-intake__question-head,
.console-intake__row,
.console-intake__publish {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.console-intake__question-head h2 {
  margin: var(--space-1) 0 0;
  font-size: var(--font-size-lg);
}

.console-intake__question label {
  display: grid;
  gap: var(--space-2);
}

.console-intake__question label > span {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  font-weight: 600;
}

.console-intake__row {
  justify-content: start;
}

.console-intake__row > label:first-child {
  width: 10rem;
}

.console-intake__check {
  display: inline-flex !important;
  grid-template-columns: none;
  align-items: center;
  min-height: var(--tap-target-min);
}

.console-intake__check input {
  width: 1.15rem;
  height: 1.15rem;
}

.console-intake__publish {
  justify-content: flex-end;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  padding: var(--space-4);
}

.console-workshop__form,
.console-workshop__section,
.console-workshop__repeater,
.console-workshop__item,
.console-workshop__subgrid,
.console-workshop__subitem {
  display: grid;
  gap: var(--space-4);
}

.console-workshop__section {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  padding: var(--space-4);
}

.console-workshop__section h2 {
  margin: 0;
  font-size: var(--font-size-lg);
}

.console-workshop__grid,
.console-workshop__inline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: var(--space-4);
}

.console-workshop__item,
.console-workshop__subitem {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-muted);
  padding: var(--space-3);
}

.console-workshop__subgrid {
  gap: var(--space-3);
}

.console-workshop__item-head {
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
}

.console-workshop label {
  display: grid;
  gap: var(--space-2);
}

.console-workshop label > span {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  font-weight: 600;
}

.console-workshop textarea {
  min-height: 5rem;
}

.console-workshop__error {
  margin: 0;
  color: var(--color-danger);
  font-size: var(--font-size-sm);
}

/* Lean admin/console surfaces.
 * These pages are operational tools, so keep them plain, readable, and
 * independent from public-site themes or OS dark-mode recoloring.
 */
.admin-shell,
.console-shell,
.auth-page {
  --color-bg: #d3d7de;
  --color-bg-muted: #c6cbd3;
  --color-surface: #ffffff;
  --color-border: #d4d4d4;
  --color-text: #111111;
  --color-text-muted: #595959;
  --color-accent: #111111;
  --color-accent-contrast: #ffffff;
  --color-focus-ring: #111111;
  --shadow-sm: none;
  --shadow-md: none;
  color-scheme: light;
}

.auth-page {
  --auth-mustard: #f5f5f5;
  --auth-mustard-tint: #d3d7de;
  --auth-mustard-soft: #eeeeee;
  --auth-marine: #111111;
  --auth-marine-08: #eeeeee;
  --auth-marine-16: #d4d4d4;
  --auth-marine-55: #595959;
  --auth-ink: #111111;
  --auth-rule: #d4d4d4;
  --auth-surface: #ffffff;
  --auth-surface-soft: #f5f5f5;
  align-items: start;
  min-height: auto;
  padding: var(--space-6) var(--space-5);
  background: #d3d7de;
  color: #111111;
  font-family: var(--font-sans);
  font-feature-settings: normal;
}

.auth-container {
  width: min(100%, 28rem);
}

.auth-brand {
  min-height: auto;
  color: #111111;
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  font-weight: 600;
}

.auth-brand::before,
.auth-title::after {
  content: none;
}

.auth-title {
  margin-block-start: var(--space-5);
  color: #111111;
  font-size: var(--font-size-xl);
  font-weight: 600;
  line-height: var(--line-height-tight);
}

.auth-subtitle,
.auth-field__hint,
.auth-field__error,
.auth-hint,
.auth-links__row--muted,
.auth-links__row--muted a {
  color: #595959;
}

.auth-error,
.auth-success-detail {
  border-color: #111111;
  background: #f5f5f5;
  color: #111111;
  font-family: var(--font-sans);
  font-weight: 600;
}

.auth-form,
.auth-links {
  border-color: #d4d4d4;
}

.auth-field__label,
.auth-checkbox__label {
  color: #111111;
  font-family: var(--font-sans);
  font-size: var(--font-size-sm);
  font-weight: 600;
}

.auth-field__input,
.auth-page input,
.auth-page select,
.auth-page textarea,
.console-shell input,
.console-shell select,
.console-shell textarea,
.admin-shell input,
.admin-shell select,
.admin-shell textarea {
  border: 1px solid #bdbdbd;
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: #111111;
  box-shadow: none;
}

.auth-field__input:-webkit-autofill,
.auth-field__input:-webkit-autofill:hover,
.auth-field__input:-webkit-autofill:focus {
  -webkit-text-fill-color: #111111;
  box-shadow: 0 0 0 1000px var(--color-surface) inset;
}

.auth-field__input:focus-visible,
.console-shell input:focus-visible,
.console-shell select:focus-visible,
.console-shell textarea:focus-visible,
.admin-shell input:focus-visible,
.admin-shell select:focus-visible,
.admin-shell textarea:focus-visible {
  border-color: #111111;
  outline-color: #111111;
}

.btn--launch,
.console-shell .btn,
.console-shell button,
.admin-shell .btn,
.admin-shell button {
  border: 1px solid #111111;
  border-radius: var(--radius-sm);
  background: #111111;
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: var(--font-size-sm);
  font-weight: 600;
  box-shadow: none;
}

.btn--launch:hover,
.btn--launch:focus-visible,
.console-shell .btn:hover,
.console-shell .btn:focus-visible,
.console-shell button:hover,
.console-shell button:focus-visible,
.admin-shell .btn:hover,
.admin-shell .btn:focus-visible,
.admin-shell button:hover,
.admin-shell button:focus-visible {
  background: #333333;
  color: #ffffff;
  text-decoration: none;
}

.console-shell,
.admin-shell {
  background: #d3d7de;
  color: #111111;
}

.console-shell .site-header,
.admin-shell .site-header,
.console-shell .site-footer,
.admin-shell .site-footer {
  background: #f8f9fa;
  border-color: #d4d4d4;
}

.console-shell__heading,
.admin-shell__heading {
  font-size: var(--font-size-base);
  font-weight: 600;
}

.shell-nav__link {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #111111;
  font-weight: 500;
  padding-inline: 0;
}

.shell-nav__link:hover,
.shell-nav__link:focus-visible {
  background: transparent;
  text-decoration: underline;
}

.shell-nav__link--active {
  background: transparent;
  color: #111111;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.console-page {
  gap: var(--space-4);
}

.console-page__header {
  max-width: 56rem;
  padding-bottom: var(--space-4);
  border-bottom: 1px solid #d4d4d4;
}

.console-page__header h1 {
  font-size: var(--font-size-xl);
  font-weight: 600;
}

.console-page__eyebrow,
.console-page__tile span,
.console-intake__question-head span,
.console-intake__meta span,
.console-workshop__item-head {
  color: #595959;
  font-family: var(--font-sans);
}

.console-page__grid {
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
}

.console-page__tile,
.console-intake__question,
.console-intake__publish,
.console-workshop__section,
.console-workshop__item,
.console-workshop__subitem {
  border: 1px solid #d4d4d4;
  border-radius: var(--radius-sm);
  background: #ffffff;
  box-shadow: none;
}

.console-page__tile {
  padding: var(--space-4);
}

.console-page__tile strong,
.console-intake__question-head h2,
.console-workshop__section h2 {
  font-size: var(--font-size-base);
  font-weight: 600;
}

.console-page__notice {
  border-color: #bdbdbd;
  border-radius: var(--radius-sm);
  background: #f5f5f5;
  color: #111111;
}

.console-page__notice--error {
  border-color: #111111;
  background: #ffffff;
  color: #111111;
}

.console-intake__meta span {
  border-radius: var(--radius-sm);
  background: #f5f5f5;
}

.console-workshop__form,
.console-workshop__section,
.console-workshop__repeater,
.console-workshop__item,
.console-workshop__subgrid,
.console-workshop__subitem {
  gap: var(--space-3);
}

.console-workshop__section,
.console-workshop__item,
.console-workshop__subitem {
  padding: var(--space-3);
}

.console-workshop label > span {
  color: #333333;
  font-size: var(--font-size-sm);
  font-weight: 600;
}

.console-workshop textarea {
  min-height: 6rem;
}

/* Legal placeholder pages. */
/* Legal palette aliases the brand tokens, same as auth. */
.legal-page {
  --legal-mustard: var(--brand-mustard);
  --legal-mustard-tint: var(--brand-mustard-tint);
  --legal-marine: var(--brand-marine);
  --legal-marine-16: var(--brand-marine-16);
  --legal-marine-55: var(--brand-text-muted);
  --legal-ink: var(--brand-ink);
  --legal-rule: var(--brand-rule);
  --legal-surface: var(--brand-surface);
  --legal-surface-soft: var(--brand-surface-soft);
  --legal-font: var(--font-sans);
  --legal-mono: var(--font-mono);

  min-height: 100vh;
  padding-block: var(--space-7);
  background:
    radial-gradient(circle at 18% 16%, color-mix(in srgb, var(--legal-mustard) 34%, transparent), transparent 18rem),
    linear-gradient(180deg, var(--legal-surface) 0%, var(--legal-mustard-tint) 42%, var(--legal-surface) 100%);
  color: var(--legal-ink);
  font-family: var(--legal-font);
  font-feature-settings: "ss01", "ss02";
}

.legal-page .site-container {
  max-width: 58rem;
}

.legal-page__header {
  max-width: 44rem;
}

.legal-page__eyebrow,
.legal-page__reviewed {
  color: var(--legal-marine-55);
  font-family: var(--legal-mono);
  font-size: var(--font-size-sm);
  font-weight: 700;
}

.legal-page__eyebrow {
  margin-block-end: var(--space-2);
}

.legal-page__title {
  margin: 0;
  font-size: 4rem;
  font-weight: 750;
  letter-spacing: 0;
}

.legal-page__lede {
  margin-block-start: var(--space-4);
  color: var(--legal-marine-55);
  font-size: var(--font-size-lg);
}

.legal-page__draft-notice {
  width: fit-content;
  max-width: 100%;
  margin-block: var(--space-5) var(--space-3);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--legal-marine);
  border-radius: 0;
  background: var(--legal-mustard);
  color: var(--legal-marine);
  font-family: var(--legal-mono);
  font-weight: 750;
}

.legal-page__sections {
  margin-block-start: var(--space-7);
  border-block-start: 1px solid var(--legal-rule);
  background: var(--legal-surface);
}

.legal-page__section {
  padding-block: var(--space-5);
  border-block-end: 1px solid var(--legal-rule);
}

.legal-page__section-title {
  margin-block-end: var(--space-2);
}

.legal-page__section-body {
  max-width: 68ch;
  color: var(--legal-marine-55);
}

.legal-page__back {
  margin-block-start: var(--space-6);
}

.legal-page__back .btn {
  border-color: var(--legal-marine);
  border-radius: 0;
  background: var(--legal-surface);
  color: var(--legal-marine);
  font-family: var(--legal-mono);
  font-size: 0.82rem;
  font-weight: 750;
}

.legal-page__back .btn:hover,
.legal-page__back .btn:focus-visible {
  background: var(--legal-surface-soft);
  text-decoration: none;
}

@media (max-width: 768px) {
  .legal-page__title {
    font-size: 2.75rem;
  }
}

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