/* ============================================================================
   GEPL ERP — theme layer
   ----------------------------------------------------------------------------
   One sheet, loaded last, that gives the ERP the same industrial console look
   as the Enamel Portal: dark navy, IBM Plex, dense tables, colour reserved for
   state. It is a *layer*, not a rewrite — the 270-odd Blade views keep their
   existing markup and classes (.e-card, .e-form-input, .btn, .table, select2,
   DataTables). What changes is what those classes mean.

   Two mechanisms do most of the work:

     1. The legacy tokens in style.css (--primary-color, --white-color,
        --main-bg …) are redefined here against the dark palette. style.css
        already reads them in 423 places, so most of it re-skins for free.
     2. Where style.css hardcodes a colour — 66 bare #fff, a handful of
        #dee2e6 borders — a rule below overrides just that spot.

   The palette, spacing, radii and type scale are lifted verbatim from
   enamel/public/css/console.css so the two apps stay visually one system. If a
   colour changes there, change it here too.

   Order inside the file, and the order the sections are numbered in:

     1 tokens          every colour, size, gap, duration and z-index, once
     2 base            reset, type scale, focus, reduced motion
     3 shell           header, navigation, command palette, the page frame
     4 layout          the grid, and the column classes the views use
     5 components      cards, forms, tables, buttons, badges, modals
     6 third-party     DataTables, select2, toastr, SweetAlert, pickers
     7 feedback        progress bar, loader, skeleton, empty state
     8 affordances     skip link, back to top, spacing rhythm, alignment
     9 responsive      five breakpoints, all of them layout not scale
    10 print           the whole thing back into normal flow, on white

   Nothing above the "components" line knows about a specific page, and nothing
   anywhere writes a literal that section 1 has a name for.

   The specification this implements is UI-DESIGN-SYSTEM.md, in the repository
   root. When the two disagree, this file is wrong.
   ========================================================================== */

/* ============================ 1. tokens ================================== */

:root {
  /* Tells the browser which way round its own furniture goes: the scrollbars,
     the caret, the drop-down list a native <select> opens, the panel a date
     input opens, the spin buttons on a number field. None of those are ours to
     paint, and without this they stay light on a dark page. */
  color-scheme: dark;

  /* ---- surface ramp -------------------------------------------------------
     Depth on a dark interface is carried by surface lightness, not by shadow.
     Five steps, darkest at the back; every fill in this sheet is one of them.
     The hex values are the Enamel Portal's, unchanged, so the two applications
     read as one system - the names below are just the roles they play here. */
  --paper: #070e17;
  --surface: #142233;
  --surface-2: #0d1723;
  --surface-alt: #182738;
  --navy: #0b131f;
  --navy-2: #121e2d;

  --bg-app: var(--paper);
  --bg-sunken: var(--surface-2);
  --bg-card: var(--surface);
  --bg-raised: var(--surface-alt);
  --bg-nav: var(--navy);

  /* ---- ink ----
     Three steps and no more: what you read, what labels it, what hints at it. */
  --ink: #ffffff;
  --ink-2: #8fa2b2;
  --ink-3: #597082;
  --on-navy: #ffffff;
  --on-navy-dim: #8fa2b2;
  /* The lift a menu row gets under the pointer. It has to be a token: the
     menu is a navy bar in one theme and a white sheet in the other, so one
     literal here is a label that disappears in whichever theme it was not
     written for. */
  --on-navy-hover: #eef3f8;

  --line: #1e3247;
  --line-strong: #2c4763;

  /* ---- accent & state ----
     Colour means something here. Blue is interaction; the six pairs below are
     states and categories. A screen never introduces a seventh. */
  --accent: #568cee;
  --accent-deep: #3a6cc9;
  --accent-hover: #3e72d3;
  --accent-soft: #44ccb9;
  --accent-weak: #0d2033;

  /* Text drawn *on top of* a solid state colour. The state colours are light
     enough to read against the dark page, which is exactly what makes white
     text on a filled one unreadable - white on --success is 2.2:1. */
  --on-state: #05131b;

  --success: #55c298;
  --success-bg: rgba(31, 107, 78, .25);
  --warning: #e5a93c;
  --warning-bg: rgba(138, 98, 16, .25);
  --danger: #e57267;
  --danger-bg: rgba(166, 51, 40, .25);
  --steel: #7fb0d6;
  --steel-bg: rgba(51, 100, 143, .25);
  --teal: #44ccb9;
  --teal-bg: rgba(23, 109, 126, .25);
  --violet: #a391d6;
  --violet-bg: rgba(92, 78, 125, .25);

  /* ---- type ----
     One family, three roles. IBM Plex, the same as the Enamel Portal.

     13px is the working size on purpose: a data grid at 15px fits noticeably
     fewer rows on a laptop, and these screens are read at desk distance. */
  --display: 'IBM Plex Sans Condensed', ui-sans-serif, system-ui, sans-serif;
  --body: 'IBM Plex Sans', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --t-xs: 11px;
  --t-sm: 12px;
  --t-base: 13px;
  --t-md: 14px;
  --t-lg: 16px;
  --t-xl: 20px;
  --t-2xl: 24px;

  --lh-tight: 1.3;
  --lh-dense: 1.45;
  --lh-text: 1.55;

  /* ---- space ----
     4px base, 8px rhythm. 4 is for the inside of a control - icon to label,
     badge padding - and nowhere else. */
  --s0: 2px;
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 64px;

  /* The steps above are the vocabulary; these are the sentences. A screen
     should reach for a role, not a number, because the role is what changes
     when the layout gets narrow - see section 9. */
  --gap-page: var(--s5);
  --gap-block: var(--s4);
  --gap-card: 20px;
  --gap-field: var(--s3);
  --gap-inline: var(--s2);
  --gap-tight: var(--s1);

  /* ---- shape ---- */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-pill: 999px;

  /* ---- elevation ----
     Three, used to say "this floats above that" and never as decoration. */
  --e1: 0 1px 2px rgba(0, 0, 0, .35), 0 4px 12px rgba(0, 0, 0, .22);
  --e2: 0 8px 24px rgba(0, 0, 0, .45);
  --e3: 0 28px 64px -20px rgba(0, 0, 0, .6);

  --ring: 0 0 0 2px var(--paper), 0 0 0 4px rgba(86, 140, 238, .75);

  /* The values that cannot be a flat colour: a scrim over the page, the fade
     under a sticky header, the tint of a hovered row, the transparent stop of
     a gradient, and the ink that goes on top of a filled accent. Tokens,
     because the light theme has different answers for all five. */
  --scrim: rgba(4, 10, 17, .58);
  --page-fade: rgba(7, 14, 23, .82);
  --hover-tint: rgba(255, 255, 255, .022);
  --surface-fade: rgba(20, 34, 51, 0);
  --edge-shadow: rgba(0, 0, 0, .35);
  --on-accent: #ffffff;
  /* The faint drafting grid behind the page. It was replaced by its own name
     in a global search-and-replace, which made it circular and switched the
     grid off entirely. */
  --grid-line: rgba(86, 140, 238, .035);
  /* The accent as a halo rather than a fill: the progress bar's own light, and
     the ring that rides the edge of the theme wipe. */
  --accent-glow: rgba(86, 140, 238, .55);

  /* ---- controls ----
     One height for everything a person types into or clicks. A filter bar has
     no reason to be three different heights. */
  --ctl-h: 40px;
  --ctl-h-sm: 32px;
  --ctl-h-lg: 44px;
  --ctl-px: var(--s3);

  --row-h: 40px;

  /* ---- motion ----
     200-300ms is the band where a transition reads as motion rather than as a
     jump or a wait. Everything here collapses to nothing under
     prefers-reduced-motion; see section 2. */
  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 280ms;
  --ease: cubic-bezier(.2, .7, .3, 1);
  --ease-in: cubic-bezier(.4, 0, 1, 1);

  /* ---- stacking ----
     Every z-index in this sheet comes from this list. Screens that invented
     their own numbers are why a select2 menu used to open behind a sticky
     table header. */
  --z-base: 1;
  --z-sticky: 10;
  --z-float: 20;
  --z-header: 1030;
  --z-scrim: 1035;
  --z-nav: 1040;
  --z-loader: 1050;
  --z-dropdown: 1060;
  --z-toast: 1090;
  --z-palette: 1100;
  --z-progress: 1200;

  /* ---- shell metrics ---- */
  --header-h: 56px;
  --nav-w: 296px;
  --nav-rail-w: 64px;

  /* ---- legacy tokens (style.css reads these) ----
     Remapped onto the dark palette rather than deleted, because 423 rules in
     style.css already point at them. --primary-color carries the brand in
     both roles it is used in: a fill behind white text, and a line or label
     on a dark surface. */
  --primary-color: #568cee;
  --secondary-color: #44ccb9;
  --heading-color: #ffffff;
  --white-color: #142233;
  /* "white" now means "the raised surface" - that is how style.css uses it */
  --black-color: #ffffff;
  --input-border-color: #2c4763;
  --header-bg: #0b131f;
  --main-bg: #070e17;
  /* style.css shipped `--main-bg: nav-item #e5eaf2`, which is not a colour */
  --loader-color: rgba(7, 14, 23, .72);
  --box-shadow: var(--e1);

  --body-font: var(--body);
  --heading-font: var(--display);

  /* Bootstrap 5 greys, re-pointed so utility classes stop punching holes in
     the dark surface. The scale is inverted: 100 is now the darkest. */
  --bs-gray-100: #0d1723;
  --bs-gray-200: #182738;
  --bs-gray-300: #1e3247;
  --bs-gray-400: #2c4763;
  --bs-gray-500: #597082;
  --bs-gray-600: #8fa2b2;
  --bs-gray-700: #a9bac8;
  --bs-gray-800: #cfdae4;
  --bs-gray-900: #ffffff;
  --bs-gray: #8fa2b2;
  --bs-gray-dark: #182738;
  --bs-white: #142233;
  --bs-light: #182738;
  --bs-dark: #cfdae4;

  --bs-primary: #568cee;
  --bs-secondary: #8fa2b2;
  --bs-success: #55c298;
  --bs-info: #7fb0d6;
  --bs-warning: #e5a93c;
  --bs-danger: #e57267;
  --bs-blue: #568cee;
  --bs-green: #55c298;
  --bs-red: #e57267;
  --bs-yellow: #e5a93c;
  --bs-teal: #44ccb9;
  --bs-cyan: #7fb0d6;

  --bs-body-color: #ffffff;
  --bs-body-bg: #070e17;
  --bs-border-color: #1e3247;
  --bs-link-color: #568cee;
  --bs-link-hover-color: #4278db;

  --bs-border-radius: var(--r-sm);
  --bs-border-radius-sm: var(--r-sm);
  --bs-border-radius-lg: var(--r-md);
}

/* Narrow screens tighten the page, not the type: the gutter and the card
   padding come down a step, everything else stays legible. */
@media (max-width: 767.98px) {
  :root {
    --gap-page: var(--s4);
    --gap-card: var(--s4);
    --ctl-h: 44px;
    --ctl-h-sm: 36px;
  }
}

/* ---------------------------- 1b. the light theme ------------------------
   Same system, other end of the ramp. Nothing below this block knows which
   theme is on: every rule in the sheet reads a token, so redefining the tokens
   is the whole of it.

   Two rules were followed picking these values. The surfaces go *up* as they
   come forward (sunken, page, card, raised) - the reverse of the dark ramp,
   because on paper a raised thing catches light where on a screen it emits
   it. And the state colours are darkened rather than reused: #55c298 reads
   fine on navy and is 1.9:1 on white, so light mode gets its own six.

   The switch is on <html>. There is no `prefers-color-scheme` default: this is
   a tool people sit in front of all day, so it is their choice and it is
   remembered, not the operating system's. */
html[data-theme="light"] {
  color-scheme: light;

  --paper: #eef2f7;
  --surface: #ffffff;
  --surface-2: #f4f7fa;
  --surface-alt: #e7edf4;
  --navy: #ffffff;
  --navy-2: #f4f7fa;

  --ink: #101c2b;
  --ink-2: #53657c;
  /* 4.6:1 on the page, not 2.8. The dark theme's third step can be this pale
     because it sits on near-black; on a light page the same lightness is a
     hint nobody can read - and --ink-3 is what the breadcrumb, the placeholder
     text and every "no value here" dash are written in. */
  --ink-3: #5e6f85;
  --on-navy: #101c2b;
  --on-navy-dim: #53657c;
  --on-navy-hover: #0b1420;

  --line: #dbe3ec;
  --line-strong: #bcc9d9;

  --accent: #1a63cf;
  --accent-deep: #14509f;
  --accent-hover: #1a63cf;
  --accent-soft: #0d7d72;
  --accent-weak: #e7f0fd;

  --success: #12704b;
  --success-bg: #e2f3ea;
  --warning: #8a5a09;
  --warning-bg: #fbeed6;
  --danger: #ad2721;
  --danger-bg: #fbe8e7;
  --steel: #275f86;
  --steel-bg: #e6eff7;
  --teal: #0d6d66;
  --teal-bg: #e0f2f0;
  --violet: #55458a;
  --violet-bg: #ece7f7;

  /* On a light theme the state colours are the dark half of the pair, so what
     goes on top of one is white - the exact opposite of the dark theme. */
  --on-state: #ffffff;

  --e1: 0 1px 2px rgba(16, 28, 43, .08), 0 4px 12px rgba(16, 28, 43, .06);
  --e2: 0 8px 24px rgba(16, 28, 43, .14);
  --e3: 0 28px 64px -20px rgba(16, 28, 43, .28);
  --ring: 0 0 0 2px var(--paper), 0 0 0 4px rgba(26, 99, 207, .6);

  --scrim: rgba(16, 28, 43, .38);
  --page-fade: rgba(238, 242, 247, .86);
  --hover-tint: rgba(16, 28, 43, .028);
  --surface-fade: rgba(255, 255, 255, 0);
  --edge-shadow: rgba(16, 28, 43, .16);
  --on-accent: #ffffff;
  --grid-line: rgba(26, 99, 207, .045);
  --accent-glow: rgba(26, 99, 207, .45);

  /* The legacy names style.css still reads, on the other side. */
  --primary-color: #1a63cf;
  --secondary-color: #0d7d72;
  --heading-color: #101c2b;
  --white-color: #ffffff;
  --black-color: #101c2b;
  --input-border-color: #bcc9d9;
  --header-bg: #ffffff;
  --main-bg: #eef2f7;
  --loader-color: rgba(238, 242, 247, .76);

  /* Bootstrap's greys, the right way up again. */
  --bs-gray-100: #f8fafc;
  --bs-gray-200: #f1f5f9;
  --bs-gray-300: #e2e8f0;
  --bs-gray-400: #cbd5e1;
  --bs-gray-500: #94a3b8;
  --bs-gray-600: #64748b;
  --bs-gray-700: #475569;
  --bs-gray-800: #334155;
  --bs-gray-900: #0f172a;
  --bs-gray: #64748b;
  --bs-gray-dark: #334155;
  --bs-white: #ffffff;
  --bs-light: #f1f5f9;
  --bs-dark: #1e293b;

  --bs-primary: #1a63cf;
  --bs-secondary: #64748b;
  --bs-success: #12704b;
  --bs-info: #275f86;
  --bs-warning: #8a5a09;
  --bs-danger: #ad2721;
  --bs-blue: #1a63cf;
  --bs-green: #12704b;
  --bs-red: #ad2721;
  --bs-yellow: #8a5a09;
  --bs-teal: #0d7d72;
  --bs-cyan: #275f86;

  --bs-body-color: #101c2b;
  --bs-body-bg: #eef2f7;
  --bs-border-color: #dbe3ec;
  --bs-link-color: #1a63cf;
  --bs-link-hover-color: #14509f;
}

/* The header and the menu are white sheets in light mode, so the two things
   that were painted for a navy bar need saying again. */
html[data-theme="light"] .e-header,
html[data-theme="light"] .erp-nav {
  border-color: var(--line);
}

html[data-theme="light"] .e-header {
  box-shadow: 0 1px 0 var(--line);
}

html[data-theme="light"] .e-header .e-icon,
html[data-theme="light"] .e-btn-bg-white.e-btn-circle {
  background: var(--surface-2) !important;
  border-color: var(--line);
}

/* The wordmark is a white PNG. On a white bar it disappears, so it is inked
   back to the brand colour. */
html[data-theme="light"] .e-header-logo img {
  filter: brightness(0) saturate(100%) invert(24%) sepia(72%) saturate(1900%) hue-rotate(203deg) brightness(92%) contrast(94%);
}

/* CKEditor already ships light; on a light page its frame is the only thing
   that needs to stop looking like an inset panel. */
html[data-theme="light"] .cke_chrome {
  border-color: var(--line-strong) !important;
  box-shadow: none;
}

/* ============================ 2. base ==================================== */

* {
  box-sizing: border-box;
}

*,
::before,
::after {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: var(--r-pill);
  border: 3px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ink-3);
  background-clip: content-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body,
body.main-bg {
  margin: 0;
  font-family: var(--body);
  font-size: var(--t-md);
  line-height: var(--lh-text);
  color: var(--ink);
  background-color: var(--paper);
  /* Faint blueprint grid, same as the enamel console: reads as drafting paper
     and costs nothing to paint. */
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--accent-soft);
  /* --on-state rather than a literal: the highlight is a state colour, and
     the light theme's version of it is the dark half of the pair. Ink picked
     for the dark theme's pale teal is only just legible on it. */
  color: var(--on-state);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--display);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -.005em;
}

h1 {
  font-size: var(--t-2xl);
  line-height: var(--lh-tight);
}

h2 {
  font-size: var(--t-xl);
  line-height: var(--lh-tight);
}

h3,
h4 {
  font-size: var(--t-lg);
  line-height: var(--lh-dense);
}

h5 {
  font-size: var(--t-md);
  line-height: var(--lh-dense);
}

h6 {
  font-size: var(--t-base);
  line-height: var(--lh-dense);
}

p {
  color: var(--ink);
}

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 2px;
}

a:hover,
a:focus {
  color: var(--accent-deep);
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  opacity: 1;
}

small,
.small {
  font-size: var(--t-sm);
}

code,
kbd,
pre,
samp,
.mono {
  font-family: var(--mono);
}

/* One focus treatment for the whole app. Keyboard only - a mouse click on a
   button should not leave a ring behind it. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* Nothing in the interface depends on an animation finishing, so a person who
   has asked their system for less motion gets none of it. */
@media (prefers-reduced-motion: reduce) {

  *,
  ::before,
  ::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

img,
svg,
video {
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

/* Weights are 400, 500 and 600. There is no 700: on a dark background the
   extra weight blooms and reads as a different colour rather than as emphasis,
   and the views reach for `font-weight-bold`, `fw-bold`, `<b>` and `<strong>`
   interchangeably for the same job. */
b,
strong,
.font-weight-bold,
.fw-bold,
.fw-bolder {
  font-weight: 600;
}

.text-muted,
.text-secondary {
  color: var(--ink-2) !important;
}

.text-dark {
  color: var(--ink) !important;
}

.text-white {
  color: var(--on-accent) !important;
}

.text-primary {
  color: var(--accent) !important;
}

.text-success {
  color: var(--success) !important;
}

.text-danger {
  color: var(--danger) !important;
}

.text-warning {
  color: var(--warning) !important;
}

.text-info {
  color: var(--steel) !important;
}

.bg-white,
.bg-light {
  background-color: var(--surface) !important;
  color: var(--ink);
}

/* Bootstrap's "dark" chip. --navy is the header and menu colour, which in the
   light theme is white - so a `.badge.bg-dark` came out as white text on a
   white pill. A neutral chip in both themes instead, which is what every use
   of it in this app actually means. */
.bg-dark {
  background-color: var(--surface-alt) !important;
  color: var(--ink) !important;
}

.badge.bg-dark {
  background-color: var(--surface-alt) !important;
  color: var(--ink-2) !important;
  border: 1px solid var(--line);
}

/* ============================ 3. shell =================================== */

/* Holds the header, the rail and the panel — all three of which are fixed, so
   the element itself contributes nothing but the line box its own whitespace
   would otherwise draw under the header. */
.app-admin-wrap {
  width: 100%;
  height: 0;
  line-height: 0;
}

/* ---- header ---- */
.e-header {
  background-color: var(--navy);
  border-bottom: 1px solid var(--line-strong);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .4);
  height: var(--header-h);
  padding: 0 var(--s4);
  gap: var(--s3);
  flex-wrap: nowrap;
  z-index: var(--z-header);
}

.e-header h5,
.e-header .db-text-color {
  font-family: var(--display);
  font-size: var(--t-md);
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--on-navy) !important;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Three groups, left to right: the menu toggle and the brand, then the search,
   then the clock and the utility icons. The page title used to sit up here; it
   is now in the page head, next to the actions that operate on it. */
.e-header-logo-container {
  min-width: 0;
  flex: 1;
  gap: var(--s3);
}

/* The mark used to be pinned to the centre of the bar, with the page title and
   the search to the left of it and the account to the right. It belongs with
   the menu toggle, at the start. */
.e-header-logo {
  width: 150px;
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--s2);
  text-align: left;
}

.e-header-logo img {
  width: auto;
  max-height: 26px;
}

/* Under a phone width the mark is the first thing to go: the toggle, the
   search and the account icons all have to fit. */
@media (max-width: 700px) {

  .e-header-logo {
    display: none;
  }
}

/* The account block: name, clock, then the three utility buttons. It had no
   gap of its own, so the name ran into the date beside it. */
.e-header > div:last-of-type,
.e-header > .display-flex:last-child {
  gap: var(--s3);
  flex: none;
}

.e-header-user {
  max-width: 200px;
  margin: 0;
}

.e-header-logo p,
.e-header-day {
  font-family: var(--display);
  font-size: var(--t-xs);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.e-header-date-container {
  text-align: right;
  line-height: 1.25;
  margin: 0;
  padding-right: var(--s2);
  border-right: 1px solid var(--line);
}

.e-header-date {
  font-family: var(--mono);
  font-size: var(--t-sm);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  margin: 0;
}

/* The round header buttons. They were white circles on a light bar; on the
   dark bar they become quiet outlines that light up on hover. */
.e-header .e-icon,
.e-btn-bg-white.e-btn-circle {
  width: 34px;
  height: 34px;
  border-radius: var(--r-pill);
  background: var(--navy-2) !important;
  border: 1px solid var(--line-strong);
  box-shadow: none !important;
  color: var(--on-navy-dim);
  position: relative;
  transition: background var(--dur-1), color var(--dur-1), border-color var(--dur-1);
}

.e-header .e-icon:hover {
  background: var(--surface-alt) !important;
  border-color: var(--accent);
  color: var(--accent);
}

.e-header .e-icon i {
  font-size: var(--t-md);
}

/* Unread counters. Absolute inside the button, so they ride along with it
   instead of being positioned against the viewport. */
.e-header .comment-menu-notification {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 var(--s1);
  border-radius: var(--r-pill);
  background: var(--danger) !important;
  color: var(--on-state) !important;
  font-family: var(--mono);
  font-size: var(--t-xs);
  line-height: 16px;
  text-align: center;
  border: 1px solid var(--navy);
}

/* The palette's visible handle, in the header beside the page title. */
.header-search {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  white-space: nowrap;
  gap: var(--s2);
  margin-left: var(--s3);
  padding: var(--s2) var(--s3);
  min-height: 0;
  height: 32px;
  background: var(--navy-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  color: var(--ink-3);
  font-size: var(--t-sm);
  cursor: pointer;
  transition: border-color var(--dur-1), color var(--dur-1), background var(--dur-1);
}

.header-search:hover {
  border-color: var(--accent);
  color: var(--ink);
  background: var(--surface-alt);
}

.header-search i {
  font-size: var(--t-sm);
  color: var(--accent);
}

.header-search kbd {
  font-family: var(--mono);
  font-size: var(--t-xs);
  color: var(--ink-2);
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 2px var(--s1);
}

@media (max-width: 1200px) {

  .header-search span,
  .header-search kbd {
    display: none;
  }

  .header-search {
    padding: var(--s2) var(--s2);
  }
}

.menu-toggle,
.layout-sidebar-large .menu-toggle {
  width: 40px;
  height: 40px;
  margin-right: var(--s2);
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--navy-2);
  color: var(--on-navy);
  justify-content: center;
  transition: background var(--dur-1), color var(--dur-1), border-color var(--dur-1);
}

.menu-toggle:hover {
  background: var(--surface-alt);
  border-color: var(--accent);
  color: var(--accent);
}

.menu-toggle h5 {
  font-size: var(--t-md);
  color: inherit !important;
}

/* ---- navigation ----
   One scrolling menu, off-canvas, over the page. It is built at load out of
   the markup sidebar.blade.php renders for the old icon rail (see
   js/sidebar.js), so the permission checks in that file stay where they are.

   It overlays rather than pushes: opening a menu on a screen carrying a
   20-column table should not reflow the table. */
.erp-nav {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--nav-w);
  max-width: 86vw;
  z-index: var(--z-nav);
  display: flex;
  flex-direction: column;
  background: var(--navy);
  border-right: 1px solid var(--line-strong);
  box-shadow: 4px 0 32px rgba(0, 0, 0, .55);
  transform: translateX(-100%);
  transition: transform .24s cubic-bezier(.2, .8, .2, 1);
}

.erp-nav.open {
  transform: none;
}

.e-header,
.main-content-wrap {
  transition: margin-left .24s cubic-bezier(.2, .8, .2, 1),
              left .24s cubic-bezier(.2, .8, .2, 1),
              width .24s cubic-bezier(.2, .8, .2, 1);
}

.erp-nav-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-scrim);
  background: var(--scrim);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-2) ease, visibility var(--dur-2);
}

.erp-nav-overlay.open {
  opacity: 1;
  visibility: visible;
}

.erp-nav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  padding: var(--s4) var(--s4) var(--s3);
  border-bottom: 1px solid var(--line);
}

.erp-nav-title {
  font-family: var(--display);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
}

.erp-nav-close {
  background: transparent;
  border: none;
  color: var(--on-navy-dim);
  font-size: var(--t-xl);
  line-height: 1;
  padding: 0 var(--s1);
  min-height: 0;
  cursor: pointer;
}

.erp-nav-close:hover {
  color: var(--ink);
}

/* Not a filter box - a button that happens to look like one. Focusing it opens
   the palette, which is the thing that actually searches. */
.erp-nav-search {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin: var(--s3) var(--s4) 0;
  padding: var(--s2) var(--s3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--navy-2);
  color: var(--ink-3);
  cursor: text;
}

.erp-nav-search i {
  font-size: var(--t-sm);
  color: var(--accent);
}

.erp-nav-search input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: var(--t-sm);
  height: auto;
  padding: 0;
}

.erp-nav-search input:focus {
  box-shadow: none;
  outline: none;
}

.erp-nav-search kbd,
.erp-palette kbd {
  font-family: var(--mono);
  font-size: var(--t-xs);
  letter-spacing: .04em;
  color: var(--ink-2);
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 2px var(--s1);
}

.erp-nav-list {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--s3) var(--s3) var(--s6);
  scrollbar-color: #2f5171 transparent;
}

.nav-section {
  margin-bottom: 2px;
}

.nav-section-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  padding: var(--s2) var(--s3);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--on-navy-dim);
  font-family: var(--display);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  min-height: 0;
  transition: background var(--dur-1), color var(--dur-1), border-color var(--dur-1);
}

.nav-section-header:hover {
  background: var(--navy-2);
  color: var(--on-navy);
}

.nav-section.open > .nav-section-header {
  background: var(--accent-weak);
  border-color: var(--accent);
  color: var(--accent);
}

.nav-section-title {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-width: 0;
}

.nav-section-title i {
  font-size: var(--t-md);
  width: 18px;
  text-align: center;
  color: var(--accent);
  flex-shrink: 0;
}

.nav-section-caret {
  font-size: var(--t-xs);
  transition: transform var(--dur-2) ease;
}

.nav-section.open .nav-section-caret {
  transform: rotate(90deg);
}

/* Collapsed groups are not rendered at all rather than merely hidden: ten
   groups of a dozen links each is a lot of layout to keep alive off-screen. */
.nav-section-sub {
  display: none;
  padding: 2px 0 var(--s2) var(--s3);
  margin-left: var(--s2);
  border-left: 1px solid var(--line);
}

.nav-section.open > .nav-section-sub {
  display: block;
}

/* ---- the third level ----
   Masters, and any other group the server wrote as <details> because it grew
   past a screenful. One step further in than a section, quieter, and it opens
   on click or when the page you are on is inside it. */
.nav-subgroup {
  margin: var(--s0) 0;
}

.nav-subgroup-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  padding: var(--s2) var(--s3) var(--s2) var(--s4);
  background: none;
  border: 0;
  border-radius: var(--r-sm);
  color: var(--on-navy-dim);
  font-family: var(--body);
  font-size: var(--t-base);
  text-align: left;
  cursor: pointer;
  min-height: 0;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}

.nav-subgroup-header:hover {
  background: var(--navy-2);
  color: var(--on-navy);
}

.nav-subgroup.open > .nav-subgroup-header {
  color: var(--on-navy);
}

.nav-subgroup-title {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-width: 0;
}

.nav-subgroup-title i {
  width: 17px;
  text-align: center;
  font-size: var(--t-base);
  color: var(--ink-3);
}

.nav-subgroup-caret {
  font-size: 9px;
  color: var(--ink-3);
  transition: transform var(--dur-2) var(--ease);
}

.nav-subgroup.open .nav-subgroup-caret {
  transform: rotate(90deg);
}

.nav-subgroup-sub {
  display: none;
  padding-left: var(--s3);
  margin-left: var(--s4);
  border-left: 1px solid var(--line);
}

.nav-subgroup.open > .nav-subgroup-sub {
  display: block;
}

.erp-nav .nav-item {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s3);
  border-radius: var(--r-sm);
  color: var(--on-navy);
  font-size: var(--t-sm);
  line-height: 1.35;
  text-decoration: none;
  position: relative;
  transition: background var(--dur-1), color var(--dur-1);
}

.erp-nav .nav-item i {
  font-size: var(--t-base);
  width: 17px;
  text-align: center;
  color: var(--ink-3);
  flex-shrink: 0;
  transition: color var(--dur-1);
}

.erp-nav .nav-item:hover {
  background: var(--navy-2);
  color: var(--on-navy-hover);
}

.erp-nav .nav-item:hover i {
  color: var(--accent-soft);
}

.erp-nav .nav-item.active {
  background: var(--accent-deep);
  color: var(--on-accent);
  font-weight: 600;
}

.erp-nav .nav-item.active i {
  color: var(--on-accent);
}

.erp-nav .nav-item.active::before {
  content: "";
  position: absolute;
  left: calc(-1 * var(--s3) - 1px);
  top: 4px;
  bottom: 4px;
  width: 2px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
}

/* A step in a flow that has no screen yet, or a label between steps. */
.erp-nav .nav-note {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s3);
  font-size: var(--t-sm);
  color: var(--ink-3);
}

.erp-nav .nav-note .soon {
  margin-left: auto;
  font-family: var(--display);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 1px var(--s2);
  white-space: nowrap;
}

/* The two-level icon rail that admin/partials/sidebar.blade.php renders.
   sidebar.js reads it - the permission-filtered tree is built there, in 1,200
   lines of Gate::check, and none of that is duplicated in JS - and then removes
   it. Reading works fine on a hidden element; painting it first does not, which
   is why a white rail used to flash across the left of every page before the
   menu appeared. Hidden only when scripts are running: with JS off this is the
   only navigation there is. */
html.js .side-content-wrap,
html.js .sidebar-left,
html.js .sidebar-left-secondary,
html.js .sidebar-overlay {
  display: none !important;
}

/* ---- command palette ----
   Ten groups over a hundred screens: past a certain size the fastest menu is
   a text field. Ctrl+K, Alt+S, or the search box in the menu. */
.erp-palette {
  position: fixed;
  inset: 0;
  z-index: var(--z-palette);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh var(--s4) var(--s4);
  background: var(--scrim);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .16s ease, visibility .16s;
}

.erp-palette.open {
  opacity: 1;
  visibility: visible;
}

.erp-palette-box {
  width: min(560px, 100%);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--e3);
  overflow: hidden;
  transform: translateY(-8px) scale(.99);
  transition: transform var(--dur-2) cubic-bezier(.2, .8, .2, 1);
}

.erp-palette.open .erp-palette-box {
  transform: none;
}

.erp-palette-input {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--line);
}

.erp-palette-input i {
  color: var(--accent);
}

.erp-palette-input input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: var(--t-md);
  height: auto;
  padding: var(--s1) 0;
}

.erp-palette-input input:focus {
  outline: none;
  box-shadow: none;
}

.erp-palette-results {
  max-height: 46vh;
  overflow-y: auto;
  padding: var(--s2);
}

.erp-palette-row {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) var(--s3);
  border-radius: var(--r-sm);
  color: var(--ink);
  text-decoration: none;
  font-size: var(--t-base);
}

.erp-palette-row i {
  color: var(--ink-3);
  width: 18px;
  text-align: center;
  font-size: var(--t-base);
}

.erp-palette-row .l {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.erp-palette-row .g {
  font-family: var(--display);
  font-size: var(--t-xs);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
  flex-shrink: 0;
}

.erp-palette-row.on {
  background: var(--accent-deep);
  color: #fff;
}

.erp-palette-row.on i,
.erp-palette-row.on .g {
  color: rgba(255, 255, 255, .8);
}

.erp-palette-empty {
  padding: var(--s5);
  text-align: center;
  color: var(--ink-2);
  font-size: var(--t-sm);
}

/* ---- the app shell ----
   The window does not scroll. The header is fixed, the content region fills
   exactly what is left of the viewport, and scrolling happens inside it - so
   the header, the menu and the floating buttons never drift, and a screen's
   own furniture (a table's header row, its pager) can be pinned against a
   known edge instead of against a page of unknown length.

   100dvh, not 100vh: on a phone the address bar collapses as you scroll and
   vh keeps measuring the taller window, which leaves a strip of empty page
   below every screen. */
html,
body,
body.main-bg {
  height: 100%;
  overflow: hidden;
}

.main-content-wrap,
.main-content-wrap.sidenav-open {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  bottom: 0;
  float: none;
  width: auto;
  margin: 0;
  min-height: 0;
  padding: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* ---- the page ----
   Rendered by master.blade.php around every screen's own markup, so all 270 of
   them get the same frame whatever they do inside it:

     .page-head      breadcrumb, title, the one primary action
     <the screen>    whatever the view yields
     .page-foot      the pager, on list screens

   Two rules here do most of the work the old screens were each doing by hand.
   The page owns the gutter, so the gap under the header is the same everywhere;
   and the page owns the gaps *between* blocks, so a screen can no longer be a
   few pixels off from its neighbour by writing mb-3 where the last one wrote
   mb-4. Blocks carry no vertical margins of their own. */
.page {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--gap-block);
  padding: var(--gap-page);
  /* Beyond about 1760px a full-width table stops being readable and starts
     being a row of widely separated columns. */
  max-width: 1760px;
  margin-inline: auto;
  min-width: 0;
}

/* ---- a screen whose point is the rows ----
   erp-ux.js marks a page that has one bounded list on it, and here the
   vertical rhythm is spent differently: on a form, 24px of gutter is what
   makes thirty fields readable, and on a list it is a row that is not there.

   Measured, not guessed. On the purchase order list the furniture above the
   table - page gutter, breadcrumb and title, filter bar, a button, a summary
   card, the show/search bar - came to 456px of a 927px content region, so the
   rows had 421px, less than half the screen, and the screen scrolled as well
   as the rows. What follows takes about 50px of that back. Nothing here
   changes a control's size or a font: it is the space between things, and
   only on the screens where that space is competing with data.

   Form screens, dashboards and print keep exactly what they had. */
.page.has-bound-list {
  padding-top: var(--s4);
  padding-bottom: var(--s4);
  gap: var(--s3);
}

/* The breadcrumb and the title stop being a stack with air around it and
   become a heading with its action beside it. */
.page.has-bound-list .page-head {
  min-height: 0;
  align-items: center;
}

.page.has-bound-list .page-title {
  font-size: var(--t-lg);
}

.page.has-bound-list .panel-body-view {
  padding-top: var(--s3);
  padding-bottom: var(--s4);
}

/* Spacing the views wrote by hand before the page owned the gaps: a <br> used
   as a margin, and mb-3 on every filter column. Both are now doubling up with
   the gap the row already has. */
.page.has-bound-list .panel-body-view > br {
  display: none;
}

.page.has-bound-list .panel-body-view > .row > [class*="col-"].mb-3,
.page.has-bound-list .panel-body-view > h5.mb-3 {
  margin-bottom: var(--s2);
}

/* The summary tiles over a list are a number and a word, and they were
   costing 80px of rows to say so. */
.page.has-bound-list .panel-body-view-15 {
  padding: var(--s2) var(--s3);
}

.page.has-bound-list .card-count {
  font-size: var(--t-xl);
}

/* A flex item will not shrink below its content's minimum width unless it is
   told it may. Without this a table wider than the screen pushes the page out
   with it, and the content column - which is supposed to clip - scrolls
   sideways instead of the table scrolling inside its own panel. */
.page > *,
.page section,
.page .row,
.page [class*="col-"],
.e-card,
.card,
.panel-body-view,
.dataTables_wrapper {
  min-width: 0;
}

.page > .container-fluid,
.page > section.container-fluid,
.page > .container {
  padding: 0 !important;
  margin-left: 0;
  margin-right: 0;
  max-width: none;
}

/* A screen that yields several sibling rows gets the page rhythm between them
   rather than whatever margin each row happened to be given. */
.page > section > .row + .row,
.page > .container-fluid > .row + .row {
  margin-top: var(--gap-block);
}

/* ---- page head ---- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--gap-inline);
  flex-wrap: wrap;
  min-height: var(--ctl-h);
}

.page-head-text {
  min-width: 0;
}

.page-title {
  margin: 0;
  font-family: var(--display);
  font-size: var(--t-xl);
  font-weight: 600;
  line-height: var(--lh-tight);
  letter-spacing: -.01em;
  color: var(--ink);
}

/* Filled by sidebar.js out of the menu tree it already built, so the trail a
   person reads is by construction the same one they clicked. */
.crumbs {
  display: flex;
  align-items: center;
  gap: var(--gap-tight);
  flex-wrap: wrap;
  font-size: var(--t-sm);
  color: var(--ink-3);
  margin-bottom: 2px;
  min-height: 16px;
}

.crumbs a {
  color: var(--ink-3);
}

.crumbs a:hover {
  color: var(--accent);
}

.crumbs .sep {
  opacity: .5;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: var(--gap-inline);
  flex-wrap: wrap;
}

.page-actions:empty {
  display: none;
}

/* The primary action for a screen, moved here from the floating "+" by
   erp-ux.js. It reads as a button with a word on it rather than a circle
   parked over the last row of the table. */
.page-actions .btn.plus,
.page-actions .btn.plus-primary {
  position: static;
  width: auto;
  height: var(--ctl-h);
  min-height: var(--ctl-h);
  border-radius: var(--r-sm);
  box-shadow: none;
}

/* The opt-in bar, moved here out of the fixed-position shell — it used to
   render at the very top of the document, behind the header, where nobody
   could read it. */
/* It appears on every screen until someone grants permission, so it is a line
   of information rather than an alarm: one hairline, one tinted edge, the same
   height as a control. A full-width amber box at the top of all 150 screens
   competes with the screen. */
.notify-optin-bar {
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--warning);
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: var(--t-sm);
  padding: var(--s2) var(--s3);
  margin-bottom: 0;
}

.notify-optin-bar strong,
.notify-optin-bar b {
  color: var(--ink);
}

.notify-optin-icon {
  color: var(--warning);
}

.notify-optin-btn {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  border-radius: var(--r-sm);
  padding: var(--s1) var(--s3);
  font-size: var(--t-xs);
  min-height: 0;
  white-space: nowrap;
}

.notify-optin-close {
  background: transparent;
  border: 0;
  color: var(--ink-3);
  border-radius: var(--r-sm);
  padding: var(--s1) var(--s2);
  font-size: var(--t-sm);
  min-height: 0;
}

.notify-optin-btn:hover {
  background: var(--accent-weak);
  border-color: var(--accent);
  color: var(--accent);
}

.notify-optin-close:hover {
  background: var(--surface-alt);
  color: var(--ink);
}

.notify-optin-close {
  border: none;
  margin-left: auto;
}

/* ============================ 4. layout ================================== */

/* `col-mg-*` appears 587 times across the views — a typo for `col-md-*` that
   no stylesheet has ever defined, so every one of those columns silently fell
   back to full width. Aliasing it is a one-block fix; correcting 587 call
   sites is not. New markup should use col-md-*. */
@media (min-width: 768px) {

  .col-mg-1,
  .col-mg-2,
  .col-mg-3,
  .col-mg-4,
  .col-mg-5,
  .col-mg-6,
  .col-mg-7,
  .col-mg-8,
  .col-mg-9,
  .col-mg-10,
  .col-mg-11,
  .col-mg-12 {
    flex: 0 0 auto;
  }

  .col-mg-1 {
    width: 8.33333333%;
  }

  .col-mg-2 {
    width: 16.66666667%;
  }

  .col-mg-3 {
    width: 25%;
  }

  .col-mg-4 {
    width: 33.33333333%;
  }

  .col-mg-5 {
    width: 41.66666667%;
  }

  .col-mg-6 {
    width: 50%;
  }

  .col-mg-7 {
    width: 58.33333333%;
  }

  .col-mg-8 {
    width: 66.66666667%;
  }

  .col-mg-9 {
    width: 75%;
  }

  .col-mg-10 {
    width: 83.33333333%;
  }

  .col-mg-11 {
    width: 91.66666667%;
  }

  .col-mg-12 {
    width: 100%;
  }

  /* A five-across row. Bootstrap's twelve columns cannot express a fifth, and
     the inquiry dashboard asks for one by name — undefined until now, which is
     why its five tiles stacked two-up. */
  .col-md-2-4 {
    flex: 0 0 auto;
    width: 20%;
  }
}

@media (max-width: 767.98px) {

  .col-md-2-4 {
    width: 100%;
  }
}

/* ============================ 5. components ============================== */

/* ---- cards ---- */

/* Several dashboards build a stat tile by putting a *button* background class
   on a card - .e-card.e-btn-bg-secondary - which painted the tile in the
   accent colour and then wrote accent-coloured labels on top of it. A card is
   a card whatever else it is wearing. */
.e-card.e-btn-bg-primary,
.e-card.e-btn-bg-secondary,
.e-card.e-btn-bg-white {
  background-color: var(--surface-alt) !important;
  border: 1px solid var(--line);
  color: var(--ink);
}

/* .btn-text-white is put on stat tiles as well as on buttons - on a tile it
   was painting the label white on a white card, so inside a card it inherits
   the card's ink instead. A real button is excluded: it is a filled accent
   block, and white is exactly what belongs on it. */
.e-card .btn-text-white:not(.btn):not(.e-btn):not(button),
.e-card .btn-text-white:not(.btn):not(.e-btn):not(button) * {
  /* Named, not inherited. `inherit` is only as good as whatever the card's own
     colour happens to be, and on the payable report that was white. */
  color: var(--ink) !important;
}

.e-card,
.card {
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--e1);
  color: var(--ink);
  /* The page spaces its blocks - see .page in section 3. A card that also
     carries its own bottom margin is how two screens end up 8px apart. */
  margin-bottom: 0;
}

/* A card inside a card is not a card. The summary tiles on the list screens
   sit inside the panel that holds the table, and drawn as full cards - border,
   radius, shadow and their own padding - they read as three stacked layers,
   which is what "components on top of components" looks like. One tint and one
   hairline instead. */
.e-card .e-card,
.e-card .card,
.card .e-card,
.card .card,
.e-card .e-card.e-btn-bg-primary,
.e-card .e-card.e-btn-bg-secondary,
.e-card .e-card.e-btn-bg-white {
  background-color: var(--surface-2) !important;
  border-color: var(--line);
  border-radius: var(--r-sm);
  box-shadow: none;
}

.e-card .e-card:hover {
  border-color: var(--line-strong);
}

.card-header {
  background: var(--surface-alt);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--display);
  font-weight: 600;
  padding: var(--s3) var(--s4);
}

.card-footer {
  background: var(--surface-alt);
  border-top: 1px solid var(--line);
  padding: var(--s3) var(--s4);
}

/* One inner padding for every panel, whatever the screen calls it. -15 was a
   second, slightly different padding for the same job. */
.panel-body-view,
.panel-body-view-15,
.filter-card,
.crm-section-card {
  padding: var(--gap-card);
}

/* Inside a tile the padding comes down a step - a tile is a label and a
   number, not a panel. */
.e-card .e-card > .panel-body-view,
.e-card .e-card > .panel-body-view-15 {
  padding: var(--s3) var(--s4);
}

/* A card heading, wherever a page draws one with a flex header. */
.table-header,
.table-footer {
  align-items: center;
  gap: var(--s3);
  flex-wrap: wrap;
}

.table-header {
  padding-bottom: var(--s3);
  margin-bottom: var(--s3);
  border-bottom: 1px solid var(--line);
}

.table-header h1,
.table-header h2,
.table-header h3,
.table-header h4,
.table-header h5 {
  margin: 0;
  font-size: var(--t-lg);
}

/* A filter bar is a panel like any other. Several screens style it themselves
   because the theme only gave it padding; the surface belongs here, once. */
.filter-card,
.crm-section-card {
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--ink);
}

.e-card .filter-card,
.card .filter-card,
.e-card .crm-section-card {
  background-color: var(--surface-2);
  border-radius: var(--r-sm);
}

/* ---- the dashboard ----
   No figures, because there are none worth inventing yet. What it offers is
   the way in: the modules this account can reach, grouped the way the menu
   groups them, filled by sidebar.js out of the permission-filtered tree. */
.home-hub-head h2 {
  margin: 0 0 var(--s1);
  font-size: var(--t-xl);
}

.home-hub-head p {
  margin: 0 0 var(--s5);
  color: var(--ink-2);
  font-size: var(--t-md);
}

.home-hub-key {
  border: 0;
  background: none;
  padding: 0;
  min-height: 0;
  cursor: pointer;
}

.home-hub-key kbd {
  font-family: var(--mono);
  font-size: var(--t-xs);
  color: var(--ink-2);
  background: var(--surface-alt);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  padding: 2px var(--s1);
  margin: 0 1px;
}

.home-hub-key:hover kbd {
  border-color: var(--accent);
  color: var(--accent);
}

.home-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--gap-block);
}

.home-hub-card {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  padding: var(--gap-card);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--ink);
  transition: border-color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease),
              box-shadow var(--dur-1) var(--ease);
}

.home-hub-card:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: var(--e1);
  color: var(--ink);
}

.home-hub-card-head {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-family: var(--display);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
}

.home-hub-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1) var(--s2);
  font-size: var(--t-sm);
  color: var(--ink-2);
  line-height: 1.5;
}

.home-hub-links > span::after {
  content: "·";
  margin-left: var(--s2);
  color: var(--ink-3);
}

.home-hub-links > span:last-child::after {
  content: none;
}

.home-hub-links .more {
  color: var(--ink-3);
}

/* ---- the dashboard's figures (17/10/2026) ----
   Above the hub: "waiting for you", then one block per area the account may open. The server
   sends only what the user's permissions allow (App\Services\Dashboard\DashboardService); this
   only lays it out. Tokens only - both themes. docs/dashboard/ has the spec. */
.dash {
  display: grid;
  gap: var(--gap-block);
  margin-bottom: var(--s6);
}

.dash:empty { display: none; }

.dash-loading,
.dash-error {
  margin: 0;
  padding: var(--gap-card);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  color: var(--ink-2);
  font-size: var(--t-sm);
}

.dash-error button { margin-left: var(--s2); }

.dash-approvals {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2) var(--s3);
  padding: var(--s3) var(--gap-card);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--r-md);
}

.dash-approvals h2 {
  margin: 0 var(--s2) 0 0;
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--ink);
}

.dash-ap {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  min-height: 44px;
  padding: var(--s1) var(--s3) var(--s1) var(--s1);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--ink);
  font-size: var(--t-sm);
  text-decoration: none;
}

.dash-ap:hover { border-color: var(--accent); color: var(--ink); }

.dash-ap b {
  min-width: 34px;
  height: 34px;
  padding: 0 var(--s2);
  display: inline-grid;
  place-items: center;
  border-radius: var(--r-pill);
  background: var(--accent-deep);
  color: var(--on-accent);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.dash-ap.is-zero b { background: var(--surface-alt); color: var(--ink-3); }

.dash-section { display: grid; gap: var(--s3); }

.dash-section > h2 {
  margin: var(--s2) 0 0;
  font-family: var(--display);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
}

html[lang="hi"] .dash-section > h2,
html[lang="gu"] .dash-section > h2 { letter-spacing: 0; text-transform: none; font-size: var(--t-sm); }

.dash-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: var(--gap-block);
}

.dash-tile {
  display: grid;
  align-content: start;
  gap: var(--s1);
  min-height: 108px;
  padding: var(--s3) var(--gap-card);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--ink);
  text-decoration: none;
}

a.dash-tile:hover { border-color: var(--accent); color: var(--ink); }
.dash-tile.is-alert { border-top: 3px solid var(--danger); }
.dash-tile.is-warn { border-top: 3px solid var(--warning); }

.dash-tile .lbl { font-size: var(--t-sm); color: var(--ink-2); }

.dash-tile .val {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--t-2xl);
  font-weight: 500;
  line-height: 1.15;
}

.dash-tile .val.is-na { color: var(--ink-3); }
.dash-tile .sub { font-size: var(--t-xs); color: var(--ink-3); }

.dash-panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  gap: var(--gap-block);
}

.dash-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.dash-panel.is-wide { grid-column: 1 / -1; }

.dash-panel-h {
  display: flex;
  align-items: baseline;
  gap: var(--s2);
  padding: var(--s3) var(--gap-card) var(--s2);
  border-bottom: 1px solid var(--line);
}

.dash-panel-h h3 { margin: 0; font-size: var(--t-md); font-weight: 600; }
.dash-panel-h .n { font-family: var(--mono); font-size: var(--t-sm); color: var(--ink-2); }

.dash-panel-b { padding: var(--s2) var(--gap-card) var(--s3); min-width: 0; overflow-x: auto; }

.dash-panel-f {
  margin-top: auto;
  padding: var(--s2) var(--gap-card);
  border-top: 1px solid var(--line);
  font-size: var(--t-sm);
}

.dash-panel-f a { font-weight: 500; text-decoration: none; }

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

.dash-table th {
  padding: var(--s2) var(--s2) var(--s1) 0;
  text-align: left;
  font-size: var(--t-xs);
  font-weight: 500;
  color: var(--ink-3);
  white-space: nowrap;
}

.dash-table td {
  padding: var(--s2) var(--s2) var(--s2) 0;
  border-top: 1px solid var(--line);
  vertical-align: top;
  color: var(--ink);
}

.dash-table .r { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.dash-table .code { font-family: var(--mono); color: var(--accent); white-space: nowrap; }
.dash-table .muted { display: block; font-size: var(--t-xs); color: var(--ink-3); }

.dash-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px var(--s2) 2px 6px;
  border-radius: var(--r-pill);
  font-size: var(--t-xs);
  font-weight: 600;
  white-space: nowrap;
}

.dash-badge::before { font-size: 10px; line-height: 1; }
.dash-badge.is-danger { color: var(--danger); background: var(--danger-bg); }
.dash-badge.is-danger::before { content: "▲"; }
.dash-badge.is-warn { color: var(--warning); background: var(--warning-bg); }
.dash-badge.is-warn::before { content: "◷"; }
.dash-badge.is-ok { color: var(--success); background: var(--success-bg); }
.dash-badge.is-ok::before { content: "✓"; }
.dash-badge.is-neutral { color: var(--ink-2); background: var(--surface-alt); }
.dash-badge.is-neutral::before { content: "–"; }

.dash-bars { display: grid; gap: var(--s2); margin: 0; padding: var(--s1) 0 0; list-style: none; }

.dash-bar {
  display: grid;
  grid-template-columns: minmax(90px, 32%) 1fr auto;
  align-items: center;
  gap: var(--s2);
  font-size: var(--t-sm);
}

.dash-bar .bl { color: var(--ink-2); overflow-wrap: anywhere; }
.dash-bar .track { position: relative; height: 14px; background: var(--surface-alt); border-radius: 0 4px 4px 0; }
.dash-bar .fill { position: absolute; inset: 0 auto 0 0; min-width: 2px; background: var(--accent-deep); border-radius: 0 4px 4px 0; }
.dash-bar .bv { min-width: 3ch; text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.dash-bars-note { margin: var(--s2) 0 0; font-size: var(--t-xs); color: var(--ink-3); }

.home-hub-title {
  margin: 0 0 var(--s3);
  font-family: var(--display);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-2);
}

html[lang="hi"] .home-hub-title,
html[lang="gu"] .home-hub-title { letter-spacing: 0; text-transform: none; font-size: var(--t-sm); }

@media (max-width: 600px) {
  .dash-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-tile { min-height: 92px; padding: var(--s3); }
  .dash-tile .val { font-size: var(--t-xl); }
}

/* ---- stat tiles ----
   The dashboards build these out of .card-icon / .card-count /
   .card-count-text inside an .e-card. */
/* The icon on a summary tile is a label, not a control. Quiet, in a tinted
   disc, so the number is the thing the eye lands on. */
.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: var(--r-pill);
  background: var(--accent-weak);
}

.card-icon i {
  font-size: var(--t-lg);
  color: var(--accent);
}

/* The figure on a tile. A rupee total in tabular mono is wide; on a third of
   a tablet it has to be allowed to shrink and to break, or it pushes the tile
   - and with it the page - past the edge of the screen. */
.e-card .card-content,
.card .card-content {
  min-width: 0;
}

.card-count {
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: var(--t-2xl);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  color: var(--ink);
}

/* The caption over a figure. It was --accent, which is the interaction
   colour: on a screen where blue means "this does something", a blue caption
   over a number that does nothing is a false signal. */
.card-count-text {
  font-family: var(--display);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 0 0 2px;
}

/* ---- forms ---- */
label,
.e-form-label,
.crm-input-label,
.form-label {
  font-family: var(--display);
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: .07em;
  text-transform: uppercase;
}

.e-input-container,
.e-form-input-container,
.crm-form-group,
.form-group {
  position: relative;
}

input,
select,
textarea,
.form-control,
.form-select,
.e-form-input,
.e-text-area,
.e-form-input-square,
.e-form-input-outline,
.e-form-input-bg,
.e-form-input-rounded {
  font-family: var(--body);
  font-size: var(--t-base);
  color: var(--ink);
  background-color: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  transition: border-color var(--dur-1), box-shadow var(--dur-1);
}

/* style.css gives .e-form-input a 2px --primary-color border; one hairline is
   enough at this density.

   The background stays transparent on purpose. These fields carry a floating
   label that sits *behind* the input at rest (z-index:-1 in style.css) and
   only lifts out in front once the field has focus or a value — which is what
   puts the field's name on screen in the first place. Fill the input and the
   resting label disappears behind it, leaving an unlabelled box. */
.e-form-input,
.e-text-area,
.form-control,
.form-select {
  border-width: 1px;
  padding: 0 var(--ctl-px);
  height: var(--ctl-h);
}

/* Anything sitting inside a floating-label container is transparent, not just
   the fields that happen to carry .e-form-input. The label rests *behind* the
   field (z-index:-1 in style.css) and only lifts out in front once the field
   has focus or a value - so an opaque field with a plain .form-control on it
   simply hid its own label, and the screen showed two unlabelled boxes. */
/* The fields inside these containers used to be forced transparent, so that a
   label parked behind them at z-index:-1 could show through. That rig is gone
   from style.css and the label is above the field now, so a field can simply
   look like a field. */
.e-form-input,
.e-text-area,
.e-input-container input,
.e-input-container select,
.e-input-container textarea,
.e-form-input-container input,
.e-form-input-container select,
.crm-form-group input,
.crm-form-group select,
.crm-form-group textarea {
  background-color: var(--surface-2);
}

.form-control,
.form-select {
  background-color: var(--surface-2);
}

/* .e-text-area is put on <select> as often as on <textarea> in these views,
   and a 80px-tall drop-down is not what anyone meant. */
textarea.e-text-area,
textarea.form-control,
textarea {
  height: auto !important;
  min-height: 80px;
  padding: var(--s3) var(--ctl-px);
}

/* .e-text-area is put on <select> as often as on <textarea> in these views,
   and style.css gives that class `height: auto !important` - which is why
   every drop-down on a create form was 21px tall while the text inputs beside
   it were 40. Matching !important is the only thing that reaches it. */
select.e-text-area,
select.e-form-input,
select.form-control,
select {
  height: var(--ctl-h);
  min-height: 0;
  padding: 0 var(--ctl-px);
  line-height: normal;
}

/* One radius for every control. The views pick between -rounded (a 2rem pill)
   and -square (0.5rem) more or less at random, so two fields in the same row
   are frequently different shapes. */
.e-form-input-rounded,
.e-form-input-square,
.e-form-input-outline,
.e-form-input-bg {
  border-radius: var(--r-sm);
}

input::placeholder,
textarea::placeholder,
.form-control::placeholder {
  color: var(--ink-3);
  opacity: 1;
}

input:hover,
select:hover,
textarea:hover,
.form-control:hover,
.e-form-input:hover {
  border-color: var(--accent-soft);
}

input:focus,
select:focus,
textarea:focus,
.form-control:focus,
.form-select:focus,
.e-form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
  background-color: var(--surface-2);
  color: var(--ink);
}

input:disabled,
select:disabled,
textarea:disabled,
.form-control:disabled,
.form-control[readonly] {
  background-color: var(--navy-2);
  color: var(--ink-2);
  cursor: not-allowed;
}

input[type=checkbox],
input[type=radio] {
  width: auto;
  height: auto;
  accent-color: var(--accent);
}

/* The native file control is a text field with a button welded to its left.
   Left alone it renders at a different height from everything beside it and
   spills onto a second line inside its container. */
input[type=file] {
  height: var(--ctl-h);
  padding: 0;
  overflow: hidden;
  font-size: var(--t-sm);
}

input[type=file]::file-selector-button {
  height: 100%;
  margin: 0 var(--s3) 0 0;
  padding: 0 var(--s4);
  border: 0;
  border-right: 1px solid var(--line-strong);
  background: var(--surface-alt);
  color: var(--ink-2);
  font-family: var(--body);
  font-size: var(--t-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}

input[type=file]::file-selector-button:hover {
  background: var(--accent-weak);
  color: var(--accent);
}

input[type=date],
input[type=time],
input[type=datetime-local] {
  /* Chrome's picker glyph is near-black and vanishes on the dark field. */
  color-scheme: dark;
}

/* ---- labels ----
   Above the field, not floating inside it.

   style.css builds a Material-style floating label: absolutely positioned over
   the input, parked at z-index:-1 while the field is empty so it reads as a
   placeholder, lifting onto the top border once the field has a value. Three
   things go wrong with it here, and they were on every form in the app:

     * At rest it is *behind* the field. That works only while the field is
       transparent; on a dark theme the field paints, and whole rows of inputs
       came up with no label at all.
     * A <select> is never :placeholder-shown, so its label is permanently in
       the lifted position, straddling the border with a background chip that
       has to match whatever surface happens to be behind it.
     * Lifted, it is 0.8rem of text sitting on a 1px line. On a dense two
       column form the label of one row lands against the field of the row
       above it.

   A label above its control costs one line of height and none of that. It is
   also what a data-entry form wants: the eye reads down a column of labels,
   not around the inside of forty boxes. */
.e-input-container,
.e-form-input-container,
.crm-form-group {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--gap-tight);
}

/* Whatever actually holds the label becomes the column, not just the outer
   container. A date field wraps its input and label four divs down, inside an
   .input-group with a calendar button beside them; keeping this to a child
   selector left those labels behind the field, invisible, which is how two of
   the fields on the purchase-order form came up with no label at all. */
.e-input-container *:has(> .e-form-label),
.e-form-input-container *:has(> .e-form-label),
.crm-form-group *:has(> .e-form-label) {
  display: flex;
  flex-direction: column;
  gap: var(--gap-tight);
  min-width: 0;
}

.e-form-label,
.crm-input-label {
  /* The container is a column and the label is written after its field in the
     markup, so this is what puts it on top. */
  order: -1;
  margin: 0;
  padding: 0;
  color: var(--ink-2);
  font-size: var(--t-xs);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The field is focused, so its label is too. */
.e-input-container:focus-within .e-form-label,
.e-form-input-container:focus-within .e-form-label,
.crm-form-group:focus-within .e-form-label {
  color: var(--accent);
}

/* The calendar / search button welded to the side of a field. Now that the
   label sits above the input, an addon stretched to the full height of the
   container reaches up beside the label; it belongs against the field. */
.e-input-container .input-group-addon,
.e-input-container .input-group-append,
.e-input-container .input-group-text,
.e-form-input-container .input-group-addon,
.e-form-input-container .input-group-append {
  align-self: flex-end;
  flex: none;
}

.input-group-text {
  height: var(--ctl-h);
  display: inline-flex;
  align-items: center;
}

/* A required marker is a red star, not part of the label's own colour. */
.e-form-label span[style*="danger"],
.e-form-label span[style*="color"] {
  color: var(--danger) !important;
}

.invalid-feedback,
.err-msg {
  display: block;
  font-size: var(--t-xs);
  color: var(--danger);
  font-style: normal;
  font-weight: 500;
  margin-top: var(--s1);
}

.is-invalid,
input.invalid {
  border-color: var(--danger) !important;
  background-color: var(--danger-bg) !important;
}

.input-group-text {
  background: var(--surface-alt);
  border: 1px solid var(--line-strong);
  color: var(--ink-2);
  height: var(--ctl-h);
}

.custom-file-label,
.form-check-label {
  color: var(--ink);
}

.form-check-input {
  background-color: var(--surface-2);
  border-color: var(--line-strong);
}

.form-check-input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}

/* ---- buttons ----
   One button geometry for the whole app. .e-btn shipped as a 3rem-tall flex
   box, .btn as Bootstrap's; they now agree. */
.btn,
.e-btn,
button.btn {
  font-family: var(--body);
  font-weight: 600;
  font-size: var(--t-base);
  line-height: 1.2;
  height: var(--ctl-h);
  min-height: var(--ctl-h);
  padding: 0 var(--s4);
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-tight);
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--dur-1) var(--ease),
              filter var(--dur-1) var(--ease),
              border-color var(--dur-1) var(--ease),
              transform 60ms var(--ease);
}

.btn:active,
.e-btn:active {
  transform: translateY(1px);
}

/* Pressed, checked, and the open state of a dropdown toggle. style.css defines
   eight sets of these against the old palette; without an answer here a
   pressed button flashes back to the light theme's blue. One rule: a pressed
   button is the same button, a shade deeper. */
.btn:active,
.btn.active,
.btn:not(:disabled):not(.disabled):active,
.btn-check:checked + .btn,
.btn-check:active + .btn,
.show > .btn.dropdown-toggle {
  filter: brightness(.88);
  box-shadow: none !important;
}

/* The eight `box-shadow: 0 8px 25px -8px <colour>` glows style.css puts under
   every button on hover. On a dark surface a coloured halo under a 40px button
   reads as a rendering fault, not as depth. */
.btn:hover,
.btn:focus,
.e-btn:hover,
.e-btn:focus {
  box-shadow: none !important;
}

.btn:disabled,
button:disabled,
.btn.disabled {
  opacity: .42;
  cursor: not-allowed;
  transform: none;
}

.e-btn-rounded {
  border-radius: var(--r-sm);
}

/* The views ask for 20% and 100% widths on buttons; 20% of a wide screen is a
   very odd button, so the narrow one becomes a sensible minimum instead. */
.e-btn-width-20 {
  width: auto;
  min-width: 160px;
}

.e-btn-width-100,
.e-width-100 {
  width: 100%;
}

.btn-primary,
.e-btn-bg-primary,
.btn-primary:focus,
.e-btn-bg-primary:focus {
  background-color: var(--accent-deep);
  border-color: var(--accent-deep);
  color: var(--on-accent) !important;
}

.btn-primary:hover,
.e-btn-bg-primary:hover {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--on-accent) !important;
}

/* The second button in a pair - Reset beside Filter, Cancel beside Save. It
   has to read as a button on a card, which a transparent box with a hairline
   round it does not quite manage. */
.btn-secondary,
.e-btn-bg-secondary {
  background-color: var(--surface-2);
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-secondary:hover,
.e-btn-bg-secondary:hover {
  background-color: var(--surface-alt);
  border-color: var(--accent-soft);
  color: var(--ink);
}

.btn-success {
  background-color: transparent;
  border-color: var(--success);
  color: var(--success);
}

.btn-success:hover {
  background-color: var(--success-bg);
  color: var(--success);
}

.btn-danger {
  background-color: transparent;
  border-color: var(--danger);
  color: var(--danger);
}

.btn-danger:hover {
  background-color: var(--danger-bg);
  color: var(--danger);
}

.btn-warning {
  background-color: transparent;
  border-color: var(--warning);
  color: var(--warning);
}

.btn-warning:hover {
  background-color: var(--warning-bg);
  color: var(--warning);
}

.btn-info {
  background-color: transparent;
  border-color: var(--steel);
  color: var(--steel);
}

.btn-info:hover {
  background-color: var(--steel-bg);
  color: var(--steel);
}

.btn-light,
.btn-outline-secondary,
.btn-outline-light {
  background-color: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-light:hover,
.btn-outline-secondary:hover,
.btn-outline-light:hover {
  background-color: var(--surface-alt);
  color: var(--ink);
}

.btn-dark {
  background-color: var(--navy-2);
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-dark:hover {
  background-color: var(--surface-alt);
  color: var(--ink);
}

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

.btn-outline-primary:hover {
  background-color: var(--accent-weak);
  color: var(--accent);
}

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

.btn-outline-danger:hover {
  background-color: var(--danger-bg);
  color: var(--danger);
}

.btn-sm,
.btn-group-sm > .btn {
  min-height: 30px;
  padding: var(--s1) var(--s3);
  font-size: var(--t-sm);
}

.btn-lg {
  min-height: 46px;
  padding: var(--s3) var(--s5);
  font-size: var(--t-md);
}

/* Only ever correct on something with an accent fill behind it. Inside a card
   the rule above wins, because there the class is being used as a label. */
.btn-text-white {
  color: var(--on-accent) !important;
}

.e-btn-border-primary {
  border-color: var(--accent);
}

/* The action buttons inside table rows: square, icon-sized, quiet until
   hovered. Most row actions in the ERP are an <a> or <button> carrying only an
   icon. */
td .btn.btn-sm,
td .e-btn.btn-sm,
.action-btn {
  min-height: 28px;
  padding: var(--s1) var(--s2);
}

/* The floating "add" button is gone. Seventy list screens rendered a bare "+"
   in a circle, fixed to the bottom-right corner, where it covered the last row
   of the table and the right-hand end of the pager, and told a person who had
   not used the screen before nothing at all about what it would add.

   erp-ux.js moves the link out of .plus-container and into .page-actions, where
   it becomes the labelled primary action for the screen. The container itself
   is left in the markup - 70 views render it - and hidden here, so no view
   needs editing and nothing depends on the move having happened.

   The rules below only still exist for the split second before that script
   runs, and for the back-to-top button, which is genuinely floating. */
.plus-container {
  position: fixed;
  left: auto;
  right: var(--s5);
  bottom: calc(var(--s5) + env(safe-area-inset-bottom));
  width: auto;
  z-index: var(--z-float);
  visibility: hidden;
}

.page-actions .plus-container {
  position: static;
  visibility: visible;
  z-index: auto;
}

#erp-top {
  right: var(--s5);
  bottom: calc(var(--s5) + env(safe-area-inset-bottom));
}

body:has(.dtx-foot) #erp-top {
  bottom: calc(76px + env(safe-area-inset-bottom));
}

/* In the page head it is the screen's primary action: a normal button, one
   height with everything beside it, with a word on it. */
.page-actions .plus,
.page-actions .plus-primary {
  width: auto;
  height: var(--ctl-h);
  min-height: var(--ctl-h);
  padding: 0 var(--s4);
  border-radius: var(--r-sm);
  background: var(--accent-deep) !important;
  border-color: var(--accent-deep) !important;
  color: #fff !important;
  box-shadow: none;
}

.page-actions .plus:hover {
  filter: brightness(1.12);
}

/* The circle, for the moment before erp-ux.js moves it. */
.plus,
.plus-primary {
  width: 52px;
  height: 52px;
  border-radius: var(--r-pill);
  background: var(--accent-deep) !important;
  border-color: var(--accent-deep) !important;
  color: #fff !important;
  box-shadow: var(--e2);
  padding: 0;
  min-height: 0;
}

.plus:hover {
  background: var(--accent) !important;
}

/* The round add/remove buttons on the repeatable rows of the long forms.
   style.css gives them a size, a radius and a border but never a fill, so
   they were left showing the browser's own control colour - which follows
   `color-scheme`, and on the dark theme that is a flat mid-grey (#6b6b6b)
   belonging to no palette, with a blue "+" on it at about 1.6:1. Naming the
   surface fixes both: the chip becomes part of the card in either theme, and
   the icon has something to sit on. The hover state is already tokenised in
   style.css, so it follows on its own. */
.btn_round {
  background: var(--surface-alt);
  color: var(--ink-2);
}

/* ---- tables ---- */
.table,
table.dataTable {
  width: 100%;
  color: var(--ink);
  font-size: var(--t-sm);
  border-collapse: collapse;
  margin-bottom: 0;
  --bs-table-bg: transparent;
  --bs-table-color: var(--ink);
  --bs-table-striped-bg: var(--hover-tint);
  --bs-table-striped-color: var(--ink);
  --bs-table-hover-bg: var(--surface-alt);
  --bs-table-hover-color: var(--ink);
  --bs-table-border-color: var(--line);
}

.table > :not(caption) > * > * {
  background-color: transparent;
  color: var(--ink);
  box-shadow: none;
}

.table thead th,
table.dataTable thead th,
.table .thead-dark th {
  font-family: var(--display);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-2);
  background-color: var(--surface-alt);
  border-bottom: 1px solid var(--line-strong) !important;
  border-color: var(--line-strong);
  padding: var(--s3) var(--s3);
  white-space: nowrap;
  vertical-align: middle;
}

.table tbody td,
table.dataTable tbody td {
  padding: var(--s2) var(--s3);
  border-bottom: 1px solid var(--line);
  border-color: var(--line);
  vertical-align: middle;
}

.table-bordered,
.table-bordered td,
.table-bordered th {
  border: 1px solid var(--line);
}

.table-striped > tbody > tr:nth-of-type(odd) > *,
.table-striped tbody tr:nth-of-type(odd) {
  background-color: var(--hover-tint);
}

.table-hover > tbody > tr:hover > *,
.table tbody tr:hover {
  background-color: var(--surface-alt);
  color: var(--ink);
}

.table-dark {
  background-color: var(--navy-2);
  color: var(--ink);
}

/* A row that is hundreds of pixels tall - a role and every permission it
   holds, a BOM and its lines - centres its short cells in the middle of all
   that height, where they sit far below anything else on screen. Those cells
   belong at the top, beside the first line of the tall one. */
.table tbody tr:has(td .badge + .badge) td,
.table tbody tr:has(td ul) td,
.table.align-top tbody td {
  vertical-align: top;
}

/* Numbers line up on the decimal point or they are not worth printing. */
.table td.num,
.table th.num,
.table .text-end,
td.text-end,
.num-strong {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table td.num,
.num-strong {
  font-family: var(--mono);
}

/* Every table scrolls inside its own box. The page body never scrolls
   sideways, whatever a 20-column report decides to do.

   The shadows are the enamel console's: they appear at whichever edge still
   has content behind it, so a table that runs off the side says so instead of
   looking like it simply ends there. `local` attachment is what makes them
   track the scroll. */
/* 97 views put .table-responsive on the <table> itself rather than on a
   wrapper around it. Bootstrap's rule for that class is `display: block;
   overflow-x: auto`, so those tables stop being tables: the columns no longer
   size against each other, the widths DataTables measured are ignored, and the
   action column - the last one, the one every row's buttons live in - is the
   one that ends up past the right edge. The table goes back to being a table;
   the scrolling is done by the .dt-scroll box around it. */
table.table-responsive {
  display: table;
  width: 100%;
  overflow: visible;
}

div.table-responsive,
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--r-sm);
  background:
    linear-gradient(to right, var(--surface) 30%, var(--surface-fade)),
    linear-gradient(to right, var(--surface-fade), var(--surface) 70%) 100% 0,
    radial-gradient(farthest-side at 0 50%, var(--edge-shadow), transparent),
    radial-gradient(farthest-side at 100% 50%, var(--edge-shadow), transparent) 100% 0;
  background-repeat: no-repeat;
  background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
}

/* ---- list furniture ----
   The toolbar, filter panel, bulk bar and footer around every list are drawn
   by js/erp-datatable.js and styled in css/erp-datatable.css (since
   21/09/2026). The .dt-topbar / .dt-footbar bars that lived here are gone. */

/* The rows scroll inside this box, both ways.

   Vertically it is what puts a long list under a header row that stays put and
   above a pager that stays on screen - no more scrolling five hundred rows to
   reach the "Next" button. Horizontally it stops a wide table being squeezed
   into the card, which is what pushed the buttons in an action cell on top of
   each other.

   The height is set per screen by erp-ux.js, because it depends on how much of
   the window the filters above the table have already used. An overflow box is
   also the containing block for anything sticky inside it, which is why the
   header row below sticks to 0 rather than to the app header. */
.dt-scroll {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* DataTables measures the room a table has against .dataTables_wrapper and
   writes the answer back as an inline pixel width. erp-ux.js then moves the
   table into the .dt-scroll box above, which is 16px narrower - the wrapper's
   own side padding. So every list table is laid out 16px wider than the box it
   now lives in, and the last column - Document here, the action buttons on most
   screens - sits behind the right edge. columns.adjust() cannot help: it
   re-measures against the same wrapper and writes the same too-wide number
   back.

   Handing the width back to the browser fixes it in both directions. A table
   whose columns fit takes exactly the box and nothing is clipped; a twenty
   column report still cannot lay out below its min-content width, so it grows
   past 100% and .dt-scroll scrolls it, which is what the box is for.

   border-box because a table is content-box by default: at 100% the two 1px
   side borders of .table-bordered land outside the box, and 2px of overhang is
   enough to draw a full 14px scrollbar under a table that fits.

   !important because the number being overridden is an inline style. */
.dt-scroll > table {
  width: 100% !important;
  box-sizing: border-box;
}

/* ---- no folded cells ----
   A row is as tall as its tallest cell, on every list. Until 17/09/2026 this
   section held .cell-clamp: four lines (two in Compact), the rest faded out,
   the row opened on a click. The fade hid a second product and its quantity on
   the purchase request list and read as text that was missing, so it was taken
   off everywhere. Do not bring it back to win rows - see erp-ux.js. */

/* ---- how tall the rows box is ----
   erp-ux.js writes the max-height; see fitTable there for why it is measured
   rather than derived, and what the floor is for. Everything here is what has
   to be true for that measurement to mean anything.

   The page is normal flow with a minimum of one screen: it fills the window
   when the content is short, and grows and scrolls when it is not. That is the
   difference from the previous version, which pinned the page to exactly one
   screen and clipped - so a rows box that did not fit took the pager with it,
   below a fold nothing could scroll past. */
.page {
  min-height: 100%;
}

/* Below a tablet the screen is too short to divide at all: a rows box with a
   pager under it is worse than a page that simply scrolls. */
@media (max-width: 767.98px) {

  .dt-scroll {
    max-height: 70vh !important;
  }
}

/* A guard for the moment before erp-ux.js has wrapped the table in .dt-scroll,
   and for any table that never gets wrapped. Without it a wide table pushes
   the content column out and, because that column clips rather than scrolls,
   the right-hand end of the table becomes unreachable. */
.dataTables_wrapper,
.page .table-scroll {
  overflow-x: auto;
}

/* Selector for selector with `table.dataTable thead th` above, which is one
   step more specific than a bare `.dt-scroll thead th` and would otherwise
   keep the app-header offset - parking the header row 56px down the box, on
   top of the first row. */
.dt-scroll table thead th,
.dt-scroll table.dataTable thead th,
.table-scroll table thead th {
  top: 0;
}

/* ---- action column ----
   The last column of a list is where the row's buttons live. Left to itself it
   is the column the browser chooses to squeeze, so four icon buttons wrap onto
   three ragged lines and a wide button lands on top of them.

   One flex row, one gap, aligned right, wrapping tidily when a row really does
   carry five actions. The column shrinks to its content instead of taking a
   share of the table's width. */
.table thead th:last-child,
table.dataTable thead th:last-child {
  width: 1%;
  white-space: nowrap;
}

.table tbody td:last-child,
table.dataTable tbody td:last-child {
  width: 1%;
}

/* "Nothing here yet" is one cell spanning the whole row, so it is also the
   last cell - and was being right-aligned into the corner by the rule above. */
.table tbody td.dataTables_empty,
table.dataTable tbody td.dataTables_empty {
  width: auto;
  text-align: center;
}

/* The submit row of a long form, pinned to the foot of its panel by
   erp-ux.js. Only on forms taller than the window - on a short one it would be
   a bar floating over nothing. */
.form-actions-sticky {
  position: sticky;
  bottom: 0;
  z-index: var(--z-sticky);
  margin: var(--s3) calc(var(--gap-card) * -1) calc(var(--gap-card) * -1);
  padding: var(--s3) var(--gap-card);
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--r-md) var(--r-md);
}

/* An image whose file is not on the server. erp-ux.js strips the src and adds
   this class; what is left is a square that says "no photo" rather than a
   broken-image glyph repeated down a column. */
img.img-missing {
  display: inline-block;
  min-width: 34px;
  min-height: 34px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  position: relative;
  font-size: 0;
}

img.img-missing::after {
  content: "";
  position: absolute;
  inset: 30%;
  border: 1px solid var(--ink-3);
  border-radius: 2px;
  opacity: .55;
}

/* ---- row action buttons ----
   The DataTables column renderers in ~90 controllers build these three shapes
   and nothing has ever styled two of them:

     <a href="..." title="Edit"><i class="fa fa-edit"></i></a>
     <button class="btn-xs btn-trash btn-delete"><i class="fa fa-trash"></i></button>
     <a class="btn btn-primary">View Ledger</a>

   .btn-xs and .btn-trash appear in no stylesheet in the repository, so the
   delete button rendered as the browser's own grey box next to a bare blue
   icon link. One square, one size, one hover - and delete goes red on hover
   rather than sitting there red all the time, because in a list of forty rows
   a column of red is just noise. */
.table tbody td .btn-xs,
.table tbody td .btn-trash,
.table tbody td:last-child > a:not(.btn),
.table tbody td:last-child > button:not(.btn),
table.dataTable tbody td:last-child > a:not(.btn),
table.dataTable tbody td:last-child > button:not(.btn) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--ctl-h-sm);
  height: var(--ctl-h-sm);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-2);
  font-size: var(--t-base);
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease),
              border-color var(--dur-1) var(--ease);
}

.table tbody td .btn-xs:hover,
.table tbody td:last-child > a:not(.btn):hover,
.table tbody td:last-child > button:not(.btn):hover {
  background: var(--accent-weak);
  border-color: var(--accent);
  color: var(--accent);
}

.table tbody td .btn-trash:hover,
.table tbody td .btn-delete:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
}

.table tbody td .btn-xs:disabled,
.table tbody td .btn-xs[disabled] {
  opacity: .4;
  cursor: not-allowed;
}

/* An icon with no word next to it is not a filled button. In a column of four
   actions, one solid blue square beside three outlines reads as "this one is
   different", which it is not - they are four peers. Colour still carries the
   meaning: the delete goes red on hover, the rest go accent. erp-ux.js marks
   these, because CSS cannot ask whether an element contains text. */
.table tbody td .btn.is-icon-only,
table.dataTable tbody td .btn.is-icon-only {
  width: var(--ctl-h-sm);
  min-width: var(--ctl-h-sm);
  padding: 0;
  background-color: transparent !important;
  border-color: var(--line) !important;
  color: var(--ink-2) !important;
}

.table tbody td .btn.is-icon-only:hover,
table.dataTable tbody td .btn.is-icon-only:hover {
  background-color: var(--accent-weak) !important;
  border-color: var(--accent) !important;
  color: var(--accent) !important;
}

.table tbody td .btn.is-icon-only.btn-danger:hover,
.table tbody td .btn.is-icon-only.btn-delete:hover,
.table tbody td .btn.is-icon-only.btn-trash:hover {
  background-color: var(--danger-bg) !important;
  border-color: var(--danger) !important;
  color: var(--danger) !important;
}

/* Row actions are compact. A list with five actions on every row - edit,
   delete, view, export, add - was giving a third of the table's width to its
   buttons, at the same size as the ones on a form. */
.table tbody td:last-child .btn,
table.dataTable tbody td:last-child .btn {
  height: var(--ctl-h-sm);
  min-height: var(--ctl-h-sm);
  padding: 0 var(--s2);
  font-size: var(--t-sm);
  font-weight: 500;
}

/* The action column is pinned by css/erp-datatable.css, to the column the
   frame has identified as the actions (.dtx-actions) - not to whichever
   column happens to come last, which is what the rule here used to do. */

/* Kept as a plain table cell, laid out inline. Turning the <td> itself into a
   flex container looks tidier in a mock-up and breaks the table: a cell that
   is `display:flex` no longer participates in column sizing, so `width: 1%`
   collapses it and every button wraps onto its own line. The controls are
   inline-level instead, and the cell shrinks to fit them. */
.table tbody td:last-child,
table.dataTable tbody td:last-child {
  white-space: nowrap;
  text-align: right;
}

.table tbody td:last-child > * {
  vertical-align: middle;
}

.table tbody td:last-child > * + * {
  margin-left: var(--s2);
}

/* A form wrapping a delete button is a layout accident, not a block. */
.table tbody td:last-child form {
  display: inline;
  margin: 0;
}

/* Where a page has already wrapped its controls, that wrapper does the work. */
.action-buttons {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s2);
}

.action-buttons > * + * {
  margin-left: 0;
}

/* Every row control is the same height, whatever it was built out of. */
.table tbody td:last-child .btn,
.table tbody td:last-child .e-btn,
.table tbody td:last-child > a,
.table tbody td:last-child button,
.action-buttons > a,
.action-buttons > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  height: 30px;
  padding: 0 var(--s3);
  margin: 0;
  font-size: var(--t-sm);
  line-height: 1;
  border-radius: var(--r-sm);
  white-space: nowrap;
}

/* No forced square. `:has(> i:only-child)` looks like it means "icon only",
   but :only-child counts elements and ignores text - so `<a><i></i> View
   Ledger</a>` matched it too, and every labelled button in the row was
   clipped to 30px with its text spilling over the button beside it. A minimum
   width keeps a lone icon from looking pinched; the padding does the rest. */
.table tbody td:last-child .btn,
.table tbody td:last-child > a,
.table tbody td:last-child button,
.action-buttons > a,
.action-buttons > button {
  min-width: 30px;
}

.table tbody td:last-child i {
  font-size: var(--t-base);
}

/* ---- label buttons ----
   `.btn-label-success` and friends: a tinted pill used as a status control in
   the row of a list. style.css builds them out of `rgba(var(--bs-*-rgba), .3)`
   and a drop shadow, and gives them the state colour as *text* on a fill of
   the same hue - which on this palette is a light green pill with light green
   writing on it. Same idea, using the theme's state pairs, which are built for
   exactly this. */
.btn-label-primary,
.btn-label-secondary,
.btn-label-success,
.btn-label-warning,
.btn-label-danger,
.btn-label-info,
.btn-label-dark,
.btn-label-light {
  box-shadow: none;
  border: 1px solid transparent;
  font-weight: 600;
}

.btn-label-primary {
  background-color: var(--accent-weak);
  color: var(--accent);
  border-color: var(--accent);
}

.btn-label-success {
  background-color: var(--success-bg);
  color: var(--success);
  border-color: var(--success);
}

.btn-label-warning {
  background-color: var(--warning-bg);
  color: var(--warning);
  border-color: var(--warning);
}

.btn-label-danger {
  background-color: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger);
}

.btn-label-info {
  background-color: var(--steel-bg);
  color: var(--steel);
  border-color: var(--steel);
}

.btn-label-secondary,
.btn-label-dark,
.btn-label-light {
  background-color: var(--surface-alt);
  color: var(--ink-2);
  border-color: var(--line-strong);
}

/* ---- badges & labels ---- */
.badge {
  display: inline-block;
  padding: var(--s1) var(--s2);
  border-radius: var(--r-pill);
  font-family: var(--body);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: .03em;
  /* A neutral chip by default. Several columns render `badge text-success`
     with no bg-* class at all, which drew the ink and no pill; the state
     classes below override this. */
  background-color: var(--surface-alt);
  color: var(--ink-2);
}

.badge.bg-primary,
.badge-primary {
  background-color: var(--steel-bg) !important;
  color: var(--steel) !important;
}

.badge.bg-success,
.badge-success {
  background-color: var(--success-bg) !important;
  color: var(--success) !important;
}

.badge.bg-danger,
.badge-danger {
  background-color: var(--danger-bg) !important;
  color: var(--danger) !important;
}

.badge.bg-warning,
.badge-warning {
  background-color: var(--warning-bg) !important;
  color: var(--warning) !important;
}

.badge.bg-info,
.badge-info {
  background-color: var(--teal-bg) !important;
  color: var(--teal) !important;
}

.badge.bg-secondary,
.badge-secondary {
  background-color: var(--surface-alt) !important;
  color: var(--ink-2) !important;
}

/* Bootstrap's .bg-* utilities are !important, so a progress bar wearing one
   paints Bootstrap's raw red, amber and green rather than the palette - in
   both themes, and in hues the system does not otherwise contain. */
.progress-bar.bg-success {
  background-color: var(--success) !important;
}

.progress-bar.bg-warning {
  background-color: var(--warning) !important;
}

.progress-bar.bg-danger {
  background-color: var(--danger) !important;
}

.progress-bar.bg-info {
  background-color: var(--steel) !important;
}

.progress {
  background-color: var(--surface-2);
  border-radius: var(--r-pill);
}

/* ---- alerts ---- */
.alert {
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  border-left-width: 3px;
  padding: var(--s3) var(--s3);
  font-size: var(--t-sm);
}

.alert-success {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
}

.alert-danger {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
}

.alert-warning {
  background: var(--warning-bg);
  border-color: var(--warning);
  color: var(--warning);
}

.alert-info {
  background: var(--steel-bg);
  border-color: var(--steel);
  color: var(--steel);
}

/* The quiet variants: Bootstrap paints these near-white, which on this theme
   is a bright card in the middle of a dark form. */
.alert-light,
.alert-secondary,
.alert-dark {
  background: var(--surface-alt);
  border-color: var(--line-strong);
  color: var(--ink);
}

.alert-light .text-muted,
.alert-secondary .text-muted {
  color: var(--ink-2) !important;
}

.alert a,
.alert strong {
  color: inherit;
}

/* ---- modals (Bootstrap 5) ---- */
.modal-content {
  background-color: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--e3);
  color: var(--ink);
}

.modal-header,
.modal-footer {
  border-color: var(--line);
  padding: var(--s3) var(--s5);
}

.modal-title {
  font-family: var(--display);
  font-size: var(--t-lg);
  font-weight: 600;
}

.modal-body {
  padding: var(--s5);
}

/* Bootstrap top-aligns a dialog, 1.75rem from the top of the window. On this
   shell that is underneath the fixed 56px app bar, so a modal opened from a
   list screen has its own title half hidden behind the header. Centre every
   dialog vertically - the same thing .modal-dialog-centered does, without
   having to add the class to every view that has a modal. */
.modal-dialog {
  display: flex;
  align-items: center;
  min-height: calc(100% - 3.5rem);
}

.modal-dialog > .modal-content {
  width: 100%;
}

.modal-backdrop.show {
  background: var(--scrim);
  opacity: 1;
  backdrop-filter: blur(2px);
}

/* Bootstrap draws this cross as a black SVG, sized for a white sheet. On the
   dark theme it has to be turned inside out to be seen at all. */
.btn-close {
  filter: invert(1) grayscale(1) brightness(1.6);
  opacity: .6;
}

.btn-close:hover {
  opacity: 1;
}

/* ...and turned back the right way round when the page is white again. The
   inversion above is not a decoration, it is a correction for a dark ground:
   left switched on in light mode it paints the cross white on a white modal
   header and the dialog loses its visible way out. */
html[data-theme="light"] .btn-close {
  filter: none;
}

/* ---- tabs & pills ---- */
.nav-tabs {
  border-bottom: 1px solid var(--line);
  gap: 2px;
}

.nav-tabs .nav-link {
  color: var(--ink-2);
  background: transparent;
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  font-family: var(--display);
  font-size: var(--t-sm);
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: var(--s2) var(--s4);
}

.nav-tabs .nav-link:hover {
  color: var(--ink);
  background: var(--surface-alt);
}

.nav-tabs .nav-link.active {
  color: var(--ink);
  background: transparent;
  border-color: transparent transparent var(--accent);
}

.nav-pills .nav-link.active {
  background-color: var(--accent-deep);
  color: #fff;
}

/* ---- pagination ---- */
.pagination {
  gap: var(--s1);
}

.page-link,
.table-pagination a {
  background-color: transparent;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  border-radius: var(--r-sm);
  font-size: var(--t-sm);
  padding: var(--s2) var(--s3);
}

.page-link:hover,
.table-pagination a:hover:not(.active) {
  background-color: var(--surface-alt);
  border-color: var(--accent-soft);
  color: var(--ink);
}

.page-item.active .page-link,
.table-pagination a.active {
  background-color: var(--accent-deep);
  border-color: var(--accent-deep);
  color: #fff;
}

.page-item.disabled .page-link {
  background-color: transparent;
  border-color: var(--line);
  color: var(--ink-3);
}

/* ---- misc chrome ---- */
.dropdown-menu {
  background-color: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  box-shadow: var(--e2);
  font-size: var(--t-sm);
}

.dropdown-item {
  color: var(--ink);
}

.dropdown-item:hover,
.dropdown-item:focus {
  background-color: var(--surface-alt);
  color: var(--ink);
}

.list-group-item {
  background-color: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.progress {
  background-color: var(--surface-alt);
}

.progress-bar {
  background-color: var(--accent);
}

.loadscreen,
#preloader {
  background-color: var(--loader-color);
}

/* ---- sign-in ----
   The one screen that does not live in the shell. Two halves on a desk: what
   the system is, and the way in. One column on a phone, where the half that is
   not the form is the half that goes.

   It was a 440px card floating in the middle of a gradient with the mark
   balanced on top of the fields. --------------------------------------- */
.signin-body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
}

.signin {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  min-height: 100dvh;
}

.signin-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--s4);
  padding: var(--s7) clamp(var(--s6), 6vw, 96px);
  color: var(--on-navy);
  background:
    radial-gradient(120% 90% at 12% 8%, rgba(86, 140, 238, .22), transparent 60%),
    radial-gradient(90% 80% at 90% 100%, rgba(68, 204, 185, .16), transparent 62%),
    linear-gradient(160deg, #0b131f 0%, #0d1c2c 48%, #122c42 100%);
  overflow: hidden;
}

/* The same drafting grid the app draws behind its pages. */
.signin-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(120% 100% at 20% 0%, #000, transparent 78%);
  pointer-events: none;
}

.signin-brand > * {
  position: relative;
}

.signin-mark {
  width: 208px;
  max-width: 60%;
  margin-bottom: var(--s5);
}

.signin-lede {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(24px, 2.6vw, 34px);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -.01em;
  color: #fff;
}

.signin-sub {
  margin: 0;
  max-width: 46ch;
  font-size: var(--t-md);
  line-height: var(--lh-text);
  color: var(--on-navy-dim);
}

.signin-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s3) var(--s5);
  margin: var(--s4) 0 0;
  padding: 0;
  list-style: none;
  font-size: var(--t-sm);
  color: var(--on-navy-dim);
}

.signin-facts li {
  display: flex;
  align-items: center;
  gap: var(--s2);
}

.signin-facts i {
  color: var(--accent-soft);
  width: 18px;
  text-align: center;
}

.signin-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s5);
  padding: var(--s7) var(--s5);
  background: var(--paper);
  overflow: hidden;
}

/* The same drafting grid as the brand half, faint, so the form side reads as
   part of the same sheet rather than as the space left over beside it. */
.signin-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(120% 100% at 80% 100%, #000, transparent 76%);
  pointer-events: none;
}

.signin-panel > * {
  position: relative;
  z-index: 1;
}

.signin-theme {
  position: absolute;
  top: var(--s5);
  right: var(--s5);
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  overflow: hidden;
  transition: border-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}

.signin-theme:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.signin-card {
  width: min(400px, 100%);
  padding: var(--s6);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--e2);
}

.signin-title {
  margin: 0 0 var(--s1);
  font-size: var(--t-xl);
}

.signin-hint {
  margin: 0 0 var(--s5);
  font-size: var(--t-sm);
  color: var(--ink-2);
  line-height: var(--lh-text);
}

.signin-hint strong {
  color: var(--ink);
  font-family: var(--mono);
}

.signin-submit {
  width: 100%;
  height: var(--ctl-h-lg);
  min-height: var(--ctl-h-lg);
  margin-top: var(--s4);
  font-size: var(--t-md);
  gap: var(--s2);
}

.signin-submit-quiet {
  margin-top: var(--s2);
}

.signin-foot {
  margin: 0;
  font-size: var(--t-xs);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.signin-foot span {
  margin: 0 var(--s1);
}

.signin-card .alert {
  margin-bottom: var(--s4);
}

/* Under a laptop there is no room for two halves, and the brand panel is the
   half that is not the reason anyone opened the page. */
@media (max-width: 991.98px) {

  .signin {
    grid-template-columns: 1fr;
  }

  .signin-brand {
    display: none;
  }

  .signin-panel {
    justify-content: flex-start;
    padding-top: var(--s7);
  }

  .signin-panel::before {
    content: "";
    width: 168px;
    height: 34px;
    margin-bottom: var(--s5);
    background: url("../images/stahlglas-white.png") center / contain no-repeat;
  }

  html[data-theme="light"] .signin-panel::before {
    filter: brightness(0) saturate(100%) invert(24%) sepia(72%) saturate(1900%) hue-rotate(203deg) brightness(92%) contrast(94%);
  }
}

/* The code field. One box, monospaced, spaced out so six digits read as six
   digits - and a width in percent, so it fits the card at any size instead of
   the 410px the old six-box version was pinned to. */
#partitioned,
.e-otp-control {
  width: 100%;
  min-width: 0;
  height: var(--ctl-h-lg);
  padding: 0 var(--s3);
  text-align: center;
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: .42em;
  text-indent: .42em;
  background-color: var(--surface-2);
  background-image: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  color: var(--ink);
}

#partitioned::placeholder {
  color: var(--ink-3);
  font-weight: 400;
}

#partitioned:focus,
.e-otp-control:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* The two wrappers the old markup needed to clip its 410px input. */
#divOuter,
#divInner {
  width: 100%;
  overflow: visible;
}

/* Decorative corner artwork from the old light login — it is a white-cornered
   PNG and reads as a smudge on the dark card. */
.wrap-green,
.wrap-blue {
  display: none;
}

/* An item's own photograph, shown beside its name so the person reading a
   recipe can see they have opened the part they meant.

   Not .upload-preview, which is a different job: that one previews a file
   somebody has just picked, is held at 260px and zooms on click. This is a
   fixed square of finished content, so it is sized and left alone.

   object-fit is contain and never cover — an item photo is usually a whole
   part on a bench, and cropping it to a square cuts off the end that tells
   you which part it is. */
.item-thumb {
  flex: 0 0 auto;
  width: var(--s8);
  height: var(--s8);
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-sunken);
}

/* No photograph on the item. A grey square with the fallback glyph says the
   record has no picture; a broken-image icon says the page is broken. */
.item-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
  font-size: var(--t-lg);
}

/* An input that states a size keeps it. .e-form-input is width:100%, which is
   right in a form column and wrong inside a table row: next to a unit and a
   button in a flex row it collapsed to one character (Stock Valuation's rate
   box, 18/09/2026). size="9" is the width the markup asked for; nothing else in
   the views sets size on an .e-form-input. */
.e-form-input[size] {
  width: auto;
  flex: 0 0 auto;
}

/* ============================ 6. third-party ============================= */

/* ---- DataTables ---- */
.dataTables_wrapper {
  color: var(--ink);
  font-size: var(--t-sm);
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_processing,
.dataTables_wrapper .dataTables_paginate {
  color: var(--ink-2);
}

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
  background-color: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  color: var(--ink);
  padding: var(--s1) var(--s2);
  height: auto;
  width: auto;
  margin: 0 var(--s2);
}

.dataTables_wrapper .dataTables_filter input:focus {
  border-color: var(--accent);
  box-shadow: var(--ring);
  outline: none;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  background: transparent !important;
  border: 1px solid var(--line-strong) !important;
  border-radius: var(--r-sm);
  color: var(--ink) !important;
  padding: var(--s1) var(--s3);
  margin-left: var(--s1);
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--surface-alt) !important;
  border-color: var(--accent-soft) !important;
  color: var(--ink) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--accent-deep) !important;
  border-color: var(--accent-deep) !important;
  color: #fff !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
  background: transparent !important;
  border-color: var(--line) !important;
  color: var(--ink-3) !important;
}

.dataTables_wrapper {
  position: relative;
}

.dataTables_wrapper .dataTables_processing {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  box-shadow: var(--e2);
  color: var(--ink);
}

/* DataTables paints its own opaque row backgrounds — white, and #f9f9f9 for
   the striped variant, plus a third shade on whichever column is sorted. All
   of it has to go transparent or the row wins over the surface underneath and
   the table becomes white text on white. */
table.dataTable tbody tr,
table.dataTable tbody tr.odd,
table.dataTable tbody tr.even,
table.dataTable.display tbody tr.odd,
table.dataTable.display tbody tr.even,
table.dataTable.stripe tbody tr.odd {
  background-color: transparent;
}

table.dataTable tbody tr.odd > .sorting_1,
table.dataTable tbody tr.even > .sorting_1,
table.dataTable.order-column tbody tr > .sorting_1,
table.dataTable.order-column.stripe tbody tr.odd > .sorting_1,
table.dataTable.display tbody tr.odd > .sorting_1,
table.dataTable.display tbody tr.even > .sorting_1 {
  background-color: rgba(255, 255, 255, .02);
}

table.dataTable.display tbody tr:hover,
table.dataTable.hover tbody tr:hover,
table.dataTable tbody tr:hover > .sorting_1 {
  background-color: var(--surface-alt);
}

table.dataTable tbody tr.selected,
table.dataTable tbody tr.odd.selected,
table.dataTable tbody tr.even.selected {
  background-color: var(--accent-weak);
}

table.dataTable thead .sorting,
table.dataTable thead .sorting_asc,
table.dataTable thead .sorting_desc {
  cursor: pointer;
}

table.dataTable thead th.sorting:after,
table.dataTable thead th.sorting_asc:after,
table.dataTable thead th.sorting_desc:after {
  color: var(--accent);
  opacity: .7;
}

/* Responsive extension: the "+" that opens a hidden-column row. */
table.dataTable.dtr-inline.collapsed > tbody > tr > td:first-child:before {
  background-color: var(--accent-deep);
  border-color: var(--accent-deep);
  box-shadow: none;
  color: #fff;
}

table.dataTable > tbody > tr.child ul.dtr-details > li {
  border-bottom: 1px solid var(--line);
}

table.dataTable > tbody > tr.child span.dtr-title {
  color: var(--ink-2);
  font-family: var(--display);
  font-size: var(--t-xs);
  letter-spacing: .07em;
  text-transform: uppercase;
}

/* ---- select2 ----
   Every drop-down in the ERP. The header partial used to carry ~90 lines of
   !important overrides inline in every page, and style.css another hundred
   that re-skinned the widget as a white light-mode panel; both are gone and
   this is the only place select2 is styled. */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
  height: var(--ctl-h);
  padding: 0 var(--s2);
  background-color: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  font-size: var(--t-base);
  display: flex;
  align-items: center;
}

.select2-container--default .select2-selection--single .select2-selection__rendered,
.select2-container .select2-selection--single .select2-selection__rendered {
  line-height: normal;
  padding-left: var(--s1);
  padding-right: var(--s5);
  color: var(--ink);
  font-weight: 400;
  font-size: var(--t-base);
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: var(--ink-3);
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: var(--ctl-h);
  right: var(--s2);
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: var(--ink-2) transparent transparent transparent;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
  border-color: transparent transparent var(--ink-2) transparent;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
  border-color: var(--accent);
}

/* A disabled picker reads like a disabled <select>. select2.min.css fills it
   #eee, which in the dark theme puts light ink on a light box - the Issue
   Material item picker is disabled until a category is chosen, so this is on
   screen every time that page opens. */
.select2-container--default.select2-container--disabled .select2-selection--single,
.select2-container--default.select2-container--disabled .select2-selection--multiple {
  background-color: var(--navy-2);
  cursor: not-allowed;
}

.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__rendered {
  color: var(--ink-2);
}

.select2-container--default .select2-search--dropdown {
  padding: var(--s2);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.select2-dropdown {
  background-color: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  box-shadow: var(--e2);
  z-index: var(--z-dropdown);
}

.select2-container--default .select2-results__option {
  padding: var(--s2) var(--s3);
  font-size: var(--t-sm);
  color: var(--ink);
  background-color: transparent;
}

.select2-container--default .select2-results__option[aria-selected=true] {
  background-color: var(--surface-alt);
  color: var(--ink);
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: var(--accent-deep);
  color: #fff;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
  background-color: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  color: var(--ink);
  padding: var(--s2) var(--s2);
  height: auto;
  font-size: var(--t-sm);
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
  background-color: var(--accent-weak);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  color: var(--ink);
  font-size: var(--t-xs);
}

/* ---- toastr ----
   Below the header rather than over it: a toast that half-covers the page
   title and the clock is harder to read and hides the thing it is reporting
   on. */
#toast-container.toast-top-right,
#toast-container.toast-top-center,
#toast-container.toast-top-left,
#toast-container.toast-top-full-width {
  top: calc(var(--header-h) + 12px);
}

#toast-container > div {
  background-image: none !important;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  border-left-width: 3px;
  box-shadow: var(--e2);
  opacity: 1;
  font-size: var(--t-sm);
  padding: var(--s3) var(--s4) var(--s3) var(--s7);
}

#toast-container > .toast-success {
  background-color: #123528 !important;
  border-color: var(--success);
  color: #d6f2e6;
}

#toast-container > .toast-error {
  background-color: #3a1a17 !important;
  border-color: var(--danger);
  color: #ffdedb;
}

#toast-container > .toast-warning {
  background-color: #3a2c10 !important;
  border-color: var(--warning);
  color: #ffeccc;
}

#toast-container > .toast-info {
  background-color: #16293a !important;
  border-color: var(--steel);
  color: #d8ecfa;
}

.toast-progress {
  background-color: currentColor;
  opacity: .35;
}

/* ---- sweetalert2 ----
   Every selector here is prefixed with `body`. SweetAlert injects its own
   stylesheet into <head> at runtime - after this file - so at equal
   specificity its rules win and the dialog comes up as a white sheet on a dark
   app. One extra element in the selector is enough to settle it. */
body .swal2-container {
  z-index: var(--z-dropdown);
}

body .swal2-container.swal2-backdrop-show,
body .swal2-container.swal2-shown {
  background: var(--scrim);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

body .swal2-popup {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--e3);
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--t-base);
}

body .swal2-title {
  color: var(--ink);
  font-family: var(--display);
  font-size: var(--t-xl);
  font-weight: 600;
}

body .swal2-html-container,
body .swal2-content {
  color: var(--ink-2);
  font-size: var(--t-base);
}

body .swal2-input,
body .swal2-textarea,
body .swal2-select,
body .swal2-file {
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  border-radius: var(--r-sm);
  box-shadow: none;
}

body .swal2-input:focus,
body .swal2-textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--ring);
}

body .swal2-actions {
  gap: var(--s2);
}

body .swal2-styled {
  border-radius: var(--r-sm);
  font-family: var(--body);
  font-weight: 600;
  font-size: var(--t-sm);
  padding: var(--s2) var(--s5);
  box-shadow: none;
}

body .swal2-styled.swal2-confirm {
  background-color: var(--accent-deep);
  color: #fff;
}

body .swal2-styled.swal2-confirm:hover {
  background-color: var(--accent);
}

/* The cancel button ships white-on-white against this surface - which is to
   say, invisible. */
body .swal2-styled.swal2-cancel {
  background-color: transparent;
  border: 1px solid var(--line-strong);
  color: var(--ink);
}

body .swal2-styled.swal2-cancel:hover {
  background-color: var(--surface-alt);
}

body .swal2-styled.swal2-deny {
  background-color: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
}

body .swal2-icon.swal2-warning {
  border-color: var(--warning);
  color: var(--warning);
}

body .swal2-icon.swal2-error {
  border-color: var(--danger);
  color: var(--danger);
}

body .swal2-icon.swal2-success {
  border-color: var(--success);
  color: var(--success);
}

body .swal2-icon.swal2-success [class^=swal2-success-line] {
  background-color: var(--success);
}

body .swal2-icon.swal2-success .swal2-success-ring {
  border-color: var(--success);
}

body .swal2-icon.swal2-info,
body .swal2-icon.swal2-question {
  border-color: var(--steel);
  color: var(--steel);
}

body .swal2-close {
  color: var(--ink-2);
}

body .swal2-close:hover {
  color: var(--ink);
}

body .swal2-validation-message {
  background: var(--danger-bg);
  color: var(--danger);
}

body .swal2-timer-progress-bar {
  background: var(--accent);
}

.chat-reminder-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.chat-reminder-list li {
  display: flex;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s2) 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--t-sm);
}

.chat-reminder-who {
  color: var(--ink);
}

.chat-reminder-n {
  font-family: var(--mono);
  color: var(--accent);
}

/* ---- date pickers (bootstrap-datepicker, daterangepicker, datetimepicker) ---- */
.datepicker,
.datepicker-dropdown,
.bootstrap-datetimepicker-widget,
.daterangepicker {
  background-color: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  box-shadow: var(--e2);
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--t-sm);
}

/* daterangepicker paints its grid on a wrapper of its own, and that wrapper
   carries `background-color: #fff` independently of the panel above. So the
   rule above darkened the panel and left a white sheet sitting behind the
   numbers: "Aug 2026", the Su-Sa row and every ordinary date are written in
   --ink, which is white, and they disappeared into it. The only things that
   stayed readable were the greyed-out days of the neighbouring month and the
   selected range, because those carry colours of their own - which is exactly
   what "the month and the dates don't show" looks like on screen.

   Transparent rather than var(--surface) on purpose: the panel is already
   painted, and one fill is enough. Light mode is unaffected - it was reading
   dark ink on the vendor's white, and now reads the same ink on the panel's
   own white. */
.daterangepicker .calendar-table {
  background-color: transparent;
  border-color: transparent;
}

/* The heading and the column labels, in the hierarchy the rest of the app
   uses: the month is a heading, the weekday letters label the columns under
   it. Without this they are the same weight and the grid reads flat. */
.daterangepicker .calendar-table th.month {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--ink);
}

.daterangepicker .calendar-table thead tr:last-child th {
  color: var(--ink-2);
  font-weight: 600;
}

/* The month arrows are two borders of a rotated square, drawn by the vendor in
   literal black. They were only ever visible because the table behind them was
   white; the moment it stops being white they have to be given the ink. */
.daterangepicker .calendar-table .next span,
.daterangepicker .calendar-table .prev span {
  border-color: var(--ink-2);
}

.daterangepicker .calendar-table th.next:hover span,
.daterangepicker .calendar-table th.prev:hover span {
  border-color: var(--accent);
}

/* Rendered on every range picker since 23/09/2026: erp-datepickers.js turns
   showDropdowns on by default, so month and year are picked, not stepped. The
   vendor paints them white, which is white-on-white in the dark theme. */
.daterangepicker select.monthselect,
.daterangepicker select.yearselect,
.daterangepicker select.hourselect,
.daterangepicker select.minuteselect,
.daterangepicker select.secondselect,
.daterangepicker select.ampmselect {
  background-color: var(--surface-alt);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  color: var(--ink);
}

/* The rule that splits the shortcut list from the calendars is #ddd in the
   vendor sheet - a near-white line straight across a dark panel. */
.daterangepicker.show-ranges.ltr .drp-calendar.left,
.daterangepicker.show-ranges.single.ltr .drp-calendar.left {
  border-left-color: var(--line);
}

.daterangepicker.show-ranges.rtl .drp-calendar.right,
.daterangepicker.show-ranges.single.rtl .drp-calendar.left {
  border-right-color: var(--line);
}

/* The pointer, for the case where the panel opens upwards near the foot of the
   page. The downward pair is handled further down this section; this is the
   same fix for the other direction, where the vendor fills the tip with #fff. */
.daterangepicker.drop-up:before {
  border-top-color: var(--line-strong);
}

.daterangepicker.drop-up:after {
  border-top-color: var(--surface);
}

/* The range currently chosen, sat next to Cancel/Apply. It is a pair of dates
   and reads as one, so it goes in the numeric face like every other date on
   these screens. */
/* The single-date pickers' title, split by erp-datepickers.js into a month
   and a year that each open their own grid. Drawn as two small buttons with a
   caret, because the plain "September 2026" never said it could be clicked. */
.erp-dp-part {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-weight: 600;
  line-height: 1.5;
}

.erp-dp-part::after {
  content: "\25BE";
  margin-left: 4px;
  color: var(--ink-2);
  font-size: .85em;
}

.erp-dp-part:hover {
  background-color: var(--accent-weak);
  border-color: var(--accent);
}

/* The vendor hovers every header cell and grid cell in #eee, which under the
   theme's white ink turned the year title of the month grid into a blank
   white bar. The theme's own hover instead; none behind the split title. */
.bootstrap-datetimepicker-widget table thead tr:first-child th:hover,
.bootstrap-datetimepicker-widget table td span:not(.active):hover,
.bootstrap-datetimepicker-widget table td.day:not(.active):hover,
.datepicker table tr th.datepicker-switch:hover,
.datepicker table tr th.prev:hover,
.datepicker table tr th.next:hover,
.datepicker table tr td span:not(.active):hover {
  background: var(--surface-alt);
  color: var(--ink);
}

.bootstrap-datetimepicker-widget .datepicker-days th.picker-switch:hover,
.datepicker .datepicker-days th.datepicker-switch:hover {
  background: transparent;
}

.daterangepicker .drp-selected {
  color: var(--ink-2);
  font-family: var(--mono);
}

.datepicker table,
.timepicker table,
.daterangepicker .calendar-table table {
  font-family: var(--body) !important;
}

.datepicker table tr td,
.datepicker table tr th,
.daterangepicker td,
.daterangepicker th {
  color: var(--ink);
  border-radius: var(--r-sm);
}

.datepicker table tr td.day:hover,
.daterangepicker td.available:hover,
.daterangepicker th.available:hover {
  background-color: var(--surface-alt);
  color: var(--ink);
}

.datepicker table tr td.active,
.datepicker table tr td.active:hover,
.datepicker table tr td.today,
.daterangepicker td.active,
.daterangepicker td.active:hover {
  background-color: var(--accent-deep) !important;
  background-image: none !important;
  color: #fff !important;
}

.datepicker table tr td.old,
.datepicker table tr td.new,
.daterangepicker td.off,
.daterangepicker td.off.in-range {
  color: var(--ink-3);
  background-color: transparent;
}

.daterangepicker td.in-range {
  background-color: var(--accent-weak);
  color: var(--ink);
}

.daterangepicker .drp-buttons {
  border-top: 1px solid var(--line);
}

.daterangepicker .ranges li {
  color: var(--ink);
}

.daterangepicker .ranges li:hover {
  background-color: var(--surface-alt);
}

.daterangepicker .ranges li.active {
  background-color: var(--accent-deep);
  color: #fff;
}

.daterangepicker:before,
.daterangepicker:after {
  border-bottom-color: var(--line-strong);
}

.datepicker-container {
  background: var(--surface);
  color: var(--ink);
}

.date a,
.bdpw-clock-digit.cursor {
  color: var(--accent);
}

/* ---- ckeditor ----
   Left as the light widget it ships as: it edits a document that will be
   printed on white paper, and its toolbar icons are dark sprites that become
   invisible the moment the bar behind them is darkened. Only the frame is
   themed, so it reads as a deliberate white sheet inside a dark form rather
   than as a hole in the page. */
.cke_chrome {
  border: 1px solid var(--line-strong) !important;
  border-radius: var(--r-sm);
  overflow: hidden;
  box-shadow: var(--e1);
}

.cke_top,
.cke_bottom {
  border-color: #d1d1d1 !important;
}

/* ---- jQuery UI autocomplete ----
   One screen uses it (visitor entry, the city field). Its own theme is not
   loaded, so the menu is built here out of the same tokens as every other
   dropdown in the app. */
.ui-autocomplete {
  position: absolute;
  z-index: var(--z-dropdown);
  max-height: 240px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--s1);
  margin: 2px 0 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  box-shadow: var(--e2);
}

.ui-autocomplete .ui-menu-item {
  list-style: none;
}

.ui-autocomplete .ui-menu-item-wrapper {
  display: block;
  padding: var(--s2) var(--s3);
  border-radius: var(--r-sm);
  color: var(--ink);
  font: 400 13px/1.4 var(--body);
  cursor: pointer;
}

.ui-autocomplete .ui-menu-item-wrapper.ui-state-active,
.ui-autocomplete .ui-menu-item-wrapper:hover {
  background: var(--accent-weak);
  color: var(--ink);
  border: 0;
  margin: 0;
}

/* The widget parks a "searching" helper offscreen; it must not add a scrollbar. */
.ui-helper-hidden-accessible {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---- ladda ---- */
.ladda-button[data-style=zoom-in] .ladda-spinner,
.ladda-button .ladda-spinner {
  color: currentColor;
}

/* ============================ 7. feedback & motion ======================= */

/* ---- page transition bar ----
   Every screen in this ERP is a full page load. Between the click and the new
   paint the old page just sits there, which on a slow office link reads as a
   dead button and gets clicked again. The bar starts on the click and is wiped
   out by the navigation itself. */
#erp-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  box-shadow: 0 0 8px var(--accent-glow);
  z-index: var(--z-progress);
  opacity: 0;
  transition: width var(--dur-2) ease, opacity var(--dur-2) ease;
  pointer-events: none;
}

#erp-progress.on {
  opacity: 1;
}

/* ---- full-screen loader ----
   Shown until window.load, and by any script that sets .is-busy on <body>. */
.loadscreen,
#preloader {
  position: fixed;
  inset: 0;
  z-index: var(--z-loader);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--page-fade);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

/* The stock markup is a single <span>, so the ring is drawn with borders on
   that one element rather than needing extra nodes. */
#preloader .spinner-glow,
.erp-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  background: none;
  box-shadow: none;
  animation: erp-spin .7s linear infinite;
  display: block;
}

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

/* ---- busy button ----
   Any submit button inside a form that has been sent. Keeps its width so the
   row does not jump, and cannot be pressed twice. */
button.is-busy,
.btn.is-busy {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

button.is-busy::after,
.btn.is-busy::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  /* currentColor, not white: the spinner sits on whatever button was pressed,
     and a secondary button in light mode has dark text on a pale fill. */
  border: 2px solid currentColor;
  opacity: .9;
  border-top-color: transparent;
  animation: erp-spin .7s linear infinite;
}

/* ---- skeleton rows ----
   For a table waiting on its AJAX source. A grey block that breathes reads as
   "coming", where an empty white box reads as "broken". */
.skeleton {
  background: linear-gradient(90deg, var(--surface-alt) 25%, var(--line) 37%, var(--surface-alt) 63%);
  background-size: 400% 100%;
  animation: erp-shimmer 1.3s ease infinite;
  border-radius: var(--r-sm);
  color: transparent !important;
  min-height: 12px;
}

/* The rows erp-ux.js draws while a list is on its way. They are the shape of
   the answer, so the screen does not jump when the answer arrives - and they
   only appear on the *first* load, where there is nothing on screen yet. A
   redraw of a table that already has rows keeps its rows. */
tr.skeleton-row td {
  padding: var(--s2) var(--s3);
  border-bottom: 1px solid var(--line);
}

tr.skeleton-row .skeleton {
  display: block;
  height: 10px;
  width: 100%;
}

tr.skeleton-row:nth-child(even) .skeleton {
  width: 72%;
}

tr.skeleton-row:nth-child(3n) .skeleton {
  width: 86%;
}

@keyframes erp-shimmer {
  from {
    background-position: 100% 50%;
  }

  to {
    background-position: 0 50%;
  }
}

/* DataTables draws its own "Processing..." box. Left as it ships it is a
   transparent strip positioned halfway down a table that may be taller than
   the screen - which is to say, invisible exactly when the table is big enough
   to need it. Fixed to the middle of the viewport instead, it floated in the
   empty space below a short table, unattached to anything. Centred on the
   table's own wrapper, opaque, is where it belongs. */
.dataTables_wrapper .dataTables_processing {
  position: absolute;
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  transform: translate(-50%, -50%);
  width: auto;
  min-width: 168px;
  margin: 0;
  padding: var(--s3) var(--s5);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s3);
  font-family: var(--display);
  font-size: var(--t-xs);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  box-shadow: var(--e3);
  z-index: var(--z-toast);
}

.dataTables_wrapper .dataTables_processing::before {
  content: "";
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  animation: erp-spin .7s linear infinite;
  flex-shrink: 0;
}

/* ---- empty state ---- */
/* "No data available in table" is the most common thing a new screen shows,
   and as DataTables ships it is one grey line in an empty box that reads as a
   page that failed to load. */
.dataTables_empty,
.table .empty,
.empty-state {
  padding: var(--s7) var(--s4) !important;
  text-align: center;
  color: var(--ink-2);
  font-size: var(--t-base);
}

.dataTables_empty::before,
.empty-state::before {
  content: "119";
  font-family: "Font Awesome 6 Pro", "Font Awesome 6 Free", "Font Awesome 5 Pro", sans-serif;
  font-weight: 300;
  display: block;
  font-size: var(--t-2xl);
  color: var(--ink-3);
  margin-bottom: var(--s2);
  opacity: .8;
}

/* ============================ 8. UX affordances ========================== */

/* Keyboard users land here first and can jump the 100-item menu. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: var(--z-progress);
  background: var(--accent-deep);
  color: #fff;
  padding: var(--s3) var(--s4);
  border-radius: 0 0 var(--r-sm) 0;
  font-size: var(--t-sm);
  font-weight: 600;
}

.skip-link:focus {
  left: 0;
  color: #fff;
}

/* A header row that stays put while a long list scrolls under it.

   Sticking it to the top of the *page* rather than to a scrolling box is what
   makes this work on every screen here: the tables are in normal page flow and
   it is the window that scrolls, so `top: 0` inside a non-scrolling wrapper
   would simply detach the row and let it float over the controls above it —
   which is exactly what it did. The offset is the fixed header's height.

   One above --z-sticky rather than on it. The pinned action column further
   down this sheet is sticky as well, and two sticky things sharing a z-index
   are settled by which comes later in the document - which is the body, every
   time. That is why scrolling a list slid the action buttons up over the
   header row instead of under it. The ladder inside a list now reads: pinned
   body cell, header row, pinned header corner, page head. */
.table thead th,
table.dataTable thead th {
  position: sticky;
  top: 0;
  z-index: calc(var(--z-sticky) + 1);
}

/* Inside a box that scrolls on its own, the header sticks to that box instead. */
.table-responsive[style*="max-height"] thead th,
.dataTables_scrollBody thead th,
.table-scroll thead th {
  top: 0;
}

/* A sticky cell has no background of its own to hide the rows sliding beneath
   it — .table's own background is on the table, not the cells. */
.table thead th,
table.dataTable thead th {
  background-color: var(--surface-alt);
  background-clip: padding-box;
}

/* Marks the field the server complained about, and the label above it. */
.has-error .e-form-label,
.has-error label {
  color: var(--danger);
}

/* Back to top, on any page long enough to need it. Sits clear of the floating
   add button. */
#erp-top {
  position: fixed;
  right: 20px;
  bottom: 84px;
  width: 38px;
  height: 38px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  box-shadow: var(--e1);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: var(--z-float);
  min-height: 0;
  padding: 0;
}

#erp-top.on {
  display: flex;
}

#erp-top:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Bootstrap's vertical spacing utilities, on the theme's scale. mb-4 is 24px
   out of the box and mb-5 is 48px, which is why the gap between a tab strip
   and the cards under it, or between the cards and the table, is twice the gap
   between anything else. Scoped to the content area so nothing in the shell or
   in a third-party widget is caught by it. */
.main-content-wrap .mb-4,
.main-content-wrap .my-4 {
  margin-bottom: var(--s4) !important;
}

.main-content-wrap .mb-5,
.main-content-wrap .my-5 {
  margin-bottom: var(--s5) !important;
}

.main-content-wrap .mt-4,
.main-content-wrap .my-4 {
  margin-top: var(--s4) !important;
}

.main-content-wrap .mt-5,
.main-content-wrap .my-5 {
  margin-top: var(--s5) !important;
}

.main-content-wrap .py-4,
.main-content-wrap .pt-4 {
  padding-top: var(--s4) !important;
}

.main-content-wrap .py-4,
.main-content-wrap .pb-4 {
  padding-bottom: var(--s4) !important;
}

.main-content-wrap .py-5,
.main-content-wrap .pt-5 {
  padding-top: var(--s5) !important;
}

.main-content-wrap .py-5,
.main-content-wrap .pb-5 {
  padding-bottom: var(--s5) !important;
}

/* ---- spacing rhythm ----
   Screens written by hand over two years use 10, 15, 20, 25 and 30px for the
   same gap. The audit found eleven different distances between two blocks on
   the same screen. Nothing below changes any markup: it puts the containers
   that hold the gaps onto one scale, so the vertical rhythm is the same on
   every screen whatever numbers the page itself asked for.

   The page owns the space *between* blocks (see .page in section 3); a block
   owns the space *inside* itself. Nothing owns both, which is what produced
   two stacked margins in the first place. */
/* Bootstrap's own default for --bs-gutter-y is already 0; setting it here as
   well overrode every g-2 / g-3 the views ask for and collapsed the vertical
   gap between stacked tiles to nothing. */
.row {
  --bs-gutter-x: var(--s4);
}

.e-card,
.card,
.filter-card,
.crm-section-card {
  margin-bottom: 0;
}

/* A screen that puts several rows inside one section still gets the page's
   rhythm between them. */
.page section > .row + .row,
.page .container-fluid > .row + .row,
.panel-body-view > .row + .row {
  margin-top: var(--gap-block);
}

/* Blocks inside a panel carry no bottom margin, for the same reason blocks on
   the page carry none: the container owns the gap. The list screens write
   `row g-3 mb-4` on the tiles and `row g-2 mb-3` on the filter bar, so the gap
   between them was that bottom margin *plus* the panel's own rhythm - 40px
   where 16 was meant, three times over, on a screen where every pixel above
   the table is a row of data nobody can see. */
.panel-body-view > .row,
.panel-body-view-15 > .row,
.page > section > .row,
.page > .container-fluid > .row {
  margin-bottom: 0 !important;
}

/* One inner padding for every panel, whatever the screen calls it. */
.panel-body-view,
.panel-body-view-15,
.filter-card,
.crm-section-card {
  padding: var(--gap-card);
}

.e-card .e-card > .panel-body-view,
.e-card .e-card > .panel-body-view-15 {
  padding: var(--s3) var(--s4);
}

/* Twenty-seven list screens space their blocks with <br>, sometimes two of
   them, sometimes three. A line break directly inside a panel is spacing, not
   content, and the page already spaces its blocks. */
.panel-body-view > br,
.panel-body-view-15 > br,
.e-card > br,
.page > br {
  display: none;
}

/* The last control in a card should not push a second gap against the card's
   own padding. */
.panel-body-view > .row:last-child > [class^="col-"] > .mb-3:last-child,
.panel-body-view > .row:last-child > [class*=" col-"] > .mb-3:last-child {
  margin-bottom: 0 !important;
}

/* Form fields: one gap between them, vertically, instead of whatever mb-2 /
   mb-3 / my-3 each screen happened to reach for. */
.e-input-container,
.crm-form-group,
.form-group {
  margin-bottom: var(--gap-field);
}

.e-input-container.mb-3,
.e-input-container.mb-2,
.e-input-container.mb-4,
.form-group.mb-3,
.form-group.mb-2 {
  margin-bottom: var(--gap-field) !important;
}

/* Bootstrap's own spacers - 4, 8, 16, 24, 48 - are already this scale, so
   mb-1 … mb-5 and g-1 … g-5 need nothing done to them. The gutter is the one
   exception: 24px between two fields of a dense form is a gap, not a gutter. */

/* A block that is the last thing on a page adds nothing under itself; the
   page's own bottom padding is the gap. */
.page > *:last-child,
.page section > .row:last-child {
  margin-bottom: 0;
}

/* ---- alignment ----
   Money and quantities read down the column, not down the middle of it, and a
   heading sits on the same baseline as the buttons beside it. */
.table td.text-end,
.table th.text-end,
.table td.text-right,
.table th.text-right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table th {
  vertical-align: middle;
}

.card-head,
.table-header,
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  flex-wrap: wrap;
}

/* ---- the theme switch ----
   The button, the two icons that swap with the theme, and the reveal.

   erp-ux.js publishes the centre of the switch as --vt-x / --vt-y and the
   distance to the furthest corner as --vt-r, then hands the change to the View
   Transition API. The old page is held still and the new one is wiped in as a
   circle growing from the switch, with a ring riding the edge of it. 700ms:
   long enough to read as one movement, short enough not to be a wait. */
#erpThemeToggle {
  border: 1px solid var(--line-strong);
  background: var(--navy-2);
  color: var(--on-navy-dim);
  padding: 0;
  cursor: pointer;
  overflow: hidden;
}

#erpThemeToggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

#erpThemeToggle i {
  font-size: var(--t-md);
  transition: transform var(--dur-3) var(--ease), opacity var(--dur-2) var(--ease);
}

/* One icon at a time, and the one leaving turns out of the way rather than
   blinking off. */
.theme-icon-light,
html[data-theme="light"] .theme-icon-dark {
  position: absolute;
  opacity: 0;
  transform: rotate(-90deg) scale(.6);
  pointer-events: none;
}

.theme-icon-dark,
html[data-theme="light"] .theme-icon-light {
  position: static;
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* The wave. A ring, not a filled disc: what should be visible is the *edge*
   travelling, the same edge the new theme is arriving behind. */
.theme-ripple {
  position: fixed;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  z-index: var(--z-progress);
  pointer-events: none;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--accent), 0 0 22px 6px var(--accent-glow);
  animation: theme-wave 700ms cubic-bezier(.32, 0, .18, 1) forwards;
}

@keyframes theme-wave {
  from {
    width: 0;
    height: 0;
    margin: 0;
    opacity: .9;
  }

  to {
    width: calc(var(--r) * 2);
    height: calc(var(--r) * 2);
    margin: calc(var(--r) * -1);
    opacity: 0;
  }
}

/* The reveal itself. The outgoing snapshot simply waits; the incoming one is
   clipped to the growing circle. */
::view-transition-old(root) {
  animation: none;
  z-index: 1;
}

::view-transition-new(root) {
  animation: theme-reveal 700ms cubic-bezier(.32, 0, .18, 1);
  z-index: 2;
  mix-blend-mode: normal;
}

@keyframes theme-reveal {
  from {
    clip-path: circle(0 at var(--vt-x) var(--vt-y));
  }

  to {
    clip-path: circle(var(--vt-r) at var(--vt-x) var(--vt-y));
  }
}

@media (prefers-reduced-motion: reduce) {

  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none;
  }

  .theme-ripple {
    display: none;
  }
}

/* ---- motion & polish ----
   Short, and only ever there to say what moved where. 200-300ms is the band a
   transition reads as motion rather than as a jump or a wait; every duration
   here comes from --dur-1..3 and every one of them is switched off under
   prefers-reduced-motion by the rule in section 2. */

/* The page head stays put while the list under it scrolls, so the title, the
   breadcrumb and the screen's primary action are reachable from row 400. The
   line under it appears only once something has actually scrolled beneath -
   erp-ux.js watches a one-pixel sentinel for that. */
.page-head {
  position: sticky;
  top: 0;
  /* Above anything sticky inside a list. The rows scroll in their own box, but
     that box slides under this one as the page scrolls, and on a tie the table
     wins for being later in the document - which is how the pinned action
     buttons came to sit on top of the page title. */
  z-index: calc(var(--z-sticky) + 3);
  padding-block: var(--s3);
  margin-block: calc(var(--s3) * -1) 0;
  background: linear-gradient(var(--paper) 70%, var(--page-fade));
  transition: box-shadow var(--dur-2) var(--ease);
}

.page-head.is-stuck {
  box-shadow: 0 1px 0 var(--line), 0 10px 18px -14px rgba(0, 0, 0, .9);
}

/* Out of flow, so it cannot add a gap of its own to the page's rhythm. */
.page-head-sentinel {
  position: absolute;
  top: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
  animation: none !important;
}

/* Blocks arrive in the order the eye reads them. 40ms apart, 220ms each, and
   it is over before anyone could call it an animation - which is the point:
   it explains that the tiles, the filters and the table are three things, not
   one wall. */
@media (prefers-reduced-motion: no-preference) {

  .page > *,
  .page section > .row {
    animation: erp-rise var(--dur-3) var(--ease) backwards;
  }

  .page > *:nth-child(2) { animation-delay: 40ms; }
  .page > *:nth-child(3) { animation-delay: 80ms; }
  .page > *:nth-child(4) { animation-delay: 120ms; }
  .page > *:nth-child(n+5) { animation-delay: 160ms; }
}

@keyframes erp-rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* A row is a target. It says so on hover, on the left edge, without moving
   anything - a row that shifts under the cursor is a row you misclick. */
.table tbody tr,
table.dataTable tbody tr {
  transition: background var(--dur-1) var(--ease);
}

.table tbody tr > td:first-child,
table.dataTable tbody tr > td:first-child {
  box-shadow: inset 2px 0 0 transparent;
  transition: box-shadow var(--dur-1) var(--ease);
}

.table tbody tr:hover > td:first-child,
table.dataTable tbody tr:hover > td:first-child {
  box-shadow: inset 2px 0 0 var(--accent);
}

/* Only things that go somewhere lift. A panel that just holds a form does not
   move when the cursor crosses it. */
a > .e-card,
a > .card,
.e-card.is-clickable,
.card.is-clickable {
  transition: transform var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease),
              box-shadow var(--dur-1) var(--ease);
}

a:hover > .e-card,
a:hover > .card,
.e-card.is-clickable:hover,
.card.is-clickable:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  box-shadow: var(--e2);
}

/* Icon buttons in a row: quiet until the pointer is on the row, then legible.
   Never hidden - an action nobody can see is an action nobody uses. */
.table tbody td:last-child .btn {
  opacity: .82;
  transition: opacity var(--dur-1) var(--ease), background var(--dur-1) var(--ease),
              border-color var(--dur-1) var(--ease);
}

.table tbody tr:hover td:last-child .btn,
.table tbody td:last-child .btn:focus-visible {
  opacity: 1;
}

/* ---- upload preview ----
   The thumbnail of a file that has just been picked, before the form is saved.

   These forms are filled on a phone at a gate, and the input is capture=
   environment - so the picked file is a camera frame, three or four thousand
   pixels down its long edge. Rendered at the width of its column with no ceiling
   on the height, one portrait photo is taller than the screen; three of them put
   the Save button several swipes below the fold and the form cannot be finished
   on the device it was filled on.

   The cap is on height, not width, because that is the dimension that runs away:
   a landscape number plate keeps its full column width, and a portrait ID card is
   the one that gets held back. object-fit is contain and never cover - a cropped
   preview of a document is worse than a small one, because the crop hides exactly
   the edges somebody is checking.

   Visibility is left alone. The upload script writes display:block on the element
   itself when a file is chosen, and the markup carries display:none until then. */
.upload-preview {
  /* The field wrapper is a flex column, so without this the image is a stretched
     flex item: the box takes the whole column width and object-fit letterboxes the
     photo inside it, grey bars either side. Held to the start, the box hugs the
     picture - a portrait capture comes out about 195px wide instead of 928. */
  align-self: flex-start;
  max-width: 100%;
  max-height: 260px;
  width: auto;
  height: auto;
  object-fit: contain;
  margin-top: var(--s2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-sunken);
  cursor: zoom-in;
}

/* Held small, a captured ID card is legible enough to know you took the right
   photo and not enough to read it. Clicking swaps the ceiling for most of the
   viewport, which is what the picture is there for. */
.upload-preview.is-zoomed {
  max-height: 80vh;
  cursor: zoom-out;
}

/* ============================ 9. responsive ============================== */

/* Five breakpoints, and every one of them changes the layout rather than the
   scale. What used to be here instead - four `body { zoom }` rules in
   media.css that photographed the page and shrank it inside four narrow width
   bands - is written up where it was removed.

     >= 1440   docked menu, full gutter
     1200-1439 docked menu
     1024-1199 menu becomes an overlay drawer
     768-1023  page head still on one line, filters wrap
     480-767   page head stacks, gutter and card padding drop a step,
               controls grow to 44px for a thumb
     < 480     one column, the pager reduces to its arrows

   The two things that must hold at every width: the body never scrolls
   sideways, and a table that is wider than the screen scrolls inside its own
   panel with its header row still pinned to the top of it. */

/* Ultra-wide. A table stretched across 2560px stops being a table and becomes
   a row of widely separated columns, so the page stops growing at 1760 - but
   the shell around it does not, so the menu and header still reach the edges. */
@media (min-width: 1800px) {

  .page {
    padding-inline: var(--s6);
  }
}

/* Nothing behind the menu should scroll while it is open. The menu is over
   the page at every width now, so this is no longer a small-screen rule. */
body.nav-open {
  overflow: hidden;
}

@media (max-width: 991.98px) {

  .e-header {
    padding: 0 var(--s3);
  }

  .e-header-logo {
    width: 130px;
  }

  .card-count {
    font-size: var(--t-xl);
  }

  /* The clock and the account name are the first things to go: the toggle,
     the search and the three utility buttons all have to fit. */
  .e-header-date-container,
  .e-header-user {
    display: none;
  }
}

@media (max-width: 767.98px) {

  /* --gap-page and --gap-card already step down a size; see section 1. */
  .page-head {
    align-items: stretch;
    gap: var(--s3);
  }

  .page-actions {
    justify-content: flex-start;
  }

  .e-card,
  .card {
    border-radius: var(--r-sm);
  }

  .card-count {
    font-size: var(--t-lg);
  }

  .card-icon {
    width: 30px;
    height: 30px;
  }

  /* Gloves, a tablet, and a shop floor: 44px targets, and 16px inputs so
     focusing a field does not zoom the page. */
  .btn,
  .e-btn,
  button.btn {
    min-height: var(--ctl-h);
  }

  .btn-sm,
  .btn-group-sm > .btn,
  td .btn.btn-sm {
    min-height: var(--ctl-h-sm);
  }

  input,
  select,
  textarea,
  .form-control,
  .form-select,
  .e-form-input {
    font-size: var(--t-lg);
  }

  .e-btn-width-20 {
    width: 100%;
    min-width: 0;
  }

  .table-header,
  .table-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .dataTables_wrapper .dataTables_filter,
  .dataTables_wrapper .dataTables_length {
    float: none;
    margin: 0;
    text-align: left;
  }

  .dataTables_wrapper .dataTables_filter input {
    width: 100%;
    min-width: 0;
    display: block;
  }

  .dataTables_wrapper .dataTables_paginate {
    float: none;
    justify-content: center;
    text-align: center;
  }

}

@media (max-width: 575.98px) {

  /* The header is two rows on a phone (29/10/2026). On one row the toggle, the
     search, the language switch and seven round buttons came to 485px on a
     375px screen, and Notifications and Logout sat off the right edge where no
     one could reach them. Row one keeps the toggle and the search, with the
     language switch lifted to its right end (row one has room; row two does
     not, at the 36px phone target size section 1 sets). Row two is the seven
     round buttons, right-aligned. --header-h moves with it, so the content
     region and the menu (both placed at top: var(--header-h)) start under the
     second row, not behind it. Right-aligned by an auto margin rather than
     justify-content, so that if a narrower phone still cannot fit the row it
     overflows to the right and scrolls, instead of off the left edge where
     nothing can scroll to it. */
  :root {
    --header-h: calc(var(--s7) + var(--ctl-h-lg));
  }

  .e-header {
    flex-wrap: wrap;
    align-content: flex-start;
    row-gap: 0;
    padding: 0 var(--s3);
  }

  .e-header-logo-container {
    flex: 1 0 100%;
    height: var(--s7);
  }

  .e-header > div:last-of-type,
  .e-header > .display-flex:last-child {
    flex: 0 0 100%;
    height: var(--ctl-h-lg);
    gap: var(--s1);
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .e-header > div:last-of-type > .tour-help {
    margin-left: auto;
  }

  /* Out of the row's flow and onto row one; the header is position: fixed, so
     it is the containing block, and the row's overflow does not clip it. */
  .e-header > div:last-of-type .lang-switch {
    position: absolute;
    top: var(--s2);
    right: var(--s3);
  }

  /* mx-1 / mx-2 are Bootstrap utilities with !important; the gap spaces them. */
  .e-header > div:last-of-type .e-icon,
  .e-header > div:last-of-type .tour-help-btn {
    width: var(--ctl-h-sm);
    height: var(--ctl-h-sm);
    flex: none;
    margin: 0 !important;
  }

  .page-title {
    font-size: var(--t-lg);
  }

  /* One action, full width, under the title - not a button squeezed against
     the right edge of a phone. */
  /* .page-actions .btn.plus above is three classes deep, so the override has
     to be at least as specific to reach it. */
  .page-actions,
  .page-actions > *,
  .page-actions .btn.plus,
  .page-actions .btn.plus-primary {
    width: 100%;
  }

  .page-actions .btn {
    justify-content: center;
  }

  /* Every form column becomes one column. The views ask for col-sm-6 and
     col-lg-4 in about forty combinations; below this width none of them are
     readable side by side. */
  .e-form-container .row > [class*="col-"] {
    width: 100%;
    flex: 0 0 100%;
    max-width: 100%;
  }

  /* Bootstrap's .d-flex does not wrap. A filter bar or a pair of controls laid
     out with it is wider than a phone, and pushes the panel sideways. */
  .page .d-flex:not(.flex-nowrap),
  .page .display-flex {
    flex-wrap: wrap;
  }

  /* The pager keeps its arrows and the current page; the numbered buttons
     either side of it are what overflows. */
  .dataTables_paginate .paginate_button:not(.previous):not(.next):not(.current) {
    display: none;
  }
}

/* ============================ 10. print ================================== */

/* Anything that leaves the building goes on white paper. Screens are dark;
   toner is not. */
@media print {

  /* The shell is a fixed, internally scrolling region on screen. On paper that
     would print exactly one screenful and throw the rest away, so the whole
     thing goes back to normal flow before anything reaches the printer. */
  html,
  body,
  body.main-bg {
    height: auto !important;
    overflow: visible !important;
    background: #fff !important;
    background-image: none !important;
    color: #000;
  }

  .main-content-wrap,
  .main-content-wrap.sidenav-open {
    position: static !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  /* The page frame: no gutter, no max width, and the head does not stick to
     anything on paper. */
  .page {
    display: block;
    max-width: none;
    min-height: 0;
    padding: 0;
    margin: 0;
  }

  .page-head {
    position: static !important;
    background: none !important;
    box-shadow: none !important;
    margin: 0 0 12pt;
    padding: 0;
  }

  .page-title {
    color: #000;
    font-size: 14pt;
  }

  .page > * {
    animation: none !important;
  }

  .notify-optin-bar,
  .page-head-sentinel,
  #erp-top,
  #erp-progress,
  .skip-link {
    display: none !important;
  }

  .dt-scroll,
  .table-responsive,
  .table-scroll {
    max-height: none !important;
    overflow: visible !important;
    background: none !important;
  }

  /* A sticky header repeats itself over the page break, or worse, prints once
     halfway down. thead is repeated by the printer on its own. */
  .table thead th,
  table.dataTable thead th {
    position: static !important;
  }

  .e-header,
  .erp-nav,
  .erp-nav-overlay,
  .erp-palette,
  .sidebar-overlay,
  .plus-container,
  .page-actions,
  .crumbs,
  #chat_panel,
  .chat-panel,
  #toast-container,
  .no-print {
    display: none !important;
  }

  .main-content-wrap,
  .main-content-wrap.sidenav-open {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  .e-card,
  .card {
    background: #fff !important;
    border-color: #999 !important;
    box-shadow: none !important;
    break-inside: avoid;
    color: #000;
  }

  .table,
  .table th,
  .table td {
    color: #000 !important;
    background: #fff !important;
    border-color: #999 !important;
  }

  .table-responsive {
    overflow: visible !important;
  }
}

/* ============================================================================
   14. How many rows fit on the screen
   ----------------------------------------------------------------------------
   The complaint: "I can only see three records at a time." The rows box is
   already sized to the window by fitTable in erp-ux.js, so the height is not
   what is wrong - the row is. On the transaction list a row stands about 123px
   because it is as tall as its fattest cell: two stacked lines of accounts, a
   wrapped row of attachment chips, a type over a subtype over its splits.

   Two controls sit in the bar above every list, and they do different jobs.

   Compact takes the padding down and puts stacked pairs onto one line. It
   never hides part of a cell: the two-line fold it used to add went with the
   fold on every list on 17/09/2026.

   Maximise is worth roughly one extra row on its own - it recovers the header,
   the sidebar and the page gutter, about 190px - and four with compact on. It
   is a fixed overlay rather than the Fullscreen API: the table has to be
   re-measured either way, and this is predictable across browsers and keeps
   the theme's own colours instead of the browser's black.
   ========================================================================== */

/* The Compact and full-screen buttons are the frame's (.dtx-view-btn, in
   css/erp-datatable.css); they set the same body classes as before. */

/* ---- compact rows ---- */

body.rows-compact .dt-scroll > table > tbody > tr > td,
body.rows-compact .dt-scroll > table > thead > tr > th {
  padding-top: var(--s1);
  padding-bottom: var(--s1);
  line-height: 1.3;
}

/* The transaction list sets its own cell padding under two ids
   (#voucher_master_page #VoucherMasterList tbody td), which outranks the rule
   above - so the same declaration has to be repeated at a specificity that can
   reach it. Worth the duplication: this is the screen the request was about,
   and a compact mode that visibly does nothing on it would be worse than none. */
body.rows-compact #voucher_master_page #VoucherMasterList tbody td {
  padding-top: var(--s1);
  padding-bottom: var(--s1);
}

/* A stacked pair inside a cell is the single biggest contributor to row
   height on the transaction lists, and side by side it costs one line instead
   of two. The selectors carry an id because the page that defines these sets
   them under one. */
body.rows-compact #voucher_master_page .account-row,
body.rows-compact #voucher_master_page .type-subtype-container {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s2);
}

body.rows-compact #voucher_master_page .account-label {
  width: 15px;
  height: 15px;
}

body.rows-compact #voucher_master_page .account-name,
body.rows-compact #voucher_master_page .subtype-label {
  font-size: var(--t-sm);
}

/* Chips on one line where they can be. A fourth attachment still wraps - the
   cell growing to hold what is in it stays correct. */
body.rows-compact #voucher_master_page .attachment-cell a.btn,
body.rows-compact #voucher_master_page .attachment-cell button {
  height: 20px;
  font-size: 10px;
}

/* The status/action cell, which governs the row once the others fold.

   It is skipped by the folding pass on purpose - hiding half a row of buttons
   behind a click would put an approval out of reach - so it is the one cell
   that has to be made genuinely shorter rather than shorter-looking.

   Three things make it tall. The status badge sits on its own line above the
   buttons. The buttons stand 28px. And the column is pinned to 130px, narrower
   than the words on them, so Full Approved, Partial Approved and Hold each take
   a line of their own: a voucher awaiting approval is three stacked buttons
   under a badge, about 150px of row on its own.

   Compact puts the badge beside the buttons rather than above them, takes the
   buttons to 20px, and widens the column enough for two to sit side by side.
   The labels are left alone - which approval you are pressing is not a thing to
   abbreviate - and the width costs nothing, because the table already scrolls
   sideways while the height was costing rows. */
body.rows-compact #VoucherMasterList th:nth-child(10),
body.rows-compact #VoucherMasterList td:nth-child(10) {
  width: 200px !important;
  max-width: 200px !important;
  min-width: 190px !important;
}

body.rows-compact #voucher_master_page .status-action-column {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: var(--s1);
  text-align: left;
}

body.rows-compact #voucher_master_page .basic-actions-wrapper {
  margin-top: 0;
  justify-content: flex-start;
}

body.rows-compact #voucher_master_page .basic-actions-wrapper > a,
body.rows-compact #voucher_master_page .basic-actions-wrapper > button {
  height: 20px !important;
  padding: 0 var(--s1) !important;
  font-size: 10px !important;
  border-radius: var(--r-sm) !important;
}

/* A button whose label wraps is two lines tall whatever height is set on it -
   and at 10px in a 200px column, Partial Approved is exactly the label that
   would. Keeping them on one line is what makes the 20px height real rather
   than a clip. */
body.rows-compact #voucher_master_page .basic-actions-wrapper > a,
body.rows-compact #voucher_master_page .basic-actions-wrapper > button {
  white-space: nowrap;
  line-height: 1;
}

/* The status badge is the last thing on its own line. Beside the buttons it
   costs nothing. */
body.rows-compact #voucher_master_page .status-badge-wrapper {
  margin: 0;
  display: inline-flex;
  align-items: center;
}

body.rows-compact #voucher_master_page .status-badge-wrapper .badge,
body.rows-compact #voucher_master_page .status-badge-wrapper > span {
  font-size: 10px;
  padding: 0 var(--s1);
}

body.rows-compact #voucher_master_page .vm-cls-badge {
  padding: 0 var(--s1);
  font-size: 10px;
}

/* The transaction and created dates are stacked by an inline style the
   controller writes into the cell, and an inline style outranks every
   selector - so this is one of the few places !important is the tool rather
   than a shortcut. Side by side they cost one line instead of two. */
body.rows-compact #voucher_master_page .date-row-merged {
  flex-direction: row !important;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2) !important;
}

body.rows-compact #voucher_master_page .cr-date-merged {
  font-size: 10px;
}

/* ---- maximised ----

   .main-content-wrap is already a fixed region pinned below the header and
   scrolling internally, so maximising is not a new overlay - it is that same
   region starting at the top of the window instead. Everything that depends on
   it keeps working, fitTable included, because it is still the thing being
   measured.

   What that recovers: the header (--header-h), the page head with its
   breadcrumb and title, and a step off the page gutter. About 190px, which is
   one more transaction row on its own and four with compact rows on. */
body.list-maximised .e-header,
body.list-maximised .erp-nav,
body.list-maximised .erp-nav-overlay,
body.list-maximised .page-head {
  display: none !important;
}

body.list-maximised .main-content-wrap,
body.list-maximised .main-content-wrap.sidenav-open {
  top: 0;
  background: var(--bg-app);
}

body.list-maximised .page {
  padding-top: var(--s2);
  padding-bottom: var(--s2);
}

