/* Teaching Tools Hub design system.
   Everything shared lives here and reaches every page through base.html.
   Tool templates use these components instead of styling themselves.

   Theming: tokens are defined on :root (light), redefined for dark under
   prefers-color-scheme, and overridden in both directions by the manual
   toggle, which stamps data-theme on <html> and persists in localStorage.
   Components only ever reference tokens, never raw colors. */

/* ---------- Tokens: light ---------- */

:root {
  --color-bg: #f2f4f5;
  --color-surface: #ffffff;
  --color-ink: #1f2d3a;
  --color-muted: #56656f;
  --color-faint: #7b8894;
  --color-border: #dbe1e5;
  --color-border-strong: #b9c3c9;

  --color-link: #0f766e;
  --color-primary: #0f766e;
  --color-primary-hover: #0c5d57;
  --color-primary-soft: #e4f4f2;
  --color-primary-ring: rgba(15, 118, 110, 0.25);
  --color-stat-border: #bfe0db;

  --color-header: #14302b;
  --color-header-text: #ffffff;
  --color-header-link: #a9c6bf;
  --color-header-accent: #2dd4bf;

  --color-danger-bg: #fdf1f1;
  --color-danger-border: #f2c4c4;
  --color-danger-text: #a03030;
  --color-ok-bg: #e2f3e8;
  --color-ok-text: #1c6b3c;
  --color-off-bg: #fbe9e9;
  --color-off-text: #993838;

  --color-code-bg: #eceff1;
  --color-thead-bg: #f7f9fa;
  --color-row-border: #edf0f2;
  --color-bar-track: #e8edef;
  --seg-label: rgba(255, 255, 255, 0.95);

  --chart-1: #0f766e;
  --chart-2: #b45309;
  --chart-3: #6d28d9;
  --chart-4: #be185d;
  --chart-5: #1d4ed8;
  --chart-6: #4d7c0f;

  --shadow-card: 0 1px 2px rgba(31, 45, 58, 0.06);
  --shadow-lift: 0 6px 18px rgba(31, 45, 58, 0.1);

  --show-sun: none;
  --show-moon: block;

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

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --content-width: 1040px;

  color-scheme: light;
}

/* ---------- Tokens: dark (OS preference) ---------- */

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #12181c;
    --color-surface: #1b2429;
    --color-ink: #e6ecee;
    --color-muted: #a0aeb6;
    --color-faint: #7f8d95;
    --color-border: #2b3740;
    --color-border-strong: #43525b;

    --color-link: #4cd3c3;
    --color-primary: #0f766e;
    --color-primary-hover: #128a7d;
    --color-primary-soft: #16302d;
    --color-primary-ring: rgba(76, 211, 195, 0.25);
    --color-stat-border: #275f56;

    --color-header: #0f2420;
    --color-header-text: #ffffff;
    --color-header-link: #9dbdb5;
    --color-header-accent: #2dd4bf;

    --color-danger-bg: #35201f;
    --color-danger-border: #5f3434;
    --color-danger-text: #f0a3a3;
    --color-ok-bg: #17362a;
    --color-ok-text: #7fd8a3;
    --color-off-bg: #3a2426;
    --color-off-text: #eda2a2;

    --color-code-bg: #242f36;
    --color-thead-bg: #202b31;
    --color-row-border: #26313a;
    --color-bar-track: #26323a;
    --seg-label: #10181c;

    --chart-1: #34d0bf;
    --chart-2: #f0a24a;
    --chart-3: #b79df7;
    --chart-4: #f27daa;
    --chart-5: #7aa8f7;
    --chart-6: #a3d16e;

    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-lift: 0 6px 18px rgba(0, 0, 0, 0.5);

    --show-sun: block;
    --show-moon: none;

    color-scheme: dark;
  }
}

/* ---------- Tokens: manual override beats the OS preference ---------- */

:root[data-theme="dark"] {
  --color-bg: #12181c;
  --color-surface: #1b2429;
  --color-ink: #e6ecee;
  --color-muted: #a0aeb6;
  --color-faint: #7f8d95;
  --color-border: #2b3740;
  --color-border-strong: #43525b;

  --color-link: #4cd3c3;
  --color-primary: #0f766e;
  --color-primary-hover: #128a7d;
  --color-primary-soft: #16302d;
  --color-primary-ring: rgba(76, 211, 195, 0.25);
  --color-stat-border: #275f56;

  --color-header: #0f2420;
  --color-header-text: #ffffff;
  --color-header-link: #9dbdb5;
  --color-header-accent: #2dd4bf;

  --color-danger-bg: #35201f;
  --color-danger-border: #5f3434;
  --color-danger-text: #f0a3a3;
  --color-ok-bg: #17362a;
  --color-ok-text: #7fd8a3;
  --color-off-bg: #3a2426;
  --color-off-text: #eda2a2;

  --color-code-bg: #242f36;
  --color-thead-bg: #202b31;
  --color-row-border: #26313a;
  --color-bar-track: #26323a;
  --seg-label: #10181c;

  --chart-1: #34d0bf;
  --chart-2: #f0a24a;
  --chart-3: #b79df7;
  --chart-4: #f27daa;
  --chart-5: #7aa8f7;
  --chart-6: #a3d16e;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-lift: 0 6px 18px rgba(0, 0, 0, 0.5);

  --show-sun: block;
  --show-moon: none;

  color-scheme: dark;
}

:root[data-theme="light"] {
  --color-bg: #f2f4f5;
  --color-surface: #ffffff;
  --color-ink: #1f2d3a;
  --color-muted: #56656f;
  --color-faint: #7b8894;
  --color-border: #dbe1e5;
  --color-border-strong: #b9c3c9;

  --color-link: #0f766e;
  --color-primary: #0f766e;
  --color-primary-hover: #0c5d57;
  --color-primary-soft: #e4f4f2;
  --color-primary-ring: rgba(15, 118, 110, 0.25);
  --color-stat-border: #bfe0db;

  --color-header: #14302b;
  --color-header-text: #ffffff;
  --color-header-link: #a9c6bf;
  --color-header-accent: #2dd4bf;

  --color-danger-bg: #fdf1f1;
  --color-danger-border: #f2c4c4;
  --color-danger-text: #a03030;
  --color-ok-bg: #e2f3e8;
  --color-ok-text: #1c6b3c;
  --color-off-bg: #fbe9e9;
  --color-off-text: #993838;

  --color-code-bg: #eceff1;
  --color-thead-bg: #f7f9fa;
  --color-row-border: #edf0f2;
  --color-bar-track: #e8edef;
  --seg-label: rgba(255, 255, 255, 0.95);

  --chart-1: #0f766e;
  --chart-2: #b45309;
  --chart-3: #6d28d9;
  --chart-4: #be185d;
  --chart-5: #1d4ed8;
  --chart-6: #4d7c0f;

  --shadow-card: 0 1px 2px rgba(31, 45, 58, 0.06);
  --shadow-lift: 0 6px 18px rgba(31, 45, 58, 0.1);

  --show-sun: none;
  --show-moon: block;

  color-scheme: light;
}

/* ---------- Base ---------- */

* { box-sizing: border-box; }

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

body {
  font-family: var(--font-sans);
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  color: var(--color-ink);
  font-size: 16px;
  line-height: 1.6;
}

h1, h2, h3 {
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--color-ink);
}

h1 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.1rem); margin: 0 0 8px; }
h2 { font-size: 1.3rem; margin: 32px 0 12px; }
h3 { font-size: 1.05rem; margin: 24px 0 8px; }

p { margin: 0 0 14px; }

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

a:hover { text-decoration: underline; }

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--color-code-bg);
  border-radius: 4px;
  padding: 2px 5px;
}

pre code {
  display: block;
  padding: 14px;
  overflow-x: auto;
  line-height: 1.5;
}

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

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

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- Header and footer ---------- */

.site-header {
  background: var(--color-header);
  border-bottom: 3px solid var(--color-header-accent);
}

.header-inner {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.site-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--color-header-text);
  font-weight: 650;
  font-size: 17px;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.site-title:hover { text-decoration: none; }

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--color-header-accent);
  color: #14302b;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.site-nav a {
  color: var(--color-header-link);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.site-nav a:hover { color: #fff; }

.nav-user { color: var(--color-header-link); font-size: 13px; }

.nav-logout { margin: 0; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  color: var(--color-header-link);
  cursor: pointer;
}

.theme-toggle:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.5);
}

.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-sun { display: var(--show-sun); }
.theme-toggle .icon-moon { display: var(--show-moon); }

.site-footer {
  margin-top: auto;
  padding: 28px 24px 32px;
  text-align: center;
  font-size: 13px;
  color: var(--color-faint);
}

/* ---------- Layout ---------- */

.content {
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 36px 24px 48px;
}

.tool-shell {
  max-width: 780px;
  margin: 0 auto;
}

.page-intro {
  color: var(--color-muted);
  max-width: 56ch;
  margin: 0 0 28px;
}

.breadcrumb {
  font-size: 13px;
  color: var(--color-faint);
  margin-bottom: 10px;
}

.breadcrumb a { color: var(--color-faint); }
.breadcrumb a:hover { color: var(--color-link); }

/* ---------- Tool cards (landing) ---------- */

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 20px;
}

.tool-card {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s ease, box-shadow 0.15s ease,
    transform 0.15s ease;
}

.tool-card:hover,
.tool-card:focus-visible {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
  text-decoration: none;
}

.tool-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--color-primary-soft);
  font-size: 24px;
  margin-bottom: 14px;
}

.tool-card h2 {
  font-size: 1.05rem;
  margin: 0 0 6px;
}

.tool-card p {
  font-size: 14px;
  color: var(--color-muted);
  margin: 0 0 16px;
}

.tool-card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tool-version {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-muted);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 2px 10px;
}

.tool-open {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-link);
}

/* ---------- Buttons ---------- */

.button,
.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--color-primary);
  color: #fff;
  border: 1px solid transparent;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 14.5px;
  line-height: 1.3;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.button:hover,
.download-button:hover {
  background: var(--color-primary-hover);
  text-decoration: none;
}

.button-secondary {
  background: var(--color-surface);
  color: var(--color-ink);
  border-color: var(--color-border-strong);
}

.button-secondary:hover {
  background: var(--color-bg);
  border-color: var(--color-faint);
}

.button-small {
  padding: 6px 14px;
  font-size: 13px;
}

/* ---------- Forms ---------- */

label {
  font-size: 14px;
  font-weight: 550;
  color: var(--color-ink);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-ink);
  font-family: var(--font-sans);
  font-size: 15px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-ring);
}

input[type="file"] {
  font-size: 14px;
  color: var(--color-muted);
}

input[type="file"]::file-selector-button {
  background: var(--color-surface);
  color: var(--color-ink);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  margin-right: 12px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

input[type="file"]::file-selector-button:hover { background: var(--color-bg); }

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
}

.auth-form label { display: block; margin-bottom: 14px; }

.auth-form .button { width: 100%; margin-top: 6px; }

.form-error {
  background: var(--color-danger-bg);
  border: 1px solid var(--color-danger-border);
  color: var(--color-danger-text);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
}

/* ---------- Panels and cards ---------- */

.panel,
.instructions,
.auth-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-card);
}

.auth-card {
  max-width: 400px;
  margin: 40px auto;
}

.auth-card h1 { font-size: 1.4rem; margin-bottom: 18px; }

.sso-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.auth-alt {
  font-size: 13.5px;
  color: var(--color-muted);
  margin: 18px 0 0;
}

.instructions > :first-child { margin-top: 0; }
.instructions > :last-child { margin-bottom: 0; }
.instructions img { max-width: 100%; height: auto; }

/* ---------- Tables ---------- */

.table-wrap {
  overflow-x: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.data-table,
.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  font-size: 14px;
}

.data-table th,
.admin-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
  background: var(--color-thead-bg);
  border-bottom: 1px solid var(--color-border);
}

.data-table td,
.admin-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--color-row-border);
  font-variant-numeric: tabular-nums;
}

.data-table tr:last-child td,
.admin-table tr:last-child td { border-bottom: none; }

/* ---------- Status pills ---------- */

.status-pill {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
}

.status-on { background: var(--color-ok-bg); color: var(--color-ok-text); }
.status-off { background: var(--color-off-bg); color: var(--color-off-text); }

/* ---------- Uploads: drag-or-click dropzone ---------- */

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 36px 24px;
  border: 2px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
}

.dropzone:focus-within {
  outline: 2px solid var(--color-link);
  outline-offset: 2px;
}

.dropzone-icon { color: var(--color-link); margin-bottom: 6px; }
.dropzone-icon svg { width: 28px; height: 28px; }

.dropzone-title { font-weight: 600; font-size: 15px; }

.dropzone-hint { font-size: 13px; color: var(--color-muted); font-weight: 400; }

.dropzone-file {
  margin-top: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--color-link);
}

.upload-actions { margin-top: 18px; }

/* ---------- Analysis results convention ----------
   Shared components for any tool that turns an upload into an on-screen
   analysis (voting today, the document-integrity checker later):
   stat callouts for the headline numbers, labeled bar rows and stacked
   strips for distributions, tables demoted to a details fold, and
   downloads as the optional extra at the end. Candidate/series colors
   cycle through chart-c1..chart-c6. */

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 500;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 4px 14px;
  color: var(--color-muted);
}

.choice-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 20px;
}

.choice-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-chip span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1.5px solid var(--color-border-strong);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-muted);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease,
    color 0.15s ease;
}

.choice-chip span::before {
  content: "\2713";
  width: 1em;
  font-weight: 700;
  opacity: 0;
}

.choice-chip input:checked + span {
  background: var(--color-primary-soft);
  border-color: var(--color-primary);
  color: var(--color-ink);
}

.choice-chip input:checked + span::before { opacity: 1; color: var(--color-link); }

.choice-chip input:focus-visible + span {
  outline: 2px solid var(--color-link);
  outline-offset: 2px;
}

.result-block { margin-top: 40px; }
.result-block > h2 { margin-top: 0; }

.result-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
}

.result-card > h3:first-child { margin-top: 0; }

.stat-callout {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 20px;
}

.stat {
  flex: 1 1 160px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px 22px;
  box-shadow: var(--shadow-card);
}

.stat-first {
  background: var(--color-primary-soft);
  border-color: var(--color-stat-border);
}

.stat-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
}

.stat-first .stat-label { color: var(--color-link); }

.stat-value {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 150px;
  gap: 12px;
  align-items: center;
  font-size: 14px;
}

.bar-label {
  text-align: right;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-track {
  position: relative;
  display: block;
  height: 26px;
  border-radius: 6px;
  background: var(--color-bar-track);
  overflow: hidden;
}

.bar-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  min-width: 2px;
  border-radius: 6px;
}

.bar-value {
  font-size: 13px;
  color: var(--color-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.bar-row.is-eliminated .bar-fill { opacity: 0.35; }
.bar-row.is-eliminated .bar-label { color: var(--color-faint); }

.chart-c1 { background: var(--chart-1); }
.chart-c2 { background: var(--chart-2); }
.chart-c3 { background: var(--chart-3); }
.chart-c4 { background: var(--chart-4); }
.chart-c5 { background: var(--chart-5); }
.chart-c6 { background: var(--chart-6); }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 18px 0 10px;
  font-size: 13px;
  color: var(--color-muted);
}

.legend-item { display: inline-flex; align-items: center; gap: 7px; }

.legend-dot { width: 12px; height: 12px; border-radius: 4px; }

.stack-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13.5px;
}

.stack-label {
  text-align: right;
  font-weight: 600;
  color: var(--color-muted);
  white-space: nowrap;
}

.stack-bar {
  display: flex;
  height: 28px;
  border-radius: 6px;
  background: var(--color-bar-track);
  overflow: hidden;
}

.stack-seg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
}

.seg-label {
  font-size: 12px;
  font-weight: 650;
  color: var(--seg-label);
  white-space: nowrap;
}

.round-group { margin-bottom: 20px; }

.round-title {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  margin-bottom: 8px;
}

.tag-eliminated {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--color-off-bg);
  color: var(--color-off-text);
}

.table-details { margin-top: 16px; }

.table-details summary {
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--color-link);
}

.table-details[open] summary { margin-bottom: 12px; }

.downloads-note {
  font-size: 13.5px;
  color: var(--color-muted);
  margin-bottom: 14px;
}

.result-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* ---------- Small screens ---------- */

@media (max-width: 640px) {
  .header-inner { padding: 12px 16px; }
  .content { padding: 24px 16px 40px; }
  .site-nav { gap: 12px; }
  .panel,
  .instructions,
  .auth-card { padding: 20px; }
  .auth-card { margin: 16px auto; }
  .result-card { padding: 18px 20px; }
  .bar-row { grid-template-columns: 1fr; gap: 4px; }
  .bar-label { text-align: left; }
  .stack-row { grid-template-columns: 1fr; gap: 4px; }
  .stack-label { text-align: left; }
}
