/* ==========================================================================
   AFSL Compliance Portal — Design System
   ==========================================================================
   Single-file stylesheet so each HTML template is import-ready for Figma.
   Structure mirrors the modular CSS described in DESIGN-SYSTEM.md.
   --------------------------------------------------------------------------- */

/* ==========================================================================
   0. Font loading — Eudoxus
   ==========================================================================
   Eudoxus is licensed. When CC confirms AFSL licence, drop the .woff2 files
   into /frontend/assets/fonts/ and the @font-face rules below will pick them up.
   Until then, the fallback stack (Inter / Public Sans / Arial) renders.
   ========================================================================== */
@font-face {
  font-family: "Eudoxus";
  src: url("../fonts/EudoxusSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Eudoxus";
  src: url("../fonts/EudoxusSans-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Eudoxus";
  src: url("../fonts/EudoxusSans-ExtraBold.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* ==========================================================================
   1. Design Tokens (_variables.css)
   ========================================================================== */
:root {
  /* Brand — dark navy */
  --color-primary: #0F2C5C;
  /* Secondary text now navy — the grey-black slate is retired from text */
  --color-primary-hover: #1E4A8A;
  --color-primary-soft: #E6ECF5;
  --color-secondary: #0F2C5C;  /* navy — retired the slate-grey so all text stays in the navy family */
  --color-accent: #C9A34A;
  --color-accent-soft: #FAF3DE;

  /* Status */
  --color-success: #28A745;
  --color-success-soft: #E6F4EA;
  --color-warning: #FFC107;
  --color-warning-soft: #FFF8E1;
  --color-warning-text: #8B6A00;    /* WCAG-AA text on warning-soft */
  --color-error: #DC3545;
  --color-error-soft: #FBE9EB;
  --color-info: #1E88E5;
  --color-info-soft: #E3F2FD;

  /* Risk matrix palette (tokenised from the four visual bands) */
  --color-risk-low: #4CAF50;
  --color-risk-med: #FFC107;
  --color-risk-high: #FF7043;
  --color-risk-critical: #DC3545;

  /* Grayscale */
  --gray-50: #FAFAFA;
  --gray-100: #F5F5F5;
  --gray-150: #E9EAEC;
  --gray-200: #E5E5E5;
  --gray-300: #D1D5DB;
  --gray-400: #687588;
  --gray-500: #737373;
  --gray-800: #262626;
  --gray-900: #171717;

  /* Surface */
  --bg-body: #FFFFFF;
  --bg-surface: #FFFFFF;
  --bg-subtle: #F4F4F7;         /* NSW-style soft grey */
  --bg-cream: #FFF4D8;           /* accent strip / callouts */
  --bg-navy: #0F2C5C;            /* for full-width navy sections */
  --bg-navy-deep: #0A1F44;       /* footer / darkest */
  /* All text is in the navy family — no neutral greys or near-black for text */
  --text-primary: #0F2C5C;                     /* navy — body + headings */
  --text-secondary: #4A5F87;                   /* navy 65% — labels, subtitles */
  --text-muted: #5F7099;                       /* navy — captions, meta, breadcrumbs · WCAG AA 4.9:1 on white */
  --text-on-navy: #FFFFFF;
  --text-on-navy-muted: rgba(255, 255, 255, 0.75);

  /* Comfortable touch-first defaults. Desktop density is tightened below. */
  --font-family-base: "Eudoxus", "Eudoxus Sans", "Inter", "Public Sans", Arial, sans-serif;
  --font-size-2xs: 16px;
  --font-size-xs: 16px;
  --font-size-sm: 16px;
  --font-size-base: 16px;
  /* Uppercase labels need less visual mass than sentence-case UI copy. */
  --font-size-uppercase: 11px;
  --font-size-lg: 18px;
  --font-size-xl: 20px;
  --font-size-2xl: 24px;
  --font-size-3xl: 30px;
  --font-size-4xl: 38px;
  --font-size-5xl: 52px;

  /* Section spacing — more breathing room around page headers */
  --section-y: 72px;
  --section-y-lg: 104px;
  --section-y-sm: 24px;           /* equal to --content-pad-x so page content has matching top + left padding */
  --page-header-gap: 48px;        /* breathing room below page titles */
  --content-pad-x: 24px;          /* matches header + page-band horizontal padding for consistent left alignment */
  --font-weight-light: 300;
  --font-weight-normal: 400;
  /* Keep body and navigation copy on one regular weight tier. */
  --font-weight-medium: 400;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;

  /* Spacing (4px base) */
  --spacing-1: 4px;
  --spacing-2: 8px;
  --spacing-3: 12px;
  --spacing-4: 16px;
  --spacing-5: 20px;
  --spacing-6: 24px;
  --spacing-8: 32px;
  --spacing-10: 40px;
  --spacing-12: 48px;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-focus: 0 0 0 3px #FFC107;    /* WCAG-AAA high-contrast yellow, gov-style */

  /* Border */
  --border-width: 1px;
  --border-color: var(--color-primary-soft);
  --border-color-strong: #D5DEEC;
  --input-border-color: #B8BDC4;

  /* Layout */
  --sidebar-width: 240px;
  --header-height: 64px;
  --container-max: 1400px;
}

/* Desktop workspaces favour information density. This mirrors the useful
   working area of an 80% browser zoom without scaling the document itself,
   so responsive breakpoints, focus rings and fixed positioning stay intact. */
@media (min-width: 1024px) {
  :root {
    --font-size-2xs: 13px;
    --font-size-xs: 13px;
    --font-size-sm: 13px;
    --font-size-base: 13px;
    --font-size-uppercase: 9px;
    --font-size-lg: 15px;
    --font-size-xl: 16px;
    --font-size-2xl: 19px;
    --font-size-3xl: 24px;
    --font-size-4xl: 30px;
    --font-size-5xl: 42px;

    --section-y: 58px;
    --section-y-lg: 84px;
    --section-y-sm: 19px;
    --page-header-gap: 38px;
    --content-pad-x: 19px;

    --spacing-1: 3px;
    --spacing-2: 6px;
    --spacing-3: 10px;
    --spacing-4: 13px;
    --spacing-5: 16px;
    --spacing-6: 19px;
    --spacing-8: 26px;
    --spacing-10: 32px;
    --spacing-12: 38px;

    --sidebar-width: 208px;
    --header-height: 51px;
  }
}

/* ==========================================================================
   2. Base (_base.css)
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  color: var(--text-primary);
  background: var(--bg-body);
  line-height: 1.5;
}

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

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

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 var(--spacing-3);
  color: var(--color-primary);
  font-weight: var(--font-weight-semibold);
  line-height: 1.2;
}

/* Hero / page-band sections now use light blue → headings are navy */
.a-section--navy h1, .a-section--navy h2, .a-section--navy h3, .a-section--navy h4,
.a-hero h1, .a-hero h2, .a-hero h3,
.a-page-band h1, .a-page-band h2, .a-page-band h3 { color: var(--color-primary); }
/* Only deep-navy footer section keeps white */
.a-section--navy-deep h1, .a-section--navy-deep h2, .a-section--navy-deep h3 { color: #FFFFFF; }

h1 { font-size: var(--font-size-4xl); letter-spacing: -0.02em; font-weight: var(--font-weight-extrabold); }
h2 { font-size: var(--font-size-3xl); letter-spacing: -0.01em; font-weight: var(--font-weight-bold); }
h3 { font-size: var(--font-size-2xl); font-weight: var(--font-weight-bold); }
h4 { font-size: var(--font-size-xl); font-weight: var(--font-weight-semibold); }
h5 { font-size: var(--font-size-lg); font-weight: var(--font-weight-semibold); }
h6 { font-size: var(--font-size-base); font-weight: var(--font-weight-semibold); }

p {
  margin: 0 0 var(--spacing-3);
}

small,
.text-xs {
  font-size: var(--font-size-xs);
}

.text-sm { font-size: var(--font-size-sm); }
.text-base { font-size: var(--font-size-base); }
.text-lg { font-size: var(--font-size-lg); }

.font-normal { font-weight: var(--font-weight-normal); }
.font-medium { font-weight: var(--font-weight-medium); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-bold { font-weight: var(--font-weight-bold); }

.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-secondary); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--color-success); }
.text-warning { color: #B98900; }
.text-error { color: var(--color-error); }
.text-info { color: var(--color-info); }

hr {
  border: 0;
  border-top: var(--border-width) solid var(--border-color);
  margin: var(--spacing-6) 0;
}

code {
  font-family: "JetBrains Mono", Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
  background: var(--gray-100);
  padding: 0 var(--spacing-1);
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   3. Layout — App shell
   ========================================================================== */
.a-app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--header-height) 1fr;
  grid-template-areas: "sidebar header" "sidebar main";
  min-height: 100vh;
  transition: grid-template-columns 500ms ease;
}

.a-sidebar {
  grid-area: sidebar;
  background: #FFFFFF;
  color: var(--text-primary);
  padding: var(--spacing-6) var(--spacing-4);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  transition: padding 500ms ease, transform 500ms ease;
}

.a-app.is-sidebar-collapsed {
  grid-template-columns: 76px 1fr;
}

.a-sidebar__brand-compact { display: none; }
.a-sidebar__collapse {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  width: 100%;
  margin-top: auto;
  padding: 10px var(--spacing-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: var(--font-size-sm);
  cursor: pointer;
}
.a-sidebar__collapse:hover { background: var(--bg-subtle); color: var(--color-primary); }
.a-sidebar__mobile-close { display: none; }
.a-sidebar__overlay { display: none; }
.is-sidebar-collapsed .a-sidebar { padding-inline: var(--spacing-3); }
.is-sidebar-collapsed .a-sidebar__brand { justify-content: center; }
.a-sidebar__logo,
.a-sidebar__section-label,
.a-nav__label {
  max-width: 220px;
  opacity: 1;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 220ms ease, max-width 500ms ease;
}
.is-sidebar-collapsed .a-sidebar__logo,
.is-sidebar-collapsed .a-sidebar__section-label,
.is-sidebar-collapsed .a-nav__label { max-width: 0; opacity: 0; transition-delay: 0ms; }
.a-app:not(.is-sidebar-collapsed) .a-sidebar__logo { transition-delay: 60ms; }
.a-app:not(.is-sidebar-collapsed) .a-sidebar__section-label { transition-delay: 120ms; }
.a-app:not(.is-sidebar-collapsed) .a-nav__item:nth-child(1) .a-nav__label { transition-delay: 160ms; }
.a-app:not(.is-sidebar-collapsed) .a-nav__item:nth-child(2) .a-nav__label { transition-delay: 220ms; }
.a-app:not(.is-sidebar-collapsed) .a-nav__item:nth-child(3) .a-nav__label { transition-delay: 280ms; }
.a-app:not(.is-sidebar-collapsed) .a-nav__item:nth-child(4) .a-nav__label { transition-delay: 340ms; }
.a-app:not(.is-sidebar-collapsed) .a-nav__item:nth-child(5) .a-nav__label { transition-delay: 400ms; }
.a-app:not(.is-sidebar-collapsed) .a-nav__item:nth-child(n+6) .a-nav__label { transition-delay: 460ms; }
.is-sidebar-collapsed .a-sidebar__brand-compact {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--color-primary);
  color: #fff;
  font-weight: var(--font-weight-extrabold);
}
.is-sidebar-collapsed .a-nav__link,
.is-sidebar-collapsed .a-sidebar__collapse { justify-content: center; padding-inline: 0; }

.a-sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  margin-bottom: var(--spacing-8);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-extrabold);
  color: var(--color-primary);
  letter-spacing: -0.01em;
}

.a-sidebar__brand-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--color-primary);
  display: grid;
  place-items: center;
  color: #FFFFFF;
  font-weight: var(--font-weight-extrabold);
  font-size: var(--font-size-lg);
}

.a-sidebar__section {
  margin-bottom: var(--spacing-6);
}

.a-sidebar__section-label {
  font-size: var(--font-size-uppercase);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--spacing-2);
  padding: 0 var(--spacing-3);
}

.a-nav {
  list-style: none;
  margin: 0;
  padding: 0;
}

.a-nav__item {
  margin-bottom: 2px;
}

.a-nav__link {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  padding: 10px var(--spacing-3);
  border-radius: var(--radius-sm);
  color: var(--color-secondary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  text-decoration: none;
  border-left: 3px solid transparent;
  margin-left: -3px;
  transition: background 120ms ease, color 120ms ease;
}

.a-nav__link:hover {
  background: var(--bg-subtle);
  color: var(--color-primary);
  text-decoration: none;
}

.a-nav__link.is-active {
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-weight: var(--font-weight-bold);
  border-left-color: var(--color-primary);
}

.a-nav__link.is-active .a-nav__icon {
  color: var(--color-primary);
}

.a-nav__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: var(--text-secondary);
}

.a-header {
  grid-area: header;
  background: var(--bg-surface);
  border: 0;
  display: flex;
  align-items: center;
  padding: 0 var(--content-pad-x);
  gap: var(--spacing-4);
  position: relative;
  z-index: 10;
}

/* Top-header title is redundant with the page h1 — hide it but keep the node for layout */
.a-header__title {
  display: none;
}

.a-header__spacer { flex: 1; }

.a-header__search {
  flex: 0 1 420px;
  max-width: 420px;
  position: relative;
  display: flex;
  align-items: center;
}
.a-header__search::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 0;
  bottom: 0;
  margin: auto 0;
  width: 16px;
  height: 16px;
  background: var(--text-muted);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>") center / contain no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>") center / contain no-repeat;
  pointer-events: none;
}

.a-header__search input,
.a-header__search input[type="search"] {
  width: 100%;
  padding: 8px 12px 8px 40px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.a-header__search input::placeholder { color: var(--text-muted); }
.a-header__search input:hover,
.a-header__search input[type="search"]:hover { border-color: var(--color-primary); }
.a-header__search input:focus-visible,
.a-header__search input[type="search"]:focus-visible {
  outline: 0;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(15, 44, 92, 0.12);
}

.a-header__actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
}

.a-header__bell {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 0;
  padding: 0;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.a-header__bell:hover { background: var(--color-primary-soft); color: var(--color-primary); }
.a-header__bell:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(15, 44, 92, 0.2);
}

.a-header__bell .dot {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 8px;
  height: 8px;
  background: var(--color-error);
  border: 2px solid var(--bg-surface);
  border-radius: var(--radius-full);
}

.a-header__user {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  cursor: pointer;
}

.a-header__avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: #FFFFFF;
  display: grid;
  place-items: center;
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
}

.a-header__user-meta {
  line-height: 1.2;
}

.a-header__user-name {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
}

.a-header__user-role {
  font-size: 11px;
  color: var(--text-secondary);
}
.a-header__user-chevron {
  display: grid;
  color: var(--text-secondary);
  transition: transform 120ms ease;
}
.is-open .a-header__user-chevron { transform: rotate(180deg); }
.a-header__dropdown-tenant {
  margin-top: var(--spacing-2);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary);
}

/* ---- Header dropdowns (bell + user) ---- */
.a-header__dropdown-wrap {
  position: relative;
  display: inline-block;
}
.a-header__dropdown-wrap[data-dropdown] > button {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.a-header__dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 320px;
  max-width: 380px;
  background: var(--bg-surface);
  border: 1px solid var(--color-primary-soft);
  border-radius: var(--radius-md);
  box-shadow: 0 6px 24px rgba(15, 44, 92, 0.14);
  z-index: 40;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 120ms ease, transform 120ms ease, visibility 0s linear 120ms;
}
.is-open > .a-header__dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 120ms ease, transform 120ms ease, visibility 0s linear 0s;
}
.a-header__dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-3) var(--spacing-4);
  border-bottom: 1px solid var(--color-primary-soft);
}
.a-header__dropdown-header__title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary);
}
.a-header__dropdown-header__action {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  text-decoration: none;
}
.a-header__dropdown-header__action:hover { color: var(--color-primary); }
.a-header__dropdown-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 360px;
  overflow-y: auto;
}
.a-header__dropdown-item {
  display: flex;
  gap: var(--spacing-3);
  padding: var(--spacing-3) var(--spacing-4);
  border-bottom: 1px solid var(--color-primary-soft);
  text-decoration: none;
  color: var(--text-primary);
  transition: background 120ms ease;
}
.a-header__dropdown-item:last-child { border-bottom: 0; }
.a-header__dropdown-item:hover { background: var(--color-primary-soft); color: var(--color-primary); }
.a-header__dropdown-item.is-unread { background: rgba(230, 236, 245, 0.35); }
.a-header__dropdown-item__dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  margin-top: 7px;
}
.a-header__dropdown-item:not(.is-unread) .a-header__dropdown-item__dot { background: transparent; }
.a-header__dropdown-item__body { flex: 1; min-width: 0; }
.a-header__dropdown-item__title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary);
  margin-bottom: 2px;
}
.a-header__dropdown-item__meta {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  line-height: 1.4;
}
.a-header__dropdown-footer {
  display: block;
  padding: var(--spacing-3) var(--spacing-4);
  text-align: center;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary);
  text-decoration: none;
  border-top: 1px solid var(--color-primary-soft);
}
.a-header__dropdown-footer:hover { background: var(--color-primary-soft); }

/* User-specific variant — narrower, menu-style */
.a-header__dropdown--user {
  min-width: 240px;
  max-width: 260px;
}
.a-header__dropdown--user .a-header__dropdown-header {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  border-bottom: 1px solid var(--color-primary-soft);
}
.a-header__dropdown--user .a-header__dropdown-item {
  padding: 10px var(--spacing-4);
  font-size: var(--font-size-sm);
}
.a-header__dropdown--user .a-header__dropdown-item--danger { color: var(--color-error); }
.a-header__dropdown--user .a-header__dropdown-item--danger:hover {
  background: var(--color-error-soft);
  color: var(--color-error);
}

.a-main {
  grid-area: main;
  padding: var(--spacing-6);
  background: var(--bg-subtle);
  border-top: 1px solid var(--color-primary-soft);
  border-left: 1px solid var(--color-primary-soft);
  border-radius: 10px 0 0 0;
  overflow-x: hidden;
}

.a-container {
  max-width: var(--container-max);
  margin: 0 auto;
}

/* Standard content wrapper for pages that aren't using full-width sections */
.a-content-wrap {
  max-width: none;
  margin: 0;
  padding: var(--section-y-sm) var(--content-pad-x);
  width: 100%;
}
.a-content-wrap--flush-bottom { padding-bottom: 0; }
.a-content-wrap--top-left { padding-top: var(--content-pad-x); }
.a-detail-layout { width: 100%; max-width: none; margin: 0; padding: 0; }
.a-detail-grid {
  grid-template-columns: minmax(0, 3fr) minmax(320px, 1fr);
  gap: var(--spacing-6);
  margin-top: 0;
  align-items: start;
}
@media (max-width: 1023px) {
  .a-detail-grid { grid-template-columns: 1fr; }
}

.a-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--spacing-4);
  padding-top: var(--spacing-4);
  margin-bottom: var(--page-header-gap);
  flex-wrap: wrap;
}

/* Full-width light-blue band holding the breadcrumb + page title + key actions */
.a-page-band {
  background-color: var(--color-primary-soft);
  background-image:
    linear-gradient(rgba(230, 236, 245, 0.4), rgba(230, 236, 245, 0.4)),
    url("../images/header-bg.jpg");
  background-size: cover;
  background-position: center right;
  background-repeat: no-repeat;
  padding: var(--content-pad-x) 0 var(--spacing-8);
  border-top-left-radius: 10px;
  border-bottom: 1px solid var(--border-color);
  position: relative;
}
/* Erase main's left border within the band's vertical range so it stops at the curve */
.a-page-band::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -1px;
  width: 1px;
  background: var(--bg-subtle);
  pointer-events: none;
}
.a-page-band__inner {
  max-width: none;
  margin: 0;
  padding: 0 var(--content-pad-x);
}
.a-page-band .a-context-bar,
.a-hero .a-context-bar,
.a-section--navy .a-context-bar {
  padding: 0;
  margin: 0 0 var(--spacing-6);
  background: transparent;
  color: var(--color-primary);
}
.a-page-band .a-context-bar a,
.a-hero .a-context-bar a,
.a-section--navy .a-context-bar a {
  color: var(--color-primary);
  opacity: 0.75;
}
.a-page-band .a-context-bar a:hover,
.a-hero .a-context-bar a:hover,
.a-section--navy .a-context-bar a:hover { opacity: 1; }
.a-page-band .a-context-bar .text-muted,
.a-hero .a-context-bar .text-muted,
.a-section--navy .a-context-bar .text-muted { color: var(--color-primary); opacity: 0.75; }
.a-page-band .a-page-header,
.a-hero .a-page-header,
.a-section--navy .a-page-header {
  padding-top: 0;
  margin-bottom: 0;
}
/* kill trailing margin on the last child of the band's header so the bottom padding is clean */
.a-page-band .a-page-header > div > :last-child,
.a-hero .a-page-header > div > :last-child,
.a-section--navy .a-page-header > div > :last-child {
  margin-bottom: 0;
}
.a-page-band .a-page-header__title,
.a-hero .a-page-header__title,
.a-section--navy .a-page-header__title { color: var(--color-primary); }
.a-page-band .a-page-header__subtitle,
.a-hero .a-page-header__subtitle,
.a-section--navy .a-page-header__subtitle { color: var(--text-secondary); margin-bottom: 0; }

/* Buttons inside header bands sit on a patterned background, so outlined
   variants need a solid fill to stay readable. Filled variants (primary,
   on-navy) already have their own backgrounds and are unaffected. */
.a-page-band .a-btn--outline,
.a-hero .a-btn--outline,
.a-section--navy .a-btn--outline,
.a-page-band .a-btn--secondary,
.a-hero .a-btn--secondary,
.a-section--navy .a-btn--secondary,
.a-page-band .a-btn--on-navy-outline,
.a-hero .a-btn--on-navy-outline,
.a-section--navy .a-btn--on-navy-outline {
  background: #FFFFFF;
}
.a-page-band .a-btn--outline:hover,
.a-hero .a-btn--outline:hover,
.a-section--navy .a-btn--outline:hover,
.a-page-band .a-btn--secondary:hover,
.a-hero .a-btn--secondary:hover,
.a-section--navy .a-btn--secondary:hover,
.a-page-band .a-btn--on-navy-outline:hover,
.a-hero .a-btn--on-navy-outline:hover,
.a-section--navy .a-btn--on-navy-outline:hover {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}
/* Secondary's grey border reads as dirt on the navy band — match it to the fill */
.a-page-band .a-btn--secondary,
.a-hero .a-btn--secondary,
.a-section--navy .a-btn--secondary {
  border-color: #FFFFFF;
}
.a-page-band .a-btn--secondary:hover,
.a-hero .a-btn--secondary:hover,
.a-section--navy .a-btn--secondary:hover {
  border-color: var(--color-primary-soft);
}
/* Ghost / link buttons inside bands also get a solid white fill for legibility */
.a-page-band .a-btn--ghost,
.a-hero .a-btn--ghost,
.a-section--navy .a-btn--ghost,
.a-page-band .a-btn--link,
.a-hero .a-btn--link,
.a-section--navy .a-btn--link {
  background: #FFFFFF;
}
.a-page-band .a-btn--ghost:hover,
.a-hero .a-btn--ghost:hover,
.a-section--navy .a-btn--ghost:hover,
.a-page-band .a-btn--link:hover,
.a-hero .a-btn--link:hover,
.a-section--navy .a-btn--link:hover {
  background: #FFFFFF;
}

.a-page-header__title {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary);
  margin-bottom: var(--spacing-2);
  /* Long titles (e.g. full action names) wrap instead of stretching the band */
  max-width: 550px;
  overflow-wrap: break-word;
}

.a-page-header__subtitle {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  margin: 0;
  /* Long descriptions stay readable: same measure as the title, two lines max */
  max-width: 550px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.a-breadcrumbs {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  margin-bottom: var(--spacing-2);
}

.a-breadcrumbs a { color: var(--text-secondary); }
.a-breadcrumbs a:hover { color: var(--color-primary); }

/* Auth shell */
.a-auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--spacing-6);
  /* Latest design (Figma 72:* revisions): light wave background, consistent with the dashboard. */
  background: linear-gradient(160deg, var(--bg-surface) 0%, var(--color-primary-soft) 100%);
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  gap: var(--spacing-4);
}

.a-auth__card {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  padding: var(--spacing-10);
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}
.a-auth__forgot { display: block; margin-top: var(--spacing-3); text-align: center; }
.a-auth__footer-links { display: flex; justify-content: center; gap: var(--spacing-5); color: var(--text-secondary); }
.a-auth__card--md { max-width: 520px; }
.a-auth__card--lg { max-width: 560px; }

/* Mobile: shrink card padding so fixed-width content (e.g. the 6-box OTP row) fits ≤375px. */
@media (max-width: 480px) {
  .a-auth { padding: var(--spacing-4); }
  .a-auth__card { padding: var(--spacing-6); }
}

/* Document hub — category folder cards (grid view) */
.a-folder-card:hover,
.a-folder-card:focus-visible {
  border-color: var(--color-primary) !important;
  box-shadow: var(--shadow-sm);
  outline: none;
}

.a-auth__brand {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  margin-bottom: var(--spacing-8);
  justify-content: center;
  color: var(--color-primary);
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-lg);
}

.a-auth__heading {
  text-align: center;
  margin-bottom: var(--spacing-6);
}

.a-auth__title {
  font-size: var(--font-size-xl);
  margin-bottom: var(--spacing-1);
  text-align: center;
}

.a-auth__lede {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  margin: 0 0 var(--spacing-4);
  text-align: center;
  line-height: 1.5;
}

/* ==========================================================================
   4. Buttons
   ========================================================================== */
.a-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-2);
  padding: 8px 16px;                      /* compact, consistent default */
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  line-height: 1.3;
  min-height: 36px;                       /* still meets WCAG 2.5.5 (AA 24px) with headroom */
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 80ms ease;
  border: 1px solid transparent;
  background: transparent;
  white-space: nowrap;
}

.a-btn:focus-visible {
  outline: 0;
  box-shadow: var(--shadow-focus);
}

.a-btn:disabled,
.a-btn.is-disabled {
  opacity: 0.5;
  pointer-events: none;
}

.a-btn--primary {
  background: var(--color-primary);
  color: #FFFFFF;
  border: 1px solid var(--color-primary);
}
.a-btn--primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  color: #FFFFFF;
  text-decoration: none;
}

.a-btn--secondary {
  background: var(--gray-150);
  color: var(--color-secondary);
  border: 1px solid var(--gray-150);
}
.a-btn--secondary:hover {
  background: var(--gray-200);
  border-color: var(--gray-200);
  text-decoration: none;
  color: var(--color-secondary);
}

.a-btn--outline {
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
}
/* Adjacent buttons get a small gap — fallback for non-flex parents */
.a-btn + .a-btn { margin-left: var(--spacing-2); }
.a-btn--outline:hover {
  background: var(--gray-100);
  text-decoration: none;
  color: var(--color-secondary);
}

.a-btn--danger {
  background: var(--color-error);
  color: #FFFFFF;
  border: 1px solid var(--color-error);
}
.a-btn--danger:hover {
  background: #B62936;
  border-color: #B62936;
  text-decoration: none;
  color: #FFFFFF;
}

.a-btn--ghost {
  color: var(--color-primary);
}
.a-btn--ghost:hover {
  background: var(--color-primary-soft);
  text-decoration: none;
}

.a-btn--link {
  color: var(--color-primary);
  padding: 0;
  background: transparent;
}
.a-btn--link:hover {
  text-decoration: underline;
}

.a-btn--sm {
  font-size: var(--font-size-xs);
  padding: 6px 12px;
  min-height: 30px;
}

/* --lg alias — kept for legacy class usage but now visually identical to base
   so every button reads the same size regardless of which modifier is applied. */
.a-btn--lg {
  font-size: var(--font-size-sm);
  padding: 8px 16px;
  min-height: 36px;
}

.a-btn--outline {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: transparent;
}

.a-btn--outline:hover {
  background: var(--color-primary);
  color: #FFFFFF;
  text-decoration: none;
}

.a-btn.is-loading {
  pointer-events: none;
  opacity: 0.7;
  position: relative;
}

/* ==========================================================================
   5. Cards
   ========================================================================== */
.a-card {
  background: var(--bg-surface);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-5);
}

.a-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-4);
}

.a-card__title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  margin: 0;
}

.a-card__body { margin-top: var(--spacing-2); }
.a-card__footer {
  margin-top: var(--spacing-5);
  padding-top: var(--spacing-4);
  border-top: var(--border-width) solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: var(--spacing-3);
}

.a-card--flat { border: 0; box-shadow: none; padding: var(--spacing-4); }
.a-card--elevated { border: 0; box-shadow: var(--shadow-md); }
.a-card--upload {
  border: 2px dashed var(--border-color-strong);
  background: var(--bg-subtle);
  text-align: center;
  padding: var(--spacing-8);
}
.a-card--sm { padding: var(--spacing-3); }
.a-card--lg { padding: var(--spacing-8); }
.a-card--muted { background: var(--bg-subtle); border-color: var(--border-color); }

.a-content-card {
  background: var(--bg-surface);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: var(--spacing-6);
  overflow: hidden;
}

.a-content-card--flush-body .a-content-card__body { padding-bottom: 0; }

.a-content-header {
  padding: var(--spacing-5) var(--spacing-6);
  border-bottom: var(--border-width) solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--spacing-4);
}

.a-content-title {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
}

.a-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  margin: 0;
}
.a-title--sm { font-size: var(--font-size-base); }
.a-title--lg { font-size: var(--font-size-2xl); }

.a-content-controls {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  flex-wrap: wrap;
}

.a-content-card__body {
  padding: var(--spacing-5) var(--spacing-6);
}

/* Stat tile card */
.a-stat {
  background: var(--bg-surface);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--spacing-5) var(--spacing-6);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-2);
}

.a-stat__label {
  font-size: var(--font-size-uppercase);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: var(--font-weight-semibold);
}

.a-stat__value {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-extrabold);
  color: var(--color-secondary);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.a-stat__trend {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: var(--spacing-1);
}

.a-stat__trend--up { color: var(--color-success); }
.a-stat__trend--down { color: var(--color-error); }
.a-stat--link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}
.a-stat--link:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
  text-decoration: none;
}
.a-stat--link:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ==========================================================================
   6. Badges
   ========================================================================== */
.a-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-1);
  font-size: 14px;
  font-weight: var(--font-weight-semibold);
  padding: 2px var(--spacing-2);
  border-radius: var(--radius-full);
  background: #F2F5FA;
  color: var(--color-primary);
  line-height: 1.3;
  white-space: nowrap;
}
.a-badge--success { background: #EAF6EE; color: var(--color-success); }
.a-badge--warning { background: #FCF4E0; color: #8B6A00; }
.a-badge--error   { background: #FBEBEE; color: var(--color-error); }
.a-badge--info    { background: #EAF3FB; color: var(--color-info); }
.a-badge--muted   { background: #F2F5FA; color: var(--text-secondary); }
.a-badge--primary { background: var(--color-primary-soft); color: var(--color-primary); }
.a-badge--sm { font-size: var(--font-size-2xs); padding: 1px var(--spacing-2); }
.a-badge--lg { font-size: var(--font-size-sm); padding: var(--spacing-1) var(--spacing-3); }
.a-badge--link { text-decoration: none; }
.a-badge--link:hover { background: var(--color-primary-soft); color: var(--color-primary); }
/* "Current" indicator — small dot-style, reads clearly against the subtle navy row highlight */
.a-badge--current {
  background: transparent;
  color: var(--color-primary);
  font-size: var(--font-size-uppercase);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 0 0 12px;
  position: relative;
  font-weight: var(--font-weight-bold);
  /* Breathing room after the preceding label (the dot's glow ring needs it) */
  margin-left: var(--spacing-2);
}
.a-badge--current::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(15, 44, 92, 0.15);
}

.a-count-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-2);
}

.a-count-badge__link {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--color-primary);
}

/* ==========================================================================
   7. Forms
   ========================================================================== */
.a-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-4);
}

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

.a-check {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  cursor: pointer;
  font-size: var(--font-size-sm);
}

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

.form-group {
  margin-bottom: var(--spacing-4);
}

.form-label {
  display: block;
  margin-bottom: var(--spacing-1);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-secondary);
}

.form-label.required::after {
  content: "*";
  color: var(--color-error);
  margin-left: 4px;
}
.form-label.required:has(.form-required)::after { content: none; }

.form-help {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  margin-top: var(--spacing-1);
}

.form-control,
.form-select,
input[type="text"],
input[type="search"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
textarea,
select {
  display: block;
  width: 100%;
  padding: var(--spacing-2) var(--spacing-3);
  font-family: inherit;
  font-size: var(--font-size-sm);
  line-height: 1.4;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: var(--border-width) solid var(--input-border-color);
  border-radius: var(--radius-md);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

select:not([multiple]) {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230F2C5C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}
.a-custom-select-menu {
  position: fixed;
  z-index: 200;
  max-height: min(360px, 60vh);
  overflow-y: auto;
  padding: var(--spacing-1);
  background: #fff;
  border: 1px solid var(--border-color-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}
.a-custom-select-menu__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-3);
  width: 100%;
  padding: 9px var(--spacing-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text-primary);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.a-custom-select-menu__option:hover,
.a-custom-select-menu__option.is-selected { background: var(--color-primary-soft); }
.a-custom-select-menu__option.is-selected { color: var(--color-primary); font-weight: var(--font-weight-semibold); }

.a-custom-date-menu {
  position: fixed;
  z-index: 210;
  padding: var(--spacing-3);
  background: #fff;
  border: 1px solid var(--border-color-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  color: var(--color-primary);
  max-width: calc(100vw - 16px);
}
.a-custom-date-menu__header,
.a-custom-date-menu__footer { display: flex; align-items: center; justify-content: space-between; gap: var(--spacing-2); }
.a-custom-date-menu__header { padding-bottom: var(--spacing-3); border-bottom: 1px solid var(--border-color); }
.a-custom-date-menu__header button,
.a-custom-date-menu__footer button,
.a-custom-date-menu__grid button {
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-primary);
  font: inherit;
  cursor: pointer;
}
.a-custom-date-menu__header button { width: 34px; height: 34px; font-size: 22px; }
.a-custom-date-menu__header button:hover,
.a-custom-date-menu__footer button:hover,
.a-custom-date-menu__grid button:hover { background: var(--color-primary-soft); }
.a-custom-date-menu__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; padding: var(--spacing-3) 0; text-align: center; }
.a-custom-date-menu__weekday { padding: 4px 0; color: var(--text-muted); font-size: var(--font-size-uppercase); font-weight: var(--font-weight-semibold); }
.a-custom-date-menu__grid button { aspect-ratio: 1; min-width: 34px; }
.a-custom-date-menu__grid button.is-today { box-shadow: inset 0 0 0 1px var(--color-primary); }
.a-custom-date-menu__grid button.is-selected { background: var(--color-primary); color: #fff; font-weight: var(--font-weight-semibold); }
.a-custom-date-menu__footer { padding-top: var(--spacing-2); border-top: 1px solid var(--border-color); }
.a-custom-date-menu__footer button { padding: 6px var(--spacing-2); text-decoration: underline; }

.a-repeatable-table { display: grid; gap: var(--spacing-3); }
.a-repeatable-table__scroll { overflow-x: auto; border: 1px solid var(--border-color); border-radius: var(--radius-md); }
.a-repeatable-table table { width: 100%; min-width: 1120px; border-collapse: collapse; }
.a-repeatable-table th,
.a-repeatable-table td { padding: var(--spacing-2); border-bottom: 1px solid var(--border-color); text-align: left; vertical-align: middle; }
.a-repeatable-table th { min-width: 130px; background: var(--surface-subtle); color: var(--text-secondary); font-size: var(--font-size-sm); }
.a-repeatable-table th:nth-child(2) { min-width: 230px; }
.a-repeatable-table tbody tr:last-child td { border-bottom: 0; }
.a-repeatable-table tfoot td { background: var(--color-primary-soft); font-weight: var(--font-weight-semibold); }
.a-repeatable-table__total { min-width: 90px; font-variant-numeric: tabular-nums; font-weight: var(--font-weight-semibold); }

/* Placeholder text — muted navy so inputs read as part of the same colour family */
input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

.form-control:focus,
.form-select:focus {
  outline: 0;
  border-color: var(--color-primary);
  box-shadow: var(--shadow-focus);
}

.form-control:disabled {
  background: var(--gray-100);
  cursor: not-allowed;
}

textarea.form-control {
  min-height: 96px;
  resize: vertical;
}

.has-error .form-control {
  border-color: var(--color-error);
}
.invalid-feedback {
  display: none;
  font-size: var(--font-size-xs);
  color: var(--color-error);
  margin-top: var(--spacing-1);
}
.has-error .invalid-feedback { display: block; }

.form-check,
.form-switch {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  margin-bottom: var(--spacing-2);
}

.form-check-input {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
}

.form-switch .form-check-input {
  width: 32px;
  height: 18px;
}

.form-actions {
  display: flex;
  gap: var(--spacing-3);
  justify-content: flex-end;
  margin-top: var(--spacing-6);
  margin-bottom: var(--spacing-6);
}
.a-notification-preferences {
  border-top: 1px solid var(--border-color);
}
.a-notification-preference {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, auto);
  align-items: center;
  gap: var(--spacing-6);
  padding: var(--spacing-4) 0;
  border-bottom: 1px solid var(--border-color);
}
.a-notification-preference .form-label,
.a-notification-preference .form-help,
.a-notification-preference .form-switch { margin: 0; }
.a-notification-preference .form-switch { justify-self: end; }
.a-notification-preference .form-select { min-width: 180px; }
@media (max-width: 600px) {
  .a-notification-preference { grid-template-columns: 1fr; gap: var(--spacing-2); }
  .a-notification-preference .form-switch { justify-self: start; }
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-4);
}

.form-grid--single {
  grid-template-columns: 1fr;
}

.form-grid__full {
  grid-column: 1 / -1;
}

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

/* ==========================================================================
   8. Alerts
   ========================================================================== */
.a-alert {
  display: flex;
  gap: var(--spacing-3);
  padding: var(--spacing-4);
  border-radius: var(--radius-md);
  border: var(--border-width) solid transparent;
  margin-bottom: var(--spacing-4);
  font-size: var(--font-size-sm);
}

.a-alert--success { background: var(--color-success-soft); color: var(--color-success); border-color: rgba(40, 167, 69, 0.2); }
.a-alert--warning { background: var(--color-warning-soft); color: #8B6A00; border-color: rgba(255, 193, 7, 0.35); }
.a-alert--error { background: var(--color-error-soft); color: var(--color-error); border-color: rgba(220, 53, 69, 0.2); }
.a-alert--info { background: var(--color-info-soft); color: var(--color-info); border-color: rgba(30, 136, 229, 0.2); }

.a-alert-icon { flex-shrink: 0; width: 20px; height: 20px; }
.a-alert-title { font-weight: var(--font-weight-semibold); margin-bottom: var(--spacing-1); }
.a-alert-message { color: inherit; }
.a-alert-title,
.a-alert-message,
.a-alert a { color: var(--color-primary); }
.a-alert--dismissible { position: relative; align-items: flex-start; padding-right: var(--spacing-10); }
.a-alert__close {
  position: absolute;
  top: var(--spacing-2);
  right: var(--spacing-2);
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: currentColor;
  font: inherit;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.a-alert__close:hover { background: rgba(255, 255, 255, 0.65); }
.a-alert__close-link { margin-top: var(--spacing-2); padding: 0; border: 0; background: transparent; color: currentColor; font: inherit; text-decoration: underline; cursor: pointer; }
.a-document-alert__count { min-width: 32px; min-height: 32px; display: inline-grid; place-items: center; font-size: var(--font-size-base); }

/* ==========================================================================
   9. Modals
   ========================================================================== */
.a-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 44, 92, 0.5);
  display: grid;
  place-items: center;
  padding: var(--spacing-4);
  z-index: 50;
}

.a-modal {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.a-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-5) var(--spacing-6);
  border-bottom: var(--border-width) solid var(--border-color);
}

.a-modal__title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  margin: 0;
}

.a-modal__close {
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: var(--font-size-xl);
  padding: 0;
  line-height: 1;
}

.a-modal__body { padding: var(--spacing-6); }

.a-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--spacing-3);
  padding: var(--spacing-4) var(--spacing-6);
  border-top: var(--border-width) solid var(--border-color);
  background: var(--bg-subtle);
}

/* ==========================================================================
   10. Tables
   ========================================================================== */
.a-table-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  padding-bottom: 0;
}
/* When a table-wrap sits inside a content card it inherits the card's chrome */
.a-content-card .a-table-wrap {
  border-radius: 0;
  overflow: visible;
}
.a-table-wrap--overflow-visible { overflow: visible; }

.a-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-4) 0;
  border: 0;
  gap: var(--spacing-4);
  flex-wrap: wrap;
}
.a-table-header:only-child,
.a-table-header + table { margin-top: 0; }

/* Search input pushes all following filter controls to the right */
.a-table-header .a-search-wrap { margin-right: auto; }
.a-table-controls {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  flex-wrap: wrap;
  width: 100%;
}
.a-table-controls .a-search-wrap { margin-right: auto; }

.a-table-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  margin: 0;
}

.a-table-controls {
  display: flex;
  gap: var(--spacing-3);
  align-items: center;
  flex-wrap: wrap;
  padding: 0 var(--spacing-4);
}

.a-search-wrap input {
  min-width: 260px;
}

.a-filter-wrap select {
  min-width: 160px;
}

.a-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.a-table th {
  text-align: left;
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-uppercase);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary, var(--text-secondary));
  padding: var(--spacing-3) var(--spacing-5);
  background: transparent;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.a-table td {
  padding: var(--spacing-4) var(--spacing-5);
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.a-table tbody tr:last-child td { border-bottom: 0; }
.a-table tbody tr:hover { background: var(--bg-subtle); }

/* Subtle "current" row highlight — near-white navy tint with a navy left accent */
.a-table tbody tr.is-current { background: #F5F8FC; position: relative; }
.a-table tbody tr.is-current td { box-shadow: none; }
.a-table tbody tr.is-current td:first-child {
  border-left: 3px solid var(--color-primary);
  padding-left: calc(var(--spacing-5) - 3px);
}
.a-table tbody tr.is-current:hover { background: #EEF3FA; }

.td-avatar-name {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
}
.a-tenant-name-link { display: inline-block; color: inherit; text-decoration: none; }
.a-tenant-name-link .name { color: var(--color-primary); text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; }
.a-tenant-name-link:hover .name { text-decoration-color: currentColor; }

.td-avatar-name img,
.td-avatar-name .avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: #FFF;
  display: grid;
  place-items: center;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
}

.td-actions {
  text-align: right;
}

.a-actions {
  display: inline-flex;
  gap: var(--spacing-1);
}

.a-action {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius-md);
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 120ms, color 120ms;
}

.a-action:hover { background: var(--gray-150); color: var(--color-primary); }
.a-action--delete:hover { color: var(--color-error); background: var(--color-error-soft); }
.a-action--danger:hover { color: var(--color-error); }
.a-action--success:hover { color: var(--color-success); }
.a-action--view:hover { color: var(--color-info); background: var(--color-info-soft); }
.a-action--edit:hover { color: var(--color-primary); background: var(--color-primary-soft); }
.a-action--download:hover { color: var(--color-success); background: var(--color-success-soft); }

/* Table pagination */
.a-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-3) var(--spacing-6);
  border-top: var(--border-width) solid var(--border-color);
  background: #fff;
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

.a-pagination__pages {
  display: flex;
  gap: var(--spacing-1);
}
.a-pagination__controls,
.a-pagination__size {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
}
.a-pagination__size .form-control { width: auto; min-width: 72px; padding-block: 4px; }
.a-pagination__pages { align-items: center; }

.a-pagination__page {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  border: var(--border-width) solid transparent;
  color: var(--color-secondary);
  background: transparent;
  cursor: pointer;
  text-decoration: none;
}

.a-pagination__page.is-active {
  background: var(--color-primary);
  color: #FFF;
}

/* ==========================================================================
   11. Icons
   ========================================================================== */
.a-icon {
  display: inline-grid;
  place-items: center;
  color: currentColor;
}

.a-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
}

.a-icon--xs { width: 12px; height: 12px; }
.a-icon--sm { width: 16px; height: 16px; }
.a-icon--md { width: 20px; height: 20px; }
.a-icon--lg { width: 24px; height: 24px; }
.a-icon--xl { width: 32px; height: 32px; }

.a-icon--primary { color: var(--color-primary); }
.a-icon--success { color: var(--color-success); }
.a-icon--error { color: var(--color-error); }
.a-icon--warning { color: #B98900; }
.a-icon--info { color: var(--color-info); }

/* ==========================================================================
   12. Utilities
   ========================================================================== */
.hidden { display: none !important; }
.block { display: block; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }

.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--spacing-1); }
.gap-2 { gap: var(--spacing-2); }
.gap-3 { gap: var(--spacing-3); }
.gap-4 { gap: var(--spacing-4); }
.gap-6 { gap: var(--spacing-6); }

.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }

.w-full { width: 100%; }
.w-auto { width: auto; }
.h-full { height: 100%; }

.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

.text-center { text-align: center; }
.text-left { text-align: left; }

.mt-1 { margin-top: var(--spacing-1); }
.mt-2 { margin-top: var(--spacing-2); }
.mt-3 { margin-top: var(--spacing-3); }
.mt-4 { margin-top: var(--spacing-4); }
.mt-5 { margin-top: var(--spacing-5); }
.mt-6 { margin-top: var(--spacing-6); }
.mt-8 { margin-top: var(--spacing-8); }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--spacing-1); }
.mb-2 { margin-bottom: var(--spacing-2); }
.mb-3 { margin-bottom: var(--spacing-3); }
.mb-4 { margin-bottom: var(--spacing-4); }
.mb-5 { margin-bottom: var(--spacing-5); }
.mb-6 { margin-bottom: var(--spacing-6); }
.p-3 { padding: var(--spacing-3); }
.p-3 { padding: var(--spacing-3); }
.p-4 { padding: var(--spacing-4); }
.p-5 { padding: var(--spacing-5); }
.p-6 { padding: var(--spacing-6); }

/* Grid primitives */
.a-grid {
  display: grid;
  gap: var(--spacing-4);
}
.a-grid--2 { grid-template-columns: repeat(2, 1fr); }
.a-grid--3 { grid-template-columns: repeat(3, 1fr); }
.a-grid--4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1023px) {
  .a-grid--4 { grid-template-columns: repeat(2, 1fr); }
  .a-grid--3 { grid-template-columns: repeat(2, 1fr); }
  .a-header__user-meta { display: none; }
}
@media (max-width: 767px) {
  .a-grid--4, .a-grid--3, .a-grid--2 { grid-template-columns: 1fr; }
  .a-app {
    grid-template-columns: 1fr;
    grid-template-areas: "header" "main";
  }
  .a-app.is-sidebar-collapsed { grid-template-columns: 1fr; }
  .is-sidebar-collapsed .a-sidebar { width: 280px; padding: var(--spacing-6) var(--spacing-4); }
  .is-sidebar-collapsed .a-sidebar__logo { display: block; }
  .is-sidebar-collapsed .a-sidebar__brand-compact { display: none; }
  .is-sidebar-collapsed .a-sidebar__section-label { display: block; }
  .is-sidebar-collapsed .a-nav__label { display: inline; }
  .is-sidebar-collapsed .a-sidebar__logo,
  .is-sidebar-collapsed .a-sidebar__section-label,
  .is-sidebar-collapsed .a-nav__label { max-width: 220px; opacity: 1; }
  .is-sidebar-collapsed .a-nav__link,
  .is-sidebar-collapsed .a-sidebar__collapse { justify-content: flex-start; padding-inline: var(--spacing-3); }

  /* Sidebar becomes a slide-in drawer, closed by default */
  .a-sidebar {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 220ms cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 2px 0 16px rgba(15, 44, 92, 0.08);
  }
  body.sidebar-open .a-sidebar { transform: translateX(0); }

  /* Full-screen overlay behind the drawer */
  .a-sidebar__overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 44, 92, 0.35);
    z-index: 45;
    border: 0;
    padding: 0;
    animation: a-overlay-fade 180ms ease forwards;
  }
  @keyframes a-overlay-fade { from { opacity: 0; } to { opacity: 1; } }

  /* Mobile-only header controls */
  .a-header__menu-toggle { display: grid !important; }
  .a-header__brand { display: flex !important; }

  /* Tighter mobile header */
  .a-header {
    padding: 0 var(--spacing-4);
    gap: var(--spacing-3);
  }
  .a-header__search { display: none; }
  .a-header__tenant-tag { display: none; }
  .a-header__user-meta { display: none; }
  .a-header__spacer { flex: 1; }

  /* Table actions: wrap below rather than squeeze */
  .a-content-header { flex-direction: column; align-items: stretch; gap: var(--spacing-3); }
  .a-content-controls { width: 100%; }

  /* Page band & hero: tighten padding */
  .a-page-band__inner, .a-section__inner, .a-hero__inner { padding: 0 var(--spacing-4); }
  .a-page-header { flex-direction: column; align-items: stretch; gap: var(--spacing-4); }
  .a-page-header > div:last-child { display: flex; flex-wrap: wrap; gap: var(--spacing-2); }

  /* Main border-radius/border looks odd when sidebar is drawered — flatten */
  .a-main {
    border-radius: 0;
    border-left: 0;
  }
  .a-sidebar__brand { align-items: flex-start; }
  .a-sidebar__mobile-close {
    display: grid;
    place-items: center;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    margin-left: auto;
    border: 1px solid var(--input-border-color);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--color-primary);
    cursor: pointer;
  }
}

.a-folder-grid { margin-bottom: 0; gap: var(--spacing-4); }
.a-folder-card { text-align: left; cursor: pointer; color: inherit; text-decoration: none; }
.a-folder-card:hover { text-decoration: none; border-color: var(--color-primary); }
.a-folder-card.is-active { border-color: var(--color-primary); background: var(--color-primary-soft); }
.a-folder-card__icon { display: inline-grid; width: 24px; height: 24px; color: var(--color-primary); margin-bottom: var(--spacing-2); }
.a-folder-card__icon svg { width: 100%; height: 100%; }
.a-folder-card__title { font-size: var(--font-size-base); font-weight: var(--font-weight-bold); margin-bottom: 2px; }
.a-page-header__title--folder { font-size: var(--font-size-xl); }
.a-checkbox-group { display: grid; gap: var(--spacing-2); padding: var(--spacing-2) 0; }
.a-checkbox-group .form-check { margin: 0; }
.a-custom-date-menu__manual { padding: var(--spacing-3) 0 0; }
.a-custom-date-menu__manual > label { display: block; font-size: var(--font-size-xs); font-weight: var(--font-weight-semibold); margin-bottom: var(--spacing-1); }
.a-custom-date-menu__manual > div { display: grid; grid-template-columns: 1fr auto; gap: var(--spacing-2); }
.a-custom-date-menu__manual input { min-width: 0; border: 1px solid var(--input-border-color); border-radius: var(--radius-sm); padding: var(--spacing-2); }
.a-custom-date-menu__manual input[aria-invalid="true"] { border-color: var(--color-danger); }
.a-custom-date-menu__manual span { color: var(--color-danger); display: block; font-size: var(--font-size-xs); margin-top: var(--spacing-1); }
.a-workflow-actions { display: flex; gap: var(--spacing-2); }
.a-workflow-editor { display: grid; grid-template-columns: minmax(260px, 36%) 1fr; gap: var(--spacing-6); align-items: start; }
.a-workflow-stages { display: grid; gap: var(--spacing-3); }
.a-workflow-stage { display: grid; gap: var(--spacing-1); text-align: left; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: #fff; color: var(--text-primary); padding: var(--spacing-4); cursor: grab; }
.a-workflow-stage > span { color: var(--text-secondary); font-size: var(--font-size-xs); text-align: center; }
.a-workflow-stage > small { color: var(--text-secondary); }
.a-workflow-stage.is-active { border-color: var(--color-primary); background: var(--color-primary-soft); }
.a-workflow-detail__heading { display: flex; align-items: center; justify-content: space-between; gap: var(--spacing-3); }
.a-workflow-approval-settings { display: grid; gap: var(--spacing-4); margin-top: var(--spacing-4); padding: var(--spacing-4); background: var(--surface-muted); border-radius: var(--radius-md); }
@media (max-width: 800px) { .a-workflow-editor { grid-template-columns: 1fr; } }
@media print { .a-sidebar, .a-header, .a-workflow-actions, .a-workflow-detail { display: none !important; } .a-main { margin: 0 !important; } .a-workflow-editor { display: block; } }
.a-folder-skeleton__icon { width: 24px; height: 24px; margin-bottom: var(--spacing-2); border-radius: var(--radius-sm); }
.a-folder-skeleton__short { width: 55%; }
.a-entry-form-layout { width: 100%; }
.a-checklist-email-invite { border-top: 1px solid var(--border-color); padding-top: var(--spacing-5); }
.a-checklist-row-actions { display: flex; justify-content: flex-end; gap: var(--spacing-2); flex-wrap: wrap; }
.a-document-version { display: inline-flex; align-items: center; gap: var(--spacing-1); min-width: max-content; white-space: nowrap; }
.a-framework-assignment-controls { display: flex; align-items: center; gap: var(--spacing-2); }
.a-framework-assignment-controls .form-select { min-width: min(320px, 45vw); }
@media (max-width: 767px) {
  .a-framework-assignment-controls { align-items: stretch; flex-direction: column; }
  .a-framework-assignment-controls .form-select { min-width: 0; }
}
.a-document-new-badge { min-width: 44px; justify-content: center; white-space: nowrap; }
.a-dashboard-action-title { font-weight: var(--font-weight-normal); }
.a-table__clickable-row { cursor: pointer; }
.a-table__clickable-row:hover { background: var(--bg-subtle); }
.a-table__clickable-row:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -2px; }
.a-rich-text { font-size: var(--font-size-base); line-height: 1.7; }
.a-rich-text a { font-weight: var(--font-weight-semibold); text-underline-offset: 2px; }
.a-html-editor {
  border: var(--border-width) solid var(--input-border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  overflow: hidden;
}
.a-html-editor:focus-within {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-focus);
}
.a-html-editor__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-1);
  padding: var(--spacing-2);
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-subtle);
}
.a-html-editor__surface {
  padding: var(--spacing-4);
  color: var(--text-primary);
  font-size: var(--font-size-base);
  line-height: 1.6;
  outline: 0;
}
.a-html-editor__surface p:first-child,
.a-html-editor__surface h2:first-child { margin-top: 0; }
.a-html-editor__surface p:last-child,
.a-html-editor__surface ul:last-child { margin-bottom: 0; }
.a-html-editor .form-help { padding: 0 var(--spacing-4) var(--spacing-3); }

@media (max-width: 767px) {
  .a-folder-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .a-folder-card .a-content-card__body { padding: var(--spacing-3); }
  .a-folder-card__title { overflow-wrap: anywhere; }
  .a-document-table, .a-document-table tbody, .a-document-table tr, .a-document-table td { display: block; width: 100%; }
  .a-document-table thead { display: none; }
  .a-document-table tbody { padding: var(--spacing-3); background: var(--bg-subtle); }
  .a-document-table tbody tr {
    padding: var(--spacing-4);
    margin-bottom: var(--spacing-3);
    border: 1px solid var(--border-color-strong);
    border-radius: var(--radius-md);
    background: #fff;
    box-shadow: var(--shadow-sm);
  }
  .a-document-table tbody tr:last-child { margin-bottom: 0; }
  .a-document-table tbody td {
    display: grid;
    grid-template-columns: minmax(88px, 0.35fr) minmax(0, 1fr);
    gap: var(--spacing-3);
    align-items: start;
    min-width: 0;
    padding: var(--spacing-2) 0;
    border: 0;
    white-space: normal;
  }
  .a-document-table tbody td::before { content: attr(data-label); color: var(--text-muted); font-size: var(--font-size-uppercase); font-weight: var(--font-weight-semibold); text-transform: uppercase; letter-spacing: 0.05em; }
  .a-document-table .td-actions { text-align: left; }
  .a-document-table .td-actions .a-btn { width: fit-content; }
  .a-pagination { align-items: flex-start; flex-direction: column; gap: var(--spacing-3); padding-inline: var(--spacing-4); }
  .a-pagination__controls { width: 100%; justify-content: space-between; flex-wrap: wrap; }
}

.a-tab-strip {
  display: flex;
  gap: var(--spacing-6);
  margin-bottom: var(--spacing-6);
  border-bottom: 2px solid var(--border-color);
}
.a-tab-strip__button {
  padding: 12px 0;
  border: 0;
  border-bottom: 3px solid transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  margin-bottom: -2px;
  background: none;
  cursor: pointer;
}
.a-tab-strip__button.is-active {
  border-bottom-color: var(--color-primary);
  color: var(--color-primary);
  font-weight: var(--font-weight-bold);
}
.a-filter-menu { position: relative; margin-left: auto; }
.a-filter-menu__panel {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  right: 0;
  display: none;
  width: 200px;
  max-width: 200px;
  padding: var(--spacing-3);
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}
.a-filter-menu.is-open .a-filter-menu__panel { display: grid; gap: var(--spacing-3); }
.a-filter-menu__panel label {
  display: grid;
  gap: var(--spacing-1);
  font-size: 14px;
  font-weight: var(--font-weight-semibold);
}
.a-filter-menu__panel .form-select { width: 100%; max-width: 100%; }

/* Mobile menu-toggle + brand — always in the DOM but only visible < 768px */
.a-header__menu-toggle {
  display: none;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-primary);
  border: 0;
  padding: 0;
  cursor: pointer;
}
.a-header__menu-toggle:hover { background: var(--color-primary-soft); }
.a-header__menu-toggle:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(15, 44, 92, 0.2);
}
.a-header__brand {
  display: none;
  align-items: center;
  gap: var(--spacing-2);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  font-size: var(--font-size-base);
  letter-spacing: -0.01em;
}
.a-header__brand-mark {
  width: 28px;
  height: 28px;
  background: var(--color-primary);
  color: #FFFFFF;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  font-weight: var(--font-weight-extrabold);
  font-size: 16px;
}

/* Divider */
.a-divider {
  height: 1px;
  background: var(--border-color);
  margin: var(--spacing-6) 0;
}

/* Empty state */
.a-empty {
  text-align: center;
  padding: var(--spacing-10) var(--spacing-6);
  color: var(--text-secondary);
}

.a-empty__icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--spacing-4);
  color: var(--gray-300);
}

.a-empty__title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-secondary);
  margin-bottom: var(--spacing-1);
}

.a-empty__message {
  font-size: var(--font-size-sm);
  margin-bottom: var(--spacing-4);
}

/* Timeline */
.a-timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 var(--spacing-4);
  border-left: 2px solid var(--border-color);
}

.a-timeline__item {
  position: relative;
  padding: 0 0 var(--spacing-5) var(--spacing-4);
}

.a-timeline__item::before {
  content: "";
  position: absolute;
  left: -21px;
  top: 4px;
  width: 12px;
  height: 12px;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-surface);
}

.a-timeline__time {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

.a-timeline__body {
  font-size: var(--font-size-sm);
  margin-top: var(--spacing-1);
}

/* Risk matrix */
.a-risk-matrix {
  display: grid;
  grid-template-columns: 48px repeat(5, 1fr);
  grid-template-rows: 48px repeat(5, 80px);
  gap: 4px;
}

.a-risk-matrix__y-label,
.a-risk-matrix__x-label {
  display: grid;
  place-items: center;
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  font-weight: var(--font-weight-semibold);
}

.a-risk-matrix--named {
  grid-template-columns: 112px repeat(5, minmax(88px, 1fr));
  grid-template-rows: 56px repeat(5, 80px);
}

.a-risk-matrix--named .a-risk-matrix__x-label,
.a-risk-matrix--named .a-risk-matrix__y-label {
  line-height: 1.2;
  padding: var(--spacing-1);
  text-align: center;
}

.a-risk-matrix__cell {
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  position: relative;
  font-size: var(--font-size-xs);
  color: #FFFFFF;
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, outline-color 120ms ease;
  outline: 2px solid transparent;
  outline-offset: 2px;
}
.a-risk-matrix__cell:hover { transform: scale(1.03); box-shadow: var(--shadow-md); }
.a-risk-matrix__cell.is-active {
  outline-color: var(--color-primary);
  box-shadow: var(--shadow-md);
}

.a-risk-matrix__cell--low { background: var(--color-risk-low); }
.a-risk-matrix__cell--med { background: var(--color-risk-med); color: var(--color-secondary); }
.a-risk-matrix__cell--high { background: var(--color-risk-high); }
.a-risk-matrix__cell--critical { background: var(--color-risk-critical); }

.a-risk-pin {
  position: absolute;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  background: var(--color-secondary);
  border: 2px solid #FFF;
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
  color: #FFF;
  font-size: var(--font-size-2xs);
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.a-risk-pin:hover { transform: scale(1.15); }
.a-risk-pin.is-active {
  background: var(--color-primary);
  transform: scale(1.2);
  box-shadow: 0 0 0 3px rgba(15,44,92,.25), 0 1px 3px rgba(0,0,0,.25);
}
/* Fan out pins when a cell has more than one */
.a-risk-matrix__cell .a-risk-pin:nth-child(1) { transform: translate(-10px, -8px); }
.a-risk-matrix__cell .a-risk-pin:nth-child(2) { transform: translate(10px, -8px); }
.a-risk-matrix__cell .a-risk-pin:nth-child(3) { transform: translate(-10px, 10px); }
.a-risk-matrix__cell .a-risk-pin:nth-child(4) { transform: translate(10px, 10px); }
.a-risk-matrix__cell .a-risk-pin:only-child { transform: none; }
.a-risk-matrix__cell .a-risk-pin.is-active { transform: scale(1.2); z-index: 2; }

.a-risk-tooltip {
  position: fixed;
  pointer-events: none;
  z-index: 50;
  background: var(--color-secondary);
  color: #FFF;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  font-size: var(--font-size-xs);
  line-height: 1.4;
  box-shadow: var(--shadow-lg);
  max-width: 240px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 120ms ease, transform 120ms ease;
}
.a-risk-tooltip.is-visible { opacity: 1; transform: translateY(0); }
.a-risk-tooltip__title { font-weight: var(--font-weight-semibold); margin-bottom: 2px; }
.a-risk-tooltip__meta { color: rgba(255,255,255,.7); font-size: var(--font-size-2xs); }

/* Risk list item selected state */
.a-risk-list-item {
  padding: var(--spacing-4) var(--spacing-5);
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 120ms ease, border-left-color 120ms ease;
}
.a-risk-list-item:hover { background: var(--bg-subtle); }
.a-risk-list-item > div { align-items: center; }
.a-risk-list-item .a-badge { flex: 0 0 auto; min-height: 22px; padding-block: 1px; line-height: 1.15; }
.a-risk-list-item.is-active {
  background: var(--color-primary-soft);
  border-left-color: var(--color-primary);
}

/* View toggle (Inherent/Residual) */
.a-view-toggle { display: inline-flex; background: var(--gray-100); border-radius: var(--radius-md); padding: 3px; }
.a-view-toggle__btn {
  background: transparent;
  border: 0;
  padding: 6px 12px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--text-secondary);
  border-radius: calc(var(--radius-md) - 2px);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
  font-family: inherit;
}
.a-view-toggle__btn:hover { color: var(--color-primary); }
.a-view-toggle__btn.is-active {
  background: #FFF;
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

/* Progress + Stepper */
.a-progress {
  height: 8px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.a-progress__bar {
  height: 100%;
  background: var(--color-primary);
  transition: width 200ms ease;
}
.a-progress__bar--success { background: var(--color-success); }

.a-stepper {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  margin-bottom: var(--spacing-6);
  flex-wrap: wrap;
}

.a-stepper__item {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.a-stepper__item.is-active { color: var(--color-primary); font-weight: var(--font-weight-semibold); }
.a-stepper__item.is-done { color: var(--color-success); }

.a-stepper__bullet {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--gray-200);
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
}

.a-stepper__item.is-active .a-stepper__bullet { background: var(--color-primary); color: #FFFFFF; }
.a-stepper__item.is-done .a-stepper__bullet { background: var(--color-success); color: #FFFFFF; }

/* Comment thread */
.a-comments {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-4);
}

.a-comment {
  display: flex;
  gap: var(--spacing-3);
}

.a-comment__avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: #FFF;
  display: grid;
  place-items: center;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  flex-shrink: 0;
}

.a-comment__body {
  background: var(--bg-subtle);
  padding: var(--spacing-3) var(--spacing-4);
  border-radius: var(--radius-md);
  flex: 1;
}

.a-comment--cc-only .a-comment__body {
  background: var(--color-accent-soft);
  border-left: 3px solid var(--color-accent);
}

.a-comment__meta {
  display: flex;
  gap: var(--spacing-2);
  align-items: baseline;
  font-size: var(--font-size-xs);
  margin-bottom: var(--spacing-1);
}

.a-comment__author { font-weight: var(--font-weight-semibold); color: var(--color-secondary); }
.a-comment__time { color: var(--text-secondary); }

/* Evidence list */
.a-evidence {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-2);
  margin-top: var(--spacing-3);
}

.a-evidence__item {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  padding: var(--spacing-2) var(--spacing-3);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.a-evidence__file {
  flex: 1;
  font-size: var(--font-size-sm);
  color: var(--color-secondary);
}

.a-evidence__meta {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

/* ==========================================================================
   12b. Section primitives (NSW-gov-style alternation)
   ========================================================================== */
.a-section {
  padding: var(--section-y) 0;
  background: var(--bg-surface);
}
.a-section--soft {
  background: var(--bg-subtle);
}
.a-section--cream {
  background: var(--bg-cream);
}
/* Light-blue page band — matches sidebar active-state tint, navy text
   `.a-section--navy` and `.a-hero` both alias to the same .a-page-band look */
.a-section--navy {
  --text-on-navy: var(--color-primary);
  --text-on-navy-muted: var(--text-secondary);
  background-color: var(--color-primary-soft);
  background-image:
    linear-gradient(rgba(230, 236, 245, 0.4), rgba(230, 236, 245, 0.4)),
    url("../images/header-bg.jpg");
  background-size: cover;
  background-position: center right;
  background-repeat: no-repeat;
  color: var(--color-primary);
  border-top-left-radius: 10px;
  padding: var(--spacing-4) 0;
  position: relative;
}
.a-section--navy .a-section__inner {
  padding: 0 var(--spacing-6);
}
.a-section--navy::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -1px;
  width: 1px;
  background: var(--bg-subtle);
  pointer-events: none;
}
.a-section--navy h1,
.a-section--navy h2,
.a-section--navy h3,
.a-section--navy h4 {
  color: var(--color-primary);
}
.a-section--navy p,
.a-section--navy .text-muted {
  color: var(--text-secondary);
}
.a-section--navy-deep {
  background: var(--bg-navy-deep);
  color: var(--text-on-navy);
}
.a-section--sm { padding: var(--section-y-sm) 0; }
.a-section--lg { padding: var(--section-y-lg) 0; }
.a-section__inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--content-pad-x);
}

/* Hero band — full-width light blue (matches sidebar active tint), navy text */
.a-hero {
  --text-on-navy: var(--color-primary);
  --text-on-navy-muted: var(--text-secondary);
  background-color: var(--color-primary-soft);
  background-image:
    linear-gradient(rgba(230, 236, 245, 0.4), rgba(230, 236, 245, 0.4)),
    url("../images/header-bg.jpg");
  background-size: cover;
  background-position: center right;
  background-repeat: no-repeat;
  color: var(--color-primary);
  padding: var(--section-y) 0 var(--section-y-sm) 0;
  border-top-left-radius: 10px;
  position: relative;
}
.a-hero::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -1px;
  width: 1px;
  background: var(--bg-subtle);
  pointer-events: none;
}
.a-hero__inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--content-pad-x);
}
.a-hero__eyebrow {
  font-size: var(--font-size-uppercase);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-primary);
  opacity: 0.8;
  margin-bottom: var(--spacing-4);
  display: inline-block;
}
.a-hero__title {
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-extrabold);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 var(--spacing-4);
  color: var(--color-primary);
  max-width: 900px;
}
.a-hero__subtitle {
  font-size: var(--font-size-lg);
  color: var(--text-secondary);
  max-width: 680px;
  margin: 0 0 var(--spacing-6);
  line-height: 1.5;
}
.a-hero__actions {
  display: flex;
  gap: var(--spacing-3);
  flex-wrap: wrap;
}
@media (max-width: 767px) {
  .a-hero__title { font-size: var(--font-size-3xl); }
  .a-hero__subtitle { font-size: var(--font-size-base); }
}

/* Section heading */
.a-section__heading {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-extrabold);
  letter-spacing: -0.015em;
  margin: 0 0 var(--spacing-4);
  max-width: 720px;
}
.a-section__lead {
  font-size: var(--font-size-base);
  color: var(--text-secondary);
  max-width: 680px;
  margin: 0 0 var(--spacing-8);
  line-height: 1.55;
}

/* CTA strip — solid-colour full-width band */
.a-cta-strip {
  background: var(--bg-navy);
  color: var(--text-on-navy);
  padding: var(--section-y-sm) 0;
}
.a-cta-strip__inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--spacing-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-6);
  flex-wrap: wrap;
}
.a-cta-strip__text { flex: 1; min-width: 280px; }
.a-cta-strip__title {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  margin: 0 0 var(--spacing-2);
  color: #FFFFFF;
}
.a-cta-strip__sub {
  color: var(--text-on-navy-muted);
  margin: 0;
  font-size: var(--font-size-base);
}

/* Service grid card (inspired by NSW "what are you looking for") */
.a-service-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-4);
}
@media (max-width: 1023px) { .a-service-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 639px)  { .a-service-grid { grid-template-columns: 1fr; } }

.a-service-card {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-4);
  padding: var(--spacing-5) var(--spacing-5);
  background: var(--bg-surface);
  border: 0;
  border-top: 3px solid var(--color-primary);
  border-radius: 0;
  color: var(--text-primary);
  text-decoration: none;
  transition: box-shadow 120ms ease, transform 120ms ease;
}
.a-service-card:hover {
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--text-primary);
  transform: translateY(-2px);
}
.a-service-card__icon {
  width: 32px; height: 32px;
  flex-shrink: 0;
  display: grid; place-items: center;
  color: var(--color-primary);
}
.a-service-card__title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  margin: 0 0 var(--spacing-1);
  color: var(--color-secondary);
}
.a-service-card__sub {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* Page header bar — lighter breadcrumb strip */
.a-context-bar {
  background: transparent;
  border-top: 0;
  border-bottom: 0;
  padding: var(--spacing-3) var(--spacing-6);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  font-weight: var(--font-weight-normal);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--spacing-3);
}
.a-context-bar__left {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  min-width: 0;        /* allow breadcrumbs to truncate */
}
.a-context-bar a {
  color: var(--text-secondary);
  transition: color 120ms ease;
}
.a-context-bar a:hover {
  color: var(--color-primary);
  text-decoration: none;
}
/* Tag was here before; now lives in the header. Keep for legacy compat. */
.a-context-bar__tag {
  font-size: var(--font-size-uppercase);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-primary);
  padding: 4px 10px;
  background: var(--color-primary-soft);
  border-radius: var(--radius-sm);
}

/* Header tenant tag — sits left of the user avatar */
.a-header__tenant-tag {
  font-size: var(--font-size-uppercase);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-primary);
  padding: 5px 10px;
  background: var(--color-primary-soft);
  border-radius: var(--radius-sm);
  line-height: 1;
  white-space: nowrap;
  margin-right: var(--spacing-3);
  transition: background 120ms ease;
}
.a-header__tenant-tag:hover {
  background: color-mix(in srgb, var(--color-primary-soft) 70%, var(--color-primary) 30%);
}

/* Overriding a-page-header to feel more gov */
.a-page-header__title {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-extrabold);
  letter-spacing: -0.015em;
  color: var(--color-secondary);
  margin-bottom: var(--spacing-2);
}

/* Borderless stat for sections on coloured backgrounds */
.a-stat--plain {
  border: 0;
  padding: 0;
  background: transparent;
}

/* Section divider accent — removed per feedback */
.a-accent-bar { display: none; }

/* Hero CTA style — clean white-on-navy, no gold */
/* Legacy on-navy buttons — bands are now light blue so these render as navy-on-white */
.a-btn--on-navy {
  background: var(--color-primary);
  color: #FFFFFF;
  border-color: var(--color-primary);
}
.a-btn--on-navy:hover {
  background: var(--bg-navy-deep);
  color: #FFFFFF;
  text-decoration: none;
}
.a-btn--on-navy-outline {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.a-btn--on-navy-outline:hover {
  background: rgba(15, 44, 92, 0.08);
  color: var(--color-primary);
  text-decoration: none;
}

/* ==========================================================================
   12c. State handling & micro-interactions
   ========================================================================== */

/* -- Global focus-visible -- WCAG 2.2 / keyboard users -- */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible,
.a-nav__link:focus-visible,
.a-service-card:focus-visible,
.a-card:focus-visible,
.a-action:focus-visible,
.a-pagination__page:focus-visible {
  outline: 0;
  box-shadow: var(--shadow-focus);
  z-index: 2;
  position: relative;
}

/* -- Motion-safe defaults -- */
@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;
  }
}

/* -- Link states -- text underline on hover, animate colour -- */
a {
  text-underline-offset: 2px;
  transition: color 120ms ease;
}
a:hover { text-decoration: underline; }
.a-nav__link:hover,
.a-service-card:hover,
.a-btn:hover,
.a-action:hover { text-decoration: none; }

/* -- Card interactive states (service cards + clickable stats) -- */
.a-service-card { will-change: transform; }
.a-service-card:active { transform: translateY(0); }

.a-stat {
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 80ms ease;
}
.a-stat--clickable {
  cursor: pointer;
}
.a-stat--draggable.is-customising { cursor: grab; outline: 1px dashed var(--border-color-strong); }
.a-stat--draggable.is-customising:active { cursor: grabbing; opacity: 0.82; }
.a-dashboard-sections { display: flex; flex-direction: column; }
.a-dashboard-customise { order: -1; }
.a-dashboard-customise__hint { flex-basis: 100%; color: var(--text-primary); font-size: var(--font-size-base); font-weight: var(--font-weight-medium); }
.a-dashboard-section.is-customising { cursor: grab; outline: 1px dashed var(--border-color-strong); outline-offset: 0; padding: var(--spacing-4); margin-bottom: var(--spacing-5); }
.a-dashboard-section.is-customising:active { cursor: grabbing; opacity: 0.9; }
.a-snapshot-row.is-customising { cursor: grab; outline: 1px dashed var(--border-color); outline-offset: 0; padding: var(--spacing-3); }
.a-stat.is-customising { position: relative; padding-top: calc(var(--spacing-5) + 24px); }
.a-stat.is-hidden-card { opacity: 0.45; background: var(--gray-100); }
.a-stat__customise-controls { position: absolute; top: var(--spacing-2); right: var(--spacing-2); left: var(--spacing-2); display: flex; align-items: center; justify-content: space-between; }
.a-drag-dots { display: grid; grid-template-columns: repeat(2, 3px); grid-auto-rows: 3px; gap: 2px; padding: 5px; color: var(--text-secondary); }
.a-drag-dots i { display: block; width: 3px; height: 3px; border-radius: 50%; background: currentColor; }
.a-card-visibility { display: grid; place-items: center; width: 28px; height: 28px; padding: 4px; border: 0; border-radius: var(--radius-sm); background: #fff; color: var(--color-primary); cursor: pointer; }
.a-card-visibility:hover { background: var(--color-primary-soft); }
.a-card-visibility svg { width: 18px; height: 18px; }
.a-stat--clickable:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}
.a-stat--clickable:active { transform: translateY(1px); }

/* -- Form control states (Stripe-style soft focus ring) -- */
.form-control:hover:not(:disabled):not(:focus),
.form-select:hover:not(:disabled):not(:focus) {
  border-color: var(--border-color-strong);
}
.form-control:focus-visible,
.form-select:focus-visible {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-focus);
}
.has-error .form-control:focus-visible,
.has-error .form-select:focus-visible {
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.25);
}
.form-control:disabled,
.form-select:disabled {
  background: var(--gray-100);
  color: var(--text-muted);
  cursor: not-allowed;
  border-color: var(--gray-200);
}

/* -- Table row hover: full-row highlight, soft background -- */
.a-table tbody tr {
  transition: background 100ms ease;
}
.a-table tbody tr:hover td {
  background: var(--color-primary-soft);
}
.a-table tbody tr[aria-selected="true"] td {
  background: var(--color-primary-soft);
  border-color: var(--color-primary);
}

/* -- Badges: keep hoverability subtle, no movement -- */
.a-badge {
  transition: background 120ms ease, color 120ms ease;
}

/* -- Button loading state (Linear-style inline spinner) -- */
.a-btn.is-loading {
  pointer-events: none;
  opacity: 0.85;
  position: relative;
  color: transparent !important;
}
.a-btn.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  color: var(--color-primary);
  animation: a-spin 0.6s linear infinite;
}
.a-btn--primary.is-loading::after,
.a-btn--danger.is-loading::after,
.a-btn--on-navy.is-loading::after { color: #FFFFFF; }

@keyframes a-spin {
  to { transform: rotate(360deg); }
}

/* -- On-navy danger button (used on tenant-overview hero) -- */
.a-btn--on-navy-danger {
  background: var(--color-error);
  color: #FFFFFF;
  border-color: var(--color-error);
}
.a-btn--on-navy-danger:hover {
  background: #B72836;
  border-color: #B72836;
  color: #FFFFFF;
  text-decoration: none;
}

/* -- Loading skeleton for async placeholders -- */
.a-skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-150) 37%, var(--gray-100) 63%);
  background-size: 400% 100%;
  animation: a-skeleton-sweep 1.4s ease-in-out infinite;
  border-radius: var(--radius-md);
  min-height: 1em;
  color: transparent;
  user-select: none;
}
.a-skeleton--text { height: 1em; width: 80%; margin: 4px 0; border-radius: 4px; }
.a-skeleton--heading { height: 1.4em; width: 40%; margin: 8px 0 12px; }
.a-skeleton--tile { height: 80px; width: 100%; }
.a-skeleton--circle { border-radius: var(--radius-full); width: 36px; height: 36px; }

.a-loading {
  padding: var(--spacing-4);
}

@keyframes a-skeleton-sweep {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* -- Empty state inline variant (for inside cards/tables) -- */
.a-empty--inline {
  padding: var(--spacing-10) var(--spacing-4);
  text-align: center;
}

/* -- Inline helper text on interactive elements (Linear-esque) -- */
.a-btn__shortcut {
  display: inline-block;
  margin-left: var(--spacing-2);
  padding: 1px 6px;
  font-size: var(--font-size-2xs);
  font-family: "JetBrains Mono", Menlo, monospace;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  opacity: 0.8;
}

/* -- Progressive-disclosure chrome on <details> -- */
details {
  border-radius: var(--radius-md);
}
details > summary {
  cursor: pointer;
  padding: var(--spacing-2);
  list-style: none;
  transition: background 120ms ease;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: var(--spacing-2);
  transition: transform 120ms ease;
  color: var(--text-secondary);
}
details[open] > summary::before {
  transform: rotate(90deg);
}
details > summary:hover {
  color: var(--color-primary);
}

/* -- Enhanced action icons: consistent sizing + hover affordance -- */
.a-action {
  transition: background 120ms ease, color 120ms ease;
}
.a-action:focus-visible {
  box-shadow: var(--shadow-focus);
  outline: 0;
}

/* -- Respect text-selection accents with brand colour -- */
::selection {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

/* -- Visually-hidden utility (for screen-reader-only labels) -- */
.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;
}

/* -- Input range slider styling for risk matrix edit -- */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--gray-150);
  border-radius: var(--radius-full);
  outline: none;
  padding: 0;
  border: 0;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  cursor: pointer;
  box-shadow: 0 0 0 4px rgba(15, 44, 92, 0.12);
  transition: box-shadow 120ms ease, transform 80ms ease;
}
input[type="range"]::-webkit-slider-thumb:hover {
  box-shadow: 0 0 0 6px rgba(15, 44, 92, 0.18);
}
input[type="range"]::-webkit-slider-thumb:active {
  transform: scale(1.1);
}
input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  cursor: pointer;
  border: 0;
}
input[type="range"]:focus-visible {
  box-shadow: var(--shadow-focus);
}

/* -- Inherent/residual slider track colour variants for risk -- */
input[type="range"][data-severity="low"] { accent-color: var(--color-risk-low); }
input[type="range"][data-severity="med"] { accent-color: var(--color-risk-med); }
input[type="range"][data-severity="high"] { accent-color: var(--color-risk-high); }

/* -- Aria-live region styling (so announcements are inert visually) -- */
[aria-live] { min-height: 0; }

/* -- Keyboard shortcut hint pattern (Linear-style) -- */
kbd {
  display: inline-block;
  padding: 2px 6px;
  font-family: "JetBrains Mono", Menlo, monospace;
  font-size: var(--font-size-2xs);
  background: var(--gray-100);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 0 var(--border-color);
  color: var(--color-secondary);
}

/* ==========================================================================
   12d. Additional micro-interactions (Linear/Stripe feel)
   ========================================================================== */

/* Sidebar nav — subtle icon shift on hover, animated active indicator */
.a-nav__link {
  position: relative;
  transition: background 140ms ease, color 140ms ease, border-left-color 140ms ease, padding-left 140ms ease;
}
.a-nav__link:hover .a-nav__icon {
  color: var(--color-primary);
  transform: translateX(1px);
}
.a-nav__icon {
  transition: color 140ms ease, transform 140ms ease;
}
.a-nav__link.is-active {
  box-shadow: inset 3px 0 0 var(--color-primary);
}

/* Brand mark — subtle scale on sidebar hover */
.a-sidebar:hover .a-sidebar__brand-mark {
  transform: scale(1.04);
}
.a-sidebar__brand-mark {
  transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Header user affordance */
.a-header__user {
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: background 120ms ease;
}
.a-header__user:hover {
  background: var(--bg-subtle);
}

/* Card subtle lift on hover (only for clickable ones with a-card--link / inside <a>) */
a > .a-card,
a.a-card {
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}
a > .a-card:hover,
a.a-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-color-strong);
}

/* Action icons: brighter hover backing */
.a-action {
  border-radius: var(--radius-sm);
}
.a-action:hover {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

/* Pagination hover */
.a-pagination__page:not(.is-active):hover {
  background: var(--bg-subtle);
  color: var(--color-primary);
  text-decoration: none;
}

/* Context bar hover subtle (no change to layout, only colour fade) */
.a-context-bar a {
  border-bottom: 1px solid transparent;
}
.a-context-bar a:hover {
  border-bottom-color: currentColor;
}

/* ==========================================================================
   12e. Role-based nav visibility
   ==========================================================================
   Add a class to <body> to hide nav items beyond the user's role.
   Roles, ordered: super_admin > cc_admin > cc_staff > client_admin > standard_user > lite_user > auditor
   Each nav item carries data-min-role="X" meaning "requires role ≥ X".
   By default everything is shown (super-admin view).
   ========================================================================== */

/* Client Admin — no cross-tenant tools */
body.role-client-admin [data-min-role="cc_staff"],
body.role-client-admin [data-min-role="cc_admin"],
body.role-client-admin [data-min-role="super_admin"] { display: none; }

/* CC Staff — sees cross-tenant read but not super-admin ops */
body.role-cc-staff [data-min-role="cc_admin"],
body.role-cc-staff [data-min-role="super_admin"] { display: none; }

/* CC Admin — sees cross-tenant admin, but not platform super-admin */
body.role-cc-admin [data-min-role="super_admin"] { display: none; }

/* Standard User — only their own work */
body.role-standard-user [data-min-role="client_admin"],
body.role-standard-user [data-min-role="cc_staff"],
body.role-standard-user [data-min-role="cc_admin"],
body.role-standard-user [data-min-role="super_admin"] { display: none; }

/* Auditor — read-only scope, no admin tools at all */
body.role-auditor [data-min-role="client_admin"],
body.role-auditor [data-min-role="cc_staff"],
body.role-auditor [data-min-role="cc_admin"],
body.role-auditor [data-min-role="super_admin"] { display: none; }

/* Section labels collapse when they have no visible children */
body.role-standard-user .a-sidebar__section:has(> .a-nav > .a-nav__item > [data-min-role]:not([data-min-role="standard_user"]):not([data-min-role="client_admin"])):has(> .a-nav > .a-nav__item:not([hidden])) { /* noop — placeholder */ }

/* ==========================================================================
   13. Dark Mode
   ========================================================================== */
.dark-mode {
  --bg-body: #0A1626;
  --bg-surface: #13243D;
  --bg-subtle: #1E3559;
  --border-color: rgba(255, 255, 255, 0.1);
  --border-color-strong: rgba(255, 255, 255, 0.2);
  --text-primary: #FFFFFF;
  --text-secondary: #A0A0A0;
  --text-muted: rgba(255, 255, 255, 0.5);
  --color-primary: #4A7BC8;
  --color-primary-hover: #6895E0;
  --color-primary-soft: rgba(74, 123, 200, 0.15);
  --gray-50: #13243D;
  --gray-100: #1E3559;
  --gray-150: rgba(255, 255, 255, 0.08);
  --gray-200: rgba(255, 255, 255, 0.1);
}

/* ── Calendar view ───────────────────────────────────────────────────────── */

.a-cal-view__grid,
.a-cal-view__list { display: none; }
.a-cal-view.is-grid .a-cal-view__grid { display: block; }
.a-cal-view.is-list .a-cal-view__list { display: block; }

.a-cal {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.a-cal__head {
  padding: var(--spacing-3);
  font-size: var(--font-size-uppercase);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  background: var(--gray-50);
  border-bottom: 1px solid var(--border-color);
  text-align: center;
}

.a-cal__day {
  min-height: 120px;
  padding: var(--spacing-2);
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  font-size: var(--font-size-sm);
}

.a-cal__day:nth-child(7n) { border-right: 0; }
.a-cal__day--other { background: var(--bg-subtle); color: var(--text-muted); }
.a-cal__day--today { background: var(--color-primary-soft); }

.a-cal__day { min-width: 0; }

.a-cal__date {
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--spacing-1);
}

.a-cal__event {
  display: block;
  max-width: 100%;
  margin-top: 2px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-2xs);
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
}

.a-cal__event--warn { background: var(--color-warning-soft); color: #8B6A00; }
.a-cal__event--err { background: var(--color-error-soft); color: var(--color-error); }
.a-cal__event--ok { background: var(--color-success-soft); color: var(--color-success); }
.a-cal__event--info { background: var(--color-info-soft); color: var(--color-info); }

/* List view */
.a-cal-list {
  list-style: none;
  padding: 0;
  margin: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.a-cal-list__day {
  display: flex;
  gap: var(--spacing-4);
  padding: var(--spacing-4) var(--spacing-5);
  border-bottom: 1px solid var(--border-color);
}

.a-cal-list__day:last-child { border-bottom: 0; }
.a-cal-list__day--today { background: var(--color-primary-soft); }

.a-cal-list__date {
  flex-shrink: 0;
  width: 72px;
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
}

.a-cal-list__date__weekday {
  font-size: var(--font-size-uppercase);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  font-weight: var(--font-weight-semibold);
}

.a-cal-list__date__day { font-size: var(--font-size-xl); line-height: 1; }

.a-cal-list__events {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-2);
  min-width: 0;
}

.a-cal-list__event {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  text-decoration: none;
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  font-size: var(--font-size-sm);
}

.a-cal-list__event:hover { background: var(--color-primary-soft); }

.a-cal-list__event__dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.a-cal-list__event__dot--err { background: var(--color-error); }
.a-cal-list__event__dot--warn { background: #8B6A00; }
.a-cal-list__event__dot--info { background: var(--color-info); }
.a-cal-list__event__dot--ok { background: var(--color-success); }

/* Responsive: default to list view on mobile */
@media (max-width: 767px) {
  .a-cal-view .a-cal-view__grid { display: none !important; }
  .a-cal-view .a-cal-view__list { display: block !important; }
  .a-cal-list__day { flex-direction: row; gap: var(--spacing-3); padding: var(--spacing-3) var(--spacing-4); }
  .a-cal-list__date { width: 56px; }
}

/* ── Error page shell ────────────────────────────────────────────────────── */
.a-error-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: var(--spacing-6);
  background: var(--bg-subtle);
}

/* ── Missing utility classes (ported from Bootstrap / component usage) ───── */

.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }

.m-5 { margin: var(--spacing-5); }

.p-0 { padding: 0; }
.pt-2 { padding-top: var(--spacing-2); }

.min-w-120 { min-width: 120px; }

.text-danger { color: var(--color-error); }
.text-gray-500 { color: var(--gray-500); }

.form-error {
  color: var(--color-error);
  font-size: var(--font-size-xs);
  margin-top: var(--spacing-1);
}

.form-hint {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  margin-top: var(--spacing-1);
}

.form-check-label {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-2);
  cursor: pointer;
  font-size: var(--font-size-sm);
}

.form-group--wide { max-width: none; }


/* Brand logo — AFSL Assist wordmark (sidebar/header) + co-brand lockup (auth). Replaces the placeholder "A" mark. */
.a-sidebar__logo { display: block; width: 100%; max-width: 200px; height: auto; }
.a-header__logo  { display: block; height: 22px; width: auto; max-width: 100%; }
.a-auth__logo    { display: block; margin: 0 auto var(--spacing-5); height: 22px; width: auto; max-width: 100%; }
