/* ===================================================================================================================
   GRC Owl theme: navy / rust / cream, taken from the logo (public/assets/img/logo-mark.png, logo-stacked.png).
   Two accent roles, used consistently everywhere below:
     - NAVY (--ink)  = primary actions, headings, links, the sidebar.       (the owl's dominant colour)
     - RUST (--rust) = "this is active / selected / hovered" - a highlight, never a primary action.  (the owl's body)
   Bootstrap 5.3 is loaded from a CDN with no build step, so it is retinted here by overriding the CSS custom
   properties it already exposes on :root and on its own component classes - never by fighting its !important rules.
   =================================================================================================================== */
:root {
  /* brand palette, sampled from the logo */
  --ink: #0b2545;          /* navy: headings, primary buttons, links, sidebar */
  --ink-2: #1f2a3d;        /* a touch softer - body text */
  --ink-dark: #071a30;     /* hover/active shade of navy */
  --ink-soft: #4a6483;     /* a mid step of navy, for things that need to read as "brand" but lighter */
  --rust: #8a4627;         /* the owl's rust: hover links, active chips/tabs, the instance badge */
  --rust-dark: #6e3720;
  --rust-tint: #f7e9e0;    /* rust at ~12% - soft chip backgrounds */
  --rust-tint-strong: #f0d6c5;
  --cream: #ece9de;        /* the logo's paper - the navbar */
  --cream-deep: #d9d3c2;   /* a hairline border on cream */
  --cream-soft: #f7f5ef;   /* a barely-there paper tint for subtle panels/sticky headers */

  /* legacy names some rules below still read - point them at the new palette */
  --brand: var(--ink);
  --brand-dark: var(--ink-dark);
  --sidebar-bg: var(--ink);
  --sidebar-fg: #b9c3d4;

  /* Bootstrap's own tokens: these ARE consumed via var() throughout bootstrap.min.css, so overriding them
     here retints body text, links, borders, radii and focus rings everywhere without touching Bootstrap's file. */
  /* typefaces (self-hosted, see fonts.css): sans for the interface and data, serif for page titles, mono for IDs/keys */
  --font-sans: 'Source Sans 3', system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: 'Source Serif 4', Georgia, "Times New Roman", serif;
  --font-mono: 'Source Code Pro', ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
  --bs-body-font-family: var(--font-sans);
  --bs-font-monospace: var(--font-mono);

  /* risk heat bands (score <=4, <=9, <=15, >15) - views use class heat-1..4, charts read these; theme-light.css retints */
  --heat-1: #2fa66c; --heat-2: #f2c94c; --heat-3: #f2a65a; --heat-4: #d5495a;
  --heat-1-ink: #fff; --heat-2-ink: #3d2f00; --heat-3-ink: #3d1f00; --heat-4-ink: #fff;
  --heat-1-fill: var(--heat-1); --heat-2-fill: var(--heat-2); --heat-3-fill: var(--heat-3); --heat-4-fill: var(--heat-4);
  --lvl-low: #8b98a9; --lvl-medium: #e0a100; --lvl-high: #d9534f; --lvl-critical: #8e1b1b;
  --bs-body-bg: #fbfaf7;
  --bs-body-color: var(--ink-2);
  --bs-emphasis-color: var(--ink);
  --bs-secondary-color: #6b6259;
  --bs-link-color: var(--ink);
  --bs-link-color-rgb: 11, 37, 69;
  --bs-link-hover-color: var(--rust);
  --bs-link-hover-color-rgb: 138, 70, 39;
  --bs-border-color: #e3ded0;
  --bs-border-radius: 8px;
  --bs-border-radius-sm: 0.4rem;
  --bs-border-radius-lg: 0.75rem;
  --bs-focus-ring-color: rgba(11, 37, 69, 0.22);
}

body {
  background: var(--bs-body-bg);
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--ink); }
.app-main h3 { font-family: var(--font-serif); font-weight: 600; letter-spacing: -0.01em; }
/* pills inside a page title stay in the interface face; a record ID set as muted text in the title becomes mono */
.app-main h3 .badge, .app-main h3 .cs-badge, .app-main h3 .lvl { font-family: var(--font-sans); letter-spacing: 0.01em; vertical-align: 0.2em; }
.app-main h3 > .text-muted { font-family: var(--font-mono); font-size: 0.62em; font-weight: 500 !important; letter-spacing: 0; vertical-align: 0.2em; }

/* ---------- interactions: consistent, modest motion instead of instant snaps ---------- */
a, .btn, .nav-link, .dropdown-item, .cl-chip, .catalogue-table tbody tr, .card, .form-control, .form-select {
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
::selection { background: rgba(138, 70, 39, 0.22); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--cream-deep); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #c2b9a2; }

/* ---------- buttons, form controls, nav components: Bootstrap sets these as custom properties on the same
   selector rather than reading the :root ones above, so they are redeclared here (this file loads last and wins). ---------- */
.btn-primary {
  --bs-btn-bg: var(--ink); --bs-btn-border-color: var(--ink);
  --bs-btn-hover-bg: var(--ink-dark); --bs-btn-hover-border-color: var(--ink-dark);
  --bs-btn-active-bg: var(--ink-dark); --bs-btn-active-border-color: var(--ink-dark);
  --bs-btn-disabled-bg: var(--ink); --bs-btn-disabled-border-color: var(--ink);
  --bs-btn-focus-shadow-rgb: 11, 37, 69;
}

.btn-outline-primary {
  --bs-btn-color: var(--ink); --bs-btn-border-color: var(--ink);
  --bs-btn-hover-bg: var(--ink); --bs-btn-hover-border-color: var(--ink);
  --bs-btn-active-bg: var(--ink); --bs-btn-active-border-color: var(--ink);
  --bs-btn-focus-shadow-rgb: 11, 37, 69;
}
.btn-link { --bs-btn-color: var(--ink); --bs-btn-hover-color: var(--rust); }
/* forward actions (Approve, Submit for Review/Approval, Move to Closed, Send...): green, picked by action_btn_class() */
.btn-go {
  --bs-btn-color: #fff; --bs-btn-bg: #1d7048; --bs-btn-border-color: #1d7048;
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #165a39; --bs-btn-hover-border-color: #165a39;
  --bs-btn-active-color: #fff; --bs-btn-active-bg: #124a2f; --bs-btn-active-border-color: #124a2f;
  --bs-btn-disabled-color: #fff; --bs-btn-disabled-bg: #1d7048; --bs-btn-disabled-border-color: #1d7048;
  --bs-btn-focus-shadow-rgb: 29, 112, 72;
}
/* AI buttons (anything that asks the AI): one look everywhere - small, violet, stars icon */
.btn-ai {
  --bs-btn-color: #fff; --bs-btn-bg: #6941c6; --bs-btn-border-color: #6941c6;
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #5631a8; --bs-btn-hover-border-color: #5631a8;
  --bs-btn-active-color: #fff; --bs-btn-active-bg: #48298f; --bs-btn-active-border-color: #48298f;
  --bs-btn-disabled-color: #fff; --bs-btn-disabled-bg: #6941c6; --bs-btn-disabled-border-color: #6941c6;
  --bs-btn-focus-shadow-rgb: 105, 65, 198;
}
/* Move to In Progress (and any transition into In Progress): the In Progress status blue, picked by action_btn_class() */
.btn-progress {
  --bs-btn-color: #fff; --bs-btn-bg: #2a6fb8; --bs-btn-border-color: #2a6fb8;
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #235c99; --bs-btn-hover-border-color: #235c99;
  --bs-btn-active-color: #fff; --bs-btn-active-bg: #1f5690; --bs-btn-active-border-color: #1f5690;
  --bs-btn-disabled-color: #fff; --bs-btn-disabled-bg: #2a6fb8; --bs-btn-disabled-border-color: #2a6fb8;
  --bs-btn-focus-shadow-rgb: 47, 127, 209;
}
.form-control:focus, .form-select:focus { border-color: var(--ink-soft); }
.form-check-input:checked { background-color: var(--ink); border-color: var(--ink); }
.form-check-input:focus { border-color: var(--ink-soft); }
.form-switch .form-check-input:checked { background-color: var(--ink); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--ink); }
.pagination { --bs-pagination-active-bg: var(--ink); --bs-pagination-active-border-color: var(--ink); --bs-pagination-color: var(--ink); --bs-pagination-hover-color: var(--ink-dark); --bs-pagination-focus-color: var(--ink); }
.dropdown-menu { --bs-dropdown-link-active-bg: var(--ink); box-shadow: 0 10px 30px rgba(11, 37, 69, 0.12); border-color: var(--bs-border-color); }
.card { border: 1px solid var(--bs-border-color); box-shadow: none; border-radius: 8px; }
.btn { font-weight: 600; }
body { font-size: 0.9375rem; }
.table, .kpi-value, .viz-tile-value, .viz-hero, .viz-row-value, .upc-when, .upc-day { font-variant-numeric: tabular-nums; }
code, kbd, .upc-code { font-family: var(--font-mono); }
/* risk heat bands: badges, heatmap cells */
.heat-1 { background-color: var(--heat-1) !important; color: var(--heat-1-ink) !important; }
.heat-2 { background-color: var(--heat-2) !important; color: var(--heat-2-ink) !important; }
.heat-3 { background-color: var(--heat-3) !important; color: var(--heat-3-ink) !important; }
.heat-4 { background-color: var(--heat-4) !important; color: var(--heat-4-ink) !important; }
/* keyboard focus ring for buttons, tabs, menu items (text fields keep their own glow); light ring on the navy chrome */
.btn:focus-visible, .nav-link:focus-visible, .page-link:focus-visible, .dropdown-item:focus-visible, .cl-chip:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.btn-danger:focus-visible, .btn-outline-danger:focus-visible { outline-color: #b3261e; }
.app-sidebar .nav-link:focus-visible, .app-navbar .btn:focus-visible, .app-navbar .nav-link:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
/* level (priority / severity / criticality): a coloured dot and plain text, so only a STATUS is ever a pill (visual audit 2026-11-10) */
.lvl { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.8125rem; font-weight: 600; color: var(--bs-emphasis-color, inherit); white-space: nowrap; line-height: 1.3; }
.lvl::before { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--lvl-low); flex: none; }
.lvl-medium::before { background: var(--lvl-medium); }
.lvl-high::before { background: var(--lvl-high); }
.lvl-critical { color: var(--lvl-critical); font-weight: 700; }
.lvl-critical::before { background: var(--lvl-critical); box-shadow: 0 0 0 3px color-mix(in srgb, var(--lvl-critical) 22%, transparent); }
.table > tbody > tr > td:has(> .lvl:only-child) { white-space: nowrap; }

/* ---------- top navigation bar: deep navy (same as the sidebar), the owl on a cream chip so its dark strokes stay readable ---------- */
.app-navbar {
  background: linear-gradient(90deg, var(--ink-dark), var(--ink));
  border-bottom: 3px solid var(--rust);
  box-shadow: 0 2px 6px rgba(7, 26, 48, 0.25);
  color: #fff;
  padding: 0.5rem 1rem;
  min-height: 72px;
}
.app-navbar .navbar-brand { color: #fff; font-size: 1.25rem; letter-spacing: 0.01em; }
.app-navbar .navbar-brand:hover { color: #fff; }
.app-navbar .navbar-toggler { border-color: rgba(255, 255, 255, 0.4); }
.app-navbar .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}
/* the notification bell and the account menu button, on the navy bar */
.btn-navbar-icon {
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.06);
}
.btn-navbar-icon:hover, .btn-navbar-icon:focus, .btn-navbar-icon.show { color: #fff; background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.55); }

/* global search box in the title bar, with its live results panel */
.app-search { position: relative; flex: 1 1 320px; max-width: 460px; margin-left: 1.25rem; }
.app-search-icon { position: absolute; left: 0.7rem; top: 50%; transform: translateY(-50%); color: rgba(255, 255, 255, 0.7); pointer-events: none; }
.app-search-input.form-control {
  padding-left: 2.1rem; color: #fff; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.35); border-radius: 999px;
}
.app-search-input.form-control::placeholder { color: rgba(255, 255, 255, 0.7); }
.app-search-input.form-control:focus { background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.7); box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.15); color: #fff; }
.app-search-panel {
  position: absolute; top: calc(100% + 0.4rem); left: 0; right: 0; z-index: 1080; max-height: 70vh; overflow-y: auto;
  background: #fff; color: var(--bs-body-color); border: 1px solid var(--bs-border-color); border-radius: 8px; box-shadow: 0 10px 30px rgba(11, 37, 69, 0.2);
}
.app-search-panel[hidden] { display: none; }
.app-search-group { padding: 0.45rem 0.9rem 0.2rem; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: #6c757d; }
.app-search-item { display: block; padding: 0.4rem 0.9rem; color: inherit; text-decoration: none; }
.app-search-item:hover, .app-search-item.active { background: var(--rust-tint, #f3e9e4); color: inherit; }
.app-search-item small { display: block; color: #6c757d; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-search-item span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-search-empty, .app-search-all { padding: 0.6rem 0.9rem; font-size: 0.875rem; color: #6c757d; }
.app-search-all { display: block; border-top: 1px solid var(--bs-border-color); font-weight: 500; text-decoration: none; color: var(--ink); }
@media (max-width: 575.98px) { .app-search { order: 10; flex-basis: 100%; max-width: none; margin: 0.5rem 0 0; } }

/* Brand mark: larger, sitting on a cream rounded chip (the logo was drawn on paper, not on navy). */
.brand-chip {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 56px; height: 56px; padding: 4px; background: var(--cream); border-radius: 8px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18);
}
.brand-chip img { display: block; width: 100%; height: 100%; object-fit: contain; }

/* the instance name: a soft rust tag rather than a solid loud badge */
.instance-badge {
  background: var(--rust-tint) !important;
  color: var(--rust-dark) !important;
  border: 1px solid var(--rust-tint-strong);
  border-radius: 999px !important;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

/* Sign-in page: the full lockup (owl, name, tagline), or the owl and the instance's own name. */
.auth-logo { display: block; width: 100%; max-width: 160px; height: auto; margin: 0 auto; }
.auth-mark { width: 72px; height: 72px; }

.app-shell {
  display: flex;
  min-height: calc(100vh - 75px);
}

/* ---------- sidebar: navy, the owl's dominant colour - rust marks the current page ---------- */
.app-sidebar {
  width: 262px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
}
.sidebar-inner { padding: 1rem 0; }
.sidebar-group { margin-bottom: 1rem; }
.sidebar-group-label {
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #a7b8d0;
  padding: 0.25rem 1.25rem;
}
.app-sidebar .nav-link {
  color: var(--sidebar-fg);
  padding: 0.5rem 1.25rem;
  border-left: 3px solid transparent;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.app-sidebar .nav-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.app-sidebar .nav-link.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-left-color: var(--rust);
  font-weight: 600;
}

.app-main { flex-grow: 1; min-width: 0; }

/* ---------- desktop: the title bar is fixed, and the sidebar and the page scroll independently of each other ---------- */
@media (min-width: 992px) {
  body.app-body { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
  body.app-body > .app-navbar { flex: 0 0 auto; }
  body.app-body .app-shell { flex: 1 1 auto; min-height: 0; overflow: hidden; }
  body.app-body .app-sidebar { overflow-y: auto; overscroll-behavior: contain; }
  body.app-body .app-main { overflow-y: auto; overscroll-behavior: contain; }
  /* minimized: the sidebar shrinks to a slim strip holding only the ">>>" button */
  body.sidebar-collapsed .app-sidebar { width: 64px; }
  /* ...and the page icons stay as clickable items: labels and group headings hide, a divider marks each group */
  body.sidebar-collapsed .sidebar-group-label { display: none; }
  body.sidebar-collapsed .sidebar-group { margin-bottom: 0.5rem; padding-bottom: 0.5rem; border-bottom: 1px solid rgba(127, 139, 171, 0.25); }
  body.sidebar-collapsed .sidebar-group:last-child { border-bottom: 0; }
  body.sidebar-collapsed .app-sidebar .nav-link { justify-content: center; padding-left: 0; padding-right: 0; gap: 0; }
  body.sidebar-collapsed .app-sidebar .nav-link > span { display: none; }
  body.sidebar-collapsed .app-sidebar .nav-link .bi { font-size: 1.25rem; }
}
/* the sidebar still scrolls (wheel, touch, keyboard) but shows no scrollbar */
.app-sidebar { scrollbar-width: none; -ms-overflow-style: none; }
.app-sidebar::-webkit-scrollbar { width: 0; height: 0; display: none; }
/* minimize / maximize: a round button sitting on the line between the sidebar and the page, level with Dashboard (placed by app.js) */
.sidebar-edge-toggle {
  position: fixed; left: 235px; top: 100px; width: 30px; height: 30px; z-index: 40; padding: 0;
  align-items: center; justify-content: center; border-radius: 50%;
  background: #fff; color: #0b2545; border: 1px solid #d5dbe8; box-shadow: 0 1px 4px rgba(11, 37, 69, 0.25); font-size: 0.8125rem; line-height: 1;
}
.sidebar-edge-toggle:hover { background: #f3f6ff; color: var(--rust); }

/* ---------- dashboard KPI tiles: navy / amber-rust / deep rust / teal - one brand family, four readable hues ---------- */
.kpi-card { border-radius: 8px; color: #fff; }
.kpi-card .kpi-value { font-size: 2.25rem; font-weight: 700; }
.kpi-card .kpi-label { opacity: 0.88; font-size: 0.875rem; }
.kpi-bg-1 { background: linear-gradient(135deg, var(--ink), #274972); }
.kpi-bg-2 { background: linear-gradient(135deg, #a8632f, #c98c4c); }
.kpi-bg-3 { background: linear-gradient(135deg, var(--rust-dark), var(--rust)); }
.kpi-bg-4 { background: linear-gradient(135deg, #1f7a63, #2fa688); }

.heatmap-table { border-collapse: separate; border-spacing: 4px; }
.heatmap-cell {
  width: 64px; height: 44px; text-align: center; vertical-align: middle;
  border-radius: 6px; font-weight: 600; font-size: 0.875rem;
}

/* ---------- sign-in page: a deep navy field around the white card, like the logo's paper under studio light ---------- */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(900px 500px at 15% 10%, rgba(255, 255, 255, 0.06), transparent 60%),
    linear-gradient(135deg, #061422, var(--ink) 65%, var(--ink-soft));
}
.auth-card { max-width: 420px; width: 100%; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.5); }

.table-actions a, .table-actions button { margin-right: 0.25rem; }

.required-mark { color: #d5495a; }

/* Grouped, filterable checklist (e.g. Annex A mapping) */
.checklist-scroll { max-height: 300px; overflow-y: auto; }
.picker-group-label {
  position: sticky; top: 0; z-index: 1; background: #fff;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: #6c757d; padding: 0.35rem 0 0.2rem; margin-top: 0.4rem;
}
.picker-item .form-check-label { font-size: 0.875rem; }

/* ===================================================================================================================
   Audit progress (External Audits): status pills, stat tiles, meters and stacked bars - plain HTML/CSS, no chart library.
   Colours: every control status has its own hue (Open gray-blue, In Progress blue, Pending Auditor Review amber,
   Clarification Requested red, Closed green, Not Applicable gray-cream = left out of progress). Colour never
   carries the meaning alone: every mark has a label, a legend entry and a table view.
   =================================================================================================================== */
:root {
  --cs-open: #8b98a9;
  --cs-in_progress: #2f7fd1;
  --cs-pending_auditor_review: #e0a100;
  --cs-clarification_requested: #d9534f;
  --cs-closed: #2e9e5b;
  --cs-not_applicable: #c3c2b7;
  --cs-overdue: #d9534f;
  --viz-track: #dce3ea;
  --viz-ink: var(--ink);
  --viz-ink-2: #52514e;
  --viz-muted: #898781;
  --viz-hairline: #e1e0d9;
}

/* status pill: swatch + label */
.cs-badge {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.15rem 0.6rem;
  border: 1px solid var(--viz-hairline); border-radius: 999px; background: #fff;
  color: var(--viz-ink); font-size: 0.8125rem; line-height: 1.3; white-space: nowrap;
}
.cs-dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--viz-muted); flex: none; }
.cs-open .cs-dot { background: var(--cs-open); }
.cs-in_progress .cs-dot { background: var(--cs-in_progress); }
.cs-pending_auditor_review .cs-dot { background: var(--cs-pending_auditor_review); }
.cs-clarification_requested .cs-dot { background: var(--cs-clarification_requested); }
.cs-closed .cs-dot { background: var(--cs-closed); }
.cs-not_applicable .cs-dot { background: var(--cs-not_applicable); }
.cs-overdue .cs-dot { background: var(--cs-overdue); }

/* the panel */
.viz-title { font-size: 0.9375rem; font-weight: 600; color: var(--viz-ink); margin: 0; }
.viz-caption { color: var(--viz-ink-2); font-size: 0.875rem; }
.viz-hero { font-size: 3rem; font-weight: 600; line-height: 1; color: var(--viz-ink); }
.viz-hero .viz-unit { font-size: 1.25rem; font-weight: 500; color: var(--viz-ink-2); margin-left: 0.1rem; }
.viz-tile { border: 1px solid var(--viz-hairline); border-radius: 8px; padding: 0.65rem 0.85rem; background: #fff; height: 100%; }
.viz-tile-label { display: flex; align-items: center; gap: 0.4rem; color: var(--viz-ink-2); font-size: 0.8125rem; }
.viz-tile-value { font-size: 1.75rem; font-weight: 600; line-height: 1.25; color: var(--viz-ink); }
.viz-swatch { width: 0.65rem; height: 0.65rem; border-radius: 2px; flex: none; display: inline-block; }
.viz-swatch.seg-na { background: transparent; border: 1.5px solid var(--cs-not_applicable); }

/* meter: one ratio against its limit */
.viz-meter { height: 12px; background: var(--viz-track); border-radius: 4px; overflow: hidden; }
.viz-meter-fill { height: 100%; background: var(--cs-closed); border-radius: 0 4px 4px 0; }
.viz-meter-fill.is-evidence { background: var(--ink-soft); }   /* violet is kept for AI buttons only */

/* stacked bars: 14px thick, 2px gaps, a 4px round only on the data end, a tooltip on every segment */
.viz-stack { display: flex; gap: 2px; height: 14px; }
.viz-stack.viz-stack-sm { height: 8px; }
.viz-seg { position: relative; flex-basis: 0; min-width: 3px; outline: none; }
.viz-seg:last-child { border-radius: 0 4px 4px 0; }
.viz-seg::before { content: ""; position: absolute; inset: -7px 0; }      /* the hit area is bigger than the mark */
.viz-seg::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
  background: var(--viz-ink); color: #fff; padding: 0.25rem 0.55rem; border-radius: 4px; font-size: 0.75rem; font-weight: 500;
  white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity 0.12s; z-index: 30;
}
.viz-seg.tip-start::after { left: 0; transform: none; }               /* near the bar's ends: keep the tooltip inside the card */
.viz-seg.tip-end::after { left: auto; right: 0; transform: none; }
.viz-seg:hover::after, .viz-seg:focus-visible::after { opacity: 1; }
.viz-seg:hover, .viz-seg:focus-visible { filter: brightness(1.1); }
.viz-seg:focus-visible { outline: 2px solid var(--viz-ink); outline-offset: 2px; }
.seg-closed { background: var(--cs-closed); }
.seg-in_progress { background: var(--cs-in_progress); }
.seg-open { background: var(--cs-open); }
.seg-pending_auditor_review { background: var(--cs-pending_auditor_review); }
.seg-clarification_requested { background: var(--cs-clarification_requested); }
.seg-overdue { background: var(--cs-overdue); }
.viz-stack-none { height: 14px; border-radius: 4px; background: var(--viz-hairline); }
.viz-stack-sm.viz-stack-none { height: 8px; }

.viz-legend { display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; margin: 0.65rem 0 0; padding: 0; list-style: none; font-size: 0.875rem; color: var(--viz-ink-2); }
.viz-legend li { display: inline-flex; align-items: center; gap: 0.4rem; }
.viz-legend strong { color: var(--viz-ink); font-weight: 600; }

.viz-rows { display: grid; gap: 0.85rem; }
.viz-row { display: grid; grid-template-columns: minmax(6.5rem, 9rem) 1fr auto; align-items: center; gap: 0.75rem; }
.viz-row-label { color: var(--viz-ink-2); font-size: 0.875rem; }
.viz-row-value { color: var(--viz-ink); font-size: 0.875rem; white-space: nowrap; min-width: 8.5rem; text-align: right; }
@media (max-width: 575.98px) {
  .viz-row { grid-template-columns: 1fr auto; }
  .viz-row .viz-stack { grid-column: 1 / -1; order: 3; }
  .viz-row-value { min-width: 0; }
}

.viz-table-toggle > summary { cursor: pointer; color: var(--ink); font-size: 0.875rem; width: fit-content; }
.viz-table th, .viz-table td { font-size: 0.875rem; }

.viz-schedule { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.875rem; color: var(--viz-ink); }
.viz-schedule .bi { font-size: 1rem; }
.viz-schedule.is-overdue .bi { color: #d03b3b; }
.viz-schedule.is-soon .bi { color: #c98500; }
.viz-schedule.is-done .bi { color: #0ca30c; }
.viz-schedule.is-ok .bi { color: var(--viz-muted); }

/* the list page's progress cell */
.progress-cell { min-width: 9rem; }
.progress-cell .progress-text { font-size: 0.75rem; color: var(--viz-ink-2); margin-top: 0.3rem; white-space: nowrap; }

@media (forced-colors: active) {
  .viz-seg, .viz-meter-fill { forced-color-adjust: none; border: 1px solid CanvasText; }
}

/* ---------- checklist filter chips and the catalogue picker: rust marks "selected", navy hover is neutral ---------- */
.cl-chip {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.15rem 0.7rem; cursor: pointer;
  border: 1px solid var(--viz-hairline); border-radius: 999px; background: #fff; color: var(--viz-ink-2); font-size: 0.8125rem;
}
.cl-chip:hover { background: var(--cream-soft); }
.cl-chip.is-active { background: var(--rust); border-color: var(--rust); color: #fff; }
.cl-chip .cl-chip-count { font-weight: 600; }

.catalogue-scroll { max-height: 26rem; overflow: auto; border: 1px solid var(--viz-hairline); border-radius: 6px; background: #fff; }
.catalogue-table { margin: 0; }
/* every list/table: header cells sit vertically centred (Bootstrap's default is bottom) and left-aligned */
.table > thead > tr > th, .table > thead > tr > td { vertical-align: middle; text-align: left; }
.catalogue-table thead th { position: sticky; top: 0; z-index: 2; background: var(--cream-soft); box-shadow: 0 1px 0 var(--viz-hairline); font-size: 0.8125rem; }
.catalogue-table tbody tr { cursor: pointer; }
.catalogue-table tbody tr:hover { background: var(--cream-soft); }
.catalogue-table tbody tr.is-selected { background: var(--rust-tint); }
.catalogue-table td { vertical-align: top; font-size: 0.875rem; }
.catalogue-table .cat-desc { color: var(--viz-ink-2); }

/* ---------- tag picker: "type @ then a name" (risk register access lists) ---------- */
.tagpicker { position: relative; border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius); padding: 0.4rem; background: #fff; }
.tagpicker-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.3rem; }
.tagpicker-chips:empty { margin-bottom: 0; }
.tagpicker-chip {
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.15rem 0.4rem 0.15rem 0.6rem;
  background: var(--rust-tint); color: var(--rust-dark); border-radius: 999px; font-size: 0.8125rem; font-weight: 500;
}
.tagpicker-chip button {
  border: none; background: none; color: var(--rust-dark); opacity: 0.7; line-height: 1; padding: 0 0.1rem; font-size: 1rem; cursor: pointer;
}
.tagpicker-chip button:hover { opacity: 1; }
.tagpicker [data-tagpicker-input] { border: none; padding: 0.2rem 0.1rem; box-shadow: none !important; }
.tagpicker-menu, .richtext-mention-menu {
  position: absolute; z-index: 40; left: 0; right: 0; top: 100%; margin-top: 0.2rem;
  background: #fff; border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius);
  box-shadow: 0 10px 30px rgba(11, 37, 69, 0.14); max-height: 14rem; overflow-y: auto; padding: 0.25rem;
}
.richtext-mention-menu { left: auto; right: auto; top: auto; width: 15rem; }
.tagpicker-menu-item {
  display: block; width: 100%; text-align: left; border: none; background: none; padding: 0.35rem 0.6rem;
  border-radius: 6px; font-size: 0.875rem; color: var(--ink-2);
}
.tagpicker-menu-item.is-active, .tagpicker-menu-item:hover { background: var(--cream-soft); color: var(--ink); }

/* ---------- rich text with @mentions (risk comments, treatment plan) ---------- */
.richtext { position: relative; }
.richtext-toolbar { display: flex; gap: 0.25rem; margin-bottom: 0.35rem; }
.richtext-toolbar .btn { padding: 0.15rem 0.5rem; line-height: 1.4; }
.richtext-editor {
  min-height: 5rem; padding: 0.5rem 0.75rem; overflow-y: auto;
}
.richtext-editor:empty::before { content: attr(data-placeholder); color: var(--bs-secondary-color); }
.richtext-editor p { margin: 0 0 0.5rem; }
.richtext-editor p:last-child { margin-bottom: 0; }
.richtext-editor ul, .richtext-editor ol { margin: 0 0 0.5rem 1.2rem; padding: 0; }
.mention {
  display: inline-block; background: var(--rust-tint); color: var(--rust-dark); border-radius: 6px;
  padding: 0.05rem 0.35rem; font-weight: 600; font-size: 0.92em;
}
.richtext-view .mention { background: var(--rust-tint); color: var(--rust-dark); border-radius: 6px; padding: 0.05rem 0.35rem; font-weight: 600; }
.richtext-view p { margin: 0 0 0.5rem; }
.richtext-view p:last-child, .richtext-view :last-child { margin-bottom: 0; }

/* ---------- risk list: sortable column headers, filter bar ---------- */
.risk-sort-link { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 0.25rem; }
.risk-sort-link:hover { color: var(--ink); }
.risk-sort-link .bi { font-size: 0.75rem; color: var(--rust); }
.filter-bar { font-size: 0.875rem; }
.filter-bar label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--viz-ink-2); margin-bottom: 0.15rem; }

/* ---------- profile photo ---------- */
.profile-avatar {
  width: 72px; height: 72px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
  background: var(--cream-soft); border: 1px solid var(--bs-border-color);
}
.profile-avatar-placeholder {
  display: flex; align-items: center; justify-content: center; color: var(--ink-2); font-size: 1.75rem;
}
.navbar-avatar {
  width: 22px; height: 22px; border-radius: 50%; object-fit: cover; margin-right: 0.25rem; vertical-align: -4px;
}

/* ---------- file drop (risk comment attachments) ---------- */
.filedrop-zone {
  border: 1px dashed var(--bs-border-color); border-radius: var(--bs-border-radius); padding: 0.6rem 0.75rem;
  font-size: 0.875rem; color: var(--ink-2); cursor: pointer; text-align: center; background: var(--cream-soft);
}
.filedrop-zone:hover, .filedrop-zone:focus-visible { border-color: var(--rust); color: var(--ink); }
.filedrop-zone.is-dragover { border-color: var(--rust); background: var(--rust-tint); color: var(--ink); }
.filedrop-list { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.5rem; }
.filedrop-chip {
  display: inline-flex; align-items: center; gap: 0.35rem; background: var(--cream-soft); border: 1px solid var(--bs-border-color);
  border-radius: 999px; padding: 0.15rem 0.35rem 0.15rem 0.6rem; font-size: 0.75rem;
}
.filedrop-chip button { border: none; background: none; line-height: 1; font-size: 1rem; color: var(--ink-2); padding: 0 0.2rem; }
.filedrop-chip button:hover { color: var(--rust-dark); }



/* ---------- profile photo cropper ---------- */
.cropper { border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius); padding: 1rem; background: var(--cream-soft); }
.cropper-stage {
  position: relative; width: 280px; height: 280px; max-width: 100%; overflow: hidden; cursor: grab; touch-action: none;
  background: #222; border-radius: 4px; outline: 2px solid var(--ink);
}
.cropper-stage:active { cursor: grabbing; }
.cropper-stage img { position: absolute; left: 0; top: 0; max-width: none; user-select: none; -webkit-user-drag: none; pointer-events: none; transform-origin: 0 0; }
.cropper-stage::after { /* thirds grid, so the square reads as a selection box */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.35) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.35) 1px, transparent 1px);
  background-size: 33.333% 33.333%;
}
.cropper-preview { width: 72px; height: 72px; border-radius: 50%; border: 1px solid var(--bs-border-color); background-repeat: no-repeat; background-color: #ddd; }

/* the row an audit-page link jumps to (#control-N) flashes briefly */
tr:target > td { animation: targetflash 3s ease-out; }
@keyframes targetflash { from { background-color: var(--rust-tint-strong); } to { background-color: transparent; } }


/* ---------- lists: column chooser + draggable column edges (app.js: initGrid) ---------- */
.grid-col-hidden { display: none !important; }
/* Every list heading keeps a readable minimum width, so a header can never be squeezed to nothing on load. */
.table > thead > tr > th { min-width: 4.5rem; }
.table > thead > tr > th:last-child:empty { min-width: 0; }
/* the record's title (a cell holding just its link) gets room, so lists don't stack titles three lines deep;
   cells holding a single pill or date never wrap */
.table > tbody > tr > td:not(.text-nowrap):has(> a:only-child) { min-width: 13rem; }
.table > tbody > tr > td:has(> .badge:only-child), .table > tbody > tr > td:has(> .cs-badge:only-child) { white-space: nowrap; }
table.grid-fixed { table-layout: fixed; max-width: none; }
table.grid-fixed th, table.grid-fixed td { overflow-wrap: anywhere; }
/* once widths are pinned nothing may spill into the next column: headings wrap (sort arrow included) and a pill
   wider than its column is cut with an ellipsis - status_badge() puts the full label in its title */
table.grid-fixed > thead > tr > th { white-space: normal !important; overflow: hidden; }
table.grid-fixed .risk-sort-link { display: inline; }
table.grid-fixed td .badge, table.grid-fixed td .cs-badge { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.grid-resizer {
  position: absolute; top: 0; right: 0; bottom: 0; width: 9px; cursor: col-resize; user-select: none; touch-action: none; z-index: 3;
}
.grid-resizer::after { content: ""; position: absolute; top: 25%; bottom: 25%; right: 3px; width: 2px; background: var(--cream-deep); border-radius: 2px; }
th:hover > .grid-resizer::after, .grid-resizer.is-active::after { background: var(--rust); }
.grid-menu { min-width: 14rem; max-height: 22rem; overflow-y: auto; }

/* Risk Register: the Risk Treatment Plan card stands out from the neutral cards around it. */
.card-treatment { background: var(--rust-tint); border-color: var(--rust-tint-strong); border-left: 4px solid var(--rust); }
.card-treatment .table { --bs-table-bg: transparent; }
.card-treatment .card-title { color: var(--rust-dark); }

/* Owl: the floating assistant (bottom right of every signed-in page). Sits under Bootstrap's modals (1055) and above the page. */
.owl-widget { position: fixed; right: 20px; bottom: 20px; z-index: 1045; font-size: 0.875rem; }
.owl-fab {
  width: 62px; height: 62px; padding: 0; border-radius: 50%; cursor: pointer;
  background: var(--cream); border: 2px solid var(--ink); box-shadow: 0 6px 18px rgba(11, 37, 69, 0.28);
  display: flex; align-items: center; justify-content: center; transition: transform .15s ease, box-shadow .15s ease;
}
.owl-fab:hover { transform: translateY(-2px); box-shadow: 0 9px 22px rgba(11, 37, 69, 0.34); border-color: var(--rust); }
.owl-fab:focus-visible { outline: 3px solid var(--rust); outline-offset: 3px; }
.owl-fab img { width: 42px; height: 42px; object-fit: contain; }
.owl-widget.open .owl-fab { display: none; }
.owl-panel {
  position: absolute; right: 0; bottom: 0; width: 380px; height: min(560px, calc(100vh - 110px));
  display: flex; flex-direction: column; background: #fff; border: 1px solid var(--cream-deep); border-radius: 8px;
  box-shadow: 0 14px 40px rgba(11, 37, 69, 0.28); overflow: hidden;
}
.owl-panel[hidden] { display: none; }
.owl-head { display: flex; align-items: center; gap: .6rem; padding: .65rem .8rem; background: var(--ink); color: #fff; }
.owl-head-img { background: var(--cream); border-radius: 50%; padding: 3px; object-fit: contain; flex: none; }
.owl-head-text { flex: 1; min-width: 0; line-height: 1.2; }
.owl-head-text small { display: block; color: #b9c3d4; font-size: 0.75rem; }
.owl-icon-btn { background: transparent; border: 0; color: #dfe6f1; width: 30px; height: 30px; border-radius: 6px; cursor: pointer; }
.owl-icon-btn:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.owl-log { flex: 1; overflow-y: auto; padding: .8rem; background: var(--cream-soft); display: flex; flex-direction: column; gap: .55rem; }
.owl-msg { max-width: 92%; padding: .5rem .7rem; border-radius: 8px; white-space: pre-line; overflow-wrap: anywhere; line-height: 1.4; }
.owl-msg.me { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 3px; }
.owl-msg.owl { align-self: flex-start; background: #fff; border: 1px solid var(--cream-deep); color: #2b2b2b; border-bottom-left-radius: 3px; }
.owl-items { align-self: stretch; display: flex; flex-direction: column; gap: .3rem; }
.owl-item {
  display: block; padding: .4rem .6rem; background: #fff; border: 1px solid var(--cream-deep); border-left: 3px solid var(--rust);
  border-radius: 6px; text-decoration: none; color: var(--ink); overflow-wrap: anywhere;
}
.owl-item:hover { background: var(--rust-tint); color: var(--ink); }
.owl-item .t { display: block; font-weight: 600; font-size: 0.8125rem; }
.owl-item small { display: block; color: #6b6259; font-size: 0.75rem; }
.owl-chips { align-self: stretch; display: flex; flex-wrap: wrap; gap: .35rem; }
.owl-chip {
  background: #fff; border: 1px solid var(--ink-soft); color: var(--ink); border-radius: 999px; padding: .2rem .65rem;
  font-size: 0.75rem; cursor: pointer;
}
.owl-chip:hover { background: var(--ink); color: #fff; }
.owl-typing { align-self: flex-start; color: #6b6259; font-size: 0.8125rem; padding-left: .3rem; }
.owl-ai-note { align-self: flex-start; color: #6b6259; font-size: 0.75rem; margin-top: -.3rem; padding-left: .3rem; }
.owl-page-hint { align-self: flex-start; color: #6b6259; font-size: 0.75rem; margin-top: .4rem; padding-left: .3rem; }
.owl-form { display: flex; gap: .4rem; padding: .6rem; border-top: 1px solid var(--cream-deep); background: #fff; }
.owl-input { flex: 1; min-width: 0; border: 1px solid var(--cream-deep); border-radius: 999px; padding: .4rem .85rem; font-size: 0.875rem; }
.owl-input:focus { outline: 0; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(11, 37, 69, .15); }
.owl-send { flex: none; width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--ink); color: #fff; cursor: pointer; }
.owl-send:hover { background: var(--ink-dark); }
.owl-send:disabled { opacity: .5; cursor: default; }
@media (max-width: 575.98px) {
  .owl-widget { right: 12px; bottom: 12px; }
  .owl-panel { position: fixed; right: 8px; left: 8px; bottom: 8px; width: auto; height: min(78vh, 560px); }
}
@media print { .owl-widget { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .owl-fab { transition: none; } }

/* Dashboard KPI icon badge (Dark theme: frosted circle on the coloured tile; theme-light.css restyles it). */
.kpi-card { position: relative; padding-right: 4.5rem !important; }
.kpi-ico { display: flex; align-items: center; justify-content: center; position: absolute; top: 1rem; right: 1.1rem; width: 2.75rem; height: 2.75rem; border-radius: 50%; background: rgba(255, 255, 255, 0.18); color: #fff; font-size: 1.25rem; }

/* Dashboard > custom graphs (builder modal + saved graph cards) */
.custom-chart-box { position: relative; height: 280px; }
.custom-chart-box.cc-preview-box { height: 320px; }
.custom-chart-number { text-align: center; padding: 1.25rem 0; }
.custom-chart-number-value { font-size: 3rem; font-weight: 600; line-height: 1.1; color: var(--viz-ink); }
.custom-chart-number-label { color: var(--viz-ink-2); font-size: 0.875rem; }
.custom-chart-card .min-w-0 { min-width: 0; }
.custom-chart-card .flex-none { flex: none; }
#chartBuilder .cc-step { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--viz-ink-2); margin-bottom: .5rem; }
#chartBuilder .cc-filter-row { border: 1px solid var(--viz-hairline); border-radius: 8px; padding: .5rem; margin-bottom: .5rem; }
#chartBuilder .cc-preview { position: sticky; top: 0; }

/* Dashboard layout: draggable graph cards */
.dash-card { position: relative; }
.dash-grip {
  position: absolute; top: 2px; left: 50%; transform: translateX(-50%); z-index: 2; border: 0; background: transparent;
  color: var(--viz-ink-2); cursor: grab; padding: 0 .75rem; line-height: 1; font-size: 1rem; opacity: .35; border-radius: 6px;
}
.dash-card:hover .dash-grip, .dash-grip:focus-visible { opacity: 1; }
.dash-grip:active { cursor: grabbing; }
.dash-dragging { opacity: .45; }
@media (hover: none) { .dash-grip { opacity: .7; } }

/* Posted comments: avatar + bubble */
.comment-thread { padding: 0; }
.comment-item { display: flex; gap: .75rem; align-items: flex-start; margin-bottom: .85rem; }
.comment-item:last-child { margin-bottom: 0; }
.comment-avatar { flex: 0 0 2rem; width: 2rem; height: 2rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 0.8125rem; font-weight: 600; background: var(--rust-tint); color: var(--rust-dark); }
.comment-main { flex: 1 1 auto; min-width: 0; background: rgba(127,127,127,.08); border: 1px solid rgba(127,127,127,.18); border-radius: .25rem .75rem .75rem .75rem; padding: .55rem .85rem; }
.comment-head { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; margin-bottom: .2rem; }
.comment-head strong { font-size: 0.875rem; }
.comment-date { font-size: 0.75rem; opacity: .65; }

/* Dashboard: My Upcoming Action Items - date tile, title + meta line, relative due chip, priority/status badge. */
.upc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 0.9rem; }
.upc-count {
  display: inline-block; min-width: 1.5rem; padding: 0.05rem 0.5rem; margin-left: 0.35rem; border-radius: 999px;
  background: var(--rust-tint); color: var(--rust-dark); font-size: 0.75rem; font-weight: 600; text-align: center; vertical-align: 0.1em;
}
.upc-actions { display: flex; align-items: center; gap: 0.75rem; }
.upc-toggle { line-height: 1; padding: 0.25rem 0.45rem; }
.upc-all { font-size: 0.875rem; font-weight: 500; white-space: nowrap; text-decoration: none; }
.upc-all i { transition: transform 0.15s ease; display: inline-block; }
.upc-all:hover i { transform: translateX(3px); }
.upc-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--viz-hairline); border-radius: 8px; overflow: hidden; }
.upc-list li + li { border-top: 1px solid var(--viz-hairline); }
.upc-row {
  display: flex; align-items: center; gap: 0.9rem; padding: 0.7rem 1rem; color: inherit; text-decoration: none;
  background: transparent; transition: background-color 0.15s ease;
}
.upc-row:hover, .upc-row:focus-visible { background: var(--cream-soft, #f7f7f4); color: inherit; }
.upc-row:hover .upc-title { color: var(--rust); }
.upc-date {
  flex: none; width: 2.9rem; height: 2.9rem; border-radius: 8px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; line-height: 1; background: var(--viz-track); color: var(--viz-ink);
}
.upc-day { font-size: 1rem; font-weight: 600; }
.upc-mon { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; margin-top: 0.18rem; opacity: 0.75; }
.upc-date.upc-today { background: #fde8ea; color: #b4232f; }
.upc-date.upc-soon { background: #fff3dc; color: #9a6200; }
.upc-date.upc-later { background: var(--rust-tint); color: var(--rust-dark); }
.upc-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.upc-title { font-weight: 500; color: var(--viz-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color 0.15s ease; }
.upc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem 0.55rem; font-size: 0.75rem; color: var(--viz-muted, #898781); }
.upc-meta i { margin-right: 0.3rem; }
.upc-meta > span + span::before { content: "\00b7"; margin-right: 0.55rem; }
.upc-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.75rem; letter-spacing: 0.02em; }
.upc-detail { min-width: 0; max-width: 28rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upc-side { flex: none; display: flex; align-items: center; gap: 0.6rem; }
.upc-side .badge { min-width: 4.6rem; text-align: center; }
.upc-when { font-size: 0.75rem; font-weight: 500; color: var(--viz-ink-2); min-width: 4.6rem; text-align: right; }
.upc-when.upc-today { color: #b4232f; }
.upc-when.upc-soon { color: #9a6200; }
.upc-empty { display: flex; align-items: center; gap: 0.6rem; padding: 1rem; border: 1px dashed var(--viz-hairline); border-radius: 8px; color: var(--viz-ink-2); }
.upc-empty i { font-size: 1.25rem; color: #2f9e6e; }
@media (max-width: 575.98px) {
  .upc-head { flex-direction: column; gap: 0.4rem; }
  .upc-row { align-items: flex-start; }
  .upc-side { flex-direction: column; align-items: flex-end; gap: 0.3rem; }
  .upc-title { white-space: normal; }
}

/* Back-to-list arrow button: a quiet outline icon (visual review 2026-11-09), so the page's one solid button is its main
   action (Edit, New ...). The views still carry btn-primary; .btn.btn-back outranks it. */
.btn-back { display: inline-flex; align-items: center; justify-content: center; width: 34px; vertical-align: middle; }
.btn.btn-back {
  --bs-btn-color: var(--ink); --bs-btn-bg: #fff; --bs-btn-border-color: var(--cream-deep);
  --bs-btn-hover-color: var(--ink); --bs-btn-hover-bg: var(--cream-soft); --bs-btn-hover-border-color: #c2b9a2;
  --bs-btn-active-color: var(--ink); --bs-btn-active-bg: var(--rust-tint); --bs-btn-active-border-color: var(--rust-tint-strong);
}

/* Critical / SEV-1 badge: a deeper, solid red than High, so the top of the scale stands out (status_badge adds the class) */
.badge.badge-critical { background-color: #8e1b1b !important; color: #fff !important; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18); }

/* Links in tables (IDs, titles, names): no permanent underline - bold enough to read as links, underlined on hover */
.app-main .table a:not(.btn):not(.badge):not(.dropdown-item) { text-decoration: none; font-weight: 600; }
.app-main .table a:not(.btn):not(.badge):not(.dropdown-item):hover { text-decoration: underline; text-underline-offset: 2px; }

/* Third-Party Risk Management icon: a mask so it takes the text colour like the Bootstrap Icons glyphs */
.bi.bi-tprm { display: inline-block; width: 1em; height: 1em; vertical-align: -0.125em; background-color: currentColor; -webkit-mask: url("../img/icon-tprm.png") center / contain no-repeat; mask: url("../img/icon-tprm.png") center / contain no-repeat; }
.bi.bi-tprm::before { content: none; }

/* Dashboard > Reports: editor blocks and the report page */
.rb-block .card-header { background: transparent; }
.rb-badge { font-weight: 600; letter-spacing: .02em; }
.rb-badge-text { background: var(--viz-hairline, #e3e6ea); color: var(--viz-ink, #1f2933); }
.rb-badge-chart { background: #2f7fd1; color: #fff; }
.rb-badge-page_break { background: #8b98a9; color: #fff; }
.report-sheet .report-block { margin-bottom: 1.75rem; }
.report-sheet .report-block:last-child { margin-bottom: 0; }
.report-sheet .report-heading { font-weight: 600; border-bottom: 1px solid var(--viz-hairline, #e3e6ea); padding-bottom: .35rem; margin-bottom: .75rem; }
.report-sheet .report-chart-box { height: 320px; }
.report-sheet .report-data-table { max-width: 40rem; font-size: 0.875rem; }
.report-page-break { display: flex; align-items: center; gap: .75rem; margin: 1.5rem 0; color: var(--viz-ink-2, #6b7280); font-size: 0.75rem; text-transform: uppercase; letter-spacing: .05em; }
.report-page-break::before, .report-page-break::after { content: ""; flex: 1; border-top: 1px dashed var(--viz-hairline, #c8ccd2); }

/* Graph builder: colour pickers */
.cc-swatches { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.cc-swatch { position: relative; display: inline-flex; }
.cc-swatch input[type=color] { width: 2.25rem; height: 2.25rem; padding: 2px; border: 1px solid var(--viz-hairline, #c8ccd2); border-radius: 6px; background: transparent; cursor: pointer; }
.cc-swatch-x { position: absolute; top: -.45rem; right: -.45rem; width: 1.05rem; height: 1.05rem; line-height: .9rem; padding: 0; border-radius: 50%; border: 1px solid var(--viz-hairline, #c8ccd2); background: #fff; color: #444; font-size: 0.8125rem; cursor: pointer; }
.cc-swatch:not(:hover):not(:focus-within) .cc-swatch-x { opacity: 0; }
.cc-swatch-add { width: 2.25rem; height: 2.25rem; padding: 0; }
@media (hover: none) { .cc-swatch:not(:hover):not(:focus-within) .cc-swatch-x { opacity: .8; } }

/* Documentation (/help) */
.docs-hero { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; justify-content: space-between; }
.docs-search { position: relative; flex: 0 1 26rem; width: 100%; }
.docs-search > .bi-search { position: absolute; left: .75rem; top: .6rem; color: var(--bs-secondary-color); }
.docs-search input { padding-left: 2.2rem; }
.docs-toc { position: sticky; top: 1rem; max-height: calc(100vh - 6rem); overflow-y: auto; }
.docs-toc-group { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--bs-secondary-color); padding: .6rem .6rem .2rem; }
.docs-toc-link { display: block; padding: .3rem .6rem; border-radius: 6px; color: var(--bs-body-color); text-decoration: none; font-size: 0.875rem; }
.docs-toc-link .bi { width: 1.1rem; display: inline-block; color: var(--bs-secondary-color); }
.docs-toc-link:hover { background: var(--bs-tertiary-bg); }
.docs-toc-link.active { background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); font-weight: 600; }
.docs-section { margin-bottom: 1.25rem; scroll-margin-top: 1rem; }
.docs-section .card-body { padding: 1.5rem; }
.docs-h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: .75rem; }
.docs-h2 .bi { color: var(--brand, var(--bs-primary)); margin-right: .25rem; }
.docs-topic { margin-top: 1.1rem; }
.docs-topic h5 { font-size: 1rem; font-weight: 600; margin-bottom: .4rem; }
.docs-topic p:last-child, .docs-topic ul:last-child, .docs-topic ol:last-child { margin-bottom: 0; }
.docs-who { font-size: 0.875rem; color: var(--bs-secondary-color); border-left: 3px solid var(--bs-border-color); padding-left: .6rem; }
.docs-chips { display: inline-flex; flex-wrap: wrap; gap: .3rem; vertical-align: middle; }
.docs-chip { display: inline-block; font-size: 0.75rem; padding: .1rem .5rem; border-radius: 8px; background: var(--bs-tertiary-bg); border: 1px solid var(--bs-border-color); }
.docs-table { font-size: 0.875rem; }
.docs-glossary dt { font-weight: 600; }
.docs-glossary dd { margin-bottom: 0; }
.docs-glossary .docs-topic { margin-top: .6rem; }

/* ---------- version label at the foot of the sidebar (opens the release notes) ---------- */
.sidebar-version { font-size: 0.75rem; }
.settings-section-label { text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.06em; color: var(--bs-secondary-color); margin-bottom: 0.35rem; }
.settings-about .sidebar-version { font-size: inherit; }
.settings-about .sidebar-version a { opacity: 1; display: flex; text-decoration: none; }
/* Settings button pinned to the bottom-left of the sidebar; opens the Administration list */
.sidebar-inner { min-height: 100%; display: flex; flex-direction: column; }
.sidebar-settings { margin-top: auto; padding: 0.25rem 0 0; background: var(--sidebar-bg, transparent); border-top: 1px solid rgba(127, 139, 171, 0.25); }
.sidebar-settings .nav-link { background: transparent; text-align: left; }
html.theme-light .sidebar-settings { background: var(--x-card, #fff); margin-bottom: 0; padding-bottom: 0; }
html.theme-light .sidebar-settings .nav-link { margin-bottom: 0; }
.sidebar-settings .nav-link { padding-top: 0.35rem; padding-bottom: 0.35rem; }
@media (min-width: 992px) {
  /* let the sidebar fill the column so Settings sits at the very bottom, whatever the menu length */
  body.app-body .app-sidebar#sidebarNav { display: flex !important; flex-direction: column; }
  body.app-body .app-sidebar#sidebarNav > .sidebar-inner { flex: 1 1 auto; }
  body.app-body .x-side { display: flex; flex-direction: column; }
  body.app-body .x-side > .app-sidebar { flex: 1 1 auto; }
  body.sidebar-collapsed .sidebar-settings .nav-link { justify-content: center; padding-left: 0; padding-right: 0; gap: 0; }
  body.sidebar-collapsed .sidebar-settings .nav-link > span { display: none; }
}
.sidebar-version a { color: inherit; opacity: 0.6; text-decoration: none; display: inline-flex; align-items: center; gap: 0.4rem; }
.sidebar-version a:hover { opacity: 1; text-decoration: underline; }
@media (min-width: 992px) {
  body.sidebar-collapsed .sidebar-version { padding-left: 0; padding-right: 0; text-align: center; }
  body.sidebar-collapsed .sidebar-version a > span { display: none; }
}

/* ---------- Compliance Calendar month grid (compliance/calendar.php); Bootstrap variables, so both themes ---------- */
.cal-month-title { min-width: 9.5rem; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head { padding: .45rem .5rem; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--bs-secondary-color); border-bottom: 1px solid var(--bs-border-color); background: var(--bs-tertiary-bg); }
.cal-cell { min-height: 7.25rem; padding: .35rem .4rem .5rem; border-right: 1px solid var(--bs-border-color); border-bottom: 1px solid var(--bs-border-color); display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-empty { background: var(--bs-tertiary-bg); opacity: .6; }
.cal-day { font-size: 0.8125rem; font-weight: 600; color: var(--bs-secondary-color); }
.cal-today .cal-day { display: inline-flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--bs-primary); color: #fff; }
.cal-chip { --chip: var(--bs-secondary); display: flex; align-items: center; gap: .35rem; font-size: 0.75rem; line-height: 1.25; padding: .15rem .4rem; border-radius: 6px; text-decoration: none; color: var(--bs-body-color); background: var(--bs-tertiary-bg); border: 1px solid var(--bs-border-color); min-width: 0; }
.cal-chip:hover { border-color: var(--chip); color: var(--bs-emphasis-color); }
.cal-chip-dot { flex: 0 0 .55rem; width: .55rem; height: .55rem; border-radius: 50%; background: var(--chip); }
.cal-chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-chip-planned { background: transparent; border-style: dashed; color: var(--bs-secondary-color); }
.cal-chip-planned .cal-chip-dot { background: transparent; border: 1.5px dashed var(--bs-secondary-color); }
.cal-chip-effective { background: var(--bs-info-bg-subtle); border-color: var(--bs-info-border-subtle); }
.cal-chip-effective .bi { font-size: 0.75rem; color: var(--bs-info-text-emphasis); }
.cal-chip-legend { display: inline-flex; margin-left: .35rem; pointer-events: none; }
.cal-legend { display: inline-flex; align-items: center; flex-wrap: wrap; }
.cal-agenda-day { display: flex; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--bs-border-color); }
.cal-agenda-day:last-child { border-bottom: 0; }
.cal-agenda-date { flex: 0 0 6.5rem; font-weight: 600; font-size: 0.875rem; color: var(--bs-secondary-color); padding-top: .2rem; }
.cal-agenda-day.cal-today .cal-agenda-date { color: var(--bs-primary); }
@media (max-width: 575.98px) {
  .cal-agenda-day { flex-direction: column; gap: .2rem; }
  .cal-agenda-date { flex-basis: auto; }
}

/* ---------- Regulatory Updates: circular text imported from a feed (tables kept, never wider than the card) ---------- */
.reg-body { overflow-x: auto; max-height: 34rem; overflow-y: auto; }
.reg-body table { width: 100%; }
.reg-body td, .reg-body th { padding: .15rem .35rem; vertical-align: top; }
.reg-ai-list li { margin-bottom: .35rem; }

/* ===================================================================================================================
   Visual review 2026-11-09, batch 2: pop-up notices, confirm dialog, error page, link pickers, dense lists,
   dashboard (upcoming groups, heatmap axes, graph tools). theme-light.css retints these with its tokens.
   =================================================================================================================== */

/* ---------- pop-up notices (partials/flash.php + window.GrcToast in app.js): bottom-right ---------- */
.app-toasts {
  position: fixed; bottom: 88px; right: 20px; z-index: 1090; width: min(380px, calc(100vw - 32px));
  display: flex; flex-direction: column; gap: 0.5rem; pointer-events: none;   /* bottom-right, above Ask Owl: never over the page's buttons */
}
.app-toast {
  --toast-c: #24589f;
  pointer-events: auto; display: flex; align-items: flex-start; gap: 0.65rem; padding: 0.75rem 0.7rem 0.75rem 0.9rem;
  background: #fff; color: var(--ink-2); border: 1px solid var(--cream-deep); border-left: 4px solid var(--toast-c); border-radius: 8px;
  box-shadow: 0 12px 32px -12px rgba(15, 29, 51, 0.38), 0 2px 6px rgba(15, 29, 51, 0.08); font-size: 0.9375rem; line-height: 1.4;
  animation: appToastIn 0.22s ease-out;
}
.app-toast.is-leaving { opacity: 0; transform: translateX(16px); transition: opacity 0.2s ease, transform 0.2s ease; }
.app-toast-icon { color: var(--toast-c); font-size: 1rem; line-height: 1.3; flex: none; }
.app-toast-body { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; padding-top: 0.05rem; }
.app-toast-close { flex: none; font-size: 0.75rem; margin-top: 0.3rem; opacity: 0.45; }
.app-toast-close:hover { opacity: 0.85; }
.app-toast-success { --toast-c: #1d7048; }
.app-toast-danger { --toast-c: #b3261e; }
.app-toast-warning { --toast-c: #b07a0c; }
.app-toast-info, .app-toast-secondary { --toast-c: #24589f; }
@keyframes appToastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .app-toast { animation: none; } .app-toast.is-leaving { transition: none; } }
@media (max-width: 575.98px) { .app-toasts { bottom: 80px; left: 16px; right: 16px; width: auto; } }

/* ---------- confirm dialog (window.GrcConfirm; every data-confirm form) ---------- */
.grc-confirm .modal-content { border-radius: 8px; border: 1px solid var(--cream-deep); box-shadow: 0 24px 48px -16px rgba(15, 29, 51, 0.35); }
.grc-confirm .modal-title { font-size: 1rem; font-weight: 600; color: var(--ink); line-height: 1.35; }
.grc-confirm-text { color: var(--bs-secondary-color); white-space: pre-line; overflow-wrap: anywhere; }
.grc-confirm .min-w-0 { min-width: 0; padding-top: 0.15rem; }
.grc-confirm-icon { flex: none; width: 2.5rem; height: 2.5rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 1.25rem; }
.grc-confirm-icon.is-danger { background: #fbe6e3; color: #b3261e; }
.grc-confirm-icon.is-info { background: #e6eefa; color: #24589f; }

/* ---------- error page inside the app (errors/error.php) ---------- */
.error-page {
  max-width: 540px; margin: 6vh auto 2rem; padding: 2.5rem 2rem 2rem; text-align: center;
  background: #fff; border: 1px solid var(--cream-deep); border-radius: 8px;
}
.error-page-icon {
  width: 4rem; height: 4rem; margin: 0 auto 1rem; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 1.75rem; background: var(--rust-tint); color: var(--ink);
}
.error-page-code { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--bs-secondary-color); margin-bottom: 0.35rem; }
.app-main h3.error-page-title { margin-bottom: 0.6rem; }
.error-page-detail { color: var(--ink-2); margin-bottom: 0.35rem; }
.error-page-hint { color: var(--bs-secondary-color); margin-bottom: 1.5rem; }

/* ---------- link pickers on record pages: quiet "+ Link ..." button, grey unlink icons ---------- */
.picker-open { margin-top: 0.15rem; }
.list-group-item .btn-link.text-danger:not(:hover):not(:focus-visible) { color: var(--bs-secondary-color) !important; opacity: 0.7; }

/* ---------- lists (tables with a column chooser): one line per cell, the record title at most two lines ----------
   app.js gives a cut-off cell its full text as a tooltip. Row buttons stay side by side. */
.table-hover[data-grid] > tbody > tr > td:not([colspan]) { white-space: nowrap; max-width: 12rem; overflow: hidden; text-overflow: ellipsis; }
/* a long pill (e.g. "Opportunity for Improvement") is cut with an ellipsis; status_badge() keeps the full label as its tooltip */
.table-hover[data-grid] > tbody > tr > td .badge { max-width: 8.5rem; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.table-hover[data-grid] > tbody > tr > td:not([colspan]):not(.text-nowrap):has(> a:only-child) { white-space: normal; min-width: 10.5rem; max-width: 26rem; }
.table-hover[data-grid] > tbody > tr > td:not(.text-nowrap) > a:only-child { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.table-hover[data-grid] > tbody > tr > td.cell-desc { min-width: 18rem; max-width: 34rem; }
.table-hover[data-grid] > tbody > tr > td.table-actions, .table-hover[data-grid] > tbody > tr > td:last-child:has(> form, > .btn) { max-width: none; overflow: visible; }
.table-actions { white-space: nowrap; width: 1%; }
.table-actions form { display: inline-block; }
.table-actions a:last-child, .table-actions form:last-child button { margin-right: 0; }

/* ---------- dashboard: upcoming groups, heatmap axes, graph tools ---------- */
.upc-group-head { display: flex; align-items: center; gap: 0.5rem; margin: 0.15rem 0 0.45rem; }
.upc-group-head ~ .upc-group-head { margin-top: 1.1rem; }
.upc-group-label { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--viz-ink-2); }
.upc-group-label.upc-group-overdue { color: #b4232f; }
.upc-group-n { font-size: 0.75rem; font-weight: 600; color: var(--viz-ink-2); background: var(--viz-track); border-radius: 999px; padding: 0.05rem 0.5rem; }
.upc-more { padding-left: 0.25rem; margin-top: 0.35rem; text-decoration: none; }
.heatmap-axis { font-size: 0.75rem; font-weight: 600; color: var(--viz-ink-2); text-align: center; padding: 0 0.35rem; font-variant-numeric: tabular-nums; }
.heatmap-ytitle { width: 1.4rem; padding: 0; vertical-align: middle; }
.heatmap-ytitle span { writing-mode: vertical-rl; transform: rotate(180deg); display: inline-block; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; color: var(--viz-ink-2); white-space: nowrap; }
.heatmap-xtitle { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; color: var(--viz-ink-2); text-align: center; padding-top: 0.15rem; }
/* a user graph's edit/remove buttons appear when the card is hovered or focused (always on touch screens) */
.custom-chart-card .flex-none .btn { opacity: 0; transition: opacity 0.15s ease; }
.dash-card:hover .custom-chart-card .flex-none .btn, .custom-chart-card:focus-within .flex-none .btn { opacity: 1; }
@media (hover: none) { .custom-chart-card .flex-none .btn { opacity: 1; } }

/* ===================================================================================================================
   Classic theme (stored value 'dark'; visual review 2026-11-09, batch 3): keeps its navy title bar, sidebar and
   gradient dashboard tiles, but pills, alerts, buttons and links now use the same six-tone status map as Light, so
   both themes say the same thing in the same colours. theme-light.css re-declares all of these with its own tokens.
   =================================================================================================================== */
:root {
  --st-good: #1d7048;    --st-good-bg: #e3f2ea;
  --st-warn: #8d5b06;    --st-warn-bg: #fbefd6;
  --st-bad: #b3261e;     --st-bad-bg: #fbe6e3;
  --st-info: #24589f;    --st-info-bg: #e6eefa;
  --st-neutral: #4c5970; --st-neutral-bg: #eef0f4;
}
/* pills: tinted backgrounds with strong text (Critical stays solid, see .badge-critical above) */
.badge { font-weight: 600; border-radius: 999px; padding: 0.34em 0.75em; letter-spacing: 0.01em; font-size: 0.75rem; }   /* fixed size, as in Light: a pill in a page title stays pill-sized */
.badge.text-bg-success, .badge.bg-success { background: var(--st-good-bg) !important; color: var(--st-good) !important; }
.badge.text-bg-danger, .badge.bg-danger { background: var(--st-bad-bg) !important; color: var(--st-bad) !important; }
.badge.text-bg-warning, .badge.bg-warning { background: var(--st-warn-bg) !important; color: var(--st-warn) !important; }
.badge.text-bg-primary, .badge.bg-primary, .badge.text-bg-info, .badge.bg-info { background: var(--st-info-bg) !important; color: var(--st-info) !important; }
.badge.text-bg-secondary, .badge.bg-secondary, .badge.text-bg-light, .badge.text-bg-dark, .badge.bg-dark { background: var(--st-neutral-bg) !important; color: var(--st-neutral) !important; }
.badge.badge-critical { background: #8e1b1b !important; color: #fff !important; }
.badge.badge-treat-accept { background: #efe9f8 !important; color: #5b3a96 !important; }
.badge.text-bg-light.border { border: 1px solid var(--bs-border-color) !important; }
.badge.text-dark { color: var(--st-neutral) !important; }
/* the unread count on the bell and the instance tag keep their own look */
.btn-navbar-icon .badge.bg-danger { background: #d5495a !important; color: #fff !important; }
/* alerts */
.alert-info, .alert-primary { background: var(--st-info-bg); color: var(--st-info); border-color: #cddcf3; }
.alert-warning { background: var(--st-warn-bg); color: var(--st-warn); border-color: #f1dca8; }
.alert-success { background: var(--st-good-bg); color: var(--st-good); border-color: #c4e2d0; }
.alert-danger { background: var(--st-bad-bg); color: var(--st-bad); border-color: #f2c9c3; }
/* buttons: one solid navy primary; outline buttons are quiet; Success/Dark/Info (old transition styles) read as primary */
.btn { font-weight: 600; }
.btn-outline-primary, .btn-outline-secondary, .btn-outline-dark, .btn-light {
  --bs-btn-color: var(--ink); --bs-btn-bg: #fff; --bs-btn-border-color: #d5d0c2;
  --bs-btn-hover-bg: var(--cream-soft); --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: #c2b9a2;
  --bs-btn-active-bg: var(--rust-tint); --bs-btn-active-color: var(--ink); --bs-btn-active-border-color: var(--rust-tint-strong);
  --bs-btn-disabled-color: #9a958a; --bs-btn-disabled-bg: #fff; --bs-btn-disabled-border-color: #e3ded0;
}
.btn-outline-danger { --bs-btn-color: var(--st-bad); --bs-btn-bg: #fff; --bs-btn-border-color: #efc3bd; --bs-btn-hover-bg: var(--st-bad-bg); --bs-btn-hover-color: var(--st-bad); --bs-btn-hover-border-color: #e8aaa2; --bs-btn-active-bg: var(--st-bad-bg); --bs-btn-active-color: var(--st-bad); }
.btn-success, .btn-dark, .btn-info { --bs-btn-color: #fff; --bs-btn-bg: var(--ink); --bs-btn-border-color: var(--ink); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--ink-dark); --bs-btn-hover-border-color: var(--ink-dark); --bs-btn-active-bg: var(--ink-dark); --bs-btn-active-border-color: var(--ink-dark); }
.btn-danger { --bs-btn-bg: var(--st-bad); --bs-btn-border-color: var(--st-bad); --bs-btn-hover-bg: #93201a; --bs-btn-hover-border-color: #93201a; --bs-btn-active-bg: #93201a; }
/* the back arrow keeps its quiet outline look (defined earlier, re-stated after the outline rules above) */
.btn.btn-back { --bs-btn-color: var(--ink); --bs-btn-bg: #fff; --bs-btn-border-color: var(--cream-deep); }
/* links: no permanent underline anywhere in the page (as in Light), underline on hover */
.app-main a:not(.btn):not(.dropdown-item):not(.nav-link):not(.badge) { text-decoration: none; }
.app-main a:not(.btn):not(.dropdown-item):not(.nav-link):not(.badge):hover { text-decoration: underline; text-underline-offset: 2px; }
/* page header (title + actions) wraps instead of squeezing the title */
.app-main > .container-fluid > .d-flex:has(> h3) { flex-wrap: wrap; gap: 0.75rem 1rem; }
.app-main > .container-fluid > .d-flex:has(> h3) > .d-flex, .app-main > .container-fluid > .d-flex:has(> h3) > div:last-child { flex-wrap: wrap; justify-content: flex-end; }

/* ---------- phones and tablets (visual review 2026-11-09, batch 3) ---------- */
/* Title bar (Classic): two compact rows - logo, icons and menu button, then the search box - instead of four. */
@media (max-width: 991.98px) {
  .app-navbar { min-height: 0; padding: 0.4rem 0.25rem; }
  .app-navbar > .container-fluid { row-gap: 0.45rem; }
  .app-navbar .brand-chip { width: 40px; height: 40px; border-radius: 8px; padding: 3px; }
  .app-navbar .navbar-brand { font-size: 1rem; margin-right: 0.5rem; }
  .app-navbar > .container-fluid > .btn-navbar-icon, .app-navbar > .container-fluid > .dropdown { order: 1; }
  .app-navbar > .container-fluid > .navbar-toggler { order: 2; margin-left: 0.5rem; padding: 0.3rem 0.5rem; }
  .app-navbar > .container-fluid > .app-search { order: 3; flex: 1 1 100%; max-width: none; margin: 0; }
}
/* Help / Support / the account name become icon buttons (their titles still name them) */
@media (max-width: 767.98px) {
  .nav-label { display: none; }
  .btn-navbar-icon { padding: 0.3rem 0.5rem; }
  .app-navbar .btn-navbar-icon.me-2 { margin-right: 0.3rem !important; }
  .owl-fab { width: 48px; height: 48px; }
  .owl-fab img { width: 32px; height: 32px; }
  .owl-widget { right: 14px; bottom: 14px; }
  .app-main h3 { font-size: 1.25rem; }
}
@media (max-width: 575.98px) {
  .app-navbar .navbar-brand > span.ms-2:not(.instance-badge) { display: none; }   /* the logo chip already says GRC Owl; the instance tag stays */
  /* Lists: each row becomes a small card of "label  value" lines (labels come from the column headings, app.js) */
  .table-hover[data-grid] > thead { display: none; }
  .table-hover[data-grid], .table-hover[data-grid] > tbody, .table-hover[data-grid] > tbody > tr { display: block; width: 100% !important; }
  .table-hover[data-grid] > tbody > tr {
    margin: 0.6rem; width: auto !important; padding: 0.4rem 0.8rem; background: #fff;
    border: 1px solid var(--bs-border-color); border-radius: 8px;
  }
  .table-hover[data-grid] > tbody > tr > td, .table-hover[data-grid] > tbody > tr > td:not([colspan]) {
    display: flex; justify-content: space-between; align-items: center; gap: 0.75rem;
    max-width: none; min-width: 0 !important; white-space: normal; text-align: right; border: 0 !important; padding: 0.22rem 0 !important;
  }
  .table-hover[data-grid] > tbody > tr > td[data-label]::before {
    content: attr(data-label); flex: none; max-width: 45%; text-align: left;
    font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--bs-secondary-color);
  }
  .table-hover[data-grid] > tbody > tr > td.table-actions { justify-content: flex-end; width: auto; padding-top: 0.4rem !important; }
  .table-hover[data-grid] > tbody > tr > td[colspan] { display: block; text-align: center; }
  .table-hover[data-grid] > tbody > tr > td.grid-col-hidden { display: none !important; }
  .table-hover[data-grid] > tbody > tr:hover > * { --bs-table-bg-state: transparent; }
}

/* ---------- record forms: section headings and side-by-side fields (crud/form.php + CrudController::$formLayout) ---------- */
.form-section { margin: 0.75rem 0 1rem; padding-top: 1.25rem; border-top: 1px solid var(--bs-border-color); }
.form-section.is-first { margin-top: 0; padding-top: 0; border-top: 0; }
.form-section-title { margin: 0; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-soft); }
.form-grid > .mb-3 { min-width: 0; }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; padding-top: 1.25rem; margin-top: 0.5rem; border-top: 1px solid var(--bs-border-color); }
@media (max-width: 575.98px) {
  /* a list card leads with the record's title, bold and without a label */
  .table-hover[data-grid] > tbody > tr > td:not(.text-nowrap):has(> a:only-child) { display: block; text-align: left; font-size: 1rem; padding-bottom: 0.35rem !important; }
  .table-hover[data-grid] > tbody > tr > td:not(.text-nowrap):has(> a:only-child)::before { display: none; }
  .table-hover[data-grid] > tbody > tr > td:not(.text-nowrap):has(> a:only-child) > a { font-weight: 600; }
  /* tab and pill rows stay on one line and scroll sideways instead of stacking */
  .app-main .nav-pills, .app-main .nav-tabs { flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none; max-width: 100%; min-width: 0; flex-basis: 100%; }
  .app-main .nav-pills .nav-link, .app-main .nav-tabs .nav-link { white-space: nowrap; }
}

/* ===== visual audit 2026-11-10, Priority 2: one solid button per region, quiet row actions, one button text size ===== */
.btn:not(.btn-sm):not(.btn-lg) { --bs-btn-font-size: 0.875rem; --bs-btn-padding-y: 0.46875rem; }
/* AI buttons: a violet tint, so the next workflow step is the only solid colour beside them */
.btn-ai {
  --bs-btn-color: #5b3a96; --bs-btn-bg: #efe9f8; --bs-btn-border-color: #dccff2;
  --bs-btn-hover-color: #48298f; --bs-btn-hover-bg: #e4d9f5; --bs-btn-hover-border-color: #cdbbec;
  --bs-btn-active-color: #48298f; --bs-btn-active-bg: #d9caf1; --bs-btn-active-border-color: #cdbbec;
  --bs-btn-disabled-color: #5b3a96; --bs-btn-disabled-bg: #efe9f8; --bs-btn-disabled-border-color: #dccff2;
}
/* a record with a workflow strip (.wf-strip): the FIRST forward step is the page's one solid button; Edit and any further forward step are outline */
.app-main:has(.wf-strip) .d-flex:has(> h3) .btn-primary.btn-sm:not(.btn-back),
.wf-strip form:has(.btn-go, .btn-progress) ~ form :is(.btn-go, .btn-progress) {
  --bs-btn-color: var(--ink); --bs-btn-bg: var(--bs-body-bg); --bs-btn-border-color: var(--bs-border-color);
  --bs-btn-hover-color: var(--ink); --bs-btn-hover-bg: var(--cream-soft, #f7f7f4); --bs-btn-hover-border-color: var(--ink-soft);
  --bs-btn-active-color: var(--ink); --bs-btn-active-bg: var(--cream-soft, #f7f7f4); --bs-btn-active-border-color: var(--ink-soft);
}
/* list rows: Edit / Delete / Remove are grey icons with no box until hovered or focused, so a page is not a column of red outlines */
.table[data-grid] > tbody > tr > td:last-child .btn.btn-sm:is(.btn-outline-primary, .btn-outline-secondary, .btn-outline-danger) {
  --bs-btn-color: var(--bs-secondary-color); --bs-btn-bg: transparent; --bs-btn-border-color: transparent;
}
@media (min-width: 768px) {
  .owl-fab { width: 40px; height: 40px; }
  .owl-fab img { width: 28px; height: 28px; }
}

/* ===== visual audit 2026-11-10, Priority 3: type scale (12/13/14/15/16/20/28), record titles, detail lists, pinned list columns ===== */
.nav-label { font-size: 0.875rem; font-weight: 500; }
/* a record's ID sits on its own small line above the serif title, so titles line up on the left */
.app-main h3 > .text-muted:first-child:not(.fs-6):not(.badge) { display: block; font-size: 0.8125rem; font-weight: 500 !important; letter-spacing: 0.02em; margin-bottom: 0.2rem; vertical-align: baseline; }
/* detail lists: a small muted label, the value in the heading colour */
.app-main dl.row > dt { font-size: 0.8125rem; font-weight: 500; color: var(--bs-secondary-color); padding-top: 0.15rem; }
.app-main dl.row > dd { color: var(--bs-emphasis-color); }
/* an audit's control list: three lines of the description, the rest on the control's own page */
.cl-desc { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
/* lists wider than the card: the first column and the Actions column stay put while the rest scrolls; rows are at least 48px */
@media (min-width: 576px) {
  .table-responsive > .table[data-grid] > tbody > tr > td { height: 3rem; }
  .table-responsive > .table[data-grid] > tbody > tr > td:first-child { position: sticky; left: 0; z-index: 1; background-color: var(--bs-card-bg, #fff); }
  .table-responsive > .table[data-grid] > thead > tr > th:first-child { position: sticky; left: 0; z-index: 2; background-color: var(--grid-head-bg, var(--bs-card-bg, #fff)); }
  .table-responsive > .table[data-grid] > tbody > tr > td:last-child:has(.btn) { position: sticky; right: 0; z-index: 1; background-color: var(--bs-card-bg, #fff); border-left: 1px solid var(--bs-border-color); }
  .table-responsive > .table[data-grid] > thead > tr > th.text-end:last-child { position: sticky; right: 0; z-index: 2; border-left: 1px solid var(--bs-border-color); background-color: var(--grid-head-bg, var(--bs-card-bg, #fff)); }
}

/* ===== page tabs (audits, Edit Profile): <ul data-page-tabs> switches .page-pane blocks. A pane that is not showing keeps its width
   (height 0 + hidden, not display:none) so the list grids inside can still measure their columns. ===== */
.page-pane:not(.is-active) { height: 0; overflow: hidden; visibility: hidden; }
.page-pane-host:not(:has(.page-pane.is-active)) { display: none; }

/* ===== visual audit 2026-11-10, Priority 4: notifications list ===== */
.notif-icon { flex: none; width: 2rem; height: 2rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--st-neutral-bg, #eef0f4); color: var(--st-neutral, #4c5970); font-size: 0.9375rem; }
.notif-icon.is-urgent { background: var(--st-bad-bg, #fbe6e3); color: var(--st-bad, #b3261e); }
.notif-unread { background: var(--st-info-bg, #e6eefa); }

/* ---------- Settings pane: second column beside the module sidebar; the page is the third ---------- */
.settings-pane { flex: 0 0 220px; width: 220px; padding: 1rem 0.6rem; border-right: 1px solid rgba(127, 139, 171, 0.3); background: #f4f6fa; color: #3d4a60; }
.settings-pane-title { font-weight: 700; padding: 0 0.6rem 0.75rem; color: var(--ink, #0b2545); }
.settings-pane .settings-section-label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: #7b879b; padding: 0.6rem 0.6rem 0.25rem; }
.settings-pane .nav-link { display: flex; align-items: center; gap: 0.55rem; padding: 0.42rem 0.6rem; border-radius: 6px; color: #3d4a60; font-size: 0.875rem; font-weight: 500; }
.settings-pane .nav-link:hover { background: rgba(11, 37, 69, 0.07); color: var(--ink, #0b2545); }
.settings-pane .nav-link.active { background: var(--ink, #0b2545); color: #fff; font-weight: 600; }
@media (min-width: 992px) { body.app-body .settings-pane { overflow-y: auto; } }
@media (max-width: 991.98px) { .settings-pane { flex: none; width: auto; border-right: 0; border-bottom: 1px solid rgba(127, 139, 171, 0.3); } }
html.theme-light .settings-pane { background: var(--x-card, #fff); border-right-color: var(--x-line, #e3e8ef); }
html.theme-light .settings-pane .nav-link.active { background: var(--x-primary-tint); color: var(--x-primary); }
html.theme-light .settings-pane .nav-link:hover { background: var(--x-hover); }
@media (min-width: 992px) { html.theme-light .settings-pane { overflow-y: auto; } }

/* ===================================================================================================================
   Visual audit 2026-11-22: form-select single-caret hygiene, tactile button feedback, empty states, integration card
   status borders, and visual theme preview cards.
   =================================================================================================================== */
.app-main { padding-bottom: 5rem; }
.form-select:not([multiple]):not([size]) {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px 12px;
  padding-right: 2.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
@media (prefers-reduced-motion: reduce) { .btn:active:not(:disabled) { transform: none; } }
.risk-sort-link:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
.table-actions .btn-sm { min-width: 2rem; min-height: 2rem; display: inline-flex; align-items: center; justify-content: center; padding: 0.25rem 0.45rem; }

/* Integration cards: left status accent matches the badge tone; title never squashes the badge */
.int-card { border-left-width: 3px; }
.int-card-good { border-left-color: var(--st-good); }
.int-card-warn { border-left-color: var(--st-warn); }
.int-card-bad { border-left-color: var(--st-bad); }
.int-card-title { min-width: 0; line-height: 1.3; }

/* Rich empty state for zero-data tables */
.empty-state { padding: 2.75rem 1.5rem; text-align: center; max-width: 26rem; margin: 0 auto; }
.empty-state-icon {
  width: 3rem; height: 3rem; margin: 0 auto 0.75rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--rust-tint); color: var(--ink); font-size: 1.25rem;
}
.empty-state-title { font-weight: 600; font-size: 1rem; color: var(--ink); margin-bottom: 0.25rem; }
.empty-state-desc { font-size: 0.875rem; color: var(--bs-secondary-color); margin-bottom: 1rem; }

/* Visual theme swatch picker (Edit Profile > Preferences) */
.theme-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0.75rem; }
.theme-card {
  position: relative; display: flex; flex-direction: column; gap: 0.6rem; padding: 0.75rem;
  border: 1.5px solid var(--bs-border-color); border-radius: 8px; background: var(--bs-body-bg);
  cursor: pointer; transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.theme-card input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.theme-card:hover { border-color: var(--ink-soft); }
.theme-card:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }
.theme-card.is-selected { border-color: var(--ink); box-shadow: 0 0 0 3px var(--bs-focus-ring-color); }
.theme-swatch {
  display: flex; height: 64px; border-radius: 6px; overflow: hidden;
  border: 1px solid rgba(15, 29, 51, 0.12);
}
.theme-swatch .ts-side { width: 26%; height: 100%; }
.theme-swatch .ts-main { flex: 1; display: flex; flex-direction: column; }
.theme-swatch .ts-top { height: 14px; }
.theme-swatch .ts-cards { flex: 1; display: flex; gap: 6px; padding: 8px; }
.theme-swatch .ts-cards span { flex: 1; border-radius: 4px; }
.theme-swatch-light .ts-side { background: #ffffff; border-right: 1px solid #e2e6ec; }
.theme-swatch-light .ts-top { background: #ffffff; border-bottom: 1px solid #e2e6ec; }
.theme-swatch-light .ts-main { background: #f5f6f8; }
.theme-swatch-light .ts-cards span { background: #ffffff; border: 1px solid #e2e6ec; }
.theme-swatch-classic .ts-side { background: #0b2545; }
.theme-swatch-classic .ts-top { background: #0b2545; border-bottom: 2px solid #8a4627; }
.theme-swatch-classic .ts-main { background: #fbfaf7; }
.theme-swatch-classic .ts-cards span:first-child { background: linear-gradient(135deg, #0b2545, #274972); }
.theme-swatch-classic .ts-cards span:last-child { background: linear-gradient(135deg, #1f7a63, #2fa688); }
.theme-card-meta strong { display: block; font-size: 0.9375rem; color: var(--ink); }
.theme-card-meta small { display: block; font-size: 0.78rem; color: var(--bs-secondary-color); line-height: 1.3; }
