/* ============================================================
   mockup-styles.css — Tim Dixon eCards Static Prototype
   Brand: Tim Dixon Design System (brand.md, ds-version 2026-06-08b)
   Colour tokens: colors_and_type.css (TDS canonical token file)
   All colour pairings verified WCAG 2.2 AAA via TDS token guarantees
   ============================================================ */

/* === 1. TDS TOKEN IMPORT ===
   brand.md "Four themes": all surfaces must support all four TDS themes.
   colors_and_type.css is the canonical token file; it defines --fg, --bg,
   --bg-card, --border, --accent, --accent-text, --accent-hover,
   --accent-subtle, --warm, --warm-text, --warm-hover, --pass, --pass-bg,
   --fail, --fail-bg, --warn, --warn-bg, --neutral, --neutral-bg,
   --code-bg, --shadow, --radius, --font-sans, --font-mono, and the full
   type and spacing scales. Hand-rolled colour variables are removed.
=== */
@import "/css/tds.css";

/* === 2. LOCAL LAYOUT TOKENS (not duplicated by TDS) === */
:root {
  /* Layout */
  --max-width: 1100px;
  --nav-height: 60px;

  /* Radii aliases — brand.md "Design style: clean geometric shapes" */
  --radius-sm:   3px;
  --radius-md:   6px;
  --radius-lg:   12px;
  --radius-full: 9999px;

  /* Spacing aliases (rem-based) mapping to TDS 4px grid */
  --sp-1:  0.25rem;   /* 4px  */
  --sp-2:  0.5rem;    /* 8px  */
  --sp-3:  0.75rem;   /* 12px */
  --sp-4:  1rem;      /* 16px */
  --sp-5:  1.25rem;   /* 20px */
  --sp-6:  1.5rem;    /* 24px */
  --sp-8:  2rem;      /* 32px */
  --sp-10: 2.5rem;    /* 40px */
  --sp-12: 3rem;      /* 48px */

  /* Shadows — very subtle; brand.md "Design style: flat" permits small
     utility shadows on containers but forbids heavy drop shadows. */
  --shadow-sm: 0 1px 3px rgba(12,59,100,0.10);
  --shadow-md: 0 2px 8px rgba(12,59,100,0.14);

  --trans: 150ms ease;
}

/* === 3. RESET === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);   /* TDS: brand.md "Typography: Roboto" */
  font-size: var(--text-base);     /* TDS: 0.9375rem / 15px */
  line-height: var(--leading-body);/* TDS: 1.6 */
  color: var(--fg);                /* TDS semantic fg */
  background: var(--bg);           /* TDS semantic bg */
  -webkit-font-smoothing: antialiased;
}

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

ul, ol {
  padding-left: var(--sp-6);
}

a {
  color: var(--accent);            /* TDS: --accent adapts across all four themes */
  text-decoration: underline;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: none;
}

/* === 4. ACCESSIBILITY UTILITIES === */

/* Skip link — visible on focus */
.skip-link {
  position: absolute;
  top: -3rem;
  left: var(--sp-4);
  z-index: 9999;
  padding: var(--sp-3) var(--sp-6);
  background: var(--accent);       /* TDS: --accent (navy in light, orange in dark) */
  color: var(--accent-text);       /* TDS: --accent-text (white on accent) */
  font-weight: 700;
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: top var(--trans);
}

.skip-link:focus {
  top: var(--sp-2);
}

/* Visually hidden but available to screen readers */
.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;
}

/* === 5. FOCUS INDICATORS
   WCAG 2.4.13 Focus Appearance (AAA): 4.5:1 contrast, 3px minimum.
   TDS colors_and_type.css already defines :focus-visible globally;
   these rules layer on top for components that need custom overrides.
=== */
:focus {
  outline: none;
}

:focus-visible {
  outline: 3px solid var(--accent);   /* TDS: --accent AAA contrast in all themes */
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Dark-background contexts: TDS dark theme sets --accent to orange which
   is AAA on the dark bg. The generic :focus-visible rule handles this
   automatically via the TDS token. No explicit override needed. */
.site-header :focus-visible,
.nav-actions :focus-visible {
  outline-color: var(--accent-text);  /* White on dark nav backgrounds */
}

/* === 6. TYPOGRAPHY
   brand.md "Typography: Scale" and "Design style: bold typography"
   TDS type tokens: --text-xs, --text-sm, --text-base, --text-lg,
   --text-xl, --text-2xl, --weight-regular, --weight-semi, --weight-bold,
   --weight-black
=== */
h1 {
  font-size: var(--text-2xl);        /* TDS: 1.9rem */
  font-weight: var(--weight-black);  /* TDS: 900 */
  line-height: var(--leading-tight); /* TDS: 1.3 */
  color: var(--fg);
}

h2 {
  font-size: var(--text-xl);         /* TDS: 1.4rem */
  font-weight: var(--weight-bold);   /* TDS: 700 */
  line-height: var(--leading-tight);
  color: var(--fg);
}

h3 {
  font-size: var(--text-lg);         /* TDS: 1.1rem */
  font-weight: var(--weight-semi);   /* TDS: 500 */
  line-height: 1.4;
  color: var(--fg);
}

h4, h5, h6 {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  line-height: 1.4;
  color: var(--fg);
}

p {
  margin-bottom: var(--sp-4);
}

p:last-child {
  margin-bottom: 0;
}

strong {
  font-weight: var(--weight-bold);
}

code {
  font-family: var(--font-mono);     /* TDS: --font-mono */
  font-size: 0.9em;
  background: var(--code-bg);        /* TDS: --code-bg */
  padding: 0.1em 0.4em;
  border-radius: var(--radius-sm);
}

/* === 7. THEME SWITCHER
   Four-theme switcher — canonical component per Four Themes.html.
   brand.md "Four themes": every surface must support all four TDS themes.
   Sits above the site header in page flow. Keyboard-accessible (each
   button is a <button> with aria-pressed), labelled with aria-label on
   the container. Collapses to two-column grid on narrow viewports.
   Not sticky: the site header is the only sticky element at the top.
=== */
.theme-switcher {
  position: relative;
  z-index: 200;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
}

.theme-switcher-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--sp-6);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

.theme-switcher-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--fg-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.theme-switcher-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  flex: 1;
}

/* Select-based theme picker (replaces button grid) */
.theme-select {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--fg);
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 var(--sp-3);
  min-height: 44px;   /* WCAG 2.5.5 touch target */
  cursor: pointer;
  width: auto;
}

/* Individual theme button */
.tbtn {
  border: 2px solid var(--border);
  background: var(--bg-card);
  color: var(--fg);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  transition: border-color 0.15s, box-shadow 0.15s;
  min-height: 44px;    /* WCAG 2.5.5 target size AAA */
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

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

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

.tbtn[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.tbtn .tbtn-name {
  font-weight: var(--weight-bold);
  display: block;
  line-height: 1.2;
}

.tbtn .tbtn-swatch-row {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.tbtn .tbtn-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.12);
  flex-shrink: 0;
}

/* Mobile collapse: show a <details> summary instead of the grid */
@media (max-width: 600px) {
  .theme-switcher-inner {
    padding: 0 var(--sp-4);
    flex-direction: column;
    align-items: stretch;
    gap: var(--sp-2);
  }

  .theme-switcher-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .theme-switcher-label {
    display: none;
  }
}

/* === 8. SITE NAVIGATION
   brand.md "Colour palette, Navy #0C3B64: primary dark background"
   Nav uses --accent as bg (navy in light, orange in dark themes).
=== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: var(--accent);         /* TDS: --accent = navy in light/muted-light */
  color: var(--accent-text);         /* TDS: --accent-text = white on accent */
  display: flex;
  align-items: center;
  box-shadow: var(--shadow-md);
}

.site-header-inner {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--sp-6);
  gap: var(--sp-6);
}

.site-logo {
  display: flex;
  flex-direction: row;               /* icon left, text block right */
  align-items: center;
  gap: var(--sp-2);                  /* 8px between icon and text */
  text-decoration: none;
  color: var(--accent-text);         /* TDS: white on accent bg */
  flex-shrink: 0;
}

/* Wrap name + sub so they stack vertically as a block to the right of the icon */
.site-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.site-logo-name {
  font-size: 1.2rem;
  font-weight: var(--weight-black);
  letter-spacing: -0.02em;
  line-height: 1;
  /* --warm fails 7:1 AAA against --accent in light and muted themes.
     --accent-text is the TDS-guaranteed readable token on --accent bg. */
  color: var(--accent-text);         /* TDS: white on navy (light) / dark on orange (dark) */
}

.site-logo-sub {
  font-size: var(--text-xs);
  font-weight: var(--weight-regular);
  color: var(--accent-text);
  line-height: 1;
  margin-top: 2px;
}

.site-nav {
  flex: 1;
}

.nav-list {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: var(--sp-1);
}

.nav-link {
  display: flex;
  align-items: center;
  height: 44px;           /* WCAG 2.5.5 target size AAA: 44px minimum */
  padding: 0 var(--sp-4);
  color: var(--accent-text);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: var(--weight-semi);
  border-radius: var(--radius-md);
  transition: background var(--trans), color var(--trans);
  white-space: nowrap;
}

.nav-link:hover {
  background: rgba(255,255,255,0.12);
  color: var(--accent-text);
}

/* Active page: warm (orange/chestnut) bottom border — brand.md "Brand Orange: large elements" */
.nav-link[aria-current="page"] {
  color: var(--accent-text);
  font-weight: var(--weight-bold);
  box-shadow: inset 0 -3px 0 var(--warm);  /* TDS: --warm adapts across themes */
}

/* Admin section divider — aria-hidden="true" on the <li>, purely visual */
.nav-separator {
  display: inline-block;
  width: 1px;
  height: 1.2em;
  vertical-align: middle;
  background: var(--border);
  margin: 0 var(--sp-2);
  list-style: none;
}

/* Admin dropdown */
.admin-menu-dropdown {
  position: absolute;
  top: calc(100% + var(--sp-1));
  left: 0;
  min-width: 10rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  padding: var(--sp-1) 0;
  list-style: none;
  margin: 0;
  z-index: 9000;
}

.admin-menu-item {
  display: block;
  padding: var(--sp-2) var(--sp-4);
  color: var(--fg);
  text-decoration: none;
  font-size: var(--text-sm);
  white-space: nowrap;
}

.admin-menu-item:hover,
.admin-menu-item:focus {
  background: var(--bg-subtle);
  color: var(--accent);
  outline: none;
}

.admin-menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-2);
  font-size: var(--text-sm);
  font-family: inherit;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}

/* Mobile navigation toggle (hamburger) — hidden on desktop, shown via media query */
.mobile-nav-toggle {
  display: none;
}

.user-chip {
  /* Button reset — element is a <button> (ARIA menu trigger) */
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  /* Layout and appearance */
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-full);
  color: var(--accent-text);
  font-size: var(--text-sm);
  font-weight: var(--weight-semi);
  text-decoration: none;
  transition: background var(--trans);
  min-height: 44px;
}

.user-chip:hover {
  background: rgba(255,255,255,0.12);
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  background: var(--warm);           /* TDS: --warm = orange large element */
  color: var(--warm-text);           /* TDS: --warm-text = dark on warm fill */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: var(--weight-black);
  flex-shrink: 0;
}

/* === User menu dropdown === */
.user-menu-dropdown {
  position: absolute;
  top: calc(100% + var(--sp-2));     /* just below the chip button */
  right: 0;
  z-index: 200;
  min-width: 220px;
  background: var(--bg-card);        /* TDS: card surface — adapts all four themes */
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

/* Sections within the dropdown (info, theme, actions) */
.user-menu-section {
  /* padding is set inline per-section for flexibility */
}

/* Thin rule between sections */
.user-menu-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0;
}

/* Shared style for links and sign-out button inside the dropdown */
.user-menu-item {
  display: block;
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  min-height: 44px;                  /* WCAG 2.5.5: 44px touch target */
  display: flex;
  align-items: center;
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  color: var(--fg);
  text-decoration: none;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  transition: background var(--trans), color var(--trans);
}

.user-menu-item:hover,
.user-menu-item:focus-visible {
  background: var(--accent-subtle);  /* TDS: subtle tint of accent colour */
  color: var(--fg);
  outline: none;
}

/* Danger variant — sign out */
.user-menu-item--danger {
  color: var(--fail);                /* TDS: --fail = red, adapts across themes */
}

.user-menu-item--danger:hover,
.user-menu-item--danger:focus-visible {
  background: var(--fail-bg);        /* TDS: --fail-bg = light red */
  color: var(--fail);
}

/* === End user menu dropdown === */

/* === Formatting toolbar (signing form) === */
.formatting-toolbar {
    display: flex;
    gap: var(--sp-1);
    margin-bottom: var(--sp-2);
}

.fmt-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
    height: 36px;
    padding: 0 var(--sp-2);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--fg);
    font-size: var(--text-sm);
    cursor: pointer;
    font-family: inherit;
    transition: background var(--trans), border-color var(--trans);
}

.fmt-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
}

.fmt-btn:hover {
    background: var(--accent-subtle);
    border-color: var(--accent);
}

.fmt-btn[aria-pressed="true"] {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-text);
    box-shadow: inset 0 -3px 0 0 var(--accent-text);
}

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

/* Formatting toolbar — row 2 selects */
.fmt-select {
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    color: var(--fg);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 var(--sp-2);
    min-height: 36px;
    cursor: pointer;
}

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

/* Separator between toolbar groups */
.fmt-sep {
    display: inline-block;
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 var(--sp-1);
    align-self: center;
}

/* Colour swatches */
.fmt-swatch {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    min-width: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color var(--trans), transform var(--trans);
}

.fmt-swatch::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
}

.fmt-swatch:hover {
    border-color: var(--accent);
    transform: scale(1.15);
}

.fmt-swatch:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
    border-color: var(--accent);
}

.fmt-swatch--active {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 2px var(--accent);
}

/* Native colour input */
.fmt-color-input {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    cursor: pointer;
    padding: 2px;
    background: var(--bg-card);
}

.fmt-color-input:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}
/* === End formatting toolbar === */

/* Admin nav badge */
.nav-admin-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--sp-2);
  background: var(--warm);           /* TDS: --warm */
  color: var(--warm-text);           /* TDS: --warm-text */
  font-size: 0.7rem;
  font-weight: var(--weight-black);
  border-radius: var(--radius-sm);
  margin-left: var(--sp-1);
}

/* === 9. LAYOUT === */
.site-main {
  min-height: calc(100vh - var(--nav-height) - 48px);
  padding: var(--sp-8) 0 var(--sp-12);
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

.page-header {
  margin-bottom: var(--sp-8);
  padding-bottom: var(--sp-6);
  border-bottom: 2px solid var(--border);  /* TDS: --border */
}

.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.page-subtitle {
  color: var(--fg-muted);            /* TDS: --fg-muted */
  margin-top: var(--sp-2);
  font-size: var(--text-lg);
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  list-style: none;
  padding: 0;
  margin-bottom: var(--sp-4);
  font-size: var(--text-sm);
}

.breadcrumbs li + li::before {
  content: "/";
  color: var(--fg-muted);
  margin-right: var(--sp-2);
}

.breadcrumbs a {
  color: var(--accent);
}

.breadcrumbs [aria-current="page"] {
  color: var(--fg-muted);
  font-weight: 600;
}

/* Two-column layout helper */
.layout-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-8);
}

.layout-sidebar {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: var(--sp-8);
  align-items: start;
}

/* === 10. BUTTONS
   brand.md "Design style: clean geometric shapes, generous whitespace"
   WCAG 2.5.5 target size AAA: minimum 44px height
=== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: 44px;
  padding: 0 var(--sp-6);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  line-height: 1;
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--trans), color var(--trans), border-color var(--trans);
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* Primary: TDS --accent bg, --accent-text text — AAA in all four themes */
.btn-primary {
  background: var(--accent);         /* TDS: --accent */
  color: var(--accent-text);         /* TDS: --accent-text */
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);   /* TDS: --accent-hover */
  border-color: var(--accent-hover);
}

/* Secondary: card bg, accent border, accent text */
.btn-secondary {
  background: var(--bg-card);        /* TDS: --bg-card */
  color: var(--accent);              /* TDS: --accent */
  border-color: var(--accent);
}

.btn-secondary:hover {
  background: var(--accent-subtle);  /* TDS: --accent-subtle */
}

/* Danger: TDS --fail text colour adapted for button bg */
.btn-danger {
  background: var(--fail);           /* TDS: --fail */
  color: var(--bg-card);             /* White/light bg text on fail red */
  border-color: var(--fail);
}

.btn-danger:hover {
  opacity: 0.88;
}

/* Ghost: transparent, accent text */
.btn-ghost {
  background: transparent;
  color: var(--accent);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--accent-subtle);
}

/* Neutral/cancel: card bg, body text, border — #1A1A1A on #FFFFFF ≥ 16:1 (AAA) */
.btn-neutral {
  background: var(--bg-card);
  color: var(--fg);
  border-color: var(--border);
}

.btn-neutral:hover,
.btn-neutral:focus-visible {
  background: var(--bg);
  border-color: var(--fg-muted);
}


/* Back navigation link — used on admin create/edit/delete screens */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--text-sm);
  color: var(--fg-muted);
  text-decoration: none;
  margin-bottom: var(--sp-4);
}

.back-link:hover,
.back-link:focus-visible {
  color: var(--fg);
  text-decoration: underline;
}

/* Size variants */
.btn-sm {
  height: 36px;
  padding: 0 var(--sp-4);
  font-size: var(--text-sm);
}

.btn-lg {
  height: 52px;
  padding: 0 var(--sp-8);
  font-size: var(--text-lg);
}

.btn-icon {
  width: 44px;
  padding: 0;
}

/* === 11. FORMS
   WCAG 1.3.1: labels programmatically associated with inputs
   WCAG 2.4.6: visible labels
   Target size: inputs min 44px height
=== */
.form-group {
  margin-bottom: var(--sp-6);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--fg);
  margin-bottom: var(--sp-2);
}

.form-label .required-marker {
  color: var(--fail);                /* TDS: --fail */
  margin-left: 2px;
}

.form-hint {
  display: block;
  font-size: var(--text-sm);
  color: var(--fg-muted);            /* TDS: --fg-muted */
  margin-top: var(--sp-1);
}

.form-input,
.form-select,
.form-textarea {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: var(--sp-3) var(--sp-4);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--fg);
  background: var(--bg-card);        /* TDS: --bg-card */
  border: 2px solid var(--border);   /* TDS: --border */
  border-radius: var(--radius-md);
  transition: border-color var(--trans);
  appearance: none;
  -webkit-appearance: none;
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: var(--accent);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent);
  outline: 3px solid var(--accent);
  outline-offset: 1px;
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.5;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%230C3B64'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: var(--sp-10);
}

/* Checkbox and radio */
.form-check {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.form-check-input {
  width: 44px;
  height: 44px;
  min-width: 44px;
  margin-top: 0;                     /* centred with label at 44 px height */
  accent-color: var(--accent);       /* TDS: --accent */
  cursor: pointer;
}

.form-check-label {
  font-size: var(--text-base);
  color: var(--fg);
  cursor: pointer;
  line-height: 1.5;
}

/* Inline form row */
.form-row {
  display: flex;
  gap: var(--sp-4);
  align-items: flex-end;
}

.form-row .form-group {
  flex: 1;
  margin-bottom: 0;
}

/* Field error */
.form-error {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
  font-size: var(--text-sm);
  color: var(--fail);                /* TDS: --fail */
  font-weight: var(--weight-semi);
}

/* Search input variant */
.search-input-wrap {
  position: relative;
}

.search-input-wrap .search-icon {
  position: absolute;
  left: var(--sp-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-muted);
  pointer-events: none;
}

.search-input-wrap .form-input {
  padding-left: 2.75rem;
}

/* === 12. CARDS / PANELS
   brand.md "Design style: generous whitespace, clean geometric shapes"
=== */
.card {
  background: var(--bg-card);        /* TDS: --bg-card */
  border: 1px solid var(--border);   /* TDS: --border */
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);         /* TDS: --shadow */
  overflow: hidden;
}

.card-header {
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}

.card-header h2,
.card-header h3 {
  margin: 0;
}

.card-body {
  padding: var(--sp-6);
}

.card-footer {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border);
  background: var(--bg);             /* TDS: --bg (slightly off-card) */
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-3);
}

/* Occasion/item card — clickable list item style */
.item-card {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--fg);
  transition: border-color var(--trans), box-shadow var(--trans);
}

.item-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}

.item-card + .item-card {
  margin-top: var(--sp-3);
}

/* === 13. TABLES === */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.table thead th {
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  /* All-caps only for labels/badges — brand.md "Typography: All capitals" */
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-text);         /* TDS: --accent-text (white on accent) */
  background: var(--accent);         /* TDS: --accent */
  border: none;
  white-space: nowrap;
}

.table thead th:first-child {
  border-radius: var(--radius-sm) 0 0 0;
}

.table thead th:last-child {
  border-radius: 0 var(--radius-sm) 0 0;
}

.table tbody tr {
  border-bottom: 1px solid var(--border);
}

.table tbody tr:nth-child(even) {
  background: var(--bg);             /* TDS: --bg (subtle alternating row) */
}

.table tbody tr:hover {
  background: var(--accent-subtle);  /* TDS: --accent-subtle */
}

.table tbody td {
  padding: var(--sp-4);
  color: var(--fg);
  vertical-align: middle;
}

.table tfoot td {
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-xs);
  color: var(--fg-muted);
  border-top: 2px solid var(--border);
}

/* === 14. BADGES / STATUS LABELS
   WCAG 1.4.1: not colour alone — badges always include a text label
=== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  /* All-caps for labels — brand.md "Typography: All capitals" */
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

/* Accent bg, accent-text: AAA in all four themes */
.badge-primary {
  background: var(--accent);
  color: var(--accent-text);
}

/* Neutral: bg token, fg text */
.badge-neutral {
  background: var(--neutral-bg);     /* TDS: --neutral-bg */
  color: var(--fg);
  border: 1px solid var(--border);
}

/* Success */
.badge-success {
  background: var(--pass-bg);        /* TDS: --pass-bg */
  color: var(--pass);                /* TDS: --pass */
}

/* Error */
.badge-error {
  background: var(--fail-bg);        /* TDS: --fail-bg */
  color: var(--fail);                /* TDS: --fail */
}

/* Warning */
.badge-warning {
  background: var(--warn-bg);        /* TDS: --warn-bg */
  color: var(--warn);                /* TDS: --warn */
}

/* Sky accent — neutral-bg with fg text keeps AAA across themes */
.badge-sky {
  background: var(--neutral-bg);
  color: var(--fg);
}

/* === 15. ALERTS === */
.alert {
  display: flex;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--radius-md);
  border-left: 4px solid transparent;
  margin-bottom: var(--sp-6);
}

.alert-icon {
  flex-shrink: 0;
  margin-top: 2px;
}

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

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

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

.alert-info {
  background: var(--accent-subtle);
  border-color: var(--accent);
  color: var(--accent);
}

/* === 16. TAGS (group chips) === */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  list-style: none;
  padding: 0;
  margin: 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px var(--sp-3);
  background: var(--accent-subtle);  /* TDS: --accent-subtle */
  color: var(--accent);              /* TDS: --accent (AAA on accent-subtle) */
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}

/* === 17. STEP PROGRESS (card create wizard) === */
.steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: var(--sp-8);
  overflow-x: auto;
  padding-bottom: var(--sp-2);
}

.step {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}

.step-connector {
  flex: 1;
  min-width: 32px;
  height: 2px;
  background: var(--border);
}

.step-circle {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  flex-shrink: 0;
  background: var(--bg);
  color: var(--fg-muted);
  border: 2px solid var(--border);
}

.step[aria-current="step"] .step-circle {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

.step[data-done="true"] .step-circle {
  background: var(--pass);           /* TDS: --pass */
  color: var(--bg-card);
  border-color: var(--pass);
}

.step[aria-current="step"] .step-connector,
.step[data-done="true"] .step-connector {
  background: var(--accent);
}

.step-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--fg-muted);
  white-space: nowrap;
}

.step[aria-current="step"] .step-label {
  color: var(--fg);
  font-weight: var(--weight-bold);
}

/* === 18. CARD DESIGN THUMBNAIL GRID === */
.design-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--sp-5);
}

.design-thumb {
  position: relative;
  cursor: pointer;
}

.design-thumb input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 2;
  margin: 0;
}

.design-thumb-inner {
  border: 3px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--trans), box-shadow var(--trans);
}

.design-thumb input[type="radio"]:checked + .design-thumb-inner {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.design-thumb input[type="radio"]:focus-visible + .design-thumb-inner {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.design-thumb:hover .design-thumb-inner {
  border-color: var(--fg-muted);
}

.design-thumb-preview {
  width: 100%;
  aspect-ratio: 564 / 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.design-thumb-label {
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 3;
}

.design-thumb-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--fg);
  display: block;
}

.design-thumb-style {
  font-size: var(--text-xs);
  color: var(--fg-muted);
}

.design-preview-btn {
  position: relative;
  z-index: 3;
  cursor: pointer;
  font-size: var(--text-sm);
}

/* === 19. ADMIN DESIGN LIST === */
.design-list { list-style: none; margin: 0; padding: 0; }
.design-list-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.design-list-row:first-child { border-radius: var(--radius-md) var(--radius-md) 0 0; }
.design-list-row:last-child  { border-radius: 0 0 var(--radius-md) var(--radius-md); border-bottom: none; }

/* === 20. SITE FOOTER === */
.site-footer {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border);
  background: var(--bg);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

.site-footer a {
  color: var(--accent);
  font-weight: 600;
}

/* === 20. OCCASION TYPE ICONS (inline SVG helpers) === */
.occasion-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* === 21. SIGNING CANVAS LAYOUT
   Specific to card-signing.html
   The signing canvas is a standalone immersive view; it uses its own
   dark surface (#1a1a2e) which is separate from the TDS --bg dark tokens.
   TDS semantic tokens are still used for the format panel sidebar.
=== */
.signing-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--nav-height));
  overflow: hidden;
  background: #1a1a2e;
}

.signing-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-5);
  background: #12122a;
  color: var(--accent-text);
  flex-shrink: 0;
  gap: var(--sp-4);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  min-height: 52px;
}

.signing-top-bar :focus-visible {
  outline-color: #FFFFFF;
}

.signing-top-title {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: #FFFFFF;
}

.signing-top-subtitle {
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.65);
}

.signing-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.signing-sidebar {
  width: 64px;
  background: #12122a;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--sp-4) 0;
  gap: var(--sp-3);
  border-right: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}

.signing-tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  transition: background var(--trans), color var(--trans);
  gap: 2px;
  font-size: 0.6rem;
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-family: var(--font-sans);
}

.signing-tool-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #FFFFFF;
}

.signing-tool-btn[aria-pressed="true"] {
  background: var(--accent);         /* TDS: --accent adapts across themes */
  color: var(--accent-text);
}

.signing-tool-btn:focus-visible {
  outline: 3px solid #FFFFFF;
  outline-offset: 2px;
}

.signing-tool-sep {
  width: 36px;
  height: 1px;
  background: rgba(255,255,255,0.12);
  flex-shrink: 0;
}

.signing-canvas-wrap {
  flex: 1;
  overflow-x: auto;
  overflow-y: auto;
  display: flex;
  align-items: flex-start;
  padding: var(--sp-6);
  background: #1a1a2e;
  gap: var(--sp-6);
}

.signing-canvas {
  position: relative;
  width: 564px;
  min-width: 564px;
  height: 800px;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 4px 32px rgba(0,0,0,0.6);
  flex-shrink: 0;
  background: #FFFFFF;
  background-size: cover;
  background-position: center;
}

.signing-page-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
}

.signing-pages-row {
  display: flex;
  flex-direction: row;
  gap: var(--sp-4);
  align-items: flex-start;
}

.signing-page-label {
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  user-select: none;
}

.signing-format-panel {
  width: 320px;
  background: var(--bg-card);        /* TDS: --bg-card */
  border-left: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.format-panel-head {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
  font-weight: var(--weight-bold);
  font-size: var(--text-sm);
  color: var(--fg);
  background: var(--bg);
}

.format-panel-body {
  padding: var(--sp-5);
  flex: 1;
  overflow-y: auto;
}

.format-panel-footer {
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--border);
  background: var(--bg);
}

/* Toolbar row within format panel */
.format-toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
}

.fmt-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  height: 36px;
  padding: 0 var(--sp-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  cursor: pointer;
  transition: background var(--trans);
}

.fmt-btn:hover {
  background: var(--bg);
}

.fmt-btn[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  box-shadow: inset 0 -3px 0 0 var(--accent-text);
}

/* Colour swatch grid */
.colour-palette {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: var(--sp-1);
  margin-bottom: var(--sp-3);
}

.colour-swatch {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform var(--trans);
}

.colour-swatch:hover {
  transform: scale(1.15);
}

.colour-swatch.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 4px var(--accent);
}

/* === 22. CANVAS CONTRIBUTION ITEMS === */
.canvas-contribution {
  position: absolute;
  cursor: move;
  user-select: none;
  max-width: 240px;
}

.canvas-contribution-inner {
  background: rgba(255,255,255,0.92);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  box-shadow: 0 2px 12px rgba(0,0,0,0.35);
}

.canvas-contribution-name {
  font-size: 0.7rem;
  font-weight: var(--weight-bold);
  color: var(--brand-navy);          /* TDS: --brand-navy (constant, always legible on white) */
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.canvas-contribution-text {
  font-size: var(--text-sm);
  color: #1a1a1a;
  line-height: 1.4;
  word-break: break-word;
}

.canvas-contribution-photo {
  width: 160px;
  height: 100px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  display: block;
}

.canvas-photo-wrap {
  position: absolute;
  cursor: move;
}

/* === 23. RESPONSIVE === */
@media (max-width: 900px) {
  .layout-sidebar {
    grid-template-columns: 1fr;
  }

  .layout-2col {
    grid-template-columns: 1fr;
    gap: var(--sp-6);
  }
}

@media (max-width: 768px) {
  .site-header-inner {
    padding: 0 var(--sp-4);
    gap: var(--sp-3);
  }

  .nav-list {
    display: none;
  }

  .mobile-nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    /* WCAG 2.2 SC 2.5.5 — 44×44 minimum touch target */
    min-width: 44px;
    min-height: 44px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--accent-text);
    border-radius: var(--radius-md);
    flex-shrink: 0;
    padding: 0;
    font-family: inherit;
  }

  .mobile-nav-toggle:hover {
    background: rgba(255,255,255,0.12);
  }

  .mobile-nav-toggle:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
  }

  .container {
    padding: 0 var(--sp-4);
  }

  .page-header-row {
    flex-direction: column;
  }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }

  .signing-body {
    flex-direction: column;
    overflow: auto;
  }

  .signing-format-panel {
    display: flex;
    width: 100%;
    max-width: none;
    border-left: none;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
  }

  .signing-canvas-wrap {
    flex: none;
    padding: var(--sp-3);
    overflow-x: auto;
    max-height: 55vh;
  }

  .signing-canvas {
    width: 100%;
    min-width: unset;
    height: auto;
    aspect-ratio: 564 / 800;
  }

  /* WCAG 2.2 SC 2.5.5 — 44×44 minimum touch target for toolbar buttons */
  .fmt-btn {
    min-width: 44px;
    min-height: 44px;
    height: 44px;
  }
}

/* === 24. MOBILE NAVIGATION PANEL === */
#mobile-nav-panel {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: var(--sp-4) var(--sp-6);
  position: sticky;
  top: var(--nav-height);
  z-index: 99;
  box-shadow: var(--shadow-md);
}

.mobile-nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  /* WCAG 2.2 SC 2.5.5 — 44×44 minimum touch target */
  min-height: 44px;
  padding: 0 var(--sp-4);
  color: var(--fg);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: var(--weight-semi);
  border-radius: var(--radius-md);
  transition: background var(--trans), color var(--trans);
}

.mobile-nav-link:hover {
  background: var(--bg-subtle);
  color: var(--accent);
}

.mobile-nav-link[aria-current="page"] {
  color: var(--accent);
  font-weight: var(--weight-bold);
}

.mobile-nav-link:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.mobile-nav-divider {
  height: 1px;
  background: var(--border);
  margin: var(--sp-2) var(--sp-4);
  list-style: none;
}

/* Never display the mobile nav panel on desktop regardless of JS state */
@media (min-width: 769px) {
  #mobile-nav-panel {
    display: none !important;
  }
}

/* === 27. DASHBOARD BALANCE PANEL (Sprint 11, Issue #88; compacted Sprint 12, Issue #156) === */

.dashboard-balance-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--sp-3) var(--sp-4);
    margin-bottom: var(--sp-4);
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--sp-2) var(--sp-4);
}

.dashboard-balance-card--empty {
    border-style: dashed;
    background: var(--bg-subtle, var(--bg));
}

.dashboard-balance-card--low {
    border-color: var(--warn, #f59e0b);
}

.balance-label {
    font-size: var(--text-xs, 0.7rem);
    font-weight: 600;
    color: var(--fg-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
    flex-basis: 100%;
}

.balance-number {
    font-size: 1.75rem;
    font-weight: 900;
    color: var(--accent);
    line-height: 1;
}

.balance-unit {
    font-size: var(--text-sm);
    color: var(--fg-muted);
    margin: 0;
}

.balance-plan {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--fg);
    margin: 0;
}

.balance-unlimited {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--accent);
    margin: 0;
}

.balance-warning {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-3);
    background: var(--warn-bg, #fef3c7);
    border: 1px solid var(--warn, #f59e0b);
    border-radius: var(--radius-md);
    color: var(--warn, #92400e);
    font-size: var(--text-sm);
    font-weight: 600;
}

.balance-warning svg {
    flex-shrink: 0;
    color: var(--warn, #f59e0b);
}

.balance-expiry {
    font-size: var(--text-xs, 0.7rem);
    color: var(--fg-muted);
    margin: 0;
    flex-basis: 100%;
}

.balance-cta {
    margin-left: auto;
}

/* === 26. PRINT (card-view.html download/print) === */
@media print {
  .site-header,
  .site-footer,
  .theme-switcher,
  .btn,
  .no-print {
    display: none !important;
  }

  body {
    background: white;
  }
}

/* === 27. Card viewer === */

/* Top bar */
.cv-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: #12122a;
    color: #ffffff;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
    gap: 16px;
    flex-wrap: wrap;
}

.cv-top-bar h1 {
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
}

/* Main layout */
.cv-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 16px 16px;
    gap: 16px;
    overflow-y: auto;
    background: #1a1a2e;
}

/* Unified control button — used by both zoom and page-nav */
.cv-ctrl-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.25);
    color: #ffffff;
    border-radius: 4px;
    padding: 4px 12px;
    font-size: 0.875rem;
    cursor: pointer;
    line-height: 1.4;
    min-height: 44px;
    min-width: 44px;
}

.cv-ctrl-btn:hover:not(:disabled) {
    background: rgba(255,255,255,0.2);
}

.cv-ctrl-btn:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.cv-ctrl-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Single merged controls bar: [← Prev] [−] [100%] [+] [Next →] */
.cv-controls-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 564px;
    justify-content: space-between;
}

.cv-controls-bar .cv-page-indicator {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.7);
    white-space: nowrap;
    text-align: center;
    flex: 1;
}

.cv-controls-zoom {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Canvas wrap — width driven by JS for zoom */
.cv-canvas-wrap {
    width: 564px;
    max-width: 100%;
    transition: width 0.1s ease;
}

/* Canvas — fills wrap, height follows aspect-ratio (no fixed px height) */
.cv-canvas {
    position: relative;
    width: 100%;
    aspect-ratio: 564 / 800;
    height: auto;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 32px rgba(0,0,0,0.6);
    background: #ffffff;
    background-size: cover;
    background-position: center;
}

/* Thumbnail rail */
.cv-thumb-rail {
    display: flex;
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 6px;
    width: 100%;
    max-width: 564px;
    -webkit-overflow-scrolling: touch;
    list-style: none;
    margin: 0;
}

.cv-thumb-rail::-webkit-scrollbar {
    height: 4px;
}
.cv-thumb-rail::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
}
.cv-thumb-rail::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
}

.cv-thumb {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 4px;
    padding: 4px 8px 6px;
    cursor: pointer;
    min-width: 64px;
    min-height: 44px;
    color: #ffffff;
    font-size: 0.7rem;
}

.cv-thumb:hover {
    background: rgba(255,255,255,0.12);
}

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

/* Active: 3px accent outline AND bold label — not colour alone (WCAG 1.4.1) */
.cv-thumb[aria-pressed="true"] {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
    font-weight: 700;
}

.cv-thumb-mini {
    width: 40px;
    height: 56px;
    border-radius: 3px;
    background: #e0e0e0;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.cv-thumb-label {
    white-space: nowrap;
}
