/* =========================================================================
   Donează și câștigă — Lions Clubs District 124 România
   Design system propriu, fără dependențe externe.

   Scalarea interfeței (1× / 1,5×) NU folosește proprietatea CSS `zoom`, care
   se comportă neuniform între browsere. În schimb, `html` primește o
   dimensiune de font calculată din `--ui-scale`, iar ABSOLUT tot restul foii
   este exprimat în `rem`. Astfel, textul, butoanele, spațierile, câmpurile de
   formular și variantele de răspuns cresc coerent, împreună.
   ========================================================================= */

/* ---------------------------------------------------------------- 1. Tokens */

:root {
  /* Paleta Lions */
  --lions-blue: #00338d;
  --lions-blue-dark: #001f56;
  --lions-blue-light: #1a56b8;
  --lions-gold: #ebb700;
  --lions-gold-dark: #c39a00;
  --lions-gold-light: #ffd233;

  /* Scalarea interfeței: 1 sau 1.5 */
  --ui-scale: 1;

  /* Spațiere — toate în rem, deci scalabile */
  --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;

  --radius-sm: 0.25rem;
  --radius: 0.5rem;
  --radius-lg: 0.875rem;
  --radius-full: 999rem;

  --container: 75rem;
  --container-narrow: 48rem;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;

  --transition: 150ms ease;
}

/* --- Tema luminoasă (implicită) --- */
:root,
:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f4f6fa;
  --bg-elevated: #ffffff;
  --bg-sunken: #e8ecf4;
  --bg-inset: #eef1f7;

  --text: #14203a;
  --text-muted: #55617c;
  --text-subtle: #737e97;
  --text-inverse: #ffffff;

  --border: #d3dae7;
  --border-strong: #b3bdd0;

  --brand: var(--lions-blue);
  --brand-hover: var(--lions-blue-light);
  --brand-contrast: #ffffff;
  --on-brand-muted: #d5e0f5;

  --accent: var(--lions-gold);
  --accent-hover: var(--lions-gold-dark);
  /* Textul pe galben trebuie să fie închis — galbenul cu alb nu trece AA. */
  --accent-contrast: #14203a;

  --header-bg: var(--lions-blue);
  --header-text: #ffffff;

  --success: #0f7b47;
  --success-bg: #e2f5eb;
  --danger: #b3261e;
  --danger-bg: #fdeceb;
  --warning: #8a5a00;
  --warning-bg: #fdf3dd;
  --info: #0b5f96;
  --info-bg: #e4f1fb;

  --shadow-sm: 0 1px 2px rgba(16, 28, 56, 0.08);
  --shadow: 0 2px 8px rgba(16, 28, 56, 0.1);
  --shadow-lg: 0 8px 28px rgba(16, 28, 56, 0.14);

  --focus-ring: var(--lions-blue);
}

/* --- Tema întunecată --- */
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0d1424;
  --bg-elevated: #161f34;
  --bg-sunken: #090f1c;
  --bg-inset: #1d2842;

  --text: #e9edf6;
  --text-muted: #a6b1c8;
  --text-subtle: #8390ab;
  --text-inverse: #0d1424;

  --border: #2b3852;
  --border-strong: #3d4d6d;

  /* Albastrul Lions pur e prea închis pe fundal întunecat; folosim varianta
     deschisă, ca să păstrăm contrastul cerut de WCAG. */
  --brand: #7ea6ee;
  --brand-hover: #a3c0f4;
  --brand-contrast: #06101f;
  --on-brand-muted: #2b3852;

  --accent: var(--lions-gold);
  --accent-hover: var(--lions-gold-light);
  --accent-contrast: #14203a;

  --header-bg: #081226;
  --header-text: #ffffff;

  --success: #56d39b;
  --success-bg: #10301f;
  --danger: #ff8a80;
  --danger-bg: #3a1614;
  --warning: #ffc94d;
  --warning-bg: #362703;
  --info: #74bdf4;
  --info-bg: #0c2941;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 10px 32px rgba(0, 0, 0, 0.55);

  --focus-ring: #ffd233;
}

/* Respectarea preferinței sistemului de operare când tema este „system”. */
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    color-scheme: dark;

    --bg: #0d1424;
    --bg-elevated: #161f34;
    --bg-sunken: #090f1c;
    --bg-inset: #1d2842;

    --text: #e9edf6;
    --text-muted: #a6b1c8;
    --text-subtle: #8390ab;
    --text-inverse: #0d1424;

    --border: #2b3852;
    --border-strong: #3d4d6d;

    --brand: #7ea6ee;
    --brand-hover: #a3c0f4;
    --brand-contrast: #06101f;
    --on-brand-muted: #2b3852;

    --accent: var(--lions-gold);
    --accent-hover: var(--lions-gold-light);
    --accent-contrast: #14203a;

    --header-bg: #081226;
    --header-text: #ffffff;

    --success: #56d39b;
    --success-bg: #10301f;
    --danger: #ff8a80;
    --danger-bg: #3a1614;
    --warning: #ffc94d;
    --warning-bg: #362703;
    --info: #74bdf4;
    --info-bg: #0c2941;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 10px 32px rgba(0, 0, 0, 0.55);

    --focus-ring: #ffd233;
  }
}

/* ------------------------------------------------------------ 2. Reset/bază */

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

* {
  margin: 0;
}

html {
  /* Punctul unic din care scalează întreaga interfață. */
  font-size: calc(100% * var(--ui-scale));
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  /* Nicio pagină nu trebuie să genereze scroll orizontal (§7). */
  overflow-x: hidden;
}

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

a {
  color: var(--brand);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--brand-hover);
}

/* Focus vizibil, obligatoriu pentru navigarea cu tastatura (§6). */
:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

:focus:not(:focus-visible) {
  outline: none;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.25;
  font-weight: 700;
  color: var(--text);
  text-wrap: balance;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.0625rem; }

p, ul, ol, table, pre, blockquote {
  margin-bottom: var(--space-4);
}

ul, ol {
  padding-left: 1.5rem;
}

li + li {
  margin-top: var(--space-1);
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-inset);
  padding: 0.1em 0.35em;
  border-radius: var(--radius-sm);
}

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

/* Link „Sari la conținut” pentru utilizatorii de tastatură/cititor de ecran. */
.skip-link {
  position: absolute;
  left: var(--space-3);
  top: -10rem;
  z-index: 200;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  font-weight: 600;
  transition: top var(--transition);
}

.skip-link:focus {
  top: var(--space-3);
}

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

/* ----------------------------------------------------------------- 3. Layout */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

.container-narrow {
  max-width: var(--container-narrow);
}

main {
  flex: 1 0 auto;
  padding-block: var(--space-6) var(--space-8);
}

.stack > * + * {
  margin-top: var(--space-4);
}

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

.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
}

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

/* ----------------------------------------------------------------- 4. Antet */

.site-header {
  background: var(--header-bg);
  color: var(--header-text);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 3px solid var(--accent);
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-height: 4.25rem;
  padding-block: var(--space-2);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--header-text);
  text-decoration: none;
  flex-shrink: 0;
}

.brand:hover {
  color: var(--header-text);
}

.brand-logo {
  width: 2.75rem;
  height: 2.75rem;
  object-fit: contain;
  flex-shrink: 0;
}

/* Placeholder folosit când fișierul de logo lipsește. */
.brand-logo-placeholder {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--lions-blue-dark);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-weight: 800;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
}

.brand-org {
  font-size: 0.75rem;
  color: var(--on-brand-muted);
  font-weight: 500;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-left: auto;
  flex-wrap: wrap;
}

.site-nav a,
.site-nav .nav-button {
  color: var(--header-text);
  text-decoration: none;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
  /* Ținte tactile suficient de mari (§6). */
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.site-nav a:hover,
.site-nav .nav-button:hover {
  background: rgba(255, 255, 255, 0.14);
  color: var(--header-text);
}

.site-nav a[aria-current="page"] {
  background: rgba(255, 255, 255, 0.2);
  font-weight: 700;
}

/* Selectorul include `.site-header` intenționat: `.btn` este declarat mai jos
   în fișier și, la specificitate egală, ar câștiga cu `display: inline-flex`,
   făcând butonul de meniu vizibil și pe desktop. */
.site-header .nav-toggle {
  display: none;
  margin-left: auto;
}

/* Meniul utilizatorului */
.user-menu {
  position: relative;
}

.user-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + var(--space-2));
  min-width: 17rem;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-3);
  z-index: 120;
}

.user-menu-panel[hidden] {
  display: none;
}

.user-menu-panel a,
.user-menu-panel button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: var(--space-2);
  color: var(--text);
  text-decoration: none;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  min-height: 2.75rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

.user-menu-panel a:hover,
.user-menu-panel button:hover {
  background: var(--bg-inset);
  color: var(--text);
}

.user-menu-header {
  padding: var(--space-2) var(--space-3) var(--space-3);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-2);
}

.user-menu-name {
  font-weight: 700;
}

.user-menu-club {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.menu-group-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
  font-weight: 700;
  padding: var(--space-3) var(--space-3) var(--space-1);
}

/* Grup de butoane radio pentru temă și zoom */
.pref-group {
  display: flex;
  gap: var(--space-1);
  padding: 0 var(--space-2) var(--space-2);
}

.pref-group button {
  flex: 1;
  justify-content: center;
  border: 1px solid var(--border);
  font-size: 0.875rem;
  min-height: 2.5rem;
}

.pref-group button[aria-pressed="true"] {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-contrast);
  font-weight: 700;
}

.pref-group button[aria-pressed="true"]:hover {
  background: var(--brand-hover);
  color: var(--brand-contrast);
}

/* ---------------------------------------------------------------- 5. Butoane */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  /* Minimum 2.75rem ≈ 44px la scala 1×, cerința pentru ținte tactile. */
  min-height: 2.75rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
  text-align: center;
}

.btn:active {
  transform: translateY(1px);
}

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

.btn-primary {
  background: var(--brand);
  color: var(--brand-contrast);
  border-color: var(--brand);
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  color: var(--brand-contrast);
}

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

.btn-accent:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--accent-contrast);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-inset);
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  color: var(--brand);
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-inset);
}

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

.btn-danger:hover:not(:disabled) {
  filter: brightness(1.1);
  color: #ffffff;
}

.btn-sm {
  padding: var(--space-2) var(--space-3);
  min-height: 2.25rem;
  font-size: 0.875rem;
}

.btn-lg {
  padding: var(--space-4) var(--space-6);
  min-height: 3.25rem;
  font-size: 1.125rem;
}

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

/* -------------------------------------------------------------- 6. Formulare */

.field {
  margin-bottom: var(--space-4);
}

.field label,
.label {
  display: block;
  font-weight: 600;
  font-size: 0.9375rem;
  margin-bottom: var(--space-2);
  color: var(--text);
}

.required-mark {
  color: var(--danger);
  font-weight: 700;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="url"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: var(--space-3);
  min-height: 2.75rem;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  transition: border-color var(--transition), box-shadow var(--transition);
}

textarea {
  min-height: 7rem;
  resize: vertical;
  line-height: 1.5;
}

select {
  cursor: pointer;
  /* Spațiu pentru săgeata nativă, ca textul lung să nu se suprapună. */
  padding-right: var(--space-6);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent);
  outline: none;
}

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

input::placeholder,
textarea::placeholder {
  color: var(--text-subtle);
}

input:disabled,
select:disabled,
textarea:disabled {
  background: var(--bg-inset);
  color: var(--text-muted);
  cursor: not-allowed;
}

.field-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: var(--space-2);
}

.field-error {
  font-size: 0.875rem;
  color: var(--danger);
  margin-top: var(--space-2);
  font-weight: 600;
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}

/* Bifă și radio */
.check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  cursor: pointer;
  padding: var(--space-2) 0;
  min-height: 2.75rem;
}

.check input[type="checkbox"],
.check input[type="radio"] {
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.2rem;
  flex-shrink: 0;
  accent-color: var(--brand);
  cursor: pointer;
}

.check span {
  font-size: 0.9375rem;
  line-height: 1.5;
}

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

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

/* Selector de club cu căutare (§8.1) */
.club-picker {
  position: relative;
}

.club-picker-results {
  max-height: 18rem;
  overflow-y: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  margin-top: var(--space-2);
  background: var(--bg-elevated);
}

.club-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--space-3);
  border: none;
  border-bottom: 1px solid var(--border);
  background: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--text);
  min-height: 2.75rem;
}

.club-option:last-child {
  border-bottom: none;
}

.club-option:hover,
.club-option:focus,
.club-option[aria-selected="true"] {
  background: var(--bg-inset);
}

.club-option[aria-selected="true"] {
  border-left: 4px solid var(--brand);
  font-weight: 600;
}

.club-option-name {
  font-weight: 600;
  display: block;
}

.club-option-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
  display: block;
  margin-top: 0.1rem;
}

.club-picker-empty {
  padding: var(--space-4);
  color: var(--text-muted);
  text-align: center;
  font-size: 0.9375rem;
}

.club-selected {
  margin-top: var(--space-3);
  padding: var(--space-3);
  background: var(--info-bg);
  border: 1px solid var(--info);
  border-radius: var(--radius);
  font-size: 0.9375rem;
}

/* ----------------------------------------------------------------- 7. Carduri */

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

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

.card-title {
  font-size: 1.1875rem;
  font-weight: 700;
  margin: 0;
}

.card-compact {
  padding: var(--space-4);
}

/* Erou pe prima pagină */
.hero {
  background: linear-gradient(135deg, var(--lions-blue-dark) 0%, var(--lions-blue) 55%, var(--lions-blue-light) 100%);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: var(--space-7) var(--space-6);
  margin-bottom: var(--space-6);
  position: relative;
  overflow: hidden;
}

.hero::after {
  /* Accent auriu discret, pur decorativ. */
  content: "";
  position: absolute;
  right: -6rem;
  top: -6rem;
  width: 20rem;
  height: 20rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(235, 183, 0, 0.28) 0%, transparent 70%);
  pointer-events: none;
}

.hero h1 {
  color: #ffffff;
  font-size: 2.25rem;
  margin-bottom: var(--space-3);
  position: relative;
}

.hero p {
  color: #dbe5f7;
  font-size: 1.0625rem;
  max-width: 44rem;
  position: relative;
}

.hero .cluster {
  position: relative;
  margin-top: var(--space-5);
}

/* Casete de statistici */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: var(--space-4);
}

.stat {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  padding: var(--space-4);
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.15;
  margin-top: var(--space-1);
  color: var(--text);
}

.stat-sub {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.stat-accent { border-left-color: var(--accent); }
.stat-success { border-left-color: var(--success); }
.stat-danger { border-left-color: var(--danger); }

/* ----------------------------------------------------------------- 8. Tabele */

.table-wrap {
  /* Tabelele largi derulează în propriul container, nu împing pagina (§7). */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

thead th {
  background: var(--bg-inset);
  text-align: left;
  font-weight: 700;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: var(--space-3);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: var(--space-3);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--bg-inset);
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Clasament */
.rank-badge {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-full);
  background: var(--bg-inset);
  color: var(--text);
  font-weight: 800;
  font-size: 0.875rem;
  border: 1px solid var(--border);
}

.rank-1 { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent-hover); }
.rank-2 { background: #c9ced8; color: #14203a; border-color: #aeb5c2; }
.rank-3 { background: #d9a273; color: #2c1a0a; border-color: #c08a5c; }

.rank-me {
  background: var(--info-bg);
  outline: 2px solid var(--info);
}

/* ------------------------------------------------------- 9. Alerte și mesaje */

.notice {
  padding: var(--space-4);
  border-radius: var(--radius);
  border: 1px solid;
  border-left-width: 4px;
  margin-bottom: var(--space-4);
  font-size: 0.9375rem;
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

.notice-icon {
  flex-shrink: 0;
  font-weight: 800;
  font-size: 1.125rem;
  line-height: 1.4;
}

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

.notice-success { background: var(--success-bg); border-color: var(--success); color: var(--text); }
.notice-danger  { background: var(--danger-bg);  border-color: var(--danger);  color: var(--text); }
.notice-warning { background: var(--warning-bg); border-color: var(--warning); color: var(--text); }
.notice-info    { background: var(--info-bg);    border-color: var(--info);    color: var(--text); }

.empty-state {
  text-align: center;
  padding: var(--space-7) var(--space-4);
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-3);
  opacity: 0.6;
}

.empty-state h3 {
  color: var(--text);
  margin-bottom: var(--space-2);
}

/* --------------------------------------------------------------- 10. Insigne */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.2rem var(--space-2);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid;
  white-space: nowrap;
}

.badge-neutral { background: var(--bg-inset);  border-color: var(--border-strong); color: var(--text-muted); }
.badge-success { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.badge-danger  { background: var(--danger-bg);  border-color: var(--danger);  color: var(--danger); }
.badge-warning { background: var(--warning-bg); border-color: var(--warning); color: var(--warning); }
.badge-info    { background: var(--info-bg);    border-color: var(--info);    color: var(--info); }
.badge-brand   { background: var(--brand); border-color: var(--brand); color: var(--brand-contrast); }

/* Dificultatea nu se transmite doar prin culoare — are și text (§6). */
.difficulty-1 { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.difficulty-2 { background: var(--warning-bg); border-color: var(--warning); color: var(--warning); }
.difficulty-3 { background: var(--danger-bg);  border-color: var(--danger);  color: var(--danger); }

/* --------------------------------------------------------------- 11. Quiz UI */

.quiz-bar {
  position: sticky;
  top: 4.25rem;
  z-index: 90;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow);
}

.quiz-bar-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.quiz-progress-label {
  font-weight: 700;
  font-size: 1rem;
}

.timer {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-variant-numeric: tabular-nums;
  font-size: 1.375rem;
  font-weight: 800;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius);
  background: var(--bg-inset);
  border: 2px solid var(--border-strong);
  color: var(--text);
  min-width: 7rem;
  justify-content: center;
}

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

.timer-critical {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.62; }
}

.progress {
  height: 0.625rem;
  background: var(--bg-inset);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  border-radius: var(--radius-full);
  transition: width 400ms linear;
}

.progress-fill-time {
  background: var(--brand);
}

.progress-fill-time.is-warning { background: var(--warning); }
.progress-fill-time.is-critical { background: var(--danger); }

.question-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  margin-bottom: var(--space-4);
}

.question-text {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: var(--space-5);
  text-wrap: pretty;
}

/* Variantele de răspuns — pe mobil se afișează întotdeauna vertical (§7). */
.options {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  list-style: none;
  padding: 0;
  margin: 0;
}

.options li {
  margin: 0;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-4);
  min-height: 3.25rem;
  background: var(--bg-elevated);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: 1.0625rem;
  line-height: 1.45;
  color: var(--text);
  transition: border-color var(--transition), background var(--transition);
}

.option:hover:not(:disabled) {
  border-color: var(--brand);
  background: var(--bg-inset);
}

.option:disabled {
  cursor: default;
  opacity: 0.9;
}

.option-letter {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-full);
  background: var(--bg-inset);
  border: 1px solid var(--border-strong);
  font-weight: 800;
  font-size: 0.9375rem;
}

.option[aria-pressed="true"],
.option.is-selected {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 12%, var(--bg-elevated));
}

.option[aria-pressed="true"] .option-letter,
.option.is-selected .option-letter {
  background: var(--brand);
  color: var(--brand-contrast);
  border-color: var(--brand);
}

/* Marcarea corect/greșit din pagina de rezultat. Nu se bazează doar pe
   culoare: fiecare stare are și un simbol și o etichetă text (§6). */
.option.is-correct {
  border-color: var(--success);
  background: var(--success-bg);
}

.option.is-correct .option-letter {
  background: var(--success);
  color: #ffffff;
  border-color: var(--success);
}

.option.is-wrong {
  border-color: var(--danger);
  background: var(--danger-bg);
}

.option.is-wrong .option-letter {
  background: var(--danger);
  color: #ffffff;
  border-color: var(--danger);
}

.option-mark {
  margin-left: auto;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 0.8125rem;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding-left: var(--space-3);
}

.quiz-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: space-between;
  margin-top: var(--space-5);
}

/* Harta întrebărilor */
.question-map {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.map-dot {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  display: grid;
  place-items: center;
}

.map-dot.is-answered {
  background: var(--brand);
  color: var(--brand-contrast);
  border-color: var(--brand);
}

.map-dot.is-current {
  outline: 3px solid var(--accent);
  outline-offset: 1px;
}

.map-dot:disabled {
  cursor: not-allowed;
  opacity: 0.75;
}

/* Rezultat */
.score-hero {
  text-align: center;
  padding: var(--space-6);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-5);
}

.score-value {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}

.score-caption {
  font-size: 1.0625rem;
  color: var(--text-muted);
  margin-top: var(--space-2);
}

/* ---------------------------------------------------------------- 12. Subsol */

.site-footer {
  background: var(--lions-blue-dark);
  color: #c6d2e8;
  padding-block: var(--space-6);
  margin-top: auto;
  border-top: 3px solid var(--accent);
  font-size: 0.9375rem;
}

.site-footer a {
  color: #ffffff;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}

.footer-heading {
  color: #ffffff;
  font-weight: 700;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-3);
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li + li {
  margin-top: var(--space-2);
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  padding-top: var(--space-4);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: space-between;
  font-size: 0.875rem;
  color: #9fb0cc;
}

/* ------------------------------------------------------- 13. Conținut editat */

.prose {
  max-width: 46rem;
}

.prose h2 {
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 2px solid var(--border);
}

.prose h3 {
  margin-top: var(--space-5);
  margin-bottom: var(--space-2);
}

.prose h2:first-child,
.prose h3:first-child {
  margin-top: 0;
}

.prose table {
  border: 1px solid var(--border);
}

.prose td,
.prose th {
  padding: var(--space-3);
  border: 1px solid var(--border);
}

/* ------------------------------------------------------------ 14. Paginare */

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  list-style: none;
  padding: 0;
  margin-top: var(--space-5);
  justify-content: center;
}

.pagination li { margin: 0; }

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0 var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  background: var(--bg-elevated);
  font-size: 0.9375rem;
}

.pagination a:hover {
  background: var(--bg-inset);
}

.pagination .active span,
.pagination [aria-current="page"] {
  background: var(--brand);
  color: var(--brand-contrast);
  border-color: var(--brand);
  font-weight: 700;
}

.pagination .disabled span {
  opacity: 0.45;
  cursor: not-allowed;
}

/* -------------------------------------------------------------- 15. Utilități */

.text-muted { color: var(--text-muted); }
.text-subtle { color: var(--text-subtle); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.8125rem; }
.text-lg { font-size: 1.125rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.font-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }

.w-full { width: 100%; }
.flex-1 { flex: 1; }
.ml-auto { margin-left: auto; }

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

/* ------------------------------------------------------------ 16. Responsive */

@media (max-width: 62rem) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 48rem) {
  /* --- Meniu mobil --- */
  .site-header .nav-toggle {
    display: inline-flex;
  }

  .site-nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--header-bg);
    padding: var(--space-3);
    border-top: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: var(--shadow-lg);
    max-height: calc(100vh - 4.25rem);
    overflow-y: auto;
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-header .container {
    position: relative;
    flex-wrap: wrap;
  }

  .site-nav a,
  .site-nav .nav-button {
    width: 100%;
    justify-content: flex-start;
  }

  .user-menu {
    width: 100%;
  }

  .user-menu-panel {
    position: static;
    width: 100%;
    margin-top: var(--space-2);
    box-shadow: none;
  }

  /* --- Conținut --- */
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  h1 { font-size: 1.625rem; }
  h2 { font-size: 1.3125rem; }

  .hero {
    padding: var(--space-6) var(--space-4);
  }

  .hero h1 { font-size: 1.75rem; }

  .card,
  .question-card {
    padding: var(--space-4);
  }

  .question-text {
    font-size: 1.125rem;
  }

  .option {
    padding: var(--space-3);
    font-size: 1rem;
  }

  .quiz-bar {
    /* Cronometrul rămâne vizibil pe mobil, lipit sub antet (§7). */
    top: 4.25rem;
    padding: var(--space-3);
  }

  .quiz-bar-top {
    flex-direction: row;
    align-items: center;
  }

  .timer {
    font-size: 1.125rem;
    min-width: 5.5rem;
    padding: var(--space-2) var(--space-3);
  }

  .score-value {
    font-size: 2.5rem;
  }

  .btn {
    /* Butoanele principale ocupă lățimea pe ecrane mici. */
    width: 100%;
  }

  .cluster > .btn,
  .quiz-nav > .btn,
  .form-actions > .btn {
    flex: 1 1 100%;
  }

  .btn-sm,
  .cluster > .btn-sm {
    width: auto;
    flex: 0 0 auto;
  }
}

@media (max-width: 24.5rem) {
  .container {
    padding-inline: var(--space-3);
  }

  .brand-name { font-size: 1rem; }
  .brand-org { font-size: 0.6875rem; }
  .brand-logo,
  .brand-logo-placeholder { width: 2.25rem; height: 2.25rem; }

  .option-letter {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.8125rem;
  }
}

/* ------------------------------------------------------------- 17. Tipărire */

@media print {
  .site-header,
  .site-footer,
  .quiz-nav,
  .no-print {
    display: none !important;
  }

  body {
    background: #ffffff;
    color: #000000;
  }
}
