/* VisitMe portal redesign: one theme for every portal page (2 Nov 2026).
   Carries the dashboard's design (Archivo, the SATEC palette from the 2 Nov change request, quiet surfaces, a navy
   sidebar) across the AdminLTE 3 / Bootstrap 4 pages without touching their markup or scripts.

   Loaded from views/partials/vmTheme.ejs (included from head.ejs after adminlte.min.css and styles.css; only the two
   bootstrap-table stylesheets come later). Everything is scoped under html.vm-portal (the class vmTheme.ejs adds),
   so it only applies when the theme is on, and the extra class is enough to win over most Bootstrap, AdminLTE and
   bootstrap-table rules. !important is used where something else forces a value: AdminLTE's own !important rules,
   public/css/styles.css (section 8), inline style colours, and the dashboard's body:has(#vm-dashboard) rules.

   1. Type and tokens (light, dark)      4. Tables (Bootstrap, bootstrap-table)
   2. Base                               5. Forms, pickers and plugins
   3. Shell: navbar, sidebar, footer     6. Overlays: modals, dropdowns, alerts, toasts, SweetAlert
                                         7. Pages: "Select a site", login and error pages */

/* ========== 1. Type and tokens ========== */

@font-face {
  font-family: "Archivo Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url("fonts/archivo-latin-standard-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url("fonts/archivo-latin-ext-standard-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* The same values as the dashboard (public/vm-dashboard/dashboard.css), so the two read as one product */
html.vm-portal {
  color-scheme: light;
  --canvas: #eef1f5;
  --panel: #ffffff;
  --panel-2: #f5f7fa;
  --line: #dde3ea;
  --line-2: #c7d0db;
  --ink: #0e1726;
  --ink-2: #3c4858;
  --ink-3: #5f6d82;
  --brand: #107fbc;
  --brand-ink: #0c6a9e;
  --brand-bg: #e7f2f8;
  --brand-2: #50badc;
  --good: #178a47;
  --good-ink: #116b38;
  --good-bg: #e4f5ea;
  --warning: #d36428;
  --warning-ink: #b4541f;
  --warn-bg: #fbf0ea;
  --critical: #d92d20;
  --critical-ink: #d92d20;
  --crit-bg: #fceceb;
  --nav: #0a1120;
  --nav-ink: #e8edf5;
  --nav-muted: rgba(232, 237, 245, 0.64);
  --nav-line: rgba(255, 255, 255, 0.08);
  --nav-hover: rgba(255, 255, 255, 0.06);
  --nav-active: rgba(255, 255, 255, 0.1);
  --nav-accent: #50badc;
  --scrim: rgba(10, 17, 32, 0.45);
  --shadow-1: 0 1px 2px rgba(10, 17, 32, 0.05);
  --shadow-pop: 0 12px 32px rgba(10, 17, 32, 0.14), 0 2px 6px rgba(10, 17, 32, 0.08);
  --radius: 10px;
  --radius-sm: 8px;
  --field-h: 38px;
  --vm-font: "Archivo Variable", Archivo, system-ui, -apple-system, "Segoe UI", sans-serif;
}
html.vm-portal[data-vm-mode="dark"] {
  color-scheme: dark;
  --canvas: #0a1120;
  --panel: #111a2c;
  --panel-2: #16213a;
  --line: #223049;
  --line-2: #2e3f5c;
  --ink: #e8edf5;
  --ink-2: #b4c0d2;
  --ink-3: #8292aa;
  --brand: #4db0e6;
  --brand-ink: #7cc6ee;
  --brand-bg: #12304a;
  --brand-2: #2a86ba;
  --good: #36b16b;
  --good-ink: #5fd48c;
  --good-bg: #12301f;
  --warning: #f08a5d;
  --warning-ink: #f08a5d;
  --warn-bg: #3a2216;
  --critical: #f0524a;
  --critical-ink: #ff6b61;
  --crit-bg: #3a171a;
  --nav: #070d19;
  --scrim: rgba(0, 0, 0, 0.6);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-pop: 0 16px 40px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.35);
}

/* Dark mode, filled controls: the light-blue --brand reads well as text and lines on the dark panels, but as a
   button fill with dark text it looks washed out. Filled controls keep the strong SATEC blue with white text. */
/* Filled controls with white text: the brand and green a shade darker than the accent colours (#107fbc, #178a47), so
   white text on them meets WCAG AA (4.6:1 instead of 4.4:1) */
html.vm-portal { --fill: #107bb6; --fill-hover: var(--brand-ink); --fill-ink: #ffffff; --fill-good: #168645; }
html.vm-portal[data-vm-mode="dark"] { --fill: #107bb6; --fill-hover: #0c6a9e; --fill-ink: #ffffff; --fill-good: #168645; --fill-critical: #d92d20; }

/* ========== 2. Base ========== */

/* The portal zoomed every page to 80%; the theme is designed at 100% with a 14px base instead */
html.vm-portal body { zoom: 1 !important; min-height: 100vh !important; background: var(--canvas); color: var(--ink); font-family: var(--vm-font); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
html.vm-portal .wrapper { min-height: 100vh !important; background: var(--canvas); }
html.vm-portal :where(h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6) { font-family: var(--vm-font); color: var(--ink); letter-spacing: -0.01em; }
html.vm-portal :where(h1, .h1) { font-size: 26px; font-weight: 700; }
html.vm-portal :where(h2, .h2) { font-size: 22px; font-weight: 700; }
html.vm-portal :where(h3, .h3) { font-size: 18px; font-weight: 650; }
html.vm-portal :where(h4, .h4) { font-size: 16px; font-weight: 650; }
html.vm-portal :where(h5, .h5) { font-size: 15px; font-weight: 600; }
html.vm-portal :where(h6, .h6) { font-size: 13px; font-weight: 600; }
html.vm-portal a { color: var(--brand-ink); }
html.vm-portal a:hover { color: var(--brand-ink); }
html.vm-portal ::selection { background: color-mix(in srgb, var(--brand) 22%, transparent); }
html.vm-portal :focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
html.vm-portal hr { border-color: var(--line); }
html.vm-portal small, html.vm-portal .small { font-size: 12.5px; }
/* Bootstrap colour utilities on the new palette */
html.vm-portal .text-muted { color: var(--ink-3) !important; }
html.vm-portal .text-info, html.vm-portal .text-primary { color: var(--brand-ink) !important; }
html.vm-portal .text-success { color: var(--good-ink) !important; }
html.vm-portal .text-warning { color: var(--warning-ink) !important; }
html.vm-portal .text-danger { color: var(--critical-ink) !important; }
html.vm-portal .text-dark { color: var(--ink) !important; }
html.vm-portal .text-secondary { color: var(--ink-2) !important; }
html.vm-portal .bg-white, html.vm-portal .bg-light { background-color: var(--panel) !important; }
html.vm-portal .bg-info, html.vm-portal .bg-primary { background-color: var(--fill) !important; color: #fff !important; }
html.vm-portal .bg-success { background-color: var(--fill-good) !important; }
html.vm-portal .bg-warning { background-color: var(--warning) !important; color: #fff !important; }
html.vm-portal .bg-danger { background-color: var(--critical) !important; }
html.vm-portal .border, html.vm-portal .border-top, html.vm-portal .border-bottom, html.vm-portal .border-left, html.vm-portal .border-right { border-color: var(--line) !important; }
html.vm-portal .color-satec { color: var(--brand-ink) !important; }
html.vm-portal [style*="background: white"], html.vm-portal [style*="background-color: white"], html.vm-portal [style*="background:white"] { background: var(--panel) !important; }

/* ========== 3. Shell ========== */

/* Content area: the page sits on the canvas with room to breathe */
html.vm-portal .content-wrapper { background: var(--canvas) !important; min-height: calc(100vh - 57px - 41px) !important; color: var(--ink); }
/* .container-fluid keeps Bootstrap's 7.5px padding: rows inside it use matching negative margins */
html.vm-portal .content-wrapper > .content { padding: 20px 16px 28px; }
html.vm-portal .content-header { padding: 20px 24px 0; }
html.vm-portal .content-header h1 { font-size: 22px; }
@media (max-width: 575.98px) { html.vm-portal .content-wrapper > .content { padding: 14px 12px 20px; } }

/* Navbar: a slim white bar with a hairline; page title and site on the left, actions on the right */
html.vm-portal .main-header { background: var(--panel) !important; border-bottom: 1px solid var(--line) !important; box-shadow: none !important; min-height: 57px; padding: 0 16px 0 8px; font-family: var(--vm-font); }
html.vm-portal .main-header .nav-link { color: var(--ink-2); height: 40px; display: flex; align-items: center; }
html.vm-portal .main-header [data-widget="pushmenu"] { width: 40px; justify-content: center; border-radius: 8px; }
html.vm-portal .main-header [data-widget="pushmenu"]:hover { background: var(--panel-2); }
html.vm-portal .main-header .h5 { margin: 0 0 0 6px !important; color: var(--ink-3) !important; display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 12px; margin-left: 6px; min-width: 0; }
html.vm-portal .main-header .h5 strong { font-size: 16px; font-weight: 650; color: var(--ink); letter-spacing: -0.01em; }
html.vm-portal .main-header .h5 small { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-3); }
html.vm-portal .main-header .h5 small::before { content: "\f3c5"; font-family: "Font Awesome 5 Free"; font-weight: 900; font-size: 11px; color: var(--brand-ink); }
html.vm-portal .main-header .navbar-nav.ml-auto { gap: 10px; align-items: center; }
html.vm-portal .main-header .sms-credits { margin: 0 !important; font-size: 12.5px; color: var(--ink-3) !important; white-space: nowrap; }
html.vm-portal .main-header .sms-credits:empty { display: none !important; }
html.vm-portal .vm-iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); cursor: pointer; }
html.vm-portal .vm-iconbtn:hover { background: var(--panel-2); color: var(--ink); }
html.vm-portal .main-header [data-target="#supportModal"] { background: var(--ink) !important; border: 0 !important; color: var(--panel) !important; font: 600 13px/1 var(--vm-font); height: 36px; padding: 0 6px 0 14px !important; align-items: center; box-shadow: none !important; }
html.vm-portal .main-header [data-target="#supportModal"] img { height: 26px !important; margin-left: 8px !important; }
html.vm-portal .main-header .d-sm-none[data-target="#supportModal"] img { margin-left: 0 !important; }
html.vm-portal .main-header .d-sm-none[data-target="#supportModal"] { padding: 0 5px !important; }
html.vm-portal[data-vm-mode="dark"] .main-header [data-target="#supportModal"] { background: var(--panel-2) !important; color: var(--ink) !important; border: 1px solid var(--line-2) !important; }
html.vm-portal .main-header img[alt="Logo"] { height: 32px !important; width: auto; float: none !important; margin: 0 0 0 4px !important; }
html.vm-portal[data-vm-mode="dark"] .main-header img[alt="Logo"] { background: #fff; border-radius: 6px; padding: 3px; }
@media (max-width: 575.98px) { html.vm-portal .main-header .h5 small, html.vm-portal .main-header .sms-credits { display: none !important; } }

/* Sidebar: navy, rounded rows, the current page marked with the light-blue accent */
html.vm-portal .main-sidebar { background: linear-gradient(180deg, #101b33 0%, var(--nav) 38%) !important; box-shadow: none !important; font-family: var(--vm-font); }
html.vm-portal .brand-link { background: var(--nav) !important; border-bottom: 1px solid var(--nav-line) !important; color: var(--nav-ink) !important; display: flex !important; align-items: center; gap: 10px; height: 57px; padding: 0 16px !important; font-size: 15px; line-height: 1.2; }
/* !important on the size: the dashboard's stylesheet sizes this logo with a body:has(#vm-dashboard) rule, which outranks any class selector */
html.vm-portal .brand-link .brand-image { box-shadow: none !important; opacity: 1 !important; margin: 0 !important; width: auto !important; height: 24px !important; max-width: 96px; max-height: none; float: none; object-fit: contain; border-radius: 0 !important; }
html.vm-portal .brand-link .brand-text { font-weight: 400 !important; letter-spacing: -0.01em; color: var(--nav-ink); white-space: nowrap; }
html.vm-portal .brand-link .brand-text strong { font-weight: 700; }
html.vm-portal .main-sidebar .sidebar { padding: 0 8px 16px; }
html.vm-portal .main-sidebar .user-panel { border-bottom: 1px solid var(--nav-line) !important; margin: 0 !important; }
html.vm-portal .main-sidebar .user-panel:has(.info) { gap: 10px; padding: 14px 6px !important; }
html.vm-portal .main-sidebar .user-panel:has(.info) .image { padding: 0 !important; }
html.vm-portal .main-sidebar .user-panel:has(.info) .image .nav-icon { font-size: 30px !important; color: var(--nav-accent) !important; box-shadow: none !important; }
html.vm-portal .vm-user__avatar { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: color-mix(in srgb, var(--nav-accent) 22%, transparent); color: var(--nav-ink); font-size: 12.5px; font-weight: 700; letter-spacing: 0.02em; }
html.vm-portal .main-sidebar .user-panel:has(.info) .info { padding: 0 !important; min-width: 0; line-height: 1.25; }
html.vm-portal .main-sidebar .user-panel .info a strong { font-weight: inherit; }
html.vm-portal .main-sidebar .user-panel .info a { color: var(--nav-ink) !important; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.vm-portal .vm-user__access { display: block; font-size: 11.5px; color: var(--nav-muted); }
html.vm-portal .main-sidebar .user-panel:has(#select-site) { display: block !important; margin-top: 0 !important; padding: 12px 6px 14px !important; }
html.vm-portal .main-sidebar .user-panel:has(#select-site)::before { content: "Site"; display: block; margin: 0 0 6px 2px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--nav-muted); }
html.vm-portal .main-sidebar .select2-container--default .select2-selection--single { background: var(--nav-hover) !important; border: 1px solid var(--nav-line) !important; border-radius: 8px !important; height: 38px !important; }
html.vm-portal .main-sidebar .select2-selection__rendered { color: var(--nav-ink) !important; font: 500 13.5px var(--vm-font) !important; line-height: 36px !important; padding-left: 12px !important; }
html.vm-portal .main-sidebar .select2-selection__arrow { height: 36px !important; }
html.vm-portal .main-sidebar .select2-selection__arrow b { border-color: var(--nav-muted) transparent transparent !important; }
html.vm-portal .select2-container.select-site-dropdown .select2-dropdown { min-width: 260px; }
html.vm-portal .select-site-dropdown .select2-results__option { padding: 8px 12px; }
html.vm-portal .select-site-dropdown .select2-results > .select2-results__options { max-height: min(60vh, 420px); }
html.vm-portal .vm-siteopt { display: flex; flex-direction: column; line-height: 1.25; }
html.vm-portal .vm-siteopt__name { font-size: 13.5px; font-weight: 500; }
html.vm-portal .vm-siteopt__client { font-size: 11.5px; color: var(--ink-3); }
html.vm-portal .vm-siteopt--all .vm-siteopt__name { font-weight: 650; }
html.vm-portal .select2-results__option--highlighted .vm-siteopt__client { color: inherit; opacity: 0.85; }
html.vm-portal .nav-sidebar { padding-top: 6px; }
html.vm-portal .nav-sidebar .nav-item { margin-bottom: 2px; }
html.vm-portal .nav-sidebar .nav-link { color: var(--nav-muted) !important; background: transparent !important; box-shadow: none !important; border-radius: 8px !important; padding: 8px 10px !important; display: flex !important; align-items: center; font-size: 13.5px; font-weight: 500 !important; }
html.vm-portal .nav-sidebar .nav-link:hover, html.vm-portal .nav-sidebar .nav-link:focus { background: var(--nav-hover) !important; color: var(--nav-ink) !important; }
html.vm-portal .nav-sidebar .nav-link.vm-current, html.vm-portal .nav-sidebar > .nav-item > .nav-link.active { background: var(--nav-active) !important; color: #fff !important; box-shadow: inset 3px 0 0 var(--nav-accent) !important; font-weight: 600 !important; }
html.vm-portal .nav-sidebar .nav-icon { width: 1.5rem; margin-right: 8px !important; font-size: 14px !important; text-align: center; opacity: 0.85; }
html.vm-portal .nav-sidebar .nav-link p { margin: 0; flex: 1; display: flex; align-items: center; justify-content: space-between; white-space: nowrap; }
html.vm-portal .nav-sidebar .nav-link p .right { position: static !important; font-size: 12px; transition: transform 0.15s; }
html.vm-portal .nav-sidebar .menu-open > .nav-link p .right { transform: rotate(90deg); }
html.vm-portal .nav-sidebar .nav-treeview { padding-left: 14px; }
html.vm-portal .nav-sidebar .nav-treeview .nav-link { font-size: 13px; }
html.vm-portal .nav-sidebar > .nav-item:has(> a[href="/logout"]) { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--nav-line); }
html.vm-portal .sidebar-collapse .main-sidebar .user-panel:has(#select-site), html.vm-portal .sidebar-collapse .main-sidebar .user-panel:has(.info) .info { display: none !important; }
html.vm-portal .sidebar-mini.sidebar-collapse .main-sidebar:hover .user-panel:has(#select-site) { display: block !important; }
html.vm-portal .sidebar-mini.sidebar-collapse .main-sidebar:hover .user-panel:has(.info) .info { display: block !important; }
html.vm-portal .main-sidebar .os-scrollbar-handle { background: rgba(255, 255, 255, 0.2) !important; }

/* Footer */
html.vm-portal .main-footer { background: var(--canvas) !important; border-top: 1px solid var(--line) !important; color: var(--ink-3) !important; font: 12.5px/1.4 var(--vm-font) !important; padding: 10px 24px !important; }
html.vm-portal .main-footer a { color: var(--ink-2) !important; }

/* ========== Components: cards, buttons, badges, tabs, pagination ========== */

html.vm-portal .card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); color: var(--ink); }
html.vm-portal .card-header { background: transparent; border-bottom: 1px solid var(--line); padding: 14px 18px; }
html.vm-portal .card-header .card-title, html.vm-portal .card-title { font-size: 15px; font-weight: 650; color: var(--ink); }
html.vm-portal .card-body { padding: 18px; }
html.vm-portal .card-footer { background: var(--panel-2); border-top: 1px solid var(--line); }
html.vm-portal .card[class*="card-outline"] { border-top: 3px solid var(--brand); }
html.vm-portal .small-box, html.vm-portal .info-box { border-radius: var(--radius); box-shadow: var(--shadow-1); background: var(--panel); color: var(--ink); }
html.vm-portal .list-group-item { background: var(--panel); border-color: var(--line); color: var(--ink); }
html.vm-portal .list-group-item.active { background: var(--fill); border-color: var(--fill); }

/* Buttons: one primary (info, primary), quiet secondaries, outline variants on the palette */
html.vm-portal .btn { font-family: var(--vm-font); font-weight: 600; font-size: 13.5px; border-radius: var(--radius-sm); padding: 7px 14px; line-height: 1.4; box-shadow: none !important; transition: background-color 0.12s, border-color 0.12s, color 0.12s; }
html.vm-portal .btn-sm, html.vm-portal .btn-group-sm > .btn { font-size: 12.5px; padding: 5px 11px; border-radius: 7px; }
html.vm-portal .btn-xs { font-size: 12px; padding: 3px 8px; border-radius: 6px; }
html.vm-portal .btn-lg { font-size: 15px; padding: 10px 18px; }
html.vm-portal .btn-info, html.vm-portal .btn-primary { background: var(--fill); border-color: var(--fill); color: #fff; }
html.vm-portal .btn-info:hover, html.vm-portal .btn-primary:hover, html.vm-portal .btn-info:focus, html.vm-portal .btn-primary:focus, html.vm-portal .btn-info:not(:disabled):not(.disabled):active, html.vm-portal .btn-primary:not(:disabled):not(.disabled):active { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; }
html.vm-portal[data-vm-mode="dark"] .btn-info, html.vm-portal[data-vm-mode="dark"] .btn-primary { color: var(--canvas); }
html.vm-portal .btn-secondary, html.vm-portal .btn-default, html.vm-portal .btn-light { background: var(--panel); border: 1px solid var(--line-2); color: var(--ink); }
html.vm-portal .btn-secondary:hover, html.vm-portal .btn-default:hover, html.vm-portal .btn-light:hover, html.vm-portal .btn-secondary:not(:disabled):not(.disabled):active { background: var(--panel-2); border-color: var(--line-2); color: var(--ink); }
html.vm-portal .btn-success { background: var(--fill-good); border-color: var(--fill-good); color: #fff; }
html.vm-portal .btn-success:hover { background: var(--good-ink); border-color: var(--good-ink); }
/* white on the orange token is 3.7:1; filled warning buttons and pills use a deeper orange (4.9:1) */
html.vm-portal .btn-warning { background: #b4541f; border-color: #b4541f; color: #fff; }
html.vm-portal .btn-danger { background: var(--critical); border-color: var(--critical); color: #fff; }
html.vm-portal .btn-danger:hover { background: color-mix(in srgb, var(--critical) 86%, #000); border-color: color-mix(in srgb, var(--critical) 86%, #000); }
html.vm-portal .btn-dark { background: var(--ink); border-color: var(--ink); color: var(--panel); }
html.vm-portal .btn-outline-info, html.vm-portal .btn-outline-primary { color: var(--brand-ink); border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); background: var(--panel); }
html.vm-portal .btn-outline-info:hover, html.vm-portal .btn-outline-primary:hover, html.vm-portal .btn-outline-info.active, html.vm-portal .btn-outline-primary.active { background: var(--brand-bg); border-color: var(--brand); color: var(--brand-ink); }
html.vm-portal .btn-outline-secondary, html.vm-portal .btn-outline-dark { color: var(--ink-2); border-color: var(--line-2); background: var(--panel); }
html.vm-portal .btn-outline-secondary:hover, html.vm-portal .btn-outline-dark:hover, html.vm-portal .btn-outline-secondary.active { background: var(--panel-2); color: var(--ink); border-color: var(--line-2); }
html.vm-portal .btn-outline-danger { color: var(--critical-ink); border-color: color-mix(in srgb, var(--critical) 45%, var(--line)); background: var(--panel); }
html.vm-portal .btn-outline-danger:hover { background: var(--crit-bg); color: var(--critical-ink); border-color: var(--critical); }
html.vm-portal .btn-outline-success { color: var(--good-ink); border-color: color-mix(in srgb, var(--good) 45%, var(--line)); background: var(--panel); }
html.vm-portal .btn-outline-success:hover { background: var(--good-bg); color: var(--good-ink); }
html.vm-portal .btn-outline-warning { color: var(--warning-ink); border-color: color-mix(in srgb, var(--warning) 45%, var(--line)); background: var(--panel); }
html.vm-portal .btn-outline-warning:hover { background: var(--warn-bg); color: var(--warning-ink); }
html.vm-portal .btn-link { color: var(--brand-ink); font-weight: 600; }
html.vm-portal .btn:disabled, html.vm-portal .btn.disabled { opacity: 0.5; }
html.vm-portal .btn-group > .btn:not(:last-child):not(.dropdown-toggle) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
html.vm-portal .btn-group > .btn:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
html.vm-portal .close { color: var(--ink-3); text-shadow: none; opacity: 1; font-weight: 400; }
html.vm-portal .close:hover { color: var(--ink); }

/* Badges: soft fills with the colour as ink */
html.vm-portal .badge { font-family: var(--vm-font); font-weight: 600; font-size: 11.5px; padding: 4px 8px; border-radius: 999px; }
html.vm-portal .badge-info, html.vm-portal .badge-primary { background: var(--brand-bg); color: var(--brand-ink); }
html.vm-portal .badge-success { background: var(--good-bg); color: var(--good-ink); }
html.vm-portal .badge-warning { background: var(--warn-bg); color: var(--warning-ink); }
html.vm-portal .badge-danger { background: var(--crit-bg); color: var(--critical-ink); }
html.vm-portal .badge-secondary, html.vm-portal .badge-light, html.vm-portal .badge-dark { background: var(--panel-2); color: var(--ink-2); border: 1px solid var(--line); }

/* Tabs and pills */
html.vm-portal .nav-tabs { border-bottom: 1px solid var(--line); gap: 4px; }
html.vm-portal .nav-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--ink-3); font-weight: 600; font-size: 13.5px; padding: 10px 14px; margin-bottom: -1px; background: transparent; }
html.vm-portal .nav-tabs .nav-link:hover { color: var(--ink); border-bottom-color: var(--line-2); }
html.vm-portal .nav-tabs .nav-link.active, html.vm-portal .nav-tabs .nav-item.show .nav-link { color: var(--brand-ink); border-bottom-color: var(--brand); background: transparent; }
html.vm-portal .content-wrapper .nav-pills .nav-link { border-radius: var(--radius-sm); color: var(--ink-2); font-weight: 600; }
html.vm-portal .content-wrapper .nav-pills .nav-link.active { background: var(--brand-bg); color: var(--brand-ink); }
html.vm-portal .tab-content { color: var(--ink); }

/* Pagination */
html.vm-portal .pagination { gap: 4px; margin: 0; }
html.vm-portal .page-link { border: 1px solid var(--line); border-radius: 7px !important; color: var(--ink-2); background: var(--panel); min-width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 0 10px; font-size: 13px; font-weight: 600; margin: 0 !important; }
html.vm-portal .page-link:hover { background: var(--panel-2); color: var(--ink); border-color: var(--line-2); }
html.vm-portal .page-item.active .page-link { background: var(--fill); border-color: var(--fill); color: #fff; }
html.vm-portal[data-vm-mode="dark"] .page-item.active .page-link { color: var(--canvas); }
html.vm-portal .page-item.disabled .page-link { background: var(--panel); color: var(--ink-3); opacity: 0.6; }

/* Progress */
html.vm-portal .progress { background: var(--panel-2); border-radius: 999px; height: 8px; box-shadow: none; }
html.vm-portal .progress-bar { background: var(--fill); }

/* ========== 4. Tables ========== */

/* A table is a panel: white surface, hairline rows, a quiet header (the portal's black thead-dark becomes a label row) */
html.vm-portal .table { color: var(--ink); font-size: 13px; margin-bottom: 0; background: var(--panel); }
html.vm-portal .table th, html.vm-portal .table td { border-color: var(--line) !important; vertical-align: middle; padding: 8px 10px; }
html.vm-portal .table-sm th, html.vm-portal .table-sm td { padding: 7px 10px; }
html.vm-portal .table thead th, html.vm-portal .thead-dark th, html.vm-portal .table .thead-dark th, html.vm-portal .table .thead-light th { background: var(--panel-2) !important; color: var(--ink-3) !important; border-color: var(--line) !important; border-bottom: 1px solid var(--line) !important; font-size: 12px; font-weight: 600; letter-spacing: 0.02em; text-transform: none; white-space: nowrap; }
html.vm-portal .table tbody tr { border-top: 1px solid var(--line); }
html.vm-portal .table tbody tr:first-child { border-top: 0; }
html.vm-portal .table-hover tbody tr:hover, html.vm-portal .bootstrap-table .table-hover > tbody > tr:hover { background: color-mix(in srgb, var(--brand) 5%, var(--panel)); color: var(--ink); }
html.vm-portal .table-striped tbody tr:nth-of-type(odd) { background: color-mix(in srgb, var(--panel-2) 60%, var(--panel)); }
html.vm-portal .table-bordered, html.vm-portal .table-bordered th, html.vm-portal .table-bordered td { border-color: var(--line) !important; }
html.vm-portal .table .btn-sm, html.vm-portal .table .btn-xs { padding: 3px 9px; font-size: 12px; }
html.vm-portal .table td .btn + .btn { margin-left: 4px; }
html.vm-portal table.table td:last-child { white-space: nowrap; }

/* bootstrap-table: the toolbar, the table inside a panel, the footer with counts and pages */
html.vm-portal .bootstrap-table .fixed-table-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 12px; }
html.vm-portal .bootstrap-table .fixed-table-toolbar::after { display: none; }
html.vm-portal .bootstrap-table .fixed-table-toolbar .bs-bars, html.vm-portal .bootstrap-table .fixed-table-toolbar .search, html.vm-portal .bootstrap-table .fixed-table-toolbar .columns { float: none !important; margin: 0 !important; }
html.vm-portal .bootstrap-table .fixed-table-toolbar .bs-bars { flex: 1 1 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
html.vm-portal .bootstrap-table .fixed-table-toolbar .bs-bars .btn + .btn { margin-left: 0 !important; }
html.vm-portal .bootstrap-table .fixed-table-toolbar .bs-bars > div { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
html.vm-portal .bootstrap-table .fixed-table-toolbar .bs-bars > div > .btn { margin: 0 !important; }
html.vm-portal .bootstrap-table .fixed-table-toolbar .search { order: 2; }
/* Report toolbars (Transactions: date range, Auto-Refresh, Search, then the Reset/Refresh/Configure/Download group): one
   centre line with an even gap, so the group lines up with the search box instead of sitting on the form-groups' bottom margin
   and its own 2px/16px inline nudges, and the buttons are as tall as the fields */
html.vm-portal #toolbar > .form-inline { flex-wrap: wrap; align-items: center; gap: 8px 12px; }
html.vm-portal #toolbar > .form-inline > * { margin-top: 0 !important; margin-bottom: 0 !important; }
html.vm-portal #toolbar > .form-inline > :not(.ml-auto) { margin-left: 0 !important; }
html.vm-portal #toolbar > .form-inline > .btn-group > .btn { display: inline-flex; align-items: center; justify-content: center; height: var(--field-h); min-width: var(--field-h); padding-top: 0; padding-bottom: 0; }
/* Too narrow for one line: date range and Auto-Refresh on the first, search and the button group together on the second */
@media (min-width: 576px) and (max-width: 1199.98px) {
  html.vm-portal #toolbar > .form-inline:has(> .btn-group) { row-gap: 0; }
  html.vm-portal #toolbar > .form-inline:has(> .btn-group)::after { content: ""; order: 1; flex-basis: 100%; height: 8px; }
  html.vm-portal #toolbar > .form-inline:has(> .btn-group) > :is(.btn-group, .form-group:has(input[type="search"])) { order: 2; }
  html.vm-portal #toolbar > .form-inline:has(> .btn-group) > .form-group:has(input[type="search"]) { flex: 1 1 auto; }
  html.vm-portal #toolbar > .form-inline:has(> .btn-group) > .form-group:has(input[type="search"]) > input { width: 100%; }
}
/* Phones: the button group spans the width like the fields above it, one equal button each */
@media (max-width: 575.98px) {
  html.vm-portal #toolbar > .form-inline > .btn-group { flex: 1 1 100%; }
  html.vm-portal #toolbar > .form-inline > .btn-group > .btn { flex: 1 1 0; }
}
html.vm-portal .bootstrap-table .fixed-table-toolbar .columns { order: 3; display: flex; gap: 6px; }
html.vm-portal .bootstrap-table .fixed-table-toolbar .search .form-control { min-width: 240px; padding-left: 34px; background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235f6d82' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 11px center; }
html.vm-portal .bootstrap-table .fixed-table-toolbar .columns .btn, html.vm-portal .bootstrap-table .fixed-table-toolbar .columns .btn-group > .btn { background: var(--panel); border: 1px solid var(--line-2); color: var(--ink-2); border-radius: var(--radius-sm) !important; height: var(--field-h); padding: 0 12px; }
html.vm-portal .bootstrap-table .fixed-table-toolbar .columns .btn:hover { background: var(--panel-2); color: var(--ink); }
/* Where the page makes its toolbar buttons blue (buttonsClass: 'info' on Bookings, Hosts, Employees...), the Export data
   button keeps the blue fill, so it takes the same white text as the Add/Upload buttons next to it, hovered or not */
html.vm-portal .bootstrap-table .fixed-table-toolbar .columns .btn-group > .btn:is(.btn-info, .btn-primary), html.vm-portal .bootstrap-table .fixed-table-toolbar .columns .btn-group > .btn:is(.btn-info, .btn-primary):is(:hover, :focus, :active, .active) { color: #fff; border-color: var(--fill); }
html.vm-portal .bootstrap-table .fixed-table-container { background: var(--panel); border: 1px solid var(--line) !important; border-radius: var(--radius); box-shadow: var(--shadow-1); overflow: hidden; }
html.vm-portal .bootstrap-table .fixed-table-container .table { border: 0; }
html.vm-portal .bootstrap-table .fixed-table-container .table thead th { border-top: 0 !important; }
html.vm-portal .bootstrap-table .fixed-table-container .table thead th .th-inner { padding: 10px 12px; }
html.vm-portal .bootstrap-table .fixed-table-container .table thead th .sortable { padding-right: 26px !important; }
html.vm-portal .bootstrap-table .fixed-table-container .table thead th .both { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='14' viewBox='0 0 10 14'%3E%3Cpath d='M5 1 1.5 5h7zM5 13 1.5 9h7z' fill='%2394a3b8'/%3E%3C/svg%3E") !important; background-position: right 8px center !important; }
html.vm-portal .bootstrap-table .fixed-table-container .table thead th .asc { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='14' viewBox='0 0 10 14'%3E%3Cpath d='M5 1 1.5 5h7z' fill='%23107fbc'/%3E%3Cpath d='M5 13 1.5 9h7z' fill='%23c7d0db'/%3E%3C/svg%3E") !important; background-position: right 8px center !important; }
html.vm-portal .bootstrap-table .fixed-table-container .table thead th .desc { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='14' viewBox='0 0 10 14'%3E%3Cpath d='M5 1 1.5 5h7z' fill='%23c7d0db'/%3E%3Cpath d='M5 13 1.5 9h7z' fill='%23107fbc'/%3E%3C/svg%3E") !important; background-position: right 8px center !important; }
html.vm-portal .bootstrap-table .fixed-table-container .table thead th .filter-control { padding: 0 8px 8px; }
html.vm-portal .bootstrap-table .fixed-table-container .table thead th .filter-control .form-control { height: 30px; min-height: 30px; font-size: 12.5px; padding: 4px 8px; border-radius: 6px; }
html.vm-portal .bootstrap-table .fixed-table-container .table.table-borderless tbody tr { border-top: 1px solid var(--line); }
html.vm-portal .bootstrap-table .fixed-table-container .table tbody tr.selected td { background: var(--brand-bg); }
html.vm-portal .bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading { background: var(--panel); color: var(--ink-3); }
html.vm-portal .bootstrap-table .fixed-table-container .no-records-found td { padding: 36px 12px !important; color: var(--ink-3); text-align: center; }
html.vm-portal .bootstrap-table .fixed-table-pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 2px 0; color: var(--ink-3); font-size: 13px; }
html.vm-portal .bootstrap-table .fixed-table-pagination::after { display: none; }
html.vm-portal .bootstrap-table .fixed-table-pagination > .pagination-detail, html.vm-portal .bootstrap-table .fixed-table-pagination > .pagination { float: none !important; margin: 0 !important; }
/* the page-size button is a btn-info, which styles.css paints blue with !important: restate it as a quiet button */
html.vm-portal .bootstrap-table .fixed-table-pagination .page-list .btn { height: 30px; padding: 0 10px; background: var(--panel) !important; border: 1px solid var(--line-2) !important; color: var(--ink-2) !important; }
/* Sticky header plugin */
html.vm-portal .bootstrap-table .sticky-header-container thead th { background: var(--panel-2) !important; }

/* ========== 5. Forms, pickers and plugins ========== */

html.vm-portal label, html.vm-portal .col-form-label, html.vm-portal .form-label { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
html.vm-portal .form-group { margin-bottom: 16px; }
html.vm-portal .form-text { color: var(--ink-3); font-size: 12px; }
html.vm-portal .form-control, html.vm-portal .custom-select, html.vm-portal .custom-file-label { min-height: var(--field-h); height: auto; padding: 7px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background-color: var(--panel); color: var(--ink); font-family: var(--vm-font); font-size: 13.5px; box-shadow: none; transition: border-color 0.12s, box-shadow 0.12s; }
html.vm-portal .form-control-sm, html.vm-portal .custom-select-sm { min-height: 32px; padding: 4px 10px; font-size: 13px; }
html.vm-portal textarea.form-control { min-height: 80px; }
html.vm-portal .form-control::placeholder { color: var(--ink-3); opacity: 0.8; }
html.vm-portal .form-control:focus, html.vm-portal .custom-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); background-color: var(--panel); color: var(--ink); }
html.vm-portal .form-control:disabled, html.vm-portal .form-control[readonly], html.vm-portal .custom-select:disabled { background-color: var(--panel-2); color: var(--ink-3); }
html.vm-portal .custom-select { padding-right: 32px; background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235f6d82' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; }
html.vm-portal .is-invalid, html.vm-portal .form-control.error { border-color: var(--critical) !important; }
html.vm-portal .invalid-feedback, html.vm-portal label.error { color: var(--critical-ink); font-size: 12px; font-weight: 500; }
html.vm-portal .input-group > .form-control:not(:last-child), html.vm-portal .input-group > .custom-select:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
html.vm-portal .input-group > .form-control:not(:first-child), html.vm-portal .input-group > .custom-select:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
html.vm-portal .input-group-text { background: var(--panel-2); border: 1px solid var(--line-2); color: var(--ink-3); border-radius: var(--radius-sm); font-size: 13px; }
html.vm-portal .input-group-append .btn, html.vm-portal .input-group-prepend .btn { border-radius: var(--radius-sm); }
html.vm-portal .input-group-append > .btn, html.vm-portal .input-group-append > .input-group-text { border-top-left-radius: 0; border-bottom-left-radius: 0; }
html.vm-portal .input-group-prepend > .btn, html.vm-portal .input-group-prepend > .input-group-text { border-top-right-radius: 0; border-bottom-right-radius: 0; }
/* Fieldsets (the portal groups checkboxes in fieldset.fieldset-border with a legend) */
/* Legends: the portal sets font-size: 16px inline on each one; at this size they no longer wrap in narrow boxes */
html.vm-portal fieldset legend, html.vm-portal .fieldset-border legend { width: auto; max-width: 100%; margin: 0 0 0 -4px; padding: 0 6px; font-size: 12.5px !important; font-weight: 650 !important; line-height: 1.4; color: var(--ink-2); float: none; }
/* In dialogs each group's title is an outlined pill on the border (as the Scanner Procedures names), so Medical, Induction,
   Equipment, Custom Data... read as separate sections at a glance */
html.vm-portal .modal fieldset > legend { display: inline-flex; align-items: center; width: auto !important; margin: 0 0 4px -6px !important; padding: 2px 12px !important; border: 1px solid var(--line-2); border-radius: 999px; background: var(--panel); color: var(--ink-2); font-size: 12px !important; line-height: 1.4; }
html.vm-portal fieldset .form-check, html.vm-portal fieldset .custom-control { font-size: 13px; }
/* Checkboxes, radios, switches */
/* A checkbox and its label are a flex pair: a label that does not fit wraps inside its own column instead of running
   over the next checkbox (the portal puts each checkbox in a fixed col-4/col-6 column, often inside a narrow box) */
html.vm-portal .form-check:not(.form-check-inline) { display: flex; align-items: flex-start; gap: 6px; padding-left: 0; }
html.vm-portal .form-check:not(.form-check-inline) > .form-check-input { position: static; flex-shrink: 0; margin: 3px 0 0; }
html.vm-portal .form-check-label { min-width: 0; overflow-wrap: break-word; }
html.vm-portal .form-check-input, html.vm-portal input[type="checkbox"], html.vm-portal input[type="radio"] { accent-color: var(--brand); }
html.vm-portal .form-check-label { font-weight: 500; color: var(--ink); }
/* Dialogs built from long checklists in fieldsets (Transactions > Configure Report: up to 21 columns per section): plain labels, 16px boxes,
   rows tall enough to tap, two columns where the dialog is wide enough */
html.vm-portal .modal-body:has(fieldset > :nth-child(6 of .form-check)) fieldset:has(> .form-check) > .form-check :is(strong, b) { font-weight: inherit; }
html.vm-portal .modal-body:has(fieldset > :nth-child(6 of .form-check)) fieldset:has(> .form-check) > .form-check { align-items: center; min-height: 28px; margin: 0; }
html.vm-portal .modal-body:has(fieldset > :nth-child(6 of .form-check)) fieldset:has(> .form-check) > .form-check > .form-check-input { width: 16px; height: 16px; margin: 0; }
html.vm-portal .modal-body:has(fieldset > :nth-child(6 of .form-check)) fieldset:has(> .form-check) > .form-check > .form-check-label { flex: 1; margin: 0; padding: 4px 0; cursor: pointer; }
@media (min-width: 576px) {
  html.vm-portal .modal-body:has(fieldset > :nth-child(6 of .form-check)) fieldset:has(> .form-check) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; align-content: start; }
  html.vm-portal .modal-body:has(fieldset > :nth-child(6 of .form-check)) fieldset:has(> .form-check) > :not(.form-check) { grid-column: 1 / -1; }
}
@media (max-width: 575.98px) { html.vm-portal .modal-body:has(fieldset > :nth-child(6 of .form-check)) fieldset:has(> .form-check) > .form-check { min-height: 36px; } }
html.vm-portal .custom-control-label { font-weight: 500; color: var(--ink); }
html.vm-portal .custom-control-label::before { border-color: var(--line-2); background: var(--panel); }
html.vm-portal .custom-control-input:checked ~ .custom-control-label::before { background: var(--fill); border-color: var(--fill); }
html.vm-portal .custom-control-input:focus ~ .custom-control-label::before { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
html.vm-portal .custom-switch .custom-control-input:checked ~ .custom-control-label::after { background: #fff; }
/* bootstrap-toggle */
html.vm-portal .toggle.btn { border-radius: 999px !important; border: 1px solid var(--line-2); }
html.vm-portal .toggle-on.btn { background: var(--fill); border-color: var(--fill); color: #fff; }
html.vm-portal .toggle-off.btn { background: var(--panel-2); color: var(--ink-2); }
html.vm-portal .toggle-handle.btn { background: var(--panel); border: 1px solid var(--line-2); border-radius: 999px !important; }

/* Select2 (everywhere) */
html.vm-portal .select2-container { font-family: var(--vm-font); }
html.vm-portal .content-wrapper .select2-container--default .select2-selection--single, html.vm-portal .modal .select2-container--default .select2-selection--single { height: var(--field-h); border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--panel); }
html.vm-portal .content-wrapper .select2-container--default .select2-selection--single .select2-selection__rendered, html.vm-portal .modal .select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 36px; padding-left: 12px; color: var(--ink); font-size: 13.5px; }
html.vm-portal .content-wrapper .select2-container--default .select2-selection--single .select2-selection__arrow, html.vm-portal .modal .select2-container--default .select2-selection--single .select2-selection__arrow { height: 36px; right: 6px; }
html.vm-portal .select2-container--default .select2-selection--multiple { min-height: var(--field-h); border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--panel); padding: 2px 6px; }
html.vm-portal .select2-container--default.select2-container--focus .select2-selection--multiple, html.vm-portal .select2-container--default.select2-container--open .select2-selection { border-color: var(--brand); }
html.vm-portal .select2-container--default .select2-selection--multiple .select2-selection__choice { background: var(--brand-bg); border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent); color: var(--brand-ink); border-radius: 6px; padding: 1px 8px; font-size: 12.5px; font-weight: 600; margin-top: 4px; }
html.vm-portal .select2-container--default .select2-selection--multiple .select2-selection__choice__remove { color: var(--brand-ink); margin-right: 5px; }
html.vm-portal .select2-dropdown { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-pop); color: var(--ink); overflow: hidden; font-size: 13.5px; }
html.vm-portal .select2-search--dropdown { padding: 8px; }
html.vm-portal .select2-search--dropdown .select2-search__field { border: 1px solid var(--line-2) !important; border-radius: 6px; padding: 6px 10px; background: var(--panel); color: var(--ink); font-family: var(--vm-font); }
html.vm-portal .select2-results__option { padding: 7px 12px; }
html.vm-portal .select2-container--default .select2-results__option--highlighted[aria-selected], html.vm-portal .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable { background: var(--fill) !important; color: #fff !important; }
html.vm-portal[data-vm-mode="dark"] .select2-container--default .select2-results__option--highlighted[aria-selected] { color: var(--canvas) !important; }
html.vm-portal .select2-container--default .select2-results__option[aria-selected="true"] { background: var(--brand-bg); color: var(--brand-ink); }
html.vm-portal .select2-container--default .select2-results__group { color: var(--ink-3); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 10px 12px 4px; }

/* bootstrap-select (selectpicker) */
html.vm-portal .bootstrap-select > .dropdown-toggle { background: var(--panel) !important; border: 1px solid var(--line-2) !important; color: var(--ink) !important; border-radius: var(--radius-sm); height: var(--field-h); font-weight: 400; }
html.vm-portal .bootstrap-select .dropdown-menu li a { color: var(--ink); }
html.vm-portal .bootstrap-select .dropdown-menu li.selected a, html.vm-portal .bootstrap-select .dropdown-menu li a:hover { background: var(--brand-bg); color: var(--brand-ink); }

/* Date pickers: daterangepicker, gijgo, tempusdominus */
html.vm-portal .daterangepicker { font-family: var(--vm-font); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-pop); color: var(--ink); }
html.vm-portal .daterangepicker::before, html.vm-portal .daterangepicker::after { display: none; }
html.vm-portal .daterangepicker .calendar-table { background: var(--panel); border-color: var(--panel); }
html.vm-portal .daterangepicker td.available:hover, html.vm-portal .daterangepicker th.available:hover { background: var(--panel-2); }
html.vm-portal .daterangepicker td.in-range { background: var(--brand-bg); color: var(--ink); }
html.vm-portal .daterangepicker td.active, html.vm-portal .daterangepicker td.active:hover { background: var(--fill); color: #fff; }
html.vm-portal .daterangepicker td.off { background: transparent; color: var(--ink-3); opacity: 0.6; }
html.vm-portal .daterangepicker .ranges li { border-radius: 6px; font-size: 13px; }
html.vm-portal .daterangepicker .ranges li.active { background: var(--fill); }
html.vm-portal .daterangepicker .ranges li:hover { background: var(--panel-2); }
html.vm-portal .daterangepicker .drp-buttons { border-top-color: var(--line); }
html.vm-portal .daterangepicker select { background: var(--panel); color: var(--ink); border: 1px solid var(--line-2); border-radius: 6px; }
html.vm-portal .gj-datepicker-bootstrap [role="right-icon"] button { border-color: var(--line-2); background: var(--panel-2); color: var(--ink-3); }
html.vm-portal .gj-picker { font-family: var(--vm-font); border-radius: var(--radius); box-shadow: var(--shadow-pop); border-color: var(--line); background: var(--panel); color: var(--ink); }
html.vm-portal .gj-picker-bootstrap table tr td.selected.gj-cursor-pointer div { background: var(--fill); }
html.vm-portal .gj-picker-bootstrap table tr td.today div { color: var(--brand-ink); }
html.vm-portal .bootstrap-datetimepicker-widget { font-family: var(--vm-font); background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-pop); }
html.vm-portal .bootstrap-datetimepicker-widget table td.active, html.vm-portal .bootstrap-datetimepicker-widget table td span.active { background: var(--fill); }
html.vm-portal .bootstrap-datetimepicker-widget table td.today::before { border-bottom-color: var(--brand); }

/* Dropzone */
html.vm-portal .dropzone { border: 1.5px dashed var(--line-2); border-radius: var(--radius); background: var(--panel-2); min-height: 120px; color: var(--ink-3); }
html.vm-portal .dropzone:hover { border-color: var(--brand); background: var(--brand-bg); }
html.vm-portal .dropzone .dz-message { font-weight: 600; }

/* ========== 6. Overlays ========== */

html.vm-portal .modal-backdrop.show { background: var(--scrim); opacity: 1; }
html.vm-portal .modal-content { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-pop); }
/* No overflow: hidden on the dialog, so pop-ups opened inside it (the time picker in Sites' operating hours, date pickers,
   dropdowns) can reach past its edge; the first and last sections carry the rounded corners instead */
html.vm-portal .modal-content > :first-child { border-top-left-radius: 13px; border-top-right-radius: 13px; }
html.vm-portal .modal-content > :last-child { border-bottom-left-radius: 13px; border-bottom-right-radius: 13px; }
html.vm-portal .modal-header { border-bottom: 1px solid var(--line); padding: 16px 20px; align-items: center; }
html.vm-portal .modal-title { font-size: 16px; font-weight: 650; color: var(--ink); }
html.vm-portal .modal-header .close { padding: 8px 10px; margin: -8px -8px -8px auto; border-radius: 8px; font-size: 22px; }
html.vm-portal .modal-header .close:hover { background: var(--panel-2); }
html.vm-portal .modal-body { padding: 20px; }
html.vm-portal .modal-footer { border-top: 1px solid var(--line); background: var(--panel-2); padding: 12px 20px; gap: 8px; }
html.vm-portal .modal-footer > * { margin: 0; }
html.vm-portal .dropdown-menu { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-pop); padding: 6px; font-size: 13.5px; color: var(--ink); }
html.vm-portal .dropdown-item { border-radius: 6px; padding: 7px 10px; color: var(--ink); }
html.vm-portal .dropdown-item:hover, html.vm-portal .dropdown-item:focus { background: var(--panel-2); color: var(--ink); }
html.vm-portal .dropdown-item.active, html.vm-portal .dropdown-item:active { background: var(--fill); color: #fff; }
html.vm-portal .dropdown-divider { border-top-color: var(--line); }
html.vm-portal .dropdown-menu label { font-weight: 500; color: var(--ink); }
html.vm-portal .tooltip-inner { background: var(--ink); color: var(--panel); font: 12.5px/1.4 var(--vm-font); border-radius: 6px; padding: 6px 9px; }
html.vm-portal .popover { font-family: var(--vm-font); border-color: var(--line); border-radius: var(--radius); box-shadow: var(--shadow-pop); background: var(--panel); }
html.vm-portal .popover-header { background: var(--panel-2); border-bottom-color: var(--line); color: var(--ink); }
html.vm-portal .popover-body { color: var(--ink); }

/* Alerts: soft fills, an icon-weight left rule, readable ink */
html.vm-portal .alert { border: 1px solid transparent; border-left-width: 4px; border-radius: var(--radius-sm); padding: 12px 16px; font-size: 13.5px; }
html.vm-portal .alert-success { background: var(--good-bg); border-color: color-mix(in srgb, var(--good) 30%, transparent); border-left-color: var(--good); color: var(--good-ink); }
html.vm-portal .alert-danger { background: var(--crit-bg); border-color: color-mix(in srgb, var(--critical) 30%, transparent); border-left-color: var(--critical); color: var(--critical-ink); }
html.vm-portal .alert-warning { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warning) 30%, transparent); border-left-color: var(--warning); color: var(--warning-ink); }
html.vm-portal .alert-info, html.vm-portal .alert-primary { background: var(--brand-bg); border-color: color-mix(in srgb, var(--brand) 30%, transparent); border-left-color: var(--brand); color: var(--brand-ink); }
html.vm-portal .alert-secondary, html.vm-portal .alert-light { background: var(--panel-2); border-color: var(--line); color: var(--ink-2); }
html.vm-portal .alert .close { color: inherit; }
html.vm-portal .callout { border-radius: var(--radius-sm); background: var(--panel); border-left-color: var(--brand); box-shadow: var(--shadow-1); }
/* Toasts (the portal's #toast-container) */
html.vm-portal .toast { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-pop); color: var(--ink); font-family: var(--vm-font); }
html.vm-portal .toast-header { background: var(--panel-2); border-bottom-color: var(--line); color: var(--ink); }
/* SweetAlert2 */
html.vm-portal .swal2-popup { font-family: var(--vm-font); border-radius: 14px; background: var(--panel); color: var(--ink); padding: 24px; }
html.vm-portal .swal2-title { color: var(--ink); font-size: 20px; font-weight: 700; }
html.vm-portal .swal2-html-container, html.vm-portal .swal2-content { color: var(--ink-2); font-size: 14px; }
html.vm-portal .swal2-styled { border-radius: var(--radius-sm) !important; font-weight: 600 !important; font-size: 14px !important; padding: 9px 18px !important; box-shadow: none !important; }
html.vm-portal .swal2-styled.swal2-confirm { background: var(--fill) !important; }
html.vm-portal .swal2-styled.swal2-cancel { background: var(--panel) !important; color: var(--ink) !important; border: 1px solid var(--line-2) !important; }
html.vm-portal .swal2-styled.swal2-deny { background: var(--critical) !important; }
html.vm-portal .swal2-icon.swal2-warning { border-color: var(--warning); color: var(--warning); }
html.vm-portal .swal2-icon.swal2-error { border-color: var(--critical); }
html.vm-portal .swal2-icon.swal2-error [class^="swal2-x-mark-line"] { background: var(--critical); }
html.vm-portal .swal2-icon.swal2-success [class^="swal2-success-line"] { background: var(--fill-good); }
html.vm-portal .swal2-icon.swal2-success .swal2-success-ring { border-color: color-mix(in srgb, var(--good) 30%, transparent); }
html.vm-portal .swal2-icon.swal2-info, html.vm-portal .swal2-icon.swal2-question { border-color: var(--brand); color: var(--brand-ink); }
/* jQuery loading overlay */
html.vm-portal .loadingoverlay { background: color-mix(in srgb, var(--panel) 70%, transparent) !important; }

/* ========== 7. Pages ========== */

/* "Select Site" (pages that need one site while All Sites is chosen): a centred card instead of a bare dropdown */
html.vm-portal .content .w-25.mx-auto:has(.site-selector) { width: min(440px, 100%) !important; margin: 48px auto !important; padding: 28px 28px 20px; background: var(--panel) !important; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-1); text-align: center; }
html.vm-portal .content .w-25.mx-auto:has(.site-selector)::before { content: "\f3c5"; font-family: "Font Awesome 5 Free"; font-weight: 900; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; background: var(--brand-bg); color: var(--brand-ink); font-size: 18px; }
html.vm-portal .content .w-25.mx-auto:has(.site-selector) > .h4 { padding: 12px 0 4px !important; font-size: 17px; font-weight: 650; color: var(--ink) !important; }
html.vm-portal .content .w-25.mx-auto:has(.site-selector) > .h4::after { content: "This page shows one site at a time. Pick the site to open; the sidebar picker changes it for every page."; display: block; margin-top: 6px; font-size: 13px; font-weight: 400; color: var(--ink-3); }
html.vm-portal .content .w-25.mx-auto:has(.site-selector) .user-panel { border: 0 !important; margin: 8px 0 0 !important; padding: 0 !important; }

/* Sign in, forgot and reset password (production's own markup: .login-page > .login-box > .login-logo + .card):
   a navy brand panel on the left on wide screens, the form card on the canvas beside it */
html.vm-portal body.login-page { --auth-panel: min(40vw, 520px); display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; margin: 0; padding: 32px 20px; background: var(--canvas) !important; background-image: none !important; }
@media (min-width: 900px) {
  html.vm-portal body.login-page { padding-left: calc(var(--auth-panel) + 20px); }
  html.vm-portal body.login-page::before { content: ""; position: fixed; inset: 0 auto 0 0; width: var(--auth-panel);
    background: radial-gradient(700px 420px at 0% 0%, rgba(80, 186, 220, 0.28), transparent 60%), radial-gradient(600px 380px at 100% 100%, rgba(16, 127, 188, 0.35), transparent 60%), linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px) 0 0 / 32px 32px, linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px) 0 0 / 32px 32px, linear-gradient(160deg, #101b33, #0a1120 60%); }
  html.vm-portal body.login-page::after { content: "Every entrance, every site, one view."; position: fixed; left: 48px; bottom: 56px; width: calc(var(--auth-panel) - 96px); color: #fff; font: 700 30px/1.15 var(--vm-font); font-stretch: 108%; letter-spacing: -0.02em; }
}
html.vm-portal .login-box { width: min(400px, 100%); margin: 0; }
html.vm-portal .login-logo { margin: 0 0 18px; text-align: left; }
html.vm-portal .login-logo p { margin: 0; font-size: 24px; font-weight: 400; letter-spacing: -0.01em; color: var(--ink); }
html.vm-portal .login-logo b { font-weight: 800; }
html.vm-portal .login-box .card { border-radius: 14px; box-shadow: var(--shadow-pop); }
html.vm-portal .login-card-body { padding: 28px; border-radius: 14px; background: var(--panel); color: var(--ink); }
html.vm-portal .login-box-msg { text-align: left; padding: 0 0 18px; color: var(--ink-3); font-size: 14px; }
html.vm-portal .login-card-body .form-control { min-height: 44px; font-size: 14.5px; }
html.vm-portal .login-card-body .row > .col-8:empty { display: none; }
html.vm-portal .login-card-body .row > .col-4 { flex: 0 0 100%; max-width: 100%; }
html.vm-portal .login-card-body .btn-info { min-height: 44px; font-size: 14.5px; }
html.vm-portal .login-box > p { margin-top: 16px !important; }
html.vm-portal .login-box > p a { color: var(--brand-ink) !important; font-weight: 600; font-size: 13px; }

/* iPhone and iPad (Safari and Chrome alike) zoom the page in when a field under 16px gets focus, and do not zoom back out,
   leaving the page enlarged and cut off at the side. On touch screens every text field is at least 16px, on every page */
@media (pointer: coarse) {
  html.vm-portal :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="button"], [type="submit"]), select, textarea) { font-size: 16px !important; }
}

/* Public pages with their own head (booking, prescreening, induction): canvas behind one centred card */
html.vm-portal body.vm-public, html.vm-portal body.vm-public.bg-light { background: var(--canvas) !important; }
html.vm-portal body.vm-public > .container > .card, html.vm-portal body.vm-public > .card, html.vm-portal body.vm-public .container > .row > [class*="col"] > .card { border-radius: 16px; box-shadow: var(--shadow-pop); }

/* Error pages (403, 409, 500; production's own markup: .error-page > .error-content with a heading, a message and
   buttons, filled from the error handler): the content as a card on the canvas */
html.vm-portal body:has(> .error-page) { display: flex; align-items: center; justify-content: center; min-height: 100vh; margin: 0; padding: 24px; background: var(--canvas); }
html.vm-portal .error-page { width: min(560px, 100%); margin: 0; }
html.vm-portal .error-page > .row:empty { display: none; }
html.vm-portal .error-page .error-content { margin: 0 !important; padding: 32px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-pop); color: var(--ink-2); }
html.vm-portal .error-page .error-content h3 { display: flex; align-items: flex-start; gap: 12px; margin: 0 0 6px; font-size: 21px; font-weight: 700; line-height: 1.3; color: var(--ink); }
html.vm-portal .error-page .error-content h3 .fas { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin-top: -6px; border-radius: 10px; font-size: 17px; background: var(--warn-bg); color: var(--warning-ink) !important; }
html.vm-portal .error-page .error-content h3 .fa-lock { background: var(--brand-bg); color: var(--brand-ink) !important; }
html.vm-portal .error-page .error-content p { margin-top: 12px; }
html.vm-portal .error-page .error-content .mt-4 { display: flex; flex-wrap: wrap; gap: 8px; }
html.vm-portal .error-page .error-content .ml-2 { margin-left: 0 !important; }

/* Tabbed editors (Scanner Procedures, Sites): AdminLTE's dark and info cards become panels with underlined tabs */
html.vm-portal .card.card-dark, html.vm-portal .card.card-info.card-tabs { background: var(--panel); border-color: var(--line); }
html.vm-portal .card.card-dark > .card-header, html.vm-portal .card-tabs > .card-header.bg-info, html.vm-portal .card-tabs > .card-header { background: var(--panel) !important; color: var(--ink) !important; border-bottom: 1px solid var(--line); padding-bottom: 0; }
html.vm-portal .card-tabs > .card-header.bg-info { background: var(--panel-2) !important; }
html.vm-portal .card.card-dark > .card-header .card-title, html.vm-portal .card-tabs > .card-header .card-title { color: var(--ink); font-size: 14px; font-weight: 650; }
html.vm-portal .card-body.bg-dark, html.vm-portal .content-wrapper .bg-dark:not(.btn) { background: var(--panel-2) !important; color: var(--ink) !important; }
html.vm-portal .card-header-tabs { margin-bottom: 0; border-bottom: 0; }
html.vm-portal .card-header-tabs .nav-link, html.vm-portal .card-header-tabs .nav-link.nav-link-info, html.vm-portal .card-header-tabs .nav-link.nav-link-light { color: var(--ink-3) !important; background: transparent !important; border: 0 !important; border-bottom: 2px solid transparent !important; border-radius: 0 !important; font-weight: 600; font-size: 13px; }
html.vm-portal .card-header-tabs .nav-link:hover { color: var(--ink) !important; }
html.vm-portal .card-header-tabs .nav-link.active { color: var(--brand-ink) !important; border-bottom-color: var(--brand) !important; background: transparent !important; }
/* Scanner Procedures: the procedure and activity names are outlined pills, filled when selected */
html.vm-portal :is(.nav-tabs-scanner-procedures, .nav-tabs-scanner-activities) { gap: 6px; align-items: center; padding-bottom: 8px; }
html.vm-portal .card-header-tabs .nav-link:is(.nav-tabs-scanner-procedures-link, .nav-tabs-scanner-activities-link) { display: inline-flex; align-items: center; min-height: 32px; padding: 4px 14px !important; margin: 0 !important; border: 1px solid var(--line-2) !important; border-radius: 999px !important; color: var(--ink-2) !important; white-space: nowrap; }
html.vm-portal .card-header-tabs .nav-link:is(.nav-tabs-scanner-procedures-link, .nav-tabs-scanner-activities-link):hover { border-color: var(--brand) !important; color: var(--brand-ink) !important; }
html.vm-portal .card-header-tabs .nav-link.active:is(.nav-tabs-scanner-procedures-link, .nav-tabs-scanner-activities-link) { border-color: var(--brand) !important; background: var(--brand-bg) !important; color: var(--brand-ink) !important; }
html.vm-portal .btn-outline-light { color: var(--ink-2); border-color: var(--line-2); background: var(--panel); }
html.vm-portal .btn-outline-light:hover { background: var(--panel-2); color: var(--ink); border-color: var(--line-2); }
html.vm-portal .table-head-fixed thead tr:nth-child(1) th { background: var(--panel-2) !important; box-shadow: inset 0 -1px 0 var(--line) !important; }

/* Inline colours in the portal's templates, mapped onto the palette (a style attribute can only be answered with !important) */
html.vm-portal tr[style*="#90EE90" i] { background: var(--good-bg) !important; box-shadow: inset 3px 0 0 var(--good); }
html.vm-portal [style*="background-color: #e6e6e6" i], html.vm-portal [style*="background-color:#e6e6e6" i] { background-color: var(--panel-2) !important; }
html.vm-portal [style*="color: #3c8dbc" i], html.vm-portal [style*="color:#3c8dbc" i], html.vm-portal [style*="color: #17a2b8" i] { color: var(--brand-ink) !important; }
html.vm-portal [style*="color: #f56954" i], html.vm-portal [style*="color:#f56954" i] { color: var(--critical-ink) !important; }
html.vm-portal [style*="color: red" i], html.vm-portal [style*="color:red" i] { color: var(--critical-ink) !important; }
html.vm-portal [style*="color: green" i], html.vm-portal [style*="color:green" i] { color: var(--good-ink) !important; }
html.vm-portal code { color: var(--ink-2); }
html.vm-portal [style*="color: #00a65a" i], html.vm-portal [style*="color:#00a65a" i] { color: var(--good-ink) !important; }
html.vm-portal[data-vm-mode="dark"] [style*="color: #333" i], html.vm-portal[data-vm-mode="dark"] [style*="color:#333" i], html.vm-portal[data-vm-mode="dark"] [style*="color: #535353" i] { color: var(--ink) !important; }
/* fills behind white text (the employee card strip, info blocks): the strong blue in both modes */
html.vm-portal [style*="background: #17a2b8" i], html.vm-portal [style*="background-color: #0070c0" i] { background: var(--fill) !important; }
/* Bootstrap contextual rows and cells, softened */
html.vm-portal .table-success, html.vm-portal .table-success > td, html.vm-portal .table-success > th { background: var(--good-bg) !important; }
html.vm-portal .table-danger, html.vm-portal .table-danger > td, html.vm-portal .table-danger > th { background: var(--crit-bg) !important; }
html.vm-portal .table-warning, html.vm-portal .table-warning > td, html.vm-portal .table-warning > th { background: var(--warn-bg) !important; }
html.vm-portal .table-info, html.vm-portal .table-info > td, html.vm-portal .table-info > th { background: var(--brand-bg) !important; }

/* Scanner Procedures: the icon rows under a procedure (previous, next, edit, copy, delete) and an activity (previous,
   next, save, delete). Production floats them as white icons on its dark card; on the theme's light card they use the
   action colour, line up on one baseline and get a square touch area. Visual order is unchanged (row-reverse undoes
   float-right's reversal). */
html.vm-portal #scannerProceduresContent .row > .col:has(> .float-right):not(:has(> :not(.float-right))) { display: flex; flex-direction: row-reverse; align-items: center; gap: 4px; }
html.vm-portal #scannerProceduresContent .row > .col:has(> .float-right):not(:has(> :not(.float-right))) > .float-right { float: none !important; margin: 0 !important; padding: 0 !important; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; min-height: 0 !important; border: 0; border-radius: 8px; color: var(--brand-ink) !important; }
html.vm-portal #scannerProceduresContent .row > .col:has(> .float-right):not(:has(> :not(.float-right))) > .float-right:hover { background: var(--brand-bg); }

/* ========== 8. Answers to public/css/styles.css ==========
   The portal's own stylesheet forces several colours and paddings with !important; these restate them on the new
   palette, also with !important (an !important rule can only be beaten by another one). */
html.vm-portal .btn-info { background: var(--fill) !important; border-color: var(--fill) !important; }
html.vm-portal .btn-info:hover, html.vm-portal .btn-info:focus { background: var(--brand-ink) !important; border-color: var(--brand-ink) !important; }
html.vm-portal .btn-info.active { background: var(--brand-ink) !important; border-color: var(--brand-ink) !important; }
html.vm-portal .bg-info { background: var(--fill) !important; }
html.vm-portal .nav-link-info.active { background: var(--brand-bg) !important; color: var(--brand-ink) !important; }
html.vm-portal .nav-link-light.active { background: var(--panel-2) !important; }
html.vm-portal .nav-link.active { font-weight: 600 !important; }
html.vm-portal .fieldset-border { border-color: var(--line) !important; border-radius: var(--radius); padding: 12px 16px; }
html.vm-portal .bootstrap-table .th-inner { padding: 10px 26px 10px 12px !important; }
html.vm-portal .filter-table thead th { padding: 0 0 8px !important; }
html.vm-portal .dz-clickable { border: 1.5px dashed var(--line-2) !important; border-radius: var(--radius) !important; }
html.vm-portal .today.gj-cursor-pointer { border: 1px solid var(--brand) !important; }
html.vm-portal .colored-toast.swal2-icon-success { background-color: var(--fill-good) !important; }
html.vm-portal .colored-toast.swal2-icon-error { background-color: var(--critical) !important; }
html.vm-portal .colored-toast.swal2-icon-warning { background-color: var(--warning) !important; }
html.vm-portal .colored-toast.swal2-icon-info, html.vm-portal .colored-toast.swal2-icon-question { background-color: var(--fill) !important; }
html.vm-portal .colored-toast .swal2-title, html.vm-portal .colored-toast .swal2-html-container { color: #fff !important; }
html.vm-portal .toast-header.bg-danger { background-color: var(--critical) !important; }

/* Fieldsets in dialogs (Medical, Induction, Equipment, Custom Data on Employees): the last row's own bottom margin and its
   fields' bottom margin added ~33px of blank space above the border; end on one 12px inset instead */
html.vm-portal .modal fieldset { padding-bottom: 12px; }
html.vm-portal .modal fieldset :is(.row, .form-row):not(:has(~ :is(.row, .form-row, .form-group))) { margin-bottom: 0 !important; }
html.vm-portal .modal fieldset :is(.row, .form-row):not(:has(~ :is(.row, .form-row, .form-group))) > [class*="col"] > .form-group:last-child,
html.vm-portal .modal fieldset :is(.row, .form-row):not(:has(~ :is(.row, .form-row, .form-group))) > .form-group:last-child,
html.vm-portal .modal fieldset > .form-group:last-child { margin-bottom: 0 !important; }
/* A QR code canvas that has not been drawn yet (Add Point of Access swaps in a blank one; it is only drawn when editing an
   existing record) is a blank 300 x 150 box: hide it until the QR library draws it, which sets its inline size */
html.vm-portal .modal canvas[id*="qr" i]:not([style]) { display: none; }
/* Reduced motion */
/* Button groups (UI rule: buttons that sit together are the same size and line up). Wherever a block holds nothing
   but buttons (for example Upload Photo / Download Card / Print Card under the employee card), they become one even
   row: equal widths and an 8px gap; when they do not all fit on one line they stack as full-width buttons of the same
   size, never a ragged two-and-one. (The grid's column minimum jumps from 1/N of the row to 100% at N x 150px.) In dialogs at every width; in page toolbars on phones (section 9). */
html.vm-portal .modal-body :is(div, p):has(> .btn ~ .btn):not(:has(> :not(.btn, input[type="file"], input[type="hidden"], [hidden], br))):not(.btn-group, .btn-group-toggle, .btn-toolbar, .input-group-append, .input-group-prepend, .dropdown, .modal-footer, .columns, .export):not(:has(> .rounded-pill)) { --vm-n: 2; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, max(calc((var(--vm-n) * 150px + (var(--vm-n) - 1) * 8px - 100%) * 999), calc((100% - (var(--vm-n) - 1) * 8px) / var(--vm-n)))), 1fr)); gap: 8px; align-items: stretch; margin-left: 0; margin-right: 0; }
html.vm-portal .modal-body :is(div, p):has(> .btn ~ .btn):not(:has(> :not(.btn, input[type="file"], input[type="hidden"], [hidden], br))):not(.btn-group, .btn-group-toggle, .btn-toolbar, .input-group-append, .input-group-prepend, .dropdown, .modal-footer, .columns, .export):has(> :nth-child(3 of .btn:not([hidden], .d-none, [style*="display: none"], [style*="display:none"]))) { --vm-n: 3; }
html.vm-portal .modal-body :is(div, p):has(> .btn ~ .btn):not(:has(> :not(.btn, input[type="file"], input[type="hidden"], [hidden], br))):not(.btn-group, .btn-group-toggle, .btn-toolbar, .input-group-append, .input-group-prepend, .dropdown, .modal-footer, .columns, .export):has(> :nth-child(4 of .btn:not([hidden], .d-none, [style*="display: none"], [style*="display:none"]))) { --vm-n: 4; }
html.vm-portal .modal-body :is(div, p):has(> .btn ~ .btn):not(:has(> :not(.btn, input[type="file"], input[type="hidden"], [hidden], br))):not(.btn-group, .btn-group-toggle, .btn-toolbar, .input-group-append, .input-group-prepend, .dropdown, .modal-footer, .columns, .export):has(> :nth-child(5 of .btn:not([hidden], .d-none, [style*="display: none"], [style*="display:none"]))) { --vm-n: 5; }
html.vm-portal .modal-body :is(div, p):has(> .btn ~ .btn):not(:has(> :not(.btn, input[type="file"], input[type="hidden"], [hidden], br))):not(.btn-group, .btn-group-toggle, .btn-toolbar, .input-group-append, .input-group-prepend, .dropdown, .modal-footer, .columns, .export) > .btn { width: auto; height: auto; align-self: stretch; text-align: center; display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin: 0 !important; white-space: nowrap; }
/* Click-to-insert chips (the {VisitorName}-style template variables on Sites > Bookings / Notifications template): as many
   equal columns as fit at ~140px (three across in the dialog on a desktop, two on a phone) instead of a full-width stack */
html.vm-portal .modal-body :is(div, p):has(> .btn.rounded-pill ~ .btn.rounded-pill):not(:has(> :not(.btn, input[type="hidden"], [hidden], br))) { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); grid-auto-rows: 1fr; gap: 8px; margin: 0; padding: 4px 0 8px; }
html.vm-portal .modal-body :is(div, p):has(> .btn.rounded-pill ~ .btn.rounded-pill):not(:has(> :not(.btn, input[type="hidden"], [hidden], br))) > .btn.rounded-pill { margin: 0 !important; min-width: 0; min-height: 32px; display: inline-flex; align-items: center; justify-content: center; text-align: center; white-space: normal; line-height: 1.25; }

/* The employee card preview is a print-size card (about 300px wide) that the page scales 1.7x inline, which overflows
   its column below about 1280px (production overflows at 1024 too). Its column becomes a container, and the card
   steps down to the largest scale that fits (thresholds are the card's width at each scale). */
html.vm-portal .modal-body .row > [class*="col"]:has(#employeeCard) { container-type: inline-size; }
/* zoom rather than the inline transform: a transform leaves the 100 x 100 box behind (so the Employee Card frame was sized
   by guesswork: blank space under the card on a phone), zoom sizes the box to the card it shows */
html.vm-portal #employeeCard { transform: none !important; zoom: 1.7; width: max-content !important; height: auto !important; }
html.vm-portal .modal fieldset:has(#employeeCard) { height: auto !important; } /* inline 360px: the frame now follows the card */
html.vm-portal .modal fieldset:has(#employeeCard) > .row { margin-bottom: 0 !important; }
@container (max-width: 511px) { html.vm-portal #employeeCard { zoom: 1.4; } }
@container (max-width: 420px) { html.vm-portal #employeeCard { zoom: 1.1; } }
@container (max-width: 330px) { html.vm-portal #employeeCard { zoom: 0.85; } }
@container (max-width: 255px) { html.vm-portal #employeeCard { zoom: 0.6; } }

/* Desktop fields that production's columns leave too narrow (about 100px): each gets room for its label and value */
@media (min-width: 992px) {
  /* Fields grouped in a fieldset (Medical, Induction, Equipment dates): tighter gutters, so each date keeps its width */
  html.vm-portal .modal fieldset > .row { margin-left: -4px; margin-right: -4px; padding-left: 0 !important; padding-right: 0 !important; }
  html.vm-portal .modal fieldset > .row > [class*="col"] { padding-left: 4px; padding-right: 4px; }
  /* Visitor Types: Weekdays Only, Valid From and Valid To share the row in thirds */
  html.vm-portal .modal .row:has(> .col-3 > .form-group [name="validFromTime"]) > [class*="col"] { flex: 0 0 33.333%; max-width: 33.333%; }
  /* Pickers sized for what they hold */
  html.vm-portal #assignVersionId { min-width: 180px; }
  html.vm-portal #employeeAttendanceCompanyId { min-width: 200px; }
}
@media (min-width: 992px) {
  /* Bookings: Min Hours and Max Days get 140px each; the other fields in that row give way */
  html.vm-portal .modal .row:has(> .col > .form-group > :is(#bookingVisitorTypeMinHours, #bookingsUploadVisitorTypeMinHours)) { flex-wrap: nowrap; }
  html.vm-portal .modal .row:has(> .col > .form-group > :is(#bookingVisitorTypeMinHours, #bookingsUploadVisitorTypeMinHours)) > [class*="col"] { flex-shrink: 1; min-width: 0; }
  html.vm-portal .modal .row:has(> .col > .form-group > :is(#bookingVisitorTypeMinHours, #bookingsUploadVisitorTypeMinHours)) > .col:has(> .form-group > :is(#bookingVisitorTypeMinHours, #bookingVisitorTypeMaxDays, #bookingsUploadVisitorTypeMinHours, #bookingsUploadVisitorTypeMaxDays)) { flex: 0 0 140px; max-width: none; }
}
@media (min-width: 992px) and (max-width: 1199.98px) {
  /* Small laptops, where dialogs are about 800px wide: a dialog split into two halves (Bookings) shows them one above
     the other, a pair of dates in a fieldset sits one above the other, and the employee card goes under the fields */
  html.vm-portal .modal-body > .row:has(> .col-7 + .col-5) > :is(.col-7, .col-5) { flex: 0 0 100%; max-width: 100%; }
  html.vm-portal .modal fieldset > .row:has(> .col:nth-child(2)):not(:has(> .col:nth-child(3))):not(:has(.form-check, .custom-control)) > .col { flex: 0 0 100%; max-width: 100%; }
  html.vm-portal .modal-body > .row:has(> .col #employeeCard) > .col { flex: 0 0 100%; max-width: 100%; }
  html.vm-portal .modal-body > .row:has(> .col #employeeCard) + .row { margin-top: 12px; }
  /* Reports and Scanner Procedures: their side panel of fields (a quarter, or a sixth, of the page) widens on small laptops */
  html.vm-portal .content-wrapper .row:has(> [class*="col"] > #reportForm) > [class*="col"]:has(> #reportForm) { flex: 0 0 33.333%; max-width: 33.333%; }
  html.vm-portal .content-wrapper .row:has(> [class*="col"] > #reportForm) > [class*="col"]:not(:has(> #reportForm)) { flex: 0 0 66.667%; max-width: 66.667%; }
  html.vm-portal #scannerProceduresContent .scannerActivityForm > .row:has(> .col-2) > .col-2 { flex: 0 0 30%; max-width: 30%; }
  html.vm-portal #scannerProceduresContent .scannerActivityForm > .row:has(> .col-2) > .col-2 ~ [class*="col"] { flex: 1 1 0; max-width: none; min-width: 0; }
}

/* ========== 9. Phones and tablets ==========
   The portal's forms use fixed Bootstrap columns (col, col-3, col-4 ...), often nested, that stay side by side on a
   small screen. Below 992px each part of a form decides by the width it actually has (container queries): every dialog
   body, card body and form column measures itself, and the columns inside it stack one per line when it is narrow,
   two per line when it is medium, and keep their design when there is room. Checkbox-only columns size to their
   label and wrap, so labels never run into each other. Wider than 992px nothing here applies.
   Below 576px dialogs also become full-screen sheets, date pickers keep field and button on one line, and toolbars
   wrap. */
@media (max-width: 991.98px) {
  html.vm-portal .modal-body, html.vm-portal .content-wrapper .card-body,
  /* (a checkbox-only column is not a container: it sizes to its label, which a size container cannot do) */
  html.vm-portal :is(.modal, .content-wrapper) :is(.row, .form-row) > :is([class^="col"], [class*=" col-"], .col):not(.col-auto):not([class*="-auto"]):not(:has(> :is(.form-check, .custom-control):only-child)) { container-type: inline-size; }
  @container (max-width: 419px) {
    html.vm-portal :is(.row, .form-row) > :is([class^="col"], [class*=" col-"], .col):not(.col-auto):not([class*="-auto"]) { flex: 0 0 100%; max-width: 100%; }
    /* rows of six or more small cells (day-of-week grids) stay a grid: four per line */
    html.vm-portal .row:has(> [class*="col"]:nth-child(6)) > :is([class^="col"], [class*=" col-"], .col):not(.col-auto):not([class*="-auto"]) { flex: 0 0 25%; max-width: 25%; }
  }
  @container (min-width: 420px) and (max-width: 679px) {
    html.vm-portal :is(.row, .form-row):not(:has(> [class*="col"]:nth-child(6))) > :is([class^="col"], [class*=" col-"], .col):not(.col-auto):not([class*="-auto"]) { flex: 0 0 50%; max-width: 50%; }
    html.vm-portal .row:has(> [class*="col"]:nth-child(6)) > :is([class^="col"], [class*=" col-"], .col):not(.col-auto):not([class*="-auto"]) { flex: 0 0 25%; max-width: 25%; }
  }
  /* Weekly hours (Sites' operating hours: an "opening" row and a "closing" row of seven days): one line per day,
     opening and closing side by side, so each day's pair stays together and the fields keep a usable width */
  @container (max-width: 767px) {
    html.vm-portal .modal .row:has(> .row > .col-2:first-child ~ .col:nth-child(8)) { display: grid; grid-template-columns: calc(50% + 15px) minmax(0, 1fr); grid-template-rows: repeat(8, auto); grid-auto-flow: column; column-gap: 12px; margin: 0 !important; padding: 0 !important; }
    html.vm-portal .modal .row:has(> .row > .col-2:first-child ~ .col:nth-child(8)) > .row { display: contents; }
    html.vm-portal .modal .row:has(> .row > .col-2:first-child ~ .col:nth-child(8)) > .row > * { flex: none !important; max-width: none !important; width: auto !important; min-width: 0; padding: 0 !important; }
    html.vm-portal .modal .row:has(> .row > .col-2:first-child ~ .col:nth-child(8)) > .row > .col-2 > div { margin: 0 0 6px !important; font-size: 13px !important; }
    html.vm-portal .modal .row:has(> .row > .col-2:first-child ~ .col:nth-child(8)) > .row:first-child > .col-2 > div { padding-left: 42px; }
    html.vm-portal .modal .row:has(> .row > .col-2:first-child ~ .col:nth-child(8)) > .row > .col .form-group { margin-bottom: 8px; }
    html.vm-portal .modal .row:has(> .row > .col-2:first-child ~ .col:nth-child(8)) > .row:first-child > .col .form-group { display: flex; align-items: center; gap: 8px; }
    html.vm-portal .modal .row:has(> .row > .col-2:first-child ~ .col:nth-child(8)) > .row:first-child > .col label { flex: 0 0 34px; margin: 0; }
    html.vm-portal .modal .row:has(> .row > .col-2:first-child ~ .col:nth-child(8)) > .row:first-child > .col .input-group { flex: 1 1 auto; min-width: 0; }
  }
  /* Scanner Procedures fits itself to the screen height (a script sets it); on a small screen its stacked fields are
     taller than that and ran over the procedure's icon row, so the page grows with its content instead */
  html.vm-portal #scannerProceduresContent { height: auto !important; }
  html.vm-portal #scannerProceduresContent :is(.h-100, .tab-content, .tab-pane, .scannerActivityForm) { height: auto !important; }
  /* Reports: the report picker and its options sit above the report instead of in a quarter-width column */
  html.vm-portal .content-wrapper .row:has(> [class*="col"] > #reportForm) { height: auto !important; }
  html.vm-portal .content-wrapper .row:has(> [class*="col"] > #reportForm) > [class*="col"] { flex: 0 0 100%; max-width: 100%; }
  html.vm-portal .content-wrapper .row:has(> [class*="col"] > #reportForm) > [class*="col"]:has(> #reportForm) { height: auto !important; }
  html.vm-portal .content-wrapper .row:has(> [class*="col"] > #reportForm) > [class*="col"]:has(> #reportForm) :is(#reportForm, #reportControls) { height: auto !important; }
  html.vm-portal .content-wrapper .row:has(> [class*="col"] > #reportForm) > [class*="col"]:not(:has(> #reportForm)) { height: auto !important; }
  html.vm-portal .content-wrapper .row:has(> [class*="col"] > #reportForm) :is(#reportTableCard, #reportScheduleCard) { height: auto !important; min-height: 60vh; margin-left: 1rem; margin-top: 0 !important; }
  /* Scanner Procedures on small screens: the tabs wrap as before, and the header buttons (Add Procedure and Copy All;
     Add Activity) move to their own line below them as equal, full-width buttons. Icons get 40px touch areas. */
  html.vm-portal #scannerProceduresContent .card-header-tabs::after { content: ''; flex: 0 0 100%; order: 1; height: 0; }
  html.vm-portal #scannerProceduresContent .card-header-tabs > li:has(> .btn, > .btn-group) { order: 2; flex: 1 1 0; min-width: 0; margin: 8px 0 0 !important; padding: 0 0 10px !important; }
  html.vm-portal #scannerProceduresContent .card-header-tabs > li > :is(.btn, .btn-group), html.vm-portal #scannerProceduresContent .card-header-tabs > li > .btn-group > .btn { width: 100%; margin: 0 !important; padding-top: 0 !important; }
  /* The procedure and activity pills in even columns under their heading: three across, two on a phone */
  html.vm-portal #scannerProceduresContent .card-header-tabs > li:has(> .card-title) { flex: 0 0 100%; width: auto !important; padding: 0 0 4px !important; }
  html.vm-portal #scannerProceduresContent .card-header-tabs > .nav-link:is(.nav-tabs-scanner-procedures-link, .nav-tabs-scanner-activities-link) { flex: 0 0 calc((100% - 12px) / 3); min-width: 0; justify-content: center; overflow: hidden; text-overflow: ellipsis; }
  html.vm-portal #scannerProceduresContent .row > .col:has(> .float-right):not(:has(> :not(.float-right))) > .float-right { width: 40px; height: 40px; }
  /* touch-sized screens: buttons and fields at least 40px tall (36px for small buttons) */
  html.vm-portal :is(.content-wrapper, .modal, body.vm-public) :is(.btn:not(.btn-xs):not(.btn-sm), .form-control, .custom-select, .select2-selection--single) { min-height: 40px; }
  html.vm-portal :is(.content-wrapper, .modal, body.vm-public) .btn-group-toggle > .btn { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }
  html.vm-portal .pagination .page-link { min-width: 40px; min-height: 40px; display: flex; align-items: center; justify-content: center; }
  html.vm-portal :is(.content-wrapper, .modal) .btn-sm { min-height: 36px; }
  html.vm-portal :is(.content-wrapper, .modal) .btn:not(.dropdown-toggle) { display: inline-flex; align-items: center; justify-content: center; column-gap: 6px; }
  html.vm-portal :is(.content-wrapper, .modal) .select2-selection--single .select2-selection__rendered { line-height: 38px !important; }
  @container (max-width: 679px) {
    /* a column that only holds a checkbox: as wide as its label, wrapping with its neighbours */
    html.vm-portal .row > :is([class^="col"], [class*=" col-"], .col):not(.col-auto):not([class*="-auto"]):has(> :is(.form-check, .custom-control):only-child) { flex: 0 0 auto; width: auto; max-width: 100%; padding-right: 18px; }
  }
}
@media (max-width: 575.98px) {
  html.vm-portal #scannerProceduresContent .card-header-tabs > .nav-link:is(.nav-tabs-scanner-procedures-link, .nav-tabs-scanner-activities-link) { flex-basis: calc((100% - 6px) / 2); }
  html.vm-portal :is(.modal, .content-wrapper) .row { row-gap: 0; }
  html.vm-portal .modal fieldset, html.vm-portal .modal .fieldset-border { width: 100%; min-width: 0; margin-bottom: 12px; }
  html.vm-portal .modal legend { white-space: normal; }
  /* Dialogs as full-screen sheets */
  html.vm-portal .modal-dialog { width: 100%; max-width: none; min-height: 100%; margin: 0; }
  html.vm-portal .modal-content { min-height: 100vh; min-height: 100dvh; border: 0; border-radius: 0; box-shadow: none; }
  html.vm-portal .modal-header { position: sticky; top: 0; z-index: 3; background: var(--panel); padding: 12px 16px; }
  html.vm-portal .modal-body { padding: 16px; flex: 1 1 auto; }
  html.vm-portal .modal-footer { flex-wrap: wrap; justify-content: stretch; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
  html.vm-portal .modal-footer > .btn, html.vm-portal .modal-footer > button { flex: 1 1 auto; min-height: 42px; }
  /* a footer of buttons only: an even grid, as many per line as fit at 130px each, all the same size */
  html.vm-portal .modal-footer:not(:has(> :not(.btn, button, [hidden], input[type="hidden"]))) { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
  html.vm-portal .modal-footer:not(:has(> :not(.btn, button, [hidden], input[type="hidden"]))) > * { margin: 0 !important; width: auto; height: auto; align-self: stretch; }
  /* an odd number of buttons cannot pair up evenly: one full-width button per row, all the same size */
  html.vm-portal .modal-footer:not(:has(> :not(.btn, button, [hidden], input[type="hidden"]))):has(> :nth-child(1 of :is(.btn, button):not([hidden])):nth-last-child(2n+1 of :is(.btn, button):not([hidden]))) { grid-template-columns: 1fr; }
  /* Fields: full width, a comfortable touch height, pickers on one line */
  html.vm-portal :is(.modal, .content-wrapper) :is(.form-control, .custom-select) { min-height: 42px; font-size: 16px; }
  html.vm-portal .input-group { flex-wrap: nowrap; }
  html.vm-portal .gj-datepicker, html.vm-portal .gj-datepicker-bootstrap { display: flex !important; flex-wrap: nowrap !important; width: 100% !important; }
  html.vm-portal .gj-datepicker-bootstrap > input { flex: 1 1 auto; min-width: 0; }
  html.vm-portal .modal .select2-container { width: 100% !important; }
  /* Toolbars above tables wrap; the search takes the whole line */
  html.vm-portal .bootstrap-table .fixed-table-toolbar .bs-bars > *, html.vm-portal .bootstrap-table .fixed-table-toolbar .bs-bars .d-flex { flex-wrap: wrap !important; gap: 8px; max-width: 100%; }
  html.vm-portal .bootstrap-table .fixed-table-toolbar .bs-bars :is(.ml-1, .ml-2, .ml-3) { margin-left: 0 !important; }
  html.vm-portal .bootstrap-table .fixed-table-toolbar .bs-bars :is(.custom-select, .gj-datepicker, .input-group, .form-control) { flex: 1 1 100%; max-width: 100%; width: 100% !important; }
  html.vm-portal .bootstrap-table .fixed-table-toolbar .bs-bars { order: 1; flex: 1 1 100%; }
  html.vm-portal .bootstrap-table .fixed-table-toolbar .search { order: 2; flex: 1 1 0; min-width: 0; }
  html.vm-portal .bootstrap-table .fixed-table-toolbar .columns { order: 3; }
  /* Inline forms above a table (Transactions' date range and auto-refresh): one group per line */
  html.vm-portal .content-wrapper .form-inline { align-items: stretch; margin-top: 0 !important; }
  html.vm-portal .content-wrapper .form-inline .form-group { flex: 1 1 100%; margin: 0 !important; justify-content: space-between; }
  html.vm-portal .content-wrapper .form-inline :is(.input-group, .form-control, .custom-select) { width: 100% !important; }
  /* Wide previews inside dialogs (the employee card) stay inside the sheet */
  html.vm-portal .modal :is([class^="col"], [class*=" col-"], .col) { min-width: 0; }
  html.vm-portal .modal-body :is(.card, img, canvas, svg) { max-width: 100%; }
  html.vm-portal .modal-body .card { overflow-x: auto; }
  html.vm-portal .bootstrap-table .fixed-table-toolbar .search .form-control { min-width: 0; width: 100%; }
  html.vm-portal .bootstrap-table .fixed-table-pagination { justify-content: center; }
  html.vm-portal .bootstrap-table .fixed-table-pagination > .pagination-detail { width: 100%; text-align: center; }
  html.vm-portal .pagination { flex-wrap: wrap; justify-content: center; }
  /* Toolbars outside bootstrap-table (date range, filters, action buttons above a page) */
  html.vm-portal .content-wrapper .content :is(.d-flex, .form-inline):not(.flex-column):not(.vm-root *) { flex-wrap: wrap; gap: 8px; }
  /* ...and where buttons share such a row with a heading or a field, each takes the whole line: full-width buttons of
     one size instead of a ragged two-and-one */
  html.vm-portal .content-wrapper .content :is(.d-flex, .form-inline):not(.flex-column):not(.vm-root *):has(> .btn ~ .btn):has(> :not(.btn, [hidden], input[type="hidden"])) > :is(.btn, h1, h2, h3, h4, h5, h6, select, .custom-select, .form-control) { flex: 1 1 100%; max-width: 100%; margin-left: 0 !important; margin-right: 0 !important; }
  html.vm-portal .content-wrapper .card-header { padding: 12px 14px; }
  html.vm-portal .content-wrapper :is(div, p):has(> .btn ~ .btn):not(:has(> :not(.btn, input[type="file"], input[type="hidden"], [hidden], br))):not(.btn-group, .btn-group-toggle, .btn-toolbar, .input-group-append, .input-group-prepend, .dropdown, .modal-footer, .columns, .export) { --vm-n: 2; width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, max(calc((var(--vm-n) * 130px + (var(--vm-n) - 1) * 8px - 100%) * 999), calc((100% - (var(--vm-n) - 1) * 8px) / var(--vm-n)))), 1fr)); gap: 8px; align-items: stretch; margin-left: 0; margin-right: 0; }
  html.vm-portal .content-wrapper :is(div, p):has(> .btn ~ .btn):not(:has(> :not(.btn, input[type="file"], input[type="hidden"], [hidden], br))):not(.btn-group, .btn-group-toggle, .btn-toolbar, .input-group-append, .input-group-prepend, .dropdown, .modal-footer, .columns, .export):has(> :nth-child(3 of .btn:not([hidden], .d-none, [style*="display: none"], [style*="display:none"]))) { --vm-n: 3; }
  html.vm-portal .content-wrapper :is(div, p):has(> .btn ~ .btn):not(:has(> :not(.btn, input[type="file"], input[type="hidden"], [hidden], br))):not(.btn-group, .btn-group-toggle, .btn-toolbar, .input-group-append, .input-group-prepend, .dropdown, .modal-footer, .columns, .export):has(> :nth-child(4 of .btn:not([hidden], .d-none, [style*="display: none"], [style*="display:none"]))) { --vm-n: 4; }
  html.vm-portal .content-wrapper :is(div, p):has(> .btn ~ .btn):not(:has(> :not(.btn, input[type="file"], input[type="hidden"], [hidden], br))):not(.btn-group, .btn-group-toggle, .btn-toolbar, .input-group-append, .input-group-prepend, .dropdown, .modal-footer, .columns, .export):has(> :nth-child(5 of .btn:not([hidden], .d-none, [style*="display: none"], [style*="display:none"]))) { --vm-n: 5; }
  html.vm-portal .content-wrapper :is(div, p):has(> .btn ~ .btn):not(:has(> :not(.btn, input[type="file"], input[type="hidden"], [hidden], br))):not(.btn-group, .btn-group-toggle, .btn-toolbar, .input-group-append, .input-group-prepend, .dropdown, .modal-footer, .columns, .export) > .btn { width: auto; height: auto; align-self: stretch; text-align: center; margin: 0 !important; }
  /* Fixed-width blocks (a form card at half width, for example Prescreening Questions) use the whole phone width */
  html.vm-portal :is(.content-wrapper, .modal) :is(.w-25, .w-50, .w-75) { width: 100% !important; }
}

/* ========== 9b. Screen-size fixes (responsive audit, 17 Nov 2026) ========== */

/* Tablets: Bootstrap keeps every dialog 500px wide until 992px, which squeezed the large ones (Users, Bookings,
   Employees, Sites, Hosts, Occurrences) and left a third of the screen unused. They now use the tablet's width, and
   the container rules of section 9 lay their columns out by the room each part really has */
@media (min-width: 576px) and (max-width: 991.98px) {
  html.vm-portal .modal-dialog.modal-lg { max-width: min(94vw, 800px); }
  html.vm-portal .modal-dialog.modal-xl { max-width: min(94vw, 1140px); }
}

/* Add Employee, Custom Data: six fields per row (col-2) were taken for a day-of-week grid and squeezed to 36px.
   One per line when narrow, two when medium, three on a tablet or small laptop; six across on a wide desktop */
@media (max-width: 991.98px) {
  @container (max-width: 419px) { html.vm-portal #employeeCustomDataFields > .row > [class*="col"] { flex: 0 0 100%; max-width: 100%; } }
  @container (min-width: 420px) and (max-width: 679px) { html.vm-portal #employeeCustomDataFields > .row > [class*="col"] { flex: 0 0 50%; max-width: 50%; } }
  @container (min-width: 680px) { html.vm-portal #employeeCustomDataFields > .row > [class*="col"] { flex: 0 0 33.333%; max-width: 33.333%; } }
}
@media (min-width: 992px) and (max-width: 1199.98px) {
  html.vm-portal #employeeCustomDataFields > .row > [class*="col"] { flex: 0 0 33.333%; max-width: 33.333%; }
}

/* Employee Custom Fields: the columns get sizes (the name and the options share the room, the type keeps its width),
   and on a phone each field becomes a small block: name, then type with required and delete, then the options */
html.vm-portal #employeeCustomFieldsModal .modal-body > table { table-layout: fixed; width: 100%; white-space: normal; }
html.vm-portal #employeeCustomFieldsModal .modal-body > table th:nth-child(2) { width: 30%; }
html.vm-portal #employeeCustomFieldsModal .modal-body > table th:nth-child(3) { width: 150px; }
html.vm-portal #employeeCustomFieldsModal .modal-body > table th:nth-child(5) { width: 92px; }
html.vm-portal #employeeCustomFieldsModal .modal-body > table th:nth-child(6) { width: 48px; }
html.vm-portal #employeeCustomFieldsModal .modal-body > table td > a[title] { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; cursor: pointer; }
@media (max-width: 699.98px) {
  html.vm-portal #employeeCustomFieldsModal .modal-body > table, html.vm-portal #employeeCustomFieldsModal .modal-body > table > tbody { display: block; }
  html.vm-portal #employeeCustomFieldsModal .modal-body > table tr:has(> th) { display: none; }
  html.vm-portal #employeeCustomFields > tr { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px 12px; align-items: end; padding: 14px 0; }
  html.vm-portal #employeeCustomFields > tr > td { display: block; padding: 0; border: 0 !important; min-width: 0; }
  html.vm-portal #employeeCustomFields > tr > td:nth-child(2) { grid-column: 1 / -1; grid-row: 1; }
  html.vm-portal #employeeCustomFields > tr > td:nth-child(3) { grid-column: 1; grid-row: 2; }
  html.vm-portal #employeeCustomFields > tr > td:nth-child(5) { grid-column: 2; grid-row: 2; }
  html.vm-portal #employeeCustomFields > tr > td:nth-child(6) { grid-column: 3; grid-row: 2; }
  html.vm-portal #employeeCustomFields > tr > td:nth-child(4) { grid-column: 1 / -1; grid-row: 3; }
  html.vm-portal #employeeCustomFields > tr > td:nth-child(-n+5)::before { display: block; margin-bottom: 4px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
  html.vm-portal #employeeCustomFields > tr > td:nth-child(2)::before { content: "Name"; }
  html.vm-portal #employeeCustomFields > tr > td:nth-child(3)::before { content: "Type"; }
  html.vm-portal #employeeCustomFields > tr > td:nth-child(4)::before { content: "Options (separate with ;)"; }
  html.vm-portal #employeeCustomFields > tr > td:nth-child(5)::before { content: "Required"; }
  html.vm-portal #employeeCustomFields > tr > td:nth-child(5) .form-check { display: flex; align-items: center; justify-content: center; height: 42px; padding: 0; }
  html.vm-portal #employeeCustomFields > tr > td:nth-child(5) .form-check-input { position: static; margin: 0 !important; }
  html.vm-portal #employeeCustomFields > tr > td:nth-child(6) > a[title] { width: 42px; height: 42px; }
}

/* Add User: below 1200px the Permissions table gets the dialog's full width under the form (in a 40% column it
   showed Feature and View only, with Add, Edit and Delete behind a sideways scroll) and its own height */
@media (max-width: 1199.98px) {
  html.vm-portal #userModal .modal-body .row > :is(.col-sm-7, .col-sm-5, .col-12, .col:only-child) { flex: 0 0 100%; max-width: 100%; }
  html.vm-portal #userModal .card-body.table-responsive:has(#permissions-table-body) { height: auto !important; max-height: none; }
}
@media (max-width: 575.98px) {
  html.vm-portal #userModal .card-body.table-responsive:has(#permissions-table-body) :is(th, td) { padding-left: 4px; padding-right: 4px; }
  html.vm-portal #userModal .card-body.table-responsive:has(#permissions-table-body) :is(th, td):first-child { padding-left: 10px; white-space: normal; }
}

/* A lone checkbox under its label (Visitor Types' Weekdays Only, Scanner Users' Administrator): Bootstrap positions it
   absolutely in a box with no height, so on a phone it sat on the next field's label. It now takes its own line */
html.vm-portal .form-group > div:not(.form-check):not(.custom-control):not(.input-group) > input.form-check-input:only-child { position: static; display: block; margin: 8px 0 2px 2px !important; }

/* The menu as its icon rail (collapsed, not hovered): the wide product logo shows its round mark only, not a cut word */
@media (min-width: 992px) {
  html.vm-portal .sidebar-mini.sidebar-collapse .main-sidebar:not(:hover) .brand-link .brand-image { width: 26px !important; max-width: 26px; height: 24px !important; object-fit: cover; object-position: left center; }
}

/* Small laptops: Scanner Procedures' Custom Label keeps room for its text */
@media (min-width: 992px) { html.vm-portal #scannerProceduresContent input[id^="controlLabel-"] { min-width: 150px; } }

/* The narrowest phones (under 360px): the client logo leaves the top bar so the page title and buttons fit */
@media (max-width: 359.98px) {
  html.vm-portal .main-header li:has(> img[alt="Logo"]), html.vm-portal .main-header img[alt="Logo"] { display: none !important; }
  html.vm-portal .main-header .navbar-nav.ml-auto { gap: 6px; }
}
html.vm-portal .main-header .h5 { min-width: 0; }
html.vm-portal .main-header .navbar-nav:has(> li > .h5), html.vm-portal .main-header li:has(> .h5) { min-width: 0; }
/* Messages (top right) never wider than the screen */
html.vm-portal #globalMessages { max-width: calc(100vw - 24px); }
@media (max-width: 575.98px) { html.vm-portal #globalMessages { right: 12px !important; } }

/* Phones and small tablets: the footer scrolls with the page instead of staying pinned over the bottom of the screen */
@media (max-width: 767.98px) {
  html.vm-portal body.layout-footer-fixed .main-footer { position: static !important; }
  html.vm-portal body.layout-footer-fixed .wrapper .content-wrapper { padding-bottom: 0 !important; }
}

/* Touch screens: checkboxes and radio buttons at 20px (13px was too small to hit), the sign-in page's link 44px tall */
@media (pointer: coarse) {
  html.vm-portal :is(.content-wrapper, .modal, body.vm-public) input:is([type="checkbox"], [type="radio"]):not(.custom-control-input) { width: 20px; height: 20px; }
  html.vm-portal :is(.content-wrapper, .modal, body.vm-public) .form-check:not(.form-check-inline) { padding-left: 30px; }
  html.vm-portal :is(.content-wrapper, .modal, body.vm-public) .form-check:not(.form-check-inline) > .form-check-input { margin-left: -30px; margin-top: 1px; }
  html.vm-portal :is(.content-wrapper, .modal, body.vm-public) .form-check-label { line-height: 22px; }
  html.vm-portal .login-box > p a { display: inline-flex; align-items: center; min-height: 44px; }
}

/* Transactions on a phone: "Auto-Refresh" and its switch on one line */
@media (max-width: 575.98px) {
  html.vm-portal .content-wrapper .form-inline .form-group:has(> .custom-switch) { display: flex; flex-wrap: nowrap; align-items: center; justify-content: flex-start; gap: 10px; min-height: 40px; }
  html.vm-portal .content-wrapper .form-inline .form-group:has(> .custom-switch) > .custom-switch { margin: 0 !important; }
}

/* Lists on a phone: each row is a card (theme.js switches bootstrap-table to its card view below 576px), so nothing
   scrolls sideways: the column name on the left, the value on the right, the row's buttons on their own line */
html.vm-portal .bootstrap-table .table.vm-cards > thead { display: none; }
html.vm-portal .bootstrap-table .table.vm-cards > tbody > tr { display: block; border-top: 1px solid var(--line); }
html.vm-portal .bootstrap-table .table.vm-cards > tbody > tr:first-child { border-top: 0; }
html.vm-portal .bootstrap-table .table.vm-cards > tbody > tr > td { display: block; padding: 10px 14px !important; white-space: normal !important; border: 0 !important; }
html.vm-portal .bootstrap-table .table.vm-cards .card-views { display: block; }
html.vm-portal .bootstrap-table .table.vm-cards .card-view { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 3px 0; font-size: 13.5px; }
html.vm-portal .bootstrap-table .table.vm-cards .card-view-title { flex: 0 0 38%; min-width: 0; font-weight: 500 !important; color: var(--ink-3); text-align: left !important; overflow-wrap: anywhere; }
html.vm-portal .bootstrap-table .table.vm-cards .card-view-value { flex: 1 1 auto; min-width: 0; color: var(--ink); text-align: right; overflow-wrap: anywhere; }
html.vm-portal .bootstrap-table .table.vm-cards .card-view:first-child .card-view-value { font-weight: 650; }
html.vm-portal .bootstrap-table .table.vm-cards .card-view:has(.card-view-value:empty) { display: none; }
html.vm-portal .bootstrap-table .table.vm-cards .card-view:has(.card-view-value > :is(.btn, button, a.btn)) { display: block; padding-top: 8px; }
html.vm-portal .bootstrap-table .table.vm-cards .card-view:has(.card-view-value > :is(.btn, button, a.btn)) .card-view-title { display: none; }
html.vm-portal .bootstrap-table .table.vm-cards .card-view:has(.card-view-value > :is(.btn, button, a.btn)) .card-view-value { display: flex; flex-wrap: wrap; gap: 8px; text-align: left; }
html.vm-portal .bootstrap-table .table.vm-cards .card-view-value > :is(.btn, button, a.btn) { flex: 1 1 0; margin: 0 !important; min-height: 38px; }
html.vm-portal .bootstrap-table:has(.table.vm-cards) .fixed-table-body { overflow-x: hidden; }

/* Reduced motion: no transitions; animations stay so loading spinners still show that something is happening */
@media (prefers-reduced-motion: reduce) { html.vm-portal *, html.vm-portal *::before, html.vm-portal *::after { transition: none !important; } }

/* Printing (Ctrl+P on any page): always the light palette, without the sidebar, header and footer */
@media print {
  html.vm-portal, html.vm-portal[data-vm-mode="dark"] { color-scheme: light; --canvas: #ffffff; --panel: #ffffff; --panel-2: #f5f7fa; --line: #dde3ea; --line-2: #c7d0db; --ink: #0e1726; --ink-2: #3c4858; --ink-3: #5f6d82; --brand: #107fbc; --brand-ink: #0c6a9e; --brand-bg: #e7f2f8; }
  html.vm-portal .main-sidebar, html.vm-portal .main-header, html.vm-portal .main-footer { display: none !important; }
  html.vm-portal .content-wrapper { margin: 0 !important; }
  html.vm-portal .card, html.vm-portal .bootstrap-table .fixed-table-container { box-shadow: none; }
}

/* ========== 10. Dark mode: filled controls ========== */
html.vm-portal[data-vm-mode="dark"] :is(.btn-info, .btn-primary) { background: var(--fill) !important; border-color: var(--fill) !important; color: var(--fill-ink) !important; }
html.vm-portal[data-vm-mode="dark"] :is(.btn-info, .btn-primary):is(:hover, :focus, .active, :active) { background: var(--fill-hover) !important; border-color: var(--fill-hover) !important; color: var(--fill-ink) !important; }
html.vm-portal[data-vm-mode="dark"] .page-item.active .page-link { background: var(--fill); border-color: var(--fill); color: var(--fill-ink); }
html.vm-portal[data-vm-mode="dark"] .select2-container--default .select2-results__option--highlighted[aria-selected],
html.vm-portal[data-vm-mode="dark"] .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable { background: var(--fill) !important; color: var(--fill-ink) !important; }
html.vm-portal[data-vm-mode="dark"] :is(.dropdown-item.active, .dropdown-item:active, .toggle-on.btn, .progress-bar) { background: var(--fill) !important; color: var(--fill-ink) !important; }
html.vm-portal[data-vm-mode="dark"] .daterangepicker :is(td.active, td.active:hover, .ranges li.active) { background: var(--fill) !important; color: var(--fill-ink) !important; }
html.vm-portal[data-vm-mode="dark"] :is(.bg-info, .bg-primary):not(.card-header) { background: var(--fill) !important; color: var(--fill-ink) !important; }
/* green and red fills: the dark tints are for text and lines; behind white text use the strong colours */
html.vm-portal[data-vm-mode="dark"] .btn-success { background: var(--fill-good) !important; border-color: var(--fill-good) !important; color: #fff !important; }
html.vm-portal[data-vm-mode="dark"] .btn-danger { background: var(--fill-critical) !important; border-color: var(--fill-critical) !important; color: #fff !important; }
/* disabled checkbox labels (Bootstrap grey) and AdminLTE's dark text on .bg-light / .bg-white boxes */
html.vm-portal .form-check-input:disabled ~ .form-check-label, html.vm-portal .form-check-input[disabled] ~ .form-check-label { color: var(--ink-3); }
html.vm-portal :is(.bg-light, .bg-white) { color: var(--ink) !important; }
html.vm-portal[data-vm-mode="dark"] .custom-control-input:checked ~ .custom-control-label::before { background: var(--fill); border-color: var(--fill); }
html.vm-portal[data-vm-mode="dark"] .swal2-styled.swal2-confirm { background: var(--fill) !important; color: var(--fill-ink) !important; }
