/* ============================================================
   DMIS — ACF Brand Theme
   Based on Army Cadets UK Brand Guidelines (May 2023)
   ============================================================ */

/* ── Google Fonts: Barlow (Neo Sans substitute) ─────────────── */
@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;500;600;700;800&family=Barlow:wght@300;400;500;600;700&display=swap');

/* ── ACF Brand Colours ──────────────────────────────────────── */
:root {
  /* Primary */
  --acf-dark-green:   #004E42;   /* Pantone 3305 — core brand */
  --acf-mid-green:    #3A7A5E;   /* Pantone 5555 — washed green */
  --acf-green:        #44883E;   /* Pantone 7741 */
  --acf-light-green:  #6BA539;   /* Pantone 7737 */
  --acf-yellow:       #EEDC00;   /* Pantone 3965 — accent/chevron */
  --acf-orange:       #FC4C02;   /* Pantone 1655 */
  --acf-red:          #D50032;   /* Pantone 199 */
  --acf-blue:         #008EAA;   /* Pantone 3135 */

  /* RAG */
  --rag-green:        #2E6636;
  --rag-green-bg:     #E8F4EA;
  --rag-amber:        #E8A020;
  --rag-amber-bg:     #FEF5E4;
  --rag-red:          #C0392B;
  --rag-red-bg:       #FDECEA;

  /* UI Neutrals */
  --body-bg:          #F4F1EB;   /* warm cream — matches your PDF body */
  --card-bg:          #FFFFFF;
  --card-border:      #E0DCD4;
  --table-header-bg:  #004E42;
  --table-alt-row:    #F9F7F3;
  --text-primary:     #1A1A1A;
  --text-secondary:   #555550;
  --text-muted:       #767670;
  --border-color:     #DDD9D0;
  --sidebar-bg:       #002E27;   /* darker than dark green */
  --sidebar-text:     #C8E6C9;
  --sidebar-active:   #EEDC00;   /* yellow accent on active */
  --sidebar-width:    240px;

  /* Typography */
  --font-display:     'Barlow Condensed', Arial, sans-serif;
  --font-body:        'Barlow', Arial, sans-serif;

  /* Spacing */
  --header-height:    82px;
  --content-padding:  24px;
  --card-radius:      6px;
  --border-radius:    4px;

  /* Shadows */
  --shadow-sm:        0 1px 3px rgba(0,0,0,.08);
  --shadow-md:        0 2px 8px rgba(0,0,0,.12);
}

/* ── Reset / Base ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { font-size: 15px; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--text-primary);
  background: var(--body-bg);
  line-height: 1.5;
}

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

/* ── Focus ring (WCAG 2.4.11) ────────────────────────────────── */
:focus-visible {
  outline: 3px solid #F5C842;   /* DMIS yellow — 6.3:1 on dark green, visible on white */
  outline-offset: 2px;
  border-radius: 2px;
}

/* Remove focus ring for mouse users on elements with a clear active state */
button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

/* ── Layout shell ────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 200;
  overflow: hidden;
  transition: transform .25s ease;
}

.sidebar-brand {
  height: var(--header-height);
  min-height: var(--header-height);
  max-height: var(--header-height);
  flex: 0 0 var(--header-height);
  box-sizing: border-box;
  padding: 0 18px;
  border-bottom: 4px solid var(--acf-yellow);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-brand .chevrons {
  font-size: 22px;
  color: var(--acf-yellow);
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1;
}

.sidebar-brand .brand-text {
  display: flex;
  flex-direction: column;
}

.sidebar-brand .det-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 12px;
  color: #FFFFFF;
  text-transform: uppercase;
  letter-spacing: .5px;
  line-height: 1.1;
}

.sidebar-brand .det-sub {
  font-size: 11px;
  color: var(--sidebar-text);
  font-weight: 400;
  letter-spacing: .3px;
}

/* Sidebar nav */
.sidebar-nav {
  padding: 8px 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-section-label {
  padding: 14px 18px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #8DB5A4;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 18px;
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
  text-decoration: none;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,.07);
  color: #FFFFFF;
  text-decoration: none;
}

.sidebar-nav a.active {
  background: rgba(238,220,0,.1);
  color: var(--acf-yellow);
  border-left-color: var(--acf-yellow);
  font-weight: 600;
}

/* Section-style clickable links (Calendar, Reporting, Training Planner) */
.sidebar-nav a.nav-section-link {
  display: block;
  padding: 14px 18px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #8DB5A4;
  border-left: 3px solid transparent;
  background: none;
}
.sidebar-nav a.nav-section-link .nav-icon {
  display: none;
}
.sidebar-nav a.nav-section-link:hover {
  background: rgba(255,255,255,.07);
  color: #FFFFFF;
}
.sidebar-nav a.nav-section-link.active {
  background: rgba(238,220,0,.1);
  color: var(--acf-yellow);
  border-left-color: var(--acf-yellow);
}

.sidebar-nav .nav-icon {
  width: 16px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
}
.sidebar-nav a.nav-has-sub {
  align-items: flex-start;
  padding-top: 7px;
  padding-bottom: 7px;
}
.nav-sub {
  display: block;
  font-size: 10.5px;
  font-weight: 400;
  opacity: 0.65;
  line-height: 1.3;
  margin-top: 1px;
}

/* Sidebar footer */
.sidebar-footer {
  flex: 0 0 auto;
  padding: 12px 18px;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: 12px;
  color: #8DB5A4;
}

.sidebar-footer a {
  color: #8DB5A4;
  font-size: 12px;
}

/* ── Main content area ───────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ── Top header bar ──────────────────────────────────────────── */
.top-header {
  background: var(--acf-dark-green);
  height: var(--header-height);
  min-height: var(--header-height);
  max-height: var(--header-height);
  flex: 0 0 var(--header-height);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  padding: 0 var(--content-padding);
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 4px solid var(--acf-yellow);
}

.page-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  color: #FFFFFF;
  letter-spacing: .3px;
  margin: 0;
  flex: 1;
}


.page-title .breadcrumb-link {
  color: #FFFFFF;
  text-decoration: none;
}

.page-title .breadcrumb-link:hover {
  color: var(--acf-yellow);
  text-decoration: none;
}

.page-title .breadcrumb-separator {
  color: var(--acf-yellow);
  margin: 0 6px;
}


.header-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 7px 12px;
  background: var(--acf-yellow);
  color: var(--acf-dark-green);
  border-radius: var(--border-radius);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
}

.header-action-button:hover {
  background: #fff16a;
  color: var(--acf-dark-green);
  text-decoration: none;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: rgba(255,255,255,.7);
}

.data-freshness {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 500;
}

.data-freshness.fresh {
  background: rgba(107,165,57,.25);
  color: #A8D87A;
}

.data-freshness.stale {
  background: rgba(208,0,50,.25);
  color: #FF8080;
}

.data-freshness .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ── Page content ────────────────────────────────────────────── */
.page-content {
  padding: var(--content-padding);
  flex: 1;
}

/* ── Data freshness stale banner ─────────────────────────────── */
.stale-banner {
  background: var(--rag-amber-bg);
  border: 1px solid var(--rag-amber);
  border-left: 4px solid var(--rag-amber);
  border-radius: var(--border-radius);
  padding: 10px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #7A4800;
  display: flex;
  align-items: center;
  gap: 8px;
}


.report-content .stale-banner {
  width: fit-content;
  max-width: 100%;
  margin-left: auto;
  margin-right: 0;
  margin-bottom: 8px;
  min-height: 32px;
  padding: 7px 10px;
  font-size: 12px;
  line-height: 1.2;
  align-items: center;
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm);
}

.card-header {
  background: var(--table-header-bg);
  color: #FFFFFF;
  padding: 10px 16px;
  border-radius: var(--card-radius) var(--card-radius) 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-header-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .3px;
  text-transform: uppercase;
  margin: 0;
}

.card-body { padding: 16px; }

/* ── KPI stat cards ──────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  padding: 16px 18px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--acf-dark-green);
}

.kpi-card.green::before { background: var(--rag-green); }
.kpi-card.amber::before { background: var(--rag-amber); }
.kpi-card.red::before   { background: var(--rag-red); }
.kpi-card.blue::before  { background: var(--acf-blue); }
.kpi-card.yellow::before { background: var(--acf-yellow); }

.kpi-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 42px;
  line-height: 1;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.kpi-card.green .kpi-value { color: var(--rag-green); }
.kpi-card.amber .kpi-value { color: var(--rag-amber); }
.kpi-card.red   .kpi-value { color: var(--rag-red); }
.kpi-card.blue  .kpi-value { color: var(--acf-blue); }

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--text-secondary);
}

/* ── RAG badge ───────────────────────────────────────────────── */
.rag-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
}

.rag-badge.Green, .rag-green {
  background: var(--rag-green-bg);
  color: var(--rag-green);
  border: 1px solid #B2D9B6;
}
.rag-badge.Amber, .rag-amber {
  background: var(--rag-amber-bg);
  color: #8A5800;
  border: 1px solid #F0C97A;
}
.rag-badge.Red, .rag-red {
  background: var(--rag-red-bg);
  color: var(--rag-red);
  border: 1px solid #F4AAAA;
}

/* ── Cadet name pill (matches your PDF style) ────────────────── */
.cadet-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
  font-family: var(--font-display);
}

.cadet-pill.green { background: var(--rag-green-bg); color: var(--rag-green); border: 1px solid #B2D9B6; }
.cadet-pill.amber { background: var(--rag-amber-bg); color: #7A4800;           border: 1px solid #F0C97A; }
.cadet-pill.red   { background: var(--rag-red-bg);   color: var(--rag-red);   border: 1px solid #F4AAAA; }

/* ── Tables ──────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table thead th {
  background: var(--table-header-bg);
  color: #FFFFFF;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .6px;
  text-transform: uppercase;
  padding: 9px 12px;
  text-align: left;
  white-space: nowrap;
  position: sticky;
  top: var(--header-height);
  z-index: 5;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: background .1s;
}

.data-table tbody tr:nth-child(even) { background: var(--table-alt-row); }
.data-table tbody tr:hover { background: #EAF4EC; }

.data-table tbody td {
  padding: 9px 12px;
  vertical-align: middle;
}

.data-table .rank { color: var(--text-secondary); font-size: 12px; }

/* Module grid (training detail) */
.module-grid { overflow-x: auto; }

.module-grid table {
  border-collapse: collapse;
  font-size: 12px;
  white-space: nowrap;
}

.module-grid thead th {
  background: var(--acf-dark-green);
  color: #FFF;
  padding: 7px 10px;
  text-align: center;
  font-size: 11px;
  letter-spacing: .4px;
  font-weight: 700;
}

.module-grid thead th.cadet-col {
  text-align: left;
  min-width: 160px;
}

.module-grid tbody td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-color);
  text-align: center;
  vertical-align: middle;
}

.module-grid tbody tr:nth-child(even) td { background: var(--table-alt-row); }

.module-complete {
  color: var(--rag-green);
  font-weight: 600;
  font-size: 13px;
}
.module-complete .date {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 400;
}
.module-not-achieved { color: var(--border-color); font-size: 16px; }

/* Progress bar (matches your PDF inline bars) */
.progress-bar-wrap {
  background: #E0DCD4;
  border-radius: 3px;
  height: 6px;
  min-width: 80px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .3s;
}
.progress-bar-fill.green { background: var(--rag-green); }
.progress-bar-fill.amber { background: var(--rag-amber); }
.progress-bar-fill.red   { background: var(--rag-red); }

/* ── Watch list (sidebar panel style) ───────────────────────── */
.watch-list { display: flex; flex-direction: column; gap: 8px; }

.watch-card {
  background: #1C1C1C;
  border-radius: var(--border-radius);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.watch-card .cadet-name {
  font-weight: 700;
  color: #FFFFFF;
  font-size: 14px;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: .3px;
}

.watch-card .cadet-level {
  font-size: 10px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.watch-card .months-val {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 32px;
  color: var(--acf-red);
  line-height: 1;
  flex-shrink: 0;
}

.watch-card .months-label {
  font-size: 11px;
  color: #BBBBBB;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ── Disruption list ─────────────────────────────────────────── */
.disruption-list { display: flex; flex-direction: column; gap: 4px; }

.disruption-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius);
  font-size: 13px;
}

.disruption-item .dis-date {
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--acf-dark-green);
  font-size: 14px;
  min-width: 90px;
}

.disruption-item .dis-type {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 2px 7px;
  border-radius: 10px;
}

.dis-type.bank-holiday { background: var(--rag-red-bg);   color: var(--rag-red); }
.dis-type.half_term    { background: var(--rag-amber-bg); color: #7A4800; }
.dis-type.holiday      { background: #EFF6FF;             color: var(--acf-blue); }
.dis-type.stand-down   { background: #F3F0FF;             color: #5B21B6; }

/* ── Star level badge ────────────────────────────────────────── */
.star-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 13px;
  background: var(--acf-dark-green);
  color: #FFFFFF;
  flex-shrink: 0;
}

.star-badge.basic { background: var(--text-secondary); }

/* ── Qual expiry status ───────────────────────────────────────── */
.expiry-Expired  { color: var(--rag-red);   font-weight: 700; }
.expiry-Critical { color: var(--rag-amber); font-weight: 700; }
.expiry-Current  { color: var(--rag-green); }

/* ── DoE status pills ────────────────────────────────────────── */
.doe-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}
.doe-Complete      { background: var(--rag-green-bg); color: var(--rag-green); }
.doe-Approved      { background: #EFF6FF; color: var(--acf-blue); }
.doe-Submitted     { background: #FFF3CD; color: #7A5800; }
.doe-In-progress   { background: var(--rag-amber-bg); color: #7A4800; }
.doe-Not-started   { background: #F3F3F3; color: var(--text-secondary); }
.doe-Not-enrolled  { background: #F3F3F3; color: var(--text-muted); }

/* ── Section/page header ─────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}

.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  color: var(--acf-dark-green);
  margin: 0;
  letter-spacing: .2px;
}

.section-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ── Grid layouts ────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-sidebar { display: grid; grid-template-columns: 1fr 280px; gap: 16px; }

/* ── Coming soon placeholder ─────────────────────────────────── */
.coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: var(--text-muted);
  text-align: center;
  gap: 12px;
}

.coming-soon .cs-icon {
  font-size: 48px;
  opacity: .4;
}

.coming-soon h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  color: var(--text-secondary);
  margin: 0;
}

/* ── Responsive — tablet (≤900px): icon-only sidebar ──────────── */
@media (max-width: 900px) {
  :root { --sidebar-width: 60px; }

  .sidebar {
    width: 60px;
    overflow: visible;
  }

  .sidebar-brand {
    justify-content: center;
    padding: 0;
  }

  .sidebar-brand .brand-text,
  .nav-section-label,
  .sidebar-footer {
    display: none;
  }

  .sidebar-nav {
    overflow: visible;
  }

  .sidebar-nav a {
    justify-content: center;
    padding: 0;
    min-height: 44px;
    position: relative;
  }

  .sidebar-nav a.nav-section-link {
    display: flex;
    justify-content: center;
    padding: 0;
    min-height: 44px;
    font-size: 14px;
    letter-spacing: 0;
    text-transform: none;
    color: var(--sidebar-text);
    background: none;
  }
  .sidebar-nav a.nav-section-link .nav-icon {
    display: block;
  }

  .nav-label { display: none !important; }

  .nav-badge { display: none; }

  .menu-toggle { display: none !important; }

  .sidebar-nav a[data-label]:hover::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: #1A3C30;
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    white-space: nowrap;
    z-index: 9999;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
  }

  .grid-2, .grid-3, .grid-sidebar {
    grid-template-columns: 1fr;
  }

  .kpi-grid { grid-template-columns: repeat(2, 1fr); }

  .data-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  :root { --content-padding: 14px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-value { font-size: 32px; }
}

/* ── 43" kiosk / dashboard mode ─────────────────────────────── */
@media (min-width: 2200px) {
  html { font-size: 18px; }
  :root {
    --sidebar-width: 280px;
    --content-padding: 32px;
  }
  .kpi-value { font-size: 56px; }
  .page-title { font-size: 26px; }
}

/* ── Training Plans list — four-zone layout ──────────────────── */
.plans-zone {
  margin-bottom: 1.25rem;
  border-radius: var(--card-radius);
  overflow: hidden;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
}
.plans-zone--current {
  border: 2px solid var(--acf-dark-green);
}
.plans-zone--next {
  opacity: 0.92;
}
.plans-zone--past,
.plans-zone--future {
  background: #fafaf8;
}
.plans-zone__summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  font-size: 13px;
}
.plans-zone__summary::-webkit-details-marker { display: none; }
.plans-zone__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--card-border);
}
.plans-zone__title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}
.plans-zone__label {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-primary);
}
.plans-zone__meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
}
.plans-zone__body {
  padding: 0.5rem 1.25rem 0.75rem;
}
.plans-zone__badge {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.plans-zone__badge--current {
  background: var(--acf-dark-green);
  color: #fff;
}
.plans-zone__badge--next {
  background: var(--card-border);
  color: var(--text-secondary);
}

/* ── Half-term tab nav ───────────────────────────────────── */
.ht-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 1.25rem;
}
.ht-tab {
  display: inline-block;
  white-space: nowrap;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-secondary);
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  transition: background .12s, color .12s;
}
.ht-tab:hover { background: var(--border-color); color: var(--text-primary); text-decoration: none; }
.ht-tab--active {
  background: var(--acf-dark-green);
  color: #fff !important;
  border-color: var(--acf-dark-green);
}
.ht-tab--has-sub {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.3;
}
.ht-tab-sub {
  font-size: 0.68rem;
  font-weight: 400;
  opacity: 0.7;
  margin-top: 1px;
}
.ht-tab--active .ht-tab-sub { opacity: 0.85; }

/* Plan rows */
.plan-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid #f0ede7;
}
.plan-row:last-child { border-bottom: none; }
.plan-row__label {
  flex: 1;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
}
.plan-row__dates {
  display: block;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 1px;
}
.plan-row__status { min-width: 90px; }
.plan-row__action { min-width: 100px; text-align: right; }

/* Plan status badges */
.plan-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 999px;
}
.plan-badge--approved { background: var(--rag-green-bg); color: var(--rag-green); }
.plan-badge--draft    { background: var(--rag-amber-bg); color: #92400e; }
.plan-badge--none     { background: #f0ede7; color: var(--text-muted); }

/* Term block inside zones */
.term-block { margin-bottom: 0.5rem; }
.term-block__name {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0.75rem 0 0.25rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid #f0ede7;
}
.term-block--past .plan-row__label { color: var(--text-muted); }
.term-block__empty {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  padding: 0.25rem 0;
}

/* Small button variant */
.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

/* Trash / danger icon button */
.btn-trash {
  background: none;
  border: none;
  color: #dc2626;
  cursor: pointer;
  padding: 0.3rem;
  margin-left: 0.5rem;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  border-radius: 0.25rem;
  transition: color 0.15s ease;
}
.btn-trash:hover {
  color: #991b1b;
}
.btn-trash svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* ── Utilities ───────────────────────────────────────────────── */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.fw-bold { font-weight: 700; }
.font-display { font-family: var(--font-display); }
.small { font-size: 12px; }

/* Strength report level badges: use readable pills, not cramped circles */
.star-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1;
  font-weight: 800;
  text-align: center;
}

.star-badge.basic {
  min-width: 72px;
}


/* Override original circular star badge width for strength report */
.data-table .star-badge {
  width: auto !important;
  min-width: 88px !important;
  max-width: none !important;
  height: 28px !important;
  padding: 0 12px !important;
  border-radius: 999px !important;
  white-space: nowrap !important;
}


/* Branding asset controls */
.branding-panel input[type="text"],
.branding-panel input[type="file"],
.branding-panel button {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.branding-panel input[type="file"] {
  font-size: 12px;
  overflow: hidden;
}

/* Sidebar affiliation logo */
.sidebar-brand-logo {
  width: 36px;
  min-width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-brand-logo img {
  max-width: 36px;
  max-height: 36px;
  object-fit: contain;
  display: block;
}

/* Slightly larger sidebar brand logo now that uploaded logos are supported */
.sidebar-brand-logo {
  width: 48px;
  min-width: 48px;
  height: 48px;
}

.sidebar-brand-logo img {
  max-width: 48px;
  max-height: 48px;
}

/* ── Appearance modes ────────────────────────────────────────── */
/* Light mode is the existing default. These variables override only where needed. */

body.appearance-dark {
  --body-bg:          #111816;
  --card-bg:          #18211f;
  --card-border:      #33403c;
  --table-header-bg:  #00362f;
  --table-alt-row:    #141d1b;
  --text-primary:     #f3f5f2;
  --text-secondary:   #c9d0cc;
  --text-muted:       #96a09b;
  --border-color:     #33403c;
  --sidebar-bg:       #001f1b;
  --sidebar-text:     #b8d8c8;
  --shadow-sm:        0 1px 3px rgba(0,0,0,.35);
  --shadow-md:        0 2px 10px rgba(0,0,0,.45);
}

body.appearance-dark input,
body.appearance-dark select,
body.appearance-dark textarea {
  background: #101816;
  color: var(--text-primary);
  border-color: var(--card-border);
}

body.appearance-dark .card,
body.appearance-dark .overview-card,
body.appearance-dark .branding-panel {
  background: var(--card-bg);
  color: var(--text-primary);
}

body.appearance-dark .branding-preview {
  background: #0f1514;
  border-color: var(--card-border);
}

body.appearance-dark .detachment-tab-button {
  background: #18211f;
  color: var(--text-primary);
  border-color: var(--card-border);
}

body.appearance-dark .detachment-tab-button.active {
  background: var(--acf-dark-green);
  color: #ffffff;
  border-color: var(--acf-dark-green);
}

body.appearance-dark table,
body.appearance-dark .data-table {
  color: var(--text-primary);
}

body.appearance-dark .data-table td,
body.appearance-dark .data-table th {
  border-color: var(--card-border);
}

body.appearance-dark .data-table tbody tr:nth-child(even) {
  background: var(--table-alt-row);
}

@media (prefers-color-scheme: dark) {
  body.appearance-system {
    --body-bg:          #111816;
    --card-bg:          #18211f;
    --card-border:      #33403c;
    --table-header-bg:  #00362f;
    --table-alt-row:    #141d1b;
    --text-primary:     #f3f5f2;
    --text-secondary:   #c9d0cc;
    --text-muted:       #96a09b;
    --border-color:     #33403c;
    --sidebar-bg:       #001f1b;
    --sidebar-text:     #b8d8c8;
    --shadow-sm:        0 1px 3px rgba(0,0,0,.35);
    --shadow-md:        0 2px 10px rgba(0,0,0,.45);
  }

  body.appearance-system input,
  body.appearance-system select,
  body.appearance-system textarea {
    background: #101816;
    color: var(--text-primary);
    border-color: var(--card-border);
  }

  body.appearance-system .card,
  body.appearance-system .overview-card,
  body.appearance-system .branding-panel {
    background: var(--card-bg);
    color: var(--text-primary);
  }

  body.appearance-system .branding-preview {
    background: #0f1514;
    border-color: var(--card-border);
  }

  body.appearance-system .detachment-tab-button {
    background: #18211f;
    color: var(--text-primary);
    border-color: var(--card-border);
  }

  body.appearance-system .detachment-tab-button.active {
    background: var(--acf-dark-green);
    color: #ffffff;
    border-color: var(--acf-dark-green);
  }

  body.appearance-system table,
  body.appearance-system .data-table {
    color: var(--text-primary);
  }

  body.appearance-system .data-table td,
  body.appearance-system .data-table th {
    border-color: var(--card-border);
  }

  body.appearance-system .data-table tbody tr:nth-child(even) {
    background: var(--table-alt-row);
  }
}

/* Explicit light mode override so switching back from dark is deterministic */
body.appearance-light {
  --body-bg:          #F4F1EB;
  --card-bg:          #FFFFFF;
  --card-border:      #E0DCD4;
  --table-header-bg:  #004E42;
  --table-alt-row:    #F9F7F3;
  --text-primary:     #1A1A1A;
  --text-secondary:   #555550;
  --text-muted:       #767670;
  --border-color:     #DDD9D0;
  --sidebar-bg:       #002E27;
  --sidebar-text:     #C8E6C9;
  --sidebar-active:   #EEDC00;
  --shadow-sm:        0 1px 3px rgba(0,0,0,.08);
  --shadow-md:        0 2px 8px rgba(0,0,0,.12);
}

body.appearance-light input,
body.appearance-light select,
body.appearance-light textarea {
  background: #ffffff;
  color: var(--text-primary);
  border-color: var(--card-border);
}

body.appearance-light .card,
body.appearance-light .overview-card {
  background: var(--card-bg);
  color: var(--text-primary);
}

body.appearance-light .branding-panel {
  background: #f7f5ef;
  color: var(--text-primary);
}

body.appearance-light .branding-preview {
  background: #ffffff;
  border-color: #cfc8b6;
}

body.appearance-light .detachment-tab-button {
  background: #f7f5ef;
  color: var(--text-primary);
  border-color: var(--card-border);
}

body.appearance-light .detachment-tab-button.active {
  background: #1c1c1c;
  color: #ffffff;
  border-color: #1c1c1c;
}

body.appearance-light table,
body.appearance-light .data-table {
  color: var(--text-primary);
}

body.appearance-light .data-table tbody tr:nth-child(even) {
  background: var(--table-alt-row);
}

/* ── Theme-aware buttons and form controls ───────────────────── */

.btn,
button,
input[type="button"],
input[type="submit"],
input[type="reset"] {
  font-family: var(--font-body);
  font-weight: 700;
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius);
  background: #f7f5ef;
  color: var(--text-primary);
  padding: 7px 12px;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.btn:hover,
button:hover,
input[type="button"]:hover,
input[type="submit"]:hover,
input[type="reset"]:hover {
  background: #eee9dc;
  text-decoration: none;
}

.btn-primary,
button.btn-primary,
input[type="submit"].btn-primary {
  background: var(--acf-yellow);
  border-color: var(--acf-yellow);
  color: var(--acf-dark-green);
  font-weight: 900;
}

.btn-primary:hover,
button.btn-primary:hover,
input[type="submit"].btn-primary:hover {
  background: #d9c900;
  border-color: #d9c900;
  color: var(--acf-dark-green);
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="time"],
input[type="number"],
input[type="password"],
select,
textarea {
  font-family: var(--font-body);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius);
  background: #ffffff;
  color: var(--text-primary);
  padding: 6px 8px;
}

input[type="file"] {
  font-family: var(--font-body);
  color: var(--text-primary);
}

input[type="file"]::file-selector-button {
  font-family: var(--font-body);
  font-weight: 700;
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius);
  background: #f7f5ef;
  color: var(--text-primary);
  padding: 6px 10px;
  margin-right: 10px;
  cursor: pointer;
}

input[type="file"]::file-selector-button:hover {
  background: #eee9dc;
}

/* Dark/system dark variants */
body.appearance-dark .btn,
body.appearance-dark button,
body.appearance-dark input[type="button"],
body.appearance-dark input[type="submit"],
body.appearance-dark input[type="reset"],
body.appearance-dark input[type="file"]::file-selector-button {
  background: #24302d;
  color: var(--text-primary);
  border-color: var(--card-border);
}

body.appearance-dark .btn:hover,
body.appearance-dark button:hover,
body.appearance-dark input[type="button"]:hover,
body.appearance-dark input[type="submit"]:hover,
body.appearance-dark input[type="reset"]:hover,
body.appearance-dark input[type="file"]::file-selector-button:hover {
  background: #2d3b37;
}

body.appearance-dark .btn-primary,
body.appearance-dark button.btn-primary,
body.appearance-dark input[type="submit"].btn-primary {
  background: var(--acf-yellow);
  border-color: var(--acf-yellow);
  color: #002e27;
}

@media (prefers-color-scheme: dark) {
  body.appearance-system .btn,
  body.appearance-system button,
  body.appearance-system input[type="button"],
  body.appearance-system input[type="submit"],
  body.appearance-system input[type="reset"],
  body.appearance-system input[type="file"]::file-selector-button {
    background: #24302d;
    color: var(--text-primary);
    border-color: var(--card-border);
  }

  body.appearance-system .btn:hover,
  body.appearance-system button:hover,
  body.appearance-system input[type="button"]:hover,
  body.appearance-system input[type="submit"]:hover,
  body.appearance-system input[type="reset"]:hover,
  body.appearance-system input[type="file"]::file-selector-button:hover {
    background: #2d3b37;
  }

  body.appearance-system .btn-primary,
  body.appearance-system button.btn-primary,
  body.appearance-system input[type="submit"].btn-primary {
    background: var(--acf-yellow);
    border-color: var(--acf-yellow);
    color: #002e27;
  }
}

/* ── Form layout helpers ─────────────────────────────────────── */

.form-section {
  margin-bottom: 1.5rem;
}

.form-section:last-of-type {
  margin-bottom: 0;
}

.form-section-label {
  display: block;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--card-border);
}

.form-field {
  display: grid;
  gap: 4px;
  margin-bottom: 0.75rem;
}

.form-field:last-child {
  margin-bottom: 0;
}

.form-field label {
  font-weight: 800;
  font-size: 0.9rem;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.form-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-hint {
  font-size: 0.82rem;
  color: var(--text-muted, #888);
  margin-top: 0.3rem;
  margin-bottom: 0;
}

.form-hint-inline {
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--text-muted, #888);
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--card-border);
}

.reminder-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  margin-top: 0.25rem;
}

.reminder-inline input[type="number"] {
  width: 64px;
  text-align: center;
}

@media (max-width: 600px) {
  .form-field-row {
    grid-template-columns: 1fr;
  }
}

/* ── Detachment Info visual improvements ─────────────────────── */

.detachment-profile-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr);
  gap: 16px;
  max-width: 1180px;
}

.detachment-mini-card {
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm);
  padding: 16px;
}

.detachment-mini-card h3 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1;
  color: var(--acf-dark-green);
}

.detachment-mini-card p {
  margin: 0 0 14px;
}

.detachment-address-card {
  grid-column: 1 / -1;
}

.stacked-fields,
.address-fields {
  display: grid;
  gap: 8px;
}

.stacked-fields label {
  margin-top: 6px;
  font-weight: 800;
  color: var(--text-primary);
}

.stacked-fields label:first-child {
  margin-top: 0;
}

.stacked-fields input,
.address-fields input {
  width: 100%;
  max-width: none;
}

.address-fields {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.address-fields input:first-child,
.address-fields input:nth-child(2),
.address-fields input:last-child {
  grid-column: 1 / -1;
}

.detachment-actions-footer {
  border-top: 1px solid var(--card-border);
  padding-top: 14px;
  margin-top: 16px;
}

body.appearance-dark .detachment-mini-card {
  background: var(--card-bg);
  border-color: var(--card-border);
}

body.appearance-dark .detachment-mini-card h3 {
  color: var(--acf-yellow);
}

@media (prefers-color-scheme: dark) {
  body.appearance-system .detachment-mini-card {
    background: var(--card-bg);
    border-color: var(--card-border);
  }

  body.appearance-system .detachment-mini-card h3 {
    color: var(--acf-yellow);
  }
}

@media (max-width: 900px) {
  .detachment-profile-grid,
  .address-fields {
    grid-template-columns: 1fr;
  }

  .detachment-address-card,
  .address-fields input:first-child,
  .address-fields input:nth-child(2),
  .address-fields input:last-child {
    grid-column: auto;
  }
}

/* ── Parade Details layout ───────────────────────────────────── */

.parade-details-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 860px;
}

/* Day schedule rows */
.parade-schedule-rows {
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
}

.parade-day-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.45rem 0.25rem;
  border-bottom: 1px solid var(--card-border);
}

.parade-day-row:last-child {
  border-bottom: none;
}

.parade-day-check-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 130px;
  cursor: pointer;
  font-weight: 700;
}

.parade-day-check-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin: 0;
}

.parade-day-times {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.parade-day-times[hidden] {
  display: none !important;
}

.parade-day-times input[type="time"] {
  width: 96px;
  font-size: 0.9rem;
  padding: 4px 6px;
}

.parade-times-hint {
  color: var(--text-muted, #888);
  font-size: 0.82rem;
}

/* Default times row at bottom of parade schedule card */
.parade-defaults-row {
  border-top: 1px solid var(--card-border);
  padding-top: 0.9rem;
  margin-top: 0.75rem;
}

.parade-defaults-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: 0.6rem;
}

.parade-defaults-inputs {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.parade-defaults-inputs label {
  font-weight: 700;
  font-size: 0.9rem;
}

.parade-defaults-inputs input[type="time"] {
  width: 110px;
  font-size: 0.9rem;
}

/* Council pill grid (shared with old .parade-day-grid) */
.parade-day-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(130px, 1fr));
  gap: 10px;
}

.parade-day-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 9px 12px;
  background: #f7f5ef;
  cursor: pointer;
  font-weight: 800;
}

.parade-day-pill input {
  width: 18px;
  height: 18px;
  margin: 0;
}

/* NAAFI time card grid */
.time-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 12px;
}

.time-card {
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  background: #f7f5ef;
  padding: 12px;
}

.time-card label {
  display: block;
  font-size: 12px;
  font-weight: 900;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.time-card input[type="time"] {
  width: 100%;
  max-width: none;
  font-size: 18px;
  font-weight: 700;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  margin-bottom: 14px;
}

.toggle-row input {
  width: 20px;
  height: 20px;
  margin: 0;
}

.naafi-times[hidden] {
  display: none !important;
}

body.appearance-dark .parade-day-pill,
body.appearance-dark .time-card {
  background: #121a18;
  border-color: var(--card-border);
}

body.appearance-dark .time-card label {
  color: var(--text-secondary);
}

@media (prefers-color-scheme: dark) {
  body.appearance-system .parade-day-pill,
  body.appearance-system .time-card {
    background: #121a18;
    border-color: var(--card-border);
  }

  body.appearance-system .time-card label {
    color: var(--text-secondary);
  }
}

@media (max-width: 700px) {
  .parade-day-grid,
  .time-card-grid {
    grid-template-columns: 1fr;
  }

  .parade-day-row {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .parade-day-check-label {
    min-width: 100%;
  }
}

/* ── Key Roles layout ────────────────────────────────────────── */

.roles-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 16px;
  max-width: 1180px;
}

.role-group-card h3 {
  color: var(--acf-dark-green);
}

.role-grid {
  display: grid;
  gap: 12px;
}

.role-field {
  display: grid;
  gap: 6px;
}

.role-field label {
  font-weight: 900;
  color: var(--text-primary);
}

.role-field select {
  width: 100%;
  max-width: none;
}

body.appearance-dark .role-group-card h3 {
  color: var(--acf-yellow);
}

@media (prefers-color-scheme: dark) {
  body.appearance-system .role-group-card h3 {
    color: var(--acf-yellow);
  }
}

@media (max-width: 900px) {
  .roles-layout {
    grid-template-columns: 1fr;
  }
}


.rag-pill.Grey {
  background: #eeeeee;
  color: #555555;
}


/* WHT Currency section headers */
.wht-section-header {
  margin: 16px 0 0;
  padding: 10px 12px;
  border-radius: 10px 10px 0 0;
  border: 1px solid var(--card-border);
  border-bottom: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.wht-section-title {
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: 13px;
}

.wht-section-count {
  font-size: 12px;
  font-weight: 800;
  opacity: .85;
}

.wht-section-header.Grey {
  background: #eeeeee;
  color: #444444;
  border-color: #d4d4d4;
}

.wht-section-header.Red {
  background: var(--rag-red-bg);
  color: var(--rag-red);
  border-color: rgba(155, 28, 28, .22);
}

.wht-section-header.Amber {
  background: var(--rag-amber-bg);
  color: #7A4800;
  border-color: rgba(122, 72, 0, .25);
}

.wht-section-header.Green {
  background: var(--rag-green-bg);
  color: var(--rag-green);
  border-color: rgba(20, 108, 46, .22);
}

.wht-currency-table {
  margin-top: 0;
  border: 1px solid var(--card-border);
}

.wht-currency-table th {
  background: var(--acf-dark-green);
}

.wht-currency-table tbody tr:first-child td {
  border-top: none;
}

/* ── Reduced motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Screen reader utility ───────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Dyslexia mode (BDA guidelines) ─────────────────────────── */
body.dyslexia-mode {
  --font-body: Arial, Helvetica, sans-serif;
  --font-display: Arial, Helvetica, sans-serif;
  line-height: 1.8;
}
/* Direct font-family override as belt-and-suspenders — Google Fonts cache
   can win over CSS variable cascade in some browsers. */
body.dyslexia-mode,
body.dyslexia-mode * {
  font-family: Arial, Helvetica, sans-serif !important;
  letter-spacing: 0.05em !important;
  word-spacing: 0.1em !important;
  text-transform: none !important;
  font-style: normal !important;
}
body.dyslexia-mode p,
body.dyslexia-mode li,
body.dyslexia-mode td,
body.dyslexia-mode label {
  max-width: 80ch;
  line-height: 1.8 !important;
}

/* ── High contrast mode — direct overrides, no variable dependency ── */
body.high-contrast .text-muted,
body.high-contrast .text-secondary,
body.high-contrast p.hint,
body.high-contrast small,
body.high-contrast .form-hint,
body.high-contrast .field-hint,
body.high-contrast td.muted,
body.high-contrast .subtitle {
  color: #444444 !important;
}
body.high-contrast .card,
body.high-contrast .card-section,
body.high-contrast .panel,
body.high-contrast .overview-card {
  border: 2px solid #333333 !important;
  box-shadow: none !important;
}
body.high-contrast a {
  text-decoration: underline;
}
body.high-contrast input,
body.high-contrast select,
body.high-contrast textarea {
  border: 2px solid #333333 !important;
  outline: 2px solid #333333 !important;
}
body.high-contrast .nav-link {
  color: #ffffff !important;
}
body.high-contrast .badge {
  outline: 2px solid currentColor !important;
}
/* Debug indicator — remove once confirmed working */
body.high-contrast::before {
  content: "HIGH CONTRAST ON";
  position: fixed;
  bottom: 0;
  right: 0;
  background: #000;
  color: #fff;
  padding: 4px 8px;
  font-size: 11px;
  z-index: 99999;
  pointer-events: none;
}

/* ── Dark mode (per-user override — placeholder) ─────────────── */
body.dark {
  /* Full dark mode token set to follow in a later pass */
  filter: invert(0.9) hue-rotate(180deg);
}

/* ── Breadcrumb ──────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: #6b7280;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.breadcrumb__item {
  color: #6b7280;
  text-decoration: none;
}
.breadcrumb__item:hover {
  color: var(--acf-dark-green);
  text-decoration: underline;
}
.breadcrumb__item--text {
  color: #6b7280;
}
.breadcrumb__item--current {
  color: #111827;
  font-weight: 500;
}
.breadcrumb__sep {
  color: #d1d5db;
  font-size: 0.75rem;
}

/* ── Back button ─────────────────────────────────────────────── */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: #6b7280;
  text-decoration: none;
  padding: 0.3rem 0;
}
.btn-back:hover {
  color: var(--acf-dark-green);
}

/* ── Data import redesign ─────────────────────────────────── */
.import-status-strip { display:flex; gap:6px; flex-wrap:wrap; align-items:center; }
.import-pill {
  display:inline-flex; align-items:center; gap:4px;
  padding:3px 9px; border-radius:20px; font-size:11px; font-weight:500; border:0.5px solid;
}
.import-pill__dot { width:5px; height:5px; border-radius:50%; flex-shrink:0; }
.import-pill--fresh  { background:#EAF3DE; border-color:#97C459; color:#3B6D11; }
.import-pill--fresh  .import-pill__dot { background:#639922; }
.import-pill--due    { background:#FAEEDA; border-color:#EF9F27; color:#854F0B; }
.import-pill--due    .import-pill__dot { background:#BA7517; }
.import-pill--stale  { background:#FCEBEB; border-color:#F09595; color:#A32D2D; }
.import-pill--stale  .import-pill__dot { background:#E24B4A; }
.import-pill--never  { background:#F1EFE8; border-color:#B4B2A9; color:#5F5E5A; }
.import-pill--never  .import-pill__dot { background:#888780; }

.import-alert {
  background:#FAEEDA; border:0.5px solid #EF9F27; border-radius:8px;
  padding:10px 14px; display:flex; align-items:flex-start; gap:8px;
  font-size:13px; color:#854F0B; margin-bottom:16px;
}

.import-grid {
  display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:16px;
}
@media (max-width: 900px) {
  .import-grid { grid-template-columns:1fr; }
}

.import-card {
  background:var(--card-bg, #fff);
  border:1px solid var(--card-border, #e2e8f0);
  border-radius:var(--card-radius, 8px); padding:20px;
}
.import-card--full { margin-bottom:16px; }
.import-card__title {
  font-size:11px; font-weight:600; text-transform:uppercase;
  letter-spacing:.05em; color:var(--text-secondary, #64748b); margin-bottom:14px;
}
.import-card__subtitle { font-size:11px; color:var(--text-tertiary, #94a3b8); }

.upload-zone {
  border:1.5px dashed #ccc;
  border-radius:8px; padding:28px 16px; text-align:center;
  background:#f8fafc; cursor:pointer;
  transition:border-color .15s, background .15s;
}
.upload-zone:hover,
.upload-zone--active { border-color:#1a4731; background:#f0faf4; }
.upload-zone--uploading { opacity:.6; pointer-events:none; }
.upload-zone__icon { font-size:24px; color:#94a3b8; display:block; margin-bottom:6px; font-style:normal; }
.upload-primary { font-size:14px; font-weight:500; margin-bottom:3px; }
.upload-hint    { font-size:12px; color:#94a3b8; }

.import-actions { display:flex; gap:8px; margin-top:12px; flex-wrap:wrap; }

.import-stat-row {
  display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin-top:12px;
}
.import-stat { background:#f8fafc; border-radius:7px; padding:10px; text-align:center; }
.import-stat__label { font-size:10px; color:#64748b; margin-bottom:3px; }
.import-stat__num   { font-size:18px; font-weight:500; color:#0f172a; }
.import-stat__num--green { color:#3B6D11; }
.import-stat__num--amber { color:#854F0B; }
.import-stat__num--red   { color:#A32D2D; }

.import-automation-bar {
  display:flex; align-items:center; gap:8px; margin-top:12px;
  padding:8px 12px; background:#f8fafc;
  border-radius:7px; font-size:12px; color:#64748b;
}
.import-automation-bar__dot { width:6px; height:6px; border-radius:50%; flex-shrink:0; }
.import-automation-bar__dot--ok  { background:#639922; }
.import-automation-bar__dot--err { background:#E24B4A; }
.import-automation-bar__label { font-weight:600; color:#0f172a; }
.import-automation-bar__detail {
  flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.import-automation-bar__expand {
  background:none; border:none; cursor:pointer; font-size:11px;
  color:#64748b; padding:0; flex-shrink:0;
}
.import-automation-bar__expand:hover { color:#0f172a; }
.import-automation-log {
  margin-top:8px; padding:10px 12px; background:#f8fafc;
  border-radius:7px; font-size:12px; color:#475569; line-height:1.7;
}

.import-files-table { width:100%; border-collapse:collapse; font-size:13px; }
.import-files-table th {
  font-size:11px; font-weight:600; color:#64748b;
  text-align:left; padding:6px 8px;
  border-bottom:1px solid var(--card-border, #e2e8f0);
}
.import-files-table td {
  padding:8px; border-bottom:1px solid var(--card-border, #e2e8f0);
  vertical-align:middle;
}
.import-files-table tr:last-child td { border-bottom:none; }
.import-files-table__name { display:block; font-weight:500; }
.import-files-table__meta { display:block; font-size:11px; color:#94a3b8; }
.import-files-table__error { display:block; font-size:11px; color:#c0392b; margin-top:2px; }
.import-files-table__empty {
  color:#94a3b8; padding:20px 8px !important; text-align:center;
}
.import-files-table__summary { font-size:12px; color:#94a3b8; margin-top:8px; }

.import-health-table { width:100%; border-collapse:collapse; font-size:13px; }
.import-health-table th {
  font-size:11px; font-weight:600; color:#64748b;
  text-align:left; padding:7px 10px;
  border-bottom:1px solid var(--card-border, #e2e8f0);
}
.import-health-table td {
  padding:10px; border-bottom:1px solid var(--card-border, #e2e8f0);
  vertical-align:middle;
}
.import-health-table tr:last-child td { border-bottom:none; }
.import-health-table tr:hover td { background:#f8fafc; }

.import-area-name  { font-weight:500; }
.import-type-code  { font-size:11px; color:#94a3b8; font-family:monospace; }
.import-age        { font-size:13px; color:#475569; }
.import-age--warning  { color:#854F0B; font-weight:500; }
.import-age--critical { color:#A32D2D; font-weight:500; }
.import-last-file {
  font-size:11px; color:#475569; font-family:monospace;
  display:block; max-width:240px;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.import-view-all { font-size:12px; color:#64748b; text-decoration:none; }
.import-view-all:hover { color:#0f172a; }

/* health table scroll in right column */
.import-health-table-wrap {
  max-height: 420px;
  overflow-y: auto;
}

/* ── Exclusions toggle ──────────────────────────────────────────────────── */
.excl-toggle {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    border: none;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background 0.15s;
}
.excl-toggle--no  { background: #e8f5e9; color: #2d7a2d; }
.excl-toggle--no:hover  { background: #c8e6c9; }
.excl-toggle--yes { background: #fdecea; color: #c0392b; }
.excl-toggle--yes:hover { background: #f5c6c2; }

.excl-fields { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.excl-fields--hidden { display: none; }

.excl-label {
    font-size: 0.78rem;
    color: var(--dmis-text-muted, #666);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.excl-label input[type="date"],
.excl-label input[type="text"] {
    padding: 4px 8px;
    border: 1px solid var(--dmis-border, #ddd);
    border-radius: 4px;
    font-size: 0.82rem;
    width: 200px;
    max-width: 100%;
}
.dmis-btn--xs {
    padding: 3px 10px;
    font-size: 0.78rem;
    align-self: flex-start;
    margin-top: 2px;
}

/* ── Exclusions page redesign ───────────────────────────────────────────── */
.excl-section { margin-bottom: 32px; }

.excl-filter-bar { display: flex; gap: 6px; margin-bottom: 14px; }
.excl-filter-btn {
    padding: 5px 14px;
    border: 1px solid var(--dmis-border, #ddd);
    border-radius: 20px;
    background: transparent;
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--dmis-text-muted, #666);
    transition: all 0.15s;
}
.excl-filter-btn--active {
    background: var(--dmis-green, #1a3c2e);
    color: #fff;
    border-color: var(--dmis-green, #1a3c2e);
}
.excl-filter-btn .excl-filter-count {
    margin-left: 4px;
    opacity: 0.7;
    font-weight: 600;
}
.excl-summary {
    display: block;
    font-size: 0.8rem;
    color: var(--dmis-text-muted, #666);
    font-style: italic;
    margin-bottom: 6px;
}
.excl-detail-cell { vertical-align: top; padding-top: 10px; }
tbody tr[data-excluded="true"] { background: #fffbf0; }
tbody tr[data-excluded="true"] td:first-child { border-left: 3px solid #e6a817; }
.excl-pill-count {
    background: #fdecea;
    color: #c0392b;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 0.78rem;
    font-weight: 600;
}

/* ── Resources tab ─────────────────────────────────────────── */
.resource-section { margin-bottom: 28px; }
.resource-section__header { margin-bottom: 14px; }
.resource-section__title { font-size: 1rem; font-weight: 600; color: var(--dmis-heading, #1a3c2e); margin: 0 0 4px; }
.resource-section__hint  { font-size: 0.82rem; color: var(--dmis-text-muted, #888); margin: 0; }
.resource-divider        { border: none; border-top: 1px solid var(--dmis-border, #e0e0e0); margin: 24px 0; }
.resource-add-btn        { margin-top: 8px; }
.resource-table          { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.resource-table td       { padding: 8px 10px; border-bottom: 1px solid var(--dmis-border, #f0f0f0); vertical-align: middle; }
.resource-row:hover      { background: var(--dmis-row-hover, #fafaf8); }
.resource-row__name      { font-weight: 500; }
.resource-row__notes     { color: var(--dmis-text-muted, #888); font-size: 0.8rem; margin-left: 6px; }
.resource-row__view-inner { display: flex; align-items: center; gap: 8px; width: 100%; }
.resource-row__right     { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-shrink: 0; }
.resource-edit-cell      { padding: 0 !important; }

/* Space type badges */
.space-type-badge { font-size: 0.78rem; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.space-type-badge--indoor          { background: #e8f0ff; color: #2d4fa3; }
.space-type-badge--outdoor         { background: #e8f5e9; color: #2d7a2d; }
.space-type-badge--covered_outdoor { background: #fffbf0; color: #7a5c00; }

/* Category groups */
.resource-category__toggle {
    display: flex; align-items: center; gap: 8px; width: 100%;
    background: none; border: none; border-bottom: 1px solid var(--dmis-border, #e0e0e0);
    padding: 10px 0 6px; cursor: pointer; text-align: left;
}
.resource-category__title   { font-size: 0.82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--dmis-text-muted, #888); }
.resource-category__count   { font-size: 0.7rem; background: var(--tag-bg, #eee); border-radius: 10px; padding: 1px 7px; color: var(--dmis-text-muted, #888); font-weight: 600; }
.resource-category__chevron { margin-left: auto; font-size: 0.75rem; color: var(--dmis-text-muted, #aaa); }

/* Space cards */
.spaces-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-bottom: 12px; }
.space-card  { border: 1px solid var(--dmis-border, #e0e0e0); border-radius: 10px; padding: 14px; background: var(--dmis-card-bg, #fff); transition: box-shadow .15s; }
.space-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.space-card__header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.space-card__name   { font-weight: 600; font-size: .95rem; margin: 0 0 8px; color: var(--dmis-heading, #1a3c2e); }
.space-card__caps   { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.space-cap-chip         { font-size: .75rem; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.space-cap-chip--cadets { background: #e8f0ff; color: #2d4fa3; }
.space-cap-chip--staff  { background: #f0e8ff; color: #5c2d9a; }
.space-card__no-cap     { font-size: .75rem; color: var(--dmis-text-muted, #aaa); font-style: italic; }
.space-card__notes      { font-size: .78rem; color: var(--dmis-text-muted, #888); margin: 4px 0 0; }
.space-card__actions    { display: flex; gap: 4px; flex-shrink: 0; }
.spaces-empty           { grid-column: 1 / -1; padding: 24px; text-align: center; border: 2px dashed var(--dmis-border, #ddd); border-radius: 10px; color: var(--dmis-text-muted, #999); }
.spaces-empty__text     { font-weight: 500; margin: 0 0 4px; }
.spaces-empty__hint     { font-size: .82rem; margin: 0; }

/* Equipment search */
.equipment-search-bar   { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.equipment-search-input { flex: 1; max-width: 360px; padding: 7px 12px; border: 1px solid var(--dmis-border, #ccc); border-radius: 20px; font-size: .85rem; }
.equipment-search-input:focus { outline: none; border-color: var(--dmis-accent, #1a3c2e); box-shadow: 0 0 0 2px rgba(26,60,46,.1); }
.equipment-search-count { font-size: .8rem; color: var(--dmis-text-muted, #888); min-width: 70px; }

/* Resource forms */
.resource-form            { background: var(--dmis-bg-subtle, #f9f9f7); border: 1px solid var(--dmis-border, #e0e0e0); border-radius: 8px; padding: 16px; margin: 12px 0; }
.resource-form--new       { border-left: 3px solid var(--dmis-accent, #1a3c2e); }
.resource-form__title     { font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--dmis-text-muted, #888); margin: 0 0 10px; }
.resource-form__grid      { display: grid; grid-template-columns: 2fr 1.5fr 80px; gap: 10px 12px; margin-bottom: 14px; }
.resource-form__grid--inline { margin-bottom: 0; }
.resource-form__field     { display: flex; flex-direction: column; gap: 4px; }
.resource-form__field label { font-size: .78rem; font-weight: 600; color: var(--dmis-text-muted, #888); }
.resource-form__field input,
.resource-form__field select { padding: 6px 10px; border: 1px solid var(--dmis-border, #ccc); border-radius: 6px; font-size: .85rem; }
.resource-form__field--wide  { grid-column: span 2; }
.resource-form__field--short { grid-column: span 1; }
.resource-form__field--full  { grid-column: 1 / -1; }
.resource-form__actions { display: flex; gap: 8px; }
.label-optional { font-weight: 400; color: var(--dmis-text-muted, #aaa); font-size: .75rem; }

/* Quantity steppers */
.qty-stepper      { display: inline-flex; align-items: center; border: 1px solid var(--dmis-border, #ddd); border-radius: 6px; overflow: hidden; font-size: .82rem; }
.qty-btn          { border: none; background: var(--dmis-bg-subtle, #f5f5f3); width: 24px; height: 24px; cursor: pointer; font-size: 1rem; line-height: 1; color: var(--dmis-text-muted, #666); display: flex; align-items: center; justify-content: center; }
.qty-btn:hover    { background: var(--dmis-border, #e5e5e3); color: #000; }
.qty-display      { min-width: 28px; text-align: center; padding: 0 4px; font-weight: 600; font-size: .82rem; }
.qty-stepper--form input[type=number] { width: 48px; text-align: center; border: none; border-left: 1px solid var(--dmis-border, #ddd); border-right: 1px solid var(--dmis-border, #ddd); padding: 4px 2px; font-size: .85rem; }

/* ── Range-specific space card styles ───────────────────────── */
.space-type-badge--range  { background: #fff0e8; color: #8b3a0f; }
.space-card__range-info   { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.range-type-badge         { font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 10px; display: inline-flex; align-items: center; gap: 4px; }
.range-type-badge--air_rifle { background: #e8f0ff; color: #2d4fa3; }
.range-type-badge--l98a2     { background: #fdecea; color: #8b1a1a; }
.range-type-badge--ctr       { background: #fdf0e8; color: #8b3a0f; }
.range-type-badge--dcct      { background: #f0e8ff; color: #5c2d9a; }
.range-dcct-note          { font-size: .68rem; font-weight: 400; opacity: .8; }
.space-cap-chip--lanes    { background: #fff0e8; color: #8b3a0f; }
.space-cap-chip--spectators { background: #f5f5f3; color: #555; }
.resource-form__range-details {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 10px;
    padding: 12px;
    background: #fff8f5;
    border: 1px dashed #e0c8b0;
    border-radius: 6px;
    margin-top: 4px;
}

/* ── Training spaces: type group headings ───────────────────── */
.spaces-type-heading {
    font-size: 0.78rem; font-weight: 700;
    letter-spacing: 0.04em; text-transform: uppercase;
    color: var(--dmis-text-muted, #888);
    border-bottom: 1px solid var(--dmis-border, #e0e0e0);
    padding-bottom: 6px; margin: 20px 0 10px;
    display: flex; align-items: center; gap: 8px;
}
.spaces-type-heading:first-of-type,
.spaces-type-group:first-child .spaces-type-heading { margin-top: 0; }
.spaces-type-count {
    font-size: 0.7rem; background: var(--tag-bg, #eee);
    border-radius: 10px; padding: 1px 7px;
    color: var(--dmis-text-muted, #888); font-weight: 600;
}
.spaces-type-group:last-child { margin-bottom: 0 !important; }

/* .space-card--editing and .space-edit-panel removed in v0.12.5 — modal replaces panel */

/* ── Custom overlay modal (no Bootstrap JS required) ────────── */
.dmis-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1050;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}
.dmis-modal {
    background: var(--card-bg, #fff);
    border-radius: 10px;
    max-width: 720px; width: 100%;
    max-height: 90vh; overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    position: relative;
}
.dmis-modal__header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px;
    background: #e8f0eb; border-bottom: 1px solid #c2d9c8;
    border-radius: 10px 10px 0 0;
}
.dmis-modal__header h5 { margin: 0; font-size: .95rem; font-weight: 600; color: var(--dmis-heading, #1a3c2e); }
.dmis-modal__close { background: none; border: none; cursor: pointer; font-size: 1.1rem; color: #888; padding: 0; line-height: 1; }
.dmis-modal__body { padding: 20px; }

/* Generic form control classes used inside modal forms */
.form-control, .form-select {
    width: 100%; padding: 6px 10px;
    border: 1px solid var(--dmis-border, #ccc); border-radius: 6px;
    font-size: .85rem; font-family: inherit;
    box-sizing: border-box; background: var(--card-bg, #fff);
    color: var(--text-primary, #1a1a1a);
}
.form-control-sm, .form-select-sm { padding: 4px 8px; font-size: .82rem; }
.form-control:focus, .form-select:focus {
    outline: none; border-color: var(--dmis-accent, #1a3c2e);
    box-shadow: 0 0 0 2px rgba(26,60,46,.12);
}
