/* ==========================================================================
   ACB Large Print Web App -- Form & Layout Supplement
   Extends acb-large-print.css with UI-specific styles.
   ========================================================================== */

/* --- Design Tokens -------------------------------------------------------- */
:root {
  --color-assess: #0055cc;
  --color-fix: #2e6b2e;
  --color-transform: #8b5cf6;
  --color-transform-text: #5b21b6;
  --color-listen: #0a6f8f;
  --color-explore: #b8860b;
  --color-explore-text: #5a3b00;
  --color-muted-ui-text: #555555;
  --sidebar-width: 16rem;
}

/* --- Global focus indicator (WCAG 2.4.7 / 2.4.13 baseline) ----------------
   Every interactive element gets a high-contrast focus ring by default.
   Per-component rules below may override the colour but should never
   remove this indicator without providing an equally visible replacement.
   The ring uses a double layer (white halo + blue outline) so it remains
   visible against both light and dark backgrounds. */
:focus {
  outline: 3px solid #0055cc;
  outline-offset: 2px;
}

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

:focus-visible {
  outline: 3px solid #0055cc;
  outline-offset: 3px;
  box-shadow: 0 0 0 5px #ffffff, 0 0 0 8px #0055cc;
  border-radius: 2px;
}

/* Native form controls render the ring inside their box; offset it so the
   indicator is never clipped by adjacent borders or radii. */
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #0055cc;
  outline-offset: 3px;
  box-shadow: 0 0 0 5px #ffffff, 0 0 0 8px #0055cc;
}

/* Native checkboxes and radios are small (16-20px) and many browsers/OS
   themes draw a faint or hard-to-see focus outline on them. Force a
   visible ring with currentColor so it survives high-contrast mode and
   dark themes, plus a white halo for separation from any backdrop. */
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
  outline: 3px solid #0055cc;
  outline-offset: 3px;
  box-shadow: 0 0 0 5px #ffffff, 0 0 0 8px #0055cc;
  border-radius: 3px;
}

/* When a checkbox/radio inside a label is focused, also outline the label
   text so keyboard users with low vision can locate the control by its
   text rather than the small box alone. */
label:has(input[type="checkbox"]:focus-visible),
label:has(input[type="radio"]:focus-visible) {
  outline: 2px dashed #0055cc;
  outline-offset: 4px;
  border-radius: 4px;
}

/* Forced-colors / Windows High Contrast: defer to the system focus
   colour so the indicator survives any user theme. */
@media (forced-colors: active) {

  :focus-visible,
  input:focus-visible,
  select:focus-visible,
  textarea:focus-visible,
  button:focus-visible,
  a:focus-visible,
  summary:focus-visible,
  [tabindex]:focus-visible,
  input[type="checkbox"]:focus-visible,
  input[type="radio"]:focus-visible {
    outline: 3px solid Highlight;
    outline-offset: 3px;
    box-shadow: none;
  }

  label:has(input[type="checkbox"]:focus-visible),
  label:has(input[type="radio"]:focus-visible) {
    outline-color: Highlight;
  }
}

/* --- Skip Link --- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.5em 1em;
  background: #1a1a1a;
  color: #ffffff;
}

.skip-link:focus {
  left: 0;
}

/* ==========================================================================
   GLOW 5.0.0 -- Sidebar Navigation Layout
   ========================================================================== */

/* --- Override body max-width/padding for full-width sidebar layout -------- */
body {
  max-width: none;
  padding: 0;
  margin: 0;
}

/* --- App layout: sidebar + content area flex row -------------------------- */
.app-layout {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

/* --- Mobile header bar (hamburger + brand, hidden on desktop) ------------- */
.mobile-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  background: #ffffff;
  border-bottom: 2px solid #1a1a1a;
  position: sticky;
  top: 0;
  z-index: 200;
}

html[data-theme="dark"] .mobile-header {
  background: #1e1e1e;
  border-bottom-color: #cccccc;
}

@media (min-width: 64em) {
  .mobile-header {
    display: none;
  }
}

/* --- Hamburger toggle button ---------------------------------------------- */
.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0.5rem;
  background: none;
  border: 2px solid #1a1a1a;
  border-radius: 0.25rem;
  cursor: pointer;
  flex-shrink: 0;
  color: #1a1a1a;
}

.sidebar-toggle:hover {
  background: #f0f5ff;
  border-color: #0055cc;
  color: #0055cc;
}

.sidebar-toggle:focus-visible {
  outline: 3px solid #0055cc;
  outline-offset: 3px;
  box-shadow: 0 0 0 5px #ffffff, 0 0 0 8px #0055cc;
}

html[data-theme="dark"] .sidebar-toggle {
  border-color: #cccccc;
  color: #f0f0f0;
}

html[data-theme="dark"] .sidebar-toggle:hover {
  background: #2a3a5c;
  border-color: #80aaff;
  color: #80aaff;
}

@media (min-width: 64em) {
  .sidebar-toggle {
    display: none;
  }
}

/* Three stacked bars for hamburger icon */
.hamburger-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 20px;
}

.hamburger-bars span {
  display: block;
  width: 20px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}

/* --- Mobile brand (shown in header bar on small screens) ------------------ */
.mobile-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: Arial, sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  text-decoration: none;
  color: #1a1a1a;
}

.mobile-brand:hover,
.mobile-brand:focus {
  text-decoration: underline;
}

html[data-theme="dark"] .mobile-brand {
  color: #f0f0f0;
}

@media (min-width: 64em) {
  .mobile-brand {
    display: none;
  }
}

/* --- Sidebar overlay (mobile -- dims content behind open sidebar) --------- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 149;
}

.sidebar-overlay:not([hidden]) {
  display: block;
}

@media (min-width: 64em) {
  .sidebar-overlay {
    display: none !important;
  }
}

/* --- Sidebar ---------------------------------------------------------------- */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: #f5f5f5;
  border-right: 2px solid #1a1a1a;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 150;
  padding-bottom: 2rem;
}

html[data-theme="dark"] .sidebar {
  background: #141414;
  border-right-color: #3a3a3a;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.35);
}

/* Mobile: sidebar is off-screen until toggled */
@media (max-width: 63.999em) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: none;
  }

  .sidebar.sidebar--open {
    transform: translateX(0);
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.25);
  }
}

/* Prevent body scroll when mobile sidebar is open */
body.sidebar-body-locked {
  overflow: hidden;
}

/* --- Sidebar brand lockup (desktop only) ---------------------------------- */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  font-family: Arial, sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  text-decoration: none;
  color: #1a1a1a;
  border-bottom: 2px solid #dddddd;
  flex-shrink: 0;
}

.sidebar-brand:hover,
.sidebar-brand:focus {
  text-decoration: underline;
}

.sidebar-brand[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

html[data-theme="dark"] .sidebar-brand {
  color: #f0f0f0;
  border-bottom-color: #444444;
}

.sidebar-brand-text {
  line-height: 1.3;
}

.sidebar-group--beta .sidebar-group-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.sidebar-beta-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
  border: 1px solid rgba(239, 68, 68, 0.35);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

html[data-theme="dark"] .sidebar-beta-badge {
  background: rgba(248, 113, 113, 0.16);
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.35);
}

/* --- Sidebar nav list ----------------------------------------------------- */
.sidebar-nav {
  list-style: none;
  padding: 0.5rem 0;
  margin: 0;
  flex: 1;
}

/* --- Sidebar group container --------------------------------------------- */
.sidebar-group {
  margin-top: 1.25rem;
}

.sidebar-group:first-of-type {
  margin-top: 0.25rem;
}

/* Group label (non-interactive category heading) */
.sidebar-group-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1rem 0.375rem;
  font-family: Arial, sans-serif;
  font-size: 0.6875rem;
  /* 11px — clearly smaller than nav links */
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-muted-ui-text);
  border-top: 1px solid #e0e0e0;
  user-select: none;
  pointer-events: none;
  /* unambiguously non-interactive */
}

/* Decorative dash — visually signals "category divider", not a link */
.sidebar-group-label::before {
  content: "";
  display: inline-block;
  width: 0.875rem;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
  flex-shrink: 0;
  margin-top: 0.05em;
}

html[data-theme="dark"] .sidebar-group-label {
  color: #b8b8b8;
  border-top-color: #2e2e2e;
}

/* Active group: accent the label with the group's color */
.sidebar-group--assess.sidebar-group--active>.sidebar-group-label {
  color: var(--color-assess);
  border-top-color: var(--color-assess);
}

.sidebar-group--fix.sidebar-group--active>.sidebar-group-label {
  color: var(--color-fix);
  border-top-color: var(--color-fix);
}

.sidebar-group--transform.sidebar-group--active>.sidebar-group-label {
  color: var(--color-transform-text);
  border-top-color: var(--color-transform);
}

.sidebar-group--listen.sidebar-group--active>.sidebar-group-label {
  color: var(--color-listen);
  border-top-color: var(--color-listen);
}

.sidebar-group--explore.sidebar-group--active>.sidebar-group-label {
  color: var(--color-explore-text);
  border-top-color: var(--color-explore);
}

html[data-theme="dark"] .sidebar-group--assess.sidebar-group--active>.sidebar-group-label {
  color: #80aaff;
  border-top-color: #80aaff;
}

html[data-theme="dark"] .sidebar-group--fix.sidebar-group--active>.sidebar-group-label {
  color: #7fbe7f;
  border-top-color: #7fbe7f;
}

html[data-theme="dark"] .sidebar-group--transform.sidebar-group--active>.sidebar-group-label {
  color: #c4a0ff;
  border-top-color: #c4a0ff;
}

html[data-theme="dark"] .sidebar-group--listen.sidebar-group--active>.sidebar-group-label {
  color: #5abfde;
  border-top-color: #5abfde;
}

html[data-theme="dark"] .sidebar-group--explore.sidebar-group--active>.sidebar-group-label {
  color: #e0c060;
  border-top-color: #e0c060;
}

.sidebar-group>ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* --- Individual sidebar links -------------------------------------------- */
.sidebar-link {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem 0.5rem 1.5rem;
  font-family: Arial, sans-serif;
  font-size: 1rem;
  font-weight: 400;
  text-decoration: none;
  color: #333333;
  min-height: 44px;
  border-left: 3px solid transparent;
  transition: background 0.1s ease, color 0.1s ease;
}

.sidebar-link:hover {
  background: #e8f0fe;
  color: #0044aa;
  text-decoration: underline;
}

.sidebar-link:focus-visible {
  outline: 3px solid #0055cc;
  outline-offset: -2px;
  z-index: 1;
  position: relative;
}

/* Top-level quick start link has less indentation */
.sidebar-nav>li>.sidebar-link {
  padding-left: 1rem;
  font-weight: 700;
}

/* Active / current page link */
.sidebar-link--active,
.sidebar-link[aria-current="page"] {
  color: #0055cc;
  font-weight: 700;
  border-left-color: #0055cc;
  background: #e8f0fe;
}

html[data-theme="dark"] .sidebar-link {
  color: #e0e0e0;
}

html[data-theme="dark"] .sidebar-link:hover {
  background: #1a2a4a;
  color: #80aaff;
}

html[data-theme="dark"] .sidebar-link--active,
html[data-theme="dark"] .sidebar-link[aria-current="page"] {
  color: #80aaff;
  background: #1a2a4a;
  border-left-color: #80aaff;
}

/* Nav link icons */
.nav-icon {
  flex-shrink: 0;
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  opacity: 0.7;
  margin-right: 0.375rem;
  transition: opacity 0.15s ease;
}

.sidebar-link:hover .nav-icon,
.sidebar-link--active .nav-icon,
.sidebar-link[aria-current="page"] .nav-icon {
  opacity: 1;
}

/* --- Content area --------------------------------------------------------- */
.content-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  padding: 1.5rem clamp(1rem, 3vw, 2.5rem);
  max-width: min(66rem, 100%);
}

/* --- Print: hide sidebar, show content normally --------------------------- */
@media print {

  .mobile-header,
  .sidebar,
  .sidebar-overlay {
    display: none !important;
  }

  .app-layout {
    display: block;
  }

  .content-area {
    display: block;
  }

  main {
    max-width: none;
    padding: 0;
  }
}

/* --- Loading State (SPA tab switch) --- */
main[aria-busy="true"] {
  opacity: 0.6;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

/* --- Cards (landing page) --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.card {
  border: 2px solid #1a1a1a;
  padding: 1.25rem;
  border-radius: 0.25rem;
  position: relative;
}

.card h3 {
  margin-top: 0;
  font-size: 1.333rem;
}

.card p {
  margin-bottom: 0;
}

.card-formats {
  margin-top: 0.75rem !important;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  list-style: none;
  padding-left: 0;
}

/* -- Card accent borders (left stripe by operation type) -- */
.card-audit {
  border-left: 5px solid #0055cc;
}

.card-fix {
  border-left: 5px solid #2e6b2e;
}

.card-template {
  border-left: 5px solid #6b3fa0;
}

.card-export {
  border-left: 5px solid #b8860b;
}

.card-convert {
  border-left: 5px solid #8b5cf6;
}

.card-guidelines {
  border-left: 5px solid #0a6f8f;
}

.card-settings {
  border-left: 5px solid #7a4f2b;
}

/* --- Mission Grid (GLOW 5.0.0 home page) --- */
.mission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.mission-card {
  border: 2px solid #1a1a1a;
  border-radius: 0.375rem;
  padding: 1.5rem;
  position: relative;
}

.mission-card h3 {
  margin-top: 0;
  font-size: 1.25rem;
}

.mission-card p {
  color: #444444;
  margin-bottom: 0.75rem;
}

@media (prefers-reduced-motion: no-preference) {
  .mission-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }
}

.mission-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
  border-color: #888;
}

html[data-theme="dark"] .mission-card:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  border-color: #999;
}

.mission-card__cta {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 700;
  text-decoration: underline;
  color: inherit;
}

.mission-card__cta:hover {
  text-decoration: none;
}

/* Home quick-start strip */
.home-quickstart {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 1.25rem 1.5rem;
  background: #f0f4ff;
  border-left: 4px solid #0055cc;
  border-radius: 0.375rem;
  margin-bottom: 2rem;
}

.home-quickstart__cta {
  font-size: 1.0625rem;
  white-space: nowrap;
}

.home-quickstart__hint {
  margin: 0;
  font-size: 0.875rem;
  color: #444444;
}

/* Accent left borders per mission */
.mission-card--assess {
  border-left: 5px solid #0055cc;
}

.mission-card--fix {
  border-left: 5px solid #2e6b2e;
}

.mission-card--transform {
  border-left: 5px solid #8b5cf6;
}

.mission-card--listen {
  border-left: 5px solid #0a6f8f;
}

.mission-card--explore {
  border-left: 5px solid #b8860b;
}

/* Dark theme */
html[data-theme="dark"] .mission-card {
  background: #1e1e1e;
  border-color: #444;
}

html[data-theme="dark"] .mission-card p {
  color: #bbbbbb;
}

html[data-theme="dark"] .home-quickstart {
  background: #0a1a3a;
  border-left-color: #4d8ff5;
}

html[data-theme="dark"] .home-quickstart__hint {
  color: #bbbbbb;
}

/* --- Format Pills (hero section showing supported formats) --- */
.format-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1rem 0 1.5rem;
  list-style: none;
  padding-left: 0;
}

.format-pill {
  display: inline-block;
  font-size: 1rem;
  font-weight: 700;
  padding: 0.5em 1em;
  border-radius: 2rem;
  border: 2px solid;
}

.format-pill.format-docx {
  background: #e8f0fe;
  color: #1a3d6f;
  border-color: #2b579a;
}

.format-pill.format-xlsx {
  background: #e8f5e9;
  color: #1b5e20;
  border-color: #217346;
}

.format-pill.format-pptx {
  background: #fce4ec;
  color: #7f1d1d;
  border-color: #b7472a;
}

.format-pill.format-md {
  background: #f3e8ff;
  color: #4c1d95;
  border-color: #6b3fa0;
}

.format-pill.format-pdf {
  background: #fff3e0;
  color: #7c2d12;
  border-color: #c75000;
}

.format-pill.format-epub {
  background: #e0f2f1;
  color: #004d40;
  border-color: #00796b;
}

/* --- Format Tags (compact labels inside cards, rule lists, etc.) --- */
.format-tag {
  display: inline-block;
  font-size: 0.8125rem;
  font-weight: 700;
  padding: 0.1em 0.45em;
  border-radius: 0.25rem;
  vertical-align: middle;
  margin-left: 0.25em;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.format-tag.format-docx {
  background: #2b579a;
  color: #ffffff;
}

.format-tag.format-xlsx {
  background: #217346;
  color: #ffffff;
}

.format-tag.format-pptx {
  background: #b7472a;
  color: #ffffff;
}

.format-tag.format-md {
  background: #6b3fa0;
  color: #ffffff;
}

.format-tag.format-pdf {
  background: #c75000;
  color: #ffffff;
}

.format-tag.format-epub {
  background: #00796b;
  color: #ffffff;
}

.format-tag.format-misc {
  background: #555555;
  color: #ffffff;
}

/* --- Brand icon in nav --- */
.brand-icon {
  font-size: 1.5rem;
  vertical-align: -0.15em;
  margin-right: 0.25em;
}

/* --- Forms --- */
.form-group {
  margin-bottom: 1.5rem;
}

.inline-form {
  display: inline;
}

/* --- Consent modal --- */
.consent-modal-backdrop {
  background: #ffffff;
  color: #1a1a1a;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1rem;
}

.consent-modal {
  width: min(64rem, 100%);
  background: #ffffff;
  color: #1a1a1a;
  border: 3px solid #1a1a1a;
  border-radius: 0.375rem;
  padding: 1rem 1.25rem;
}

.consent-modal-scroll {
  margin-bottom: 1rem;
}

.consent-modal h2,
.consent-modal h3,
.consent-modal h4 {
  margin-top: 1rem;
}

.consent-modal form {
  border-top: 2px solid #1a1a1a;
  padding-top: 0.75rem;
}

.consent-modal button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 48rem) {
  .consent-modal {
    padding: 0.875rem;
  }

  .consent-modal-scroll {
    padding-right: 0;
  }
}

/* --- Whisperer progress indicator --- */
.transcribe-progress {
  margin-top: 1.5rem;
  border: 2px solid #1a1a1a;
  border-radius: 0.25rem;
  padding: 1rem;
  background: #f7f7f7;
}

.transcribe-progress h2 {
  margin-top: 0;
}

.transcribe-progress progress {
  width: 100%;
  height: 1.25rem;
}

label {
  display: block;
  margin-bottom: 0.25rem;
}

input[type="text"],
input[type="file"] {
  display: block;
  font-family: Arial, sans-serif;
  font-size: 1.125rem;
  padding: 0.5em 0.75em;
  border: 2px solid #1a1a1a;
  border-radius: 0.25rem;
  width: 100%;
  max-width: 40rem;
  background: #ffffff;
  color: #1a1a1a;
}

input[type="file"] {
  padding: 0.75em;
}

input[type="text"]:focus,
input[type="file"]:focus {
  outline: 3px solid #0055cc;
  outline-offset: 2px;
}

.help-text {
  font-size: 1rem;
  color: #444;
  margin-top: 0.25rem;
  margin-bottom: 0;
}

/* --- Status / readiness badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.2rem 0.65rem;
  border: 1px solid #666666;
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.2;
  color: #1a1a1a;
  background: #f5f5f5;
}

.badge-success {
  color: #0f5132;
  background: #d1e7dd;
  border-color: #75b798;
}

.badge-warning {
  color: #664d03;
  background: #fff3cd;
  border-color: #d6b75d;
}

/* --- Radio & Checkbox Groups --- */
fieldset {
  border: 2px solid #767676;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  border-radius: 0.25rem;
}

legend {
  font-weight: 700;
  font-size: 1.125rem;
  padding: 0 0.5em;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.radio-group label,
.checkbox-group label,
fieldset>label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
}

input[type="radio"],
input[type="checkbox"] {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.2em;
  accent-color: #0055cc;
}

/* --- Custom Rules Panel --- */
.custom-rules-panel {
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
}

.rule-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0 0;
}

.rule-list li {
  padding: 0.5em 0;
  border-bottom: 1px solid #767676;
}

.rule-list li:last-child {
  border-bottom: none;
}

.rule-ref {
  display: block;
  font-size: 0.875rem;
  color: #555;
  margin-left: 1.75rem;
}

.manual-tag {
  font-size: 0.875rem;
  color: #8b0000;
}

.category-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.125em 0.375em;
  border-radius: 0.25rem;
  vertical-align: middle;
  margin-left: 0.25em;
}

.category-msac {
  background: #e0e7ff;
  color: #1e3a5f;
}

/* --- Details / Accordions --- */
details {
  margin: 1rem 0;
  border: 1px solid #767676;
  border-radius: 0.25rem;
}

details>summary {
  padding: 0.75em 1em;
  font-weight: 700;
  cursor: pointer;
  list-style: revert;
}

details>summary:focus {
  outline: 3px solid #0055cc;
  outline-offset: -2px;
}

details[open]>summary {
  border-bottom: 1px solid #767676;
}

details> :not(summary) {
  padding: 0 1em;
}

details.help-accordion {
  background: #f8f8f8;
}

details.guideline-accordion {
  background: #fafafa;
}

details.rule-group {
  border: 1px solid #767676;
  margin: 0.5rem 0;
}

/* --- Severity Badges --- */
.severity-badge {
  display: inline-block;
  font-size: 0.875rem;
  font-weight: 700;
  padding: 0.15em 0.5em;
  border-radius: 0.2rem;
  white-space: nowrap;
}

.severity-critical {
  background: #8b0000;
  color: #ffffff;
}

.severity-high {
  background: #b44700;
  color: #ffffff;
}

.severity-medium {
  background: #b8860b;
  color: #000000;
}

.severity-low {
  background: #2e6b2e;
  color: #ffffff;
}

/* --- Buttons --- */
.btn-primary {
  display: inline-block;
  font-family: Arial, sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  color: #ffffff;
  background: #0055cc;
  border: 2px solid #0055cc;
  padding: 0.75em 1.5em;
  border-radius: 0.25rem;
  cursor: pointer;
  text-decoration: none;
  min-width: 44px;
  min-height: 44px;
}

.btn-primary:hover,
.btn-primary:focus {
  background: #003d99;
  border-color: #003d99;
  outline: 3px solid #003d99;
  outline-offset: 2px;
}

.btn-primary:disabled,
.btn-primary[aria-disabled="true"] {
  color: #ffffff;
  background: #4d6f91;
  border-color: #4d6f91;
  cursor: not-allowed;
}

.btn-secondary {
  display: inline-block;
  font-family: Arial, sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  color: #ffffff;
  background: #666666;
  border: 2px solid #666666;
  padding: 0.75em 1.5em;
  border-radius: 0.25rem;
  cursor: pointer;
  text-decoration: none;
  min-width: 44px;
  min-height: 44px;
}

.btn-secondary:hover,
.btn-secondary:focus {
  background: #555555;
  border-color: #555555;
  outline: 3px solid #555555;
  outline-offset: 2px;
}

.btn-secondary:disabled,
.btn-secondary[aria-disabled="true"] {
  color: #ffffff;
  background: #595959;
  border-color: #595959;
  cursor: not-allowed;
}

/* --- Consent agreement checkbox --- */
.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 1.125rem;
  font-family: Arial, sans-serif;
  cursor: pointer;
  margin-bottom: 0.5rem;
}

.checkbox-label input[type="checkbox"] {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  margin-top: 0.125rem;
  cursor: pointer;
  accent-color: #0055cc;
}

.checkbox-label span {
  line-height: 1.5;
}

/* --- Settings Actions Grouping --- */
.settings-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

/* --- Narrow Input Fields (for threshold numbers, etc.) --- */
.input-narrow {
  max-width: 8rem !important;
}

select.input-narrow {
  max-width: 12rem !important;
}

/* --- Per-style font-size grid (Fix and Template forms) --- */
.font-size-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.5rem 1.5rem;
  margin-top: 0.5rem;
}

.font-size-grid .form-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.font-size-grid .form-row label {
  flex: 1 1 auto;
  font-weight: 600;
  margin: 0;
}

.font-size-grid .form-row .suffix {
  font-weight: 600;
}

/* --- Scores --- */
.score-display {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.score-number {
  font-size: 2rem;
  font-weight: 700;
}

.score-grade {
  font-size: 1.333rem;
  font-weight: 700;
}

.grade-a {
  color: #2e6b2e;
}

.grade-b {
  color: #2e6b2e;
}

.grade-c {
  color: var(--color-explore-text);
}

.grade-d {
  color: #cc5500;
}

.grade-f {
  color: #8b0000;
}

.score-comparison {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin: 1.5rem 0;
}

.score-box {
  border: 2px solid #1a1a1a;
  padding: 1rem 1.5rem;
  border-radius: 0.25rem;
  text-align: center;
}

.score-box h3 {
  margin: 0 0 0.25rem 0;
  font-size: 1.125rem;
}

.score-arrow {
  font-size: 2rem;
  font-weight: 700;
}

/* --- Error Box --- */
.error-box {
  border: 2px solid #8b0000;
  background: #fff0f0;
  padding: 1rem 1.25rem;
  border-radius: 0.25rem;
  margin-bottom: 1.5rem;
}

.error-box p {
  margin: 0;
}

/* --- Flash Messages --- */
[class^="flash-"] {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: 0.25rem;
  margin-bottom: 1.5rem;
  border: 2px solid;
}

.flash-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}

/* --- AI Settings --------------------------------------------------------- */
.settings-ai-key-input {
  font-family: monospace;
  width: 100%;
  max-width: 32rem;
}

.settings-ai-custom-model {
  font-family: monospace;
  max-width: 20rem;
}

.settings-ai-model-guide-help {
  margin-top: 0.5rem;
}

.settings-ai-validate-result {
  margin-top: 0.75rem;
}

.settings-ai-feature-actions {
  margin-top: 1rem;
}

.provider-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 1rem;
  margin: 1rem 0 1.5rem 0;
}

.provider-card {
  border: 2px solid #1a1a1a;
  border-radius: 0.375rem;
  padding: 1rem 1.25rem;
  background: #fff;
}

.provider-card h3,
.provider-card h4 {
  margin-top: 0;
}

.provider-card p:last-of-type {
  margin-bottom: 0.75rem;
}

.feature-model-card {
  border: 1px solid #c7d3e0;
  border-radius: 0.375rem;
  padding: 1rem;
  margin-bottom: 1rem;
  background: #fbfdff;
}

.feature-model-card--beta {
  border-color: #4a6fa5;
}

.ai-session-panel {
  border: 2px solid #1a1a1a;
  border-radius: 0.375rem;
  padding: 1rem 1.25rem;
  margin: 1rem 0 1.5rem 0;
  background: #f8fbff;
}

.ai-session-panel p {
  margin: 0 0 0.75rem 0;
}

.settings-ai-select-unavailable {
  color: #6e7781;
}

/* --- AI Playground ------------------------------------------------------- */
.beta-notice {
  background: var(--color-accent-subtle, #f0f4ff);
  border-left: 4px solid var(--color-accent, #4a6fa5);
  border-radius: 0 0.375rem 0.375rem 0;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 1rem;
}

.badge--beta {
  background: var(--color-accent, #4a6fa5);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15em 0.55em;
  border-radius: 0.25em;
  vertical-align: middle;
}

.playground-model-indicator {
  font-size: 0.95rem;
  color: var(--color-text-muted, #555);
  margin-bottom: 1rem;
}

.playground-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.playground-toolbar__label {
  font-weight: 600;
}

.playground-toolbar__select {
  min-width: 14rem;
  max-width: 24rem;
}

.playground-quota {
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  color: var(--color-text-muted, #555);
}

.playground-quota--warn {
  color: var(--color-error, #c0392b);
  font-weight: 600;
}

.playground-status {
  min-height: 1.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.playground-status:not(:empty) {
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
}

.playground-status--error {
  background: var(--color-error-bg, #fff0f0);
  border: 1px solid var(--color-error, #c0392b);
  color: var(--color-error, #c0392b);
}

.playground-status--success {
  background: var(--color-success-bg, #f0fff4);
  border: 1px solid var(--color-success, #27ae60);
  color: var(--color-success, #1a7a42);
}

.playground-status--info {
  background: var(--color-info-bg, #f0f8ff);
  border: 1px solid var(--color-info, #2980b9);
  color: var(--color-info-dark, #1a5276);
}

.conversation-log {
  border: 1px solid var(--color-border, #d0d7de);
  border-radius: 0.5rem;
  padding: 1rem;
  min-height: 12rem;
  max-height: 36rem;
  overflow-y: auto;
  scroll-behavior: smooth;
  background: var(--color-surface, #fff);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
}

.conversation-log:focus {
  outline: 2px solid var(--color-focus, #0050d8);
  outline-offset: 2px;
}

.conversation-log__empty {
  color: var(--color-text-muted, #6e7781);
  font-style: italic;
  text-align: center;
  margin: auto;
}

.message {
  max-width: 85%;
  border-radius: 0.5rem;
  padding: 0.625rem 0.875rem;
  line-height: 1.5;
  word-break: break-word;
}

.message__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 0.25rem 0;
  opacity: 0.86;
}

.message__model {
  font-weight: 400;
  font-family: monospace;
  font-size: 0.85em;
}

.message__body {
  white-space: pre-wrap;
  font-size: 1rem;
}

.message__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.message--user {
  align-self: flex-end;
  background: var(--color-accent, #4a6fa5);
  color: #fff;
  border-bottom-right-radius: 0.125rem;
}

.message--assistant {
  align-self: flex-start;
  background: var(--color-surface-raised, #f6f8fa);
  border: 1px solid var(--color-border, #d0d7de);
  border-bottom-left-radius: 0.125rem;
}

.message--thinking {
  opacity: 0.78;
  border-style: dashed;
}

.message--thinking .message__body {
  font-style: italic;
}

.message--thinking .message__meta {
  opacity: 0.7;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 0.5rem;
  padding: 0.15rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.4;
  background: transparent;
  border: 1px solid var(--color-border, #d0d7de);
  border-radius: 0.25rem;
  color: var(--color-text-muted, #555);
  cursor: pointer;
  vertical-align: middle;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.copy-btn:hover,
.copy-btn:focus-visible {
  background: var(--color-accent, #4a6fa5);
  border-color: var(--color-accent, #4a6fa5);
  color: #fff;
  outline: 2px solid var(--color-focus, #0050d8);
  outline-offset: 2px;
}

.copy-btn--copied {
  background: var(--color-success, #1b5e20) !important;
  border-color: var(--color-success, #1b5e20) !important;
  color: #fff !important;
}

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0;
}

.typing-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--color-accent, #4a6fa5);
  animation: typing-bounce 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing-bounce {

  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }

  30% {
    transform: translateY(-0.35rem);
    opacity: 1;
  }
}

.playground-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  margin-bottom: 0.25rem;
}

.playground-textarea {
  flex: 1;
  resize: vertical;
  font-size: 1rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border, #d0d7de);
  border-radius: 0.375rem;
  font-family: inherit;
  line-height: 1.5;
}

.playground-textarea:focus {
  outline: 2px solid var(--color-focus, #0050d8);
  outline-offset: 1px;
  border-color: var(--color-focus, #0050d8);
}

.playground-send-btn {
  align-self: flex-end;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.playground-actions {
  margin-top: 0.75rem;
}

.char-count {
  color: var(--color-text-muted, #6e7781);
  font-size: 0.85rem;
}

.char-count--warn {
  color: var(--color-error, #c0392b);
  font-weight: 600;
}

.playground-templates {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

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

@media (max-width: 768px) {
  .playground-input-row {
    flex-direction: column;
    align-items: stretch;
  }

  .playground-send-btn {
    align-self: stretch;
    justify-content: center;
  }

  .message {
    max-width: 100%;
  }
}


[class^="flash-"] p {
  margin: 0;
  line-height: 1.4;
}

.flash-error {
  border-color: #8b0000;
  background: #fff0f0;
  color: #1a1a1a;
}

.flash-success {
  border-color: #2e6b2e;
  background: #f0fff0;
  color: #1a1a1a;
}

.flash-warning {
  border-color: #b8860b;
  background: #fff8e0;
  color: #1a1a1a;
}

.flash-info,
.flash-message {
  border-color: #0055cc;
  background: #f0f5ff;
  color: #1a1a1a;
}

/* --- Textarea --- */
.form-textarea {
  display: block;
  font-family: Arial, sans-serif;
  font-size: 1.125rem;
  padding: 0.5em 0.75em;
  border: 2px solid #1a1a1a;
  border-radius: 0.25rem;
  width: 100%;
  max-width: 40rem;
  background: #ffffff;
  color: #1a1a1a;
}

.form-textarea:focus {
  outline: 3px solid #0055cc;
  outline-offset: 2px;
}

/* --- Tables (findings) --- */
.findings-table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
}

.findings-table th,
.findings-table td {
  text-align: left;
  padding: 0.5em 0.75em;
  border: 1px solid #666;
  font-size: 1rem;
}

.findings-table th {
  background: #f0f0f0;
  font-weight: 700;
}

/* --- Footer --- */
footer {
  border-top: 2px solid #1a1a1a;
  margin-top: 3rem;
  padding-top: 1rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 1rem;
}

.footer-links a {
  font-size: 1rem;
  padding: 0.25em 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.footer-links a:focus {
  outline: 3px solid #0055cc;
  outline-offset: 2px;
}

.footer-links a[aria-current="page"] {
  font-weight: 700;
}

footer p {
  font-size: 1rem;
  color: #444;
}

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

/* --- Findings Severity Summary --- */
.severity-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
  list-style: none;
  padding-left: 0;
}

.severity-summary li {
  font-weight: 700;
}

/* --- Occurrence count badges and per-rule occurrence lists --- */
.occurrence-count {
  display: inline-block;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.15rem 0.5rem;
  border-radius: 0.25rem;
  border: 1px solid currentColor;
}

.occurrence-count--single {
  color: #2e6b2e;
  /* match successful/low-priority green */
}

.occurrence-count--multi {
  color: #8a3a00;
  /* warm amber to draw attention to repeats */
  background: #fff7e6;
}

html[data-theme="dark"] .occurrence-count--single {
  color: #9be39b;
}

html[data-theme="dark"] .occurrence-count--multi {
  color: #ffc680;
  background: #3a2710;
}

.occurrence-location {
  margin-top: 0.25rem;
  font-size: 0.95rem;
}

.occurrence-list {
  margin-top: 0.4rem;
}

.occurrence-list>summary {
  font-size: 0.95rem;
  cursor: pointer;
}

.occurrence-list-items {
  margin: 0.5rem 0 0 1.25rem;
  padding-left: 1rem;
}

.occurrence-list-items li {
  margin-bottom: 0.35rem;
  line-height: 1.4;
}

.occurrence-loc {
  font-weight: 600;
}

.occurrence-msg {
  display: block;
  margin-top: 0.1rem;
}

/* --- Perfect Score Celebration --- */
.celebration {
  border: 3px solid #2e6b2e;
  background: #f0fff0;
  padding: 1.5rem;
  border-radius: 0.5rem;
  text-align: center;
}

.celebration h2 {
  color: #2e6b2e;
  margin-top: 0;
}

.celebration .score-number {
  font-size: 2.5rem;
}

/* --- Back to Top Link --- */
.back-to-top {
  display: inline-block;
  font-size: 1rem;
  margin-top: 0.5rem;
}

/* --- Expand / Collapse All Toggle --- */
.toggle-all-wrap {
  margin-bottom: 1rem;
}

.toggle-all-btn {
  font-family: Arial, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: #0055cc;
  background: none;
  border: 2px solid #0055cc;
  padding: 0.4em 1em;
  border-radius: 0.25rem;
  cursor: pointer;
}

.toggle-all-btn:hover,
.toggle-all-btn:focus {
  background: #0055cc;
  color: #ffffff;
  outline: 3px solid #003d99;
  outline-offset: 2px;
}

/* --- Action Grid (Quick Start action chooser) --- */
.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.action-card {
  border: 2px solid #ddd;
  border-radius: 0.5rem;
  padding: 1.5rem;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.action-card:hover {
  border-color: #0055cc;
  box-shadow: 0 4px 12px rgba(0, 85, 204, 0.1);
}

.action-icon {
  font-size: 2.5rem;
  line-height: 1;
}

.action-card h3 {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0;
  color: #000;
}

.action-card p {
  font-size: 1rem;
  margin: 0;
  flex-grow: 1;
  line-height: 1.5;
}

.action-card form {
  align-self: flex-start;
}

/* --- Chat Interface --- */
.chat-turn {
  border: 2px solid #ccc;
  border-radius: 0.5rem;
  padding: 1rem;
  margin: 1rem 0;
  background: #fafafa;
}

.chat-turn summary {
  cursor: pointer;
  font-weight: 700;
  padding: 0.5rem;
  margin: -1rem -1rem 1rem -1rem;
  background: #f0f0f0;
  border-radius: 0.5rem 0.5rem 0 0;
}

.chat-turn summary:hover,
.chat-turn summary:focus {
  background: #e0e0e0;
  outline: 3px solid #0055cc;
  outline-offset: -2px;
}

.chat-turn-content {
  margin-top: 1rem;
}

.chat-turn-content h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 1rem 0 0.5rem 0;
  color: #000;
}

.user-question {
  border-left: 4px solid #0055cc;
  padding-left: 1rem;
  margin: 0.5rem 0 1rem 0;
  font-style: italic;
  line-height: 1.5;
}

.ai-answer {
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* --- Drag-and-drop zone --- */
.drop-zone {
  border: 2px dashed #767676;
  border-radius: 0.25rem;
  padding: 0.875rem 1.25rem;
  margin-top: 0.5rem;
  max-width: 40rem;
  background: #f8f8f8;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.drop-zone--active {
  border-color: #0055cc;
  border-style: solid;
  background: #e8f0fe;
}

.drop-zone-hint {
  margin: 0;
  color: #595959;
  font-size: 1rem;
  text-align: center;
}

.drop-zone--active .drop-zone-hint {
  color: #0055cc;
  font-weight: 700;
}

/* --- Score headline: large grade letter beside score number --- */
.score-headline {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin: 1rem 0 1.5rem;
}

.score-grade-letter {
  font-size: 6rem;
  font-weight: 700;
  line-height: 1;
  min-width: 1.5ch;
  text-align: center;
}

.score-headline-detail {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.score-headline-detail p {
  margin: 0;
}

/* --- Next-step action callout card --- */
.next-step-callout {
  border: 2px solid #0055cc;
  border-left: 6px solid #0055cc;
  background: #f0f5ff;
  padding: 1.25rem 1.5rem;
  border-radius: 0.25rem;
  margin-bottom: 1.5rem;
}

.next-step-callout h3 {
  margin-top: 0;
  color: #0044aa;
}

.next-step-callout.next-step-success {
  border-color: #2e6b2e;
  background: #f0fff0;
}

.next-step-callout.next-step-success h3 {
  color: #2e6b2e;
}

.next-step-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 1rem;
}

.tool-list {
  list-style-type: disc;
  margin-left: 2rem;
}

.tool-list li {
  margin-bottom: 0.25rem;
}

.tool-list code {
  background: #f0f0f0;
  padding: 0.2em 0.4em;
  border-radius: 0.25rem;
  font-size: 0.9em;
  color: #8a1f2d;
}

/* --- Batch Audit Callout (UX improvement #3) --- */
.batch-audit-callout {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.batch-audit-single,
.batch-audit-batch {
  border: 2px solid #1a1a1a;
  padding: 1.25rem;
  border-radius: 0.25rem;
}

.batch-audit-single {
  background: #ffffff;
}

.batch-audit-batch {
  background: #f5f5f5;
  border: 3px solid #0055cc;
  border-left: 6px solid #0055cc;
  position: relative;
}

.batch-audit-batch h3 {
  margin-top: 0;
  color: #0044aa;
}

.batch-audit-batch p {
  margin-bottom: 0.5rem;
}

.batch-audit-batch ul {
  margin: 0.75rem 0 0 1.5rem;
  padding: 0;
}

.batch-audit-batch li {
  margin-bottom: 0.25rem;
}

@media (max-width: 50em) {
  .batch-audit-callout {
    grid-template-columns: 1fr;
  }
}

/* --- Findings Diff Detail Sections (UX improvement #4) --- */
.diff-callout {
  border: 2px solid #2e6b2e;
  border-left: 6px solid #2e6b2e;
  background: #f0fff0;
  padding: 1.25rem;
  border-radius: 0.25rem;
  margin-bottom: 1.5rem;
}

.diff-findings-detail {
  margin-top: 1rem;
  border: 1px solid #d0d0d0;
  padding: 1rem;
  border-radius: 0.25rem;
  background: #fafafa;
}

.diff-findings-detail summary {
  font-weight: 700;
  cursor: pointer;
  padding: 0.5rem;
  margin: -0.5rem;
  padding-left: 1.5rem;
}

.diff-findings-detail summary::-webkit-details-marker {
  margin-right: 0.5rem;
}

/* --- Toast Container (fixed bottom-right overlay, filled by toast.js) --- */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 500;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.75rem;
  max-width: min(22rem, calc(100vw - 3rem));
  pointer-events: none;
}

#toast-container>* {
  pointer-events: auto;
}

@media (max-width: 48rem) {
  #toast-container {
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
    max-width: none;
  }
}

/* --- Page Breadcrumb (group context pill above h1) --- */
.page-breadcrumb {
  display: flex;
  align-items: center;
  margin: 0 0 0.5rem;
}

.page-breadcrumb__label {
  display: inline-block;
  font-family: Arial, sans-serif;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.25em 0.75em;
  border-radius: 2rem;
  background: #f0f0f0;
  color: #555;
}

.page-breadcrumb__label[data-group="assess"] {
  background: #dde8ff;
  color: var(--color-assess);
}

.page-breadcrumb__label[data-group="fix"] {
  background: #d8edd8;
  color: var(--color-fix);
}

.page-breadcrumb__label[data-group="transform"] {
  background: #ede0ff;
  color: var(--color-transform-text);
}

.page-breadcrumb__label[data-group="listen"] {
  background: #d0ecf5;
  color: var(--color-listen);
}

.page-breadcrumb__label[data-group="explore"] {
  background: #f5ecd0;
  color: var(--color-explore-text);
}

html[data-theme="dark"] .page-breadcrumb__label {
  background: #2a2a2a;
  color: #aaa;
}

html[data-theme="dark"] .page-breadcrumb__label[data-group="assess"] {
  background: #0a1a3a;
  color: #80aaff;
}

html[data-theme="dark"] .page-breadcrumb__label[data-group="fix"] {
  background: #0a2010;
  color: #7fbe7f;
}

html[data-theme="dark"] .page-breadcrumb__label[data-group="transform"] {
  background: #1a0a2a;
  color: #c4a0ff;
}

html[data-theme="dark"] .page-breadcrumb__label[data-group="listen"] {
  background: #0a1a22;
  color: #5abfde;
}

html[data-theme="dark"] .page-breadcrumb__label[data-group="explore"] {
  background: #1e1600;
  color: #e0c060;
}

/* --- Upload Hero (centered card for Quick Start upload page) --- */
.upload-hero {
  max-width: 44rem;
  margin: 1rem auto 2rem;
  padding: 2.5rem 2rem;
  background: #ffffff;
  color: #1a1a1a;
  border: 2px solid #c0d0f0;
  border-radius: 0.75rem;
  box-shadow: 0 4px 24px rgba(0, 85, 204, 0.07), 0 1px 4px rgba(0, 0, 0, 0.06);
  text-align: center;
}

.upload-hero>p {
  color: #444;
  margin-bottom: 1.5rem;
}

.upload-hero fieldset {
  border: none;
  padding: 0;
  text-align: left;
  margin: 0 0 0.5rem;
}

.upload-hero legend {
  font-size: 1.125rem;
  font-weight: 700;
  padding: 0;
  margin-bottom: 1rem;
  width: 100%;
  text-align: center;
}

.upload-hero input[type="file"] {
  max-width: 100%;
  width: 100%;
  padding: 2rem 1.5rem;
  border: 2px dashed #4d88e0;
  border-radius: 0.5rem;
  background: #f0f4ff;
  cursor: pointer;
  font-size: 1.0625rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.upload-hero input[type="file"]:hover,
.upload-hero input[type="file"]:focus {
  border-color: #0055cc;
  background: #e4ecff;
}

.upload-hero .btn-primary {
  margin-top: 1.5rem;
  font-size: 1.1875rem;
  padding: 0.875em 2.5em;
  border-radius: 0.375rem;
  min-width: 16rem;
  box-shadow: 0 2px 8px rgba(0, 85, 204, 0.25);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

@media (prefers-reduced-motion: no-preference) {
  .upload-hero .btn-primary:hover {
    box-shadow: 0 4px 16px rgba(0, 85, 204, 0.35);
    transform: translateY(-1px);
  }
}

.upload-hero .field-hint {
  text-align: left;
  margin-top: 0.625rem;
}

html[data-theme="dark"] .upload-hero {
  background: #141920;
  color: #f5f7fb;
  border-color: #2a3d6a;
  box-shadow: 0 4px 24px rgba(0, 85, 204, 0.15);
}

html[data-theme="dark"] .upload-hero>p {
  color: #bbb;
}

html[data-theme="dark"] .upload-hero input[type="file"] {
  border-color: #3a5a9a;
  background: #0a1020;
  color: #e0e0e0;
}

html[data-theme="dark"] .upload-hero input[type="file"]:hover,
html[data-theme="dark"] .upload-hero input[type="file"]:focus {
  border-color: #80aaff;
  background: #0e1830;
}

.diff-section {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: 0.25rem;
}

.diff-section h3 {
  margin-top: 0;
  font-size: 1rem;
}

.diff-new {
  background: #f0f9ff;
  border-left: 4px solid #0055cc;
}

.diff-persistent {
  background: #fffbf0;
  border-left: 4px solid #d97706;
}

.diff-cleared {
  background: #f0fff0;
  border-left: 4px solid #2e6b2e;
}

/* --- Print Stylesheet (GLOW 5.0.0: sidebar layout) --- */
@media print {

  .skip-link,
  .mobile-header,
  .sidebar,
  .sidebar-overlay,
  footer,
  .btn-primary,
  .back-to-top,
  .toggle-all-wrap,
  .help-accordion {
    display: none !important;
  }

  .app-layout {
    display: block;
  }

  .content-area {
    display: block;
  }

  body {
    max-width: none;
    padding: 0;
  }

  main {
    max-width: none;
    padding: 0;
  }

  .card {
    break-inside: avoid;
    border: 1px solid #000;
  }

  .findings-table {
    font-size: 0.875rem;
  }

  .findings-table th,
  .findings-table td {
    padding: 0.25em 0.5em;
  }

  .severity-badge,
  .format-tag,
  .format-pill {
    border: 1px solid currentColor;
    background: transparent !important;
    color: #000 !important;
  }

  details {
    border: none;
  }

  details>summary {
    list-style: none;
    padding: 0;
    font-weight: 700;
  }

  details[open]>summary {
    border-bottom: none;
  }

  /* Force all details open in print */
  details:not([open]) {
    display: block;
  }

  details:not([open])>*:not(summary) {
    display: block;
  }
}

/* --- Responsive (GLOW 5.0.0) --- */

@media (max-width: 40em) {
  .card-grid {
    grid-template-columns: 1fr;
  }

  .score-comparison {
    flex-direction: column;
  }

  .score-arrow {
    transform: rotate(90deg);
  }

  .footer-links {
    flex-direction: column;
    gap: 0;
  }
}

/* --- Help Links (Learn More) --- */
.help-links {
  list-style: none;
  padding: 0;
  margin: 0.25rem 0 0 0;
  font-size: 0.889rem;
}

.help-links li {
  margin-bottom: 0.15rem;
}

.help-links a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

/* --- Guide Page --- */
.guide-toc {
  column-count: 2;
  column-gap: 2rem;
  padding-left: 1.5rem;
}

/* Hidden file input used as DataTransfer target (batch mode) */
.sr-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- Batch Upload: File Queue --- */
.file-queue-list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
}

.file-queue-item {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-bottom: 0.4rem;
  background: #f9f9f9;
  flex-wrap: wrap;
}

.file-queue-name {
  flex: 1 1 auto;
  font-weight: 700;
  word-break: break-all;
}

.file-queue-size {
  flex: 0 0 auto;
  font-size: 0.889rem;
  color: #555;
}

.btn-remove-file {
  flex: 0 0 auto;
  padding: 0.2em 0.6em;
  font-size: 0.889rem;
  background: transparent;
  border: 1px solid #c00;
  color: #c00;
  border-radius: 3px;
  cursor: pointer;
  line-height: 1.4;
}

.btn-remove-file:hover,
.btn-remove-file:focus {
  background: #c00;
  color: #fff;
  outline: 2px solid #900;
  outline-offset: 1px;
}

/* --- Notice box (non-error informational) --- */
.notice-box {
  border: 2px solid #005ea2;
  border-radius: 4px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  background: #e8f1fa;
}

/* --- Success box (email sent confirmation) --- */
.success-box {
  border: 2px solid #1a6b2a;
  border-radius: 4px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  background: #eaf5ec;
}

/* --- Warning box (ACB guideline deviation notice) --- */
.warning-box {
  border: 2px solid #d97706;
  border-radius: 4px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  background: #fef3c7;
}

.warning-box p {
  margin: 0;
  line-height: 1.5;
}

.warning-box .warning-message {
  white-space: pre-line;
}

/* --- Batch Scorecard Summary --- */
.batch-scorecard {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  margin: 1rem 0 1.5rem;
}

.batch-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 7rem;
  padding: 0.75rem 1rem;
  border: 2px solid #1a1a1a;
  border-radius: 4px;
  text-align: center;
}

.batch-stat-value {
  font-size: 1.778rem;
  font-weight: 700;
  line-height: 1.2;
}

.batch-stat-label {
  font-size: 0.889rem;
  margin-top: 0.25rem;
}

/* --- Batch Per-file Details --- */
.batch-file-details {
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-bottom: 1rem;
  padding: 0;
}

.batch-file-details>summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.75rem 1rem;
  cursor: pointer;
  background: #f5f5f5;
  border-radius: 4px;
  list-style: none;
}

.batch-file-details>summary::-webkit-details-marker {
  display: none;
}

.batch-file-details[open]>summary {
  border-bottom: 1px solid #ccc;
  border-radius: 4px 4px 0 0;
}

.batch-file-details>summary::before {
  content: "\25B6";
  /* right-pointing triangle */
  font-size: 0.75rem;
  flex-shrink: 0;
}

.batch-file-details[open]>summary::before {
  content: "\25BC";
  /* down-pointing triangle */
}

.batch-file-details>table,
.batch-file-details>p {
  padding: 0.75rem 1rem;
}

.batch-file-name {
  font-weight: 700;
  flex: 1 1 auto;
  word-break: break-all;
}

.batch-file-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.severity-summary-inline {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

/* --- Individual file report section separator --- */
.individual-file-report {
  border-top: 2px solid #1a1a1a;
  padding-top: 1.5rem;
  margin-top: 2rem;
}

.individual-file-report:first-of-type {
  border-top: none;
  margin-top: 0;
}

/* --- Status pass/fail inline labels --- */
.status-pass {
  color: #1a6600;
  font-weight: 700;
}

.status-fail {
  color: #8b0000;
  font-weight: 700;
}

.celebration-inline {
  font-weight: 700;
  color: #1a6600;
  padding: 0.5rem 1rem;
}

/* --- Batch overview table score column --- */
.batch-overview-table .score-number {
  font-size: 1rem;
  font-weight: 700;
}

/* --- Secondary button --- */
.btn-secondary {
  display: inline-block;
  padding: 0.5em 1.25em;
  background: transparent;
  border: 2px solid #1a1a1a;
  color: #1a1a1a;
  border-radius: 3px;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}

.btn-secondary:hover,
.btn-secondary:focus {
  background: #1a1a1a;
  color: #fff;
  outline: 2px solid #555;
  outline-offset: 2px;
}

.btn-secondary:disabled,
.btn-secondary[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 40em) {
  .guide-toc {
    column-count: 1;
  }
}

.guide-steps {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.guide-step {
  display: flex;
  gap: 1rem;
  border: 2px solid #0055cc;
  border-radius: 0.25rem;
  padding: 1.25rem;
  background: #f0f5ff;
}

.step-number {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  line-height: 2.5rem;
  text-align: center;
  font-size: 1.333rem;
  font-weight: 700;
  color: #ffffff;
  background: #0055cc;
  border-radius: 50%;
}

.step-content h3 {
  margin-top: 0;
}

.guide-tip {
  background: #fff8e0;
  border-left: 4px solid #b8860b;
  padding: 0.5em 1em;
  font-size: 1rem;
}

/* --- Contextual Workflow Banner --- */
.workflow-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  border: 2px solid #0055cc;
  border-left-width: 5px;
  background: #f0f5ff;
  padding: 1rem 1.25rem;
  border-radius: 0.25rem;
  margin-bottom: 1.5rem;
}

.workflow-banner p {
  margin: 0;
}

.workflow-banner .banner-icon {
  display: none;
}

pre,
code,
kbd,
table,
thead,
tbody,
tr,
th,
td {
  background-color: #ffffff;
  color: #1a1a1a;
}

pre,
code,
kbd {
  border: 1px solid #666666;
  box-sizing: border-box;
}

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow-x: auto;
  max-width: 100%;
}

pre code {
  display: inline;
  border: 0;
  background-color: #ffffff;
  color: #1a1a1a;
  overflow-wrap: anywhere;
}

/* Keep markdown fenced-code text in guide/changelog at AA contrast.
   Some syntax-classed code blocks can inherit low-contrast token colors. */
pre > code[class^="language-"],
pre > code[class*=" language-"] {
  background-color: #ffffff;
  color: #1a1a1a;
}

textarea {
  background-color: #ffffff;
  color: #1a1a1a;
  overflow: hidden;
  resize: none;
}

table {
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  max-width: 100%;
}

th,
td {
  box-sizing: border-box;
  overflow-wrap: anywhere;
  word-break: normal;
  vertical-align: top;
}

.workflow-banner a {
  font-weight: 700;
}

/* --- Quick-Start Cards (index) --- */
.quickstart-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.quickstart-step {
  border: 2px solid #0055cc;
  border-top-width: 5px;
  border-radius: 0.25rem;
  padding: 1rem;
  text-align: center;
}

.quickstart-step .qs-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0055cc;
}

.quickstart-step h3 {
  margin: 0.25rem 0 0.5rem;
  font-size: 1.125rem;
}

.quickstart-step p {
  font-size: 1rem;
  margin-bottom: 0;
}

/* --- Changelog --- */
.changelog-content h2 {
  border-bottom: 2px solid #1a1a1a;
  padding-bottom: 0.5rem;
  margin-top: 2.5rem;
}

.changelog-content h3 {
  margin-top: 1.5rem;
  color: #1a1a1a;
}

.changelog-content h4 {
  margin-top: 1.25rem;
}

.changelog-content ul,
.changelog-content ol {
  margin-top: 0.5rem;
  margin-bottom: 1rem;
}

.changelog-content li {
  margin-bottom: 0.25rem;
}

.changelog-content hr {
  border: none;
  border-top: 1px solid #cccccc;
  margin: 2rem 0;
}

.changelog-content code {
  background: #f5f5f5;
  padding: 0.1em 0.3em;
  border-radius: 3px;
  font-size: 0.9em;
}

/* --- Heading Review --- */
.signal-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.85em;
}

.signal-list li {
  margin-bottom: 0.15em;
}

.button-group {
  margin-top: 1.5rem;
}

/* --- Brand logo in nav --- */
.brand-logo {
  display: inline-block;
  vertical-align: middle;
  max-height: 44px;
  width: auto;
  margin-right: 0.5rem;
}

.brand-nav-text {
  vertical-align: middle;
}

/* ==========================================================================
   University of Arizona brand theme (GLOW_BRAND_PROFILE=uarizona)
   Overrides default BITS blue palette with UA Arizona Red + Navy.
   ========================================================================== */

body.theme-uarizona {
  /* UA brand palette */
  --ua-red: #AB0520;
  --ua-red-dark: #8B0416;
  --ua-navy: #0C234B;
  --ua-navy-dark: #071830;
  --ua-red-light: #f9e5e8;
}

/* Sidebar accent (UA Arizona theme) */
body.theme-uarizona .sidebar {
  border-right-color: var(--ua-navy);
}

body.theme-uarizona .sidebar-brand {
  color: var(--ua-navy);
}

body.theme-uarizona .sidebar-brand:hover,
body.theme-uarizona .sidebar-brand:focus {
  color: var(--ua-red);
}

/* Active sidebar link */
body.theme-uarizona .sidebar-link--active,
body.theme-uarizona .sidebar-link[aria-current="page"] {
  color: var(--ua-red);
  border-left-color: var(--ua-red);
  background: var(--ua-red-light);
}

body.theme-uarizona .sidebar-link:hover {
  color: var(--ua-red-dark);
  background: #fdeef0;
}

/* Primary button */
body.theme-uarizona .btn-primary {
  background: var(--ua-red);
  border-color: var(--ua-red);
}

body.theme-uarizona .btn-primary:hover,
body.theme-uarizona .btn-primary:focus {
  background: var(--ua-red-dark);
  border-color: var(--ua-red-dark);
  outline-color: var(--ua-red-dark);
}

body.theme-uarizona .btn-primary:disabled,
body.theme-uarizona .btn-primary[aria-disabled="true"] {
  background: #d4727f;
  border-color: #d4727f;
}

/* Links */
body.theme-uarizona a {
  color: var(--ua-navy);
}

body.theme-uarizona a:hover,
body.theme-uarizona a:focus {
  color: var(--ua-red);
}

body.theme-uarizona a:visited {
  color: var(--ua-navy-dark);
}

/* Focus rings */
body.theme-uarizona input[type="text"]:focus,
body.theme-uarizona input[type="file"]:focus,
body.theme-uarizona select:focus,
body.theme-uarizona textarea:focus {
  outline-color: var(--ua-red);
}

body.theme-uarizona details>summary:focus {
  outline-color: var(--ua-red);
}

/* Checkboxes and radios */
body.theme-uarizona input[type="radio"],
body.theme-uarizona input[type="checkbox"] {
  accent-color: var(--ua-red);
}

/* Skip link */
body.theme-uarizona .skip-link {
  background: var(--ua-navy);
}

/* Footer links */
body.theme-uarizona .footer-links a {
  color: var(--ua-navy);
}

/* Info box accent */
body.theme-uarizona .info-box {
  border-left-color: var(--ua-red);
}

/* Card borders */
body.theme-uarizona .card {
  border-color: var(--ua-navy);
}

/* Nav brand logo: UA wordmark is wide, cap at a comfortable nav height */
body.theme-uarizona .brand-logo {
  max-height: 36px;
}

/* Community Access logo sizing (legacy theme-bits kept for compatibility) */
body.theme-communityaccess .brand-logo,
body.theme-bits .brand-logo {
  max-height: 44px;
  border-radius: 0.25rem;
}

/* ============================================================
   QUICK WINS FILTER
   ============================================================ */

.quick-wins-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: #f0f5ff;
  border: 1px solid #b8d0f5;
  border-radius: 0.25rem;
}

/* ============================================================
   SHARE SECTION (AUDIT REPORT)
   ============================================================ */

.share-section {
  margin-top: 1.25rem;
  border: 1px solid #ccc;
  border-radius: 0.25rem;
  padding: 0.75rem 1rem;
  background: #fafafa;
}

.share-section>summary {
  cursor: pointer;
  font-weight: 700;
}

.share-url-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.share-url-input {
  flex: 1;
  min-width: 14rem;
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 0.25rem;
  font-family: monospace;
  background: #f8f8f8;
  color: inherit;
}

/* ============================================================
   CONVERT PREVIEW (IFRAME)
   ============================================================ */

.convert-preview-wrap {
  margin-top: 0.75rem;
  border: 1px solid #ccc;
  border-radius: 0.25rem;
  overflow: hidden;
}

.convert-preview-frame {
  display: block;
  width: 100%;
  height: 60vh;
  min-height: 24rem;
  border: 0;
  background: #fff;
}

/* ============================================================
   CMS TEXTAREA (CONVERT RESULT)
   ============================================================ */

.cms-copy-bar {
  margin-bottom: 0.5rem;
}

.cms-textarea {
  display: block;
  width: 100%;
  min-height: 12rem;
  font-family: monospace;
  font-size: 0.8rem;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 0.25rem;
  background: #f8f8f8;
  color: inherit;
  resize: vertical;
  box-sizing: border-box;
}

/* ============================================================
   SCORE-BOX AFTER (FIX RESULT)
   ============================================================ */

.score-box--after {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

/* The grade letter inside the After box uses a tighter size than
   the audit headline but is still visually dominant */
.score-box--after .score-grade-letter {
  font-size: 3rem;
  line-height: 1;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */

#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 0.75rem 1.25rem;
  border-radius: 0.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  max-width: 24rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(0.5rem);
  transition: opacity 0.25s ease, transform 0.25s ease;
  background: #1a1a1a;
  color: #fff;
}

.toast--visible {
  opacity: 1;
  transform: translateY(0);
}

.toast--success {
  background: #1b5e20;
  color: #fff;
}

.toast--error {
  background: #b71c1c;
  color: #fff;
}

.toast--info {
  background: #0d3b6e;
  color: #fff;
}

/* ============================================================
   DARK MODE
   ------------------------------------------------------------
   Activated when html[data-theme="dark"] is set. The boot
   script in base.html resolves the user's preference (light /
   dark / auto) and writes the attribute before first paint.
   "auto" defers to prefers-color-scheme, also via JS, so this
   stylesheet only needs a single attribute selector.
   ============================================================ */

html[data-theme="dark"] {
  color-scheme: dark;
}

html[data-theme="light"] {
  color-scheme: light;
}

html[data-theme="dark"] body {
  background: #121212;
  color: #e0e0e0;
}

html[data-theme="dark"] a {
  color: #7ab3ff;
}

html[data-theme="dark"] a:visited {
  color: #c3a0ff;
}

/* Sidebar dark mode */
html[data-theme="dark"] .sidebar-link {
  color: #c0c0c0;
}

html[data-theme="dark"] .sidebar-link:hover {
  color: #ffffff;
  background: #2a2a2a;
}

html[data-theme="dark"] .sidebar-link--active,
html[data-theme="dark"] .sidebar-link[aria-current="page"] {
  color: #7ab3ff;
  border-left-color: #7ab3ff;
  background: #1a2a3a;
}

/* Cards and boxes */
html[data-theme="dark"] .card,
html[data-theme="dark"] .help-box,
html[data-theme="dark"] .score-box,
html[data-theme="dark"] .option-card,
html[data-theme="dark"] .upload-option-card {
  background: #1e1e1e;
  border-color: #333;
  color: #e0e0e0;
}

html[data-theme="dark"] .notice-box {
  background: #1e2a00;
  border-color: #3a5a00;
  color: #d8e8c0;
}

html[data-theme="dark"] .warning-box {
  background: #2a1800;
  border-color: #6b4000;
  color: #f5d8a0;
}

html[data-theme="dark"] .error-box,
html[data-theme="dark"] .flash-error {
  background: #2d0a0a;
  border-color: #6b1010;
  color: #f5b0b0;
}

html[data-theme="dark"] .success-box,
html[data-theme="dark"] .flash-success {
  background: #0a2010;
  border-color: #1b5e20;
  color: #b0f5b0;
}

html[data-theme="dark"] .celebration {
  background: #0a1a2d;
  border-color: #1a4570;
  color: #b0d8ff;
}

/* Forms */
html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="search"],
html[data-theme="dark"] input[type="file"],
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: #2a2a2a;
  border-color: #555;
  color: #e0e0e0;
}

html[data-theme="dark"] input[type="text"]:focus,
html[data-theme="dark"] input[type="email"]:focus,
html[data-theme="dark"] input[type="file"]:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus {
  outline-color: #7ab3ff;
  border-color: #7ab3ff;
}

/* Dark-mode focus ring: swap the white halo for a dark halo so the
   indicator stays visible against dark backgrounds. */
html[data-theme="dark"] :focus-visible,
html[data-theme="dark"] input:focus-visible,
html[data-theme="dark"] select:focus-visible,
html[data-theme="dark"] textarea:focus-visible,
html[data-theme="dark"] button:focus-visible,
html[data-theme="dark"] a:focus-visible,
html[data-theme="dark"] summary:focus-visible,
html[data-theme="dark"] [tabindex]:focus-visible,
html[data-theme="dark"] input[type="checkbox"]:focus-visible,
html[data-theme="dark"] input[type="radio"]:focus-visible {
  outline-color: #7ab3ff;
  box-shadow: 0 0 0 5px #121212, 0 0 0 8px #7ab3ff;
}

html[data-theme="dark"] label:has(input[type="checkbox"]:focus-visible),
html[data-theme="dark"] label:has(input[type="radio"]:focus-visible) {
  outline-color: #7ab3ff;
}

/* Buttons */
html[data-theme="dark"] .btn-primary {
  background: #1a5fb4;
  color: #fff;
  border-color: #1a5fb4;
}

html[data-theme="dark"] .btn-primary:hover,
html[data-theme="dark"] .btn-primary:focus {
  background: #2470cc;
}

html[data-theme="dark"] .btn-secondary {
  background: #2a2a2a;
  color: #7ab3ff;
  border-color: #7ab3ff;
}

html[data-theme="dark"] .btn-secondary:hover,
html[data-theme="dark"] .btn-secondary:focus {
  background: #1e2d42;
}

/* Findings table */
html[data-theme="dark"] .findings-table th {
  background: #1e1e1e;
  color: #e0e0e0;
  border-color: #444;
}

html[data-theme="dark"] .findings-table td {
  border-color: #333;
}

html[data-theme="dark"] .findings-table tr:nth-child(even) {
  background: #1a1a1a;
}

html[data-theme="dark"] .findings-table tr:nth-child(odd) {
  background: #121212;
}

html[data-theme="dark"] .findings-table tr:hover {
  background: #1e2d42;
}

/* Severity badges -- keep colors but bump contrast */
html[data-theme="dark"] .severity-badge.severity-critical {
  background: #b71c1c;
  color: #fff;
}

html[data-theme="dark"] .severity-badge.severity-high {
  background: #bf5600;
  color: #fff;
}

html[data-theme="dark"] .severity-badge.severity-medium {
  background: #7a6a00;
  color: #fff;
}

html[data-theme="dark"] .severity-badge.severity-low {
  background: #1b5e20;
  color: #fff;
}

/* Score grades */
html[data-theme="dark"] .grade-a {
  color: #66bb6a;
}

html[data-theme="dark"] .grade-b {
  color: #8bc34a;
}

html[data-theme="dark"] .grade-c {
  color: #ffca28;
}

html[data-theme="dark"] .grade-d {
  color: #ff7043;
}

html[data-theme="dark"] .grade-f {
  color: #ef5350;
}

/* Score headline */
html[data-theme="dark"] .score-headline {
  background: #1e1e1e;
  border-color: #333;
}

/* Footer */
html[data-theme="dark"] footer {
  background: #1a1a1a;
  border-top-color: #333;
  color: #d0d0d0;
}

html[data-theme="dark"] footer p {
  color: #d0d0d0;
}

html[data-theme="dark"] .footer-links a,
html[data-theme="dark"] footer a {
  color: #9cc9ff;
}

html[data-theme="dark"] .footer-links a[aria-current="page"] {
  color: #ffffff;
}

/* Code */
html[data-theme="dark"] code {
  background: #2a2a2a;
  color: #ff8a80;
}

html[data-theme="dark"] .tool-list code {
  background: #2a2a2a;
  color: #ff8a80;
}

/* Drop zone */
html[data-theme="dark"] .drop-zone {
  background: #1e1e1e;
  border-color: #555;
  color: #c0c0c0;
}

html[data-theme="dark"] .drop-zone--active {
  background: #1e2d42;
  border-color: #7ab3ff;
}

html[data-theme="dark"] .drop-zone-hint {
  color: #c0c0c0;
}

html[data-theme="dark"] .drop-zone--active .drop-zone-hint {
  color: #9dcbff;
}

/* Quick wins bar */
html[data-theme="dark"] .quick-wins-bar {
  background: #0d1a2d;
  border-color: #1a4570;
}

/* Share section */
html[data-theme="dark"] .share-section {
  background: #1a1a1a;
  border-color: #333;
}

html[data-theme="dark"] .share-url-input {
  background: #2a2a2a;
  border-color: #555;
  color: #e0e0e0;
}

/* CMS textarea */
html[data-theme="dark"] .cms-textarea {
  background: #2a2a2a;
  border-color: #555;
  color: #e0e0e0;
}

html[data-theme="dark"] .transcribe-progress,
html[data-theme="dark"] .provider-card,
html[data-theme="dark"] .feature-model-card,
html[data-theme="dark"] .ai-session-panel,
html[data-theme="dark"] .action-card,
html[data-theme="dark"] .chat-turn,
html[data-theme="dark"] .ai-meter,
html[data-theme="dark"] .batch-audit-single,
html[data-theme="dark"] .batch-audit-batch,
html[data-theme="dark"] .diff-findings-detail,
html[data-theme="dark"] details.help-accordion,
html[data-theme="dark"] details.guideline-accordion,
html[data-theme="dark"] details.rule-group {
  background: #1e1e1e;
  border-color: #444;
  color: #e0e0e0;
}

html[data-theme="dark"] .chat-turn summary {
  background: #2a2a2a;
  color: #e0e0e0;
}

html[data-theme="dark"] .chat-turn summary:hover,
html[data-theme="dark"] .chat-turn summary:focus {
  background: #1e2d42;
}

html[data-theme="dark"] .chat-turn-content h3,
html[data-theme="dark"] .action-card h3,
html[data-theme="dark"] .batch-audit-batch h3 {
  color: #e0e0e0;
}

html[data-theme="dark"] .help-text,
html[data-theme="dark"] .rule-ref,
html[data-theme="dark"] .settings-ai-select-unavailable,
html[data-theme="dark"] .ai-meter__detail,
html[data-theme="dark"] .ai-meter__session {
  color: #c0c0c0;
}

html[data-theme="dark"] .badge {
  color: #f0f0f0;
  background: #2a2a2a;
  border-color: #8a8a8a;
}

html[data-theme="dark"] .badge-success {
  color: #d8f3dc;
  background: #163524;
  border-color: #52b788;
}

html[data-theme="dark"] .badge-warning {
  color: #ffe08a;
  background: #3b2f12;
  border-color: #d4a72c;
}

/* Details/summary */
html[data-theme="dark"] details {
  border-color: #333;
}

html[data-theme="dark"] details>summary {
  color: #7ab3ff;
}

/* Skip link */
html[data-theme="dark"] .skip-link:focus {
  background: #1e1e1e;
  color: #7ab3ff;
  outline-color: #7ab3ff;
}

/* Theme toggle button (footer) */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.theme-toggle label {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.theme-toggle select {
  font-family: Arial, sans-serif;
  font-size: 1rem;
  padding: 0.35em 0.6em;
  border: 2px solid currentColor;
  border-radius: 0.25rem;
  background: transparent;
  color: inherit;
  min-height: 44px;
}

html[data-theme="dark"] .theme-toggle select {
  background: #1e1e1e;
  color: #e0e0e0;
  border-color: #7ab3ff;
}

/* ============================================================
   IMPROVED PRINT STYLESHEET (extends the existing @media print block)
   ============================================================ */

@media print {

  /* Additional elements to hide in print */
  .quick-wins-bar,
  .share-section,
  .no-print,
  #toast-container,
  .cms-copy-bar,
  .convert-preview-wrap {
    display: none !important;
  }

  /* Ensure findings table page breaks cleanly */
  .findings-table {
    page-break-inside: auto;
  }

  .findings-table tr {
    page-break-inside: avoid;
  }

  /* Score headline: simplify for print */
  .score-headline {
    border: none;
    padding: 0;
    gap: 0.5rem;
  }

  .score-grade-letter {
    font-size: 3rem;
  }

  /* Score comparison box */
  .score-comparison {
    border: 1px solid #000;
    padding: 0.5rem;
  }
}


/* --- Reduced motion: respect user preference (WCAG 2.3.3) --- */
@media (prefers-reduced-motion: reduce) {

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

/* --- Audit report: diff callout (re-audit comparison) --- */
.diff-callout {
  border: 2px solid #1a1a1a;
  border-radius: 0.375rem;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  background: #f5f9ff;
}

.diff-callout .diff-headline {
  font-size: 1.125rem;
  margin: 0 0 0.5rem 0;
}

.diff-callout .diff-improved {
  color: #155f2c;
}

.diff-callout .diff-regressed {
  color: #8a1c1c;
}

.diff-callout .diff-stats {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.diff-callout .diff-stats li {
  margin: 0;
}

/* --- Audit findings: inline rule explanations --- */
.finding-explain {
  margin-top: 0.5rem;
}

.finding-explain>summary {
  cursor: pointer;
  font-weight: 600;
  color: #0055cc;
}

.finding-explain-body {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-left: 4px solid #0055cc;
  background: #f6f9fc;
}

.finding-explain-body p {
  margin: 0.25rem 0;
}

.finding-explain-body .finding-fixable {
  color: #155f2c;
}

.finding-explain-body .finding-manual {
  color: #5a3500;
}

/* --- Share section: PDF / CSV download row --- */
.share-downloads {
  margin: 0.75rem 0 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* --- GLOW Anthem (Audio Player) --- */
.audio-player-container {
  border: 4px solid #0055cc;
  padding: 1.5rem;
  border-radius: 0.5rem;
  background-color: #f0f7ff;
  margin: 2rem 0;
}

.audio-player-container audio {
  width: 100%;
  margin: 1rem 0;
}

.lyrics {
  margin-top: 1rem;
  padding: 1rem;
  border-top: 2px solid #0055cc;
  background: #ffffff;
}

.lyrics h3 {
  margin-top: 0;
}

.lyrics h4 {
  margin-top: 1.5rem;
  color: #0044aa;
  border-bottom: 2px solid #e0e0e0;
}

[data-theme="dark"] .audio-player-container {
  background-color: #001a33;
  border-color: #3385ff;
}

[data-theme="dark"] .lyrics {
  background: #1a1a1a;
  border-top-color: #3385ff;
}

[data-theme="dark"] .lyrics h4 {
  color: #80b3ff;
  border-bottom-color: #333;
}

/* --- Sidebar AI Meter --------------------------------------------------- */
.ai-meter {
  border: 2px solid #1a1a1a;
  border-radius: 0.375rem;
  padding: 0.875rem 1rem;
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: #f8fbff;
}

.ai-meter__label {
  font-weight: 700;
}

.ai-meter__detail,
.ai-meter__session {
  font-size: 0.95rem;
}

.ai-meter__session {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ai-meter__session-btn,
.ai-meter__link {
  align-self: flex-start;
}