/* REZTIBAS terminal — extracted from base.html <style>. */
    /* Suppress all transitions until base.js has applied saved UI state (nav
       collapse, theme) — otherwise the navbar animates on every page load. */
    html.preload * , html.preload *::before, html.preload *::after {
      transition: none !important;
      animation: none !important;
    }
    :root {
      /* Canonical manager layout tokens (shared names across managers). */
      --sidebar-width: 250px;
      --header-height: 50px;
      /* Legacy local aliases — kept so existing selectors keep working. */
      --sidebar-w: var(--sidebar-width);
      --header-h: var(--header-height);
      /* Firmware-manager fonts: system sans everywhere; code font ONLY for
         actual code surfaces (config editor + rendered output) via --code.
         --mono intentionally maps to sans — no code font in UI text. */
      --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
              Arial, sans-serif;
      --mono: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
              Arial, sans-serif;
      --code: "Courier New", ui-monospace, monospace;
    }
    /* Manager design tokens — the whole app re-skins through these. Accent is
       the manager blue; --amber is kept strictly for warning semantics. */
    html[data-bs-theme="dark"] {
      color-scheme: dark;
      --bg: #1a1d20;
      --panel: #24292e;
      --panel-deep: #1e2329;
      --border: #3a3f44;
      --border-strong: #4b5158;
      --line: #3a3f44;
      --row-hover: rgba(255, 255, 255, .04);
      --card-shadow: 0 1px 3px rgba(0, 0, 0, .18);
      --text: #e1e4e8;
      --muted: #9aa0a8;
      --faint: #6d747c;
      /* Bootstrap's --bs-secondary-color, so the sidebar search matches the
         other managers exactly. */
      --search-muted: rgba(173, 181, 189, .75);
      --accent: #3b82f6;
      --accent-strong: #1d4ed8;
      --accent-soft: rgba(59, 130, 246, .14);
      --amber: #ffc107;
      --amber-bright: #ffcd39;
      --green: #28a745;
      --red: #ef4444;
      --cyan: #38bdf8;
      --violet: #a78bfa;
      --btn-primary: #15803d;
      --btn-primary-h: #1a9647;
      --btn-secondary: #334155;
      --btn-secondary-h: #3f4d5f;
      --btn-secondary-fg: #e1e4e8;
      --btn-danger: #b91c1c;
      --btn-danger-h: #dc2626;
      /* Canonical manager token names (aliases used by shared components). */
      --btn-default: #1d4ed8;
      --btn-tertiary: #1e293b;
      --btn-success: #15803d;
      --btn-warning: #ffc107;
      --btn-light-dark: #f8fafc;
      --toast-success: #15803d;
      --toast-danger: #b91c1c;
      --toast-warning: #ffc107;
      --toast-brand: #1d4ed8;
      --bs-body-bg: #1a1d20;
      --bs-body-color: #e1e4e8;
      --bs-card-bg: #24292e;
      --bs-border-color: #3a3f44;
      --bs-tertiary-bg: #2b3035;
    }
    html[data-bs-theme="light"] {
      color-scheme: light;
      --bg: #f5f7f9;
      --panel: #ffffff;
      --panel-deep: #eef1f4;
      --border: #dee2e6;
      --border-strong: #cbd2d9;
      --line: #dee2e6;
      --row-hover: rgba(0, 0, 0, .035);
      --card-shadow: 0 1px 3px rgba(0, 0, 0, .08);
      --text: #24292e;
      --muted: #57606a;
      --faint: #8b949e;
      --search-muted: rgba(33, 37, 41, .75);
      --accent: #3b82f6;
      --accent-strong: #3b82f6;
      --accent-soft: rgba(59, 130, 246, .1);
      --amber: #d97706;
      --amber-bright: #b45309;
      --green: #15803d;
      --red: #ef4444;
      --cyan: #0284c7;
      --violet: #7c3aed;
      --btn-primary: #22c55e;
      --btn-primary-h: #16a34a;
      --btn-secondary: #e2e8f0;
      --btn-secondary-h: #cbd5e1;
      --btn-secondary-fg: #24292e;
      --btn-danger: #ef4444;
      --btn-danger-h: #dc2626;
      /* Canonical manager token names (aliases used by shared components). */
      --btn-default: #3b82f6;
      --btn-tertiary: #f8fafc;
      --btn-success: #22c55e;
      --btn-warning: #ffc107;
      --btn-light-dark: #1e293b;
      --toast-success: #22c55e;
      --toast-danger: #ef4444;
      --toast-warning: #ffc107;
      --toast-brand: #3b82f6;
      --bs-body-bg: #f5f7f9;
      --bs-body-color: #24292e;
      --bs-card-bg: #ffffff;
      --bs-border-color: #dee2e6;
      --bs-tertiary-bg: #f8f9fa;
    }
    * { box-sizing: border-box; }
    body {
      margin: 0; background: var(--bg); color: var(--text);
      font: 400 14px/1.5 var(--sans);
      min-height: 100vh; padding-top: var(--header-h);
      -webkit-font-smoothing: antialiased;
    }
    ::selection { background: var(--accent-soft); }

    /* ------------------------------------------------------- top header */
    .header {
      position: fixed; top: 0; left: var(--sidebar-w); right: 0;
      height: var(--header-h); z-index: 1040;
      display: flex; align-items: center; gap: 1rem; padding: 0 2rem;
      background: var(--bg); border-bottom: 1px solid var(--border);
    }
    .header .spacer { flex: 1; }
    .header .menu-toggle {
      display: none; background: none; border: none; color: var(--text);
      font-size: 1.4rem; cursor: pointer; padding: .1rem .3rem;
    }
    /* Breadcrumb — verbatim firmware-manager styling. */
    .header-breadcrumb { overflow: hidden; flex: 1; }
    .header-breadcrumb .breadcrumb { margin-bottom: 0; flex-wrap: nowrap;
                                     overflow: hidden; }
    ol.breadcrumb {
      background-color: transparent; padding: 0; margin-bottom: 1rem;
      font-size: 0.875rem; display: flex; align-items: center; list-style: none;
    }
    .breadcrumb-item { display: flex; align-items: center; font-size: 0.875rem;
                       white-space: nowrap; }
    .breadcrumb-item + .breadcrumb-item::before {
      content: ">"; font-size: 1.2rem; display: flex; align-items: center;
      float: none;
    }
    .breadcrumb-item a { color: var(--bs-body-color); text-decoration: none; }
    .breadcrumb-item a:hover { color: var(--bs-primary); }
    .breadcrumb-item.active { color: var(--bs-primary); font-weight: 500; }
    .header-actions { display: flex; align-items: center; gap: 1rem; }
    .theme-toggle {
      background: none; border: none; color: var(--text); cursor: pointer;
      padding: 0; font-size: .875rem; line-height: 1.5;
      display: inline-flex; align-items: center;
    }
    .theme-toggle:hover { color: var(--bs-primary); background: none; }
    .usermenu { position: relative; }
    .usermenu > button {
      display: inline-block;
      background: none; border: none; color: var(--text);
      padding: 0; font: 400 .875rem/1.5 var(--sans);
      cursor: pointer;
    }
    .usermenu > button:hover { color: var(--bs-primary); background: none; }
    .usermenu > button .mdi-account-circle { font-size: 1em; }
    .usermenu-drop {
      position: absolute; top: calc(100% + .125rem); right: 0; min-width: 10rem;
      background: var(--bg); border: 1px solid var(--bs-border-color-translucent);
      border-radius: .375rem; padding: .5rem 0; z-index: 1050; display: none;
    }
    .usermenu-drop.show { display: block; }
    .usermenu-drop { font-size: 1rem; }
    .usermenu-drop a, .usermenu-drop button {
      display: block; width: 100%;
      padding: .25rem 1rem; border-radius: 0; background: none; border: none;
      color: var(--text); font: 400 1rem/1.5 var(--sans); text-align: left;
      text-decoration: none; cursor: pointer; min-height: 0;
    }
    .usermenu-drop a:hover, .usermenu-drop button:hover {
      background: var(--bs-tertiary-bg); filter: none;
    }
    .usermenu-drop hr { border: none; margin: .5rem 0; opacity: 1;
                        border-top: 1px solid var(--bs-border-color-translucent); }

    /* ---------------------------------------------------------- sidebar */
    aside#sidebar {
      position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
      z-index: 1050; display: flex; flex-direction: column;
      background: var(--panel); border-right: 1px solid var(--border);
      overflow: hidden;
    }
    .sidebar-logo {
      display: flex; justify-content: center; align-items: center;
      padding: 1.5rem 1rem; flex-shrink: 0; text-decoration: none;
    }
    .sidebar-logo img { height: 50px; width: auto; max-width: 90%; }
    /* Colours match the other managers: --bg is their --bs-body-bg, icon and
       placeholder share one tone, focus ring is the family blue. */
    .sidebar-search {
      display: flex; align-items: center; gap: .4rem;
      margin: 0 .75rem .75rem; padding: 0 .6rem;
      background: var(--bg); border: 1px solid var(--border);
      border-radius: 7px; flex-shrink: 0;
    }
    .sidebar-search:focus-within { border-color: #0d6efd; }
    .sidebar-search .mdi { color: var(--search-muted); font-size: 1rem; }
    .sidebar-search input {
      flex: 1; min-width: 0; background: none; border: 0; outline: none;
      color: var(--text); font: inherit; font-size: .85rem; padding: .45rem 0;
    }
    .sidebar-search input::placeholder { color: var(--search-muted); }
    .sub-row .drag-handle {
      cursor: grab; color: var(--muted); margin-right: .4rem;
      letter-spacing: -.1em; user-select: none;
    }
    .sub-row.js-section.dragging { opacity: .4; }
    .sub-row.js-section.drop-before td { box-shadow: inset 0 2px 0 var(--accent); }
    .sub-row.js-section.drop-after td { box-shadow: inset 0 -2px 0 var(--accent); }
    .nav-groups { flex: 1; overflow-y: auto; padding: 0 0 1rem;
                  scrollbar-width: thin; }
    .nav-groups::-webkit-scrollbar { width: 5px; }
    .nav-section { margin-bottom: .5rem; }
    .nav-section-header {
      display: flex; align-items: center; justify-content: space-between;
      padding: .5rem 1rem; cursor: pointer; user-select: none;
      font-size: .75rem; font-weight: 600; text-transform: uppercase;
      color: var(--text);
      transition: background-color .2s;
    }
    .nav-section-header:hover { background: rgba(13, 110, 253, .05); }
    .nav-section-header > span {
      display: flex; align-items: center; gap: .5rem;
    }
    .nav-section-header .toggle-icon { transition: transform .2s; }
    .nav-section-header.collapsed .toggle-icon { transform: rotate(-90deg); }
    .nav-section-content { overflow: hidden; transition: max-height .3s ease; }
    .sidebar-nav .nav-link {
      display: flex; align-items: center; padding: .5rem 1rem .5rem 2rem;
      color: var(--text); text-decoration: none; line-height: 1.5;
      transition: all .2s;
    }
    .sidebar-nav .nav-link > .mdi {
      min-width: 24px; font-size: 1.1rem; margin-right: .5rem;
    }
    .sidebar-nav .nav-link:hover { background: rgba(13, 110, 253, .1); color: var(--text); }
    .sidebar-nav .nav-link.active { background: #0d6efd; color: #fff; }
    .sidebar-nav .nav-link.active > .mdi { color: #fff; }
    /* Nested "Configurations" subgroup inside a module section. */
    .nav-subsection { margin: .1rem 0; }
    .nav-subsection > .nav-section-header {
      padding-left: 2rem; font-size: .68rem; opacity: .85;
    }
    .nav-subsection > .nav-section-header > span .mdi { font-size: .85rem; }
    .sidebar-nav .nav-subsection .nav-link { padding-left: 2.9rem; }

    /* ------------------------------------------------------------ page */
    /* No min-height stretch: like the other managers the footer hugs the
       content instead of being pinned to the bottom of the viewport. */
    .page { margin-left: var(--sidebar-w); min-width: 0;
            display: flex; flex-direction: column; }
    /* Tabs bar matches the header/breadcrumb row height exactly. */
    .subheader {
      padding: 0 2rem; border-bottom: 1px solid var(--border);
      background: var(--bg); position: sticky; top: var(--header-h); z-index: 30;
      height: var(--header-h);
    }
    .tabs { display: flex; gap: 1.5rem; overflow-x: auto; height: 100%; }
    .tabs a {
      display: flex; align-items: center; padding: 0 .1rem;
      color: var(--muted); text-decoration: none;
      font-size: .88rem; white-space: nowrap;
      border-bottom: 2px solid transparent;
      transition: color .12s;
    }
    .tabs a:hover { color: var(--text); }
    .tabs a.active { color: var(--text); border-bottom-color: var(--accent); }
    /* API reference: a normal tab, just pinned to the far right. */
    /* API + Documentation sit together at the right end of the tab row. */
    main { padding: 2rem; width: 100%; min-width: 0; flex: 1;
           min-height: calc(100vh - var(--header-h) - 55px); }
    /* Pages with the tabs bar have a second 50px row above main. */
    .subheader + main {
      min-height: calc(100vh - var(--header-h) - var(--header-h) - 55px);
    }
    /* Footer — verbatim manager styling: icon links left, meta right. */
    footer {
      background-color: transparent;
      border-top: 1px solid var(--border);
      padding: 1rem 2rem;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    footer a { color: var(--text); text-decoration: none; }
    footer a:hover { color: var(--accent); }
    footer small { color: var(--muted); font-size: 0.765625rem;
                   font-family: var(--sans); }

    h2 { font-size: 1.05rem; font-weight: 600; letter-spacing: .01em;
         margin: 0 0 1.1rem; }
    /* Count pills next to page titles are retired — bulk-bar keeps its own. */
    h2 .count, h3 .count, h4 .count, .res-card-head .count { display: none; }
    h3 {
      font-family: var(--mono); font-size: .7rem; font-weight: 600;
      color: var(--muted); text-transform: uppercase; letter-spacing: .18em;
      margin: 2rem 0 .8rem;
    }
    /* Second-level bar: a twin of the header tabs, attached right below it. */
    .subnav {
      display: flex; gap: 1.5rem;
      margin: -1.6rem -2rem 1.6rem;
      padding: 0 2rem;
      border-bottom: 1px solid var(--border);
      height: var(--header-h);
    }
    .subnav a {
      display: flex; align-items: center; padding: 0 .1rem;
      color: var(--muted); text-decoration: none;
      font-size: .88rem; white-space: nowrap;
      border-bottom: 2px solid transparent;
      transition: color .12s;
    }
    .subnav a:hover { color: var(--text); }
    .subnav a.active { color: var(--text); border-bottom-color: var(--accent); }
    .toolbar {
      display: flex; justify-content: space-between; align-items: center;
      gap: 1rem; margin-bottom: 1.3rem; padding: .2rem 0 .9rem;
      border-bottom: 1px solid var(--border);
    }
    .toolbar h2, .toolbar h4 { margin: 0; font-size: 1.5rem; font-weight: 600; }
    .toolbar .actions { display: flex; gap: .6rem; align-items: center; }
    .js-filter { width: 220px; }
    .js-filter:placeholder-shown, .js-configuration-filter:placeholder-shown {
      background: var(--panel-deep)
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" fill="none" stroke="%2363696f" stroke-width="2"><circle cx="5.5" cy="5.5" r="4.5"/><path d="m9 9 3 3"/></svg>')
        no-repeat .6rem center;
      padding-left: 1.7rem;
    }
    .toolbar h2.mono { font-family: var(--mono); font-size: 1.15rem; }
    .breadcrumb { margin: 0 0 .7rem; font-size: .9rem; }
    .breadcrumb a { color: var(--text); text-decoration: none; }
    .breadcrumb a:hover { color: var(--text); }
    .meta {
      display: flex; flex-wrap: wrap; align-items: center; gap: .55rem;
      margin-bottom: 1.6rem; font-size: .86rem;
    }

    /* -------------- toasts (firmware-manager style: solid, bottom-right) */
    .toasts {
      position: fixed; bottom: 20px; right: 20px; z-index: 1055;
      display: flex; flex-direction: column-reverse; gap: .75rem;
      width: min(400px, calc(100vw - 1.8rem));
    }
    .flash {
      display: flex; align-items: center; gap: .75rem;
      padding: 1rem; margin: 0; color: #fff;
      border-radius: .5rem; overflow: hidden;
      box-shadow: 0 4px 12px rgba(0, 0, 0, .25);
      font-size: .875rem; transition: opacity .4s;
      animation: toast-in .18s ease-out; background: var(--cyan);
    }
    @keyframes toast-in {
      from { transform: translateX(14px); opacity: 0; }
    }
    .flash.success { background: var(--green); }
    .flash.error   { background: var(--red); }
    .flash.warning { background: var(--amber); }
    .flash.info    { background: var(--cyan); }
    .flash .toast-icon {
      display: inline-flex; align-items: center; justify-content: center;
      flex-shrink: 0; width: 1.75rem; height: 1.75rem;
      background: rgba(255, 255, 255, .2); border-radius: .375rem;
    }
    .flash .toast-icon i { font-size: 1.1rem; }
    .flash .toast-message { flex-grow: 1; line-height: 1.35; }
    .flash .toast-close {
      display: flex; align-items: center; justify-content: center;
      flex-shrink: 0; width: 2rem; height: 2rem; margin-left: auto;
      background: transparent; border: none; cursor: pointer;
      color: rgba(255, 255, 255, .8); border-radius: .375rem;
      transition: all .15s ease;
    }
    .flash .toast-close:hover {
      background: rgba(255, 255, 255, .2); color: #fff;
    }
    .flash.fade { opacity: 0; }

    /* Canonical manager toasts — markup built by showToast() in base.js.
       Legacy .flash rules above stay for the few server-rendered flashes. */
    .toast-container {
      position: fixed; bottom: 20px; right: 20px; z-index: 1055;
      display: flex; flex-direction: column-reverse; gap: .75rem;
    }
    .toast {
      min-width: 350px; max-width: 400px; border-radius: .5rem;
      box-shadow: 0 4px 12px rgba(0, 0, 0, .15); overflow: hidden;
    }
    /* No Bootstrap JS is loaded (deliberate): Bootstrap CSS hides .toast
       until its JS adds .show — force visibility and animate ourselves. */
    .toast-container .toast {
      display: block; opacity: 1; border: none;
      transition: opacity .4s; animation: toast-in .18s ease-out;
    }
    .toast-container .toast.hiding { opacity: 0; }
    .toast-solid {
      display: flex; align-items: center; padding: 1rem; color: white;
    }
    .toast-solid .toast-icon {
      display: inline-flex; align-items: center; justify-content: center;
      flex-shrink: 0; width: 1.75rem; height: 1.75rem;
      background: rgba(255, 255, 255, .2); border-radius: .375rem;
    }
    .toast-solid .toast-icon i { font-size: 1.1rem; }
    .toast-solid .toast-message {
      margin-left: .75rem; font-size: .875rem; flex-grow: 1;
    }
    .toast-solid .toast-close {
      margin-left: auto; display: flex; align-items: center;
      justify-content: center; width: 2rem; height: 2rem;
      background: transparent; border: none;
      color: rgba(255, 255, 255, .8); border-radius: .375rem;
      cursor: pointer; transition: all .15s ease;
    }
    .toast-solid .toast-close:hover {
      background: rgba(255, 255, 255, .2); color: white;
    }
    .toast-success { background-color: var(--toast-success) !important; }
    .toast-danger { background-color: var(--toast-danger) !important; }
    .toast-warning { background-color: var(--toast-warning) !important; }
    .toast-info { background-color: var(--toast-brand) !important; }
    @media (max-width: 575.98px) {
      .toast-container { left: 1rem; right: 1rem; }
      .toast-container .toast { min-width: auto; max-width: 100%; width: 100%; }
    }

    /* ------------------------------------------------------------ forms */
    input, select, textarea {
      background: var(--panel); color: var(--text);
      border: 1px solid var(--border); border-radius: .25rem;
      padding: .5rem .75rem; font: inherit; font-size: .875rem;
      transition: all .15s ease-in-out;
    }
    select {
      -webkit-appearance: none; appearance: none;
      background-repeat: no-repeat !important;
      background-position: right .75rem center !important;
      background-size: 16px 12px !important;
      padding-right: 2.5rem !important;
    }
    html[data-bs-theme="dark"] select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23e1e4e8' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E"); }
    html[data-bs-theme="light"] select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23212529' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E"); }
    input::placeholder, textarea::placeholder { color: var(--faint); }
    label.required::after,
    label:has(+ input:required)::after,
    label:has(+ select:required)::after,
    label:has(+ textarea:required)::after {
      content: " *"; color: #dc3545; font-weight: bold;
    }
    /* List filter panel (django-filter FilterSets, see <app>/filters.py). */
    .filter-count {
      display: inline-block; min-width: 1.1rem; padding: 0 .25rem;
      margin-left: .3rem; border-radius: 999px; background: var(--accent);
      color: #fff; font-size: .7rem; line-height: 1.1rem; text-align: center;
    }
    .filter-panel {
      position: absolute; z-index: 1050;
      width: min(900px, calc(100% - 4rem));
      background: var(--bg); border: 1px solid var(--border);
      border-radius: .5rem; padding: 1rem; margin: 0 0 1rem;
      box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .15);
    }
    .filter-fields {
      display: grid; gap: 1rem;
      grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
    .filter-panel label {
      display: flex; flex-direction: column; gap: .5rem;
      font-size: .875rem; font-weight: 500; color: var(--text);
    }
    .filter-panel input, .filter-panel select { width: 100%; }
    .filter-actions {
      display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1rem;
      padding-top: 1rem; border-top: 1px solid var(--border);
    }
    .filter-reset {
      text-decoration: none; padding: .42rem .9rem; border-radius: 6px;
      border: 1px solid var(--border-strong); color: var(--text);
      font-size: .82rem;
    }
    /* No number spinners / spin-boxes anywhere. */
    input[type=number] { -moz-appearance: textfield; appearance: textfield; }
    input[type=number]::-webkit-inner-spin-button,
    input[type=number]::-webkit-outer-spin-button {
      -webkit-appearance: none; appearance: none; margin: 0;
    }
    input:focus, select:focus, textarea:focus {
      outline: none; border-color: var(--border);
      box-shadow: 0 0 0 .15rem rgba(var(--bs-emphasis-color-rgb), .1);
    }
    textarea.mono, input.mono { font-family: var(--code); font-size: .84rem; }
    textarea.mono { line-height: 1.55; }
    .pw-field { position: relative; }
    .pw-field input { width: 100%; padding-right: 2.3rem; }
    .pw-generate {
      position: absolute; right: .3rem; top: 50%; transform: translateY(-50%);
      background: none; border: none; color: var(--muted); cursor: pointer;
      padding: .15rem .3rem; font-size: 1rem; line-height: 1;
    }
    .pw-generate:hover { background: none; color: var(--accent); }
    .slider-row { display: flex; align-items: center; gap: .7rem; }
    .slider-row input[type=range] {
      flex: 1; accent-color: var(--accent); min-width: 0;
    }
    .slider-row input[type=number] { width: 5.5rem; flex: 0 0 auto; }
    .code-editor {
      display: flex; align-items: stretch;
      background: var(--panel-deep); border: 1px solid var(--border-strong);
      border-radius: 6px; overflow: hidden;
    }
    .code-editor:focus-within {
      border-color: var(--border);
      box-shadow: 0 0 0 .15rem rgba(var(--bs-emphasis-color-rgb), .1);
    }
    .code-editor .gutter {
      flex-shrink: 0; min-width: 2.4em; padding: .42rem .55rem;
      text-align: right; white-space: pre; overflow: hidden;
      font: 400 .84rem/1.55 var(--code); color: var(--faint);
      background: rgba(255, 255, 255, .02);
      border-right: 1px solid var(--border);
      user-select: none;
    }
    .code-editor textarea {
      flex: 1; min-width: 0; min-height: 320px; resize: vertical;
      border: none; border-radius: 0; background: transparent;
    }
    .code-editor textarea:focus { box-shadow: none; }
    .tag-picker {
      display: flex; flex-wrap: wrap; align-items: center; gap: .35rem;
      padding: .35rem .45rem; position: relative; cursor: text;
      background: var(--panel-deep); border: 1px solid var(--border-strong);
      border-radius: 6px;
    }
    .tag-picker:focus-within {
      border-color: var(--border);
      box-shadow: 0 0 0 .15rem rgba(var(--bs-emphasis-color-rgb), .1);
    }
    .tag {
      display: inline-flex; align-items: center; gap: .25rem;
      font-family: var(--sans); font-size: .8125rem; color: var(--text);
      background: #2d333b; border: 1px solid #444c56;
      border-radius: 4px; padding: .1rem .25rem .1rem .5rem;
      text-transform: none; letter-spacing: 0; white-space: nowrap;
    }
    html[data-bs-theme="light"] .tag { background: #f6f8fa; border-color: #d0d7de; }
    .tag button {
      background: none; border: none; color: var(--muted); cursor: pointer;
      padding: 0 .2rem; font-size: .72rem;
    }
    .tag button:hover { color: var(--red); background: none; }
    .tag-picker input {
      flex: 1; min-width: 110px; border: none; background: transparent;
      padding: .12rem .2rem; font-family: var(--sans); font-size: .84rem;
    }
    .tag-picker input:focus { box-shadow: none; outline: none; }
    .tag-menu {
      position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20;
      background: var(--panel); border: 1px solid var(--border-strong);
      border-radius: 6px; max-height: 190px; overflow-y: auto;
      box-shadow: 0 14px 34px rgba(0, 0, 0, .45);
    }
    .tag-menu div {
      padding: .38rem .65rem; cursor: pointer;
      font-family: var(--sans); font-size: .84rem; color: var(--text);
      text-transform: none; letter-spacing: 0;
    }
    .tag-menu div:hover { background: var(--accent-soft); }
    .tag-menu div.none { color: var(--faint); cursor: default; background: none; }
    button {
      background: var(--btn-primary); color: #fff; border: 1px solid transparent;
      border-radius: .25rem; padding: .5rem 1rem; min-height: 38px;
      font: 500 .875rem var(--sans); cursor: pointer;
      transition: all .15s ease-in-out;
    }
    button:hover { background: var(--btn-primary); filter: brightness(.9); }
    button.secondary {
      background: var(--btn-secondary); color: var(--btn-secondary-fg);
      border-color: transparent;
    }
    button.secondary:hover { background: var(--btn-secondary); color: var(--btn-secondary-fg); }
    /* Compact button variants keep their own metrics (no 38px floor). */
    button.icon, .tag button, .pw-generate, .usermenu > button, .menu-toggle,
    .theme-toggle, .js-cancel, .js-copy, .btn-action-main, .btn-action-dropdown,
    .action-item, .nav-section-header { min-height: 0; }
    button.icon, a.icon-link {
      display: inline-block; background: none; color: var(--muted);
      border: 1px solid var(--border-strong); border-radius: 5px;
      padding: .14rem .55rem; font: 500 .78rem var(--sans);
      text-decoration: none; cursor: pointer; transition: color .12s, border-color .12s;
    }
    button.icon:hover, a.icon-link:hover {
      background: none; color: var(--text); border-color: var(--muted);
    }
    button.icon.delete { color: var(--red); border-color: transparent; }
    button.icon.delete:hover { border-color: var(--red); background: none; }
    button.icon .mdi, a.icon-link .mdi { font-size: .95rem; line-height: 1.2; }

    /* Family-manager row actions: blue Edit split-button with a caret dropdown. */
    .action-split-btn {
      display: inline-flex; position: relative;
      box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
    }
    .action-split-btn .btn-action-main {
      display: inline-flex; align-items: center; gap: .3rem;
      padding: .25rem .6rem; font: 500 .75rem var(--sans); color: #fff;
      background: var(--accent-strong, #1d4ed8);
      border: 1px solid var(--accent-strong, #1d4ed8);
      border-right: 1px solid rgba(255, 255, 255, .2);
      border-radius: .375rem 0 0 .375rem; cursor: pointer; text-decoration: none;
    }
    .action-split-btn .btn-action-main:hover { color: #fff; filter: brightness(1.1); }
    .action-split-btn .btn-action-dropdown {
      display: inline-flex; align-items: center; justify-content: center;
      width: 1.75rem; padding: .25rem; color: #fff;
      background: var(--accent-strong, #1d4ed8);
      border: 1px solid var(--accent-strong, #1d4ed8); border-left: none;
      border-radius: 0 .375rem .375rem 0; cursor: pointer;
    }
    .action-split-btn .btn-action-dropdown:first-child {
      border-radius: .375rem; border-left: 1px solid var(--accent-strong, #1d4ed8);
    }
    .action-split-btn .btn-action-dropdown:hover { filter: brightness(1.1); }
    .action-dropdown-menu {
      display: none; position: fixed; z-index: 2000; margin: 0;
      min-width: 140px; padding: .5rem; list-style: none;
      background: var(--bg); border: 1px solid var(--border);
      border-radius: .375rem; box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
    }
    .action-dropdown-menu.show { display: block; }
    .action-dropdown-menu li { margin: 0; }
    .action-dropdown-menu form { margin: 0; }
    .action-dropdown-menu .action-item {
      display: flex; align-items: center; gap: .5rem; width: 100%;
      padding: .5rem .75rem; font: 400 .875rem var(--sans); color: var(--text);
      background: transparent; border: none; border-radius: .25rem;
      text-align: left; text-decoration: none; cursor: pointer;
    }
    .action-dropdown-menu .action-item:hover { background: var(--bs-tertiary-bg); }
    .action-dropdown-menu .action-item.danger { color: var(--toast-danger, #dc3545); }
    .action-dropdown-menu .action-item.danger:hover { background: rgba(220, 53, 69, .1); }

    /* ------------------------------------- tables (manager .table-container) */
    .table-container {
      background: var(--bg); border: 1px solid var(--border);
      border-radius: 7px; box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
    }
    .table-wrap { overflow-x: auto;
                  border-radius: 6px 6px 0 0; }
    .table-container .table-wrap:last-child {
      border-radius: 6px;
    }
    table {
      width: 100%; border-collapse: separate; border-spacing: 0;
      background: transparent; font-size: .875rem;
    }
    th {
      font-size: .8125rem; font-weight: 600; color: var(--text);
      text-align: left; height: 2.75rem; padding: 0 1rem; vertical-align: middle;
      border-bottom: 1px solid var(--border);
      background: var(--bg); white-space: nowrap;
    }
    /* Sortable column headers (django_tables2) look like plain headers. */
    th a { color: inherit; text-decoration: none; }
    th a:hover { color: inherit; }
    th .mdi { font-size: .9rem; vertical-align: middle; }
    td {
      text-align: left; height: 2.75rem; padding: 0 1rem; vertical-align: middle;
      border-bottom: 1px solid var(--border);
      font-variant-numeric: tabular-nums;
      white-space: nowrap;
      background: var(--panel);
    }
    tr:last-child td { border-bottom: none; }
    .table-container td a:hover { color: #5c9dff; text-decoration: none; }
    tr.table-empty td {
      text-align: center; color: var(--muted); padding: 2.2rem 1rem;
      white-space: normal;
    }
    tr.table-empty:hover td { box-shadow: none; }
    .table-footer {
      display: flex; align-items: center; justify-content: space-between;
      flex-wrap: wrap; gap: 1rem; min-height: 2.75rem; padding: 0 1rem;
      background: var(--bg); border-top: 1px solid var(--border);
      border-radius: 0 0 6px 6px;
      font-size: .875rem;
    }
    .table-footer .table-info { color: var(--muted); }
    .table-footer .table-info strong { color: var(--text); }
    .pagination { margin: 0; display: flex; list-style: none; padding: 0; }
    .pagination .page-link {
      min-width: 2rem; text-align: center;
      background-color: var(--bg); border: 1px solid var(--border);
      color: var(--text); padding: .25rem .6rem; font-size: .8125rem;
      text-decoration: none; display: block; margin-left: -1px;
    }
    .pagination .page-item:first-child .page-link {
      border-radius: .375rem 0 0 .375rem; margin-left: 0;
    }
    .pagination .page-item:last-child .page-link {
      border-radius: 0 .375rem .375rem 0;
    }
    .pagination .page-link:hover { background-color: var(--bs-secondary-bg); }
    .pagination .page-item.active .page-link {
      background-color: #0d6efd; border-color: #0d6efd;
      color: #fff;
    }
    .pagination .page-item.disabled .page-link {
      color: var(--faint); pointer-events: none; opacity: .5;
      background-color: var(--bs-tertiary-bg);
    }
    .page-size-selector { display: flex; align-items: center; gap: .5rem;
                          color: var(--muted); font-size: .875rem; }
    .page-size-selector select {
      background-color: var(--bg); border: 1px solid var(--border);
      color: var(--text); font-size: .8125rem; padding: .25rem .6rem;
      border-radius: .375rem; cursor: pointer; min-width: 70px;
    }
    /* Description cells absorb remaining width. */
    td.desc { white-space: normal; width: 100%; min-width: 160px; }
    tr.linked { cursor: pointer; }
    tr.linked:hover td {
      box-shadow: inset 0 0 0 9999px rgba(var(--bs-emphasis-color-rgb), .075);
    }
    th.bulk-col, td.bulk-col { width: 1%; padding-right: .3rem; white-space: nowrap; }
    .bulk-col input { cursor: pointer; }
    .bulk-bar {
      position: sticky; bottom: 0; z-index: 30;
      display: none; align-items: center; gap: .8rem;
      margin-top: .8rem; padding: .6rem .9rem;
      background: var(--panel); border: 1px solid var(--accent);
      border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.45);
    }
    .bulk-bar.show { display: flex; }
    .bulk-bar .count { font-family: var(--mono); color: var(--muted); }
    .bulk-bar .spacer { flex: 1; }
    tbody tr, table tr { transition: background .15s; }
    table tr:hover td {
      box-shadow: inset 0 0 0 9999px rgba(var(--bs-emphasis-color-rgb), .075);
    }
    /* Family manager look: table links render in body colour and fade on hover. */
    table td a {
      color: var(--text); text-decoration: none; transition: opacity .15s;
    }
    table td a:hover { opacity: .7; text-decoration: none; }
    td.mono, .mono { font-family: var(--mono); font-size: .84rem; }
    td.actions { text-align: right; white-space: nowrap; }
    td.actions > * { margin-left: .25rem; }
    .muted { color: var(--muted); }
    a.cidr { color: var(--cyan); text-decoration: none; }
    a.cidr:hover { text-decoration: underline; text-underline-offset: 3px; }

    code {
      background-color: var(--panel); color: #e83e8c;
      padding: .2rem .4rem; border-radius: .25rem; font-size: .875rem;
    }

    /* -------------------------------------------- badges (manager-style) */
    .badge {
      display: inline-block; padding: .35rem .65rem; border-radius: .25rem;
      font-family: var(--sans); font-size: .75rem; font-weight: 600;
      line-height: 1; letter-spacing: .02em; color: #fff;
      background: var(--faint); white-space: nowrap;
    }
    .badge.active, .badge.gateway, .badge.running,
    .badge.production, .badge.vrrp-primary { background: #28a745; }
    .badge.maintenance { background: var(--btn-warning); color: #212529; }
    .badge.decommissioned { background: var(--faint); }
    .badge.container, .badge.network { background: #17a2b8; }
    .badge.reserved, .badge.dhcp, .badge.paused, .badge.shutting-down,
    .badge.pending, .badge.vrrp-secondary { background: var(--btn-warning); color: #212529; }
    .badge.deprecated, .badge.crashed { background: #dc3545; }
    .badge.broadcast, .badge.vrrp-vip { background: #6d28d9; }
    .badge.default, .badge.stopped, .badge.unknown, .badge.inactive {
      background: var(--btn-secondary); color: var(--btn-secondary-fg);
    }
    .badge.kind-badge {
      background: transparent; border: 1px solid var(--muted); color: var(--muted);
      margin-left: .5rem; font-size: .68rem;
    }

    /* -------------------------------------------- utilization meters */
    .util { display: inline-flex; align-items: center; gap: .55rem; }
    .util .bar {
      position: relative; width: 64px; height: 9px;
      background: var(--panel-deep); border: 1px solid var(--border-strong);
      border-radius: 2px; overflow: hidden;
    }
    .util .bar i { display: block; height: 100%; background: var(--green); }
    .util.warn .bar i { background: var(--amber); }
    .util.bad .bar i { background: var(--red); }
    .util .bar::after {
      content: ""; position: absolute; inset: 0;
      background: repeating-linear-gradient(90deg,
        transparent 0, transparent calc(25% - 1px),
        var(--bg) calc(25% - 1px), var(--bg) 25%);
      pointer-events: none;
    }
    .util > .muted {
      font-family: var(--mono); font-size: .74rem; min-width: 3.2em;
    }

    .empty {
      color: var(--muted); padding: 2.4rem 1rem; text-align: center;
      background: var(--panel); border: 1px dashed var(--border);
      border-radius: .5rem; font-size: .88rem;
    }
    .empty button { margin-left: .7rem; }
    .ferr {
      font-family: var(--sans); font-size: .78rem; font-weight: 400;
      text-transform: none; letter-spacing: 0; color: var(--red);
    }
    dialog.modal input.invalid, dialog.modal select.invalid,
    dialog.modal textarea.invalid { border-color: var(--red); }

    /* ------------------------------------------------------- split view */
    .split { display: flex; gap: 1.6rem; align-items: flex-start; }
    .split-main { flex: 1.4; min-width: 0; }
    .split-side { flex: 1; min-width: 320px; }
    .split-side .toolbar h2, .split-side .toolbar h3, .split-side .toolbar h4 { margin: 0; }
    .split-side .hint {
      font-size: .76rem; margin: .8rem 0 0; color: var(--faint);
    }
    .js-configuration-filter { width: 170px; }
    tr.configuration-item { cursor: grab; }
    tr.configuration-item:active { cursor: grabbing; }
    tr.configuration-item td:first-child { padding-left: 2rem; position: relative; }
    tr.configuration-item td:first-child::before {
      content: "⣿"; font-size: .72rem; line-height: 1;
      color: var(--faint); position: absolute; left: .8rem; top: 50%;
      transform: translateY(-50%);
    }
    tr.configuration-item:hover td { background: var(--accent-soft); }
    .tree-toggle {
      display: inline-flex; align-items: center; justify-content: center;
      width: 22px; height: 22px; margin-right: .5rem; padding: 0;
      background: var(--panel-deep); border: 1px solid var(--border);
      border-radius: 5px; color: var(--muted); cursor: pointer;
      vertical-align: middle; font-size: 1rem;
      transition: color .12s, border-color .12s, background .12s;
    }
    .tree-toggle:hover {
      color: var(--text); border-color: var(--border-strong);
      background: var(--panel);
    }
    .tree-toggle .mdi { transition: transform .15s; display: inline-block;
                        line-height: 1; }
    .tree-toggle.collapsed .mdi { transform: rotate(-90deg); }
    tr.sub-row .tree { color: var(--faint); font-family: var(--mono);
                       margin-right: .35rem; }
    dialog.modal.config-modal { width: min(920px, 94vw); }
    button.danger { background: var(--btn-danger); color: #fff; }
    button.danger:hover { background: var(--btn-danger); }
    tr.device-row.dragover td {
      background: var(--accent-soft);
      box-shadow: inset 0 1px 0 var(--accent), inset 0 -1px 0 var(--accent);
    }
    .chip {
      display: inline-flex; align-items: center; gap: .15rem;
      font-family: var(--mono); font-size: .74rem;
      background: var(--panel-deep); color: var(--text);
      border: 1px solid var(--border-strong); border-radius: 4px;
      padding: .04rem .2rem .04rem .5rem; margin: .1rem .2rem .1rem 0;
      white-space: nowrap;
    }
    .chip button {
      background: none; border: none; color: var(--faint); cursor: pointer;
      padding: 0 .25rem; font-size: .74rem;
    }
    .chip button:hover { color: var(--red); background: none; }
    .drop-hint { font-size: .78rem; color: var(--faint); }

    /* ---------------------------------------------------- config output */
    .config-block { position: relative; }
    pre.config {
      background: #0d1117; border: 1px solid var(--border);
      border-radius: .25rem; padding: 1.1rem 1.3rem; overflow-x: auto;
      font: 400 .82rem/1.65 var(--code); color: #c9d1d9; margin: 0;
    }
    .config-block .js-copy {
      position: absolute; top: .6rem; right: .6rem;
    }

    /* ------------------------------------------------------------ modal */
    /* Bootstrap also defines `.modal` (display:none, full-screen shell) —
       these rules restore native <dialog> behaviour for our dialogs. */
    dialog.modal {
      background: var(--bg); color: var(--text);
      border: 1px solid var(--border); border-radius: .5rem;
      padding: 0; width: min(500px, 92vw);
      box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .15);
      display: none; position: fixed; inset: 0; margin: auto;
      height: fit-content; max-height: 92vh; overflow: visible;
    }
    dialog.modal[open] { display: block; }
    /* Modals containing a code editor get room to work. */
    dialog.modal:has(textarea) { width: min(860px, 94vw); }
    dialog.modal:has(textarea) .modal-body { max-height: 74vh; }
    dialog.modal::backdrop { background: rgba(0, 0, 0, .5); }
    dialog.modal .modal-head {
      display: flex; justify-content: space-between; align-items: center;
      padding: .95rem 1.3rem; border-bottom: 1px solid var(--border);
    }
    dialog.modal .modal-head strong { font-size: .98rem; font-weight: 600; }
    dialog.modal .modal-body {
      display: flex; flex-direction: column; gap: .8rem;
      padding: 1.2rem 1.3rem; max-height: 65vh; overflow-y: auto;
    }
    dialog.modal .modal-body .fields {
      display: flex; flex-direction: column; gap: .8rem; flex: 1; min-width: 0;
    }
    dialog.modal .modal-body.with-help { flex-direction: row; gap: 1.3rem; }
    dialog.modal:has(.modal-help) { width: min(1150px, 96vw); }
    .modal-help {
      width: 300px; flex-shrink: 0; align-self: stretch;
      border-left: 1px solid var(--border); padding-left: 1.3rem;
      font-size: .78rem; color: var(--muted); overflow-y: auto;
    }
    .modal-help h4 {
      font-family: var(--mono); font-size: .66rem; font-weight: 600;
      text-transform: uppercase; letter-spacing: .16em; color: var(--faint);
      margin: 0 0 .6rem;
    }
    .modal-help .ph-hint { margin: 0 0 .9rem; line-height: 1.6; }
    .modal-help .ph { margin-bottom: .9rem; line-height: 1.5; }
    .modal-help .ph > code { display: block; margin-bottom: .15rem; }
    .modal-help code {
      font-family: var(--code); font-size: .74rem; color: var(--amber);
    }
    .modal-help .ph > span { display: block; font-size: .74rem;
                             color: var(--faint); margin-bottom: .15rem; }
    .modal-help .ph ul { margin: 0; padding: 0; list-style: none; }
    .modal-help .ph li {
      font-family: var(--code); font-size: .74rem; color: var(--cyan);
      padding-left: .9rem;
    }
    @media (max-width: 1000px) { .modal-help { display: none; } }
    dialog.modal label {
      display: flex; flex-direction: column; gap: .4rem;
      font-size: .82rem; font-weight: 500; letter-spacing: 0; color: var(--text);
    }
    dialog.modal label > input, dialog.modal label > select,
    dialog.modal label > textarea {
      font-family: var(--sans); text-transform: none; letter-spacing: 0;
      width: 100%;
    }
    dialog.modal label > input.mono, dialog.modal label > textarea.mono {
      font-family: var(--mono);
    }
    dialog.modal label.checkbox {
      flex-direction: row; align-items: center; gap: .55rem;
    }
    dialog.modal label.checkbox > input { width: auto; }
    dialog.modal .modal-foot {
      display: flex; justify-content: flex-end; gap: .5rem;
      padding: .9rem 1.3rem; border-top: 1px solid var(--border);
    }

    /* ------------------------------------------------------------ login */
    .login-box {
      max-width: 340px; margin: 14vh auto 0;
      background: var(--panel); border: 1px solid var(--border);
      border-radius: .5rem; padding: 1.8rem 1.6rem;
      display: flex; flex-direction: column; gap: .9rem;
    }
    .login-box h2 { margin: 0 0 .2rem; }
    .login-box label {
      display: flex; flex-direction: column; gap: .3rem;
      font-family: var(--mono); font-size: .68rem;
      text-transform: uppercase; letter-spacing: .14em; color: var(--muted);
    }


    .sidebar-overlay {
      display: none; position: fixed; inset: 0; z-index: 1045;
      background: rgba(0,0,0,.5);
    }
    .sidebar-overlay.show { display: block; }
    @media (max-width: 900px) {
      .header { left: 0; }
      aside#sidebar { transform: translateX(-100%); transition: transform .25s; }
      aside#sidebar.show { transform: translateX(0); }
      .header .menu-toggle { display: inline-flex; }
      .page { margin-left: 0; }
      main, .subheader, .header { padding-left: 1rem; padding-right: 1rem; }
      .subnav { margin: -1.6rem -1rem 1.4rem; padding: 0 1rem; }
      .split { flex-direction: column; }
      .split-side { min-width: 0; width: 100%; }
    }
    @media (min-width: 901px) { .sidebar-overlay { display: none !important; } }
    @media (prefers-reduced-motion: reduce) {
      * { transition: none !important; }
    }

    /* ---------------------------------------------- location map + wizard */
    dialog.modal.wizard-modal { width: min(1180px, 96vw); max-width: 96vw; }
    dialog.modal.wizard-modal .modal-body { padding: 0; display: flex;
                                            flex-direction: row; gap: 0; }
    .wizard-panels { flex: 1; min-width: 0; }
    .wizard-help { padding: 1.2rem 1.3rem; max-height: none; }
    /* Content-history revert control (configurations). */
    .wizard-history { margin-bottom: .9rem; border: 1px solid var(--border);
                      border-radius: .5rem; background: var(--panel-deep); }
    .wizard-history > summary {
      cursor: pointer; user-select: none; padding: .5rem .75rem;
      font-size: .8rem; font-weight: 600; color: var(--muted);
      display: flex; align-items: center; gap: .4rem;
    }
    .wizard-history > summary::before {
      content: "\F0453"; font-family: "Material Design Icons";
      font-size: 1rem; color: var(--accent);
    }
    .wizard-history[open] > summary { border-bottom: 1px solid var(--border); }
    .wh-list { max-height: 190px; overflow-y: auto; padding: .3rem; }
    .wh-item {
      display: block; width: 100%; text-align: left; background: none;
      border: none; border-radius: 5px; padding: .38rem .55rem;
      color: var(--text); font: 400 .82rem var(--sans); cursor: pointer;
    }
    .wh-item:hover { background: var(--panel); }
    .wh-item.sel { background: var(--accent-soft); }
    .wh-item .wh-when { font-family: var(--code); }
    .wh-item .wh-who { color: var(--muted); }
    .wh-item .wh-cur {
      font-size: .68rem; color: var(--accent); border: 1px solid var(--accent);
      border-radius: 4px; padding: 0 .3rem; margin-left: .3rem;
    }
    .wizard-steps { display: flex; border-bottom: 1px solid var(--line);
                    background: var(--panel-2, var(--bg)); }
    .wstep { flex: 1; text-align: center; padding: .75rem .5rem;
             font-size: .74rem; letter-spacing: .09em; font-weight: 600;
             color: var(--muted); text-transform: uppercase; position: relative;
             cursor: pointer; user-select: none;
             clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%,
                       calc(100% - 14px) 100%, 0 100%, 14px 50%); }
    .wstep:first-child { clip-path: polygon(0 0, calc(100% - 14px) 0,
                       100% 50%, calc(100% - 14px) 100%, 0 100%); }
    .wstep.active { color: var(--accent, #2d6cdf); }
    .wstep.done { color: var(--text); }
    .wizard-body { min-height: 62vh; }
    .wpanel { display: none; }
    .wpanel.active { display: block; }
    .wpanel:not([data-location]) { padding: 1.4rem 1.6rem; }
    .wizard-loc { position: relative; height: 62vh; }
    .wmap { position: absolute; inset: 0; z-index: 0; background: #e8eaed; }
    .wcol { position: absolute; top: 1rem; z-index: 500; width: 250px;
            max-height: calc(62vh - 2rem); overflow-y: auto;
            background: rgba(255,255,255,.96); border-radius: 6px;
            box-shadow: 0 2px 14px rgba(0,0,0,.18); padding: .7rem 0; }
    .wcol-countries { left: 1rem; }
    .wcol-locations { left: 17.5rem; }
    .wcol h4 { margin: 0 0 .3rem; padding: 0 1rem; font-size: .72rem;
               letter-spacing: .08em; color: #9aa0a6; font-weight: 600; }
    .witem { display: flex; align-items: center; gap: .55rem; cursor: pointer;
             padding: .42rem 1rem; font-size: .86rem; color: #202124;
             border-left: 3px solid transparent; }
    .witem:hover { background: #f1f3f4; }
    .witem.active { border-left-color: var(--accent, #2d6cdf);
                    background: #eaf1fd; font-weight: 500; }
    .witem .flag { font-size: 1.05rem; line-height: 1; }
    .witem .wcount { margin-left: auto; font-size: .72rem; color: #9aa0a6; }
    .witem .wsub { color: #9aa0a6; font-size: .78rem; }
    .wizard-foot { display: flex; align-items: center; gap: .6rem; }
    .wizard-foot .spacer { flex: 1; }
    .map-page { position: absolute; inset: 0; }
    .map-page #bigmap { position: absolute; inset: 0; }
    :root[data-bs-theme="dark"] .wmap { background: #2a2d31; }

    /* ---- global search (results page, manager list look) ---- */
    .sidebar-search.page-search { margin: 0; width: 280px; max-width: 100%; }
    .table-container td.sub { color: var(--muted); }
    .table-container tr.more td { color: var(--muted); font-size: .82rem; }
    .table-container tr.more:hover td { background: transparent; }

/* ── Flatpickr date picker, themed to match (adopted from statuspage mgr) ── */
/* flatpickr wraps the input in a .flatpickr-wrapper (inline-block), which
   breaks the width:100% rule on `label > input` — stretch both so date fields
   match every other field's width. */
dialog.modal label > .flatpickr-wrapper { display: block; width: 100%; }
dialog.modal label > .flatpickr-wrapper > input { width: 100%; }
/* While a calendar is open, let the (scrollable) modal body overflow so the
   inline calendar isn't clipped. Covers plain + wizard modals (both use
   .modal-body, which has overflow-y:auto / max-height:65vh). */
dialog.modal:has(.flatpickr-calendar.open) .modal-body { overflow: visible; }
.flatpickr-calendar {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .28);
  color: var(--text);
  font-family: var(--sans);
}
.flatpickr-calendar.arrowTop::before,
.flatpickr-calendar.arrowTop::after,
.flatpickr-calendar.arrowBottom::before,
.flatpickr-calendar.arrowBottom::after { display: none; }
/* Inline (static) calendar sits under the field inside the modal. */
.flatpickr-calendar.static { box-shadow: 0 4px 16px rgba(0, 0, 0, .22); }
.flatpickr-months,
.flatpickr-months .flatpickr-month { background: transparent; color: var(--text); }
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year { color: var(--text); font-weight: 600; }
.flatpickr-monthDropdown-months { background: var(--panel); }
.flatpickr-monthDropdown-month { background: var(--panel); color: var(--text); }
.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month { fill: var(--muted); }
.flatpickr-months .flatpickr-prev-month svg,
.flatpickr-months .flatpickr-next-month svg { fill: var(--muted); }
.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg { fill: var(--accent); }
.flatpickr-weekdays { background: transparent; }
span.flatpickr-weekday { color: var(--muted); font-weight: 600; }
.flatpickr-day {
  color: var(--text);
  border-radius: 6px;
  border-color: transparent;
}
.flatpickr-day:hover,
.flatpickr-day:focus { background: var(--row-hover); border-color: transparent; }
.flatpickr-day.today { border-color: var(--accent); }
.flatpickr-day.selected,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.flatpickr-day.inRange { background: var(--accent-soft); border-color: transparent; box-shadow: none; }
.flatpickr-day.flatpickr-disabled,
.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay { color: var(--faint); }
.flatpickr-time input,
.flatpickr-time .flatpickr-am-pm { color: var(--text); }
.flatpickr-time input:hover,
.flatpickr-time .flatpickr-am-pm:hover,
.flatpickr-time input:focus { background: var(--row-hover); }
.numInputWrapper span.arrowUp::after { border-bottom-color: var(--muted); }
.numInputWrapper span.arrowDown::after { border-top-color: var(--muted); }

/* ---- audit log before/after diff ---- */
.audit-toggle { width: 2.2rem; text-align: center; }
.audit-toggle .tree-toggle { margin-right: 0; }
.audit-diff-row > td { padding: 0; border-top: none; }
.audit-diff-row:not(.open) { display: none; }
.audit-diff {
  width: auto; margin: .1rem 0 .5rem 0;
  border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
}
.audit-diff th {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); background: var(--panel-deep); padding: .25rem .6rem;
}
.audit-diff td { padding: .2rem .6rem; font-size: .82rem; vertical-align: top; }
.audit-old { color: var(--red); }
.audit-new { color: var(--green); }

    /* ------------------------------------------------------ messaging */
    .cal-nav { display: inline-flex; align-items: center; gap: .45rem; }
    .cal-nav .cal-btn {
      display: inline-flex; align-items: center; justify-content: center;
      min-width: 30px; height: 30px; padding: 0 .55rem; border-radius: 6px;
      background: var(--btn-secondary); color: var(--btn-secondary-fg);
      font: 500 .82rem var(--sans); text-decoration: none;
      transition: background .12s;
    }
    .cal-nav .cal-btn:hover { background: var(--btn-secondary-h); }
    .cal-nav .cal-month {
      min-width: 130px; text-align: center;
      font-size: .95rem; font-weight: 600;
    }
    table.cal { width: 100%; table-layout: fixed; }
    table.cal th { text-transform: uppercase; font-size: .72rem;
                   letter-spacing: .05em; color: var(--muted); }
    td.cal-day {
      vertical-align: top; height: 108px; padding: .45rem .5rem;
      border-bottom: 1px solid var(--line);
    }
    td.cal-day + td.cal-day { border-left: 1px solid var(--line); }
    tr:last-child td.cal-day { border-bottom: none; }
    td.cal-out { background: var(--panel-deep); }
    td.cal-out .cal-num { color: var(--faint); }
    td.cal-today { box-shadow: inset 0 0 0 2px var(--accent);
                   border-radius: 4px; }
    td.cal-today .cal-num { color: var(--accent); font-weight: 700; }
    .cal-num { font-size: .78rem; color: var(--muted); margin-bottom: .3rem; }
    .cal-item {
      font-size: .74rem; padding: .14rem .4rem; margin-bottom: .25rem;
      border-radius: 4px; background: var(--accent-soft); color: var(--text);
      overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
      border-left: 3px solid var(--accent);
    }
    .cal-item.cal-in-progress { border-left-color: var(--amber); }
    .cal-item.cal-completed { border-left-color: var(--green); }
    .cal-item.cal-cancelled { border-left-color: var(--red); opacity: .6;
      text-decoration: line-through; }

    .oncall-top {
      display: flex; justify-content: center; margin-bottom: 1.3rem;
    }
    .oncall-wheelbox {
      display: flex; align-items: center; justify-content: center;
      background: var(--panel); border: 1px solid var(--border);
      border-radius: .5rem; box-shadow: 0 1px 3px rgba(0,0,0,.12);
      padding: 1rem 3rem;
    }
    .oncall-svg { width: 260px; height: 260px; }
    .oncall-seg { opacity: .9; stroke: var(--bg); stroke-width: 2; }
    .oncall-seg-l1 { fill: var(--accent); }
    .oncall-seg-l2 { fill: var(--amber); }
    .oncall-seg-l3 { fill: var(--violet); }
    .oncall-hub { fill: var(--panel-deep); stroke: var(--border); }
    .oncall-hub-title { fill: var(--muted); font-size: 10px;
      text-transform: uppercase; letter-spacing: .08em; }
    .oncall-hub-team { fill: var(--text); font-size: 13px; font-weight: 600; }
    .oncall-seg-label { fill: rgba(255,255,255,.92); font-size: 10px;
      font-weight: 700; text-transform: uppercase; }
    .oncall-seg-name { fill: rgba(255,255,255,.95); font-size: 11px; }
    .oncall-teams select { min-width: 220px; }

    /* Login page — same split layout as the other managers: logo left,
       card right, fixed header with theme toggle, standard footer. */
    .login-container {
      min-height: calc(100vh - var(--header-h) - 55px);
      display: flex; align-items: stretch;
    }
    .login-container .row {
      min-height: calc(100vh - var(--header-h) - 55px);
      width: 100%; margin: 0;
    }
    .logo-section {
      display: flex; align-items: center; justify-content: flex-end;
      padding: 2rem;
    }
    .form-section {
      display: flex; align-items: center; justify-content: flex-start;
      padding: 2rem;
    }
    .login-card { width: 100%; max-width: 400px; }
    .logo-section > div { width: 100%; max-width: 550px; }
    .logo-section img { width: 100%; height: auto; }
    html[data-bs-theme="dark"] .logo-dark { display: block !important; }
    html[data-bs-theme="dark"] .logo-light { display: none !important; }
    html[data-bs-theme="light"] .logo-dark { display: none !important; }
    html[data-bs-theme="light"] .logo-light { display: block !important; }
    .login-card .detail-card {
      background: var(--panel); border: 1px solid var(--border);
      border-radius: 0.5rem; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
      overflow: hidden;
    }
    /* The other managers shrink bootstrap's -lg controls back to .875rem. */
    .login-card .form-control {
      background: var(--panel); border-color: var(--border);
      color: var(--text);
      padding: 0.5rem 0.75rem; font-size: 0.875rem; border-radius: 0.25rem;
    }
    .login-card .form-control:focus {
      background: var(--bg); color: var(--text);
      border-color: var(--accent); box-shadow: 0 0 0 .2rem var(--accent-soft);
    }
    .login-card .btn {
      padding: 0.5rem 1rem; font-size: 0.875rem; border-radius: 0.25rem;
      font-weight: 500; border: none; min-height: 38px;
    }
    .login-card .btn-success {
      background-color: var(--btn-primary); border-color: var(--btn-primary);
      color: #fff;
    }
    .login-card .btn-success:hover {
      background-color: var(--btn-primary-h); border-color: var(--btn-primary-h);
    }
    /* The other managers' light theme uses the brighter success green. */
    html[data-bs-theme="light"] .login-card .btn-success {
      background-color: #22c55e; border-color: #22c55e;
    }
    html[data-bs-theme="light"] .login-card .btn-success:hover {
      background-color: #16a34a; border-color: #16a34a;
    }

    /* Analytics — chart panel above the samples table. */
    .ana-panel {
      background: var(--panel); border: 1px solid var(--border);
      border-radius: .5rem; box-shadow: var(--card-shadow);
      padding: 1rem 1.2rem 0.7rem; margin-bottom: 1.2rem;
    }
    .ana-head {
      display: flex; justify-content: space-between; align-items: center;
      gap: 1rem; flex-wrap: wrap; margin-bottom: .6rem;
    }
    .ana-legend { display: flex; gap: .9rem; }
    .ana-chip {
      display: inline-flex; align-items: center; gap: .4rem;
      font-size: .8rem; color: var(--muted); font-weight: 500;
    }
    .ana-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
    .ana-dot.ana-rx_mbps { background: var(--accent); }
    .ana-dot.ana-tx_mbps { background: var(--cyan); }
    .ana-dot.ana-watts { background: var(--amber); }
    .ana-stats { display: flex; gap: 1.4rem; }
    .ana-stat { display: inline-flex; align-items: baseline; gap: .45rem; font-size: .82rem; }
    .ana-stat-label { color: var(--muted); text-transform: uppercase;
                      font-size: .7rem; letter-spacing: .06em; }
    .ana-stat strong { font-size: 1.05rem; }
    .ana-svg { width: 100%; height: 240px; display: block; }
    .ana-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 5; }
    .ana-line { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; }
    .ana-line.ana-rx_mbps { stroke: var(--accent); }
    .ana-line.ana-tx_mbps { stroke: var(--cyan); }
    .ana-line.ana-watts { stroke: var(--amber); }
    .ana-axis {
      display: flex; justify-content: space-between; padding: .35rem 0 .3rem;
      font-size: .74rem; color: var(--muted);
    }

    /* 2FA digit boxes (login + TOTP setup) — same pattern as the other
       managers, skinned with the terminal tokens. */
    .totp-boxes {
      display: flex; justify-content: center; gap: .6rem;
    }
    .totp-digit {
      width: 3rem; height: 3.5rem; text-align: center;
      font-size: 1.4rem; font-weight: 600;
      color: var(--text); background: var(--panel-deep);
      border: 1px solid var(--border-strong); border-radius: .5rem;
      outline: none; caret-color: var(--accent);
      transition: border-color .15s, box-shadow .15s;
    }
    .totp-digit:focus {
      border-color: var(--accent); box-shadow: 0 0 0 .2rem var(--accent-soft);
    }

/* Dashboard stat cards (family style, mapped to local tokens) */
.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  padding: 1.25rem;
  text-align: center;
  color: var(--text);
}
a.stat-card:hover {
  border-color: var(--border-strong);
}
.stat-card-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  color: var(--text);
  line-height: 1;
}
.stat-card-value {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--text);
}
.stat-card-label {
  font-size: 0.8125rem;
  color: var(--text);
  margin: 0;
}
