/*
Copyright © 2023 FirstWave. All Rights Reserved.
SPDX-License-Identifier: LicenseRef-Proprietary-FirstWave-202502
*/

/* ═══════════════════════════════════════════════════════════════
   Open-AudIT Enterprise — theme overrides on top of Bootstrap 5.
   Load order: bootstrap.min.css → datatables.min.css → this file.
   Colour modes follow Bootstrap's data-bs-theme attribute.
   ═══════════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════
   LUCIDE ICON STYLING
   Icons loaded via <i data-lucide="name">.
   Lucide generates <svg class="lucide lucide-{name}">
   which inherits color via stroke="currentColor".
   ══════════════════════════════════════════════════ */
.lucide {
  width: 16px; height: 16px;
  stroke-width: 2;
  vertical-align: -0.125em;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════
   THEME VARIABLES — WCAG AA compliant
   Custom palette plus mappings onto Bootstrap's
   --bs-* variables so stock components inherit it.
   ══════════════════════════════════════════════════ */
:root {
  --header-h: 56px;
  --footer-h: 48px;
  --sidebar-w: 64px;
  --sidebar-w-expanded: 220px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  /* Button corner radius. Shared so a control that has to sit alongside a button in a toolbar
     can match it without repeating the value. */
  --radius-btn: 8px;
  /* Space between adjacent toolbar controls. 6.4px is what separates Create from Import CSV
     in the collection header: their 4px margin plus the word space between the two inline
     anchors in the markup. Shared so the table toolbar can match that header exactly. */
  --gap-toolbar: 6.4px;
  --transition: 0.2s ease;
  /* JetBrains Mono is served from public/fonts via fonts.css, which every page loads first,
     so this never reaches the network. The fallbacks only matter if that woff2 fails: no one
     monospace face ships on Linux, macOS and Windows alike, so the list names the best
     available on each in turn before the generic. */
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas,
               'Liberation Mono', 'DejaVu Sans Mono', monospace;

  /* Chart fills. Declared here rather than in the two colour-mode blocks, so they hold the
     same value in light and dark.
     The palette tokens are tuned for text contrast: on white they have to be deep to reach
     4.5:1, which is right for a word or a 1px border but reads as mud across a donut segment
     -- light-mode --warning (#8a6d00) in particular rendered as olive-brown. A chart fill
     carries no text, so it is free to take the brighter values the dark palette uses.
     Keep each in step with the dark-mode token it mirrors. Chart *text* still reads the
     mode's own tokens; only fills come from here. */
  --chart-red: #f87171;        /* mirrors dark --danger */
  --chart-yellow: #facc15;     /* mirrors dark --warning */
  --chart-green: #22c55e;      /* mirrors dark --success */
  --chart-orange: #fb923c;     /* mirrors dark --severity-high */
  --chart-blue: #60a5fa;       /* mirrors dark --info */
  /* Value labels drawn inside a slice. The fills above are bright in both modes, so the
     label is dark in both modes too: measured 6.4:1 to 11.6:1 across the five fills,
     against 1.5:1 to 2.8:1 for the white ApexCharts draws by default -- on --chart-yellow
     that default is invisible. */
  --chart-label: #111827;

  /* Top navigation bar. Declared here rather than in the two colour-mode blocks, so the bar is
     the brand navy with white text in light and dark alike. #1f284f is the navy the logo chip
     already used. White on it measures 14.2:1.
     The hover fill is white at 12% laid over the navy, written out solid: white text on it
     measures 9.8:1, and it sits 1.45:1 off the bar so the hover reads. */
  --nav-bg: #1f284f;
  --nav-fg: #ffffff;
  --nav-hover-bg: #3a4264;
}

/* Dark theme — surfaces ~L0.01, muted text >=4.5:1 */
[data-bs-theme="dark"] {
  --bg-deepest: #0a0c10;
  --bg-deep: #0f1218;
  --bg-surface: #151920;
  --bg-elevated: #1a1f2a;
  --bg-hover: #222836;
  --field-editable: #222836;   /* lighter than --bg-elevated #1a1f2a */
  /* Panel behind a dashboard widget glyph, which sits on a coloured alert. It has to be
     translucent rather than a flat surface colour, so the alert's own hue shows through and
     the panel reads as a lighter shade of that alert rather than an unrelated grey block.
     A white lift works in both themes; dark needs far less of it to stay subtle. */
  --widget-icon-bg: rgba(255, 255, 255, 0.12);
  --border: #1e2533;
  --border-light: #2a3144;
  --text-primary: #e2e8f0;       /* ~15.5:1 on surface */
  --text-secondary: #8b95a8;     /* ~5.6:1 on surface */
  --text-muted: #7f8fa3;         /* ~4.8:1 on surface */
  --text-heading: #9296d3;       /* ~7.0:1 on deepest, 6.3:1 on surface */
  --accent: #22d3bb;             /* ~9.0:1 on surface */
  --accent-dim: #1aab98;
  --accent-glow: rgba(34, 211, 187, 0.15);
  --accent-glow-strong: rgba(34, 211, 187, 0.3);
  --accent-contrast: #0a0c10;    /* text on --accent: ~11:1 */
  --warning: #facc15;            /* 11.5:1 on surface #151920, hue 48deg */
  --warning-glow: rgba(250, 204, 21, 0.12);
  --warning-glow-strong: rgba(250, 204, 21, 0.25);
  --danger: #f87171;             /* ~6.1:1 on surface */
  --danger-glow: rgba(248, 113, 113, 0.12);
  --danger-glow-strong: rgba(248, 113, 113, 0.25);
  --severity-high: #fb923c;      /* ~7.8:1 on surface */
  --severity-high-glow: rgba(251, 146, 60, 0.12);
  --severity-high-glow-strong: rgba(251, 146, 60, 0.25);
  --purple: #a78bfa;             /* 6.5:1 on surface #151920 */
  --purple-glow: rgba(167, 139, 250, 0.12);
  --purple-glow-strong: rgba(167, 139, 250, 0.25);
  /* Channel triplets for Bootstrap's utility classes, which read --bs-*-rgb rather than
     --bs-*. Keep each in step with the hex above it. */
  --success-rgb: 34, 197, 94;
  --danger-rgb: 248, 113, 113;
  --warning-rgb: 250, 204, 21;
  --info-rgb: 96, 165, 250;
  --accent-rgb: 34, 211, 187;
  --info-glow: rgba(96, 165, 250, 0.12);
  --info-glow-strong: rgba(96, 165, 250, 0.25);
  --success: #22c55e;            /* ~5.7:1 on surface */
  --success-glow: rgba(34, 197, 94, 0.12);
  --success-glow-strong: rgba(34, 197, 94, 0.25);
  --info: #60a5fa;               /* ~5.3:1 on surface */
  --info-soft: #6e88b0;          /* 4.9:1 on surface. Field help icons, deliberately quieter. */
  --shadow-card: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-dropdown: 0 16px 48px rgba(0,0,0,0.5);
  --panel-overlay: rgba(0,0,0,0.5);
}

/* Light theme — surfaces ~L1.0, all text >=4.5:1 on white */
[data-bs-theme="light"] {
  --bg-deepest: #f4f5f7;
  --bg-deep: #ffffff;
  --bg-surface: #ffffff;
  --bg-elevated: #f0f1f4;
  --bg-hover: #e8eaef;
  --field-editable: #ffffff;   /* lighter than --bg-elevated #f0f1f4 */
  --widget-icon-bg: rgba(255, 255, 255, 0.4);
  --border: #e2e4ea;
  --border-light: #d1d5dc;
  --text-primary: #111827;       /* ~18.4:1 on white */
  --text-secondary: #4b5563;     /* ~8.3:1 on white */
  --text-muted: #5c6878;         /* ~5.7:1 on white */
  --text-heading: #444aa8;       /* ~6.9:1 on deepest, 7.5:1 on white */
  --accent: #0f766e;             /* ~5.5:1 on white */
  --accent-dim: #0d6359;
  --accent-glow: rgba(15, 118, 110, 0.1);
  --accent-glow-strong: rgba(15, 118, 110, 0.2);
  --accent-contrast: #ffffff;    /* text on --accent: ~5.5:1 */
  --warning: #8a6d00;            /* 4.9:1 on white, hue 47deg. A true yellow cannot reach
                                    4.5:1 on white, so light mode is the same hue held dark
                                    enough to read. Was #b45309, hue 26deg, which sat too
                                    close to --severity-high at hue 18deg. */
  --warning-glow: rgba(138, 109, 0, 0.08);
  --warning-glow-strong: rgba(138, 109, 0, 0.16);
  --danger: #dc2626;             /* ~5.8:1 on white */
  --danger-glow: rgba(220, 38, 38, 0.08);
  --danger-glow-strong: rgba(220, 38, 38, 0.16);
  --severity-high: #c2410c;      /* ~5.2:1 on white */
  --severity-high-glow: rgba(194, 65, 12, 0.08);
  --severity-high-glow-strong: rgba(194, 65, 12, 0.16);
  --purple: #6d28d9;             /* 7.1:1 on white */
  --purple-glow: rgba(109, 40, 217, 0.08);
  --purple-glow-strong: rgba(109, 40, 217, 0.16);
  --success-rgb: 21, 128, 61;
  --danger-rgb: 220, 38, 38;
  --warning-rgb: 138, 109, 0;
  --info-rgb: 29, 78, 216;
  --accent-rgb: 15, 118, 110;
  --info-glow: rgba(29, 78, 216, 0.08);
  --info-glow-strong: rgba(29, 78, 216, 0.16);
  --success: #15803d;            /* ~5.5:1 on white */
  --success-glow: rgba(21, 128, 61, 0.08);
  --success-glow-strong: rgba(21, 128, 61, 0.16);
  --info: #1d4ed8;               /* ~7.6:1 on white */
  --info-soft: #6c8ebf;          /* 3.4:1 on white. Field help icons, deliberately quieter. */
  --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.04);
  --shadow-dropdown: 0 12px 36px rgba(0,0,0,0.12);
  --panel-overlay: rgba(0,0,0,0.2);
}

/* Map the palette onto Bootstrap's theme variables */
[data-bs-theme="dark"],
[data-bs-theme="light"] {
  --bs-body-bg: var(--bg-deepest);
  --bs-body-color: var(--text-primary);
  --bs-secondary-color: var(--text-secondary);
  --bs-tertiary-color: var(--text-muted);
  --bs-secondary-bg: var(--bg-surface);
  --bs-tertiary-bg: var(--bg-elevated);
  --bs-emphasis-color: var(--text-primary);
  --bs-border-color: var(--border);
  --bs-link-color: var(--accent);
  --bs-link-hover-color: var(--accent-dim);
  --bs-danger: var(--danger);
  --bs-success: var(--success);
  --bs-warning: var(--warning);
  --bs-info: var(--info);
  --bs-primary: var(--accent);
  /* Bootstrap's .text-*, .bg-* and .progress-bar utilities read the -rgb forms, not the
     ones above, so without these they kept Bootstrap's stock palette: .text-primary was
     rendering Bootstrap blue rather than the theme accent, and .bg-warning its own yellow.
     Mapping them puts every colour utility in the GUI on the same tokens as everything
     else, with no template change. */
  --bs-success-rgb: var(--success-rgb);
  --bs-danger-rgb: var(--danger-rgb);
  --bs-warning-rgb: var(--warning-rgb);
  --bs-info-rgb: var(--info-rgb);
  --bs-primary-rgb: var(--accent-rgb);
}

body {
  --bs-body-font-family: 'Plus Jakarta Sans', sans-serif;
  --bs-body-font-size: 14px;
  --bs-body-line-height: 1.5;
  /* code, pre, kbd and samp read this. Without the override they fell back to Bootstrap's
     own stack, which resolves to a different face on each operating system. */
  --bs-font-monospace: var(--font-mono);
}

html, body {
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

/* ── Focus ring for keyboard nav ── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ──────────────── NOISE (dark only) ──────────────── */
[data-bs-theme="dark"] body::before {
  content: '';
  position: fixed; inset: 0; z-index: 9999;
  pointer-events: none; opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 256px;
}

/* ──────────────── SCROLLBAR ──────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ──────────────── TOP HEADER (navbar) ──────────────── */
.header.navbar {
  --bs-navbar-padding-y: 0;
  --bs-navbar-padding-x: 0;
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--nav-bg);
  display: flex; align-items: center; flex-wrap: nowrap;
  padding: 0 20px;
  z-index: 1040;
}

.header-logo {
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
  margin-right: 36px;
}
.header-logo .logo-icon {
  width: 30px;
  height: 30px;
  background-color: var(--nav-fg);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--nav-bg);
  font-weight: 700;
  font-size: 11px;
  border: 0;
  padding: 0;
  font-family: inherit;
  line-height: 1;
}

.header-logo .logo-icon .lucide { width: 14px; height: 14px; }

.header-logo > span {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600; font-size: 13px; letter-spacing: 0.3px;
  white-space: nowrap;
  color: var(--nav-fg);
}
/* The product name is a link. The global link colour is --accent, which on the navy bar is
   2.6:1 in light mode. */
.header-logo > span a,
.header-logo > span a:hover { color: inherit; }

.header-nav { display: flex; align-items: center; gap: 2px; flex: 1; }

/* ── Navbar dropdowns (Bootstrap .dropdown, hover + click) ── */
.header .nav-item { position: relative; }

.header .nav-item > .nav-link {
  /* The bar's own foreground, so the labels read clearly on the navy. Hover separates
     itself with --nav-hover-bg behind the label. */
  background: none; border: none; color: var(--nav-fg);
  font-family: inherit; font-size: 13px; font-weight: 500;
  padding: 8px 14px; border-radius: var(--radius-sm);
  cursor: pointer; display: flex; align-items: center; gap: 6px;
  transition: all var(--transition);
}
/* Lucide chevron replaces Bootstrap's caret */
.header .dropdown-toggle::after { display: none; }

.header .nav-item > .nav-link:hover,
.header .nav-item:hover > .nav-link,
.header .nav-item.show > .nav-link {
  background: var(--nav-hover-bg); color: var(--nav-fg);
}
.header .nav-item > .nav-link .lucide-chevron-down {
  width: 12px; height: 12px; transition: transform var(--transition);
}
/* The right-hand menus carry an icon each, shown only once the header is too narrow for their
   labels (see the narrow viewport rules at the end of this section). */
.header .nav-item > .nav-link .nav-icon { display: none; }
.header .nav-item:hover > .nav-link .lucide-chevron-down,
.header .nav-item.show > .nav-link .lucide-chevron-down { transform: rotate(180deg); }

/* Dropdown menu — Bootstrap component, restyled + animated */
.dropdown-menu {
  --bs-dropdown-bg: var(--bg-elevated);
  --bs-dropdown-border-color: var(--border-light);
  /* Menu items are header text too, so keep them light rather than muted. Hover
     is still distinguished by --bs-dropdown-link-hover-bg. */
  --bs-dropdown-link-color: var(--text-primary);
  --bs-dropdown-link-hover-color: var(--text-primary);
  --bs-dropdown-link-hover-bg: var(--bg-hover);
  --bs-dropdown-link-active-color: var(--text-primary);
  --bs-dropdown-link-active-bg: var(--bg-hover);
  min-width: 210px;
  padding: 6px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-dropdown);
  font-size: 13px;
}

/* Header menus open on hover or click (.show), animated like the original */
.header .nav-item > .dropdown-menu {
  display: block;
  position: absolute; top: calc(100% + 6px); left: 0;
  margin: 0;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: all var(--transition);
  z-index: 1050;
}

/* The rule above anchors every header menu to the left edge of its nav item, which is right
 * for the menus on the left of the bar. The user menu is the last item on the far right, so
 * a 210px wide menu opening rightwards runs off the viewport. Anchor that one to its right
 * edge instead, so it opens leftwards. */
.header .nav-item > .dropdown-menu.dropdown-menu-end {
  left: auto;
  right: 0;
}
.header .nav-item:hover > .dropdown-menu,
.header .nav-item.show > .dropdown-menu {
  opacity: 1; visibility: visible; transform: translateY(0);
}
/* The menu sits 6px below its nav item. Hover is what holds it open, so a pointer crossing that
 * gap would leave the nav item and drop the menu. This transparent strip fills the gap and the
 * menu's top border, and belongs to the menu, so the pointer never leaves the nav item on the way
 * down. It takes the menu's visibility, so it catches nothing while the menu is closed. */
.header .nav-item > .dropdown-menu::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: 100%;
  height: calc(6px + var(--bs-dropdown-border-width));
}

.dropdown-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px;
  font-size: 13px; border-radius: var(--radius-sm);
  transition: all 0.15s;
}
.dropdown-item .lucide { width: 15px; height: 15px; color: var(--text-muted); flex-shrink: 0; }
.dropdown-item:hover .lucide { color: var(--accent); }

.dropdown-divider {
  --bs-dropdown-divider-bg: var(--border);
  margin: 4px 8px; opacity: 1;
}

.dropdown-menu .shortcut {
  margin-left: auto; font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: var(--text-muted);
  background: var(--bg-hover); padding: 2px 6px; border-radius: 4px;
}

/* ── Second-level submenus (Bootstrap 5 has none natively) ── */
.dropdown-menu .dropdown-submenu { position: relative; }
.dropdown-menu .dropdown-submenu > .dropdown-item { justify-content: flex-start; }
.dropdown-menu .dropdown-submenu .submenu-arrow {
  margin-left: auto;
  width: 12px; height: 12px;
  color: var(--text-muted);
  transition: color var(--transition);
}
.dropdown-menu .dropdown-submenu:hover > .dropdown-item .submenu-arrow { color: var(--accent); }

.dropdown-menu .dropdown-submenu > .dropdown-menu {
  display: block;
  position: absolute;
  left: calc(100% + 4px);
  top: -6px;
  min-width: 190px;
  margin: 0;
  opacity: 0; visibility: hidden; transform: translateX(-6px);
  transition: all var(--transition);
  z-index: 1060;
}
.dropdown-menu .dropdown-submenu:hover > .dropdown-menu {
  opacity: 1; visibility: visible; transform: translateX(0);
}
/* Same for the 4px between a submenu and its parent row, on the submenu's left. */
.dropdown-menu .dropdown-submenu > .dropdown-menu::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  right: 100%;
  width: calc(4px + var(--bs-dropdown-border-width));
}

/* The menus in the right-hand group open from their right edge, as Licenses and the user menu
 * already did, and their submenus (Help > Defaults) open to the left. Opening rightwards from
 * that far across the bar, Help > Defaults ran 28px off screen even at 1920px, and on narrower
 * viewports the Settings, Help and Modules menus did too. */
.header-right .nav-item > .dropdown-menu { left: auto; right: 0; }
.header-right .dropdown-submenu > .dropdown-menu {
  left: auto; right: calc(100% + 4px); transform: translateX(6px);
}
.header-right .dropdown-submenu > .dropdown-menu::before { right: auto; left: 100%; }
.dropdown-menu .dropdown-submenu > .dropdown-menu .dropdown-item { padding: 8px 12px; }
.dropdown-menu .dropdown-submenu > .dropdown-menu .dropdown-item .lucide { width: 14px; height: 14px; }

/* Header right */
.header-right { display: flex; align-items: center; gap: 6px; margin-left: auto; }
/* The theme toggle and user menu sit outside the collapsible menus (shared/header.php), so on
   narrow viewports they stay in the bar beside the hamburger. Spaced as if still inside
   .header-right. */
.header-actions { display: flex; align-items: center; gap: 6px; margin-left: 6px; }

.header-badge {
  display: flex; align-items: center; gap: 6px;
  background: var(--accent-glow); border: 1px solid rgba(34,211,187,0.2);
  padding: 5px 12px; border-radius: 20px;
  font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 500; color: var(--accent);
}
.header-badge .pulse {
  width: 6px; height: 6px; background: var(--accent); border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 var(--accent-glow-strong); }
  50% { opacity: 0.7; box-shadow: 0 0 0 6px transparent; }
}

.header-icon-btn {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border: none; background: none; color: var(--nav-fg);
  border-radius: 8px; cursor: pointer; transition: all var(--transition);
  position: relative; font-size: 18px;
}
.header-icon-btn:hover { background: var(--nav-hover-bg); color: var(--nav-fg); }
/* Set once the dashboard has been made the default: the button disables itself. Its
   colour stays the bar's foreground, same as its neighbours, because light-mode --accent
   is 2.6:1 on the navy. The `disabled` attribute is what marks it. */
.header-icon-btn.is-default,
.header-icon-btn.is-default:disabled { color: var(--nav-fg); opacity: 1; }
/* A disabled header button is not a control: no pointer, no hover highlight. The homepage
   button is disabled on the homepage and on a page that cannot be one. */
.header-icon-btn:disabled { cursor: default; }
.header-icon-btn:disabled:hover { background: none; }
.header-icon-btn .lucide { width: 18px; height: 18px; }
.header-icon-btn .notif-dot {
  position: absolute; top: 5px; right: 5px;
  width: 8px; height: 8px; background: var(--danger);
  border-radius: 50%; border: 2px solid var(--nav-bg);
}

.header-avatar {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--nav-fg);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--nav-bg);
  cursor: pointer; margin-left: 4px; transition: box-shadow var(--transition);
  /* It is a real button, so clear the user agent border, padding and font inheritance. */
  border: 0; padding: 0; font-family: inherit; line-height: 1;
}
.header-avatar:hover { box-shadow: 0 0 0 2px var(--nav-bg), 0 0 0 4px #6366f1; }

/* Narrow viewports. The full header needs 1532px, and it is fixed, so anything past the right
 * edge could not be reached at all (at 1280px that was Modules, Licenses, the theme toggle and
 * the user menu). Two steps, so labels are only given up once spacing alone cannot make room:
 *   below 1536px, tighter spacing, and the product name on two lines;
 *   below 1260px, the five right-hand menus also show only their icon.
 * Together these hold the whole header on screen down to about 1009px. */
@media (max-width: 1535.98px) {
  .header.navbar { padding: 0 12px; }
  .header-logo { margin-right: 16px; }
  .header-logo > span { white-space: normal; max-width: 17ch; line-height: 1.25; }
  .header-nav { gap: 0; }
  .header .nav-item > .nav-link { padding: 8px 9px; gap: 4px; }
  .header-right { gap: 2px; }
  .header-actions { gap: 2px; margin-left: 2px; }
}
/* The label stays in the button as visually hidden text, so it is still the button's accessible
 * name, and the button's title gives sighted users the same word as a tooltip. */
@media (max-width: 1259.98px) {
  .header-right .nav-item > .nav-link { padding: 8px; }
  .header-right .nav-item > .nav-link .nav-icon { display: block; width: 18px; height: 18px; }
  .header-right .nav-item > .nav-link .lucide-chevron-down { display: none; }
  .header-right .nav-item > .nav-link .nav-label {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
  }
}
/* Below Bootstrap's lg breakpoint even the icon-only header does not fit (it needs about 981px),
 * so the menus fold into a drawer behind a hamburger: Bootstrap's navbar-expand-lg with a
 * .navbar-collapse (shared/header.php). The theme toggle and user menu stay in the bar.
 * The bar is sticky here rather than fixed, so the open drawer pushes the page down instead of
 * covering it, and the drawer scrolls when it is taller than the screen.
 * In the drawer a menu opens in place, below its row, on a click, and so does a submenu
 * (footer.php), since rows that expanded on hover would move everything under the pointer. */
@media (max-width: 991.98px) {
  .header.navbar { position: sticky; height: auto; flex-wrap: wrap; }
  .header-logo { min-height: var(--header-h); }
  .header .navbar-toggler {
    display: flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; padding: 0; margin-left: auto;
    border: 0; border-radius: 8px; color: var(--nav-fg);
    transition: all var(--transition);
  }
  .header .navbar-toggler:hover { background: var(--nav-hover-bg); }
  /* Bootstrap rings the toggler on any focus, a mouse click included. The theme's :focus-visible
     outline already marks keyboard focus, as on the other header buttons. */
  .header .navbar-toggler:focus { box-shadow: none; }
  .header .navbar-toggler .lucide { width: 20px; height: 20px; }
  .header .navbar-collapse {
    order: 1;
    max-height: calc(100vh - var(--header-h)); overflow-y: auto;
    padding: 6px 0 12px;
    border-top: 1px solid var(--nav-hover-bg);
  }
  .header .navbar-collapse .header-nav,
  .header .navbar-collapse .header-right {
    flex-direction: column; align-items: stretch; gap: 0; margin-left: 0;
  }
  .header .navbar-collapse .header-right {
    margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--nav-hover-bg);
  }
  /* Full width rows, every label shown, the chevron at the far end. */
  .header .navbar-collapse .nav-item > .nav-link { width: 100%; padding: 10px 12px; }
  .header .navbar-collapse .nav-item > .nav-link .nav-icon { display: none; }
  .header .navbar-collapse .nav-item > .nav-link .nav-label {
    position: static; width: auto; height: auto; margin: 0;
    overflow: visible; clip: auto; white-space: normal;
  }
  .header .navbar-collapse .nav-item > .nav-link .lucide-chevron-down { display: block; margin-left: auto; }
  .header .navbar-collapse .nav-item:not(.show) > .nav-link .lucide-chevron-down { transform: none; }
  /* Menus and submenus in the flow, shown only once clicked open. */
  .header .navbar-collapse .nav-item > .dropdown-menu,
  .header .navbar-collapse .dropdown-submenu > .dropdown-menu {
    display: none; position: static; box-shadow: none; transform: none;
  }
  .header .navbar-collapse .nav-item > .dropdown-menu { margin: 2px 0 8px; }
  .header .navbar-collapse .dropdown-submenu > .dropdown-menu {
    min-width: 0; margin: 2px 0 4px 18px; padding: 0 0 0 6px;
    border: 0; border-left: 2px solid var(--border); border-radius: 0;
  }
  .header .navbar-collapse .nav-item.show > .dropdown-menu,
  .header .navbar-collapse .dropdown-submenu.show > .dropdown-menu {
    display: block; opacity: 1; visibility: visible;
    animation: fadeUp 0.2s ease-out;
  }
  .header .navbar-collapse .dropdown-submenu.show > .dropdown-item .submenu-arrow { transform: rotate(90deg); }
  /* The hover bridges only matter for menus that float clear of their row. */
  .header .navbar-collapse .dropdown-menu::before { display: none; }
}

/* ──────────────── SIDEBAR ──────────────── */
.sidebar {
  position: fixed; top: var(--header-h); left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-deep);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 0; z-index: 1030;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: visible;
}
.sidebar:hover { width: var(--sidebar-w-expanded); }

.sidebar-item {
  width: calc(100% - 16px);
  margin: 2px 8px;
  display: flex;
  align-items: center; gap: 12px;
  padding: 10px 14px;
  border: none;
  background: none;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  cursor: pointer; transition: all var(--transition);
  white-space: nowrap; overflow: hidden; position: relative;
  font-family: inherit; font-size: 13px; font-weight: 500;
}
.sidebar-item .lucide { width: 20px; height: 20px; flex-shrink: 0; transition: color var(--transition); }
/* Sidebar items rendered as links (e.g. Devices) look identical to the buttons */
a.sidebar-item { text-decoration: none; color: var(--text-muted); }
a.sidebar-item:hover { color: var(--text-primary); }
.sidebar-item span { opacity: 0; transition: opacity var(--transition); }
.sidebar:hover .sidebar-item span { opacity: 1; }
.sidebar-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-item.active {
  background: var(--accent-glow);
  color: var(--accent);
}
.sidebar-item.active .lucide { color: var(--accent); }
.sidebar-item.active::before {
  content: ''; position: absolute; left: -8px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; background: var(--accent); border-radius: 0 3px 3px 0;
}

.sidebar-divider {
  width: 28px; height: 1px; background: var(--border); margin: 8px auto;
  transition: width 0.25s;
}
.sidebar:hover .sidebar-divider { width: calc(100% - 32px); }
.sidebar-spacer { flex: 1; }

/* ── Sidebar flyout submenus ── */
.sidebar-group {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sidebar-flyout {
  position: absolute;
  left: 100%;
  top: 0;
  min-width: 200px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 6px;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-6px);
  transition: all var(--transition);
  box-shadow: var(--shadow-dropdown);
  z-index: 1050;
  margin-left: 4px;
}
.sidebar-group:hover > .sidebar-flyout,
.sidebar-group.flyout-open > .sidebar-flyout {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}
/* The flyout's 4px margin leaves a gap between a sidebar entry and its flyout, and the sidebar's
 * 1px right border, which belongs to .sidebar rather than the hovered group, lies in that gap. A
 * pointer crossing it left the group and dropped the flyout. This transparent strip fills the gap
 * and the flyout's own border, and belongs to the flyout, so the pointer never leaves the group.
 * It takes the flyout's visibility, so it catches nothing while the flyout is closed. */
.sidebar-flyout::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  right: 100%;
  width: 5px;
}

/* Bottom-aligned flyout for items near the bottom of the sidebar (Summary,
 * Hardware, Software, Settings and the gear menu): the flyout's bottom edge
 * sits level with its sidebar entry and the menu grows upward, capped to the
 * viewport and scrolling inside when a menu is taller than the screen. */
.sidebar-group.flyout-bottom > .sidebar-flyout {
  top: auto;
  bottom: 0;
}

/* A bottom-aligned flyout keeps its last item level with its sidebar entry.
 * When a menu is too tall for the space above the entry, the footer JS
 * repositions it to start just below the header and run on down past the
 * entry, so nothing scrolls and nothing leaves the top of the viewport. */

.sidebar-flyout-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 6px 12px 4px;
}

.sidebar-flyout a {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 12px; color: var(--text-secondary);
  font-size: 13px; text-decoration: none; border-radius: var(--radius-sm);
  transition: all 0.15s; white-space: nowrap;
}
/* Item counts in the Hardware / Software / Settings flyouts. The link is a
 * flex row, so margin-left auto pushes the count to the right edge. */
.sidebar-flyout a .flyout-count {
  margin-left: auto;
  padding-left: 12px;
  font-size: 11px;
  color: var(--text-muted, var(--text-secondary));
}
.sidebar-flyout a:hover {
  background: var(--bg-hover); color: var(--text-primary);
}
.sidebar-flyout a .lucide {
  width: 14px; height: 14px; color: var(--text-muted); flex-shrink: 0;
}
.sidebar-flyout a:hover .lucide { color: var(--accent); }

.sidebar-flyout .dropdown-divider {
  height: 1px; background: var(--border); margin: 4px 8px; border: 0;
}

/* ── Second-level submenus inside sidebar flyouts ── */
.sidebar-flyout .has-submenu { position: relative; }
.sidebar-flyout .has-submenu .submenu-arrow {
  margin-left: auto;
  width: 12px; height: 12px;
  color: var(--text-muted);
  transition: color var(--transition);
}
.sidebar-flyout .has-submenu:hover .submenu-arrow { color: var(--accent); }

.sidebar-flyout .submenu {
  position: absolute;
  left: calc(100% + 4px);
  top: -6px;
  min-width: 180px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 6px;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-6px);
  transition: all var(--transition);
  box-shadow: var(--shadow-dropdown);
  z-index: 1060;
}
.sidebar-flyout .has-submenu:hover > .submenu {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

/* Chevron indicator on sidebar items that have submenus */
.sidebar-group > .sidebar-item .sub-chevron {
  margin-left: auto;
  width: 14px; height: 14px;
  opacity: 0;
  transition: opacity var(--transition);
}
.sidebar:hover .sidebar-group > .sidebar-item .sub-chevron { opacity: 0.6; }
.sidebar-group:hover > .sidebar-item .sub-chevron { opacity: 1; color: var(--accent); }

/* ──────────────── MAIN CONTENT ──────────────── */
/* Licence footer (shared/footer.php). Fixed to the bottom of the viewport beside the sidebar,
   the way .main sits beside it, and stacked beneath both the sidebar (1030) and the header
   (1040) so the hover-expanded sidebar overlays it exactly as it overlays the content pane.
   It is only rendered when the licence supplies text, and body.has-footer (set by
   shared/header.php) is what gives the content pane back the footer's height below. */
.page-footer {
  position: fixed; bottom: 0; left: var(--sidebar-w); right: 0;
  /* height: var(--footer-h); */
  box-sizing: border-box;
  display: flex; align-items: center;
  /* Two text lines per column at 12px x 1.3 is 31.2px; 8px above and below makes the 48px
     that --footer-h declares. The two Bootstrap columns inside lay out as flex children. */
  padding: 8px 32px;
  font-size: 12px; line-height: 1.3;
  color: var(--text-muted);
  background: var(--bg-deep);
  border-top: 1px solid var(--border);
  overflow: hidden;
  z-index: 1020;
}
/* Content column (shared/header.php opens it, shared/footer.php closes it). It takes the
   position and size .main used to have, and lays out the session alerts and .main as a flex
   column: alerts are a fixed-size item at the top, .main is the item that fills what is left
   and scrolls. That is what makes an alert push the page down rather than sit over it, and
   what lets the pane grow back when the alert is dismissed, with no measuring in JavaScript. */
.content {
  margin-top: var(--header-h); margin-left: var(--sidebar-w);
  height: calc(100vh - var(--header-h));
  display: flex; flex-direction: column;
  min-height: 0;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
body.has-footer .content {
  height: calc(100vh - var(--header-h) - var(--footer-h));
}

.main {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; padding: 28px 32px;
  background:
    radial-gradient(ellipse 80% 60% at 70% 10%, rgba(34,211,187,0.03), transparent),
    radial-gradient(ellipse 60% 50% at 20% 80%, rgba(99,102,241,0.02), transparent),
    var(--bg-deepest);
}
[data-bs-theme="light"] .main { background: var(--bg-deepest); }

/* Below Bootstrap's lg breakpoint the page scrolls as a whole, rather than inside a content pane
   one screen high. The header there is sticky, so its open drawer pushes the page down
   (see the header section), and that needs a document that can scroll. The fixed footer also
   covered the end of the page on a small screen and, below 768px where the sidebar is hidden,
   kept a 64px gap on its left. So the footer follows the content in the normal flow instead.
   The body is a flex column at least one screen high, so on a short page the footer still sits
   at the bottom of the screen. */
@media (max-width: 991.98px) {
  html, body { height: auto; overflow: visible; }
  body.has-footer { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
  .content,
  body.has-footer .content { margin-top: 0; height: auto; flex: 1 0 auto; }
  .main { flex: 1 0 auto; overflow-y: visible; }
  .page-footer { position: static; flex-shrink: 0; margin-left: var(--sidebar-w); }
}

/* Page header */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px; animation: fadeUp 0.4s ease-out;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.page-header h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; margin: 0; }
.page-subtitle {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-muted); font-size: 13px; margin-top: 4px;
}
.last-refreshed {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
}
.last-refreshed .lucide { width: 12px; height: 12px; }
.refresh-btn {
  background: none; border: none; color: var(--accent); cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
  font-family: inherit; font-size: 11px; font-weight: 600;
  padding: 2px 6px; border-radius: 4px; transition: all var(--transition);
}
.refresh-btn:hover { background: var(--accent-glow); }
.refresh-btn .lucide { width: 12px; height: 12px; }
.refresh-btn.spinning .lucide { animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.page-actions { display: flex; gap: 8px; }

/* ── Bootstrap buttons, retuned to the dashboard look ── */
.btn {
  --bs-btn-padding-y: 9px;
  --bs-btn-padding-x: 16px;
  --bs-btn-font-size: 13px;
  --bs-btn-font-weight: 500;
  --bs-btn-border-radius: var(--radius-btn);
  display: inline-flex; align-items: center; gap: 7px;
  /* Bootstrap's .btn is inline-block and centres its label with text-align. As a
     flex container that no longer applies: the label is a flex item and sits at the
     start, which only shows on a button wider than its content, such as one given
     width:80% or w-100. Centre along the main axis so those read like the rest. */
  justify-content: center;
  transition: all var(--transition);
}
.btn .lucide { width: 15px; height: 15px; }

/* Icon glyphs inside buttons.
   open-audit-new.css gives every [class^="icon-"] a 4px padding-bottom, which the
   old GUI used to nudge the webfont onto the text baseline. A .btn is a flex
   container with align-items:center, so it centres the glyph's *box*: with all 4px
   at the bottom the visible glyph ended up 2px above the button's middle, which is
   what made the List and Help labels look high. Splitting the same 4px evenly puts
   the glyph in the centre of its own box, so box centre and glyph centre coincide.
   Keeping the total at 4px means the box stays 20px and button heights do not move
   (40px and 38px, exactly as before). Scoped to .btn so the header title icon and
   inline link icons, which rely on the asymmetric padding, are untouched. */
.btn [class^="icon-"] {
  padding-top: 2px;
  padding-bottom: 2px;
}







/* Links in tables — underline only on hover */
table.dataTable a:not(.btn) { text-decoration: none; }
table.dataTable a:not(.btn):hover { text-decoration: underline; }





/* Restore small buttons — the .btn sizing above outranks Bootstrap's
   .btn-sm in the cascade, so re-declare the compact sizes here. */
.btn-sm, .btn-group-sm > .btn {
  --bs-btn-padding-y: 3px;
  --bs-btn-padding-x: 8px;
  --bs-btn-font-size: 12px;
  --bs-btn-border-radius: var(--radius-sm);
  gap: 5px;
}
.btn-sm .lucide, .btn-group-sm > .btn .lucide { width: 13px; height: 13px; }

/* ── Bulk action bar ── */
.bulk-bar {
  display: none; align-items: center; gap: 12px;
  background: var(--accent-glow); border: 1px solid rgba(34,211,187,0.25);
  border-radius: var(--radius-md); padding: 10px 16px; margin-bottom: 16px;
  animation: fadeUp 0.25s ease-out;
}
.bulk-bar.visible { display: flex; }
.bulk-bar .bulk-count {
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  font-weight: 600; color: var(--accent);
}
.bulk-bar .bulk-actions { display: flex; gap: 6px; margin-left: auto; }
.bulk-bar .bulk-btn {
  --bs-btn-padding-y: 5px;
  --bs-btn-padding-x: 12px;
  --bs-btn-font-size: 12px;
  --bs-btn-border-radius: var(--radius-sm);
  gap: 5px;
}
.bulk-bar .bulk-btn .lucide { width: 13px; height: 13px; }
.bulk-bar .bulk-btn.danger:hover {
  background: rgba(248,113,113,0.1); color: var(--danger); border-color: var(--danger);
}
.bulk-bar .clear-btn {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-family: inherit; font-size: 12px;
  padding: 4px 8px; border-radius: 4px; transition: all var(--transition);
}
.bulk-bar .clear-btn:hover { color: var(--text-primary); background: var(--bg-hover); }

/* ──────────────── CARDS (stats + table) ──────────────── */
.card {
  --bs-card-bg: var(--bg-surface);
  --bs-card-border-color: var(--border);
  --bs-card-color: var(--text-primary);
  box-shadow: var(--shadow-card);
}

/* Stats bar */
.stats-bar { margin-bottom: 24px; animation: fadeUp 0.4s ease-out 0.08s both; }
/* The cards wrap onto more rows below the lg breakpoint (col-12 col-sm-6 col-lg), and a Bootstrap
   row has no vertical gutter by default, so the stacked cards touched. Give the row the same
   gutter vertically as horizontally, which is what the gy-* utilities set. */
.stats-bar { --bs-gutter-y: var(--bs-gutter-x); }
.stat-card { border-radius: 12px; transition: all 0.25s; }
.stat-card .card-body { padding: 16px 18px; }
.stat-card:hover {
  border-color: var(--border-light); transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.stat-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--text-muted); margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.stat-label .lucide { width: 14px; height: 14px; }
.stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 24px; font-weight: 700;
}
.stat-value.accent { color: var(--accent); }
.stat-value.warning { color: var(--warning); }
.stat-value.danger { color: var(--danger); }
.stat-change { font-size: 11px; margin-top: 6px; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }
.stat-change .up { color: var(--success); }
.stat-change .down { color: var(--danger); }
/* Small action icon in a stat card label, e.g. edit a setting or clear a queue.
   .danger matches the red of the delete button in the table rows. */
.stat-label .stat-action { color: var(--text-muted); line-height: 1; }
.stat-label .stat-action:hover { color: var(--accent); }
.stat-label .stat-action.danger,
.stat-label .stat-action.danger:hover { color: var(--danger); }

/* ──────────────── TABLE CARD ──────────────── */
.table-card {
  border-radius: var(--radius-lg);
  /* overflow must stay visible so the column-visibility popover
     (div.dt-button-collection) is not clipped on short tables */
  overflow: visible;
  animation: fadeUp 0.4s ease-out 0.15s both;
}

/* Horizontal scrolling for wide tables moves from .table-responsive to
   DataTables' own table region, so popovers in the control rows escape */
.table-wrapper.table-responsive { overflow: visible; }
.table-wrapper div.dt-layout-table > div { overflow-x: auto; }

/* Column-visibility popover above surrounding cards and controls */
div.dt-button-collection { z-index: 1060; }

.table-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  background: transparent;
  border-bottom: 1px solid var(--border);
}
.table-toolbar-left { display: flex; align-items: center; gap: 10px; }
.table-toolbar h2 { font-size: 15px; font-weight: 600; margin: 0; }
.table-toolbar .count-badge {
  background: var(--bg-hover); padding: 3px 10px; border-radius: 12px;
  font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-muted);
}
.filter-pills { display: flex; gap: 4px; }
.filter-pill {
  padding: 5px 12px; border: 1px solid var(--border); background: none;
  color: var(--text-muted); font-family: inherit; font-size: 12px;
  font-weight: 500; border-radius: 20px; cursor: pointer; transition: all var(--transition);
}
.filter-pill:hover { border-color: var(--text-muted); color: var(--text-secondary); }
.filter-pill.active { border-color: var(--accent); background: var(--accent-glow); color: var(--accent); }

/* ── DataTables 2 (Bootstrap 5 integration) overrides ── */
.table-wrapper { padding: 0 4px 4px; }

.table-wrapper .dt-container .row { margin: 0; align-items: center; }
.table-wrapper .dt-container .row > div { padding: 12px 16px; }
.table-wrapper .dt-length,
.table-wrapper .dt-search,
.table-wrapper .dt-info,
.table-wrapper .dt-paging {
  color: var(--text-muted); font-size: 12px;
}
.table-wrapper .dt-length label,
.table-wrapper .dt-search label { color: var(--text-muted); font-size: 12px; }

.table-wrapper .dt-search .form-control,
.table-wrapper .dt-length .form-select {
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-family: inherit; font-size: 12px;
  width: auto; display: inline-block;
  margin-left: 6px;
  box-shadow: none;
}

/* The rows per page control sits in the same toolbar as the Columns selector, so give it that
 * button's surface, border, text colour and metrics rather than the smaller form control look.
 * The right padding stays wider than the left to leave room for the native dropdown arrow. */
/* Toolbar controls line up on one row, so give them a common height and take away the bottom
 * margin the buttons carry. mb-2 makes a button's margin box 8px taller than the button, which
 * in a centre aligned flex row lifts it about 4px above the form controls beside it; and an
 * iconed button came out a pixel taller than a plain one. Scoped to the layout cells so the
 * buttons inside table rows, which set the row height, are left alone. */
.table-wrapper .dt-container .dt-layout-start .btn,
.table-wrapper .dt-container .dt-layout-end .btn,
.table-wrapper .dt-container .dt-layout-start .form-select,
.table-wrapper .dt-container .dt-layout-end .form-select,
.table-wrapper .dt-container .dt-layout-start .form-control,
.table-wrapper .dt-container .dt-layout-end .form-control {
  height: 40px;
  margin-bottom: 0;
}

/* The rows per page and search features each pair a label with a control. Left as inline content
 * they align on the text baseline, and because the label is a size smaller than the control that
 * drops the control a few pixels below the buttons beside it. Lay them out as centred flex rows
 * so the control lines up on its middle instead. */
.table-wrapper .dt-container .dt-length,
.table-wrapper .dt-container .dt-search {
  display: flex;
  align-items: center;
}

/* The network size selector is prepended into the collection header's button group, next to
 * Create and Import, so it gets the same treatment as the rows per page control in the table
 * toolbar: the button surface, border, text colour and metrics. */
#oa_panel_buttons .form-select,
.table-wrapper .dt-length .form-select {
  background-color: var(--bg-surface);
  /* --border-light is what .oa-neutral uses for --bs-btn-border-color, so this is
     the value that actually matches the buttons either side of these selects. */
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  border-radius: var(--radius-btn);
  font-size: 13px;
  padding: 9px 32px 9px 16px;
  height: 40px;
}
.table-wrapper .dt-search .form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  outline: none;
}

table.dataTable { border-collapse: collapse !important; width: 100% !important; margin: 0 !important; }
table.dataTable thead th {
  background: var(--bg-elevated) !important; border-bottom: 1px solid var(--border-light) !important;
  color: var(--text-muted) !important; font-size: 11px !important; font-weight: 600 !important;
  text-transform: uppercase !important; letter-spacing: 0.7px !important;
  padding: 12px 14px !important; white-space: nowrap;
}
table.dataTable thead th:first-child { border-radius: var(--radius-md) 0 0 0; }
table.dataTable thead th:last-child { border-radius: 0 var(--radius-md) 0 0; }

/* Devices puts a search box under each header label. Those boxes read as a second row of the
   header, so they sit in a .th-search band with the lighter surface behind them. The negative
   margins cancel the header cell padding so the band reaches the cell edges and runs unbroken
   across the table; min-height keeps the cells with nothing to show level with the rest. */
table.dataTable thead th .th-search {
  display: flex; align-items: center; gap: 8px;
  /* 31px is the height of a .form-control-sm, plus this band's own 6px top and bottom padding.
     border-box means min-height has to include that padding, or the cells holding nothing come
     out shorter than the cells holding a search box and the band's top edge steps up and down. */
  min-height: calc(31px + 12px);
  margin: 10px -14px -12px -14px;
  padding: 6px 14px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-light);
}
table.dataTable thead th .th-search .form-control {
  text-transform: none; letter-spacing: normal; font-weight: 400;
}
/* The band is a flex row, so text-align on the cell no longer positions its contents. Follow
   the cell's alignment explicitly, otherwise the bulk edit button and select all checkbox sit
   hard left under a centred Update heading. */
table.dataTable thead th.text-center .th-search {
  justify-content: center;
}
/* DataTables stretches the sort arrows over the whole header cell (top: 0; bottom: 0), so on a
   table with the search band they centre on the boundary between the label and the band rather
   than on the label itself. Confine them to the first line of the cell: 12px is the header
   padding-top and 17px covers one line of the 11px uppercase label. The selector repeats the
   element chain because the DataTables rule carries five element names and would otherwise
   outrank a shorter override. */
table.dataTable.column-search thead > tr > th span.dt-column-order {
  top: 12px;
  bottom: auto;
  height: 17px;
}

/* Mirror the extra right padding the orderable cells reserve below, so the band is not
   inset on those columns and the right hand edge stays straight. */
table.dataTable thead th.dt-orderable-asc .th-search,
table.dataTable thead th.dt-orderable-desc .th-search,
table.dataTable thead th.dt-ordering-asc .th-search,
table.dataTable thead th.dt-ordering-desc .th-search {
  margin-right: -30px;
}

/* Orderable headers: keep the right padding DataTables reserves for its
   absolutely-positioned sort arrows - the !important padding above would
   otherwise remove it and let long titles overlap the arrows */
table.dataTable thead th.dt-orderable-asc,
table.dataTable thead th.dt-orderable-desc,
table.dataTable thead th.dt-ordering-asc,
table.dataTable thead th.dt-ordering-desc {
  padding-right: 30px !important;
}

table.dataTable tbody td {
  background: transparent !important; border-bottom: 1px solid var(--border) !important;
  color: var(--text-secondary) !important; font-size: 13px !important;
  padding: 10px 14px !important; vertical-align: middle;
}
/* Row striping for every DataTable, with no per-view class needed.
 * Bootstrap and DataTables both draw stripes as an inset box-shadow, so the
 * blanket 'box-shadow: none !important' that used to sit in the rule above
 * suppressed both. --dt-row-stripe is DataTables' own variable: 0,0,0 by
 * default and 255,255,255 under [data-bs-theme=dark], so this reads correctly
 * in light and dark without a second rule.
 * 0.023 is DataTables' own plain odd-row alpha. Its heavier 0.054 is reserved
 * for the sorted column, which is why anything near 0.05 reads too dark here. */
table.dataTable > tbody > tr:nth-of-type(2n+1) > td {
  box-shadow: inset 0 0 0 9999px rgba(var(--dt-row-stripe, 0, 0, 0), 0.023);
}
table.dataTable tbody tr { transition: background 0.15s; }
/* Hover and selection must read on striped rows too, so they win over the
 * stripe rather than sitting under it. */
table.dataTable tbody tr:hover td { background: var(--bg-hover) !important; box-shadow: none !important; }
table.dataTable tbody tr:last-child td { border-bottom: none !important; }
table.dataTable tbody tr.selected td { background: var(--accent-glow) !important; box-shadow: none !important; }

/* Row height 49px, matching the template: 10px + 10px cell padding + a 28px
 * control + 1px border. Bootstrap's .btn-sm is 34px tall and, being inline
 * level, adds a baseline gap on top of that, which is what made rows 59px.
 * Only the vertical metrics are set here, so button widths are unchanged. */
table.dataTable tbody td .btn-sm {
  height: 28px; padding-top: 0; padding-bottom: 0;
  display: inline-flex; align-items: center; justify-content: center;
  vertical-align: middle;
}
/* Buttons in table cells are icon-only, so they take half the .btn default. */
td .btn {
  --bs-btn-padding-x: 8px;
}
/* Rows with no action button would otherwise sit at 40px. height on a table
 * cell is a minimum rather than a fixed size, so this gives every row the same
 * 49px floor while a cell with wrapped text is still free to grow. */
table.dataTable tbody td { height: 49px; }

/* DataTables wraps its buttons in a btn-group, which squares the inner corners so the pair
 * reads as one joined pill. The Create / Import CSV buttons above the table are separate,
 * individually rounded controls, so undo the grouping and keep the whole toolbar consistent. */
.dt-buttons.btn-group > .btn,
.dt-buttons.btn-group > .btn-group > .btn {
  border-radius: var(--bs-btn-border-radius) !important;
}
/* btn-group pulls adjacent buttons together with a negative margin so their borders collapse.
 * The container is a flex row, so clear those margins and space the buttons with a gap
 * instead. See --gap-toolbar for where the value comes from. */
.dt-buttons.btn-group {
  gap: var(--gap-toolbar);
}
.dt-buttons.btn-group > .btn,
.dt-buttons.btn-group > .btn-group,
.dt-buttons.btn-group > .btn-group > .btn {
  margin-left: 0 !important;
}

/* DataTables wraps whatever a button's text option produces in an anonymous span, so the
   Columns and Reset icons sit as inline siblings of their label. The icon font's glyph box
   is 20px tall against 16px text, and vertical-align: middle aligns to the baseline plus
   half the x-height rather than the box centre, which left both icons 1.5px low. Centring
   the wrapper by box lines them up whatever the font's metrics are, so this needs no
   per-icon nudge. */
.dt-buttons .btn > span {
  display: inline-flex;
  align-items: center;
}

/* The toolbar rows hold more than buttons: the rows-per-page select, the HowToSearch button
 * and the search box all sit alongside them. DataTables spaces those with a 1em margin on
 * every child but the last, plus a 6px left margin on the length select, which together left
 * a 20px hole between Reset and the rows-per-page control. Clear those margins and let one
 * gap on the row govern, so every neighbour in the toolbar is separated by the same distance
 * as the buttons in the collection header above. The selectors mirror the DataTables ones
 * because theirs carry two element names and would otherwise outrank a class-only override. */
.dt-layout-start,
.dt-layout-end {
  gap: var(--gap-toolbar);
}
div.dt-container div.dt-layout-start > *:not(:last-child),
div.dt-container div.dt-layout-end > *:not(:first-child) {
  margin-right: 0;
  margin-left: 0;
}
.dt-layout-start .dt-length select.form-select,
.dt-layout-end .dt-length select.form-select {
  margin-left: 0;
}
/* Below 768px DataTables stacks the toolbar: the cells lose d-md-flex and become plain blocks, so
 * the gap above no longer applies. Only the button group kept a margin (.5em, from DataTables),
 * which left the HowToSearch button and the search box touching. Space every stacked item by
 * the same gap instead. */
@media (max-width: 767.98px) {
  div.dt-container div.dt-layout-start > * + *,
  div.dt-container div.dt-layout-end > * + * { margin-top: var(--gap-toolbar); }
  div.dt-container div.dt-buttons { margin-bottom: 0; }
}

/* Sorting arrows (DataTables 2 markup) */
table.dataTable thead th .dt-column-order::before,
table.dataTable thead th .dt-column-order::after {
  opacity: 0.3 !important; color: var(--text-muted) !important;
}
table.dataTable thead th.dt-ordering-asc .dt-column-order::before,
table.dataTable thead th.dt-ordering-desc .dt-column-order::after {
  opacity: 0.8 !important; color: var(--accent) !important;
}

/* Pagination — Bootstrap .pagination via DataTables */
.table-wrapper .dt-paging .pagination {
  --bs-pagination-bg: transparent;
  --bs-pagination-color: var(--text-muted);
  --bs-pagination-border-color: transparent;
  --bs-pagination-border-radius: var(--radius-sm);
  --bs-pagination-font-size: 12px;
  --bs-pagination-padding-y: 4px;
  --bs-pagination-padding-x: 10px;
  --bs-pagination-hover-bg: var(--bg-hover);
  --bs-pagination-hover-color: var(--text-primary);
  --bs-pagination-hover-border-color: var(--border-light);
  --bs-pagination-focus-bg: var(--bg-hover);
  --bs-pagination-focus-color: var(--text-primary);
  --bs-pagination-focus-box-shadow: 0 0 0 3px var(--accent-glow);
  --bs-pagination-active-bg: var(--accent-glow);
  --bs-pagination-active-color: var(--accent);
  --bs-pagination-active-border-color: var(--accent-glow-strong);
  --bs-pagination-disabled-bg: transparent;
  --bs-pagination-disabled-color: var(--text-muted);
  --bs-pagination-disabled-border-color: transparent;
  margin: 0;
}
.table-wrapper .dt-paging .page-link {
  border-radius: var(--radius-sm);
  margin: 0 2px;
  transition: all var(--transition);
}
.table-wrapper .dt-paging .page-item.active .page-link { font-weight: 600; }
.table-wrapper .dt-paging .page-item.disabled .page-link { opacity: 0.3; }

/* Nav pills — the tab strip in the read views. Same accent tint as the current pagination
   button rather than a solid fill, so a selected tab reads like the other active states. */
.nav-pills {
  --bs-nav-link-color: var(--text-muted);
  --bs-nav-link-hover-color: var(--text-primary);
  --bs-nav-link-disabled-color: var(--text-muted);
  --bs-nav-link-font-size: 13px;
  --bs-nav-link-font-weight: 500;
  --bs-nav-pills-border-radius: var(--radius-sm);
  --bs-nav-pills-link-active-color: var(--accent);
  --bs-nav-pills-link-active-bg: var(--accent-glow);
  gap: 6px;
}
.nav-pills .nav-link {
  border: 1px solid transparent;
  transition: all var(--transition);
}
.nav-pills .nav-link:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-light);
}
.nav-pills .nav-link.active {
  border-color: var(--accent-glow-strong);
  font-weight: 600;
}
.nav-pills .nav-link.disabled { opacity: 0.3; }

/* ──────────────── CELL STYLES ──────────────── */
.cell-check { width: 36px; text-align: center; }
.form-check-input.row-check {
  width: 16px; height: 16px; margin: 0;
  border: 2px solid var(--border-light);
  border-radius: 4px; background-color: var(--bg-elevated); cursor: pointer;
  transition: all 0.15s;
  vertical-align: middle;
}
.form-check-input.row-check:checked {
  background-color: var(--accent); border-color: var(--accent);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%230a0c10' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}
.form-check-input.row-check:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.hostname {
  font-family: 'JetBrains Mono', monospace; font-weight: 600; font-size: 12.5px;
  color: var(--text-primary);
}

.os-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500;
}
.os-badge .lucide { width: 13px; height: 13px; }

/* Dark: bright text on dark tinted bg — all >=5:1 */
.os-badge.windows { background: rgba(96,165,250,0.12); color: #60a5fa; }
.os-badge.linux { background: rgba(251,191,36,0.12); color: #fbbf24; }
.os-badge.macos { background: rgba(168,162,158,0.12); color: #a8a29e; }

/* Light: dark text on light tinted bg — all >=5:1 on tinted white */
[data-bs-theme="light"] .os-badge.windows { background: rgba(29,78,216,0.08); color: #1d4ed8; }
[data-bs-theme="light"] .os-badge.linux { background: rgba(180,83,9,0.08); color: #92400e; }
[data-bs-theme="light"] .os-badge.macos { background: rgba(87,83,78,0.08); color: #44403c; }

.status-indicator {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; }
.status-online .status-dot { background: var(--success); box-shadow: 0 0 8px rgba(34,197,94,0.4); }
.status-online { color: var(--success); }
.status-offline .status-dot { background: var(--text-muted); }
.status-offline { color: var(--text-muted); }
.status-warning .status-dot { background: var(--warning); box-shadow: 0 0 8px rgba(245,158,11,0.4); }
.status-warning { color: var(--warning); }

.usage-bar {
  width: 72px; height: 6px; background: var(--bg-hover);
  border-radius: 3px; overflow: hidden; display: inline-block;
  vertical-align: middle; margin-right: 8px;
}
.usage-bar-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.usage-low .usage-bar-fill { background: var(--success); }
.usage-med .usage-bar-fill { background: var(--warning); }
.usage-high .usage-bar-fill { background: var(--danger); }
.usage-text { font-family: 'JetBrains Mono', monospace; font-size: 12px; }

.ip-addr { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text-muted); }
.uptime { font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.spec-text { font-size: 12px; }
.spec-text strong { color: var(--text-primary); font-weight: 600; }

/* Tags — Bootstrap badges with the dashboard palette */
.badge.tag {
  padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600;
  background: var(--bg-hover); color: var(--text-muted); margin: 1px 2px;
  line-height: 1.5;
}
/* Dark tags — bright on dark tinted bg, all >=5:1 */
.badge.tag.prod { background: rgba(248,113,113,0.12); color: #fca5a5; }
.badge.tag.dev { background: rgba(96,165,250,0.12); color: #93bbfd; }
.badge.tag.staging { background: rgba(251,191,36,0.12); color: #fbbf24; }
.badge.tag.db { background: rgba(192,132,252,0.12); color: #d4b5fd; }
.badge.tag.web { background: rgba(34,211,187,0.12); color: var(--accent); }

/* Light tags — dark text on white-ish tinted bg, all >=4.5:1 */
[data-bs-theme="light"] .badge.tag.prod { background: rgba(220,38,38,0.08); color: #b91c1c; }
[data-bs-theme="light"] .badge.tag.dev { background: rgba(29,78,216,0.08); color: #1d4ed8; }
[data-bs-theme="light"] .badge.tag.staging { background: rgba(180,83,9,0.08); color: #92400e; }
[data-bs-theme="light"] .badge.tag.db { background: rgba(126,34,206,0.08); color: #6b21a8; }
[data-bs-theme="light"] .badge.tag.web { background: rgba(15,118,110,0.08); color: var(--accent); }

/* Row actions */
.row-actions { display: flex; gap: 2px; }
.row-action-btn {
  width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
  border: none; background: none; color: var(--text-muted); border-radius: var(--radius-sm);
  cursor: pointer; transition: all 0.15s; font-size: 14px;
}
.row-action-btn .lucide { width: 14px; height: 14px; }
.row-action-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.row-action-btn.terminal:hover { color: var(--accent); }
.row-action-btn.power:hover { color: var(--danger); }

/* ──────────────── DETAIL PANEL (Bootstrap offcanvas) ──────────────── */
.detail-panel.offcanvas {
  --bs-offcanvas-width: 440px;
  --bs-offcanvas-bg: var(--bg-deep);
  --bs-offcanvas-color: var(--text-primary);
  --bs-offcanvas-border-color: var(--border);
  --bs-offcanvas-transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 90vw;
  box-shadow: -8px 0 32px rgba(0,0,0,0.3);
}
.offcanvas-backdrop { background-color: var(--panel-overlay); transition: opacity 0.3s; }
.offcanvas-backdrop.show { opacity: 1; }

.detail-panel .offcanvas-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.detail-panel .offcanvas-title {
  font-size: 16px; font-weight: 700; font-family: 'JetBrains Mono', monospace;
}
.panel-close {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border: none; background: none; color: var(--text-muted); border-radius: 8px;
  cursor: pointer; transition: all var(--transition); font-size: 18px;
}
.panel-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.panel-close .lucide { width: 18px; height: 18px; }

.detail-panel .offcanvas-body { padding: 24px; }

.panel-section { margin-bottom: 24px; }
.panel-section-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--text-muted); margin-bottom: 12px;
  display: flex; align-items: center; gap: 6px;
}
.panel-section-title .lucide { width: 14px; height: 14px; }

.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.panel-field {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px;
}
.panel-field.full { grid-column: 1 / -1; }
.panel-field-label { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.panel-field-value {
  font-family: 'JetBrains Mono', monospace; font-size: 13px;
  font-weight: 500; color: var(--text-primary);
}

.panel-actions {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; gap: 8px;
}
.panel-actions .btn { flex: 1; justify-content: center; }

/* ──────────────── KEYBOARD HINT ──────────────── */
.kbd-hint {
  position: fixed; bottom: 16px; right: 24px;
  display: flex; align-items: center; gap: 8px;
  color: var(--text-muted); font-size: 11px; z-index: 1020;
  opacity: 0.6; transition: opacity var(--transition);
}
.kbd-hint:hover { opacity: 1; }
.kbd-hint kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; padding: 2px 6px;
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  border-radius: 4px; font-family: 'JetBrains Mono', monospace;
  font-size: 11px; font-weight: 600; color: var(--text-primary);
}

/* ──────────────── RESPONSIVE ──────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .content { margin-left: 0; }
  .page-footer { margin-left: 0; }
  .page-header { flex-direction: column; gap: 12px; }
  .kbd-hint { display: none; }
}

/* ──────────────── OPEN-AUDIT HELPER COMPAT ────────────────
   The shared view helpers emit lucide icon-font spans and
   text-oa-* colour classes from the previous design. Map them
   onto the new palette so helper output matches the theme. */
.oa-icon { margin-right: 8px; }
/* .text-oa-* were replaced by the .oa-text-* variants above. */

/* Toolbar rows emitted by *_card_header() helpers */
#oa_panel_buttons .btn,
.page-title-right .btn { margin-left: 4px; }

/* Collection page header — the *_card_header() toolbar rendered outside
   any card, on the page background, like the template's page-header */
.collection-header {
  margin-bottom: 24px;
  animation: fadeUp 0.4s ease-out;
}
.collection-header h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin: 0;
  white-space: nowrap;
  /* Sits on the same hue line as the logo mark (#1F284F) and the avatar (#6366F1).
     No single value clears 4.5:1 on both themes, so the token is paired like the rest. */
  color: var(--text-heading);
}
.collection-header .oa-icon { color: var(--text-heading); }
/* The collection word ("Devices") is an <a> back to the list, while the resource name
   beside it is a plain span, so Bootstrap's generic `a` rule painted the two halves of
   one title in different colours - link blue next to the heading colour. Inherit so the
   whole line reads as a single heading. Colour alone no longer marks it as a link, so
   hover and keyboard focus underline it to keep that affordance. */
.collection-header h1 a { color: inherit; }
.collection-header h1 a:hover,
.collection-header h1 a:focus-visible { color: inherit; text-decoration: underline; }
.collection-header .row { align-items: center; }
.collection-header .mb-2 { margin-bottom: 0 !important; }
/* The toolbar buttons are inline, so on a narrow viewport they wrap onto more rows, and with
   their mb-2 cleared above, the rows touched. A top margin on each button spaces the rows apart,
   and the matching negative margin on the toolbar cancels it on the first row, so a toolbar that
   fits on one row sits exactly where it did. */
.collection-header .page-title-right { margin-top: calc(-1 * var(--gap-toolbar)); }
.collection-header .page-title-right .btn { margin-top: var(--gap-toolbar); }

/* Card headers hold the helper toolbars — give them the
   table-toolbar treatment from the dashboard design */
.card > .card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  /* padding: 16px 20px; */
}
.card > .card-header h1 { margin: 0; font-size: 15px; font-weight: 600; }

/* supportCollection.php: stacked panels of print_r output. The dumps hold long values such as
   paths and base URLs, so each scrolls in its own box rather than stretching the page. */
.support-card { margin-bottom: 20px; }
.support-dump {
  margin: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
  overflow-x: auto;
  max-height: 420px;
  overflow-y: auto;
}

/* collectionHelp.php: the edition badge and screenshot sit to the right of the
   rendered Markdown, which wraps around them and then continues across the full
   column width once past the bottom of the image. */
.help-aside {
  float: right;
  width: 33%;
  margin: 0 0 20px 24px;
}

/* Paragraphs wrap around a float, but a full width block box would slide under it.
   Tables are width:100% via Bootstrap's .table, and pre/blockquote are block level,
   so make them start below the aside instead of colliding with it. On a collection
   whose intro is short this is the difference between a tidy page and a table
   sitting on top of the screenshot. */
.help-aside ~ table,
.help-aside ~ pre,
.help-aside ~ blockquote,
.help-aside ~ .table-responsive {
  clear: right;
}

/* Narrow viewports: stack instead, so neither the text nor the image is squeezed. */
@media (max-width: 991.98px) {
  .help-aside {
    float: none;
    width: auto;
    margin: 0 0 20px 0;
  }
}

/* Help page screenshots. collectionHelp.php floats a thumbnail right and wraps the
   Markdown around it, then opens a full size copy in a modal. .helpImage was not
   carried into open-audit-new.css, so it is restated here in theme terms.

   The width pair matters: the screenshots are around 1920px wide, so with only
   max-width:100% the thumbnail fills the whole column and the text has nothing to
   wrap beside. 600px with a 45% ceiling keeps the wrapped column readable and
   matches what the previous GUI rendered via open-audit.css, which this stylesheet
   replaces rather than supplements. */
.helpImage {
  width: 600px;
  max-width: 45%;
  cursor: zoom-in;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* The thumbnail and the Upgrade button sit in one floated column, .helpAside, so
   the column carries the width pair and the image fills it. */
.helpBody .helpAside {
  width: 600px;
  max-width: 45%;
  margin-top: 40px;
}
.helpBody .helpAside .helpImage {
  width: 100%;
  max-width: 100%;
}

/* Below 768px there is no room to wrap, so the column goes full width and the text
   runs beneath it. */
@media (max-width: 767.98px) {
  .helpBody .helpAside {
    float: none !important;
    width: 100%;
    max-width: 100%;
    margin-left: 0 !important;
    margin-top: 0;
  }
}

/* The zoomed copy fills the dialog: the width and the 45% ceiling above apply to
   the floated thumbnail only. */
.modal .helpImage {
  width: 100%;
  max-width: 100%;
  height: auto;
  cursor: default;
  border: none;
}

/* Flash/session alerts shown by shared/header.php */
/* Session alerts from shared/header.php. In normal flow at the top of the content column,
   not fixed over the page, so they push the view down; .main's own top padding supplies the
   gap beneath them. The wrapper itself has no footprint - the spacing sits on each .alert -
   so a page with nothing to say loses no height to an empty container. */
.oa-alerts {
  flex: 0 0 auto;
}
.oa-alerts .alert {
  /* The oa-red / oa-yellow / oa-green chip rule makes the alert inline-block, which is what
     gives it a shrink-to-fit width rather than the full column. Keep that width and centre
     the box with auto side margins; the max-width keeps a long message off the gutters and
     lets it wrap instead. */
  display: block;
  width: fit-content;
  max-width: calc(100% - 64px);
  margin: 16px auto 0;
}

/* ══════════════════════════════════════════════════════════════════════════
   READ AND CREATE FORM FIELDS
   Styling taken from the computer-form-openaudit.html mockup and mapped onto
   the classes the views already emit, so the markup and the inline edit
   behaviour in open-audit-new.js are untouched:
     mockup .form-input / .form-textarea  ->  .form-control / textarea.form-control
     mockup .form-select                  ->  .form-select (and the select2 widget)
     mockup .form-label                   ->  .form-label
     mockup .form-hint                    ->  .form-text
     mockup .form-section-title           ->  .form-section-title
   The mockup's own variables are identical to this file's, so these rules use
   them directly and follow light and dark mode with everything else.
   ══════════════════════════════════════════════════════════════════════════ */

.card-body .form-label,
.card-body label.form-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* The create form marks required fields with a red asterisk inline; keep the
   mockup's weight for it. */
.card-body .form-label span {
  font-weight: 700;
}

.card-body .form-control,
.card-body .form-select,
.card-body textarea.form-control {
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 8px 12px;
  font-family: inherit;
  font-size: 13px;
  /* The mockup leaves line-height alone, which renders as 16px of content and a
     34px control. Bootstrap forces 1.5, stretching the content box to 19.5px and
     the control to 40px. 16px is pinned rather than left at 'normal' so the
     height does not drift with font loading and every field matches, with or
     without an inline edit button beside it. */
  line-height: 16px;
  box-shadow: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.card-body .form-control:focus,
.card-body .form-select:focus,
.card-body textarea.form-control:focus {
  background-color: var(--bg-elevated);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  color: var(--text-primary);
}

.card-body .form-control::placeholder,
.card-body textarea.form-control::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

/* Read views render every field disabled until Edit is pressed, so a disabled
   field is the normal resting state and has to stay legible. Only the border is
   softened, which leaves Edit as the visible affordance. */
.card-body .form-control:disabled,
.card-body .form-control[readonly],
.card-body .form-select:disabled,
.card-body textarea.form-control:disabled {
  opacity: 1;
  background-color: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text-primary);
}

/* An editable field carries the lighter surface; a disabled one keeps
   --bg-elevated from the rule above. On a read view that means the field lightens
   the moment Edit enables it, and on a create form, where every field is editable
   from the outset, it means the fields match a read view field being edited.
   :enabled is a live pseudo-class, so the read view needs no extra scripting.
   Note this is a deliberate step away from the mockup, whose form fields sit at
   --bg-elevated: here the shade carries the meaning "you can type in this". */
.card-body .form-control:enabled,
.card-body .form-select:enabled,
.card-body textarea.form-control:enabled {
  background-color: var(--field-editable);
}
.card-body .form-control:enabled:focus,
.card-body .form-select:enabled:focus,
.card-body textarea.form-control:enabled:focus {
  background-color: var(--field-editable);
}

.card-body .form-select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237f8fa3' 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 10px center;
  background-size: 14px;
  padding-right: 32px;
}
.card-body .form-select[multiple] {
  background-image: none;
  padding-right: 12px;
}
.card-body .form-select option {
  background-color: var(--bg-elevated);
  color: var(--text-primary);
}
/* Chosen entries in a list box (a multiple select, or one with a size). The option
   rule above paints every entry the same, which also wiped the browser's own highlight
   for the chosen ones, so the Roles and Orgs lists gave no clue what was selected.
   Chrome draws its own highlight over a plain background-color on a chosen option but
   honours a background-image, hence the single-colour gradient. Editable lists get the
   accent itself; a disabled list gets a tint of it plus an accent bar at the left, so
   the chosen entries still stand out while the field reads as not editable. */
.card-body .form-select[multiple] option:checked,
.card-body .form-select[size]:not([size="1"]) option:checked {
  background: var(--accent) linear-gradient(0deg, var(--accent), var(--accent));
  color: var(--accent-contrast);
  font-weight: 600;
}
.card-body .form-select[multiple]:disabled option:checked,
.card-body .form-select[size]:not([size="1"]):disabled option:checked {
  background: var(--bg-elevated) linear-gradient(0deg, var(--accent-glow-strong), var(--accent-glow-strong));
  color: var(--text-primary);
  box-shadow: inset 3px 0 0 var(--accent);
}
.card-body .form-select optgroup {
  color: var(--text-muted);
  font-weight: 600;
  font-style: normal;
}

/* Textareas carry command output, scripts and pasted config, where column alignment is
   part of the content, so they take the mono face. The grouped rule above sets
   font-family: inherit for .form-control and .form-select, and this reasserts it for
   textareas only, at equal specificity but later in the cascade. The bare textarea
   selector picks up any that sit outside .card-body. */
textarea,
.card-body textarea.form-control {
  font-family: var(--font-mono);
}

.card-body textarea.form-control {
  resize: vertical;
  min-height: 60px;
}

/* Bootstrap's help text, the mockup's .form-hint */
.card-body .form-text {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Section headings inside a form card */
.card-body .form-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* select2 replaces the native select on org_id and location_id, so give the
   widget the same surface, border, radius and focus ring as a .form-select. */
.card-body .select2-container--bootstrap-5 .select2-selection {
  /* select2 replaces the native select with a span, so :enabled cannot reach it.
     Give the widget the editable shade by default and let the
     .select2-container--disabled rule below put it back to --bg-elevated at rest,
     which mirrors what :enabled/:disabled do for the native controls. */
  background-color: var(--field-editable);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  box-shadow: none;
}
.card-body .select2-container--bootstrap-5.select2-container--focus .select2-selection,
.card-body .select2-container--bootstrap-5.select2-container--open .select2-selection {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.card-body .select2-container--bootstrap-5 .select2-selection {
  /* Match the .form-select metrics above: 34px tall, 13px text, room on the
     right for select2's arrow. Overrides the bootstrap-5 select2 theme, which
     uses 1rem/1.5 and its own min-height. */
  min-height: 34px;
  padding: 8px 32px 8px 12px;
  font-size: 13px;
  line-height: 16px;
}
.card-body .select2-container--bootstrap-5 .select2-selection__rendered {
  color: var(--text-primary);
  font-size: 13px;
  line-height: 16px;
  padding: 0;
}
.card-body .select2-container--bootstrap-5 .select2-selection__arrow {
  height: 32px;
}
.card-body .select2-container--bootstrap-5.select2-container--disabled .select2-selection {
  background-color: var(--bg-elevated);
  border-color: var(--border);
}
.select2-container--bootstrap-5 .select2-dropdown {
  background-color: var(--bg-elevated);
  border-color: var(--border-light);
}
.select2-container--bootstrap-5 .select2-results__option {
  color: var(--text-primary);
}
.select2-container--bootstrap-5 .select2-results__option--highlighted {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}
.select2-container--bootstrap-5 .select2-search__field {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
}

/* Inline edit / submit / cancel buttons sit in the field's input-group. The
 * link and devices buttons share the same resting look. */
.card-body .input-group .btn.edit,
.card-body .input-group .btn.submit,
.card-body .input-group .btn.cancel,
.card-body .input-group .btn.link_button {
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-light);
  color: #4b55638c;
}
/* An .input-group stretches every child to the tallest one, so the field only
   keeps the mockup's 34px if these buttons are 34px too. Bootstrap's padding
   plus the 1.2rem icon the view sets inline would otherwise make them 40px.
   Centring with flex means the icon size no longer drives the height. The
   link and devices buttons (.link_button) beside a field share the sizing so
   every button in the row is the same 34px, keeping their own colours. */
.card-body .input-group .btn.edit,
.card-body .input-group .btn.submit,
.card-body .input-group .btn.cancel,
.card-body .input-group .btn.link_button {
  height: 34px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.card-body .input-group .btn.edit:hover,
.card-body .input-group .btn.link_button:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--text-muted);
}
/* Link, devices and edit button icons: light blue at rest; link and devices
 * turn success on mouse-over. Submit and cancel (shown once edit is clicked)
 * carry their action colours: success tick, danger cross. */
.card-body .input-group .btn.link_button [class^="icon-"],
.card-body .input-group .btn.link_button [class*=" icon-"],
.card-body .input-group .btn.edit [class^="icon-"],
.card-body .input-group .btn.edit [class*=" icon-"] {
  color: #74C0FC;
}
.card-body .input-group .btn.submit [class^="icon-"],
.card-body .input-group .btn.submit [class*=" icon-"] {
  color: var(--bs-success);
}
.card-body .input-group .btn.cancel [class^="icon-"],
.card-body .input-group .btn.cancel [class*=" icon-"] {
  color: var(--bs-danger);
}
.card-body .input-group .btn.link_button:hover [class^="icon-"],
.card-body .input-group .btn.link_button:hover [class*=" icon-"] {
  color: var(--bs-success);
}
.card-body .input-group .btn.submit:hover {
  background-color: var(--accent-glow);
  color: var(--accent);
  border-color: var(--accent);
}
.card-body .input-group .btn.cancel:hover {
  background-color: var(--danger-glow);
  color: var(--danger);
  border-color: var(--danger);
}

/* The field information popover trigger */
.card-body .btn-clear {
  background-color: transparent;
  border-color: transparent;
  color: var(--text-muted);
}
.card-body .btn-clear:hover {
  color: var(--accent);
}

/* Field rows: the mockup's .form-section spacing, applied to the row wrappers
   the read and create helpers emit. */
.card-body > .row + .row {
  margin-top: 0;
}

/* Dashboard widget glyph (traffic_widget and status_widget in widget_functions.php).
   open-audit-new.css was reduced from open-audit.css and the .widget-icon rule was
   dropped, but the widget markup still emits the class, so the glyph fell through to
   the blanket [class^="icon-"] at 16px and sat lost in its panel.
   The panel is 64x56 with 12px padding, giving a 32px content box, and the same widget
   renders its SVG alternative at exactly 32x32 in that box. Matching that makes the two
   kinds of widget icon the same size. padding-bottom is cleared because the blanket rule
   adds 4px that the SVG does not have, which would push the glyph off centre. */
.widget-icon {
  font-size: 32px;
  line-height: 32px;
  padding-bottom: 0;
}

/* Toasts. The old header positioned these with a fixed top:120px / right:60px and gave
   the panels no dark variant, so they inherited Bootstrap's white. Anchor the stack to
   the viewport corner instead and take the surface and border from the theme, so a
   toast reads the same in both colour modes. */
.oa-toast-container {
  position: fixed;
  top: 76px;
  right: 24px;
  z-index: 1090;
  width: max-content;
  max-width: min(420px, calc(100vw - 48px));
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.oa-toast-container .toast {
  --bs-toast-bg: var(--bg-surface);
  --bs-toast-color: var(--text-primary);
  --bs-toast-border-color: var(--border);
  --bs-toast-header-bg: var(--bg-surface);
  --bs-toast-header-color: var(--text-primary);
  --bs-toast-header-border-color: var(--border);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
}
/* The icon sits before the heading, so give it the gap the heading would have had. */
.oa-toast-container .toast-header [class^="icon-"] {
  margin-right: 8px;
  font-size: 16px;
  line-height: 1;
}
/* A coloured left edge distinguishes the two outcomes without repainting the panel,
   which keeps the body text on the same readable surface in both modes. */
.oa-toast-container .toast-success { border-left: 3px solid var(--success); }
.oa-toast-container .toast-failure { border-left: 3px solid var(--danger); }
.oa-toast-container .toast-ent,
.oa-toast-container .toast-pro { border-left: 3px solid var(--accent); }
.oa-toast-container .toast-perm { border-left: 3px solid var(--warning); }

/* ──────────────── OA COLOUR CLASSES ────────────────
   One standard set of colour classes for the whole GUI, so a pill, a button, a nav link and
   an alert that mean the same thing look the same. Each class carries a muted tint behind
   the solid colour used for text, plus a 1px border in the same colour at the strength
   .nav-pills .nav-link.active uses, and lifts on hover the way an outline button does.

   Colours come from the existing tokens, so both colour modes follow automatically:
     oa-green  --success        oa-yellow  --warning       oa-red     --danger
     oa-blue   --info           oa-orange  --severity-high oa-purple  --purple
     oa-teal   --accent         (the brand accent)

   One caveat worth knowing before these are rolled out. --purple and
   --severity-high-glow-strong were added for this set; every other token already existed.
   --warning was retuned from amber (#f59e0b / #b45309) to yellow (#facc15 / #8a6d00) so
   oa-yellow separates from oa-orange, which had sat only 9deg away in hue in light mode.
   That retune reaches every use of --warning, not just oa-yellow: Execute buttons,
   btn-warning, status dots, usage bars and medium-severity badges all move with it.

   Each class only sets colours. Shape and spacing are zero-specificity defaults in the
   :where() block, so .btn, .badge and .rounded-pill keep their own padding and radius. */

:where(.oa-green, .oa-yellow, .oa-red, .oa-blue, .oa-purple, .oa-orange, .oa-teal, .oa-grey,
        .oa-neutral) {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  text-decoration: none;
}

.oa-green  { --oa-color: var(--success);       --oa-tint: var(--success-glow);       --oa-tint-strong: var(--success-glow-strong); }
.oa-yellow { --oa-color: var(--warning);       --oa-tint: var(--warning-glow);       --oa-tint-strong: var(--warning-glow-strong); }
.oa-red    { --oa-color: var(--danger);        --oa-tint: var(--danger-glow);        --oa-tint-strong: var(--danger-glow-strong); }
.oa-blue   { --oa-color: var(--info);          --oa-tint: var(--info-glow);          --oa-tint-strong: var(--info-glow-strong); }
.oa-purple { --oa-color: var(--purple);        --oa-tint: var(--purple-glow);        --oa-tint-strong: var(--purple-glow-strong); }
.oa-orange { --oa-color: var(--severity-high); --oa-tint: var(--severity-high-glow); --oa-tint-strong: var(--severity-high-glow-strong); }
.oa-teal   { --oa-color: var(--accent);        --oa-tint: var(--accent-glow);        --oa-tint-strong: var(--accent-glow-strong); }
/* Neutral member of the set, for a status that carries no severity, such as an unknown or
   not-applicable result. Uses the surface tokens rather than a hue. */
.oa-grey   { --oa-color: var(--text-secondary); --oa-tint: var(--bg-hover);          --oa-tint-strong: var(--border-light); }

.oa-green,
.oa-yellow,
.oa-red,
.oa-blue,
.oa-purple,
.oa-orange,
.oa-teal,
.oa-grey {
  color: var(--oa-color);
  background-color: var(--oa-tint);
  border: 1px solid var(--oa-tint-strong);
  transition: all var(--transition);
  box-shadow: none;

  /* Buttons (.btn reads these rather than the properties above) */
  --bs-btn-color: var(--oa-color);
  --bs-btn-bg: var(--oa-tint);
  --bs-btn-border-color: var(--oa-tint-strong);
  --bs-btn-hover-color: var(--oa-color);
  --bs-btn-hover-bg: var(--oa-tint-strong);
  --bs-btn-hover-border-color: var(--oa-color);
  --bs-btn-active-color: var(--oa-color);
  --bs-btn-active-bg: var(--oa-tint-strong);
  --bs-btn-active-border-color: var(--oa-color);
  --bs-btn-disabled-color: var(--oa-color);
  --bs-btn-disabled-bg: var(--oa-tint);
  --bs-btn-disabled-border-color: var(--oa-tint-strong);

  /* Nav links and nav pills */
  --bs-nav-link-color: var(--oa-color);
  --bs-nav-link-hover-color: var(--oa-color);
  --bs-nav-pills-link-active-color: var(--oa-color);
  --bs-nav-pills-link-active-bg: var(--oa-tint-strong);

  /* Alerts */
  --bs-alert-color: var(--oa-color);
  --bs-alert-bg: var(--oa-tint);
  --bs-alert-border-color: var(--oa-tint-strong);

  /* Badges */
  --bs-badge-color: var(--oa-color);
}

.oa-green:hover,
.oa-yellow:hover,
.oa-red:hover,
.oa-blue:hover,
.oa-purple:hover,
.oa-orange:hover,
.oa-teal:hover,
.oa-grey:hover {
  color: var(--oa-color);
  background-color: var(--oa-tint-strong);
  border-color: var(--oa-color);
}

/* A chip may wrap a link, as the device tag chips do. Without this the anchor reverts to
   the link colour and the chip reads as two colours. */
.oa-green a, .oa-yellow a, .oa-red a, .oa-blue a, .oa-purple a, .oa-orange a,
.oa-teal a, .oa-grey a, .oa-neutral a,
.oa-green a:hover, .oa-yellow a:hover, .oa-red a:hover, .oa-blue a:hover,
.oa-purple a:hover, .oa-orange a:hover, .oa-teal a:hover, .oa-grey a:hover,
.oa-neutral a:hover {
  color: inherit;
  text-decoration: none;
}

/* Neutral quiet button. The second of the two greys: .oa-grey is a tinted status chip,
   this one is the bordered control that sits in a toolbar without asking for attention.
   Replaces .btn-outline-secondary, .btn-light and .btn-secondary, which the theme already
   drove from the same three tokens, so the appearance is unchanged. */
.oa-neutral {
  color: var(--text-secondary);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-light);
  transition: all var(--transition);
  box-shadow: none;
  --bs-btn-color: var(--text-secondary);
  --bs-btn-bg: var(--bg-surface);
  --bs-btn-border-color: var(--border-light);
  --bs-btn-hover-color: var(--text-primary);
  --bs-btn-hover-bg: var(--bg-hover);
  --bs-btn-hover-border-color: var(--text-muted);
  --bs-btn-active-color: var(--text-primary);
  --bs-btn-active-bg: var(--bg-hover);
  --bs-btn-active-border-color: var(--text-muted);
  --bs-btn-disabled-color: var(--text-muted);
  --bs-btn-disabled-bg: var(--bg-surface);
  --bs-btn-disabled-border-color: var(--border);
}
.oa-neutral:hover {
  color: var(--text-primary);
  background-color: var(--bg-hover);
  border-color: var(--text-muted);
}
.oa-neutral:focus-visible {
  color: var(--text-primary);
  background-color: var(--bg-hover);
  border-color: var(--text-muted);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Field help icons — the small circled question mark beside a field label. One of these
   sits next to every label on every read and create form, so at full --info they read as a
   row of links competing with the content they annotate. --info-soft lets them recede.
   The popover trigger is the wrapping anchor, which keeps its own hover treatment from
   .card-body .btn-clear:hover, so the affordance does not depend on this colour. */
.oa-help-icon {
  color: var(--info-soft);
}

/* Progress bar segments take the colour but not the chip shape. The :where() defaults above
   carry padding, font-size and a radius, which suit a pill or a button; on a progress bar they
   push the segment past the height of its own track (33px inside a 30px bar) and shrink the
   label. The segment is sized by the track, so only the tint, text colour and border apply. */
.progress-bar.oa-green,
.progress-bar.oa-yellow,
.progress-bar.oa-red,
.progress-bar.oa-blue,
.progress-bar.oa-purple,
.progress-bar.oa-orange,
.progress-bar.oa-teal,
.progress-bar.oa-grey {
  padding: 0;
  font-size: inherit;
  border-radius: 0;
}

/* Text-only variants. Same tokens as the chip classes above, but colour alone: no tint, no
   border, no padding. Use these wherever a word or an icon needs to carry a colour inside
   running text or a table cell, where a chip would be wrong. They replace Bootstrap's
   .text-success / .text-danger / .text-warning / .text-info / .text-primary and the older
   .text-oa-* helpers, so the whole GUI reads one palette. */
.oa-text-green  { color: var(--success); }
.oa-text-yellow { color: var(--warning); }
.oa-text-red    { color: var(--danger); }
.oa-text-blue   { color: var(--info); }
.oa-text-purple { color: var(--purple); }
.oa-text-orange { color: var(--severity-high); }
.oa-text-teal   { color: var(--accent); }
.oa-text-grey   { color: var(--text-secondary); }

/* Keyboard focus gets the same lift as hover, plus a ring, so the set is usable without
   a mouse wherever it lands on a button, a link or a nav item. */
.oa-green:focus-visible,
.oa-yellow:focus-visible,
.oa-red:focus-visible,
.oa-blue:focus-visible,
.oa-purple:focus-visible,
.oa-orange:focus-visible,
.oa-teal:focus-visible,
.oa-grey:focus-visible {
  background-color: var(--oa-tint-strong);
  border-color: var(--oa-color);
  outline: 2px solid var(--oa-color);
  outline-offset: 2px;
}

/* Menu entries the user's role does not permit (menuItem() and menuAttributes() in
   shared/header.php). Greyed, no hover highlight, and a not-allowed cursor; the click
   shows the permission toast instead of navigating. open-audit-new.css gives a.greyout
   one fixed grey, which this replaces with the theme's muted text so both modes read. */
.dropdown-menu .dropdown-item.greyout,
.dropdown-menu .dropdown-item.greyout:hover,
.dropdown-menu .dropdown-item.greyout:focus {
  color: var(--text-muted);
  opacity: 0.6;
  cursor: not-allowed;
  background: transparent;
  text-decoration: none;
}
.sidebar-flyout a.greyout,
.sidebar-flyout a.greyout:hover,
.sidebar-flyout a.greyout:focus {
  color: var(--text-muted);
  opacity: 0.6;
  cursor: not-allowed;
  background: transparent;
}

/* open-audit-new.css pins every .btn-close to the top right corner of its positioned
   ancestor (position:absolute, top:0, right:0, with its own padding), a rule written for
   the dismiss button of an alert. In a modal header Bootstrap places the close button
   with flex and negative margins, so the absolute placement pulled it out of line with
   the title and up against the corner of the dialog. Put it back in the header's flow;
   the top and right offsets are ignored once it is static. */
.modal-header .btn-close {
  position: static;
  z-index: auto;
}

/* Bootstrap's reboot sets th to text-align: inherit, which beats the align attribute Markdown
   puts on a centred table column. Without this the headings sit left over centred cells. */
table th[align="center"],
table td[align="center"] { text-align: center; }
