/* ============================================================
   Lab Inventory System — Custom Styles
   ============================================================ */

:root {
  --sidebar-width: 260px;
  --sidebar-bg: #1a2332;
  --sidebar-text: #c8d3e0;
  --sidebar-active: #3498db;
  --sidebar-hover: rgba(52, 152, 219, 0.15);
  --accent: #3498db;
  --accent-hover: #2980b9;
  --content-bg: #f0f4f8;
  --card-bg: #ffffff;
  --topbar-h: 60px;

  /* Announcement bar (site-wide notices). One source per colour — the classes
     below and the preview swatches on the admin page both read these.
     All three are dark enough to carry WHITE text at WCAG AA 4.5:1; if a level ever
     looks too pale, DARKEN THE BACKGROUND rather than switching to dark text, so the
     bar keeps looking like one family. Never use Bootstrap's bg-warning / bg-info /
     bg-light here — those are light backgrounds that would need text-dark. */
  --announce-info:     #1b6ca8;   /* white text = 5.59:1 */
  --announce-warning:  #b25e14;   /* white text = 4.66:1 */
  --announce-critical: #b02a37;   /* white text = 6.50:1 */

  /* Category badge colors */
  --consumable: #1e8549;
  --labware: #8e44ad;
  --chemical: #de2d1b;
  --ict: #277ab1;
  --lab-eq: #b25e14;
  --software: #12836d;
  /* Furniture. Rose is the one hue the other six do not use — a brown would
     sit next to Lab Equipment's orange in the nav and read as the same badge.
     Tuned to 4.66:1 against white text, matching the rest of the palette. */
  --furniture: #b1548a;

  /* Theme-aware colors (light mode defaults) */
  --text-primary:  #2c3e50;
  --text-heading:  #1e293b;
  --text-secondary:#374151;
  --text-muted:    #64748b;
  --border-color:  #e2e8f0;
  --border-subtle: #f1f5f9;
  --bg-subtle:     #f8fafc;
  --topbar-bg:     #ffffff;
  --modal-bg:      #ffffff;
  --input-bg:      #eef2f7;
  --input-border:  #dee2e6;
  --input-text:    #2c3e50;
}

/* ── Dark Mode ─────────────────────────────────────────────── */
[data-theme="dark"] {
  /* The booking page's information boxes (.info-panel) - measured 28 Nov 2026 */
  --info-panel-bg:     #0f2f36;
  --info-panel-border: #1f7a8c;
  --info-panel-link:   #67e8f9;
  --content-bg:    #0f172a;
  --card-bg:       #1e293b;
  --topbar-bg:     #1e293b;
  --modal-bg:      #1e293b;
  --input-bg:      #162032;
  --input-border:  #334155;
  --input-text:    #cbd5e1;
  --text-primary:  #cbd5e1;
  --text-heading:  #f1f5f9;
  --text-secondary:#94a3b8;
  --text-muted:    #8b949e;
  --border-color:  #334155;
  --border-subtle: #243245;
  --bg-subtle:     #162032;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--content-bg);
  color: var(--text-primary);
  margin: 0;
  overflow-x: hidden;
}

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

.sidebar-brand {
  display: flex;
  align-items: center;
  padding: 20px 20px 16px;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  min-height: 64px;
}

.sidebar-brand i { font-size: 1.5rem; color: var(--accent); }

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.88rem;
  transition: background 0.15s, color 0.15s;
  border-radius: 0;
  white-space: nowrap;
}

.sidebar-nav .nav-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.sidebar-nav .nav-link.active {
  background: linear-gradient(90deg, rgba(52,152,219,0.25) 0%, transparent 100%);
  color: #fff;
  border-left: 3px solid var(--accent);
}

.sidebar-nav .nav-link i { font-size: 1rem; min-width: 18px; }

/* ── Sidebar counts (templates/_nav_badge.html) ──
   One shape for all seven — Bootstrap's square badge with rounded corners (client, 30 Oct
   2026; four were that, three a round pill) — and its own text size, never overridden per
   link. The colour says what the number means: red and amber are Bootstrap's bg-danger
   (white 4.53:1) and bg-warning + text-dark (9.46:1); the orange is this rule, white
   4.66:1, replacing two near-identical ones typed into the page (#bc5602 Maintenance,
   #b25e14 Feedback). */
.sidebar-nav .nav-count {
  border-radius: var(--bs-badge-border-radius, 0.375rem);
  white-space: nowrap;
}
.sidebar-nav .nav-count-notice  { background-color: #b25e14; color: #ffffff; }

.nav-sub {
  padding: 6px 20px 6px 48px !important;
  font-size: 0.82rem !important;
}

/* ── Searchable location select — sticky "Enter manually" button ── */
.loc-enter-manually {
  padding: 7px 12px;
  font-size: 0.83em;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color, #dee2e6);
  background: var(--bg-subtle, #f1f5f9);
  color: var(--text-primary, #2c3e50);
  user-select: none;
}
.loc-enter-manually:hover {
  background: var(--accent, #3498db);
  color: #fff;
}
[data-theme="dark"] .loc-enter-manually {
  background: #2a3547;
  border-color: #3a4a5c;
}
[data-theme="dark"] .loc-enter-manually:hover {
  background: var(--accent, #3498db);
  color: #fff;
}

/* Read-only supplier summary shown under a supplier picker */
.supplier-info-panel {
  margin-top: 8px;
  padding: 8px 10px;
  font-size: 0.83em;
  border: 1px solid var(--border-color, #dee2e6);
  border-radius: 6px;
  background: var(--bg-subtle, #f1f5f9);
  color: var(--text-primary, #2c3e50);
}
[data-theme="dark"] .supplier-info-panel {
  background: #1a2436;
  border-color: #3a4a5c;
  color: var(--text-primary, #e2e8f0);
}

.collapse-chevron {
  transition: transform 0.25s ease;
  flex-shrink: 0;
}

.nav-link[aria-expanded="true"] .collapse-chevron {
  transform: rotate(90deg);
}

.nav-link[aria-expanded="false"] .collapse-chevron {
  transform: rotate(0deg);
}

.nav-section-label {
  padding: 14px 20px 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: rgba(200, 211, 224, 0.45);
  text-transform: uppercase;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 0.95rem;
  flex-shrink: 0;
}

.user-name {
  font-weight: 600; color: #fff; font-size: 0.88rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.user-details { overflow: hidden; }

[class^="badge-role-"] { font-size: 0.68rem; }
.badge-role-master_admin { color: #ff7675; }
.badge-role-admin { color: #fdcb6e; }
.badge-role-user { color: #74b9ff; }

/* ── Main Content ──────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s ease;
}

.topbar {
  height: var(--topbar-h);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  overflow: visible;
}

.topbar-toggle { color: var(--text-muted); padding: 6px; }
.topbar-toggle:hover { color: var(--accent); }

.breadcrumb { font-size: 0.85rem; }
.breadcrumb-item a { color: var(--accent); text-decoration: none; }
.breadcrumb-item.active { color: var(--text-muted); }

.page-content { padding: 24px; flex: 1; }

/* ── Page Header ───────────────────────────────────────────── */
.page-header { margin-bottom: 24px; }

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-heading);
  margin: 0 0 4px;
}

.page-subtitle {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.9rem;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
/* Bootstrap 5.3 sets color: var(--bs-body-color) on .card, which is black in our custom
   dark mode (we don't use Bootstrap's native dark mode). Override it here so all plain
   text inside cards inherits the correct themed colour without needing per-element rules. */
[data-theme="dark"] .card {
  color: var(--text-primary);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border-subtle);
  padding: 14px 18px;
}
/* Bootstrap rounds a first-child card-header's top corners using its own default
   radius (~5px), which doesn't match our 10px card — leaving a faint/broken line at
   the top corners. Force them to match the card so the rounded border reads cleanly. */
.card > .card-header:first-child {
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}

.card-title { font-size: 0.9rem; font-weight: 600; color: var(--text-secondary); }

/* ── Summary Cards ─────────────────────────────────────────── */
.summary-card {
  border-radius: 10px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.summary-icon {
  width: 54px; height: 54px;
  border-radius: 12px;
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.summary-value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.summary-label { font-size: 0.82rem; opacity: 0.85; margin-top: 4px; }

.summary-card-primary  { background: linear-gradient(135deg, #3498db, #2980b9); }
.summary-card-success  { background: linear-gradient(135deg, #27ae60, #219a52); }
.summary-card-danger   { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.summary-card-secondary{ background: linear-gradient(135deg, #95a5a6, #7f8c8d); }
.summary-card-info     { background: linear-gradient(135deg, #16a085, #1abc9c); }
.summary-card-missing     { background: linear-gradient(135deg, #F73D93, #d42979); }
.summary-card-warning  {
  background: linear-gradient(135deg, #f39c12, #e67e22);
}
.summary-card-success *,
.summary-card-danger *,
.summary-card-primary *,
.summary-card-info *,
.summary-card-missing *,
.summary-card-secondary * {
  color: #ffffff !important;
}
.summary-card-warning *,
.summary-card-warning .summary-label,
.summary-card-warning .summary-value {
  color: #ffffff !important;
}
[data-theme="dark"] .summary-card-success *,
[data-theme="dark"] .summary-card-warning *,
[data-theme="dark"] .summary-card-danger *,
[data-theme="dark"] .summary-card-info *,
[data-theme="dark"] .summary-card-missing *,
[data-theme="dark"] .summary-card-primary *,
[data-theme="dark"] .summary-card-secondary * {
  color: #ffffff !important;
}

/* ── Category Badges ───────────────────────────────────────── */
.badge-consumable { background-color: var(--consumable) !important; color: #fff !important; }
.badge-labware    { background-color: var(--labware) !important;    color: #fff !important; }
.badge-chemical   { background-color: var(--chemical) !important;   color: #fff !important; }
.badge-ict        { background-color: var(--ict) !important;        color: #fff !important; }
.badge-lab-eq     { background-color: var(--lab-eq) !important;     color: #fff !important; }
.badge-software   { background-color: var(--software) !important;   color: #fff !important; }
.badge-furniture  { background-color: var(--furniture) !important;  color: #fff !important; }

/* ── Booking setup: narrow time boxes ──────────────────────────────────────
   A time input only ever holds "09:00", so a full-width column is mostly empty
   and pushes the date beside it out of view. Capped rather than fixed, so it
   still shrinks on a narrow screen instead of overflowing its column. */
.booking-time-input { max-width: 150px; }

/* ── Calendar picker on a DD/MM/YYYY text box (see main.js) ────────────────
   The transparent <input type="date"> sits ON TOP of the icon so a click opens
   the browser's own calendar with no scripting. The icon underneath is purely
   what the user sees, hence pointer-events:none — without that it would swallow
   the click and nothing would open. */
.date-picker-wrap { position: relative; display: block; }
.date-picker-wrap > .date-text-input { padding-right: 2.1rem; }
.date-picker-icon {
  position: absolute; right: .7rem; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none; font-size: .95rem;
}
.date-picker-native {
  position: absolute; right: 0; top: 0; height: 100%; width: 2.4rem;
  opacity: 0; cursor: pointer; border: 0; padding: 0; background: transparent;
}
/* Chromium draws its own indicator inside the native box; stretch it so the
   whole transparent strip is clickable rather than just a few pixels of it. */
.date-picker-native::-webkit-calendar-picker-indicator {
  position: absolute; inset: 0; width: 100%; height: 100%;
  margin: 0; padding: 0; cursor: pointer; opacity: 0;
}
@media (max-width: 575.98px) { .booking-time-input { max-width: 100%; } }

/* ── Low-Stock Row ─────────────────────────────────────────── */
.table-row-low-stock {
  background-color: rgba(231, 76, 60, 0.06) !important;
  border-left: 3px solid #e74c3c;
}

/* ── Tables ────────────────────────────────────────────────── */
.table th,
.table thead th,
.table > thead > tr > th,
table th,
thead th {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #2c3e50 !important;
  background: var(--bg-subtle);
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}

[data-theme="dark"] .table th,
[data-theme="dark"] .table thead th,
[data-theme="dark"] .table > thead > tr > th,
[data-theme="dark"] table th,
[data-theme="dark"] thead th {
  color: #cbd5e1 !important;
  background: var(--bg-subtle) !important;
  border-bottom-color: var(--border-color) !important;
}

[data-theme="dark"] th span,
[data-theme="dark"] th i,
[data-theme="dark"] th small {
  color: #cbd5e1 !important;
}

[data-theme="dark"] #inventoryTable th,
[data-theme="dark"] #usersTable th,
[data-theme="dark"] #logsTable th,
[data-theme="dark"] #stockMovementTable th,
[data-theme="dark"] #feedbackTable th,
[data-theme="dark"] .sds-table th,
[data-theme="dark"] .compliance-table th {
  color: #cbd5e1 !important;
}

.table td { font-size: 0.87rem; vertical-align: middle; color: var(--text-primary); }

/* ── Merged "QTY" band ────────────────────────────────────────
   Groups QTY (New) / (In Use) / (Issued Out) under a single "QTY" heading, so the word is
   not repeated three times. It is NOT a second header row: the table keeps one header row
   (the drag-reorder and DataTables both map header cells to body cells by position, and a
   colspan/rowspan header would skew them). It is a strip absolutely positioned inside the
   first QTY cell and stretched across its neighbours by JS — see window.drawQtyBand in main.js.

   The header row gets extra top padding to make room for the strip, and every other header
   is vertically centred over the full height, so it reads as a merged two-row header. */
/* Any table carrying the band — the faculty inventory list and both research lists
   (window.drawQtyBand in main.js, one copy since 30 Oct 2026). */
thead.has-qty-band th {
  padding-top: 26px;          /* room for the strip */
}

/* ── Quantity values in the item lists (templates/_qty_cells.html) ──
   Bold coloured text, no fill — client's choice, 30 Oct 2026, replacing Bootstrap's
   .text-warning / .text-info on the faculty list (#ffc107 / #0dcaf0 measure 1.63:1 and
   1.96:1 on white) and filled pills on the research lists. Calculated against white, the
   hover grey (#ececec) and the dark card / page / hover backgrounds:
     low (red)    #b5202e 6.54 / 5.54 light   #ff9ba3 7.29 / 6.26 dark (as .import-refused)
     in use       #8a6100 5.54 / 4.69 light   #ffc107 8.97 / 7.70 dark (as .import-warned)
     out (blue)   #0b63a8 6.24 / 5.28 light   #6ec8f5 7.83 / 6.72 dark */
.qty-val-low,
.qty-val-in-use,
.qty-val-out { font-weight: 700; }
.qty-val-low    { color: #b5202e; }
.qty-val-in-use { color: #8a6100; }
.qty-val-out    { color: #0b63a8; }
[data-theme="dark"] .qty-val-low    { color: #ff9ba3; }
[data-theme="dark"] .qty-val-in-use { color: #ffc107; }
[data-theme="dark"] .qty-val-out    { color: #6ec8f5; }
/* Links to a stock group, and from a group to its records (30 Oct 2026). Bootstrap's link
   blue (#0d6efd) measured 3.25:1 on the dark card and 4.0:1 on the light grey view field.
   Calculated: #0a58ca 5.45-6.44:1 on the light backgrounds, #6ec8f5 6.72-9.56:1 on the dark. */
.stock-group-link { color: #0a58ca; }
[data-theme="dark"] .stock-group-link { color: #6ec8f5; }
/* The dashboard's low-stock "View All" in dark: Bootstrap's outline red (#dc3545) measured
   3.23:1 on the dark card — on screen only when something is low, so it went unseen until
   the page sweep held a low stock group (30 Oct 2026). Scoped to this button alone, like
   .btn-close-case: .btn-outline-danger is on many buttons. #ff9ba3 = .import-refused's
   dark red, 7.29:1. Light keeps Bootstrap's (4.53:1 on white). */
[data-theme="dark"] .btn-low-stock-all { color: #ff9ba3; border-color: #ff9ba3; }
[data-theme="dark"] .btn-low-stock-all:hover { color: #1e293b; background-color: #ff9ba3; }
/* Top-align every header so one-line labels ("Chemical Name", "UoM") start on the same line
   as the first line of the two-line ones ("SUB-/CATEGORY", "UNIT/PRICE") — one clean baseline
   across the row, instead of short labels floating between their neighbours' two lines.
   The research lists too (30 Oct 2026), so "NEW" sits beside "IN" under the QTY band on
   every list, not beside "USE". */
#inventoryTable thead th,
#researchChemicalsTable thead th,
#researchAssetsTable thead th { vertical-align: top; }
#inventoryTable thead th { position: relative; }
.qty-band-overlay {
  position: absolute;
  top: 0;
  left: 0;
  height: 22px;
  line-height: 20px;
  text-align: center;
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .5px;
  color: var(--text-heading);
  border-bottom: 1px solid var(--border-color);
  pointer-events: none;       /* never swallow a click meant for the sort link */
  z-index: 1;
}
.qty-sub { white-space: nowrap; }

/* Centre-aligned columns (QTY / In Stock Value) — narrow, since they hold small numbers.
   These used to carry 26px of padding on BOTH sides: DataTables reserved 26px on the right of
   every sortable header for its own ▲▼ carets, and the left had to mirror it or the centred
   label sat off-axis from the values. DataTables no longer sorts (see main.js), so that
   reserve is gone and the padding with it — the columns get ~50px narrower each.
   The label still centres over its values because the sort arrow's width is mirrored by an
   invisible spacer (below). */
#inventoryTable thead th.text-center {
  position: relative;
  padding-left: 6px;
  padding-right: 6px;
}
#inventoryTable td.col-qty-store,
#inventoryTable td.col-qty-in-use,
#inventoryTable td.col-qty-issued-out,
#inventoryTable td.col-stock-value {
  padding-left: 6px;
  padding-right: 6px;
}
#inventoryTable thead th.text-center .sort-link { justify-content: center; }
/* The sort arrow sits after the label, which would shove the visible text left of centre.
   Mirror its width with an invisible spacer BEFORE the label, so [spacer][LABEL][arrow] is
   symmetric and the label lands dead centre over its values. */
#inventoryTable thead th.text-center .sort-link::before {
  content: "";
  display: inline-block;
  width: 1em;
  flex: none;
}

/* One sort indicator, on the column actually being sorted.
   The arrow stays in the markup on every sortable header (so the label never shifts) but is
   only made visible on the active sort column — and faintly on hover, so you can still see
   which headers are clickable. DataTables' own ▲▼ carets are gone: it no longer sorts (see
   `ordering: false` in main.js), because it can only reorder the rows already on the page.
   ⚠ ALL THREE ITEM LISTS (client, 30 Oct 2026): the research lists reuse these headings but
   this rule named the faculty table alone, so every research heading showed its arrow all the
   time — pointing the same way on each, which reads as though every column were sorted. */
#inventoryTable thead .sort-link > i,
#researchChemicalsTable thead .sort-link > i,
#researchAssetsTable thead .sort-link > i {
  visibility: hidden;          /* hidden, NOT display:none — keeps the spacing stable */
  transition: opacity .12s ease;
}
#inventoryTable thead .sort-link.active-sort > i,
#researchChemicalsTable thead .sort-link.active-sort > i,
#researchAssetsTable thead .sort-link.active-sort > i { visibility: visible; }
#inventoryTable thead .sort-link:hover > i,
#researchChemicalsTable thead .sort-link:hover > i,
#researchAssetsTable thead .sort-link:hover > i {
  visibility: visible;
  opacity: .45;                /* a hint that the header is clickable */
}
#inventoryTable thead .sort-link.active-sort:hover > i,
#researchChemicalsTable thead .sort-link.active-sort:hover > i,
#researchAssetsTable thead .sort-link.active-sort:hover > i { opacity: 1; }

/* ── Column widths on the THREE item tables (client, 28 Oct 2026) ─────────────────────
   Faculty items, Research Fixed Assets and Research Chemicals — one block, so they cannot
   drift apart. Measured on a live copy at 1440 px: every faculty table is wider than the
   screen, so the browser shrinks every column to its MINIMUM — and Description, the one
   column whose text may wrap, went down to its heading's width (117-140 px) while
   AVAILABLE spent 115 px on one digit. In that state a column's width is its widest
   unbreakable content, so these rules set minimums rather than ask for "more room".
   ⚠ `box-sizing: border-box` is load-bearing: DataTables makes the faculty table's
   headings content-box (padding ADDED to the width) while the research tables are
   border-box, so the same 280 px rendered 296 px on one and 280 on the other. Stated here,
   the widths are what is measured on the page, on all three.
   tests/test_table_column_widths.py. */
#inventoryTable thead th[data-column="description"],
#researchAssetsTable thead th[data-column="description"],
#researchChemicalsTable thead th[data-column="description"] {
  box-sizing: border-box;
  min-width: 280px;
}
/* Supplier shows the company name only (the `first_line` filter) at a fixed 180 px; a
   longer name wraps. The contacts typed under it stay in the pop-up and the exports. */
#inventoryTable thead th[data-column="supplier"],
#researchAssetsTable thead th[data-column="ra-col-supplier"],
#researchChemicalsTable thead th[data-column="rc-col-supplier"] {
  box-sizing: border-box;
  width: 180px;
  min-width: 180px;
}
/* SDS: two language badges side by side ("EN BM"), on both chemical lists — 96 px is what
   the faculty table measured (80 px of content plus padding); at 80 px the research one
   stacked them (30 Oct 2026). */
#inventoryTable thead th[data-column="sds"],
#researchChemicalsTable thead th[data-column="rc-col-sds"] {
  box-sizing: border-box;
  min-width: 96px;
}
/* A price reads as one figure — "RM / 5,000.00" over two lines did not. */
#inventoryTable td.col-unit-price, #inventoryTable td.col-total,
#researchAssetsTable td.ra-col-unit-price, #researchAssetsTable td.ra-col-total,
#researchChemicalsTable td.rc-col-unit-price, #researchChemicalsTable td.rc-col-total {
  white-space: nowrap;
}
/* Quantity headings (`qty-head`): the label wraps word by word, and the sort arrow is drawn
   UNDER it instead of beside it — beside it, the arrow plus the invisible spacer mirroring
   it (above) took ~33 px of a column holding one digit. Out of the flow, it costs no width
   and the label stays centred. When it shows is unchanged (the rules above). */
#inventoryTable thead th.qty-head,
#researchAssetsTable thead th.qty-head,
#researchChemicalsTable thead th.qty-head {
  position: relative;
  padding-bottom: 14px;
}
#inventoryTable thead th.qty-head .sort-link,
#researchAssetsTable thead th.qty-head .sort-link,
#researchChemicalsTable thead th.qty-head .sort-link {
  white-space: normal;
  justify-content: center;
}
#inventoryTable thead th.qty-head .sort-link::before { display: none; }
#inventoryTable thead th.qty-head .sort-link > i,
#researchAssetsTable thead th.qty-head .sort-link > i,
#researchChemicalsTable thead th.qty-head .sort-link > i {
  position: absolute;
  left: 50%;
  bottom: 1px;
  transform: translateX(-50%);
  font-size: .8em;
}

.sort-link,
th .sort-link,
th a {
  color: #2c3e50 !important;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.sort-link:hover,
th a:hover { color: var(--accent) !important; }
.sort-link.active-sort,
th a.active-sort { color: var(--accent) !important; font-weight: 600; }

[data-theme="dark"] .sort-link,
[data-theme="dark"] th .sort-link,
[data-theme="dark"] th a {
  color: #cbd5e1 !important;
}
[data-theme="dark"] .sort-link:hover,
[data-theme="dark"] th a:hover {
  color: var(--accent) !important;
}
[data-theme="dark"] .sort-link.active-sort,
[data-theme="dark"] th a.active-sort {
  color: var(--accent) !important;
}

/* ── Category breakdown list ───────────────────────────────── */
.category-breakdown-list {
  list-style: none; margin: 0; padding: 0;
}

.category-breakdown-item { border-bottom: 1px solid var(--border-subtle); }
.category-breakdown-item:last-child { border-bottom: none; }

.category-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  text-decoration: none;
  color: inherit;
  transition: background 0.1s;
}
.category-link:hover { background: var(--bg-subtle); }

.category-badge-sm { font-size: 0.75rem; white-space: nowrap; }

.category-bar {
  flex: 1;
  height: 6px;
  background: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
}
.category-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.category-count {
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 28px;
  text-align: right;
  font-size: 0.88rem;
}

/* ── Low stock table in dashboard ──────────────────────────── */
.low-stock-table th, .low-stock-table td { padding: 8px 12px; font-size: 0.84rem; }
.low-stock-row { border-left: 3px solid #e74c3c; }

/* ── Btn XS ────────────────────────────────────────────────── */
.btn-xs {
  padding: 2px 8px;
  font-size: 0.78rem;
  line-height: 1.5;
  border-radius: 4px;
}

/* ── Site-wide announcement bar ────────────────────────────── */
/* A planned-downtime notice shown at the top of every page, including the login page.
   Rendered by templates/_announcement_bar.html; the level suffix comes from
   ANNOUNCEMENT_LEVELS in models.py, and tests/test_announcements.py fails if a level
   has no rule here or if a rule forgets its explicit `color`.

   ⚠ NO ANIMATION, deliberately. Asked for as a scrolling "breaking news" banner and
   built static: the reader needs the date and the time window at a glance, and
   auto-motion over 5s fails WCAG 2.2.2 without a pause control.

   Solid dark background + white text means this looks IDENTICAL in light and dark
   mode, which is what we want — login.html has no data-theme attribute at all, so
   these colours have to work with no theme applied. */
.announcement-bar {
  display: flex;
  /* FLEX-START, so the icon and the × stay level with the FIRST LINE of the message.
     That is the convention for alert banners (Material banners, GitHub flash, Atlassian
     section messages, Carbon notifications all top-align) and it is the only option that
     scales: centring looks fine on one line, tolerable on two, and clearly wrong at three
     or more, where the icon drifts away from the text it labels and floats beside the
     middle of the block.

     ⚠ This ONLY looks right because the three children are forced to share ONE line-box
     height below (see .announcement-bar-icon / -close). An earlier version left the icon
     at 1rem/1.45 (~23px) against the text's 0.88rem/1.45 (~20px): the icon then set the
     row height and everything hugged the top of that taller band, leaving a visible gap
     under the text and a worse one under the ×. If you change a font-size here, keep the
     line boxes equal or that gap comes straight back. */
  align-items: flex-start;
  gap: 10px;
  padding: 10px 24px;
  font-size: 0.88rem;
  line-height: 1.45;
  /* Explicit, not inherited: containers do not reliably inherit through Bootstrap,
     and this also renders inside .login-card, which sets its own colour. */
  color: #ffffff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.18);
}

/* The icon and the × must occupy EXACTLY one line box of the message — same font-size,
   same line-height — so that "aligned to the top" and "centred on the first line" are the
   same thing. Get this wrong and the tallest child silently sets the row height and the
   other two hang off the top of it. No magic numbers: both simply inherit the bar's
   0.88rem and repeat its 1.45, so changing the bar's font-size keeps everything in step. */
.announcement-bar-icon {
  flex: 0 0 auto;
  font-size: inherit;
  line-height: 1.45;
  color: #ffffff;
}

.announcement-bar-text {
  flex: 1 1 auto;
  color: #ffffff;
  /* Long notices wrap onto a second line rather than scrolling or being clipped. */
  overflow-wrap: anywhere;
}

.announcement-bar-text strong {
  color: #ffffff;
  margin-right: 4px;
}

.announcement-bar-close {
  flex: 0 0 auto;
  background: transparent;
  border: none;
  padding: 0 2px;
  /* Same one-line-box rule as the icon above — do not set these independently. */
  font-size: inherit;
  line-height: 1.45;
  color: #ffffff;
  opacity: 0.75;
  cursor: pointer;
}

.announcement-bar-close:hover,
.announcement-bar-close:focus {
  opacity: 1;
}

.announcement-bar-info     { background: var(--announce-info);     color: #ffffff; }
.announcement-bar-warning  { background: var(--announce-warning);  color: #ffffff; }
.announcement-bar-critical { background: var(--announce-critical); color: #ffffff; }

/* Inside the login / signup / forgot-password card the bar is a block in a rounded
   card rather than a full-width strip, so give it corners and its own spacing. */
.login-card .announcement-bar {
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: 8px;
  border-bottom: none;
}

/* ── Flash alerts ──────────────────────────────────────────── */
.flash-container {
  padding: 12px 24px 0;
}

.toast-alert {
  border-radius: 8px;
  font-size: 0.88rem;
  border: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ── Section headings in forms ─────────────────────────────── */
/* Edit & View forms render each ".section-heading + following .row" as a card,
   to match the card+icon sections used by the Add form and the research forms. */
.section-heading {
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-heading);
  background: var(--card-bg);
  margin: 0;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px 8px 0 0;
}
.section-heading + .row {
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 8px 8px;
  padding: 14px 16px;
  margin: 0 0 20px 0;
  background: var(--card-bg);
}

/* ── Sub-category selection cards ──────────────────────────── */
.sub-cat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 10px;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  background: var(--card-bg);
  color: var(--text-primary);
}

.sub-cat-card:hover {
  border-color: var(--accent);
  background: rgba(52, 152, 219, 0.05);
}

.sub-cat-card.selected {
  border-color: var(--accent);
  background: rgba(52, 152, 219, 0.1);
  color: var(--accent-hover);
}

.sub-cat-icon { font-size: 1.6rem; }
.sub-cat-label { font-size: 0.78rem; font-weight: 600; line-height: 1.3; }

/* ── Audit info ────────────────────────────────────────────── */
.audit-info {
  padding: 8px 12px;
  background: var(--bg-subtle);
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Empty state ───────────────────────────────────────────── */
.empty-state {
  padding: 32px 16px;
  text-align: center;
}

/* ── Error pages ───────────────────────────────────────────── */
.error-page { padding: 80px 20px; }
.error-code {
  font-size: 6rem;
  font-weight: 900;
  color: var(--border-color);
  line-height: 1;
}

/* ── User avatar small ─────────────────────────────────────── */
.user-avatar-sm {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 0.8rem;
  flex-shrink: 0;
}

/* ── Role permission cards ─────────────────────────────────── */
.role-permission-card {
  border: 1px solid var(--border-color);
  border-left-width: 4px !important;
  border-radius: 8px;
  padding: 14px;
}

.permission-list {
  list-style: none;
  padding: 0; margin: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.permission-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ── Login Page ────────────────────────────────────────────── */
.login-body {
  background: linear-gradient(135deg, #1a2332 0%, #2c3e50 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Wider than a bare sign-in box needs, on purpose. This card carries more than a
   username and password: the site-wide announcement bar, the development-build
   notice, and (with the directory on) the "sign in with your organisation account"
   explanation. At the old 420px that guidance wrapped to about ten lines and
   pushed the page into scrolling, so the form itself was below the fold.
   `width: 100%` still wins on a phone, so this only widens where there is room. */
.login-wrapper { width: 100%; max-width: 600px; padding: 20px; }

/* The inputs and the sign-in button stay at a comfortable reading width instead
   of stretching to the full card — a 560px-wide password box looks like a
   mistake, and a very wide button is harder to aim at, not easier. The prose
   above uses the full width; the form does not need to. */
/* `.login-panel` is for a block that must line up with the form but is not part
   of it — the "confirmed by the university directory" box on Request Access.
   Listed HERE rather than given its own width, so the measurement lives in one
   place and the box can never drift out of alignment with the fields below it. */
.login-form,
.login-panel,
.login-card .text-center { max-width: 420px; margin-left: auto; margin-right: auto; }

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-header { text-align: center; margin-bottom: 28px; }

.login-logo {
  width: 70px; height: 70px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), #2980b9);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #fff;
  margin-bottom: 16px;
}

.login-title { font-size: 1.6rem; font-weight: 700; color: #1e293b; margin: 0 0 4px; }
.login-subtitle { color: #64748b; font-size: 0.92rem; margin: 0; font-weight: bold; }
.login-footer { text-align: center; margin-top: 20px; }

.btn-login {
  background: linear-gradient(135deg, var(--accent), #2980b9);
  border: none;
  padding: 10px;
  font-weight: 600;
  font-size: 0.95rem;
}
.btn-login:hover { background: linear-gradient(135deg, #2980b9, #2471a3); }

/* ── Responsive sidebar collapse ──────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width)));
  }
  .sidebar.show {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0 !important;
  }
  .brand-text { display: inline; }
}

/* ── Sidebar collapsed state (desktop) ────────────────────── */
body.sidebar-collapsed .sidebar {
  width: 64px;
}
body.sidebar-collapsed .sidebar .brand-text,
body.sidebar-collapsed .sidebar span:not(.badge),
body.sidebar-collapsed .sidebar .nav-section-label,
body.sidebar-collapsed .sidebar .user-details,
body.sidebar-collapsed .sidebar .sidebar-footer .btn {
  display: none;
}
body.sidebar-collapsed .main-content {
  margin-left: 64px;
}
body.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 20px 0; }
body.sidebar-collapsed .sidebar-nav .nav-link { justify-content: center; padding: 12px; }
body.sidebar-collapsed .user-info { justify-content: center; }

/* ── Utilities ─────────────────────────────────────────────── */
.fw-semibold { font-weight: 600; }
.item-description .fw-medium { font-weight: 500; }

/* Tooltip text alignment */
.tooltip-left .tooltip-inner {
  text-align: left;
}

/* ── Theme Toggle Button ───────────────────────────────────── */
.theme-toggle-btn {
  color: var(--text-muted);
  padding: 5px 8px;
  font-size: 1rem;
  border-radius: 8px;
  line-height: 1;
  text-decoration: none;
  transition: color 0.2s ease, background 0.2s ease;
  display: flex;
  align-items: center;
}
.theme-toggle-btn:hover {
  color: var(--accent);
  background: var(--bg-subtle);
}
[data-theme="dark"] .theme-toggle-btn {
  color: #f59e0b;
}
[data-theme="dark"] .theme-toggle-btn:hover {
  color: #fbbf24;
  background: rgba(245,158,11,0.1);
}

/* ── Topbar account menu ────────────────────────────────────────────────────
   The avatar trigger at the top right. The sidebar footer also shows the user,
   but it is hidden when the sidebar collapses — this one is always visible.
   Colours come from the theme variables, so dark mode needs no extra rule. */
.topbar-avatar-btn {
  line-height: 1;
  border-radius: 50%;
  transition: box-shadow 0.2s ease;
}
.topbar-avatar-btn:hover,
.topbar-avatar-btn:focus-visible {
  box-shadow: 0 0 0 3px var(--bg-subtle);
}
.topbar-avatar-btn::after { display: none; }   /* no Bootstrap caret */

/* "Faculty" — the all-faculties account's selector (base.html). Theme variables only.
   The Feedback pill is pinned to the exact centre of the bar (.topbar-center), so it does
   not move out of the way of what sits to its right. */
.working-faculty-label { color: var(--text-primary); }
@media (max-width: 1599.98px) {
  /* The faculty label (icon + word) and the Low Stock words: below 1600px they make
     room for the centred pill. Screen readers still hear both; the dropdown names the
     faculty and the button keeps its icon and number, each with a tooltip. Measured 28
     Oct 2026 with the Low Stock button showing: with only the word hidden below 1400px,
     the selector ran under the pill (-42 px at 1280, -51 at 1400). */
  .working-faculty-label,
  .topbar-low-stock-text {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
  }
}
.working-faculty .form-select {
  width: auto;
  min-width: 7.5rem;
  background-color: var(--input-bg);
  color: var(--text-primary);
  border-color: var(--border-color);
}
/* A NARROWED view (one faculty chosen) is marked, so a page showing one faculty is never
   read as data having gone missing (client, 28 Oct 2026, option A). ⚠ The dark selector is
   load-bearing: `[data-theme="dark"] .form-select` is more specific and repainted the
   border grey, so in dark the narrowed view looked like any other (measured). */
.working-faculty-narrowed .form-select,
[data-theme="dark"] .working-faculty-narrowed .form-select {
  border: 2px solid var(--accent);
  font-weight: 600;
}

/* Bootstrap's dropdown defaults to light; re-point it at the theme variables so
   the account and notification menus — and the inventory page's Bulk Upload menu
   (22 Oct 2026: left light, its grey hint measured 3.08:1 in dark) — stay readable
   in dark mode. */
.topbar .dropdown-menu,
.bulk-upload-menu.dropdown-menu,
.export-menu.dropdown-menu {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  min-width: 230px;
}
.topbar .dropdown-menu .dropdown-item,
.bulk-upload-menu .dropdown-item,
.export-menu .dropdown-item { color: var(--text-primary); }
.topbar .dropdown-menu .dropdown-item:hover,
.topbar .dropdown-menu .dropdown-item:focus {
  background: var(--bg-subtle);
  color: var(--accent);
}
/* ⚠ Not the accent colour on hover: --accent on --bg-subtle measured 3.01:1 in light
   (the top-bar menus above have the same; left as they were). The text keeps its
   colour and only the background marks the row. */
.bulk-upload-menu .dropdown-item:hover,
.bulk-upload-menu .dropdown-item:focus,
.export-menu .dropdown-item:hover,
.export-menu .dropdown-item:focus {
  background: var(--bg-subtle);
  color: var(--text-primary);
}
/* The Export menu's section titles (Spreadsheet / Consumable Assets / ...): Bootstrap's
   grey header would be ~3.3:1 on the dark card, so the heading colour, as the top bar. */
.topbar .dropdown-menu .dropdown-header,
.export-menu .dropdown-header { color: var(--text-heading); }
.topbar .dropdown-menu .dropdown-divider,
.export-menu .dropdown-divider { border-top-color: var(--border-color); }

/* ── Notification bell + dropdown ──────────────────────────────────────────── */

/* Unread count, pinned to the top-right of the bell icon. */
.notif-badge {
  position: absolute;
  top: -2px; right: -4px;
  min-width: 17px; height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: #dc3545;
  color: #fff;
  font-size: 10px; font-weight: 700; line-height: 17px;
  text-align: center;
}

.notif-menu {
  width: 340px;
  max-width: calc(100vw - 24px);   /* never overflow a narrow screen */
  padding: 0;
  overflow: hidden;
}

.notif-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  color: var(--text-heading);
  background: var(--bg-subtle);
}
.notif-mark-all {
  font-size: 12px;
  text-decoration: none;
  color: var(--accent);
}
.notif-mark-all:hover { text-decoration: underline; }

/* The list scrolls once there are more than a few. */
#notifList { max-height: 380px; overflow-y: auto; }

/* Footer of the bell dropdown — mirrors .notif-header so the panel is bracketed
   the same way top and bottom, in either theme. */
.notif-footer {
  border-top: 1px solid var(--border-color);
  background: var(--bg-subtle);
}
.notif-footer .dropdown-item { color: var(--text-primary); }

.notif-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.15s ease;
}
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--bg-subtle); color: var(--text-primary); }

/* Unread ones get a tinted background and an accent rail so the eye finds them. */
.notif-item.is-unread {
  background: rgba(52,152,219,0.07);
  border-left: 3px solid var(--accent);
  padding-left: 11px;
}
[data-theme="dark"] .notif-item.is-unread { background: rgba(52,152,219,0.13); }

.notif-item .notif-icon { font-size: 1rem; line-height: 1.3; flex-shrink: 0; }
.notif-item .notif-body { min-width: 0; }   /* lets long text wrap, not overflow */
.notif-item .notif-title {
  font-weight: 600; font-size: 13px;
  color: var(--text-heading);
}
.notif-item .notif-text {
  font-size: 12.5px;
  color: var(--text-primary);
  word-break: break-word;
}
.notif-item .notif-time { font-size: 11px; color: var(--text-muted); }

.notif-empty {
  padding: 22px 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── Dark Mode — Bootstrap & component overrides ───────────── */
[data-theme="dark"] .table {
  color: var(--text-primary);
  border-color: var(--border-color);
}
[data-theme="dark"] .table > :not(caption) > * > * {
  background-color: var(--card-bg);
  border-bottom-color: var(--border-color);
  color: var(--text-primary);
}
[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: var(--bg-subtle);
}
[data-theme="dark"] .table-row-low-stock {
  background-color: rgba(231, 76, 60, 0.15) !important;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  background-color: var(--input-bg);
  border-color: var(--input-border);
  color: var(--input-text);
}
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
  background-color: var(--input-bg);
  border-color: var(--accent);
  color: var(--input-text);
  box-shadow: 0 0 0 0.2rem rgba(52,152,219,0.25);
}
/* readonly + bg-light inputs (e.g. Total Price auto-calculated field) */
[data-theme="dark"] .form-control[readonly],
[data-theme="dark"] .form-control.bg-light {
  background-color: var(--bg-subtle) !important;
  color: var(--input-text) !important;
  border-color: var(--input-border);
}
/* Bootstrap bg-light override in dark mode */
[data-theme="dark"] .bg-light {
  background-color: var(--bg-subtle) !important;
}

/* ── Count pill on a filter button (Manage Users status filter) ──────────────
   ⚠ DO NOT USE `bg-light text-dark` HERE. The rule directly above turns Bootstrap's
   .bg-light into a DARK colour in dark mode, so `bg-light text-dark` renders dark text
   on a dark pill and the number vanishes entirely — which is exactly what happened to
   the "14" on the selected Active button. Bootstrap's light utilities are not light in
   this theme; a badge must declare its own colours, per the badge rule in CLAUDE.md.

   Unselected: theme variables, so it follows light and dark automatically.
   Selected: the button underneath is `--accent` blue in BOTH themes, so the pill is
   deliberately theme-independent — solid white with the same blue text. */
.filter-count {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  font-weight: 600;
}
.btn-primary .filter-count {
  background: #ffffff;
  color: #17608f;          /* darkened from --accent for contrast on white */
  border-color: #ffffff;
}

/* ── Per-user permission overrides ───────────────────────────────────────────
   Solid backgrounds dark enough for white text in BOTH themes, declared here rather
   than borrowed from Bootstrap — see the note above about .bg-light. Measured:
   #1d7a4a ≈ 4.9:1 and #a13b2c ≈ 5.6:1 against #ffffff. */
.badge-perm-added {
  background: #1d7a4a;
  color: #ffffff !important;
}
.badge-perm-removed {
  background: #a13b2c;
  color: #ffffff !important;
}
.perm-item {
  padding: 6px 8px 6px 30px;
  border-radius: 6px;
  border: 1px solid transparent;
}
.perm-item:hover { border-color: var(--border-color); }
/* A permission the editing admin does not hold themselves: shown, never editable. */
.perm-locked { opacity: 0.55; }
.perm-locked .form-check-label { cursor: not-allowed; }
/* <label> text does not inherit reliably inside a card in dark mode. */
.perm-item .form-check-label { color: var(--text-primary); }
[data-theme="dark"] .form-control::placeholder { color: var(--text-muted); }
/* Override browser autofill white background in dark mode */
[data-theme="dark"] input:-webkit-autofill,
[data-theme="dark"] input:-webkit-autofill:hover,
[data-theme="dark"] input:-webkit-autofill:focus,
[data-theme="dark"] textarea:-webkit-autofill,
[data-theme="dark"] textarea:-webkit-autofill:hover,
[data-theme="dark"] textarea:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0px 1000px var(--input-bg) inset !important;
  -webkit-text-fill-color: var(--input-text) !important;
  caret-color: var(--input-text);
}
[data-theme="dark"] .form-label { color: var(--text-secondary); }
[data-theme="dark"] .form-text  { color: var(--text-muted); }
[data-theme="dark"] .input-group-text {
  background-color: var(--bg-subtle);
  border-color: var(--input-border);
  color: var(--text-muted);
}

/* ⚠ A SCROLLABLE MODAL WHOSE <form> WRAPS ITS HEADER, BODY AND FOOTER.

   Reported by the client (Sep 2026): on a short screen the Export / Cancel buttons
   of "Export Check Sheet" were unreachable — the modal opened and could not be used.
   Measured at 1366x600 before this rule: the footer sat at 608->672 in a 600px
   viewport, and the body never scrolled despite overflow-y: auto.

   WHY. `.modal-dialog-scrollable` works by clamping `.modal-content` to the viewport
   and letting `.modal-body` scroll inside it. Bootstrap's own rules assume the
   header, body and footer are the DIRECT children of `.modal-content`. Put a <form>
   in between — which three of our modals do, so the whole dialog submits as one form
   — and that form becomes the single flex child: the body never receives a
   constrained height, so it never scrolls, and the footer overflows a box whose
   overflow is hidden. The buttons are not below the fold, they are clipped away.

   THE SHRINK IS THE LOAD-BEARING PART, and there are two ways to get it. A flex
   child defaults to `min-height: auto`, which refuses to shrink below its content,
   so the form stays full height and nothing changes. EITHER `min-height: 0` OR
   `overflow: hidden` resolves that to zero and is sufficient on its own — measured
   both ways. `max-height: 100%` alone is NOT: with only that, the footer went back
   to 608->672 in a 600px viewport and the body stopped scrolling. Both are kept as
   belt-and-braces, and the guard test requires one of the two, not the max-height.

   ⚠ ONE RULE RATHER THAN THREE TEMPLATE EDITS, on purpose: hoisting the <form>
   outside `.modal-dialog` in each file would fix today's three and would have to be
   remembered for every modal written afterwards. Guarded by
   tests/test_modal_footer_reachable.py, which also fails if this shape disappears,
   so the rule gets retired deliberately rather than left as decoration. */
.modal-dialog-scrollable .modal-content > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}
.modal-dialog-scrollable .modal-content > form > .modal-body {
  overflow-y: auto;
  min-height: 0;
}

[data-theme="dark"] .modal-content {
  background-color: var(--modal-bg);
  border-color: var(--border-color);
  color: var(--text-primary);
}
[data-theme="dark"] .modal-header { border-bottom-color: var(--border-color); }
[data-theme="dark"] .modal-footer { border-top-color: var(--border-color); }
[data-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

[data-theme="dark"] .breadcrumb-item + .breadcrumb-item::before { color: var(--text-muted); }

[data-theme="dark"] .btn-secondary {
  background-color: #334155;
  border-color: #475569;
  color: #cbd5e1;
}
[data-theme="dark"] .btn-secondary:hover {
  background-color: #475569;
  border-color: #64748b;
}
[data-theme="dark"] .btn-outline-secondary {
  border-color: var(--border-color);
  color: var(--text-muted);
}
[data-theme="dark"] .btn-outline-secondary:hover {
  background-color: var(--bg-subtle);
  color: var(--text-primary);
}

/* DataTables dark overrides */
[data-theme="dark"] .dataTables_wrapper .dataTables_length select,
[data-theme="dark"] .dataTables_wrapper .dataTables_filter input {
  background-color: var(--input-bg);
  border-color: var(--input-border);
  color: var(--input-text);
  border-radius: 6px;
}
[data-theme="dark"] .dataTables_wrapper .dataTables_info,
[data-theme="dark"] .dataTables_wrapper .dataTables_length,
[data-theme="dark"] .dataTables_wrapper .dataTables_filter {
  color: var(--text-muted);
}
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button {
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
  background: transparent !important;
}
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current,
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #fff !important;
}
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--bg-subtle) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* ── App Footer ────────────────────────────────────────────── */
.app-footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 12px 24px 14px;
  border-top: 1px solid var(--border-subtle);
  opacity: 0.75;
  letter-spacing: 0.2px;
}

/* ── Column Toggle ─────────────────────────────────────────── */
.col-toggle-details summary { cursor: pointer; display: inline-flex; align-items: center; }
.col-toggle-details summary::-webkit-details-marker { display: none; }
.col-toggle-panel {
  background: var(--card-bg) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}
.col-toggle-panel .form-check-label {
  color: var(--text-primary) !important;
}
[data-theme="dark"] .col-toggle-panel {
  background: var(--card-bg) !important;
  border-color: var(--border-color) !important;
}
[data-theme="dark"] .col-toggle-panel .form-check-label {
  color: var(--text-primary) !important;
}
[data-theme="dark"] .col-toggle-panel .form-check-input {
  background-color: var(--bg-subtle);
  border-color: var(--border-color);
}

.asset-clickable-row:hover td { background: rgba(52,152,219,0.05) !important; }

/* ── Category Value in Dashboard ──────────────────────────── */
.category-value { font-size: 11px; }

/* ── Dark Theme Fixes ──────────────────────────────────────── */
/* Force all form-check-labels to be light in dark mode */
[data-theme="dark"] .form-check-label {
  color: var(--text-primary) !important;
}
[data-theme="dark"] .form-check input {
  background-color: var(--bg-subtle);
  border-color: var(--border-color);
}
[data-theme="dark"] .settings-page label,
[data-theme="dark"] .settings-page p,
[data-theme="dark"] .settings-page span,
[data-theme="dark"] .settings-page td,
[data-theme="dark"] .settings-page th {
  color: #ffffff !important;
}
[data-theme="dark"] .modal-body label,
[data-theme="dark"] .modal-body .form-check-label {
  color: #ffffff !important;
}

/* Reports and all cards: form labels */
[data-theme="dark"] .card-body .form-label,
[data-theme="dark"] .card-body label {
  color: var(--text-primary) !important;
}

/* Date inputs: calendar icon and text color */
[data-theme="dark"] input[type="date"] {
  color-scheme: dark;
  color: var(--text-primary) !important;
}

/* Dashboard: category counts and RM values */
[data-theme="dark"] .category-count {
  color: var(--text-primary) !important;
}
[data-theme="dark"] .category-value {
  color: var(--text-secondary) !important;
}

/* Dashboard: category breakdown item text */
[data-theme="dark"] .category-breakdown-item .text-muted,
[data-theme="dark"] .category-breakdown-item small {
  color: var(--text-secondary) !important;
}

/* Override Bootstrap text-muted to use theme variable in dark mode */
[data-theme="dark"] .text-muted {
  color: var(--text-muted) !important;
}

/* List-group items */
[data-theme="dark"] .list-group-item {
  background-color: var(--card-bg);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

/* Card headers text */
[data-theme="dark"] .card-header {
  color: var(--text-primary);
  background-color: var(--card-bg);
  border-bottom-color: var(--border-color);
}
[data-theme="dark"] .card-header .card-title,
[data-theme="dark"] .card-header h6 {
  color: var(--text-heading) !important;
}

/* Small text in cards */
[data-theme="dark"] .card small {
  color: var(--text-secondary) !important;
}

/* ── Inactive User Row ─────────────────────────────────────── */
.user-row-inactive td {
  color: #999999 !important;
  background-color: #f5f5f5 !important;
  opacity: 0.75;
}
[data-theme="dark"] .user-row-inactive td {
  color: #666666 !important;
  background-color: #2a2a2a !important;
  opacity: 0.75;
}
.user-row-inactive .user-avatar-sm {
  opacity: 0.5;
}

/* ── Read-Only View Field ───────────────────────────────────── */
.view-field {
  padding: 0.5rem 0.75rem;
  background: var(--input-bg, #f8f9fa);
  border: 1px solid var(--border-color, #dee2e6);
  border-radius: 0.375rem;
  min-height: 2.375rem;
  color: var(--text-primary, #212529);
  font-size: 0.9rem;
  word-break: break-word;
}
[data-theme="dark"] .view-field {
  background: #1e1e2e;
  border-color: #3a3a4a;
  color: #e0e0e0;
}

/* ══════════════════════════════════════════════════════════════
   Item Detail Modal
   ══════════════════════════════════════════════════════════════ */
.item-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 9000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.22s ease;
  backdrop-filter: blur(3px);
}
.item-modal-overlay.visible {
  opacity: 1;
}
.item-modal-container {
  background: var(--card-bg);
  border-radius: 14px;
  width: 85vw;
  height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  transform: scale(0.95) translateY(12px);
  transition: transform 0.22s ease, opacity 0.22s ease;
}
.item-modal-overlay.visible .item-modal-container {
  transform: scale(1) translateY(0);
}
.item-modal-box {
  background: var(--card-bg);
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.45);
  transform: scale(0.95) translateY(12px);
  transition: transform 0.22s ease;
  overflow-y: auto;
  color: var(--text-primary);
}
.item-modal-overlay.visible .item-modal-box {
  transform: scale(1) translateY(0);
}
.item-modal-box .card {
  background: var(--card-bg);
  border-color: var(--border-color);
  color: var(--text-primary);
}
.item-modal-box .card-body {
  background: var(--card-bg);
  color: var(--text-primary);
}
.item-modal-box .text-muted {
  color: var(--text-muted) !important;
}
.item-modal-box h5,
.item-modal-box h6 {
  color: var(--text-heading);
}
.item-modal-box small {
  color: var(--text-muted);
}
.item-modal-box .fw-medium,
.item-modal-box .fw-bold,
.item-modal-box .fw-semibold {
  color: var(--text-primary);
}

/* Header */
.item-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  gap: 12px;
}
.item-modal-title-area {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.item-modal-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.3;
  word-break: break-word;
}
.item-modal-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.item-modal-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.item-modal-close-btn:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

/* Body */
.item-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px 26px 28px;
}
.item-modal-body::-webkit-scrollbar { width: 6px; }
.item-modal-body::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

/* Sections */
.modal-section { margin-bottom: 26px; }
.modal-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--accent);
  margin-bottom: 12px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
}

/* Field grid */
.modal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
/* A set's parts (window.renderPartsSection) take the full width of a pop-up section —
   the research pop-up's sections are this two-column grid. */
.parts-section {
  grid-column: 1 / -1;
}
@media (max-width: 576px) {
  .modal-grid { grid-template-columns: 1fr; }
  .item-modal-container { width: 97vw; height: 92vh; border-radius: 10px; }
}
.modal-field {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 7px;
  padding: 10px 13px;
}
.modal-field-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.modal-field-value {
  font-size: 0.93rem;
  color: var(--text-primary);
  font-weight: 500;
  word-break: break-word;
}
.modal-field-value a { color: var(--accent); text-decoration: none; }
.modal-field-value a:hover { text-decoration: underline; }

/* Stock progress bar */
.modal-stock-bar {
  height: 10px;
  border-radius: 5px;
  background: var(--border-color);
  overflow: hidden;
  margin-top: 6px;
}
.modal-stock-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.5s ease;
}

/* Photo */
.modal-photo-container { text-align: center; }
.modal-photo {
  max-height: 300px;
  max-width: 100%;
  border-radius: 10px;
  cursor: zoom-in;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.modal-photo:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.modal-photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 160px;
  background: var(--bg-subtle);
  border: 2px dashed var(--border-color);
  border-radius: 10px;
  color: var(--text-muted);
  gap: 10px;
}

/* Activity Log Timeline */
.activity-timeline { list-style: none; padding: 0; margin: 0; }
.activity-entry {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
}
.activity-entry:nth-child(odd) { background: var(--bg-subtle); }
.activity-entry-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.9rem;
}
.activity-entry-icon.ic-created      { background: rgba(39,174,96,0.15);  color: #27ae60; }
.activity-entry-icon.ic-modified     { background: rgba(52,152,219,0.15); color: #3498db; }
.activity-entry-icon.ic-deleted      { background: rgba(231,76,60,0.15);  color: #e74c3c; }
.activity-entry-icon.ic-photo        { background: rgba(155,89,182,0.15); color: #9b59b6; }
.activity-entry-content { flex: 1; min-width: 0; }
.activity-entry-desc {
  font-size: 0.875rem;
  color: var(--text-primary);
  font-weight: 500;
  word-break: break-word;
}
.activity-entry-meta {
  font-size: 0.77rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ══════════════════════════════════════════════════════════════
   Photo Lightbox
   ══════════════════════════════════════════════════════════════ */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.93);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.lightbox-overlay.visible { opacity: 1; }
.lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.8);
  cursor: default;
}
.lightbox-close-btn {
  position: fixed;
  top: 18px;
  right: 18px;
  background: rgba(255, 255, 255, 0.18);
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  font-size: 1.2rem;
  transition: background 0.15s;
  z-index: 10001;
}
.lightbox-close-btn:hover { background: rgba(255, 255, 255, 0.32); }


/* ── Dark theme: Custom Fields / Settings page text fix ─── */
[data-theme='dark'] .settings-page label,
[data-theme='dark'] .settings-page .form-check-label,
[data-theme='dark'] .settings-page .form-label,
[data-theme='dark'] .settings-page .card-body,
[data-theme='dark'] .settings-page .card-text,
[data-theme='dark'] .custom-fields-page label,
[data-theme='dark'] .custom-fields-page .form-check-label,
[data-theme='dark'] .custom-fields-page .form-label,
[data-theme='dark'] .custom-fields-page .assigned-category,
[data-theme='dark'] .custom-fields-page small,
[data-theme='dark'] .custom-fields-page .text-muted {
  color: #e9ecef !important;
}
[data-theme='dark'] .custom-fields-page .badge.bg-light,
[data-theme='dark'] .settings-page .badge.bg-light {
  background-color: #3a3f4a !important;
  color: #e9ecef !important;
}

/* ── Sticky / Frozen Table Header (legacy .table-container) ── */
.table-container {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 70vh;
}
.table-container thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: var(--bg-subtle);
}
[data-theme="dark"] .table-container thead th {
  background-color: var(--card-bg);
}

/* ── Sticky / Frozen Table Header (.table-scroll-container) ── */
.table-scroll-container {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 280px);
  position: relative;
  border: 1px solid #dee2e6;
  border-radius: 4px;
}
.table-scroll-container thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 100 !important;
  background-color: #f8f9fa !important;
  border-bottom: 2px solid #dee2e6 !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}
[data-theme="dark"] .table-scroll-container thead th {
  background-color: #1a2332 !important;
  border-bottom-color: #4a5568 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3) !important;
}
[data-theme="dark"] .table-scroll-container {
  border-color: #4a5568 !important;
}

/* Allow two-line wrapping in th cells */
.table th.wrap-header {
  white-space: normal;
  line-height: 1.3;
}

/* ── DataTables Controls Spacing ──────────────────────────── */
.dataTables_length {
  margin-left: 16px !important;
  margin-top: 12px !important;
  margin-bottom: 8px !important;
}
.dataTables_filter {
  margin-right: 16px !important;
  margin-top: 12px !important;
  margin-bottom: 8px !important;
}
.dataTables_wrapper .row:first-child {
  padding: 8px 16px !important;
}
.dataTables_wrapper .dataTables_scroll {
  margin-top: 8px !important;
}
table.dataTable {
  margin-top: 8px !important;
}

/* ── Clear (X) Button and Search Icon for Search Inputs ─── */
.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.search-icon {
    position: absolute;
    right: 8px !important;
    left: auto !important;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
    font-size: 14px;
    pointer-events: none;
    z-index: 5;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-icon.hidden {
    display: none !important;
}

[data-theme="dark"] .search-icon {
    color: #aaa !important;
}

.search-wrapper input,
.search-wrapper .form-control {
    padding-left: 12px !important;
    padding-right: 32px !important;
    width: 100%;
}

.clear-btn {
    position: absolute;
    right: 8px !important;
    top: 50%;
    transform: translateY(-50%);
    background-color: #fff !important;
    color: #64748b !important;
    border: none !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    font-weight: bold !important;
    width: 18px !important;
    height: 18px !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    line-height: 1 !important;
    z-index: 10 !important;
}

.clear-btn:hover {
    background-color: #b0c4d8 !important;
    color: #2c4a6e !important;
    cursor: pointer !important;
}

.clear-btn.visible {
    display: flex !important;
}

/* Dark theme clear button */
[data-theme="dark"] .clear-btn {
    background-color: #162032 !important;
    color: #a8c4e0 !important;
}

[data-theme="dark"] .clear-btn:hover {
    background-color: #3a6090 !important;
    color: #ffffff !important;
    cursor: pointer !important;
}

/* Ensure cursor is pointer on hover */
.clear-btn,
.clear-btn * {
    cursor: pointer !important;
}

/* ── Sticky Table Controls (Show Entries + Quick Search) ──── */
.sticky-table-controls {
  position: sticky;
  top: var(--topbar-h);
  z-index: 200;
  background-color: #ffffff;
  padding-top: 6px !important;
  padding-bottom: 6px !important;
  padding-left: 16px !important;
  padding-right: 16px !important;
  border-bottom: 1px solid #dee2e6;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}
[data-theme="dark"] .sticky-table-controls {
  background-color: #1a2332 !important;
  border-bottom-color: #4a5568 !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3) !important;
}
.table-controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.sticky-table-controls .quick-search-wrapper {
  flex: 1;
  max-width: 300px;
  position: relative;
}
.show-entries-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: inherit;
  white-space: nowrap;
}
[data-theme="dark"] .show-entries-wrapper { color: #ffffff !important; }
.show-entries-wrapper select {
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #ced4da;
  font-size: 14px;
}
[data-theme="dark"] .show-entries-wrapper select {
  background-color: #2c3e50 !important;
  color: #ffffff !important;
  border-color: #4a5568 !important;
}

/* ── Dark Theme: Custom Fields / form-check labels ────────── */
[data-theme="dark"] .form-check-label { color: #ffffff !important; }
[data-theme="dark"] .form-check-input ~ label { color: #ffffff !important; }
[data-theme="dark"] input[type="checkbox"] + label { color: #ffffff !important; }
[data-theme="dark"] .dark-compatible-label { color: #ffffff !important; }
[data-theme="dark"] .dark-text { color: #ffffff !important; }

/* Target bg-light badges in dark mode (e.g., Custom Fields Assigned Categories) */
[data-theme="dark"] .table td .badge.bg-light,
[data-theme="dark"] .card .badge.bg-light {
  background-color: #3a4a5c !important;
  color: #ffffff !important;
  border-color: #4a5568 !important;
}

/* ── Topbar center slot for Feedback button ─────────────── */
.topbar-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
}

/* ── Feedback Button ─────────────────────────────────────── */
.feedback-btn {
  background: linear-gradient(135deg, #f093fb, #f5576c);
  color: white !important;
  border: none;
  border-radius: 20px;
  padding: 6px 16px;
  font-weight: bold;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(240, 147, 251, 0.4);
  transition: all 0.2s ease;
  animation: feedbackPulse 2s infinite;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.feedback-btn:hover {
  filter: brightness(1.15);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(240, 147, 251, 0.6);
  color: white !important;
}
@keyframes feedbackPulse {
  0%   { box-shadow: 0 2px 8px rgba(240,147,251,0.4); }
  50%  { box-shadow: 0 2px 16px rgba(240,147,251,0.7); }
  100% { box-shadow: 0 2px 8px rgba(240,147,251,0.4); }
}
.feedback-badge {
  /* A translucent DARK chip, not a white one. The button behind it is a light
     pink gradient, so a 30%-white overlay lightened it further and left white
     text at ~1.7:1 — effectively unreadable. Darkening instead keeps the same
     translucent look and reaches ~5:1. */
  background: rgba(0,0,0,0.40);
  color: white;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: bold;
}

/* ── Table Bottom Controls ───────────────────────────────── */
.table-bottom-controls {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding-left: 16px !important;
  padding-right: 16px !important;
  padding-top: 8px !important;
  padding-bottom: 8px !important;
  border-top: 1px solid #dee2e6 !important;
  margin-top: 0;
}
[data-theme="dark"] .table-bottom-controls {
  border-top-color: #4a5568 !important;
  color: #ffffff !important;
}
.table-bottom-controls .pagination {
  margin: 0;
}

/* ── Pagination in dark mode (shared macro: templates/_pagination.html) ──────
   The app switches themes with its own data-theme attribute and never sets
   Bootstrap's data-bs-theme, so Bootstrap's .page-link and .card-footer keep
   their LIGHT defaults in dark mode — a row of white pills on a dark card.
   These rules target the pager elements themselves rather than using a blanket
   descendant selector, which is what broke the SDS badges (see CLAUDE.md). */
[data-theme="dark"] .card-footer {
  background-color: transparent;
  border-top-color: var(--border-color);
}
[data-theme="dark"] .pagination .page-link {
  background-color: var(--input-bg);
  border-color: var(--border-color);
  color: var(--text-primary);
}
[data-theme="dark"] .pagination .page-link:hover {
  background-color: var(--card-bg);
  border-color: var(--accent);
  color: var(--text-heading);
}
[data-theme="dark"] .pagination .page-item.active .page-link {
  background-color: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}
[data-theme="dark"] .pagination .page-item.disabled .page-link {
  background-color: transparent;
  border-color: var(--border-color);
  color: var(--text-muted);
}
.table-bottom-controls .showing-text {
  font-size: 14px;
  color: #6c757d;
}
[data-theme="dark"] .table-bottom-controls .showing-text {
  color: #a0aec0 !important;
}
.table-bottom-controls .pagination-wrapper {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Date & Time column ──────────────────────────────────── */
th.date-time-col {
  min-width: 140px;
  white-space: nowrap;
}

/* ── Feedback Page Styles ────────────────────────────────── */
.feedback-subtitle {
  font-style: italic;
  color: #6c757d;
  font-size: 0.875rem;
  margin-bottom: 1rem;
  text-align: center;
}
[data-theme="dark"] .feedback-subtitle {
  color: #a0aec0;
}
.priority-critical { border-left: 4px solid #dc3545 !important; }
.feedback-row-done { background-color: rgba(25, 135, 84, 0.06) !important; }
[data-theme="dark"] .feedback-row-done { background-color: rgba(25, 135, 84, 0.12) !important; }

/* ── Column Drag & Drop (Arrange Mode) ───────────────────── */
.draggable-header {
  cursor: grab !important;
  outline: 2px dashed #3498db !important;
  outline-offset: -2px !important;
  user-select: none !important;
  position: relative !important;
}
.draggable-header::before {
  content: '⠿ ';
  color: #3498db;
  font-size: 12px;
}
.drag-source {
  opacity: 0.5 !important;
  background-color: rgba(52, 152, 219, 0.2) !important;
}
.drag-over {
  background-color: rgba(52, 152, 219, 0.3) !important;
  outline: 2px solid #3498db !important;
}
[data-theme="dark"] .draggable-header {
  outline-color: #5dade2 !important;
}
[data-theme="dark"] .draggable-header::before {
  color: #5dade2 !important;
}

/* ── Custom pagination buttons ───────────────────────────── */
.page-btn {
  background: none;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 4px 10px;
  margin: 0 2px;
  cursor: pointer;
  font-size: 14px;
  color: inherit;
  transition: all 0.15s ease;
}
.page-btn:hover:not(.disabled):not(.active) {
  background-color: #e9ecef;
}
.page-btn.active {
  background-color: #3498db;
  border-color: #3498db;
  color: white;
}
.page-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
[data-theme="dark"] .page-btn {
  border-color: #4a5568 !important;
  color: #ffffff !important;
}
[data-theme="dark"] .page-btn:hover:not(.disabled):not(.active) {
  background-color: #2c3e50 !important;
}

/* ── SDS Registry ────────────────────────────────────────────── */
.ghs-pictogram {
  width: 40px;
  height: 40px;
  margin: 2px;
  display: inline-block;
}
.ghs-pictogram-large {
  width: 60px;
  height: 60px;
  margin: 4px;
}
.ghs-pictogram-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.compliance-current {
  color: #27ae60;
  font-weight: 500;
}
.compliance-expiring {
  color: #b7860b !important;
  font-weight: 500;
}
.compliance-expired {
  color: #dc3545 !important;
  font-weight: bold !important;
}

[data-theme="dark"] .compliance-current { color: #2ecc71 !important; }
[data-theme="dark"] .compliance-expiring { color: #f0c040 !important; }
[data-theme="dark"] .compliance-expired { color: #ff6b6b !important; font-weight: bold !important; }
.compliance-expired-row {
  background-color: rgba(220, 53, 69, 0.08) !important;
}
.compliance-expiring-row {
  background-color: rgba(253, 126, 20, 0.08) !important;
}

@keyframes expiredPulse {
  0%   { border-color: #dc3545; }
  50%  { border-color: #ff6b6b; box-shadow: 0 0 10px rgba(220,53,69,0.4); }
  100% { border-color: #dc3545; }
}

/* ── Maintenance & Breakdown ──────────────────────────────────── */

/* Maintenance type badges */
.badge-maint-pm  { background:#0d6efd; color:#fff; }
.badge-maint-cal { background:#6f42c1; color:#fff; }
.badge-maint-rep { background:#dc3545; color:#fff; }
.badge-maint-dia { background:#c05802; color:#fff; }
.badge-maint-par { background:#ffc107; color:#000; }
.badge-maint-val { background:#158564; color:#fff; }
.badge-maint-cln { background:#6c757d; color:#fff; }
.badge-maint-upg { background:#6610f2; color:#fff; }
.badge-maint-ins { background:#198754; color:#fff; }
/* CF Renewal / DOSH License — previously had no class of its own and silently fell
   back to the General-Inspection green, which read as the wrong type. */
.badge-maint-cf  { background:#d63384; color:#fff; }

/* Breakdown status badges */
.badge-bd-reported      { background:#dc3545; color:#fff; }
.badge-bd-investigating { background:#c05802; color:#fff; }
.badge-bd-po-sent       { background:#0d6efd; color:#fff; }
.badge-bd-repair        { background:#6f42c1; color:#fff; }
.badge-bd-resolved      { background:#158564; color:#fff; }
.badge-bd-closed        { background:#6c757d; color:#fff; }

/* Status timeline */
.status-timeline {
  position: relative;
  padding-left: 24px;
}
.status-timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-color);
}
.timeline-entry {
  position: relative;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--bg-subtle);
  border-radius: 8px;
  border-left: 3px solid var(--border-color);
}
.timeline-entry::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 16px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--card-bg);
}
.timeline-entry.status-reported      { border-left-color: #dc3545; }
.timeline-entry.status-investigating { border-left-color: #fd7e14; }
.timeline-entry.status-po-sent       { border-left-color: #0d6efd; }
.timeline-entry.status-repair        { border-left-color: #6f42c1; }
.timeline-entry.status-resolved      { border-left-color: #20c997; }
.timeline-entry.status-closed        { border-left-color: #6c757d; }

/* Maintenance record cards */
.maintenance-record-card {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
  background: var(--bg-subtle);
}
.maintenance-record-card:hover {
  border-color: var(--accent);
}

/* Equipment search results */
.equipment-search-results {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
}
.equipment-search-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.1s;
  color: var(--text-primary);
}
.equipment-search-item:hover { background: var(--sidebar-hover); }
.equipment-search-item:last-child { border-bottom: none; }

[data-theme="dark"] .maintenance-record-card {
  background: var(--bg-subtle) !important;
  border-color: var(--border-color) !important;
}
[data-theme="dark"] .timeline-entry {
  background: var(--bg-subtle) !important;
}
[data-theme="dark"] .equipment-search-results {
  background: var(--card-bg) !important;
  border-color: var(--border-color) !important;
}
[data-theme="dark"] .equipment-search-item {
  color: var(--text-primary) !important;
}
[data-theme="dark"] .equipment-search-item:hover {
  background: var(--sidebar-hover) !important;
}
.expired-card {
  border: 2px solid #dc3545;
  animation: expiredPulse 2s infinite;
}

/* Expired chemical expiry date styling */
.expiry-expired {
  color: #dc3545 !important;
  font-weight: bold !important;
}
/* In dark mode, `[data-theme="dark"] .card small` (specificity 0,2,1) would
   otherwise beat `.expiry-expired` (0,1,0) and force the expired date grey.
   Match the same/greater specificity with a brighter red for dark backgrounds. */
[data-theme="dark"] .expiry-expired,
[data-theme="dark"] .card small.expiry-expired,
[data-theme="dark"] .view-field.expiry-expired {
  color: #ff6b6b !important;
}

/* Language badges for SDS */
.lang-badge-en {
  background-color: #0d6efd;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: bold;
}
.lang-badge-bm {
  background-color: #198754;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: bold;
}
.lang-badge-both {
  background-color: #6f42c1;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: bold;
}

.sds-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000;
  max-height: 300px;
  overflow-y: auto;
}
[data-theme="dark"] .sds-dropdown {
  background: #2c3e50 !important;
  border-color: #4a5568 !important;
  color: #ffffff !important;
}
.sds-dropdown-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
}
.sds-dropdown-item:hover {
  background-color: #f8f9fa;
}
[data-theme="dark"] .sds-dropdown-item:hover {
  background-color: #3a4a5c !important;
}
[data-theme="dark"] .sds-dropdown-item {
  border-bottom-color: #3a4a5c !important;
}

@media print {
  body * { visibility: hidden; }
  .qr-print-area, .qr-print-area * { visibility: visible; }
  .qr-print-area {
    position: fixed;
    top: 0; left: 0;
    width: 50mm;
    padding: 5mm;
    text-align: center;
  }
}

/* ── SDS Registry Page Color Fixes ──────────────────────────── */
.sds-registry-page .table td {
  color: #2c3e50 !important;
}
/* Page-level default only — deliberately NOT `.sds-registry-page *`. A blanket `*`
   here outranks each badge's own colour rule and repainted every badge the muted
   body colour (bug report #3). Descendants inherit this, and the specific rules
   below cover the cells; a badge that sets its own colour is left alone. */
[data-theme="dark"] .sds-registry-page {
  color: var(--text-primary) !important;
}
[data-theme="dark"] .sds-registry-page .table th {
  color: #cbd5e1 !important;
}
[data-theme="dark"] .sds-registry-page .table td {
  color: var(--text-primary) !important;
}

/* ── Compliance Report Page Color Fixes ──────────────────────── */
.compliance-report-page .table td {
  color: #2c3e50 !important;
}
[data-theme="dark"] .compliance-report-page,
[data-theme="dark"] .compliance-report-page .table th,
[data-theme="dark"] .compliance-report-page .table td,
[data-theme="dark"] .compliance-report-page label,
[data-theme="dark"] .compliance-report-page .form-label,
[data-theme="dark"] .compliance-report-page .card-body {
  color: var(--text-primary) !important;
}

/* ── Compliance Status Badge Colors ──────────────────────────── */
.sds-missing-icon,
.compliance-missing,
.badge-missing-sds,
.missing-sds-indicator {
  color: #e67e22 !important;
}
[data-theme="dark"] .sds-missing-icon,
[data-theme="dark"] .compliance-missing,
[data-theme="dark"] .badge-missing-sds,
[data-theme="dark"] .missing-sds-indicator {
  color: #e67e22 !important;
}

.badge-expiring-sds,
.compliance-badge-expiring {
  background-color: #b45f14 !important;
  color: #ffffff !important;
}
[data-theme="dark"] .badge-expiring-sds,
[data-theme="dark"] .compliance-badge-expiring {
  background-color: #b45f14 !important;
  color: #ffffff !important;
}

.badge-missing-sds,
.compliance-badge-missing {
  background-color: #e20a6e !important;
  color: #ffffff !important;
}
[data-theme="dark"] .badge-missing-sds,
[data-theme="dark"] .compliance-badge-missing {
  background-color: #e20a6e !important;
  color: #ffffff !important;
}

/* ── Quick Filter Buttons — outline by default, filled when active ── */
.quick-filter-btn {
  background-color: transparent !important;
  border: 2px solid currentColor !important;
}
.quick-filter-btn-all {
  background-color: transparent !important;
  color: #6c757d !important;
  border: 2px solid #6c757d !important;
}
.quick-filter-btn-all:hover,
.quick-filter-btn-all.active {
  background-color: #6c757d !important;
  color: #ffffff !important;
}
.quick-filter-btn-current {
  background-color: transparent !important;
  color: #27ae60 !important;
  border: 2px solid #27ae60 !important;
}
.quick-filter-btn-current:hover,
.quick-filter-btn-current.active {
  background-color: #1d8549 !important;
  color: #ffffff !important;
}
.quick-filter-btn-expired {
  background-color: transparent !important;
  color: #dc3545 !important;
  border: 2px solid #dc3545 !important;
}
.quick-filter-btn-expired:hover,
.quick-filter-btn-expired.active {
  background-color: #dc3545 !important;
  color: #ffffff !important;
}
.quick-filter-btn-missing {
  background-color: transparent !important;
  color: #F73D93 !important;
  border: 2px solid #F73D93 !important;
}
.quick-filter-btn-missing:hover {
  background-color: rgba(230, 126, 34, 0.1) !important;
}
.quick-filter-btn-missing.active {
  background-color: #e20a6e !important;
  color: #ffffff !important;
}
.quick-filter-btn-expiring {
  background-color: transparent !important;
  color: #cf6100 !important;
  border: 2px solid #cf6100 !important;
}
.quick-filter-btn-expiring:hover {
  background-color: rgba(183, 134, 11, 0.1) !important;
}
.quick-filter-btn-expiring.active {
  background-color: #b45f14 !important;
  color: #ffffff !important;
}
[data-theme="dark"] .quick-filter-btn-expiring {
  color: #e67e22 !important;
  border-color: #e67e22 !important;
}
[data-theme="dark"] .quick-filter-btn-expiring:hover {
  background-color: rgba(240, 192, 64, 0.1) !important;
}
[data-theme="dark"] .quick-filter-btn-expiring.active {
  background-color: #b45f14 !important;
  color: #ffffff !important;
}

/* ── Language Badges ──────────────────────────────────────────── */
.lang-badge-other {
  background-color: #6c757d;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: bold;
}

/* The language badges above set `color: white` with no !important, which loses to
   the page-wide dark rule `[data-theme="dark"] .sds-registry-page *` on specificity
   (0,2,0 beats 0,1,0) regardless of order — so in dark mode they rendered the muted
   body colour on a solid background. These re-assert white at matching specificity.
   The other SDS badges already carry their own !important dark-mode rules. */
[data-theme="dark"] .lang-badge-en,
[data-theme="dark"] .lang-badge-bm,
[data-theme="dark"] .lang-badge-both,
[data-theme="dark"] .lang-badge-other {
  color: #ffffff !important;
}

/* ── "Close Case" on the Breakdown pages ──────────────────────────
   These three buttons used Bootstrap's .btn-outline-dark / .btn-dark, which is
   a near-black outline with near-black text. On the dark theme's #1e293b card
   that measured 1.05:1 for BOTH the text and the border — the button was
   rendered, took up space, and was invisible (client, Sep 2026).

   Green rather than merely lighter, because it also says the right thing:
   closing a case is the completing action, and it sits beside a red Delete.

   Light mode keeps Bootstrap's own .btn-outline-success (#198754 on white,
   4.53:1). Only dark needs overriding, and #2ecc71 on #1e293b measures 6.96:1.

   ⚠ SCOPED TO ITS OWN CLASS, NOT TO .btn-outline-success, which is used on 25
   buttons across 14 templates. Brightening all of them may well be an
   improvement, but it is a different change from the one that was asked for. */
/* Light: Bootstrap's own .btn-outline-success is #198754, which measures 4.53:1
   on white - it clears AA by 0.03, which is not headroom. #157347 (Bootstrap's
   own success-hover shade) measures 5.88:1 and is still plainly green. */
.btn-close-case {
  color: #157347;
  border-color: #157347;
}
.btn-close-case:hover,
.btn-close-case:focus,
.btn-close-case:active {
  background-color: #157347;
  border-color: #157347;
  color: #ffffff;
}
[data-theme="dark"] .btn-close-case {
  color: #2ecc71;
  border-color: #2ecc71;
}
[data-theme="dark"] .btn-close-case:hover,
[data-theme="dark"] .btn-close-case:focus,
[data-theme="dark"] .btn-close-case:active {
  background-color: #2ecc71;
  border-color: #2ecc71;
  color: #0f172a;
}

/* ── Dark Theme Alert Secondary ───────────────────────────────────
   Bootstrap's .alert-secondary is a LIGHT grey panel (#e2e3e5 on #41464b), so
   in dark mode it renders as a bright block with dark text - legible, but it
   reads as a light-theme element dropped onto a dark page. Restyled the same
   way .alert-warning below is: a translucent tint of the theme's own muted
   colour, with `strong` and `.alert-link` re-stated because Bootstrap does not
   pass a colour down to either reliably.

   Used by the "Booking Switched Off" banner, which is deliberately grey rather
   than amber: an instrument taken out of the booking system is a statement of
   fact, not a warning about something going wrong. */
[data-theme="dark"] .alert-secondary {
  background-color: rgba(148, 163, 184, 0.15) !important;
  border-color: rgba(148, 163, 184, 0.40) !important;
  color: var(--text-primary) !important;
}
[data-theme="dark"] .alert-secondary strong {
  color: var(--text-primary) !important;
}
[data-theme="dark"] .alert-secondary .alert-link {
  color: var(--text-primary) !important;
  text-decoration: underline;
}

/* ── Dark Theme Alert Warning ─────────────────────────────────── */
[data-theme="dark"] .alert-warning {
  background-color: rgba(243, 156, 18, 0.15) !important;
  border-color: rgba(243, 156, 18, 0.4) !important;
  color: #f39c12 !important;
}
[data-theme="dark"] .alert-warning strong {
  color: #f39c12 !important;
}
/* ⚠ A LINK INSIDE THE ALERT NEEDS THE SAME TREATMENT AS `strong` ABOVE.
   Bootstrap's `.alert-link` keeps its light-theme amber (#664d03), which against
   this rule's dark background measures 1.75:1 - the text is legible and the link
   inside it is not. Measured in a real browser on the "Booking Switched Off"
   banner, the first .alert-warning in the app to carry a link. Underlined as
   well as recoloured, so the link is still identifiable as one when it is the
   same colour as the surrounding sentence. */
/* WARNING: DELIBERATELY BRIGHTER THAN THE SENTENCE AROUND IT.
   It was #f39c12 - the same amber as the alert's own body text - which measured
   6.36:1 against the background and therefore PASSED AA, while still reading
   badly: a link the same colour as the words either side of it does not announce
   itself as the thing to click, and the client reported exactly that (Sep 2026).
   The number described the wrong pair. #ffd8a8 measures 10.4:1 against the dark
   alert and is plainly lighter than the #f39c12 body, so the link separates from
   its sentence as well as from its background. The underline stays: colour alone
   must never be the only signal (WCAG 1.4.1). */
[data-theme="dark"] .alert-warning .alert-link {
  color: #ffd8a8 !important;
  text-decoration: underline;
}
[data-theme="dark"] .alert-warning .btn-warning {
  background-color: #f39c12 !important;
  border-color: #e67e22 !important;
  color: #000000 !important;
}

/* ── Compliance Badge Filled Backgrounds ──────────────────────── */
.compliance-badge-current,
.badge-current-sds,
td.compliance-current-cell,
.compliance-current-bg {
  background-color: #1d8549 !important;
  color: #ffffff !important;
  border-radius: 4px;
  padding: 2px 8px;
  display: inline-block;
}
[data-theme="dark"] .compliance-badge-current,
[data-theme="dark"] .badge-current-sds,
[data-theme="dark"] td.compliance-current-cell,
[data-theme="dark"] .compliance-current-bg {
  background-color: #1d8549 !important;
  color: #ffffff !important;
}

.compliance-badge-expiring,
.badge-expiring-sds,
.sds-expiring-badge,
td.compliance-expiring-cell,
.compliance-expiring-bg {
  background-color: #b45f14 !important;
  color: #ffffff !important;
  border-radius: 4px;
  padding: 2px 8px;
  display: inline-block;
}
[data-theme="dark"] .compliance-badge-expiring,
[data-theme="dark"] .badge-expiring-sds,
[data-theme="dark"] td.compliance-expiring-cell,
[data-theme="dark"] .compliance-expiring-bg {
  background-color: #b45f14 !important;
  color: #ffffff !important;
}

.compliance-badge-missing,
.badge-missing-sds,
td.compliance-missing-cell,
.compliance-missing-bg {
  background-color: #e20a6e !important;
  color: #ffffff !important;
  border-radius: 4px;
  padding: 2px 8px;
  display: inline-block;
}
[data-theme="dark"] .compliance-badge-missing,
[data-theme="dark"] .badge-missing-sds,
[data-theme="dark"] td.compliance-missing-cell,
[data-theme="dark"] .compliance-missing-bg {
  background-color: #e20a6e !important;
  color: #ffffff !important;
}

.compliance-badge-expired,
.badge-expired-sds,
td.compliance-expired-cell,
.compliance-expired-bg {
  background-color: #dc3545 !important;
  color: #ffffff !important;
  border-radius: 4px;
  padding: 2px 8px;
  display: inline-block;
  font-weight: bold !important;
}
[data-theme="dark"] .compliance-badge-expired,
[data-theme="dark"] .badge-expired-sds,
[data-theme="dark"] td.compliance-expired-cell,
[data-theme="dark"] .compliance-expired-bg {
  background-color: #dc3545 !important;
  color: #ffffff !important;
}

.compliance-badge-expiring *,
.compliance-badge-missing *,
.compliance-badge-expired *,
.compliance-badge-current * {
  color: #ffffff !important;
}

/* ── Row backgrounds for compliance status ─────────────────────── */
tr.row-expiring {
  background-color: rgba(255, 120, 0, 0.08) !important;
}
tr.row-expired {
  background-color: rgba(220, 53, 69, 0.08) !important;
}
tr.row-missing {
  background-color: rgba(255, 120, 0, 0.08) !important;
}
[data-theme="dark"] tr.row-expiring {
  background-color: rgba(255, 120, 0, 0.15) !important;
}
[data-theme="dark"] tr.row-expired {
  background-color: rgba(220, 53, 69, 0.15) !important;
}
[data-theme="dark"] tr.row-missing {
  background-color: rgba(255, 120, 0, 0.15) !important;
}

/* ── Update 1: Alert Warning Icon Color ───────────────────────── */
.alert-warning .bi-exclamation-triangle,
.alert-warning i.bi-exclamation-triangle,
.sds-warning-alert .bi-exclamation-triangle {
  color: #f39c12 !important;
}
[data-theme="dark"] .alert-warning .bi-exclamation-triangle,
[data-theme="dark"] .sds-warning-alert .bi-exclamation-triangle {
  color: #f39c12 !important;
}

/* ── Update 2: Page Title / Subtitle Dark Theme ───────────────── */
[data-theme="dark"] .page-title {
  color: #ffffff !important;
}
[data-theme="dark"] .page-subtitle {
  color: #cbd5e1 !important;
}

/* ── Update 2C: Summary Card All Text White ───────────────────── */
.summary-card .summary-value,
.summary-card .summary-label,
.summary-card * {
  color: #ffffff !important;
}
.summary-icon,
.summary-icon * {
  color: #ffffff !important;
}
[data-theme="dark"] .summary-card,
[data-theme="dark"] .summary-card * {
  color: #ffffff !important;
}

/* ── Update 2D: SDS Registry Page General Dark Theme Overrides ── */
/* NOTE: there is deliberately NO `.card-body *` selector here. It used to be, and
   because it is more specific (0,3,0) than the badge rules (0,2,0) it beat them no
   matter what order they appeared in — repainting every SDS badge the muted body
   colour instead of white, which is what the "white font" bug report was about.
   It also silently defeated the careful :not() list on the `span` line below.
   The specific element selectors that follow cover the same text, and anything
   nested inside a td/p inherits from it. */
[data-theme="dark"] .sds-registry-page .card-body,
[data-theme="dark"] .sds-registry-page .table td,
[data-theme="dark"] .sds-registry-page .table th,
[data-theme="dark"] .sds-registry-page label,
[data-theme="dark"] .sds-registry-page .form-label,
[data-theme="dark"] .sds-registry-page p,
/* `small` is listed explicitly: it was previously covered by the blanket
   `.card-body *` removed above, and without it the CAS-number column would dim to
   the secondary colour — a change nobody asked for while fixing the badges. */
/* ⚠ `.compliance-expired` / `.compliance-expiring` JOINED THE LIST SEP 2026. They
   colour the revision DATE inside the merged "Language / Revision" column, and the
   markup is identical on both SDS tables — but only the registry carries this
   page-wide rule, so the same column was red/amber on the Compliance Report and GREY
   here, in dark mode only. Measured: expired rgb(220,53,69) light but rgb(203,213,225)
   dark, against rgb(255,107,107) on the report.
   ⚠ BOTH SIDES ARE `!important`, so SPECIFICITY decides — and every `:not()` adds
   its argument's, putting this selector near (0,14,1) against the badge's (0,1,0).
   Excluding the class is the only fix that does not widen this rule back toward the
   blanket `*` that caused the original white-badge bug. */
[data-theme="dark"] .sds-registry-page small,
[data-theme="dark"] .sds-registry-page span:not(.badge):not(.compliance-badge-current):not(.compliance-badge-expiring):not(.compliance-badge-expired):not(.compliance-badge-missing):not(.signal-word-danger):not(.signal-word-warning):not(.signal-word-none):not(.lang-badge-en):not(.lang-badge-bm):not(.lang-badge-other):not(.linked-items-badge):not(.compliance-expired):not(.compliance-expiring) {
  color: var(--text-primary) !important;
}

/* ── Update 3: Signal Word Badge Colors ───────────────────────── */
.signal-word-danger {
  background-color: #dc3545 !important;
  color: #ffffff !important;
  padding: 2px 10px !important;
  border-radius: 4px !important;
  font-weight: 600 !important;
  font-size: 0.82rem !important;
  display: inline-block !important;
}
.signal-word-warning {
  background-color: #ff7800 !important;
  color: #ffffff !important;
  padding: 2px 10px !important;
  border-radius: 4px !important;
  font-weight: 600 !important;
  font-size: 0.82rem !important;
  display: inline-block !important;
}
.signal-word-none {
  background: none !important;
  color: #6c757d !important;
  padding: 0 !important;
  font-size: 0.85rem !important;
  font-style: italic !important;
}
[data-theme="dark"] .signal-word-danger {
  background-color: #dc3545 !important;
  color: #ffffff !important;
}
[data-theme="dark"] .signal-word-warning {
  background-color: #ff7800 !important;
  color: #ffffff !important;
}
[data-theme="dark"] .signal-word-none {
  color: #cbd5e1 !important;
}

/* ── Update 4: Linked Items Badge ─────────────────────────────── */
.linked-items-badge {
  background-color: #037ac9 !important;
  color: #ffffff !important;
  padding: 2px 10px !important;
  border-radius: 4px !important;
  font-weight: 600 !important;
  font-size: 0.82rem !important;
  display: inline-block !important;
  text-decoration: none !important;
}
.linked-items-badge:hover {
  background-color: #0d8ce0 !important;
  color: #ffffff !important;
  text-decoration: none !important;
}
[data-theme="dark"] .linked-items-badge {
  background-color: #037ac9 !important;
  color: #ffffff !important;
}
[data-theme="dark"] .linked-items-badge:hover {
  background-color: #0d8ce0 !important;
  color: #ffffff !important;
}

/* ── Choices.js Location & Supplier single-selects ───────────── */
/* These target ALL single-select Choices (data-type select-one), NOT just the
   JS-tagged .location-choices, so the layout fix works even if the browser is
   still running an older main.js. The list-page multi-select filter
   (select-multiple) keeps its default chip layout. */
.choices { margin-bottom: 0 !important; font-size: inherit !important; }

.choices[data-type*="select-one"] .choices__inner {
  background: var(--input-bg) !important;
  border-color: var(--input-border) !important;
  border-radius: 6px !important;
  /* One centred line matching the 38px sibling text inputs (removes Choices'
     44px min-height, 7.5px vertical padding, and any inline search input that
     made the box render two lines). */
  min-height: 38px !important;
  height: 38px !important;
  padding: 0 8px !important;
  display: flex !important;
  align-items: center !important;
  overflow: hidden !important;
  /* Match the 1rem (16px) font of the sibling text inputs (Choices default is 14px). */
  font-size: 1rem !important;
}
.choices[data-type*="select-one"] .choices__list--single {
  padding: 0 20px 0 4px !important;
  margin: 0 !important;
  display: flex;
  align-items: center;
  width: 100%;
}
/* Location <option>s are authored on their own indented line, so Choices renders stray
   <br> around the value — that made the selected item ~2 lines tall (text sat high) and
   inflated the dropdown options. Collapse them to a single line. */
.choices__item br { display: none !important; }
.choices[data-type*="select-one"] .choices__list--single .choices__item {
  line-height: 1.2 !important;
  font-size: 1rem !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* The search box lives inside the open dropdown, not the field — hide any input
   Choices renders inside the field box (it was forcing a second line). */
.choices[data-type*="select-one"] .choices__inner .choices__input {
  display: none !important;
}
/* Always open the dropdown DOWNWARD. When the field is low in the viewport Choices
   flips it upward (.is-flipped), which rendered it over the cards above the field. */
.choices[data-type*="select-one"].is-flipped .choices__list--dropdown,
.choices[data-type*="select-one"].is-flipped .choices__list[aria-expanded] {
  top: 100% !important;
  bottom: auto !important;
  margin-top: -1px !important;
  margin-bottom: 0 !important;
  border-radius: 0 0 6px 6px !important;
}
/* Keep the open dropdown above the cards below it, and give options a hover state
   (generic — the JS no longer tags a .location-choices class). */
.choices__list--dropdown,
.choices__list[aria-expanded] {
  z-index: 9999 !important;
}
.choices__item--choice:hover {
  background: var(--sidebar-hover) !important;
}
/* ── "Download template" button ───────────────────────────────────────────────
   A brighter blue than Bootstrap's outline-primary (client, Sep 2026). That default
   also measures only 3.25:1 on the dark page background — under the 4.5:1 line — so
   this is legibility as well as emphasis. One value per theme, measured in a browser
   on the page it appears on: #0d6efd was 4.50:1 light / 3.25:1 dark; these are
   6.44:1 / 6.06:1.

   ⚠ Deliberately its own class rather than a global override of btn-outline-primary.
   That class is the row Edit button on every table in the app, and quietly restyling
   every one of them is a much larger change than the button that was asked about. The
   dark-mode dimness on those is real and still open. */
:root {
  --btn-template: #0a58ca;
  --btn-template-hover: #084298;
  --btn-template-on: #ffffff;
}
[data-theme="dark"] {
  --btn-template: #6ea8fe;
  --btn-template-hover: #9ec5fe;
  --btn-template-on: #0f172a;
}
.btn-template {
  color: var(--btn-template);
  border: 1px solid var(--btn-template);
  background: transparent;
}
.btn-template:hover,
.btn-template:focus {
  background: var(--btn-template-hover);
  border-color: var(--btn-template-hover);
  color: var(--btn-template-on);
}
/* A link inside helper text. Bootstrap's default link blue measured 3.25:1 on the dark
   card (Edit PM Schedule's CF hint, Oct 2026) — under AA. The template button's blue is
   the app's measured-accessible blue in both themes, so links borrow it rather than a
   third value. Opt-in by class: restyling every link in the app is a different change. */
.link-readable {
  color: var(--btn-template);
}

/* Safety & Compliance tables — cells set their colour explicitly (Bootstrap does not pass
   it down reliably in the dark theme), and the free-text "Covers" column wraps rather
   than stretching the table. */
.safety-table td {
  color: var(--text-primary);
}
.safety-table td.safety-coverage {
  max-width: 320px;
  white-space: normal;
}

/* ── Bulk Upload button ───────────────────────────────────────────────────────
   ⚠ ITS OWN COLOUR, AND NOT BOOTSTRAP'S. The row Edit button is `btn-outline-primary`
   on every table in the app, and the page-level Bulk Upload was the same blue — two
   very different actions reading as one (client, Sep 2026).

   ⚠ `btn-outline-success` was the obvious swap and FAILS WCAG AA: Bootstrap's #198754
   measures 4.10:1 in light and 3.94:1 in dark, against the 4.5:1 line. Measured, not
   assumed. So the green is set here, one value per theme, both above AA — the house
   rule that a custom colour is declared as a variable rather than borrowed.

   Hover fills the button and flips the label: white on the dark green in light mode,
   near-black on the light green in dark mode. Filling with the same light green and
   keeping white text would be the usual mistake and unreadable in dark. */
:root {
  --btn-import: #146c43;        /* 6.4:1 on white */
  --btn-import-hover: #0f5132;
  --btn-import-on: #ffffff;
}
[data-theme="dark"] {
  --btn-import: #4ade80;        /* 10.8:1 on the dark page background */
  --btn-import-hover: #86efac;
  --btn-import-on: #0f172a;
}
.btn-import {
  color: var(--btn-import);
  border: 1px solid var(--btn-import);
  background: transparent;
}
.btn-import:hover,
.btn-import:focus {
  background: var(--btn-import-hover);
  border-color: var(--btn-import-hover);
  color: var(--btn-import-on);
}
/* The inventory page's Bulk Upload is a menu button (22 Oct 2026). While its menu is
   open Bootstrap marks it `.show` and paints it with its own active colours, which this
   class never set — so it takes the hover look instead. */
.btn-import.show {
  background: var(--btn-import-hover);
  border-color: var(--btn-import-hover);
  color: var(--btn-import-on);
}
/* The Export menu's button (client, 28 Nov 2026) - built like Bulk Upload's, in blue.
   Bootstrap's btn-outline-primary is on the contrast backlog (#0d6efd: 4.07:1 on the
   light page, 3.97:1 on the dark one), so one value per theme, both above AA:
   #0a58ca on #f0f4f8 ~5.8:1; #60a5fa on #0f172a ~7.1:1. Hover / open fill the button
   and flip the label, as .btn-import does. */
:root {
  --btn-export: #0a58ca;
  --btn-export-hover: #084298;
  --btn-export-on: #ffffff;
}
[data-theme="dark"] {
  --btn-export: #60a5fa;
  --btn-export-hover: #93c5fd;
  --btn-export-on: #0f172a;
}
.btn-export {
  color: var(--btn-export);
  border: 1px solid var(--btn-export);
  background: transparent;
}
.btn-export:hover,
.btn-export:focus,
.btn-export.show {
  background: var(--btn-export-hover);
  border-color: var(--btn-export-hover);
  color: var(--btn-export-on);
}
/* The one-line explanation under each choice in the Bulk Upload and Export menus. */
.bulk-upload-menu .dropdown-item,
.bulk-upload-menu .dropdown-item-text,
.export-menu .dropdown-item { white-space: normal; min-width: 18rem; }
.bulk-upload-hint,
.menu-hint {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.export-menu .dropdown-item .menu-hint { padding-left: 1.5rem; }
/* The Bulk Upload page's "use the full list instead" link: Bootstrap's link blue
   measured 3.25:1 on the dark card (4.50 light), so the page's own text colour,
   underlined so it still reads as a link. */
.edit-list-link { color: var(--text-primary); text-decoration: underline; }
/* Under the words, not under the icon (1em icon + its 0.5rem gap). */
.bulk-upload-menu .dropdown-item .bulk-upload-hint { padding-left: 1.5rem; }

/* ⚠ WRAP AT SPACES, NOT MID-WORD. The bundled Choices stylesheet sets
   `word-break: break-all` on its items, which split a location clean through a word —
   "Communications & Networking Laborator" / "y (MDT Innovations IOT Laboratory)".
   Reported by the client, Sep 2026.
   `overflow-wrap: break-word` is kept as the fallback so a single unbroken token
   longer than the dropdown still wraps instead of overflowing it — break-all is only
   wrong when there IS a space to break at. */
.choices__list--dropdown .choices__item,
.choices__list[aria-expanded] .choices__item {
  word-break: normal !important;
  overflow-wrap: break-word;
}
/* Generic Choices.js dark mode for all instances */
[data-theme="dark"] .choices__inner {
  background: var(--input-bg) !important;
  border-color: var(--input-border) !important;
  color: var(--text-primary) !important;
}
[data-theme="dark"] .choices__list--dropdown,
[data-theme="dark"] .choices__list[aria-expanded] {
  background: var(--card-bg) !important;
  border-color: var(--border-color) !important;
}
[data-theme="dark"] .choices__item--choice {
  color: var(--text-primary) !important;
}
[data-theme="dark"] .choices__item--selectable.is-highlighted {
  background: var(--sidebar-hover) !important;
}
[data-theme="dark"] .choices__input {
  background: transparent !important;
  color: var(--text-primary) !important;
}

/* ── Custom Checkbox Dropdown (Sub-Category filter) ─────────── */
.custom-checkbox-dropdown {
  position: relative;
  width: 100%;
}
.dropdown-toggle-btn {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  padding: 7px 12px;
  text-align: left;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;
  transition: border-color 0.15s;
}
.dropdown-toggle-btn:hover {
  border-color: var(--accent);
}
.checkbox-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  z-index: 9999;
  max-height: 320px;
  overflow-y: auto;
  padding: 6px 0;
}
.checkbox-dropdown-item {
  padding: 6px 14px;
  cursor: pointer;
  transition: background 0.1s;
}
.checkbox-dropdown-item:hover {
  background: var(--sidebar-hover);
}
.select-all-item {
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-subtle);
  padding: 8px 14px;
}
.dropdown-group-label {
  padding: 4px 14px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: var(--bg-subtle);
}
[data-theme="dark"] .dropdown-toggle-btn {
  background: var(--input-bg) !important;
  border-color: var(--input-border) !important;
  color: var(--text-primary) !important;
}
[data-theme="dark"] .checkbox-dropdown-menu {
  background: var(--card-bg) !important;
  border-color: var(--border-color) !important;
}
[data-theme="dark"] .checkbox-dropdown-item:hover {
  background: var(--sidebar-hover) !important;
}
[data-theme="dark"] .select-all-item {
  background: var(--bg-subtle) !important;
}
[data-theme="dark"] .form-check-label {
  color: var(--text-primary) !important;
}


/* ============================================================
   Booking System Styles
   ============================================================ */

/* Table grid view */
.booking-table-grid {
  overflow-x: auto;
  /* ⚠ THE CARD IS ROUNDED AND THIS BODY IS p-0, SO THE GRID'S SQUARE CORNERS SAT
     PROUD OF THE CURVE. The Time header's top-left border simply did not meet
     the card edge — a visible notch, reported from a screenshot Aug 2026. The
     month view never showed it because `.booking-month-table` draws no outer
     cell border there.
     Rounding the scroll container clips the table to the same curve.
     ⚠ `inherit`, NOT --bs-card-inner-border-radius. This stylesheet overrides the
     card radius to 10px while that Bootstrap variable still reports 5px, so the
     variable left a half-sized clip and the notch was still visible — just
     smaller, which is worse than obvious. `inherit` takes the parent .card's
     actual computed radius, so the two can never disagree. */
  border-radius: inherit;
}
.booking-grid-table {
  border-collapse: collapse;
  min-width: 600px;
  width: 100%;
}
.booking-grid-table th {
  background: var(--bg-subtle);
  color: var(--text-primary);
  padding: 8px 12px;
  text-align: center;
  border: 1px solid var(--border-color);
  font-size: 0.82rem;
  font-weight: 700;
  min-width: 120px;
}
.booking-grid-table td {
  border: 1px solid var(--border-color);
  padding: 4px 6px;
  text-align: center;
  font-size: 0.8rem;
  vertical-align: middle;
  min-height: 36px;
  height: 36px;
  cursor: pointer;
  transition: background 0.1s;
  color: var(--text-primary);
}
/* First column (Instrument name) is left-aligned */
.booking-grid-table th:first-child,
.booking-grid-table td:first-child {
  text-align: left;
}
.booking-grid-table td:hover {
  background: rgba(52,152,219,0.1);
}
.booking-grid-table .time-col {
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: default;
  width: 70px;
  min-width: 70px;
}
.booking-grid-table .slot-booked {
  background: rgba(52,152,219,0.15);
  color: var(--text-primary);
  font-weight: 500;
}
.booking-grid-table .slot-pending {
  background: rgba(253,126,20,0.15);
}
.booking-grid-table .slot-blackout {
  background: repeating-linear-gradient(
    45deg,
    rgba(114,28,36,0.1),
    rgba(114,28,36,0.1) 5px,
    rgba(167,29,42,0.1) 5px,
    rgba(167,29,42,0.1) 10px
  );
  cursor: not-allowed;
  text-align: center;
}
/* The blackout REASON, in the cell. Before this the cell showed only a red slash
   and a tooltip that said "Blackout" — the actual reason ("On-leave") was sent by
   the server and thrown away by the browser. `color` is set explicitly because a
   <td> does not inherit it reliably through Bootstrap. */
.booking-grid-table .slot-blackout-reason {
  color: var(--text-primary);
  font-size: 0.68rem;
  line-height: 1.15;
  margin-top: 2px;
  overflow-wrap: anywhere;
}
/* Month view: a blacked-out day is tinted so it reads at a glance, with the
   reason on a badge inside it. */
.booking-month-table .month-day-blackout {
  background: repeating-linear-gradient(
    45deg,
    rgba(114,28,36,0.10),
    rgba(114,28,36,0.10) 5px,
    rgba(167,29,42,0.10) 5px,
    rgba(167,29,42,0.10) 10px
  );
}
.booking-grid-table .slot-unavailable {
  background: rgba(220,53,69,0.1);
  cursor: not-allowed;
}
.booking-grid-table .slot-waitlist {
  background: rgba(111,66,193,0.15);
  color: var(--text-primary);
  font-weight: 500;
}
[data-theme="dark"] .booking-grid-table .slot-booked {
  background: rgba(52,152,219,0.25) !important;
}
[data-theme="dark"] .booking-grid-table .slot-pending {
  background: rgba(253,126,20,0.25) !important;
}
[data-theme="dark"] .booking-grid-table .slot-waitlist {
  background: rgba(111,66,193,0.30) !important;
}
/* ── Two-click move ─────────────────────────────────────────────────────────
   While a booking is being moved, every slot it may legally go to is marked as a
   target, and the slot it currently occupies is marked as its origin. Both follow
   the translucent-tint pattern of the other slot states above, so they sit over
   the existing weekend/reserved tints instead of replacing them.

   `color` is set explicitly on both: a <td> does not inherit text colour reliably
   through Bootstrap, which is the same reason .slot-blackout-reason sets it. */
.booking-grid-table .slot-move-target {
  background: rgba(39,174,96,0.16);
  outline: 2px dashed rgba(39,174,96,0.85);
  outline-offset: -3px;
  color: var(--text-primary);
  cursor: copy;
}
.booking-grid-table .slot-move-target:hover {
  background: rgba(39,174,96,0.34);
}
[data-theme="dark"] .booking-grid-table .slot-move-target {
  background: rgba(46,204,113,0.22) !important;
  outline-color: rgba(46,204,113,0.95);
}
[data-theme="dark"] .booking-grid-table .slot-move-target:hover {
  background: rgba(46,204,113,0.40) !important;
}
/* The slot being moved FROM. Dimmed and struck through rather than hidden — the
   person needs to see where it is leaving, or "move" has no visible before. */
.booking-grid-table .slot-moving {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
  color: var(--text-primary);
  cursor: default;
  font-style: italic;
}
/* ── The viewer's own slot ──────────────────────────────────────────────────
   Every occupied cell on the timetable used to say the same "Booked", so nobody
   could tell which slots were theirs without opening each one.

   The words "(My Slot)" carry the meaning — this tint only makes them scannable
   across a week. Colour alone would say nothing to a reader who cannot
   distinguish it (WCAG 1.4.1), which is why the marker is never CSS-only.

   Two rules because the marker lands on two very different surfaces, and one
   colour cannot serve both: the week grid's <td> has a PALE tint (so the accent
   bar reads against it), while the month and all-instruments chips have
   SATURATED backgrounds (so a light bar reads instead — accent-on-blue would be
   invisible). An inset bar rather than an outline, so it cannot be confused with
   the two outline treatments the move mode already uses just above. */
.booking-grid-table td.slot-mine {
  box-shadow: inset 4px 0 0 0 var(--accent);
}
.badge.slot-mine {
  box-shadow: inset 4px 0 0 0 rgba(255, 255, 255, 0.95);
}
/* The pending chip is yellow with dark text, so it takes a dark bar instead. */
.badge.bg-warning.slot-mine {
  box-shadow: inset 4px 0 0 0 rgba(0, 0, 0, 0.55);
}
[data-theme="dark"] .booking-grid-table td.slot-mine {
  box-shadow: inset 4px 0 0 0 #5dade2;
}

/* Small purple chip marking that a slot has a waitlist (or is the viewer's own
   waitlist entry). Used in the booking schedule grids. */
.waitlist-badge {
  display: inline-block;
  background: #6f42c1;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 600;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 6px;
  white-space: nowrap;
}
/* Single-instrument Month view calendar */
.booking-month-table {
  border-collapse: separate;
  border-spacing: 4px;
}
.booking-month-table th {
  padding: 4px 6px;
  font-size: 0.75rem;
  text-align: center;
  color: var(--text-muted);
  background: var(--bg-subtle); /* base so weekend-col tint is visible in dark mode */
}
.booking-month-table .month-day-cell {
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px;
  vertical-align: top;
  width: 14.28%;
  min-height: 80px;
  background: var(--card-bg);
  color: var(--text-primary);
}
.booking-month-table .month-day-cell:hover {
  background: var(--input-bg);
}
/* Today, in the month view. ⚠ !important because it was written on the cell until
   step C3 (security review item 8), and so beat the weekend tint, the hover and a
   blackout's stripes; no script changes this cell's background. */
.booking-month-table .month-day-today {
  background: rgba(52,152,219,0.10) !important;
  border-radius: 6px;
}

/* Weekend column (Sat & Sun) — subtle red tint.
   !important is required because [data-theme="dark"] thead th sets
   background: var(--bg-subtle) !important, which would otherwise win. */
.booking-grid-table th.weekend-col {
  background: rgba(220, 53, 69, 0.12) !important;
}
.booking-grid-table td.weekend-col {
  background: rgba(220, 53, 69, 0.06);
}
.booking-month-table th.weekend-col {
  background: rgba(220, 53, 69, 0.18) !important;
}
.booking-month-table .month-day-cell.weekend-col {
  background: rgba(220, 53, 69, 0.08);
}
[data-theme="dark"] .booking-grid-table th.weekend-col {
  background: rgba(220, 53, 69, 0.20) !important;
}
[data-theme="dark"] .booking-grid-table td.weekend-col {
  background: rgba(220, 53, 69, 0.10);
}
[data-theme="dark"] .booking-month-table th.weekend-col {
  background: rgba(220, 53, 69, 0.28) !important;
}
[data-theme="dark"] .booking-month-table .month-day-cell.weekend-col {
  background: rgba(220, 53, 69, 0.13);
}
/* Booking chips: text must follow the chip colour, not the grey forced by
   [data-theme="dark"] .card small. Target the inner <small> directly with
   higher specificity (0,3,1) so it wins over .card small (0,2,1). */
.booking-grid-table .badge.bg-primary,
.booking-grid-table .badge.bg-primary small,
.booking-month-table .badge.bg-primary,
.booking-month-table .badge.bg-primary small {
  color: #ffffff !important;
}
.booking-grid-table .badge.bg-warning,
.booking-grid-table .badge.bg-warning small,
.booking-month-table .badge.bg-warning,
.booking-month-table .badge.bg-warning small {
  color: #000000 !important;
}
/* Instrument-scope toggle (My Instruments / All Instruments) — right-aligned */
.instrument-scope-select {
  width: auto;
  margin-left: auto;
}

/* "Today" column highlight in the all-instruments week grid */
.booking-grid-table .today-col {
  background: rgba(52,152,219,0.06);
}
.booking-grid-table th.today-col {
  background: rgba(52,152,219,0.12);
  font-weight: 700;
}
[data-theme="dark"] .booking-grid-table .today-col {
  background: rgba(52,152,219,0.10);
}
[data-theme="dark"] .booking-grid-table th.today-col {
  background: rgba(52,152,219,0.18);
}

/* Autocomplete dropdown */
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  z-index: 9999;
  max-height: 250px;
  overflow-y: auto;
}
.autocomplete-item {
  padding: 10px 14px;
  cursor: pointer;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.1s;
}
.autocomplete-item:hover {
  background: var(--sidebar-hover);
}
.autocomplete-item:last-child {
  border-bottom: none;
}
[data-theme="dark"] .autocomplete-dropdown {
  background: var(--card-bg) !important;
  border-color: var(--border-color) !important;
}
[data-theme="dark"] .autocomplete-item:hover {
  background: var(--sidebar-hover) !important;
}

/* View toggle buttons */
.view-toggle-group {
  display: flex;
  gap: 4px;
  background: var(--bg-subtle);
  border-radius: 8px;
  padding: 4px;
}
.view-toggle-btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s;
}
.view-toggle-btn.active {
  background: var(--card-bg);
  color: var(--accent);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Booking status legend */
.booking-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
  margin-right: 4px;
}

/* Instrument tabs */
.instrument-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.instrument-tab {
  padding: 6px 14px;
  border-radius: 20px;
  border: 2px solid var(--border-color);
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.82rem;
  transition: all 0.15s;
}
.instrument-tab.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.instrument-tab:hover:not(.active) {
  border-color: var(--accent);
  color: var(--accent);
}

/* Date/time pickers in dark mode: `color-scheme: dark` makes the browser render
   the field text, the calendar icon, AND the native calendar popup in dark —
   more complete than inverting only the icon (the old approach left the popup
   white and did nothing for the dropdown calendar the user clicks open). */
[data-theme="dark"] input[type="time"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="datetime-local"] {
  color-scheme: dark;
}

/* Grid date picker keeps its explicit dark background/border to match the grid. */
[data-theme="dark"] input[type="date"].grid-date-picker {
  color-scheme: dark;
  background-color: var(--input-bg);
  color: var(--text-primary);
  border-color: var(--border-color);
}

/* ── Notification Settings: the daily-summary alert list ─────────────────────
   Dimmed while the master "Daily alert summary" switch is off. Opacity only —
   the fields stay enabled and keep submitting, because a disabled checkbox
   posts nothing and would wipe the eleven alert choices every time somebody
   paused their summary. Works in both themes without naming a colour: it fades
   whatever --text-primary / --input-bg already resolved to. */
.digest-options {
  border-color: var(--border-color) !important;
  transition: opacity 0.15s ease-in-out;
}

/* ⚠ DO NOT REMOVE — this fixes a real layout bug, it is not tidying.
   Bootstrap's reboot sets `legend { float: left; width: 100% }` and then relies on
   `legend + * { clear: left }` to put the following content back on its own line.
   The element after this legend is the "summary is paused" note, which is display:none
   whenever the master switch is ON — so the clear-left never applied, and the FIRST
   alert's checkbox (itself floated by .form-check-input) escaped upward and rendered
   in the top-right corner of the group, leaving "Maintenance overdue" with no tick box
   at all. Found in a real browser; source-level checks all passed. Guarded by
   tests/test_sds_badge_css.py. */
.digest-options legend {
  float: none;
  width: auto;
}

.digest-options.digest-options-off {
  opacity: 0.55;
}

/* ── Disabled SOLID buttons ───────────────────────────────────────────────────
   Bootstrap fades a disabled button with `opacity: .65`. On a solid button that
   washes out the FILL, while white label text stays white against the page
   showing through — so the label becomes unreadable rather than merely muted.
   Measured on Bulk Upload's "Upload & Preview": 2.64:1 in light and 3.3:1 in
   dark, reported as the font looking "faded and masked".

   Raising the opacity cannot fix it: white over a white page is white at any
   transparency, so only the fill fades. The fade is therefore replaced with a
   solid muted fill — unmistakably inactive, still legible (white on #5c636a
   measures ~6:1).

   Outline and link buttons are excluded: they have no fill to mute, and giving
   them one would make a disabled outline button look like a solid one.
   `.page-btn` (pagination) is untouched — it does not carry `.btn`.

   Affects, app-wide: Bulk Upload's "Upload & Preview" before a file is chosen,
   the feedback vote button once you have voted, and the forgot-password submit
   while it is working. */
.btn:disabled:not([class*="btn-outline"]):not(.btn-link),
.btn.disabled:not([class*="btn-outline"]):not(.btn-link) {
  opacity: 1;
  background-color: #5c636a;
  border-color: #5c636a;
  color: #ffffff;
  cursor: not-allowed;
}

/* ── Live inventory search: the "working on it" hint ──────────────────────────
   The top Search box asks the server as you type, so there is a short gap between
   the last keystroke and the new rows. Without a hint the table looks frozen and
   people press Filter, which is the button the live search exists to replace.

   A thin bar under the input, not a spinner over the icon: the clear (×) button and
   the magnifier already share that corner, and a third thing appearing there makes
   the box twitch. The bar sits on the border, so nothing moves.

   Colour comes from --accent so it follows the theme; it is decorative and carries
   no information the row count does not already give, so no ARIA live region. */
.search-wrapper::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    border-radius: 2px;
    background: var(--accent);
    opacity: 0;
    transition: opacity .15s ease;
    pointer-events: none;
}
.search-wrapper.is-searching::after {
    opacity: 1;
    animation: search-progress 1s ease-in-out infinite;
}
@keyframes search-progress {
    0%   { transform: scaleX(0);   transform-origin: left; }
    50%  { transform: scaleX(1);   transform-origin: left; }
    100% { transform: scaleX(0);   transform-origin: right; }
}
/* Motion is the only thing distinguishing "searching" from "idle" here, so when the
   viewer has asked for less of it the bar stays solid rather than disappearing —
   still an indicator, just not a moving one. This stylesheet has no other animation,
   which is why the media query is local rather than global. */
@media (prefers-reduced-motion: reduce) {
    .search-wrapper.is-searching::after { animation: none; }
}

/* ── A field the staff-account autofill REPLACED ──────────────────────────────
   Shown only when a pick overwrote something that was already there (Edit
   Researcher). The point is that a wrong pick is visible BEFORE Save, so this
   has to read as a change, not as an error: nothing is wrong yet, and typing in
   the box clears it. Theme-aware via the shared variables -- the note sets
   `color` explicitly because a custom container does not inherit it reliably
   through Bootstrap. */
.suggest-replaced {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 0.18rem rgba(21, 159, 251, 0.22) !important;
}
.suggest-replaced-note {
  margin-top: 0.25rem;
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--text-primary);
}
.suggest-replaced-note i {
  color: var(--accent);
  margin-right: 0.25rem;
}
.suggest-replaced-note s {
  color: var(--text-muted);
}

/* Bulk import summary — the "N row(s) will NOT be imported" count.
   Bootstrap's .text-danger (#dc3545) measures only 3.23:1 against our dark card
   background, below the 4.5:1 this project holds itself to, so the colour is set
   per theme here instead of reusing the utility class. Measured in a browser with
   getComputedStyle: 6.54:1 light, 7.29:1 dark. The count is the one part of the
   banner a user must not skim past, hence the weight as well as the colour. */
.import-refused {
  color: #b5202e;
  font-weight: 600;
}
[data-theme="dark"] .import-refused {
  color: #ff9ba3;
}

/* Same page, same problem from the other direction: Bootstrap's .text-warning
   (#ffc107) on the light card measures 1.63:1 — the "white on yellow is invisible"
   failure this project already bans on badges, in text form. It was there before
   the refused-row count was added and is fixed alongside it. Dark mode keeps the
   bright amber (8.97:1 on the dark card); only the light value is darkened.
   Measured: 5.54:1 light, 8.97:1 dark. */
.import-warned {
  color: #8a6100;
  font-weight: 600;
}
[data-theme="dark"] .import-warned {
  color: #ffc107;
}

/* Notice icons on the login card line up with the FIRST LINE of their text.
   `d-flex align-items-start` aligns the two BOXES, which is not the same thing:
   the icon inherits the alert's 16px font and a 24px line box, while the text is
   `.small` with a 19px line — so the glyph sat 5.5px below the first line's
   centre (measured, both notices). Bootstrap's `mt-1` had been added to nudge it
   and was pushing it a further 4px the wrong way.
   Matching the icon's line-height to the text line puts the two centres
   together; `flex: none` stops the icon being squeezed when the text wraps. */
.alert.d-flex > i.bi,
.alert > .d-flex > i.bi {
  line-height: inherit;
  flex: none;
}

/* ── Breakdown summary table: stacked text + date ─────────────────────────────
   Two columns share one shape — the text on top, its date on a muted line pinned to
   the bottom of the cell (Latest Status: the newest timeline note + when; Breakdown
   Desc: the description + when it was reported, which used to be a column of its own).

   WHY PIN AT ALL: a row's height is set by its TALLEST cell. Without pinning, a long
   note wrapping to three lines leaves its date three lines down while the one-line
   description next to it puts its date near the top — the dates read as ragged. Pinned,
   they form one straight line across the row however the text above them wraps.

   ⚠ POSITIONED, NOT `height: 100%` + `margin-top: auto`. That flex recipe is the
   obvious one and it DOES NOT WORK HERE: a percentage height needs a definite height to
   resolve against, and a table row has none of its own, so the wrapper collapses to its
   content and the pin silently does nothing. Measured in a real browser, Sep 2026 — the
   flex version left the uneven row 42px out while the even rows looked perfect, which
   is exactly the shape of bug that ships. `tr{height:1px}` + `td{height:100%}`,
   `td{height:1px}`, `height:inherit` and a `grid-template-rows:1fr auto` variant were
   all measured and all left the same 42px. Making the cell itself `display:flex` fixes
   the alignment and breaks the column widths (the header no longer lines up with the
   body), so that is out too.

   `padding-bottom` on the cell reserves the strip the absolute line sits in, so it can
   never overlap the text above it. `left`/`right` keep the line inside the column
   rather than spilling out of it. One line only, with the full text on hover — a
   wrapped date line would grow past the reserved strip and overlap. */
.bd-table td.bd-stack-cell {
  vertical-align: top;
  position: relative;
  padding-bottom: 26px;
}
.bd-stack { display: block; }
.bd-stack .bd-meta {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  display: block;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ⚠ THE "WAITING, NOT BROKEN" ICON ON THE CANNOT-BOOK MODAL.
   That modal's default icon is a red error triangle, which is right for the two
   reasons it was built for (instrument down, booking switched off) and WRONG for
   "your account is still being reviewed" - nothing has gone wrong there. Same
   objection the client raised about the deactivated-instrument banner being amber:
   a statement of fact, not a warning.

   ⚠ EVERY BOOTSTRAP UTILITY FAILS ONE THEME OR THE OTHER - measured in a real
   browser against the modal's own background (white light / #1e293b dark):
     text-info 1.96:1 light, text-primary 4.50/3.25, text-secondary 4.69/3.12,
     text-success 4.53/3.23, text-warning 1.63 light, text-body 1.05 dark.
   The theme variable is the only thing that holds up on both sides: 4.76:1 light
   and 4.76:1 dark, comfortably past the 3:1 WCAG 1.4.11 asks of a graphic. */
.icon-awaiting { color: var(--text-muted); }

/* One line per language in the SDS Registry's "Language / Revision" column.
   ⚠ NOWRAP KEEPS THE DATE AND ITS STATUS TOGETHER. Without it the line broke after
   the separator — "BM 06 Mar 2024 -" on one line and "current" on the next — which
   reads as though the status belongs to the row below. Measured at 1280px: the table
   still does not overflow horizontally. */
.sds-lang-line { white-space: nowrap; }

/* ⚠ A COMPLIANCE BADGE IS ONE LINE, WITH ITS ICON BESIDE THE WORD.
   Client, Sep 2026: "Expired" broke across two lines and the icon on "Expiring" sat
   above its word. Measured on the compliance report (dark, 1280px) before the fix:

     Current    25px tall, icon-to-text offset   0.0    fine
     Expiring   46px tall, offset -20.9                 icon on the line above
     Expired    46px tall, offset -20.9
     Missing    46px tall, offset -20.9

   So the "misalignment" WAS the wrap - one symptom, not two. Only "Current" escaped
   because its text is narrow enough for the column.

   ⚠ THIS SELECTOR NAMES THE BADGES ALONE, AND THAT IS THE WHOLE POINT. The same class
   names are shared by `td.compliance-*-cell` and `.compliance-*-bg` in the rules above;
   adding `display: inline-flex` there would turn table CELLS into flex containers and
   collapse the columns. */
.compliance-badge-current,
.compliance-badge-expiring,
.compliance-badge-expired,
.compliance-badge-missing {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
}


/* ⚠ THE SYMBOL IS DRAWN MUCH LARGER THAN THE WORD, AND THAT IS THE ONLY LEVER THERE IS.

   Client, Sep 2026, across four rounds: "the symbol font is very thin" → grew it to
   1.15em → "the symbols are still very thin" → tried bare stroked symbols → "the last
   design with background fill looks better, just need to increase the symbols size".

   ⚠ A `-fill` GLYPH DRAWS THE SYMBOL AS A HOLE, NOT AS INK. `check-circle-fill` paints
   a solid white DISC with the tick knocked OUT of it, so the mark you see is the badge's
   own background colour showing through. Its size is a fixed fraction of the disc, baked
   into the font outline — no CSS can change that ratio. Scaling the whole glyph is
   therefore the ONLY way to make the mark bigger, which is why this number is large.

   ⚠ AND `-webkit-text-stroke` MAKES IT WORSE HERE, WHICH IS THE OPPOSITE OF ITS EFFECT
   ON A BARE SYMBOL. A stroke painted along a filled disc's outline grows the white
   INWARD as well as outward, closing up the hole — so the very property that emboldens
   a stroked glyph THINS a knocked-out one. It was briefly used, for the bare-symbol
   design the client did not keep, and must not come back with the disc.

   ⚠ THE COST WAS MEASURED, NOT GUESSED. At 1.55em the compliance report's table body
   grows 452px → 457px, and the SDS Registry does not change at all (its rows are 118px,
   driven by the language column, not by this badge). Both pages are scanned rather than
   read, so row count is the thing worth protecting, and it is essentially untouched.

   ⚠ SCOPED TO THE BADGE'S OWN CHILD `<i>`, NEVER TO THE CLASS NAMES ALONE. Those four
   names are also carried by `td.compliance-*-cell` and `.compliance-*-bg`, so a
   `font-size` on the bare class would resize the contents of table CELLS across the
   report. Same trap as the `display: inline-flex` rule above. */
.compliance-badge-current > i,
.compliance-badge-expiring > i,
.compliance-badge-expired > i,
.compliance-badge-missing > i {
  font-size: 1.55em;
}

/* The sidebar's logo and its "Fixed Asset" / "Consumable Asset" labels (base.html) —
   written on the elements until step C3 (security review item 8). */
.sidebar-brand-icon {
  width: 32px; height: 32px; object-fit: contain; margin-right: 10px;
  filter: drop-shadow(0 0 4px rgba(52,199,219,0.4));
}
.sidebar-group-label {
  font-size: 10px; opacity: 0.6; padding: 6px 0 2px 1rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
}
.sidebar-group-label-first { padding-top: 4px; }

/* ── A box that STARTS HIDDEN: data-start-hidden (security review item 8, step C3) ──
   It used to say style="display:none", which the strict policy refuses. actions.js turns
   the marker into that same inline style the moment the element is parsed — so the
   ~300 scripts that show a box by clearing its style (el.style.display = '') or test
   it (el.style.display === 'none') work exactly as before. This rule only covers the
   moment before actions.js has seen it (and a page without actions.js). ⚠ The marker
   carries no value on purpose: one slipped into a record can only hide something. */
[data-start-hidden] { display: none !important; }

/* The all-instruments grid (booking_schedule.js). Written on its cells until step C3;
   each beats `.booking-grid-table td/th` as the cell's own style did. */
.booking-grid-table th.grid-inst-head { min-width: 160px; white-space: nowrap; text-align: left; }
.booking-grid-table td.grid-inst-cell { vertical-align: middle; padding: 6px 10px; text-align: left; }
.booking-grid-table td.grid-day-top { padding: 4px 6px; vertical-align: top; }
.booking-grid-table td.grid-day-center { text-align: center; }
/* A booking's condition values — the pop-up (booking_detail.js) and the booking form's
   summary (booking_form.js). Each beats the shared table rule (.table td .87rem,
   .table th .78rem) as the cell's own style did. */
.table td.booking-detail-value { font-size: .85rem; }
.table th.preset-summary-head { font-size: .8rem; }

/* Add Item's two inline research forms (Research Fixed Asset / Research Chemical). */
.inline-form-section {
  border-top: 1px solid var(--border-color); margin-top: 1.25rem; padding-top: 1.25rem;
}
/* A stock movement's badge in the inventory list's History pop-up — one colour per kind
   (written on the badge by its script until step C3). */
.mv-badge-issued { background: #0dcaf0; }
.mv-badge-returned, .mv-badge-added { background: #198754; }
.mv-badge-consumed, .mv-badge-damaged, .mv-badge-lost { background: #dc3545; }
.mv-badge-adjusted { background: #ff7800; }
.mv-badge-taken_into_use { background: #ffc107; }
.mv-badge-other { background: #6c757d; }

/* An equipment photo in a pop-up, click to enlarge (research asset pop-up; the faculty
   item pop-up in main.js is 180px tall — the two had drifted, kept as they were). */
.popup-photo {
  cursor: zoom-in; max-height: 200px; max-width: 100%;
  border-radius: 8px; border: 1px solid var(--border-color);
}
.popup-photo.popup-photo-180 { max-height: 180px; }

/* Add Item's two coloured section headers, and a document row in the procurement list —
   written on the elements until step C3. Named "[data-theme] …" too, because the dark
   theme's .card-header / .list-group-item rules are stronger than one class. */
.card-header.add-head-faculty, [data-theme="dark"] .card-header.add-head-faculty {
  background: linear-gradient(135deg, #0f4c75 0%, #1b6ca8 100%); color: #fff;
}
.card-header.add-head-research, [data-theme="dark"] .card-header.add-head-research {
  background: linear-gradient(135deg, #145a32 0%, #1e8449 100%); color: #fff;
}
.list-group-item.doc-list-row, [data-theme="dark"] .list-group-item.doc-list-row {
  background: var(--input-bg); color: var(--text-primary); border-color: var(--border-color);
}
/* The currency box beside a price — beats Bootstrap's `.input-group > .form-select`. */
.form-select.currency-select, .input-group > .form-select.currency-select {
  min-width: 82px; max-width: 110px; flex: 0 0 auto;
}

/* A bucket tile in the Move Stock chooser (main.js, openMoveStock). */
.move-tile { background: var(--input-bg); border: 1px solid var(--border-color); }
.move-tile-num { font-size: 1.3rem; }

/* ── Step C3 (item 8): what maintenance / breakdown / safety wrote on elements ──
   A summary card that pulses while something has lapsed (Maintenance Overdue,
   CF Expired, Safety Expired) - the card gets this class only while its count is > 0. */
.summary-card-pulse { animation: expiredPulse 2s infinite; }
/* Maintenance's "Regulatory License (CF) Only" filter box, tinted red while ticked. */
.cf-filter-box { cursor: pointer; background: transparent; }
.cf-filter-box.cf-filter-on { background: rgba(220, 53, 69, 0.08); }
/* The coloured left edge of a Maintenance / Breakdown list row (status at a glance);
   the whole row opens the record. The colours are the ones the rows always had. */
.row-edge { border-left: 4px solid; cursor: pointer; }
.log-edge { border-left: 4px solid; }   /* Activity Log rows: an edge, not a link */
.row-edge-red    { border-left-color: #dc3545; }
.row-edge-yellow { border-left-color: #ffc107; }
.row-edge-cyan   { border-left-color: #0dcaf0; }
.row-edge-orange { border-left-color: #fd7e14; }
.row-edge-green  { border-left-color: #198754; }
.row-edge-blue   { border-left-color: #0d6efd; }
.row-edge-grey   { border-left-color: #6c757d; }

/* The CF (red) and Calibration (purple) section headings on the maintenance record
   forms. Named with [data-theme="dark"] too: dark mode paints every .card-header. */
.card-header.head-tint-cf, [data-theme="dark"] .card-header.head-tint-cf { background: rgba(220, 53, 69, 0.1); }
.card-header.head-tint-cal, [data-theme="dark"] .card-header.head-tint-cal { background: rgba(111, 66, 193, 0.1); }
/* The equipment box at the top of the Maintenance / Breakdown pop-ups: the pop-up
   paints every card inside it (.item-modal-box .card), so this names it too. */
.item-modal-box .card.modal-info-card { background: var(--bg-subtle); }

/* Step C3, last area: looks that were written on the element. */
.modal-field.modal-field-wide { grid-column: span 2; }
.border.import-review-box { border-color: var(--border-color) !important; }
.popup-photo-empty { height: 130px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; border-radius: 8px; border: 1px dashed var(--border-color); color: var(--text-muted); }
code.subloc-chip { font-size: 0.82rem; background: var(--bg-subtle, #f1f5f9); padding: 2px 6px; border-radius: 4px; }

/* ── u-* : WHAT USED TO BE WRITTEN ON THE ELEMENT (style="…") ──
   (security review item 8, step C3, 14 Nov 2026)
   The strict Content Security Policy refuses style="…" written into a page, because a
   browser cannot tell a style the page wrote from one slipped into a record (CSS can
   read a page out letter by letter). So each fixed style a template used to write on
   an element is a class here, named after what it says:
       u-<property>-<value>      u-c-heading = color: var(--text-heading)
                                 u-w-100px   = width: 100px
                                 u-fs-0_85rem = font-size: .85rem
   ⚠ DELIBERATELY NOT !important. A style on the element always yielded to a script
   that later changed it (el.style.cursor = …), and these must too. The cost is that a
   more specific page rule can now win where the element's own style used to — every
   converted page was compared element by element before and after in both themes.
   ⚠ A box that starts hidden is NOT a class: it carries data-start-hidden (actions.js),
   because ~300 scripts show a box by clearing its style (el.style.display = ''), which
   a class would outlive.
   ⚠ Kept in this order (sorted) and at the END of the file, so a tie with an earlier
   rule of the same strength goes to the element's own style, as it used to. */
.u-ai-center { align-items: center; }
.u-bc-6f42c1 { border-color: #6f42c1; }
.u-bd-1px-solid-var-border-color { border: 1px solid var(--border-color); }
.u-bd-2px-dashed-adb5bd { border: 2px dashed #adb5bd; }
.u-bd-2px-dashed-var-border-color { border: 2px dashed var(--border-color); }
.u-bd-2px-solid-var-border-color { border: 2px solid var(--border-color); }
.u-bd-4px-solid-dee2e6 { border: 4px solid #dee2e6; }
.u-bdb-1px-solid-var-border-color { border-bottom: 1px solid var(--border-color); }
.u-bdb-none { border-bottom: none; }
.u-bdl-3px-solid-var-border-color { border-left: 3px solid var(--border-color); }
.u-bdl-4px-solid-6f42c1 { border-left: 4px solid #6f42c1; }
.u-bdl-4px-solid-var-announce-critical { border-left: 4px solid var(--announce-critical); }
.u-bdl-4px-solid-var-announce-info { border-left: 4px solid var(--announce-info); }
.u-bdl-4px-solid-var-announce-warning { border-left: 4px solid var(--announce-warning); }
.u-bg-0378c6 { background: #0378c6; }
.u-bg-158463 { background: #158463; }
.u-bg-207ab6 { background: #207ab6; }
.u-bg-28a745 { background: #28a745; }
.u-bg-3498db { background: #3498db; }
.u-bg-6f42c1 { background: #6f42c1; }
.u-bg-721c24 { background: #721c24; }
.u-bg-adb5bd { background: #adb5bd; }
.u-bg-b25e14 { background: #b25e14; }
.u-bg-ba5800 { background: #ba5800; }
.u-bg-bc5602 { background: #bc5602; }
.u-bg-card { background: var(--card-bg); }
.u-bg-content { background: var(--content-bg); }
.u-bg-dc3545 { background: #dc3545; }
.u-bg-fd7e14 { background: #fd7e14; }
.u-bg-input { background: var(--input-bg); }
.u-bg-rgba-0-0-0-0_55 { background: rgba(0,0,0,0.55); }
.u-bg-rgba-111-66-193-0_10 { background: rgba(111,66,193,0.10); }
.u-bg-rgba-220-53-69-0_06 { background: rgba(220,53,69,0.06); }
.u-bg-subtle { background: var(--bg-subtle); }
.u-bg-transparent { background: transparent; }
.u-br-10px { border-radius: 10px; }
.u-br-4px { border-radius: 4px; }
.u-br-6px { border-radius: 6px; }
.u-br-8px { border-radius: 8px; }
.u-c-0f7b6c { color: #0f7b6c; }
.u-c-198754 { color: #198754; }
.u-c-1b6ca8 { color: #1b6ca8; }
.u-c-212529 { color: #212529; }
.u-c-6f42c1 { color: #6f42c1; }
.u-c-accent { color: var(--accent); }
.u-c-dc3545 { color: #dc3545; }
.u-c-f39c12 { color: #f39c12; }
.u-c-fff { color: #fff; }
.u-c-heading { color: var(--text-heading); }
.u-c-muted { color: var(--text-muted); }
.u-c-text { color: var(--text-primary); }
.u-cur-pointer { cursor: pointer; }
.u-d-flex { display: flex; }
.u-d-inline { display: inline; }
.u-fd-column { flex-direction: column; }
.u-fd-row { flex-direction: row; }
.u-fi-drop-shadow-0-0-8px-rgba-52-199-219-0_5 { filter: drop-shadow(0 0 8px rgba(52,199,219,0.5)); }
.u-flex-0-0-28px { flex: 0 0 28px; }
.u-flex-1 { flex: 1; }
.u-fs-0_6rem { font-size: 0.6rem; }
.u-fs-0_72rem { font-size: .72rem; }
.u-fs-0_75rem { font-size: 0.75rem; }
.u-fs-0_78rem { font-size: 0.78rem; }
.u-fs-0_7rem { font-size: 0.7rem; }
.u-fs-0_82rem { font-size: 0.82rem; }
.u-fs-0_85rem { font-size: .85rem; }
.u-fs-0_875rem { font-size: 0.875rem; }
.u-fs-0_88rem { font-size: 0.88rem; }
.u-fs-10px { font-size: 10px; }
.u-fs-11px { font-size: 11px; }
.u-fs-12px { font-size: 12px; }
.u-fs-1_05rem { font-size: 1.05rem; }
.u-fs-1_1rem { font-size: 1.1rem; }
.u-fs-1rem { font-size: 1rem; }
.u-fs-2rem { font-size: 2rem; }
.u-fs-3rem { font-size: 3rem; }
.u-fs-8px { font-size: 8px; }
.u-fw-500 { font-weight: 500; }
.u-fwrap-nowrap { flex-wrap: nowrap; }
.u-gap-4px { gap: 4px; }
.u-gap-8px { gap: 8px; }
.u-h-12px { height: 12px; }
.u-h-24px { height: 24px; }
.u-h-280px { height: 280px; }
.u-h-90px { height: 90px; }
.u-h-auto { height: auto; }
.u-lh-1_3 { line-height: 1.3; }
.u-lh-1_6 { line-height: 1.6; }
.u-ls-0_04em { letter-spacing: .04em; }
.u-maxh-120px { max-height: 120px; }
.u-maxh-150px { max-height: 150px; }
.u-maxh-160px { max-height: 160px; }
.u-maxh-240px { max-height: 240px; }
.u-maxh-85vh { max-height: 85vh; }
.u-maxh-90vh { max-height: 90vh; }
.u-maxh-inherit { max-height: inherit; }
.u-maxw-1000px { max-width: 1000px; }
.u-maxw-100pc { max-width: 100%; }
.u-maxw-130px { max-width: 130px; }
.u-maxw-160px { max-width: 160px; }
.u-maxw-180px { max-width: 180px; }
.u-maxw-240px { max-width: 240px; }
.u-maxw-250px { max-width: 250px; }
.u-maxw-260px { max-width: 260px; }
.u-maxw-28px { max-width: 28px; }
.u-maxw-32rem { max-width: 32rem; }
.u-maxw-400px { max-width: 400px; }
.u-maxw-480px { max-width: 480px; }
.u-maxw-700px { max-width: 700px; }
.u-maxw-900px { max-width: 900px; }
.u-mb-18px { margin-bottom: 18px; }
.u-minh-28px { min-height: 28px; }
.u-minw-110px { min-width: 110px; }
.u-minw-120px { min-width: 120px; }
.u-minw-140px { min-width: 140px; }
.u-minw-150px { min-width: 150px; }
.u-minw-160px { min-width: 160px; }
.u-minw-200px { min-width: 200px; }
.u-minw-220px { min-width: 220px; }
.u-minw-44px { min-width: 44px; }
.u-minw-50px { min-width: 50px; }
.u-minw-52px { min-width: 52px; }
.u-minw-55px { min-width: 55px; }
.u-minw-60px { min-width: 60px; }
.u-minw-65px { min-width: 65px; }
.u-minw-70px { min-width: 70px; }
.u-minw-74px { min-width: 74px; }
.u-minw-80px { min-width: 80px; }
.u-minw-900px { min-width: 900px; }
.u-minw-90px { min-width: 90px; }
.u-mt-2px { margin-top: 2px; }
.u-mt-4px { margin-top: 4px; }
.u-mt-8px { margin-top: 8px; }
.u-of-hidden { overflow: hidden; }
.u-ofit-contain { object-fit: contain; }
.u-ofy-auto { overflow-y: auto; }
.u-op-0_4 { opacity: 0.4; }
.u-op-0_75 { opacity: 0.75; }
.u-op-0_8 { opacity: 0.8; }
.u-op-0_85 { opacity: 0.85; }
.u-p-0 { padding: 0; }
.u-p-0_5rem-_75rem { padding: .5rem .75rem; }
.u-p-2px-6px { padding: 2px 6px; }
.u-p-40px { padding: 40px; }
.u-p-8px { padding: 8px; }
.u-p-8px-12px { padding: 8px 12px; }
.u-p-9px { padding: 9px; }
.u-sh-none { box-shadow: none; }
.u-ta-center { text-align: center; }
.u-ta-left { text-align: left; }
.u-td-line-through { text-decoration: line-through; }
.u-tov-ellipsis { text-overflow: ellipsis; }
.u-tr-all-0_2s { transition: all 0.2s; }
.u-tr-all-_2s { transition: all .2s; }
.u-tr-opacity-0_2s { transition: opacity 0.2s; }
.u-tt-uppercase { text-transform: uppercase; }
.u-va-middle { vertical-align: middle; }
.u-va-super { vertical-align: super; }
.u-w-100px { width: 100px; }
.u-w-110px { width: 110px; }
.u-w-120px { width: 120px; }
.u-w-130px { width: 130px; }
.u-w-140px { width: 140px; }
.u-w-150px { width: 150px; }
.u-w-160px { width: 160px; }
.u-w-180px { width: 180px; }
.u-w-190px { width: 190px; }
.u-w-200px { width: 200px; }
.u-w-24px { width: 24px; }
.u-w-280px { width: 280px; }
.u-w-40px { width: 40px; }
.u-w-44px { width: 44px; }
.u-w-50px { width: 50px; }
.u-w-60px { width: 60px; }
.u-w-70px { width: 70px; }
.u-w-80px { width: 80px; }
.u-w-90px { width: 90px; }
.u-w-90vw { width: 90vw; }
.u-w-auto { width: auto; }
.u-wb-break-all { word-break: break-all; }
.u-ws-normal { white-space: normal; }
.u-ws-nowrap { white-space: nowrap; }
.u-ws-pre-line { white-space: pre-line; }
.u-ws-pre-wrap { white-space: pre-wrap; }
/* ── end of u-* ── */

/* ── Booking information boxes in dark mode (client, 28 Nov 2026) ─────────────
   "Reserved periods", "Who to ask about this instrument" and the instrument notes are
   Bootstrap's alert-info: a LIGHT cyan box the app gave no dark colour, so it glared out
   of the dark page. In dark mode they are a dark teal panel with light text and a thin
   cyan border; light mode is unchanged. Only boxes marked .info-panel - the other
   alert-info boxes in the app are left as they are (the client's call).
   Guard: tests/test_booking_dark_boxes.py (measured in a real browser). */
[data-theme="dark"] .alert-info.info-panel {
  background-color: var(--info-panel-bg);
  border-color: var(--info-panel-border);
  color: var(--text-primary);
}
[data-theme="dark"] .alert-info.info-panel strong { color: var(--text-heading); }
[data-theme="dark"] .alert-info.info-panel a { color: var(--info-panel-link); }
[data-theme="dark"] .alert-info.info-panel .text-muted { color: var(--text-muted) !important; }
