/* =========================================================================================
   Amebo design system
   -----------------------------------------------------------------------------------------
   Every color lives here as a CSS custom property. This palette is a clean, professional
   placeholder - swap the --brand-* / --status-* / --severity-* values below for Klok-IT's
   real hex codes and the whole app re-themes itself; nothing else needs to change.
   ========================================================================================= */

:root {
  /* ---- Brand -------------------------------------------------------------------------- */
  --brand-primary: #4f46e5;
  --brand-primary-dark: #4338ca;
  --brand-primary-darker: #3730a3;
  --brand-primary-light: #eef2ff;
  --brand-accent: #14b8a6;
  --brand-accent-dark: #0f9488;

  /* ---- Neutrals ------------------------------------------------------------------------ */
  --ink: #111827;
  --ink-muted: #6b7280;
  --ink-faint: #5b6270; /* was #9ca3af (2.5:1) - darkened to meet WCAG 1.4.3 text contrast */
  --surface: #ffffff;
  --surface-sunken: #f8fafc;
  --surface-hover: #f3f4f6;
  --border: #e5e7eb;
  --border-strong: #d1d5db;

  /* ---- Status (ReportStatus) ------------------------------------------------------------ */
  --status-draft: #9ca3af;
  --status-submitted: #3b82f6;
  --status-assigned: #f59e0b;
  --status-pendingreview: #8b5cf6;
  --status-closed: #10b981;

  /* ---- Severity -------------------------------------------------------------------------- */
  --severity-low: #10b981;
  --severity-moderate: #f59e0b;
  --severity-serious: #f97316;
  --severity-critical: #ef4444;

  /* ---- Feedback -------------------------------------------------------------------------- */
  --success: #10b981;
  --success-bg: #ecfdf5;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.06);
  --shadow-md: 0 4px 12px rgba(17, 24, 39, 0.08);
  --shadow-lg: 0 12px 32px rgba(17, 24, 39, 0.12);

  color-scheme: light;
}

html {
  font-size: 15px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

html, body {
  height: 100%;
}

body {
  background: var(--surface-sunken);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  margin-bottom: 0;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand-primary);
  text-decoration: none;
}
a:hover { color: var(--brand-primary-dark); text-decoration: underline; }

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

h1 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }

.text-muted { color: var(--ink-muted) !important; }

/* ---- Focus ring (shared by inputs, buttons, links) -------------------------------------- */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus,
.form-control:focus, .form-select:focus, .form-check-input:focus {
  box-shadow: 0 0 0 3px var(--brand-primary-light), 0 0 0 1px var(--brand-primary);
  border-color: var(--brand-primary);
}

/* ---- Layout shell: sticky topbar + fixed sidebar + scrolling main -------------------------
   .app-shell (column)
     .app-topbar                          <- icon/brand + login/register or user chip, always
     .app-body (row, fills remaining height)
       .app-sidebar                       <- role-aware nav, persistent on lg+
       .app-sidebar-offcanvas             <- same nav, Bootstrap offcanvas, below lg
       .app-main-wrap (column)
         .app-main
         .app-footer
   ------------------------------------------------------------------------------------------ */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- A quiet splash of brand colour across every page: a slim gradient strip at the
   very top of the shell, and a faint brand-tinted wash behind the main content instead
   of a flat neutral background. ---------------------------------------------------- */
.app-shell::before {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent));
  flex-shrink: 0;
}
body {
  background: radial-gradient(1200px 480px at 15% -10%, var(--brand-primary-light) 0%, transparent 60%),
              var(--surface-sunken);
}

/* ---- Top bar: brand mark + Register/Login (or the signed-in user chip) only ---------------- */
.app-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 1030;
}
.app-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 1.25rem;
}
.navbar-brand {
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}
.navbar-brand:hover { color: var(--ink); }
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  flex-shrink: 0;
}
.topbar-account {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.topbar-account-name {
  color: var(--ink-muted);
  font-weight: 600;
  font-size: 0.9rem;
}
.sidebar-toggle {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: var(--radius-sm);
  width: 40px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ---- Body: sidebar + main -------------------------------------------------------------- */
.app-body {
  flex: 1;
  display: flex;
  min-height: 0;
  align-items: stretch;
}
.app-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--brand-primary-light) 0%, var(--surface) 320px);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  position: relative;
}
.app-sidebar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--brand-primary), var(--brand-accent));
}
.app-sidebar-offcanvas {
  width: 260px;
  background: linear-gradient(180deg, var(--brand-primary-light) 0%, var(--surface) 320px);
}
.app-sidebar-offcanvas .offcanvas-header {
  border-bottom: 1px solid var(--border);
}
.app-sidebar-offcanvas .offcanvas-title {
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink);
}
.app-sidebar-offcanvas .offcanvas-body {
  padding: 1rem;
}
.app-main-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.app-main {
  flex: 1 0 auto;
  padding: 1.5rem 1.5rem 4rem;
}

/* ---- Sidebar nav links ------------------------------------------------------------------ */
.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--ink-muted);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar-link:hover { color: var(--ink); background: var(--surface-hover); text-decoration: none; }
.sidebar-link.active {
  color: var(--brand-primary);
  background: var(--surface);
  box-shadow: inset 3px 0 0 var(--brand-primary), var(--shadow-sm);
  font-weight: 700;
}
.sidebar-link.active .sidebar-icon { opacity: 1; }
.sidebar-icon {
  display: inline-flex;
  width: 1.25rem;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.85;
}
.sidebar-section-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand-primary-dark);
  font-weight: 700;
  margin: 1.1rem 0 0.4rem;
  padding: 0 0.75rem;
}
.sidebar-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand-primary-dark);
  font-weight: 700;
  margin: 1.1rem 0 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-sm);
}
.sidebar-section-toggle:hover { background: var(--surface-hover); }
.sidebar-section-caret {
  transition: transform 0.15s ease;
  font-size: 0.65rem;
}
.sidebar-section-toggle[aria-expanded="false"] .sidebar-section-caret { transform: rotate(-90deg); }
.sidebar-nav-collapsible.collapsed { display: none; }

.app-footer {
  border-top: 1px solid var(--border);
  color: var(--ink-faint);
  font-size: 0.875rem;
  padding: 1.25rem 1.5rem;
  background: var(--surface);
}

@media (max-width: 991.98px) {
  .app-main { padding: 1.25rem 1rem 2rem; }
  .app-topbar-inner { padding: 0.6rem 1rem; }
}
@media (max-width: 575.98px) {
  .app-main { padding: 1rem 0.75rem 2rem; }
}

/* ---- Buttons -------------------------------------------------------------------------- */
.btn { border-radius: var(--radius-sm); font-weight: 600; padding: 0.55rem 1.1rem; }
.btn-sm { padding: 0.35rem 0.75rem; border-radius: 7px; }
.btn-primary {
  background: var(--brand-primary); border-color: var(--brand-primary);
}
.btn-primary:hover, .btn-primary:active {
  background: var(--brand-primary-dark) !important; border-color: var(--brand-primary-dark) !important;
}
.btn-outline-primary { color: var(--brand-primary); border-color: var(--brand-primary); }
.btn-outline-primary:hover { background: var(--brand-primary); border-color: var(--brand-primary); }
.btn-outline-secondary { color: var(--ink-muted); border-color: var(--border-strong); }
.btn-success { background: var(--success); border-color: var(--success); }
.btn-danger { background: var(--danger); border-color: var(--danger); }

/* ---- Cards ------------------------------------------------------------------------------ */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.card.repeater-card { border-left: 4px solid var(--brand-primary); }
.surface-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
}

/* ---- Landing page -----------------------------------------------------------------
   One continuous surface-card, no internal break between the hero and the write-up -
   the icon/name row is sized close to the topbar's own brand (just a touch bigger),
   the tagline is bold but sits quietly above the body copy, and the action buttons are
   modest in size, placed after the write-up rather than competing with it up top.
   ------------------------------------------------------------------------------------ */
.landing-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.landing-brand-mark {
  width: 42px;
  height: 42px;
  font-size: 1.15rem;
  margin: 0;
  flex-shrink: 0;
}
.landing-brand-name {
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.landing-tagline {
  text-align: center;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--brand-primary-dark);
  margin: 0 auto 1.75rem;
  max-width: 46rem;
}
.landing-actions {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

/* A small floating note docked to the bottom of the viewport rather than sitting inline
   in the page flow - visible throughout without competing with the write-up above it. */
.floating-note {
  position: fixed;
  left: 50%;
  bottom: 1.1rem;
  transform: translateX(-50%);
  z-index: 1020;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--ink);
  color: #fff;
  font-size: 0.82rem;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  max-width: calc(100% - 2rem);
  text-align: center;
}
.floating-note .brand-mark { width: 20px; height: 20px; font-size: 0.7rem; flex-shrink: 0; }
@media (max-width: 575.98px) {
  .floating-note { font-size: 0.76rem; padding: 0.55rem 0.9rem; }
}

/* ---- Badges / pills ----------------------------------------------------------------------- */
.badge { font-weight: 600; border-radius: 999px; padding: 0.4em 0.75em; }

.badge-status { color: #fff; }
.badge-status[data-status="Draft"] { background: var(--status-draft); }
.badge-status[data-status="Submitted"] { background: var(--status-submitted); }
.badge-status[data-status="Assigned"] { background: var(--status-assigned); }
.badge-status[data-status="Pending review"] { background: var(--status-pendingreview); }
.badge-status[data-status="Closed"] { background: var(--status-closed); }

.badge-severity { color: #fff; }
.badge-severity[data-severity="Low"] { background: var(--severity-low); }
.badge-severity[data-severity="Moderate"] { background: var(--severity-moderate); }
.badge-severity[data-severity="Serious"] { background: var(--severity-serious); }
.badge-severity[data-severity="Critical"] { background: var(--severity-critical); }

/* ---- Forms -------------------------------------------------------------------------------- */
.form-control, .form-select {
  border-radius: var(--radius-sm);
  border-color: var(--border-strong);
  padding: 0.55rem 0.85rem;
}
.form-label { font-weight: 600; font-size: 0.9rem; color: var(--ink); margin-bottom: 0.35rem; }
.form-text { color: var(--ink-muted); } /* was --ink-faint: failed 4.5:1 contrast */

/* ---- Show/hide toggle, auto-added to every password field by password-toggle.js -------- */
.password-toggle-wrap { position: relative; }
.password-toggle-wrap .password-toggle-input { padding-right: 3.75rem; }
.password-toggle-btn {
  position: absolute;
  right: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--brand-primary);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.password-toggle-btn:hover { background: var(--brand-primary-light); }
.password-toggle-btn:focus { box-shadow: 0 0 0 3px var(--brand-primary-light), 0 0 0 1px var(--brand-primary); outline: none; }
fieldset legend { font-weight: 700; color: var(--ink); }

.alert { border-radius: var(--radius-md); border: none; }
.alert-success { background: var(--success-bg); color: #065f46; }
.alert-danger, .text-danger { color: var(--danger); }
.alert-warning { background: var(--warning-bg); color: #92400e; }

/* ---- Tables ------------------------------------------------------------------------------- */
.table { --bs-table-hover-bg: var(--surface-hover); }
.table thead th {
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  border-bottom-width: 1px;
  background: var(--surface-sunken);
}
.table td, .table th { vertical-align: middle; }

/* =========================================================================================
   Wizard: stepper + section flow
   ========================================================================================= */
.wizard-stepper {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1.75rem;
}
.wizard-stepper li { display: flex; }
.wizard-stepper .wizard-step-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-muted); /* was --ink-faint: below 4.5:1 contrast */
  padding: 0.4rem 0.75rem 0.4rem 0.4rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all 0.15s ease;
  cursor: pointer;
}
.wizard-stepper .wizard-step-btn:focus-visible { outline: 3px solid var(--brand-primary); outline-offset: 2px; }
.wizard-stepper .wizard-step-btn[aria-disabled="true"] { cursor: default; text-decoration: line-through; opacity: 0.85; }
.wizard-stepper li .step-dot {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface-hover);
  color: var(--ink-faint);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700;
  flex: none;
}
.wizard-stepper li.is-current .wizard-step-btn {
  color: var(--brand-primary-dark);
  border-color: var(--brand-primary);
  background: var(--brand-primary-light);
}
.wizard-stepper li.is-current .step-dot { background: var(--brand-primary); color: #fff; }
.wizard-stepper li.is-done .wizard-step-btn { color: var(--ink); }
.wizard-stepper li.is-done .step-dot { background: var(--brand-accent); color: #fff; }
.wizard-stepper li.has-error .wizard-step-btn { border-color: var(--error-text); color: var(--error-text); }

/* Panes are only hidden once wizard.js is running; without JavaScript every section shows. */
.wizard-js-ready .wizard-pane { display: none; }
.wizard-js-ready .wizard-pane.is-active { display: block; animation: wizard-fade-in 0.2s ease; }
.wizard-pane:focus { outline: none; }
.wizard-pane + .wizard-pane { margin-top: 2rem; }
.wizard-js-ready .wizard-pane + .wizard-pane { margin-top: 0; }
.wizard-js-only { display: none; }
.wizard-js-ready .wizard-js-only { display: revert; }
@media (prefers-reduced-motion: reduce) { .wizard-js-ready .wizard-pane.is-active { animation: none; } }

@keyframes wizard-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.wizard-nav-buttons {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

/* =========================================================================================
   Multi-select dropdown (categories, etc.)
   ========================================================================================= */
.multiselect {
  position: relative;
}
.multiselect-toggle {
  width: 100%;
  min-height: calc(1.5em + 1.1rem + 2px);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: pointer;
}
.multiselect-toggle:hover { border-color: var(--brand-primary); }
.multiselect-toggle .chevron { color: var(--ink-faint); flex: none; }
.multiselect-chips {
  display: flex; flex-wrap: wrap; gap: 0.35rem;
}
.multiselect-chips .chip {
  background: var(--brand-primary-light);
  color: var(--brand-primary-dark);
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
}
.multiselect-placeholder { color: var(--ink-faint); font-weight: 400; }

.multiselect-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 320px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem;
  display: none;
}
.multiselect.is-open .multiselect-panel { display: block; }
.multiselect-search {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.65rem;
  margin-bottom: 0.4rem;
}
.multiselect-option {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.45rem 0.5rem;
  border-radius: 7px;
  cursor: pointer;
}
.multiselect-option:hover { background: var(--surface-hover); }
.multiselect-option input { flex: none; }
/* The options are Bootstrap .form-check rows moved into the panel: cancel Bootstrap's
   float + negative left margin on the checkbox (it relies on .form-check's 1.5em left
   padding, which .multiselect-option replaces) - otherwise the box sits outside the panel
   and is clipped, so only the label text is visible. */
.multiselect-option.form-check { padding-left: 0.5rem; margin-bottom: 0; min-height: 0; }
.multiselect-option .form-check-input { float: none; margin: 0; width: 1.1em; height: 1.1em; border-color: var(--ink-muted); }
.multiselect-option .form-check-label { cursor: pointer; flex: 1; }
.multiselect-option.is-hidden { display: none; }

/* =========================================================================================
   Step-through repeater (People / Witnesses / Injuries)
   ========================================================================================= */
.repeater {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  background: var(--surface-sunken);
}
.repeater-count-row {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.repeater-count-row .form-control { max-width: 140px; }
.repeater-progress {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-muted);
  margin: 0.75rem 0;
}
.repeater-summary {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  margin-bottom: 0.75rem;
}
.repeater-summary .repeater-pill {
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--surface);
  cursor: pointer;
  color: var(--ink-muted);
}
.repeater-summary .repeater-pill.is-current { border-color: var(--brand-primary); color: var(--brand-primary-dark); background: var(--brand-primary-light); }
.repeater-summary .repeater-pill.is-filled::before { content: "✓ "; color: var(--brand-accent); }
.repeater-js-ready .repeater-item { display: none; }
.repeater-js-ready .repeater-item.is-active { display: block; }
fieldset.repeater-item { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.repeater-item > legend.repeater-legend { font-size: 1rem; font-weight: 600; color: var(--ink); margin: 0; padding: 0.75rem 1rem 0; float: none; }
.repeater-item-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; gap: 0.5rem; flex-wrap: wrap; }
.repeater-empty { color: var(--ink-muted); font-style: italic; }
.repeater-add-btn { margin-bottom: 0.75rem; }
.repeater-remove-link { text-decoration: none; padding: 0.3rem 0.4rem; }
.repeater-remove-link:hover { text-decoration: underline; }

/* =========================================================================================
   Status timeline (progress)
   ========================================================================================= */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li {
  position: relative;
  padding: 0 0 1.25rem 1.75rem;
  border-left: 2px solid var(--border);
}
.timeline li:last-child { border-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -7px; top: 2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--brand-primary);
  border: 2px solid var(--surface);
}
.timeline .timeline-title { font-weight: 700; color: var(--ink); }
.timeline .timeline-meta { font-size: 0.8rem; color: var(--ink-muted); }
.timeline .timeline-comment { font-size: 0.9rem; color: var(--ink-muted); margin-top: 0.15rem; }

/* =========================================================================================
   Auth pages
   ========================================================================================= */
.auth-shell {
  min-height: calc(100vh - 140px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.auth-card {
  width: 100%;
  max-width: 420px;
}

/* ---- Misc ---------------------------------------------------------------------------------- */
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
}
.stat-tile .stat-value { font-size: 1.6rem; font-weight: 800; color: var(--ink); }
.stat-tile .stat-label { font-size: 0.8rem; color: var(--ink-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }

/* ---- Insight page --------------------------------------------------------------------------- */
@media (min-width: 992px) {
  .col-lg-2-4 { flex: 0 0 20%; max-width: 20%; }
}
.chart-wrap { position: relative; height: 260px; }
.chart-wrap-tall { height: 420px; }
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-closed);
  margin-right: 0.35rem;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  animation: amebo-live-pulse 2s infinite;
}
@keyframes amebo-live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
#insightsTable th, #insightsTable td { border-color: var(--border); }


/* =========================================================================================
   Validation, required markers and review summary (remediation items 4-6)
   ========================================================================================= */
:root { --error-text: #b91c1c; } /* 6.5:1 on white; --danger (#ef4444) is too light for text */
.req-marker { color: var(--error-text); font-weight: 600; font-size: 0.85em; }
.field-error { display: block; color: var(--error-text); font-size: 0.875rem; margin-top: 0.25rem; font-weight: 600; }
.field-error::before { content: "⚠ "; }
.form-control.is-invalid, .form-select.is-invalid, .form-check-input.is-invalid { border-color: var(--error-text); }
.error-summary {
  border: 3px solid var(--error-text);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  background: var(--surface);
}
.error-summary:focus { outline: 3px solid var(--brand-primary); outline-offset: 2px; }
.error-summary h2 { font-size: 1.15rem; margin: 0 0 0.5rem; color: var(--error-text); }
.error-summary ul { margin: 0; padding-left: 1.25rem; }
.error-summary a { color: var(--error-text); font-weight: 600; }
.review-section { border: 1px solid var(--border); border-radius: 8px; padding: 1rem 1.25rem; margin-bottom: 1rem; background: var(--surface); }
.review-section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.review-section-head h3 { font-size: 1.05rem; margin: 0; }
.review-section dl { display: grid; grid-template-columns: minmax(10rem, 30%) 1fr; gap: 0.25rem 1rem; margin: 0; }
.review-section dt { font-weight: 600; color: var(--ink-muted); }
.review-section dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.review-section .review-missing { color: var(--error-text); font-weight: 600; }
.review-section.is-skipped { background: var(--surface-sunken); }
.review-subhead { font-weight: 700; margin: 0.75rem 0 0.25rem; }
.declaration { border: 2px solid var(--brand-primary); border-radius: 8px; padding: 1rem 1.25rem; background: var(--brand-primary-light); }
.declaration legend { font-size: 1.05rem; font-weight: 700; float: none; width: auto; padding: 0 0.25rem; margin-bottom: 0.25rem; }
.draft-banner { border: 2px dashed var(--error-text); padding: 1rem 1.25rem; border-radius: 8px; background: var(--danger-bg); }
.placeholder-tbc { background: #fff3cd; color: #664d03; padding: 0 0.25rem; border-radius: 3px; font-weight: 600; }
.staff-section { border-left: 4px solid var(--brand-accent); padding-left: 1rem; }
.source-badge { font-size: 0.75rem; }
@media (max-width: 575.98px) { .review-section dl { grid-template-columns: 1fr; } }

/* Badge text contrast (WCAG 1.4.3): white text needs darker fills than the chart palette above,
   so badges use these accessible shades while charts keep the --status-* / --severity-* colours. */
.badge-status[data-status="Draft"] { background: #4b5563; }
.badge-status[data-status="Submitted"] { background: #1d4ed8; }
.badge-status[data-status="Assigned"] { background: #92400e; }
.badge-status[data-status="Pending review"] { background: #6d28d9; }
.badge-status[data-status="Closed"] { background: #047857; }
.badge-severity[data-severity="Low"] { background: #047857; }
.badge-severity[data-severity="Moderate"] { background: #92400e; }
.badge-severity[data-severity="Serious"] { background: #c2410c; }
.badge-severity[data-severity="Critical"] { background: #b91c1c; }
/* Links inside running text must be distinguishable without colour (WCAG 1.4.1). */
.alert a, main p a, main li a:not(.btn), .form-text a { text-decoration: underline; }
.app-footer a { text-decoration: underline; }

/* =========================================================================================
   My dashboard
   ========================================================================================= */
a.dash-tile { color: inherit; text-decoration: none; border: 1px solid transparent; }
a.dash-tile:hover, a.dash-tile:focus-visible { border-color: var(--brand-primary); }
a.dash-tile:focus-visible { outline: 3px solid var(--brand-primary); outline-offset: 2px; }
.dash-tile.is-attention { border-left: 4px solid var(--brand-primary); }
.dash-bars { list-style: none; padding: 0; margin: 0; }
.dash-bar-row { display: grid; grid-template-columns: minmax(8rem, 40%) 1fr 2.5rem; gap: 0.75rem; align-items: center; padding: 0.3rem 0; }
.dash-bar-label { font-size: 0.9rem; color: var(--ink); }
.dash-bar-value { text-align: right; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.dash-bar-track { display: block; height: 12px; background: var(--surface-sunken); border-radius: 4px; overflow: hidden; }
.dash-bar-fill { display: block; height: 100%; border-radius: 0 4px 4px 0; min-width: 0; padding: 0; }
.dash-bar-cat { background: var(--brand-primary); }
.dash-progress { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; }
.dash-progress > span { display: block; min-width: 4px; }
@media (max-width: 575.98px) { .dash-bar-row { grid-template-columns: 1fr 2.5rem; } .dash-bar-track { grid-column: 1 / -1; } }
