/* ============================================================
 * Cloud Energy QHSE — Design System v2 (world-class elevation)
 *
 * Tokens: brand + semantic; light/dark via media + [data-theme]
 * Type   : Inter — 5-step scale (12 · 14 · 16 · 20 · 32/48 fluid)
 * Motion : subtle, purposeful; respects prefers-reduced-motion
 * Layout : mobile-first; nav sidebar collapses on narrow viewports
 * ============================================================ */

:root {
  /* brand — CloudEnergi: deep blue (trust/professional) + fresh green (safety/environment) */
  --ce-blue:      #1F4E9D;        /* Cloud logo blue */
  --ce-blue-700:  #163A78;        /* darker for hover / gradient end */
  --ce-blue-500:  #2E63B5;        /* mid */
  --ce-blue-300:  #6E9BE0;        /* light accent */
  --ce-blue-100:  #DCE6F5;        /* wash */
  --ce-green:     #7CB342;        /* Energi logo green */
  --ce-green-700: #5F9130;
  --ce-green-500: #8CC63F;
  --ce-green-300: #B8DE8C;
  --ce-green-100: #E8F4D8;
  --ce-navy:      #0F2A54;        /* deep header/hero backdrop */
  --ce-navy-700:  #081A38;
  --ce-navy-400:  #1E3E70;
  --ce-teal:      #2CA6A4;
  --ce-teal-300:  #7CD1CF;
  --ce-amber:     #F5B940;        /* muted (soft) amber, replaces harsh orange */

  /* CTA & primary interactions map to blue (the "Cloud" word colour).
   * Green stays reserved for success / positive states, so it keeps
   * meaning throughout the app. Amber replaces harsh orange for warnings. */
  --ce-orange:     var(--ce-blue);
  --ce-orange-600: var(--ce-blue-700);
  --ce-orange-300: var(--ce-blue-300);

  /* semantic */
  --success: #16a34a; --success-bg: #dcfce7;
  --warning: #d97706; --warning-bg: #fef3c7;
  --danger:  #dc2626; --danger-bg:  #fee2e2;
  --info:    #0284c7; --info-bg:    #dbeafe;

  /* neutral (light) */
  --bg:          #F5F7FB;
  --bg-elev:     #ECF0F7;
  --surface:     #FFFFFF;
  --surface-2:   #F1F4FA;
  --surface-3:   #E7ECF5;
  --border:      #E4E9F1;
  --border-strong: #C9D1DE;
  --text:        #0B2545;
  --text-muted:  #5A657B;
  --text-faint:  #8891A5;

  --shadow-sm: 0 1px 2px rgba(11,37,69,.05), 0 1px 3px rgba(11,37,69,.06);
  --shadow-md: 0 6px 18px rgba(11,37,69,.08), 0 2px 6px rgba(11,37,69,.05);
  --shadow-lg: 0 16px 48px rgba(11,37,69,.14), 0 8px 16px rgba(11,37,69,.08);
  --shadow-xl: 0 24px 70px rgba(11,37,69,.20);
  --shadow-brand: 0 10px 30px rgba(31,78,157,.28);
  --ring-brand:   0 0 0 3px rgba(31,78,157,.18);
  --shadow-green: 0 10px 30px rgba(124,179,66,.28);

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-2xl: 32px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans Arabic', sans-serif;

  --ease-out: cubic-bezier(.2,.7,.2,1);
  --ease-in-out: cubic-bezier(.4,0,.2,1);
  --ease-spring: cubic-bezier(.16,1,.3,1);

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #06101E;
    --bg-elev:     #0B1626;
    --surface:     #101B2E;
    --surface-2:   #17233A;
    --surface-3:   #1E2C48;
    --border:      #1F2D48;
    --border-strong: #2E3D5D;
    --text:        #E8EDF7;
    --text-muted:  #9AA6BE;
    --text-faint:  #6E7A94;
    --success-bg: #052E1A;
    --warning-bg: #3B2A08;
    --danger-bg:  #3B0F10;
    --info-bg:    #062033;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.5);
    --shadow-md: 0 6px 18px rgba(0,0,0,.4);
    --shadow-lg: 0 16px 48px rgba(0,0,0,.55);
    --shadow-xl: 0 24px 70px rgba(0,0,0,.6);
  }
}
:root[data-theme="dark"] {
  --bg:#06101E; --bg-elev:#0B1626; --surface:#101B2E; --surface-2:#17233A;
  --surface-3:#1E2C48; --border:#1F2D48; --border-strong:#2E3D5D;
  --text:#E8EDF7; --text-muted:#9AA6BE; --text-faint:#6E7A94;
  --success-bg:#052E1A; --warning-bg:#3B2A08; --danger-bg:#3B0F10; --info-bg:#062033;
  --shadow-sm:0 1px 2px rgba(0,0,0,.5); --shadow-md:0 6px 18px rgba(0,0,0,.4);
  --shadow-lg:0 16px 48px rgba(0,0,0,.55); --shadow-xl:0 24px 70px rgba(0,0,0,.6);
}

@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; }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
/* Keep the scrollbar's space reserved: switching between a long and a short tab or
 * question never changes the page width, so nothing jumps sideways. */
html { scrollbar-gutter: stable; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  line-height: 1.55;
  font-feature-settings: "cv02","cv03","cv04","cv11";
}
[dir="rtl"] body { font-family: 'Inter', 'Noto Sans Arabic', 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--ce-orange); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--ce-orange); outline-offset: 2px; border-radius: 6px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1240px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px;
}
/* -------- Brand mark --------
 * The CloudEnergi PNG is a wide wordmark (~3:1). We render it at its
 * natural aspect ratio at 50px height so both the "Cloud/Energi" letters
 * and the "Natural Gas Solutions" tagline stay readable — no cropping,
 * no squeezing into a tiny square.
 *
 * On dark themes the logo's blue and dark-grey ink would disappear
 * against a navy chrome, so we wrap it in a subtle white pill (the same
 * pattern Slack, Notion, Linear, Adobe use for third-party logos).
 * On light themes it sits flush on the surface — no visual container
 * needed. */
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }

/* --- Two logo variants, one shown per theme, NO pill / container ---
 * light theme → dark ink logo on light chrome
 * dark  theme → light-inverted logo (blues become sky, greys become warm-grey)
 * Both float directly on the topbar with no background at all — the way
 * every major SaaS (Slack, Notion, Linear, Adobe) handles logos.        */
.brand-mark { display: inline-flex; align-items: center; }
.brand-img {
  height: 40px;  /* logo file is trimmed to its ink — 40px shows it larger than the old 50px */
  width: auto;
  max-width: 240px;
  display: block;
  object-fit: contain;
  background: transparent !important;
  padding: 0 !important;
  border: 0 !important;
  box-shadow: none !important;
  /* Ask browsers to pick their best downscaling filter so the letters
   * stay crisp when the 536-wide master is displayed at ~150px wide.
   * -webkit-optimize-contrast is a hint the WebKit/Chromium pipeline
   * respects; other browsers ignore it and fall back to `auto`. */
  /* smooth, high-quality downscaling (crisp-edges = nearest-neighbour → jagged/blurry) */
  image-rendering: auto;
  transition: transform .15s var(--ease-out), opacity .2s var(--ease-out);
}
.brand:hover .brand-img { transform: translateY(-1px); }

.brand-img--dark { display: none; }
:root[data-theme="dark"] .brand-img--light { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand-img--light { display: none; } }
:root[data-theme="dark"] .brand-img--dark { display: block; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand-img--dark { display: block; } }

.brand-divider {
  width: 1px;
  height: 28px;
  background: var(--border-strong);
  opacity: .55;
}
.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* App title beside the logo — the same on every QHSE screen (Training Hub, Workspace,
 * and the Accident & Incident app through the proxy): "QHSE" bold + name medium, solid ink. */
.hub-mark { display: inline-flex; align-items: baseline; gap: 7px; white-space: nowrap; min-width: 0; color: #0E2A47; font-family: var(--font-sans); }
.hub-q { font-size: 19px; font-weight: 800; letter-spacing: .01em; line-height: 1; }
.hub-t { font-size: 19px; font-weight: 500; letter-spacing: -.015em; line-height: 1; }
:root[data-theme="dark"] .hub-mark { color: #E8EDF7; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hub-mark { color: #E8EDF7; } }

/* Legacy CE-square mark — kept for backwards compat but not used in HTML. */
.brand-logo {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, var(--ce-blue) 0%, var(--ce-blue-700) 100%);
  display: grid; place-items: center;
  box-shadow: var(--shadow-brand);
  color: #fff; font-weight: 800; font-size: 18px; letter-spacing: -.03em;
  position: relative; overflow: hidden;
}
.brand-logo::before {
  content: ""; position: absolute; right: -6px; bottom: -6px; width: 20px; height: 20px;
  background: var(--ce-green); border-radius: 50%; opacity: .95;
}
.brand-logo::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(160deg, rgba(255,255,255,.35), transparent 60%);
  pointer-events: none;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text b { font-size: 15px; letter-spacing: -.01em; }
.brand-text small { color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 1.4px; }

/* Mobile — hide the auxiliary subtitle & divider, shrink the logo a touch */
@media (max-width: 560px) {
  .brand-divider, .brand-sub { display: none; }
  .brand-img { height: 34px; max-width: 160px; }
}
.topbar-spacer { flex: 1; }
.topbar-btn {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all .15s var(--ease-out);
  text-decoration: none !important;
}
.topbar-btn:hover { border-color: var(--ce-orange); color: var(--ce-orange); transform: translateY(-1px); }

/* Language dropdown — visually consistent with .topbar-btn but hosts a native <select> */
.topbar-lang {
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text);
  border-radius: 10px;
  padding: 6px 10px 6px 12px;
  font-size: 13px; font-weight: 500;
  transition: all .15s var(--ease-out);
}
.topbar-lang:hover { border-color: var(--ce-orange); color: var(--ce-orange); transform: translateY(-1px); }
.topbar-lang-icon { font-size: 14px; line-height: 1; }
.topbar-lang select {
  appearance: none; -webkit-appearance: none;
  background: transparent; border: 0; padding: 0 18px 0 4px;
  font: inherit; color: inherit; cursor: pointer;
  min-width: 90px;
}
.topbar-lang::after {
  content: ""; position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  width: 12px; height: 12px; pointer-events: none; background: currentColor; opacity: .7;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
}
.topbar-lang select option { color: var(--text); background: var(--surface); }
/* Native scripts render at the right weight even inside the <select> */
.topbar-lang select option[dir="rtl"] { font-family: 'Noto Sans Arabic', 'Inter', sans-serif; }

/* ── Arabic font stack — hooked on <html lang="ar"> (English uses Inter) ── */
:root[lang="ar"] body,
:root[lang="ar"] input,
:root[lang="ar"] select,
:root[lang="ar"] button,
:root[lang="ar"] textarea {
  font-family: 'Noto Sans Arabic', 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.7;   /* Arabic script needs a little more air */
}

/* ---------- Layout ---------- */
.container { max-width: 1240px; margin: 0 auto; padding: 28px 20px 80px; }
.container-narrow { max-width: 820px; margin: 0 auto; padding: 28px 20px 80px; }

/* ============================================================
 * Cinematic Hero (aurora orbs, subtle grain, professional depth)
 * ============================================================ */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--ce-navy) 0%, var(--ce-navy-700) 100%);
  color: #fff;
  border-radius: var(--radius-2xl);
  padding: 56px 44px;
  margin-bottom: 28px;
  isolation: isolate;
}
.hero-aurora {
  position: absolute; inset: -40%; z-index: 0;
  pointer-events: none;
  filter: blur(60px);
  opacity: .85;
}
.hero-aurora::before, .hero-aurora::after {
  content: ""; position: absolute; border-radius: 50%;
}
.hero-aurora::before {
  width: 60%; height: 60%; top: -10%; right: -10%;
  background: radial-gradient(circle at center, rgba(46,99,181,.55), rgba(46,99,181,0) 65%);
  animation: aurora1 18s ease-in-out infinite alternate;
}
.hero-aurora::after {
  width: 55%; height: 55%; bottom: -12%; left: -6%;
  background: radial-gradient(circle at center, rgba(124,179,66,.42), rgba(124,179,66,0) 65%);
  animation: aurora2 22s ease-in-out infinite alternate;
}
.hero-grid {
  position: absolute; inset: 0; z-index: 0; opacity: .18;
  background-image:
    linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}
@keyframes aurora1 {
  0%   { transform: translate(0,0) scale(1);   opacity: .8; }
  50%  { transform: translate(-8%, 6%) scale(1.15); opacity: 1; }
  100% { transform: translate(6%, -4%) scale(1.05); opacity: .9; }
}
@keyframes aurora2 {
  0%   { transform: translate(0,0) scale(1);   opacity: .7; }
  50%  { transform: translate(9%, -4%) scale(1.1);  opacity: .95; }
  100% { transform: translate(-5%, 6%) scale(1.08); opacity: .85; }
}
.hero-content { position: relative; z-index: 1; max-width: 780px; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px; border-radius: 999px;
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.14);
  font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  margin-bottom: 20px;
  color: rgba(255,255,255,.9);
}
.hero-eyebrow-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ce-teal-300); box-shadow: 0 0 12px var(--ce-teal-300); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity:.7 } 50% { opacity:1 } }
.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(28px, 4.4vw, 44px);
  font-weight: 800; letter-spacing: -.03em; line-height: 1.08;
}
.hero h1 .grad {
  background: linear-gradient(90deg, var(--ce-blue-300), var(--ce-green-300));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { margin: 0; opacity: .82; font-size: 16px; max-width: 640px; line-height: 1.55; }
.hero-badges { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.hero-badge {
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.14);
  padding: 6px 14px; border-radius: 999px;
  font-size: 12.5px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
  backdrop-filter: blur(8px);
}

/* Compact hero for inner pages */
.hero-compact { padding: 28px 32px; margin-bottom: 24px; border-radius: var(--radius-xl); }
.hero-compact h1 { font-size: clamp(22px, 3vw, 28px); margin-bottom: 6px; }
.hero-compact p { font-size: 14px; }

/* ============================================================
 * KPI Stat Strip (landing)
 * ============================================================ */
.kpi-strip {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  margin: -60px 20px 32px; position: relative; z-index: 5;
}
@media (max-width: 780px) { .kpi-strip { grid-template-columns: repeat(2, 1fr); margin: -40px 4px 24px; } }
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-md);
  position: relative; overflow: hidden;
}
.kpi::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--ce-blue), var(--ce-green));
}
.kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); font-weight: 600; }
.kpi-value { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi-delta { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.kpi-delta.up { color: var(--success); }
.kpi-delta.down { color: var(--danger); }

/* Continue-where-you-left-off pill */
.resume-bar {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--ce-orange);
  border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.resume-bar h4 { margin: 0; font-size: 14px; font-weight: 600; }
.resume-bar small { color: var(--text-muted); font-size: 12.5px; }
.resume-bar .spacer { flex: 1; }

/* Section headers */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 8px 0 18px; flex-wrap: wrap; }
.section-head h2 { margin: 0; font-size: 20px; letter-spacing: -.015em; font-weight: 700; }
.section-head small { color: var(--text-muted); font-size: 13px; }

/* ============================================================
 * Filter / search toolbar
 * ============================================================ */
.filter-bar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.filter-chips {
  display: flex; gap: 8px; flex-wrap: wrap; flex: 1; min-width: 200px;
}
.filter-chip {
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 999px; padding: 7px 14px;
  font-size: 12.5px; font-weight: 500; color: var(--text-muted);
  transition: all .15s var(--ease-out);
}
.filter-chip:hover { border-color: var(--ce-orange); color: var(--ce-orange); }
.filter-chip.active {
  background: var(--ce-blue); border-color: var(--ce-blue); color: #fff;
}
:root[data-theme="dark"] .filter-chip.active { background: var(--ce-blue-500); border-color: var(--ce-blue-500); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .filter-chip.active { background: var(--ce-blue-500); border-color: var(--ce-blue-500); } }
.search-box {
  position: relative; min-width: 240px;
}
.search-box input {
  width: 100%; padding: 9px 14px 9px 36px;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--surface); font-size: 13.5px;
  transition: all .15s var(--ease-out);
}
.search-box input:focus { outline: none; border-color: var(--ce-orange); box-shadow: var(--ring-brand); }
.search-box::before {
  content: "🔍"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 12px; opacity: .5;
}
[dir="rtl"] .search-box input { padding: 9px 36px 9px 14px; }
[dir="rtl"] .search-box::before { left: auto; right: 12px; }

/* ============================================================
 * Assessment cards
 * ============================================================ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 18px;
}
.assessment-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  cursor: pointer;
  transition: transform .22s var(--ease-spring), box-shadow .22s var(--ease-out), border-color .18s;
  display: flex; flex-direction: column; gap: 14px;
  position: relative; overflow: hidden;
  isolation: isolate;
}
.assessment-card::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--ce-blue) 10%, transparent), transparent 55%);
  opacity: 0; transition: opacity .3s var(--ease-out);
}
.assessment-card::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, var(--ce-blue), var(--ce-green));
  opacity: 0; transition: opacity .18s;
}
[dir="rtl"] .assessment-card::after { left: auto; right: 0; }
.assessment-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}
.assessment-card:hover::before { opacity: 1; }
.assessment-card:hover::after { opacity: 1; }
.assessment-card.disabled {
  opacity: .55; cursor: not-allowed; pointer-events: none;
}
.card-head { display: flex; align-items: flex-start; gap: 12px; }
.card-icon {
  width: 48px; height: 48px; border-radius: 14px;
  background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
  border: 1px solid var(--border);
  display: grid; place-items: center;
  font-size: 24px;
  flex-shrink: 0;
}
.card-code { font-family: ui-monospace, SF Mono, Menlo, monospace; font-size: 11px; color: var(--text-faint); letter-spacing: .04em; }
.card-title { margin: 2px 0 0; font-size: 16px; font-weight: 700; line-height: 1.3; letter-spacing: -.005em; }
.card-desc { color: var(--text-muted); font-size: 13.5px; margin: 0; line-height: 1.5; }
.card-meta { display: flex; gap: 6px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.card-meta .m {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--surface-2); border-radius: 6px; padding: 3px 8px;
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  background: var(--surface-2); color: var(--text-muted);
  border: 1px solid var(--border);
}
.chip.chip-warning { background: var(--warning-bg); color: var(--warning); border-color: transparent; }
.chip.chip-success { background: var(--success-bg); color: var(--success); border-color: transparent; }
.chip.chip-danger  { background: var(--danger-bg);  color: var(--danger);  border-color: transparent; }
.chip.chip-info    { background: var(--info-bg);    color: var(--info);    border-color: transparent; }

.difficulty-dots { display: inline-flex; gap: 3px; }
.difficulty-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--surface-3); }
.difficulty-dots.d1 span:nth-child(1) { background: var(--ce-green); }
.difficulty-dots.d2 span:nth-child(-n+2) { background: var(--warning); }
.difficulty-dots.d3 span { background: var(--danger); }

/* ============================================================
 * Wizard (participant → question flow)
 * ============================================================ */
.wizard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.wizard-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
}
.wizard-title { margin: 0 0 6px; font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.wizard-sub { color: var(--text-muted); font-size: 13px; margin: 0; }
.progress {
  display: flex; align-items: center; gap: 12px; margin-top: 14px;
}
.progress-bar {
  flex: 1; height: 6px; background: var(--surface-2);
  border-radius: 999px; overflow: hidden;
  border: 1px solid var(--border);
}
.progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--ce-orange), var(--ce-teal));
  transition: width .4s var(--ease-out);
  border-radius: 999px;
}
.progress-text { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.wizard-body { padding: 28px 24px; }
.wizard-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  position: sticky; bottom: 0;
  flex-wrap: wrap;
}

/* wizard with question navigator sidebar (desktop) */
.wizard-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
}
@media (max-width: 860px) { .wizard-grid { grid-template-columns: 1fr; } }
.wizard-nav {
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
}
[dir="rtl"] .wizard-nav { border-right: 0; border-left: 1px solid var(--border); }
@media (max-width: 860px) { .wizard-nav { border-right: 0; border-bottom: 1px solid var(--border); max-height: 130px; padding: 12px; } }
.wizard-nav h5 {
  margin: 0 0 12px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-faint); font-weight: 700;
}
.q-nav {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px;
}
.q-nav-dot {
  aspect-ratio: 1; border-radius: 8px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  font-size: 11.5px; font-weight: 600; color: var(--text-muted);
  display: grid; place-items: center;
  position: relative;
  transition: all .15s var(--ease-out);
}
.q-nav-dot:hover { border-color: var(--ce-orange); color: var(--ce-orange); transform: scale(1.05); }
.q-nav-dot.answered { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.q-nav-dot.current { background: var(--ce-navy); border-color: var(--ce-navy); color: #fff; box-shadow: var(--shadow-md); }
.q-nav-dot.flagged::after {
  content: "🚩"; position: absolute; top: -6px; right: -6px; font-size: 10px;
}
.q-nav-legend { display: flex; gap: 10px; margin-top: 14px; font-size: 10.5px; color: var(--text-muted); flex-wrap: wrap; }
.q-nav-legend span { display: inline-flex; align-items: center; gap: 4px; }
.q-nav-legend .k { width: 10px; height: 10px; border-radius: 3px; border: 1px solid var(--border-strong); }
.q-nav-legend .k.answered { background: var(--success); border-color: var(--success); }
.q-nav-legend .k.current { background: var(--ce-navy); border-color: var(--ce-navy); }

.autosave-indicator {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--success); font-size: 11px;
  opacity: 0; transition: opacity .3s;
}
.autosave-indicator.show { opacity: 1; }

/* ---------- Buttons ---------- */
.btn {
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 14px; font-weight: 600;
  border: 1px solid transparent;
  display: inline-flex; align-items: center; gap: 8px;
  transition: all .15s var(--ease-out);
  background: var(--surface); color: var(--text);
  border-color: var(--border-strong);
  text-decoration: none !important;
}
.btn:hover { border-color: var(--ce-orange); color: var(--ce-orange); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(135deg, var(--ce-blue), var(--ce-blue-700));
  color: #fff; border-color: transparent;
  box-shadow: var(--shadow-brand);
}
.btn-success {
  background: linear-gradient(135deg, var(--ce-green), var(--ce-green-700));
  color: #fff; border-color: transparent;
  box-shadow: var(--shadow-green);
}
.btn-success:hover { filter: brightness(1.08); color: #fff; border-color: transparent; }
.btn-primary:hover { filter: brightness(1.08); color: #fff; border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); border-color: var(--border); background: var(--surface-2); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-flag { padding: 7px 12px; font-size: 12px; }
.btn-flag.flagged { background: var(--warning-bg); border-color: var(--warning); color: var(--warning); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.field input, .field select, .field textarea {
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--ce-orange);
  box-shadow: var(--ring-brand);
}
/* Fixed values (assessment Date & time, Conducted by) — read-only with a lock */
.locked-input { position: relative; display: flex; }
.locked-input input { flex: 1; min-width: 0; padding-right: 40px; background: var(--surface-2); color: var(--text); cursor: default; }
.locked-input input:focus { border-color: var(--border-strong); box-shadow: none; }
.locked-input svg { position: absolute; right: 14px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%);
  fill: none; stroke: var(--text-muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.consent-row { display: flex; align-items: flex-start; gap: 10px; margin-top: 18px; padding: 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.consent-row input { margin-top: 3px; accent-color: var(--ce-orange); width: 16px; height: 16px; flex-shrink: 0; }
.consent-row label { font-size: 13px; color: var(--text-muted); line-height: 1.5; cursor: pointer; }

/* ---------- Questions ---------- */
.q-topline { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.q-index { font-size: 12px; color: var(--text-faint); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.q-prompt { font-size: 17px; line-height: 1.55; margin: 0 0 20px; font-weight: 500; }
.q-blank {
  display: inline-block; min-width: 90px; padding: 2px 12px;
  border-bottom: 2px dashed var(--ce-blue); font-weight: 600;
  color: var(--ce-blue); background: rgba(31,78,157,.06);
  border-radius: 4px 4px 0 0;
}
.q-blank.filled { border-bottom-style: solid; }
.choices { display: flex; flex-direction: column; gap: 10px; }
.choice {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: 12px;
  cursor: pointer;
  transition: all .15s var(--ease-out);
  background: var(--surface);
}
.choice:hover { border-color: var(--ce-orange); background: color-mix(in srgb, var(--ce-orange) 5%, var(--surface)); transform: translateX(2px); }
[dir="rtl"] .choice:hover { transform: translateX(-2px); }
.choice input { accent-color: var(--ce-orange); width: 18px; height: 18px; margin: 0; flex-shrink: 0; }
.choice.selected { border-color: var(--ce-orange); background: color-mix(in srgb, var(--ce-orange) 10%, var(--surface)); box-shadow: var(--ring-brand); }
.choice-label { flex: 1; font-size: 14.5px; }

.bank { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px; background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: 12px; margin-top: 14px; }
.bank-title { font-size: 11px; color: var(--text-faint); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; margin: 0 0 8px; }
.bank-hint { font-size: 12.5px; color: var(--text-muted); margin: 0 0 6px; }
.bank-chip {
  padding: 8px 14px; border-radius: 10px;
  background: var(--surface); border: 1.5px solid var(--border-strong);
  font-size: 13px; cursor: pointer;
  transition: all .14s var(--ease-out);
  font-weight: 500;
}
.bank-chip:hover:not(.used) { border-color: var(--ce-orange); color: var(--ce-orange); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.bank-chip.used { opacity: .3; cursor: not-allowed; }
.blanks { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.blank-slot {
  min-width: 220px; min-height: 46px; padding: 8px 14px;
  border: 2px dashed var(--border-strong); border-radius: 10px;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); font-size: 14px;
  transition: border-color .15s, background .15s;
}
.blank-slot.filled {
  border-style: solid; border-color: var(--ce-orange);
  background: color-mix(in srgb, var(--ce-orange) 6%, var(--surface));
}
.blank-slot .placeholder { color: var(--text-faint); }
.blank-slot .clear {
  margin-left: auto; background: none; border: none;
  color: var(--text-muted); font-size: 20px; line-height: 1; padding: 0 4px; cursor: pointer;
}
[dir="rtl"] .blank-slot .clear { margin-left: 0; margin-right: auto; }
.blank-slot .clear:hover { color: var(--danger); }

.tf-row { display: flex; gap: 12px; }
.tf-btn {
  flex: 1; padding: 20px; font-size: 15px; font-weight: 700;
  border: 2px solid var(--border-strong); border-radius: 12px;
  background: var(--surface); color: var(--text);
  transition: all .15s var(--ease-out);
}
.tf-btn:hover { border-color: var(--ce-orange); transform: translateY(-1px); }
.tf-btn.selected.tf-true { border-color: var(--success); background: var(--success-bg); color: var(--success); }
.tf-btn.selected.tf-false { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }

/* ============================================================
 * Review-before-submit panel
 * ============================================================ */
.review-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px;
  margin: 14px 0 20px;
}
.review-grid .q-nav-dot { aspect-ratio: unset; padding: 10px 6px; text-align: center; font-size: 12px; }
.review-list { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.review-line {
  display: flex; gap: 12px; padding: 12px 14px;
  background: var(--surface-2); border-radius: 10px;
  border: 1px solid var(--border);
  cursor: pointer; transition: all .15s;
  align-items: flex-start;
}
.review-line:hover { border-color: var(--ce-orange); background: var(--surface); }
.review-line .n {
  width: 26px; height: 26px; border-radius: 7px; background: var(--surface); border: 1px solid var(--border-strong);
  display: grid; place-items: center; font-weight: 700; font-size: 12px; color: var(--text-muted);
  flex-shrink: 0;
}
.review-line.answered .n { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.review-line.flagged .n { background: var(--warning-bg); border-color: var(--warning); color: var(--warning); }
.review-line .txt { flex: 1; font-size: 13px; }
.review-line .txt small { color: var(--text-muted); }

/* ============================================================
 * Results
 * ============================================================ */
.result-hero {
  text-align: center; padding: 44px 20px;
  border-radius: var(--radius-2xl); margin-bottom: 24px;
  color: #fff; position: relative; overflow: hidden;
}
.result-hero::before { content:""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 20%, rgba(255,255,255,.15), transparent 55%); pointer-events: none; }
.result-hero.pass { background: linear-gradient(135deg, #059669, #16a34a); }
.result-hero.fail { background: linear-gradient(135deg, #b91c1c, #dc2626); }
.result-hero h2 { margin: 0 0 4px; font-size: 32px; font-weight: 800; letter-spacing: -.02em; }
.result-hero .score {
  font-size: 88px; font-weight: 800; letter-spacing: -.04em; line-height: 1;
  margin: 14px 0; font-variant-numeric: tabular-nums;
  text-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.result-hero p { margin: 0; opacity: .95; font-weight: 500; }

.result-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.stat-label { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.stat-value { font-size: 22px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

.review { display: flex; flex-direction: column; gap: 12px; }
.review-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  border-left: 4px solid var(--border);
}
[dir="rtl"] .review-item { border-left: 1px solid var(--border); border-right: 4px solid var(--border); }
.review-item.correct { border-left-color: var(--success); }
.review-item.incorrect { border-left-color: var(--danger); }
[dir="rtl"] .review-item.correct { border-right-color: var(--success); border-left-color: var(--border); }
[dir="rtl"] .review-item.incorrect { border-right-color: var(--danger); border-left-color: var(--border); }
.review-item h4 { margin: 0 0 6px; font-size: 14px; font-weight: 600; }
.review-item .ans { font-size: 13px; color: var(--text-muted); }
.review-item .ans b { color: var(--text); font-weight: 600; }

/* ============================================================
 * Signature capture
 * ============================================================ */
.sig-wrap { display: flex; flex-direction: column; gap: 10px; }
.sig-canvas {
  width: 100%; height: 180px; border-radius: 12px;
  background: var(--surface);
  border: 2px dashed var(--border-strong);
  cursor: crosshair;
  touch-action: none;
}
.sig-canvas.dirty { border-style: solid; border-color: var(--ce-orange); }
.sig-actions { display: flex; justify-content: space-between; align-items: center; }

/* ============================================================
 * Certificate modal
 * ============================================================ */
/* NB. align-items:flex-start (NOT center) so that when the certificate
 * is taller than the viewport, scrolling to the top actually reveals the
 * header — flexbox centering + overflow makes the top clipped. */
.cert-modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-start; justify-content: center; padding: 20px; overflow: auto; }
.cert-backdrop { position: absolute; inset: 0; background: rgba(6,16,30,.75); backdrop-filter: blur(6px); }
.cert-shell { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 12px; max-width: 900px; width: 100%; }
.cert-toolbar {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow-md);
  flex-wrap: wrap;
}
/* =============================================================
 * Certificate — Premium redesign
 *
 * Design language: cream/ivory paper · navy ink · gold accents.
 * Layout: centered vertical composition (like traditional academic
 * certificates), Playfair serif for the recipient name, subtle guilloché
 * pattern on the paper, gold border w/ mitred corners, embossed seal.
 * Two-line signature area (participant + conductor) so it stops looking
 * empty when only one signature is present.
 * ============================================================= */

/* palette scoped to certificate — deliberately independent of app theme
 * so a "printed" certificate always looks the same regardless of
 * whether the participant took the assessment in dark or light mode. */
.cert-page {
  --ink:        #0F2A54;
  --ink-soft:   #1E3E70;
  --muted:      #6b7280;
  --ivory:      #FBF7EE;
  --ivory-2:    #F6F1E2;
  --gold:       #B08A3E;
  --gold-light: #D9B96E;
  --gold-dark:  #7A5A20;
  --brand-blue: #1F4E9D;
  --brand-green:#7CB342;

  /* Paper texture baked into the page background so nothing paints
   * over the border content. */
  background:
    radial-gradient(circle at 12% 18%, rgba(176,138,62,.06), transparent 25%),
    radial-gradient(circle at 88% 82%, rgba(31,78,157,.05), transparent 30%),
    radial-gradient(circle at 92% 10%, rgba(124,179,66,.04), transparent 22%),
    linear-gradient(180deg, var(--ivory) 0%, var(--ivory-2) 100%);
  color: var(--ink);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(11,37,69,.22), 0 8px 22px rgba(11,37,69,.10);
  /* No aspect-ratio — content decides height, nothing clips. */
  min-height: 600px;
  position: relative;
}

/* Double gold border with mitred corner ornaments */
.cert-border {
  /* Flowing layout — the paper grows to fit content instead of clipping it. */
  position: relative;
  margin: 22px;
  border: 1.5px solid var(--gold);
  border-radius: 6px;
  padding: 38px 56px 60px;   /* extra bottom room for the absolute conductor strip */
  display: flex; flex-direction: column;
  min-height: 520px;
  z-index: 1;
}
.cert-border::before {
  content: "";
  position: absolute; inset: 6px;
  border: 0.5px solid var(--gold-light);
  border-radius: 3px;
  pointer-events: none;
}

/* Elegant filigree corner ornaments (SVG-drawn via CSS) */
.cert-corner {
  position: absolute; width: 46px; height: 46px;
  pointer-events: none;
}
.cert-corner::before, .cert-corner::after {
  content: ""; position: absolute; background: var(--gold);
}
.cert-corner::before { width: 100%; height: 2px; }
.cert-corner::after  { width: 2px;  height: 100%; }
.cert-corner.tl { top: -2px; left: -2px; }
.cert-corner.tl::before { top: 0; left: 0; }
.cert-corner.tl::after  { top: 0; left: 0; }
.cert-corner.tr { top: -2px; right: -2px; }
.cert-corner.tr::before { top: 0; right: 0; }
.cert-corner.tr::after  { top: 0; right: 0; }
.cert-corner.bl { bottom: -2px; left: -2px; }
.cert-corner.bl::before { bottom: 0; left: 0; }
.cert-corner.bl::after  { bottom: 0; left: 0; }
.cert-corner.br { bottom: -2px; right: -2px; }
.cert-corner.br::before { bottom: 0; right: 0; }
.cert-corner.br::after  { bottom: 0; right: 0; }
/* small gold dot at each corner intersection */
.cert-corner-dot {
  position: absolute; width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold); z-index: 2;
}

/* Header — logo LEFT, cert-id RIGHT, on same baseline */
.cert-header {
  display: flex; justify-content: space-between; align-items: center;
  gap: 20px; padding-bottom: 20px;
  border-bottom: 0.5px solid rgba(176,138,62,.35);
}
.cert-brand { display: flex; align-items: center; gap: 18px; }
/* Logo sits directly on the ivory paper — no pill, no border, no shadow.
 * The logo PNG has a transparent background so the ivory shows through. */
.cert-logo {
  height: 62px;
  display: inline-flex; align-items: center;
  background: transparent;
  padding: 0; border: 0; box-shadow: none;
}
.cert-logo img {
  display: block; height: 100%; width: auto; object-fit: contain;
  /* subtle gold shadow lends depth against the paper */
  filter: drop-shadow(0 2px 4px rgba(176,138,62,.15));
}
.cert-brand-meta {
  display: flex; flex-direction: column; justify-content: center;
  line-height: 1.2;
  padding-left: 18px;
  border-left: 0.5px solid rgba(176,138,62,.35);
  min-height: 44px;
}
.cert-brand-meta .t {
  font-family: 'Playfair Display', 'Times New Roman', Georgia, serif;
  font-size: 13.5px; font-style: italic;
  color: var(--ink); font-weight: 600;
  letter-spacing: .02em;
}
.cert-brand-meta .t-sub {
  font-size: 9.5px; color: var(--gold-dark); letter-spacing: .28em;
  text-transform: uppercase; font-weight: 700; margin-top: 4px;
}

.cert-code {
  text-align: right;
  border-left: 0.5px solid rgba(176,138,62,.35);
  padding-left: 18px;
}
.cert-code .label { font-size: 10px; color: var(--muted); letter-spacing: .18em; text-transform: uppercase; margin-bottom: 4px; }
.cert-code .val   { font-size: 13px; font-weight: 800; color: var(--ink); letter-spacing: .1em; font-family: ui-monospace, SF Mono, Menlo, monospace; }

/* Body — the meat of the certificate, vertically centered */
.cert-body {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 20px 20px 12px;
}
/* Holder's portrait — gold double ring, matching the seal */
.cert-body.has-photo { padding-top: 8px; }
.cert-portrait {
  width: 104px; height: 104px; border-radius: 50%; margin: 0 auto 14px; padding: 4px;
  background: conic-gradient(from 210deg, var(--gold-dark), var(--gold-light), var(--gold), var(--gold-light), var(--gold-dark));
  box-shadow: 0 10px 24px -12px rgba(122, 90, 32, .55), 0 0 0 6px rgba(255, 255, 255, .7), 0 0 0 7px rgba(176, 138, 62, .35);
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.cert-portrait img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; border: 3px solid #fffdf7; background: #fff; }
.cert-eyebrow {
  font-size: 11px; font-weight: 800; letter-spacing: .48em;
  color: var(--gold-dark); margin-bottom: 6px;
  display: inline-flex; align-items: center; gap: 12px;
}
.cert-eyebrow::before, .cert-eyebrow::after {
  content: ""; width: 34px; height: 1px; background: var(--gold);
}
.cert-sub {
  font-size: 14px; color: var(--muted);
  font-style: italic; margin: 10px 0 4px;
}
.cert-name {
  font-family: 'Playfair Display', 'Times New Roman', Georgia, serif;
  font-size: 54px; font-weight: 700;
  letter-spacing: -.005em;
  margin: 6px 0 4px;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.08;
}
.cert-line {
  width: 260px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 10px auto 14px;
  position: relative;
}
.cert-line::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold); transform: translate(-50%,-50%);
  box-shadow: 0 0 0 2px var(--ivory);
}
.cert-desc { font-size: 13.5px; color: var(--muted); margin: 4px 0; max-width: 620px; }
.cert-course {
  font-family: 'Playfair Display', 'Times New Roman', Georgia, serif;
  font-size: 24px; font-weight: 700; font-style: italic;
  margin: 8px 0 6px; color: var(--ink);
}
.cert-score {
  font-size: 13.5px; color: var(--muted); margin: 6px 0 12px;
}
.cert-score b { color: var(--ink); font-weight: 700; }

.cert-badge {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 10px;
  padding: 7px 22px; border-radius: 3px;
  background: transparent;
  color: var(--ink); font-size: 11px; font-weight: 800; letter-spacing: .28em;
  border: 1px solid var(--gold);
  position: relative;
}
.cert-badge::before, .cert-badge::after {
  content: ""; position: absolute; top: 50%; width: 20px; height: 1px; background: var(--gold);
}
.cert-badge::before { left: -28px; }
.cert-badge::after  { right: -28px; }
.cert-badge.fail { color: var(--danger); border-color: var(--danger); }
.cert-badge.fail::before, .cert-badge.fail::after { background: var(--danger); }

/* Footer — signatures + seal + qr in a symmetric 3-col layout */
.cert-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 30px; align-items: end;
  padding-top: 22px;
  margin-top: 10px;
}

.cert-sig, .cert-sig-conductor {
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.cert-sig-box {
  width: 220px; height: 54px;
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 2px;
}
.cert-sig-box img { max-width: 100%; max-height: 100%; }
.cert-sig-empty {
  font-family: 'Playfair Display', 'Times New Roman', Georgia, serif;
  font-style: italic; font-size: 22px; color: var(--ink); opacity: .55;
}
.cert-sig-line {
  width: 220px; border-top: 1px solid var(--ink); opacity: .55; margin-top: 2px;
}
.cert-sig-label {
  font-size: 10px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .18em; margin-top: 6px; font-weight: 700;
}
.cert-sig-name {
  font-size: 13px; color: var(--ink); font-weight: 600; margin-top: 2px;
}
.cert-sig-role {
  font-size: 10px; color: var(--muted); font-style: italic;
}

.cert-seal { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }

/* Verify block — QR left, info right, sits below signatures */
.cert-verify-strip {
  display: flex; align-items: center; gap: 16px;
  margin-top: 24px; padding: 14px 18px;
  background: rgba(255,255,255,.55);
  border: 0.5px solid rgba(176,138,62,.35);
  border-radius: 6px;
}
.cert-verify {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center;
}
.cert-qr {
  background: #FFFFFF; padding: 6px; border-radius: 6px;
  border: 0.5px solid var(--gold);
  box-shadow: 0 2px 8px rgba(176,138,62,.15);
  flex-shrink: 0;
}
.cert-qr svg { display: block; width: 88px; height: 88px; }
.cert-verify-info {
  display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1;
}
.cert-verify-label {
  font-size: 10px; color: var(--muted); letter-spacing: .14em;
  text-transform: uppercase; font-weight: 700;
}
.cert-verify-url {
  font-family: ui-monospace, SF Mono, Menlo, monospace;
  font-size: 10.5px; color: var(--ink);
  word-break: break-all; line-height: 1.4;
}
.cert-verify-url b { font-weight: 700; letter-spacing: .05em; }
.cert-verify-hint {
  font-size: 9.5px; color: var(--muted); font-style: italic; margin-top: 2px;
}

.cert-conductor {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 9.5px; color: var(--muted);
  padding-top: 20px; margin-top: 22px;
  border-top: 0.5px dashed rgba(176,138,62,.35);
  font-style: italic;
}
.cert-conductor .l, .cert-conductor .r { max-width: 45%; }

@media (max-width: 640px) {
  .cert-page { aspect-ratio: unset; min-height: unset; }
  .cert-border { position: static; inset: unset; padding: 26px 20px; }
  .cert-corner { display: none; }
  .cert-name { font-size: 34px; }
  .cert-course { font-size: 18px; }
  .cert-header { flex-direction: column; align-items: flex-start; }
  .cert-code { border-left: 0; padding-left: 0; text-align: left; }
  .cert-footer { grid-template-columns: 1fr; gap: 24px; align-items: center; text-align: center; }
  .cert-conductor { position: static; margin-top: 20px; flex-direction: column; gap: 4px; text-align: center; }
}

/* ---------- Utils ---------- */
.hidden { display: none !important; }
.spacer { flex: 1; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mono { font-family: ui-monospace, SF Mono, Menlo, monospace; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.flex { display: flex; align-items: center; }
.flex-wrap { flex-wrap: wrap; }

/* toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ce-navy); color: #fff;
  padding: 12px 20px; border-radius: 999px;
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 100; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* print — for certificate page */
@media print {
  body { background: #fff !important; }
  .topbar, .wizard-footer, .no-print, .cert-toolbar, .cert-backdrop { display: none !important; }
  .cert-modal { position: static; padding: 0; }
  .cert-shell { max-width: 100%; }
  .cert-page { box-shadow: none; border-radius: 0; }
  .container-narrow, .container { padding: 0; }
  .result-hero { break-inside: avoid; }
}

/* fade transitions between views */
/* calm fade only (no movement) — played when a new screen opens, never on a redraw of the same one */
.fade-in { animation: fadein .22s ease-out; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .fade-in { animation: none; } }

/* skeleton loader */
.skeleton { background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%); background-size: 200% 100%; border-radius: 8px; animation: sk 1.4s linear infinite; }
@keyframes sk { 0% { background-position: 200% 0 } 100% { background-position: -200% 0 } }

/* ===== Personal training link (#/my/<token>) ===== */
.my-progress { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; margin-bottom: 14px; font-size: 14px; }
.my-alldone { background: var(--success-bg); color: var(--success); border-radius: var(--radius-lg); padding: 14px 18px; font-weight: 600; margin-bottom: 14px; }
.my-list { display: grid; gap: 10px; }
.my-item { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; }
.my-item.done { opacity: .78; }
.my-item-icon { font-size: 26px; width: 44px; height: 44px; display: grid; place-items: center; background: var(--surface-2); border-radius: 12px; flex: none; }
.my-item-body { flex: 1; min-width: 0; }
.my-item-title { font-weight: 700; font-size: 15px; }
.my-item-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.my-item-action { flex: none; text-align: end; max-width: 45%; }
@media (max-width: 560px) {
  .my-item { flex-wrap: wrap; }
  .my-item-action { max-width: none; width: 100%; text-align: start; }
}

/* =====================================================================
 * Responsive app shell
 * Workspace pages (Training Hub, Admin) add <body class="app-wide"> and use
 * the full screen: phone → tablet → laptop → 1080p → 1440p/4K.
 * Reading pages (portal, quiz) stay comfortably narrow but grow a little
 * on large monitors.
 * ===================================================================== */
@media (min-width: 1600px) {
  .container, .topbar-inner { max-width: 1440px; }
}
body.app-wide .container,
body.app-wide .topbar-inner {
  max-width: min(100%, 2200px);
  padding-left: clamp(12px, 2.4vw, 44px);
  padding-right: clamp(12px, 2.4vw, 44px);
}
body.app-wide .container { padding-top: clamp(14px, 2vw, 28px); }
/* never a sideways page scroll from sub-pixel rounding (sticky still works with clip) */
body.app-wide { overflow-x: clip; }
/* 1440p / 4K: scale the whole workspace up slightly so text isn't tiny */
@media (min-width: 2400px) { body.app-wide { zoom: 1.15; } }
@media (min-width: 3200px) { body.app-wide { zoom: 1.4; } }

/* =====================================================================
 * Phone layout for the participant portal & assessment
 * (staff open their training link on a phone — this is the main device)
 * ===================================================================== */
@media (max-width: 640px) {
  /* header: compact logo, icon-only buttons, language shows its code */
  .topbar-inner { padding: 10px 12px; gap: 8px; }
  .brand-img { height: 30px; max-width: 130px; }
  .tb-label { display: none; }
  .topbar-btn { padding: 8px 10px; min-height: 38px; }
  .topbar-lang { padding: 6px 8px; min-height: 38px; }
  .topbar-lang select { min-width: 0; max-width: 78px; padding-right: 14px; text-overflow: ellipsis; }
  .topbar-lang::after { right: 6px; }

  .container-narrow { padding: 12px 12px calc(84px + env(safe-area-inset-bottom)); }
  .container-narrow > .btn-ghost:first-child { margin-bottom: 8px !important; padding: 6px 4px; font-size: 13px; }

  /* card goes edge-to-edge-ish, tighter header */
  .wizard { border-radius: 16px; box-shadow: var(--shadow-sm); }
  .wizard-header { padding: 14px 16px; }
  .wizard-title { font-size: 16px; line-height: 1.3; }
  .wizard-sub { font-size: 12px; }
  .progress { margin-top: 10px; gap: 10px; }
  .autosave-indicator { display: none; }

  /* grid children must be allowed to shrink, or the dot strip widens the card */
  .wizard-grid { grid-template-columns: minmax(0, 1fr); }
  .wizard-grid > * { min-width: 0; }
  /* question navigator: one swipeable row of small dots instead of a big grid */
  .wizard-nav { max-height: none; padding: 10px 12px; overflow: visible; }
  .wizard-nav h5, .q-nav-legend { display: none; }
  .q-nav { display: flex; gap: 6px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; padding: 4px 2px; }
  .q-nav::-webkit-scrollbar { display: none; }
  .q-nav-dot { flex: 0 0 34px; width: 34px; height: 34px; aspect-ratio: auto; border-radius: 10px; font-size: 12px; scroll-snap-align: center; }
  .q-nav-dot:hover { transform: none; }
  .q-nav-dot.flagged::after { top: -5px; right: -4px; font-size: 9px; }

  /* question */
  .wizard-body { padding: 18px 16px 20px; }
  .q-topline { margin-bottom: 8px; }
  .btn-flag { padding: 6px 10px; font-size: 12px; }
  .q-prompt { font-size: 16px; line-height: 1.5; margin-bottom: 16px; }
  .q-blank { min-width: 64px; padding: 1px 8px; }
  .blanks { flex-direction: column; gap: 8px; }
  .blank-slot { min-width: 0; width: 100%; min-height: 48px; }
  .bank { padding: 12px; gap: 8px; }
  .bank-chip { padding: 9px 12px; font-size: 13.5px; line-height: 1.35; min-height: 40px; flex: 1 1 auto; text-align: start; }
  .bank { gap: 6px; }
  .choice { padding: 14px; }
  .choice:hover { transform: none; }
  .tf-btn { padding: 16px; }

  /* footer: big thumb-friendly buttons, pinned to the bottom of the screen */
  .wizard-footer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    border-radius: 0; box-shadow: 0 -6px 20px rgba(0,0,0,.08); flex-wrap: nowrap; }
  .wizard-footer .btn { flex: 1; justify-content: center; min-height: 46px; }
  .wizard-footer > span { display: none; }

  /* forms */
  .form-grid { gap: 12px; }
  .field input, .field select, .field textarea { font-size: 16px; min-height: 46px; } /* 16px stops iOS zooming in */
  .consent-row { padding: 12px; }
}

/* Personal training link: no route back to the admin console or catalogue */
body.link-mode .topbar a[href="admin.html"],
body.link-mode #install-btn { display: none !important; }
/* result page keeps its action row in the normal flow (only the quiz pins buttons) */
@media (max-width: 640px) {
  .wizard-footer.result-footer { position: static; flex-wrap: wrap; box-shadow: none; padding: 12px; }
  .wizard-footer.result-footer > div { width: 100%; }
}

/* ---------- personal link: closing countdown + closed screen ---------- */
.link-close-note {
  display: flex; gap: 12px; align-items: center;
  margin: 0 0 16px; padding: 14px 16px; border-radius: 14px;
  background: color-mix(in srgb, var(--warning) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--warning) 40%, var(--border));
  font-size: 14px; line-height: 1.45; color: var(--text);
}
.link-close-note .lcn-icon { font-size: 22px; flex: none; }
.link-close-note .lcn-time { font-variant-numeric: tabular-nums; font-size: 15px; color: var(--danger); }
.link-ended .wizard-body { text-align: center; padding: 56px 24px; }
.link-ended .le-icon {
  width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 50%;
  display: grid; place-items: center; font-size: 40px;
  background: color-mix(in srgb, var(--text-muted) 12%, transparent);
}
.link-ended.ok .le-icon { background: color-mix(in srgb, var(--success) 15%, transparent); }
.link-ended .le-icon .ic { width: 38px; height: 38px; color: var(--text-muted); }
.link-ended.ok .le-icon .ic { color: var(--success); }
.link-close-note .lcn-icon .ic { width: 22px; height: 22px; color: var(--ce-blue); }
.my-item-icon .ic { width: 22px; height: 22px; color: var(--ce-blue); }
/* arrows in buttons point the reading direction (left in Arabic) */
[dir="rtl"] .dir-arrow { display: inline-block; transform: scaleX(-1); }
.link-ended h2 { margin: 0 0 10px; font-size: 24px; }
.link-ended .le-hint { font-size: 13px; margin-top: 14px; }
body.link-mode .topbar a[href="index.html"],
body.link-mode .topbar a[href="training.html"] { display: none !important; }

/* ---------- brand: full wordmark on laptop/PC, cloud mark on phones ---------- */
.brand-mark .brand-icon { display: none !important; }
@media (max-width: 640px) {
  .brand-mark .brand-img:not(.brand-icon) { display: none !important; }
  .brand-mark .brand-icon { height: 36px; max-width: 60px; }
  .brand-mark .brand-icon.brand-img--light { display: block !important; }
  :root[data-theme="dark"] .brand-mark .brand-icon.brand-img--light { display: none !important; }
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand-mark .brand-icon.brand-img--light { display: none !important; } }
  :root[data-theme="dark"] .brand-mark .brand-icon.brand-img--dark { display: block !important; }
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand-mark .brand-icon.brand-img--dark { display: block !important; } }
}

/* =====================================================================
 * Icons + navigation buttons — one line-icon family, one button language
 * ===================================================================== */
.ic { width: 18px; height: 18px; flex: none; display: block;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.topbar-btn {
  height: 38px; padding: 0 14px; gap: 8px;
  border: 1px solid var(--border); border-radius: 11px;
  background: var(--surface); color: var(--text);
  font: 600 13px/1 var(--font-sans); letter-spacing: -.005em; text-decoration: none; cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .12s;
}
.topbar-btn .ic { width: 17px; height: 17px; color: var(--text-muted); transition: color .15s, transform .15s; }
.topbar-btn:hover {
  transform: none; color: var(--text);
  background: var(--surface-2); border-color: var(--border-strong);
  box-shadow: 0 4px 12px -4px rgba(15, 23, 42, .12);
}
.topbar-btn:hover .ic { color: var(--ce-blue); }
.topbar-btn:active { transform: translateY(1px); }
.topbar-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ce-blue) 30%, transparent); }
.topbar-btn--icon { width: 38px; padding: 0; justify-content: center; }
.topbar-lang-icon { display: inline-grid; place-items: center; color: var(--text-muted); }
.topbar-lang-icon .ic { width: 16px; height: 16px; }
@media (max-width: 640px) {
  .topbar-btn { height: 38px; min-height: 38px; padding: 0 10px; }
  .topbar-btn:has(.tb-label) { width: 38px; padding: 0; justify-content: center; }
}

/* ---------- staff photos on the personal training link ---------- */
.pp { display: inline-grid; place-items: center; flex: none; overflow: hidden; color: #fff; font-weight: 800; letter-spacing: -.02em;
  background: linear-gradient(140deg, #005E9E, #0a7cc4 55%, #66BF26); }
.pp img { width: 100%; height: 100%; object-fit: cover; display: block; background: #fff; }
.pp-sm { width: 30px; height: 30px; border-radius: 9px; font-size: 11px; }
.pp-md { width: 44px; height: 44px; border-radius: 13px; font-size: 15px; }
.pp-lg { width: 64px; height: 64px; border-radius: 18px; font-size: 21px; box-shadow: 0 10px 22px -12px rgba(0, 40, 80, .55); }
.pp-xl { width: 76px; height: 76px; border-radius: 22px; font-size: 26px; border: 3px solid rgba(255, 255, 255, .85); box-shadow: 0 14px 30px -14px rgba(0, 0, 0, .6); }
.hero-me { display: flex; align-items: center; gap: 18px; }
.hero-me h1 { margin-bottom: 4px; }
.id-card { display: flex; align-items: center; gap: 16px; padding: 14px 16px; margin: 0 0 20px; border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--ce-blue) 25%, var(--border)); background: color-mix(in srgb, var(--ce-blue) 5%, var(--surface)); }
.id-t { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.id-t b { font-size: 16px; } .id-t small { color: var(--text-muted); font-size: 13px; }
.id-ver { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12px; font-weight: 700; color: var(--success); }
.id-ver svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.stat-person { display: flex; align-items: center; gap: 8px; }
@media (max-width: 520px) { .hero-me { gap: 12px; } .pp-xl { width: 58px; height: 58px; border-radius: 17px; font-size: 20px; } }

.cert-tb { display: inline-flex; align-items: center; gap: 8px; }
.cert-tb .ic { width: 17px; height: 17px; }

/* ---------- form validation: show exactly what is missing ---------- */
.field.invalid input, .field.invalid select, .field.invalid textarea {
  border-color: var(--danger) !important; background: color-mix(in srgb, var(--danger) 5%, var(--surface));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 14%, transparent);
  animation: fieldShake .36s ease-in-out;
}
.field.invalid label { color: var(--danger); }
.field-error { display: flex; align-items: center; gap: 6px; margin-top: 7px; font-size: 13px; font-weight: 600; color: var(--danger); }
.field-error svg { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.consent-row.invalid { border-color: var(--danger) !important; background: color-mix(in srgb, var(--danger) 6%, var(--surface)) !important; animation: fieldShake .36s ease-in-out; }
@keyframes fieldShake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@media (prefers-reduced-motion: reduce) { .field.invalid input, .consent-row.invalid { animation: none; } }

/* ============================================================
 * Pointer affordance — every clickable control shows the hand
 * cursor; disabled ones say so. Text fields keep the I-beam.
 * ============================================================ */
a[href], button, [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="link"], [role="switch"],
summary, select, label[for], label:has(> input[type="checkbox"]), label:has(> input[type="radio"]),
input[type="checkbox"], input[type="radio"], input[type="range"], input[type="file"], input[type="color"],
input[type="submit"], input[type="button"], input[type="reset"], input[type="date"]::-webkit-calendar-picker-indicator,
[onclick], [data-tab], [data-go], [data-profile], [data-staff], [data-open], [data-action], [data-drill], [data-chip], .dr-row, [data-na], [data-nachip], [data-unpick],
[data-ans], [data-close], [data-deldoc], [data-dept], [data-dl], [data-edit], [data-goto], [data-induct], [data-link],
[data-ophoto], [data-reset], [data-send], [data-session], [data-share], [data-trk-share], [data-view], [data-pw-toggle],
td.editable, th[data-course], .ntf, .plan-col, .palette .it, .l-app, .pick, .photo-edit,
.clickable, .row-link, .linkish, .chip-btn { cursor: pointer; }
button:disabled, [aria-disabled="true"], input:disabled, select:disabled, .disabled { cursor: not-allowed; }
.gate-cta:disabled { cursor: wait; }

/* ============================================================
 * Premium dropdowns (js/pselect.js) — closed state + panel
 * ============================================================ */
:root { --psel-chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --psel-chev-on: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23005E9E' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --psel-shadow: 0 1px 2px rgba(10,30,60,.06), 0 12px 28px -8px rgba(10,30,60,.22), 0 30px 60px -30px rgba(10,30,60,.35);
  --psel-sel: #005E9E; }
:root[data-theme="dark"] { --psel-chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --psel-chev-on: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237cc4f2' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --psel-shadow: 0 1px 0 rgba(255,255,255,.05) inset, 0 14px 30px -8px rgba(0,0,0,.6), 0 30px 60px -24px rgba(0,0,0,.75);
  --psel-sel: #7cc4f2; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --psel-chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --psel-chev-on: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237cc4f2' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --psel-shadow: 0 1px 0 rgba(255,255,255,.05) inset, 0 14px 30px -8px rgba(0,0,0,.6), 0 30px 60px -24px rgba(0,0,0,.75);
  --psel-sel: #7cc4f2; } }

/* closed state: one chevron everywhere, no OS arrow */
select:not([multiple]):not([size]):not([data-native]), input.psel-combo {
  -webkit-appearance: none !important; appearance: none !important;
  background-image: var(--psel-chev) !important; background-repeat: no-repeat !important;
  background-position: right 12px center !important; background-size: 16px 16px !important;
  padding-right: 38px !important; text-overflow: ellipsis;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
select:not([multiple]):not([size]):not([data-native]):hover, input.psel-combo:hover { border-color: color-mix(in srgb, var(--ce-blue) 45%, var(--border-strong)); }
select.psel-open, input.psel-combo.psel-open { background-image: var(--psel-chev-on) !important; border-color: var(--ce-blue) !important;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ce-blue) 14%, transparent) !important; }
input.psel-combo::-webkit-calendar-picker-indicator { display: none !important; }
.topbar-lang select { background-image: none !important; padding-right: 18px !important; }
.topbar-lang select.psel-open { box-shadow: none !important; border-color: transparent !important; }

/* panel */
.psel-panel { position: fixed; z-index: 10000; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--psel-shadow);
  font: 500 14px/1.35 var(--font-sans, Inter, system-ui, sans-serif); text-transform: none; letter-spacing: normal;
  opacity: 0; transform: translateY(-6px) scale(.98); transform-origin: top center; transition: opacity .14s ease, transform .18s cubic-bezier(.2,.8,.2,1); }
.psel-panel.up { transform-origin: bottom center; transform: translateY(6px) scale(.98); }
.psel-panel.in { opacity: 1; transform: none; }
.psel-panel.out { opacity: 0; transition-duration: .12s; pointer-events: none; }
.psel-search { position: relative; flex: none; padding: 8px; border-bottom: 1px solid var(--border); }
.psel-search .ic { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-muted); pointer-events: none; }
.psel-search input { width: 100%; height: 38px; padding: 0 12px 0 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font: inherit; font-size: 13.5px; outline: none; transition: border-color .15s, box-shadow .15s, background .15s; }
.psel-search input:focus { border-color: var(--ce-blue); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ce-blue) 14%, transparent); }
.psel-list { overflow-y: auto; overscroll-behavior: contain; padding: 6px; scrollbar-width: thin; }
.psel-it { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 8px 10px 8px 12px; border-radius: 9px; cursor: pointer; user-select: none; }
.psel-it + .psel-it { margin-top: 1px; }
.psel-tx { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.psel-tx mark { background: color-mix(in srgb, var(--ce-green) 26%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; font-weight: 700; }
.psel-ck { width: 18px; height: 18px; flex: none; display: grid; place-items: center; color: var(--psel-sel); opacity: 0; transform: scale(.6); transition: opacity .15s, transform .15s; }
.psel-ck .ic { width: 16px; height: 16px; stroke-width: 2.6; }
.psel-it.act { background: color-mix(in srgb, var(--ce-blue) 9%, transparent); }
.psel-it.sel { color: var(--psel-sel); font-weight: 650; background: color-mix(in srgb, var(--ce-blue) 7%, transparent); }
.psel-it.sel.act { background: color-mix(in srgb, var(--ce-blue) 13%, transparent); }
.psel-it.sel .psel-ck { opacity: 1; transform: none; }
.psel-it.dis { opacity: .45; cursor: not-allowed; }
.psel-grp { padding: 10px 12px 4px; font-size: 10.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--text-muted); }
.psel-grp:first-child { padding-top: 4px; }
.psel-empty { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 18px 12px; color: var(--text-muted); font-size: 13px; }
.psel-empty .ic { width: 16px; height: 16px; }

/* phones: bottom sheet */
.psel-back { position: fixed; inset: 0; z-index: 9999; background: rgba(8,18,36,.42); backdrop-filter: blur(2px); animation: pselFade .2s ease; }
.psel-back.out { opacity: 0; transition: opacity .15s; }
@keyframes pselFade { from { opacity: 0; } }
.psel-panel.sheet { left: 0 !important; right: 0; bottom: 0; top: auto; width: auto !important; max-height: min(78vh, 560px); border-radius: 22px 22px 0 0;
  border-bottom: 0; padding-bottom: env(safe-area-inset-bottom); transform: translateY(100%); transition: transform .26s cubic-bezier(.2,.8,.2,1), opacity .2s; opacity: 1; }
.psel-panel.sheet.in { transform: none; }
.psel-panel.sheet.out { transform: translateY(100%); }
.psel-sheet-h { position: relative; display: flex; align-items: center; gap: 10px; padding: 18px 16px 10px; flex: none; }
.psel-sheet-h b { flex: 1; font-size: 16px; font-weight: 750; }
.psel-grab { position: absolute; left: 50%; top: 7px; width: 40px; height: 4px; margin-left: -20px; border-radius: 99px; background: var(--border-strong); }
.psel-x { width: 34px; height: 34px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--surface-2); color: var(--text-muted); cursor: pointer; }
.psel-x .ic { width: 16px; height: 16px; }
.psel-panel.sheet .psel-search { padding: 4px 16px 10px; border: 0; }
.psel-panel.sheet .psel-search .ic { left: 28px; }
.psel-panel.sheet .psel-search input { height: 44px; font-size: 16px; }
.psel-panel.sheet .psel-list { padding: 4px 10px 14px; border-top: 1px solid var(--border); }
.psel-panel.sheet .psel-it { min-height: 50px; font-size: 15.5px; padding: 10px 14px; border-radius: 12px; }
@media (prefers-reduced-motion: reduce) { .psel-panel, .psel-panel.sheet { transition: opacity .12s; transform: none !important; } }

/* icons inside buttons and running text */
.btn:has(> .ic) { display: inline-flex; align-items: center; gap: 7px; }
.btn > .ic { width: 16px; height: 16px; }
.btn-sm > .ic { width: 15px; height: 15px; }
.ic.ic-in { display: inline-block; width: 1.1em; height: 1.1em; vertical-align: -.2em; }
/* native controls (date picker, scrollbars) follow the chosen theme, not only the OS */
:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }

/* ============================================================
 * Training material before an assessment (video + documents)
 * ============================================================ */
.tm { margin: 4px 0 22px; display: grid; gap: 14px; }
.tm-block { border: 1px solid var(--border); border-radius: 18px; padding: 16px; background: var(--surface);
  box-shadow: 0 1px 2px rgba(10,30,60,.05), 0 12px 28px -20px rgba(10,30,60,.3); transition: border-color .2s, box-shadow .2s; }
.tm.invalid #tm-vblock { border-color: var(--danger); box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 14%, transparent); animation: tmShake .4s; }
@keyframes tmShake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.tm-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.tm-ht { flex: 1; min-width: 0; }
.tm-ht h3 { margin: 2px 0 2px; font-size: 16px; }
.tm-ht p { margin: 0; font-size: 13px; color: var(--text-muted); }
.tm-step { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff;
  background: linear-gradient(135deg, var(--ce-blue), #0a7cc4); box-shadow: 0 6px 14px -6px rgba(0,94,158,.6); }
.tm-status { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 700;
  color: var(--warning); background: color-mix(in srgb, var(--warning) 12%, transparent); }
.tm-status.ok { color: var(--success); background: color-mix(in srgb, var(--success) 13%, transparent); }
.tm-status svg, .my-mat svg, .tm-doc svg, .btn.locked svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.tm-status svg polygon, .my-mat svg polygon { fill: currentColor; stroke: none; }
.tm-video { border-radius: 14px; overflow: hidden; background: #000; aspect-ratio: 16 / 9; }
.tm-video video { width: 100%; height: 100%; display: block; object-fit: contain; background: #000; }
.tm-progress { display: flex; align-items: center; gap: 12px; margin-top: 12px; font-size: 12.5px; color: var(--text-muted); font-weight: 600; }
.tm-meter { flex: 1; height: 7px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.tm-meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--ce-blue), var(--ce-green)); transition: width .4s ease; }
.tm-docs { display: grid; gap: 8px; }
.tm-doc { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 1px solid var(--border); border-radius: 12px; color: var(--text); text-decoration: none; transition: border-color .15s, background .15s; }
.tm-doc:hover { border-color: var(--ce-blue); background: color-mix(in srgb, var(--ce-blue) 5%, transparent); }
.tm-doc-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--ce-blue); background: color-mix(in srgb, var(--ce-blue) 10%, transparent); flex: none; }
.tm-doc-ic svg { width: 18px; height: 18px; }
.tm-doc-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tm-doc-t b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-doc-t small { font-size: 12px; color: var(--text-muted); }
.tm-doc-go { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 700; color: var(--ce-blue); flex: none; }
.tm-next { display: flex; align-items: center; gap: 12px; padding: 2px 2px 0; font-size: 16px; }
.tm-details-h { display: none; }

/* Watch again during the test — button on each question / review, player over the test */
.q-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.btn-tm { padding: 7px 12px; font-size: 12px; gap: 6px; color: var(--ce-blue); border-color: color-mix(in srgb, var(--ce-blue) 35%, var(--border)); background: color-mix(in srgb, var(--ce-blue) 6%, var(--surface)); }
.btn-tm:hover { background: color-mix(in srgb, var(--ce-blue) 12%, var(--surface)); border-color: var(--ce-blue); }
.btn-tm svg, .vm svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.btn-tm svg polygon { fill: currentColor; stroke: none; }
.review-tm { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 16px; padding: 12px 14px; border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--ce-blue) 22%, var(--border)); background: color-mix(in srgb, var(--ce-blue) 5%, var(--surface)); font-size: 13px; color: var(--text-muted); }
.vm-back { position: fixed; inset: 0; z-index: 9000; display: grid; place-items: center; padding: 24px; background: rgba(6,14,28,.72);
  backdrop-filter: blur(4px); animation: pselFade .2s ease; }
.vm { width: min(960px, 100%); max-height: calc(100vh - 48px); overflow: auto; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 20px; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.vm-h { display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px 12px; }
.vm-ht { flex: 1; min-width: 0; }
.vm-ht small { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ce-blue); }
.vm-ht h3 { margin: 2px 0 0; font-size: 17px; }
.vm-x { flex: none; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  display: grid; place-items: center; cursor: pointer; }
.vm-x:hover { border-color: var(--border-strong); }
.vm-x svg { width: 18px; height: 18px; }
.vm-video { background: #000; aspect-ratio: 16 / 9; }
.vm-video video { width: 100%; height: 100%; display: block; object-fit: contain; background: #000; }
.vm-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px; font-size: 13px; color: var(--text-muted); font-weight: 600; }
.vm-docs { display: grid; gap: 8px; padding: 6px 18px 4px; }
.vm-f { display: flex; justify-content: flex-end; padding: 12px 18px 16px; border-top: 1px solid var(--border); margin-top: 8px; }
@media (max-width: 640px) {
  .vm-back { padding: 0; place-items: end stretch; }
  .vm { border-radius: 18px 18px 0 0; max-height: 100vh; }
  .vm-f .btn { width: 100%; justify-content: center; }
  .btn-tm { padding: 6px 10px; }
}
@media (prefers-reduced-motion: reduce) { .vm-back { animation: none; } }
.btn.locked { opacity: .78; display: inline-flex; align-items: center; gap: 8px; }
.my-mat { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.my-mat-btn { margin-top: 10px; }
.my-mat span { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  color: var(--ce-blue); background: color-mix(in srgb, var(--ce-blue) 9%, transparent); }
.my-mat span.ok { color: var(--success); background: color-mix(in srgb, var(--success) 12%, transparent); }
@media (max-width: 600px) { .tm-block { padding: 12px; border-radius: 16px; } .tm-head { flex-wrap: wrap; } .tm-ht { flex: 1 1 calc(100% - 44px); } .tm-status { margin-left: 40px; } .tm-video { border-radius: 12px; } }

/* ============================================================
 * Staff's own records after an assessment: certificate + training card
 * ============================================================ */
.rec-sec { margin: 22px 0 6px; }
.rec-sec h3 { margin: 0 0 12px; font-size: 13px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); }
.rec-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.rec-grid.one { grid-template-columns: 1fr; }
@media (max-width: 640px) { .rec-grid { grid-template-columns: 1fr; } }
.rec-tile { position: relative; overflow: hidden; isolation: isolate; display: flex; flex-direction: column; gap: 14px; align-items: flex-start;
  padding: 20px 20px 18px; border-radius: 20px; border: 0; text-align: left; cursor: pointer; text-decoration: none; color: #fff; font: inherit;
  box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 18px 40px -22px rgba(0,30,60,.65); transition: transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .35s; }
.rec-tile:hover { transform: translateY(-4px); box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 28px 50px -24px rgba(0,30,60,.75); }
.rec-tile:active { transform: translateY(-1px); }
.rec-tile:focus-visible { outline: 3px solid color-mix(in srgb, var(--ce-green, #66BF26) 70%, transparent); outline-offset: 3px; }
.rec-tile::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .55; pointer-events: none;
  background: radial-gradient(circle at 110% -10%, rgba(255,255,255,.28), transparent 45%), repeating-radial-gradient(circle at 120% -20%, transparent 0 14px, rgba(255,255,255,.07) 14px 15px); }
.rec-tile::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,.18) 50%, transparent 65%); transform: translateX(-120%); }
.rec-tile:hover::after { transition: transform .9s cubic-bezier(.2,.8,.2,1); transform: translateX(120%); }
.rec-cert { background: linear-gradient(140deg, #3b2a06 0%, #6b4d12 45%, #b8893c 100%); }
.rec-card { background: linear-gradient(140deg, #00335a 0%, #005E9E 55%, #0b6e83 100%); }
.rec-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: rgba(255,255,255,.16); box-shadow: inset 0 0 0 1px rgba(255,255,255,.22); }
.rec-ic .ic, .rec-ic svg { width: 23px; height: 23px; }
.rec-cert .rec-ic { color: #ffe3a6; } .rec-card .rec-ic { color: #c9ecff; }
.rec-t { display: flex; flex-direction: column; gap: 3px; width: 100%; min-width: 0; }
.rec-t small { font-size: 10.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; opacity: .75; }
.rec-t b { font-size: 17px; line-height: 1.25; }
.rec-t > span { font-size: 13px; opacity: .88; }
.rec-meter { display: block; height: 6px; margin-top: 8px; border-radius: 99px; background: rgba(255,255,255,.2); overflow: hidden; }
.rec-meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #9fd4ff, #66BF26); transition: width .8s ease; }
.rec-go { margin-top: auto; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 700;
  background: rgba(255,255,255,.95); color: #0E1B2B; }
.rec-go .ic, .rec-go svg { width: 15px; height: 15px; }
.rec-note { display: flex; align-items: center; gap: 8px; margin: 12px 2px 0; font-size: 12.5px; color: var(--text-muted); }
.rec-note .ic, .rec-note svg { width: 16px; height: 16px; flex: none; color: var(--success); }
.rec-mini { display: inline-flex; align-items: center; gap: 6px; } .rec-mini .ic, .rec-mini svg { width: 15px; height: 15px; color: #b8893c; }
.my-alldone { display: flex; align-items: flex-start; gap: 10px; }
.my-alldone .ic, .my-alldone svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.my-alldone b { font-weight: 800; }

.res-badge { width: 64px; height: 64px; margin: 0 auto 6px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.res-badge .ic, .res-badge svg { width: 30px; height: 30px; }
.res-badge.ok { background: linear-gradient(135deg, #b8893c, #6b4d12); box-shadow: 0 0 0 6px rgba(184,137,60,.18); }
.res-badge.no { background: linear-gradient(135deg, #005E9E, #00335a); box-shadow: 0 0 0 6px rgba(0,94,158,.16); }
.wizard-title .ic { width: 18px; height: 18px; }

/* ---------- Confirmation dialog (js/ask.js) — Training Hub + Content library ---------- */
.ask { --ask-danger: #9b2c3a; --ask-danger-btn: #9b2c3a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ask { --ask-danger: #e07a88; --ask-danger-btn: #b13e4e; } }
:root[data-theme="dark"] .ask { --ask-danger: #e07a88; --ask-danger-btn: #b13e4e; }
/* confirmation dialog (ask) — above every panel */
.ask-back { position:fixed; inset:0; z-index:10000; display:grid; place-items:center; padding:20px; background:rgba(6,14,28,.52);
  backdrop-filter:blur(3px); opacity:0; transition:opacity .17s ease; }
.ask-back.in { opacity:1; }
.ask { width:min(460px,100%); background:var(--surface); color:var(--text); border:1px solid var(--border); border-radius:20px; padding:24px 24px 18px;
  box-shadow:0 30px 80px -10px rgba(0,0,0,.4); transform:translateY(10px) scale(.985); transition:transform .2s cubic-bezier(.2,.8,.2,1); }
.ask-back.in .ask { transform:none; }
.ask-ic { width:46px; height:46px; border-radius:14px; display:grid; place-items:center; margin-bottom:14px;
  color:var(--ce-blue); background:color-mix(in srgb, var(--ce-blue) 11%, transparent); }
.ask.ask--danger .ask-ic { color:var(--ask-danger); background:color-mix(in srgb, var(--ask-danger) 12%, transparent); }
.ask-ic .ic { width:22px; height:22px; }
.ask h3 { margin:0 0 6px; font-size:18px; font-weight:700; letter-spacing:-.01em; line-height:1.3; }
.ask p { margin:0; color:var(--text-muted); font-size:14px; line-height:1.55; }
.ask-dl { margin:14px 0 0; padding:10px 14px; border:1px solid var(--border); border-radius:12px; background:var(--surface-2); display:grid; gap:7px; font-size:13px; }
.ask-dl div { display:flex; justify-content:space-between; align-items:baseline; gap:14px; }
.ask-dl dt { color:var(--text-muted); flex:none; }
.ask-dl dd { margin:0; font-weight:600; text-align:end; overflow-wrap:anywhere; }
.ask-in { margin-top:14px; }
.ask-err { margin-top:6px; font-size:12.5px; color:var(--ask-danger); font-weight:600; }
.ask-f { display:flex; justify-content:flex-end; gap:8px; margin-top:22px; }
.ask-f .btn { min-width:96px; justify-content:center; }
.ask .btn-danger { background:var(--ask-danger-btn); border-color:var(--ask-danger-btn); color:#fff; }
@media (max-width:640px) {
  .ask-back { place-items:end stretch; padding:0; }
  .ask { border-radius:20px 20px 0 0; padding:22px 18px calc(16px + env(safe-area-inset-bottom)); }
  .ask-f .btn { flex:1; }
}
@media (prefers-reduced-motion: reduce) { .ask-back, .ask { transition:none; } }

/* ---------- class session: one QR for the room — each person taps their name ---------- */
.gs-hero h1 { font-size: clamp(22px, 4.6vw, 30px); }
.gs-intro { display: flex; align-items: center; gap: 14px; margin: 0 0 14px; padding: 14px 16px; border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--ce-blue) 22%, var(--border));
  background: radial-gradient(120% 160% at 0% 0%, color-mix(in srgb, var(--ce-blue) 9%, transparent) 0%, transparent 60%), var(--surface); }
.gs-intro-ic { flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--ce-blue), color-mix(in srgb, var(--ce-blue) 60%, var(--ce-green))); box-shadow: 0 8px 18px -10px var(--ce-blue); }
.gs-intro-ic .ic { width: 21px; height: 21px; }
.gs-intro b { display: block; font-size: 15.5px; letter-spacing: -.01em; }
.gs-intro small { display: block; margin-top: 2px; font-size: 12.5px; color: var(--text-muted); }
.gs-search { position: relative; display: flex; align-items: center; margin: 0 0 12px; }
.gs-search .ic { position: absolute; inset-inline-start: 14px; width: 18px; height: 18px; color: var(--text-muted); pointer-events: none; }
.gs-search input { width: 100%; height: 50px; padding-inline: 44px 14px; border-radius: 14px; border: 1.5px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: 16px var(--font-sans); }
.gs-search input:focus { outline: none; border-color: var(--ce-blue); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ce-blue) 14%, transparent); }
.gs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.gs-p { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 72px; padding: 12px 14px; text-align: start;
  border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer;
  transition: transform .15s ease, border-color .15s, box-shadow .15s; }
.gs-p .pp { flex: none; width: 46px; height: 46px; border-radius: 50%; font-size: 15px; }
.gs-p .pp img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.gs-pt { flex: 1; min-width: 0; }
.gs-pt b { display: block; font-size: 15px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.gs-pt small { display: block; margin-top: 2px; font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-tag { flex: none; display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 99px; font-size: 11.5px; font-weight: 700;
  background: color-mix(in srgb, var(--ce-blue) 10%, transparent); color: var(--ce-blue); white-space: nowrap; }
.gs-tag .ic { width: 13px; height: 13px; }
.gs-free:hover, .gs-mine:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--ce-blue) 45%, var(--border)); box-shadow: 0 12px 26px -18px rgba(0, 60, 110, .55); }
.gs-free:active, .gs-mine:active { transform: scale(.985); }
.gs-mine { border-color: color-mix(in srgb, var(--ce-blue) 50%, var(--border)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ce-blue) 12%, transparent); }
.gs-mine .gs-tag { background: var(--ce-blue); color: #fff; }
.gs-taken, .gs-off { opacity: .55; cursor: not-allowed; }
.gs-taken .gs-tag, .gs-off .gs-tag { background: var(--surface-2); color: var(--text-muted); }
.gs-done { cursor: default; }
.gs-done .gs-tag { background: color-mix(in srgb, var(--success) 13%, transparent); color: var(--success); }
.gs-none { text-align: center; color: var(--text-muted); padding: 26px 0; }
.gs-none.hidden { display: none; }
:root[data-theme="dark"] .gs-tag { color: #8fc3f0; }
:root[data-theme="dark"] .gs-mine .gs-tag { color: #fff; }
:root[data-theme="dark"] .gs-done .gs-tag { color: var(--success); }
:root[data-theme="dark"] .gs-taken .gs-tag, :root[data-theme="dark"] .gs-off .gs-tag { color: var(--text-muted); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .gs-tag { color: #8fc3f0; }
  :root:not([data-theme="light"]) .gs-mine .gs-tag { color: #fff; }
  :root:not([data-theme="light"]) .gs-done .gs-tag { color: var(--success); }
  :root:not([data-theme="light"]) .gs-taken .gs-tag, :root:not([data-theme="light"]) .gs-off .gs-tag { color: var(--text-muted); }
}
/* "Is this you?" sheet */
.gs-back { position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center; padding: 18px;
  background: rgba(6, 18, 34, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; transition: opacity .18s ease; }
.gs-back.in { opacity: 1; }
.gs-sheet { width: min(420px, 100%); padding: 26px 24px 20px; border-radius: 24px; text-align: center; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); box-shadow: 0 30px 80px -30px rgba(0, 20, 50, .6); transform: translateY(12px) scale(.98); transition: transform .2s ease; }
.gs-back.in .gs-sheet { transform: none; }
.gs-sface { display: flex; justify-content: center; margin-bottom: 12px; }
.gs-sface .pp { width: 112px; height: 112px; border-radius: 50%; font-size: 36px;
  box-shadow: 0 0 0 5px var(--surface), 0 0 0 7px color-mix(in srgb, var(--ce-blue) 40%, transparent), 0 18px 36px -16px rgba(0, 60, 110, .6); }
.gs-sface .pp img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.gs-skick { display: block; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ce-blue); }
:root[data-theme="dark"] .gs-skick { color: #8fc3f0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .gs-skick { color: #8fc3f0; } }
.gs-sheet h3 { margin: 6px 0 2px; font-size: 23px; letter-spacing: -.02em; line-height: 1.2; }
.gs-sdes { margin: 0; color: var(--text-muted); font-size: 14px; }
.gs-shelp { margin: 14px 0 18px; font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.gs-sbtns { display: flex; gap: 10px; }
.gs-sbtns .btn { flex: 1; justify-content: center; min-height: 50px; font-size: 15px; }
@media (max-width: 560px) {
  .gs-back { place-items: end stretch; padding: 0; }
  .gs-sheet { width: 100%; border-radius: 24px 24px 0 0; padding: 24px 18px calc(18px + env(safe-area-inset-bottom)); transform: translateY(30px); }
  .gs-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .gs-back, .gs-sheet, .gs-p { transition: none; } }
/* on the personal link that came from a class QR */
.gs-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 14px; padding: 9px 12px 9px 14px;
  border-radius: 12px; background: color-mix(in srgb, var(--ce-blue) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--ce-blue) 20%, var(--border)); font-size: 13px; }
.gs-bar-t { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; }
.gs-bar-t .ic { width: 16px; height: 16px; flex: none; color: var(--ce-blue); }
.gs-bar-b { flex: none; border: 0; background: transparent; color: var(--ce-blue); font: 700 13px var(--font-sans); padding: 6px 10px; border-radius: 9px; cursor: pointer; }
.gs-bar-b:hover { background: color-mix(in srgb, var(--ce-blue) 10%, transparent); }
:root[data-theme="dark"] .gs-bar-t .ic, :root[data-theme="dark"] .gs-bar-b { color: #8fc3f0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .gs-bar-t .ic, :root:not([data-theme="light"]) .gs-bar-b { color: #8fc3f0; } }
.gs-next { display: flex; align-items: center; gap: 16px; margin: 0 0 14px; padding: 18px 20px; border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--success) 35%, var(--border));
  background: radial-gradient(120% 160% at 0% 0%, color-mix(in srgb, var(--success) 12%, transparent) 0%, transparent 60%), var(--surface); }
.gs-next-ic { flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: var(--success); }
.gs-next-ic .ic { width: 24px; height: 24px; }
.gs-next b { display: block; font-size: 16px; }
.gs-next p { margin: 3px 0 0; font-size: 13px; color: var(--text-muted); }
.gs-next > div { flex: 1; min-width: 0; }
.gs-next .btn { flex: none; gap: 7px; min-height: 46px; }
.gs-next .btn .ic { width: 16px; height: 16px; }
@media (max-width: 560px) { .gs-next { flex-direction: column; text-align: center; } .gs-next .btn { width: 100%; justify-content: center; } }

/* ---------- "Add your photo" on the staff training link (first time only) ---------- */
.ph-card { display: flex; align-items: center; gap: 20px; margin: 0 0 18px; padding: 18px 20px; border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--ce-blue) 24%, var(--border)); background:
  radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--ce-blue) 9%, transparent) 0%, transparent 55%), var(--surface);
  box-shadow: 0 12px 30px -22px rgba(0, 60, 110, .45); }
.ph-face { position: relative; flex: none; }
.ph-face .pp { width: 84px; height: 84px; border-radius: 50%; font-size: 26px; box-shadow: 0 0 0 4px var(--surface), 0 0 0 6px color-mix(in srgb, var(--ce-blue) 35%, transparent); }
.ph-face .pp img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.ph-badge { position: absolute; right: -2px; bottom: -2px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ce-blue); color: #fff; box-shadow: 0 0 0 3px var(--surface); }
.ph-badge .ic { width: 15px; height: 15px; }
.ph-t { flex: 1; min-width: 0; }
.ph-t b { display: block; font-size: 16px; letter-spacing: -.01em; }
.ph-t p { margin: 4px 0 12px; font-size: 13.5px; color: var(--text-muted); line-height: 1.5; }
.ph-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.ph-acts .btn { gap: 7px; }
.ph-acts .btn .ic { width: 16px; height: 16px; }
.ph-btn { cursor: pointer; }
.ph-tip { display: block; margin-top: 10px; font-size: 12px; color: var(--text-muted); }
.ph-card.ph-preview { border-color: color-mix(in srgb, var(--success) 35%, var(--border)); }
@media (max-width: 560px) {
  .ph-card { flex-direction: column; text-align: center; padding: 18px 16px; }
  .ph-acts { justify-content: center; }
  .ph-acts .btn { flex: 1 1 100%; justify-content: center; min-height: 44px; }
}
