/* =====================================================================
   NexusISP design system  ·  "Console" theme
   Bootstrap 5.3 underneath; everything is re-skinned through tokens.
   Light + dark (data-bs-theme), brand colour from appearance.primary_color.
   ===================================================================== */

/* ---------------------------------------------------------------- fonts */
@font-face { font-family: "Inter var"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/static/vendor/fonts-ui/inter-latin-wght-normal.woff2) format("woff2");
  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: "Inter var"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/static/vendor/fonts-ui/inter-latin-ext-wght-normal.woff2) format("woff2");
  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; }
@font-face { font-family: "JetBrains Mono var"; font-style: normal; font-weight: 100 800; font-display: swap;
  src: url(/static/vendor/fonts-ui/jetbrains-mono-latin-wght-normal.woff2) format("woff2"); }

/* ---------------------------------------------------------------- tokens */
:root {
  --brand: #2563eb;               /* overridden per install from appearance.primary_color */
  --brand-rgb: 37, 99, 235;
  --brand-ink: #fff;              /* text on brand */
  --accent: #ea580c;

  --font-sans: "Inter var", Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --font-mono: "JetBrains Mono var", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* neutrals (slate) */
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;           /* table heads, wells */
  --surface-3: #f1f5f9;           /* hover */
  --line: #e5e9f0;
  --line-strong: #d5dbe5;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --subtle: #94a3b8;

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, .08), 0 2px 4px -2px rgba(15, 23, 42, .05);
  --shadow-lg: 0 20px 40px -12px rgba(15, 23, 42, .22);
  --ring: 0 0 0 3px rgba(var(--brand-rgb), .25);
  --ease: cubic-bezier(.2, .7, .2, 1);

  --sidebar-w: 260px;
  --sidebar-rail: 68px;
  --topbar-h: 56px;

  /* sidebar palette (dark by default) */
  --sb-bg: #0b1220;
  --sb-bg-2: #111a2e;
  --sb-line: rgba(255, 255, 255, .07);
  --sb-ink: #cbd5e1;
  --sb-ink-strong: #fff;
  --sb-muted: #64748b;
  --sb-hover: rgba(255, 255, 255, .05);
  --sb-active: rgba(var(--brand-rgb), .18);

  /* semantic */
  --ok: #059669;    --ok-bg: #ecfdf5;    --ok-line: #a7f3d0;
  --warn: #b45309;  --warn-bg: #fffbeb;  --warn-line: #fde68a;
  --bad: #dc2626;   --bad-bg: #fef2f2;   --bad-line: #fecaca;
  --info: #0369a1;  --info-bg: #f0f9ff;  --info-line: #bae6fd;
  --neutral: #475569; --neutral-bg: #f1f5f9; --neutral-line: #e2e8f0;

  /* map onto Bootstrap */
  --bs-body-font-family: var(--font-sans);
  --bs-font-monospace: var(--font-mono);
  --bs-body-font-size: .875rem;
  --bs-body-line-height: 1.55;
  --bs-body-color: var(--ink-2);
  --bs-body-color-rgb: 51, 65, 85;
  --bs-body-bg: var(--surface);
  --bs-emphasis-color: var(--ink);
  --bs-secondary-color: var(--muted);
  --bs-tertiary-bg: var(--bg);
  --bs-secondary-bg: var(--surface-3);
  --bs-border-color: var(--line);
  --bs-border-color-translucent: var(--line);
  --bs-border-radius: var(--radius);
  --bs-border-radius-sm: var(--radius-sm);
  --bs-border-radius-lg: var(--radius-lg);
  --bs-border-radius-xl: var(--radius-xl);
  --bs-primary: var(--brand);
  --bs-primary-rgb: var(--brand-rgb);
  --bs-link-color: var(--brand);
  --bs-link-color-rgb: var(--brand-rgb);
  --bs-link-hover-color: color-mix(in srgb, var(--brand) 80%, #000);
  --bs-link-decoration: none;
  --bs-heading-color: var(--ink);
  --bs-focus-ring-color: rgba(var(--brand-rgb), .25);
  --bs-primary-bg-subtle: color-mix(in srgb, var(--brand) 10%, #fff);
  --bs-primary-border-subtle: color-mix(in srgb, var(--brand) 30%, #fff);
  --bs-primary-text-emphasis: color-mix(in srgb, var(--brand) 75%, #000);
  --bs-success: var(--ok); --bs-success-rgb: 5, 150, 105;
  --bs-danger: var(--bad); --bs-danger-rgb: 220, 38, 38;
  --bs-warning-rgb: 217, 119, 6;
  --bs-info-rgb: 2, 132, 199;
  color-scheme: light;
}

[data-bs-theme="dark"] {
  --bg: #0a0f1a;
  --surface: #111827;
  --surface-2: #0f1624;
  --surface-3: #1a2333;
  --line: #1f2a3c;
  --line-strong: #2b3a52;
  --ink: #f1f5f9;
  --ink-2: #cbd5e1;
  --muted: #8b9ab0;
  --subtle: #64748b;
  --shadow-xs: none;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 8px 20px -6px rgba(0, 0, 0, .55);
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .7);
  --ring: 0 0 0 3px rgba(var(--brand-rgb), .4);

  --sb-bg: #0a0f1a;
  --sb-bg-2: #0f1624;
  --sb-line: #1a2333;

  --ok: #34d399;    --ok-bg: rgba(16, 185, 129, .12);  --ok-line: rgba(16, 185, 129, .3);
  --warn: #fbbf24;  --warn-bg: rgba(245, 158, 11, .12); --warn-line: rgba(245, 158, 11, .3);
  --bad: #f87171;   --bad-bg: rgba(239, 68, 68, .12);   --bad-line: rgba(239, 68, 68, .32);
  --info: #38bdf8;  --info-bg: rgba(14, 165, 233, .12); --info-line: rgba(14, 165, 233, .3);
  --neutral: #94a3b8; --neutral-bg: rgba(148, 163, 184, .1); --neutral-line: rgba(148, 163, 184, .25);

  --bs-body-color: var(--ink-2);
  --bs-body-color-rgb: 203, 213, 225;
  --bs-body-bg: var(--surface);
  --bs-emphasis-color: var(--ink);
  --bs-secondary-color: var(--muted);
  --bs-tertiary-bg: var(--bg);
  --bs-secondary-bg: var(--surface-3);
  --bs-border-color: var(--line);
  --bs-border-color-translucent: var(--line);
  --bs-heading-color: var(--ink);
  --bs-link-color: color-mix(in srgb, var(--brand) 70%, #fff);
  --bs-link-hover-color: color-mix(in srgb, var(--brand) 55%, #fff);
  --bs-primary-bg-subtle: rgba(var(--brand-rgb), .15);
  --bs-primary-border-subtle: rgba(var(--brand-rgb), .4);
  --bs-primary-text-emphasis: color-mix(in srgb, var(--brand) 60%, #fff);
  color-scheme: dark;
}

/* ---------------------------------------------------------------- base */
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font-sans); font-feature-settings: "cv11", "ss01", "ss03"; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body.app { background: var(--bg); color: var(--ink-2); }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--ink); letter-spacing: -.015em; font-weight: 650; }
.h4, h4 { font-size: 1.25rem; }
.h5, h5 { font-size: 1.05rem; }
.h6, h6 { font-size: .9rem; }
a { color: var(--bs-link-color); text-decoration: none; text-underline-offset: 2px; }  /* Bootstrap uses --bs-link-color-rgb, which the dark theme cannot lighten */
a:hover { color: var(--bs-link-hover-color); }
a:hover { text-decoration: underline; }
a.btn:hover, a.nav-link-item:hover, .nav-link:hover, .dropdown-item:hover, .list-group-item:hover, a.card:hover, a.text-decoration-none:hover, .page-link:hover, a.brand:hover, a.kpi:hover { text-decoration: none; }
.mono, code, kbd, samp, .font-monospace { font-family: var(--font-mono) !important; font-size: .82em; font-variant-ligatures: none; }
code { color: var(--ink); background: var(--surface-3); padding: .1em .35em; border-radius: 4px; }
.text-muted, .text-body-secondary { color: var(--muted) !important; }
.small, small { font-size: .8125rem; }
.tabular, .table td, .kpi-value, .stat-value { font-variant-numeric: tabular-nums; }
hr { border-color: var(--line); opacity: 1; }
::selection { background: rgba(var(--brand-rgb), .2); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.btn:focus-visible, .form-control:focus-visible, .form-select:focus-visible { outline: none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; } }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }

/* ---------------------------------------------------------------- app shell */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); flex-shrink: 0; position: sticky; top: 0; height: 100vh; z-index: 1040;
  display: flex; flex-direction: column; background: var(--sb-bg); color: var(--sb-ink); border-right: 1px solid var(--sb-line);
  transition: width .2s var(--ease), transform .2s var(--ease); }
.sidebar-light { --sb-bg: var(--surface); --sb-bg-2: var(--surface-2); --sb-line: var(--line); --sb-ink: var(--ink-2);
  --sb-ink-strong: var(--ink); --sb-muted: var(--subtle); --sb-hover: var(--surface-3); --sb-active: rgba(var(--brand-rgb), .1); }
.sidebar .brand { display: flex; align-items: center; gap: .7rem; height: var(--topbar-h); padding: 0 1rem; flex-shrink: 0;
  color: var(--sb-ink-strong); text-decoration: none; border-bottom: 1px solid var(--sb-line); }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; color: #fff;
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 82%, #fff), color-mix(in srgb, var(--brand) 62%, #000)); box-shadow: 0 4px 12px -4px rgba(var(--brand-rgb), .7); font-size: 1rem; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; background: #fff; }
.brand-text { min-width: 0; line-height: 1.15; }
/* uploaded logo (Settings -> Appearance). Wide wordmarks sit on a white plate so dark lettering stays readable on the
   dark sidebar / login hero; in the collapsed rail the plate becomes a square showing the left part of the logo. */
.brand.has-logo { height: auto; min-height: var(--topbar-h); padding: .6rem .7rem; }
.brand-logo { display: flex; align-items: center; justify-content: center; width: 100%; height: 60px; padding: 6px 10px;
  background: #fff; border-radius: 10px; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); overflow: hidden; }
.brand-logo img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.sidebar-light .brand-logo { box-shadow: none; border: 1px solid var(--line); }
.brand-logo-inline { width: auto; height: 40px; padding: 0; background: transparent; box-shadow: none; border-radius: 6px; }
.brand-logo-inline img { height: 100%; width: auto; }
.brand-logo-lg { height: 52px; }
[data-bs-theme="dark"] .brand-logo-inline { background: #fff; padding: 3px 8px; }
.brand-logo-hero { width: auto; height: 64px; padding: 8px 14px; }
.brand-logo-hero img { height: 100%; width: auto; }
@media (min-width: 992px) {
  .rail .sidebar .brand.has-logo { padding: .55rem 0; }
  .rail .sidebar .brand-logo { width: 46px; height: 46px; padding: 3px; }
  .rail .sidebar .brand-logo img { width: auto; height: 100%; max-width: none; object-fit: cover; object-position: left center; }
}
.brand-name { font-weight: 700; font-size: .95rem; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.brand-sub { font-size: .68rem; color: var(--sb-muted); text-transform: uppercase; letter-spacing: .08em; }
.nav-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: .5rem .6rem 1rem; }
.nav-group { margin-bottom: .15rem; }
.nav-section { width: 100%; display: flex; align-items: center; gap: .5rem; border: 0; background: none; color: var(--sb-muted);
  font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .09em; padding: .85rem .65rem .35rem; cursor: pointer; }
.nav-section:hover { color: var(--sb-ink); }
.nav-section .chev { margin-left: auto; font-size: .7rem; transition: transform .2s var(--ease); }
.nav-group.collapsed .chev { transform: rotate(-90deg); }
.nav-group.collapsed .nav-items { display: none; }
.nav-link-item { position: relative; display: flex; align-items: center; gap: .7rem; height: 34px; padding: 0 .65rem; margin: 1px 0;
  border-radius: var(--radius); color: var(--sb-ink); text-decoration: none; font-size: .84rem; font-weight: 500; white-space: nowrap;
  transition: background .15s var(--ease), color .15s var(--ease); }
.nav-link-item i { font-size: 1rem; width: 1.15rem; text-align: center; opacity: .75; flex-shrink: 0; }
.nav-link-item span { overflow: hidden; text-overflow: ellipsis; }
.nav-link-item:hover { background: var(--sb-hover); color: var(--sb-ink-strong); }
.nav-link-item.active { background: var(--sb-active); color: var(--sb-ink-strong); font-weight: 600; }
.nav-link-item.active i { opacity: 1; color: color-mix(in srgb, var(--brand) 70%, #fff); }
.sidebar-light .nav-link-item.active i { color: var(--brand); }
.nav-link-item.active::before { content: ""; position: absolute; left: -.6rem; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.sidebar-foot { border-top: 1px solid var(--sb-line); padding: .6rem; display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.sidebar-foot .btn-rail { margin-left: auto; }
.btn-rail { border: 0; background: transparent; color: var(--sb-muted); width: 32px; height: 32px; border-radius: var(--radius); display: grid; place-items: center; }
.btn-rail:hover { background: var(--sb-hover); color: var(--sb-ink-strong); }
.sb-user { display: flex; align-items: center; gap: .55rem; min-width: 0; color: var(--sb-ink); }
.sb-user .who { min-width: 0; line-height: 1.2; }
.sb-user .who b { display: block; color: var(--sb-ink-strong); font-size: .8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user .who small { color: var(--sb-muted); font-size: .7rem; }

/* collapsed rail (desktop) */
@media (min-width: 992px) {
  .rail .sidebar { width: var(--sidebar-rail); }
  .rail .sidebar .brand-text, .rail .sidebar .nav-section, .rail .sidebar .nav-link-item span, .rail .sb-user .who { display: none; }
  .rail .sidebar .brand { justify-content: center; padding: 0; }
  .rail .sidebar .nav-scroll { padding: .5rem .55rem; }
  .rail .sidebar .nav-group { border-top: 1px solid var(--sb-line); padding-top: .3rem; margin-top: .3rem; }
  .rail .sidebar .nav-group:first-child { border-top: 0; }
  .rail .sidebar .nav-group.collapsed .nav-items { display: block; }
  .rail .sidebar .nav-link-item { justify-content: center; padding: 0; }
  .rail .sidebar .nav-link-item.active::before { left: -.55rem; }
  .rail .sidebar-foot { flex-direction: column; }
  .rail .sidebar-foot .btn-rail { margin: 0; }
  .rail .btn-rail .bi-layout-sidebar-inset { transform: scaleX(-1); }
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: var(--topbar-h); display: flex; align-items: center; gap: .75rem; padding: 0 1.5rem; position: sticky; top: 0; z-index: 1030;
  background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line); }
.crumbs { display: flex; align-items: center; gap: .4rem; font-size: .8125rem; color: var(--muted); min-width: 0; white-space: nowrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--ink); text-decoration: none; }
.crumbs .sep { color: var(--subtle); font-size: .7rem; }
.crumbs .here { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.cmdk-trigger { display: flex; align-items: center; gap: .55rem; height: 34px; min-width: 260px; padding: 0 .5rem 0 .75rem; margin-left: auto;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); color: var(--muted); font-size: .8125rem; cursor: pointer;
  transition: border-color .15s, box-shadow .15s; }
.cmdk-trigger:hover { border-color: var(--line-strong); color: var(--ink-2); }
.cmdk-trigger kbd { margin-left: auto; }
kbd, .kbd { display: inline-flex; align-items: center; gap: 2px; font-family: var(--font-sans) !important; font-size: .7rem; font-weight: 600;
  padding: .1rem .38rem; border-radius: 5px; background: var(--surface); color: var(--muted); border: 1px solid var(--line); box-shadow: 0 1px 0 var(--line); }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: var(--radius); border: 1px solid transparent;
  background: transparent; color: var(--muted); font-size: 1.05rem; transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; flex-shrink: 0; font-size: .72rem; font-weight: 700;
  color: #fff; background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 85%, #fff), color-mix(in srgb, var(--brand) 60%, #0f172a)); letter-spacing: .02em; }
.avatar-sm { width: 24px; height: 24px; font-size: .62rem; }
.avatar-lg { width: 52px; height: 52px; font-size: 1.05rem; }
.avatar-xl { width: 64px; height: 64px; font-size: 1.3rem; }
.user-btn { display: flex; align-items: center; gap: .5rem; border: 1px solid transparent; background: transparent; border-radius: 999px; padding: 2px 8px 2px 2px; color: var(--ink-2); }
.user-btn:hover { background: var(--surface-3); }
.zone-select { height: 34px; width: auto; min-width: 140px; font-size: .8125rem; }

.content { padding: 1.5rem; width: 100%; max-width: 1680px; margin: 0 auto; flex: 1; }
.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-header h1 { font-size: 1.45rem; font-weight: 700; letter-spacing: -.022em; margin: 0; line-height: 1.2; }
.page-header .page-sub { color: var(--muted); font-size: .875rem; margin-top: .2rem; }
.page-header .actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.app-footer { padding: 1rem 1.5rem 1.25rem; color: var(--subtle); font-size: .75rem; display: flex; gap: 1rem; justify-content: space-between; flex-wrap: wrap; }

/* horizontal menu (html.nav-h, desktop only; phones keep the slide-out sidebar) */
.hnav, .hnav-brand { display: none; }
.hnav-brand { align-items: center; gap: .55rem; color: var(--ink); text-decoration: none; flex-shrink: 0; font-weight: 700; letter-spacing: -.01em; }
.hnav-brand:hover { color: var(--ink); text-decoration: none; }
.hnav-brand .brand-mark { width: 30px; height: 30px; font-size: .95rem; }
.hnav-brand .brand-logo-inline { height: 36px; }
.hnav-brand .brand-logo-inline img { max-height: 36px; width: auto; }
.hnav-btn { display: inline-flex; align-items: center; gap: .4rem; height: 34px; padding: 0 .65rem; border: 1px solid transparent; border-radius: var(--radius);
  background: transparent; color: var(--ink-2); font-size: .8125rem; font-weight: 550; white-space: nowrap; text-decoration: none;
  transition: background .15s var(--ease), color .15s var(--ease); }
.hnav-btn:hover, .hnav-btn[aria-expanded="true"] { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.hnav-btn .bi { font-size: .95rem; color: var(--muted); }
.hnav-btn .chev { font-size: .65rem; margin-left: -.1rem; }
.hnav-btn.active { color: var(--brand); background: rgba(var(--brand-rgb), .08); }
.hnav-btn.active .bi { color: var(--brand); }
.hnav-switch { margin-left: auto; padding: 0; width: 34px; justify-content: center; }
.hnav-menu { min-width: 220px; padding: .35rem; max-height: calc(100vh - 140px); overflow-y: auto; }
.hnav-menu .dropdown-item { display: flex; align-items: center; gap: .55rem; border-radius: 6px; font-size: .84rem; padding: .42rem .6rem; }
.hnav-menu .dropdown-item .bi { color: var(--muted); font-size: .95rem; width: 1.1rem; text-align: center; }
.hnav-menu .dropdown-item.active, .hnav-menu .dropdown-item:active { background: rgba(var(--brand-rgb), .1); color: var(--brand); font-weight: 600; }
.hnav-menu .dropdown-item.active .bi { color: var(--brand); }
.nav-layout-switch { display: flex; align-items: center; gap: .25rem; padding: .3rem .5rem .3rem 1rem; font-size: .8rem; color: var(--muted); }
.nav-layout-switch > span { margin-right: auto; display: inline-flex; gap: .45rem; align-items: center; }
.nav-layout-switch button { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .5rem; font-size: .75rem; border-radius: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); }
.nav-layout-switch button[aria-pressed="true"] { border-color: var(--brand); background: rgba(var(--brand-rgb), .1); color: var(--brand); font-weight: 600; }
@media (min-width: 992px) {
  .nav-h .sidebar, .nav-h .sidebar-backdrop { display: none; }
  .nav-h .hnav-brand { display: inline-flex; }
  .nav-h .hnav { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem; padding: .35rem 1.5rem; position: sticky; top: var(--topbar-h); z-index: 1029;
    background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow-xs); }
}
/* below 1600px drop the section icons so the whole menu stays on one row on laptop screens */
@media (min-width: 992px) and (max-width: 1599.98px) {
  .nav-h .hnav .dropdown > .hnav-btn > .bi:first-child { display: none; }
  .nav-h .hnav-btn { padding: 0 .55rem; }
}

/* mobile */
.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .sidebar.open + .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 1035; background: rgba(2, 6, 23, .5); }
  .topbar { padding: 0 1rem; }
  .content { padding: 1rem; }
  .cmdk-trigger { min-width: 0; width: 34px; padding: 0; justify-content: center; border-color: transparent; background: transparent; }
  .cmdk-trigger .label, .cmdk-trigger kbd { display: none; }
}

/* ---------------------------------------------------------------- cards */
.card { --bs-card-border-color: var(--line); --bs-card-border-radius: var(--radius-lg); --bs-card-inner-border-radius: calc(var(--radius-lg) - 1px);
  --bs-card-cap-bg: transparent; --bs-card-bg: var(--surface); --bs-card-spacer-y: 1.1rem; --bs-card-spacer-x: 1.15rem; --bs-card-cap-padding-y: .8rem;
  box-shadow: var(--shadow-xs); }
.card-header { font-weight: 600; color: var(--ink); font-size: .9rem; border-bottom-color: var(--line); display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; min-height: 48px; }
.card-header > .bi:first-child { color: var(--muted); }
.card-header .card-header-actions, .card-header .ms-auto { margin-left: auto; }
.card-footer { background: var(--surface-2); border-top-color: var(--line); }
.card > .table-responsive:last-child > .table, .card > .table:last-child { margin-bottom: 0; }
.card > .table-responsive:last-child, .card > .table:last-child { border-bottom-left-radius: var(--bs-card-inner-border-radius); border-bottom-right-radius: var(--bs-card-inner-border-radius); }
.card > .card-header + .table-responsive > .table > thead > tr:first-child > th { border-top: 0; }
a.card, .card-hover { transition: border-color .15s, box-shadow .15s, transform .15s var(--ease); }
a.card:hover, .card-hover:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.card-title { color: var(--ink); font-weight: 600; }
.section-title { font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 .6rem; }

/* KPI / stat tiles (macros.stat) */
.stat-card .card-body { padding: 1rem 1.1rem; }
.stat-card { height: 100%; position: relative; overflow: hidden; }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.stat-label { font-size: .78rem; color: var(--muted); font-weight: 500; }
.stat-value { font-size: 1.6rem; font-weight: 700; color: var(--ink); letter-spacing: -.025em; line-height: 1.15; margin-top: .35rem; }
.stat-sub { font-size: .75rem; color: var(--muted); margin-top: .2rem; }
.stat-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 1.05rem; flex-shrink: 0; }
a:hover .stat-card { border-color: var(--line-strong); box-shadow: var(--shadow-md); }
a:hover .stat-card .stat-label { color: var(--ink-2); }

/* soft colour helpers used by tiles, pills and icons */
.tone-primary { color: var(--brand); background: rgba(var(--brand-rgb), .1); }
.tone-success { color: var(--ok); background: var(--ok-bg); }
.tone-danger { color: var(--bad); background: var(--bad-bg); }
.tone-warning { color: var(--warn); background: var(--warn-bg); }
.tone-info { color: var(--info); background: var(--info-bg); }
.tone-secondary, .tone-dark, .tone-light { color: var(--neutral); background: var(--neutral-bg); }

/* ---------------------------------------------------------------- buttons */
.btn { --bs-btn-font-weight: 550; --bs-btn-font-size: .84rem; --bs-btn-padding-y: .42rem; --bs-btn-padding-x: .85rem; --bs-btn-border-radius: var(--radius);
  --bs-btn-focus-box-shadow: var(--ring); display: inline-flex; align-items: center; justify-content: center; gap: .4rem; white-space: nowrap;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), box-shadow .15s var(--ease); }
.btn > .bi { font-size: 1em; line-height: 1; }
.btn-sm { --bs-btn-padding-y: .28rem; --bs-btn-padding-x: .6rem; --bs-btn-font-size: .8rem; --bs-btn-border-radius: var(--radius-sm); gap: .3rem; }
.btn-lg { --bs-btn-padding-y: .65rem; --bs-btn-padding-x: 1.2rem; --bs-btn-font-size: .95rem; --bs-btn-border-radius: var(--radius); }
.w-100.btn { display: flex; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-color: var(--brand-ink);
  --bs-btn-hover-bg: color-mix(in srgb, var(--brand) 88%, #000); --bs-btn-hover-border-color: color-mix(in srgb, var(--brand) 88%, #000); --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: color-mix(in srgb, var(--brand) 80%, #000); --bs-btn-active-border-color: color-mix(in srgb, var(--brand) 80%, #000);
  --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand);
  box-shadow: 0 1px 2px rgba(var(--brand-rgb), .35), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: rgba(var(--brand-rgb), .45); --bs-btn-hover-bg: rgba(var(--brand-rgb), .08);
  --bs-btn-hover-color: var(--brand); --bs-btn-hover-border-color: var(--brand); --bs-btn-active-bg: rgba(var(--brand-rgb), .14); --bs-btn-active-color: var(--brand);
  --bs-btn-active-border-color: var(--brand); --bs-btn-disabled-color: var(--brand); --bs-btn-disabled-border-color: rgba(var(--brand-rgb), .3); background: var(--surface); }
/* neutral buttons: secondary / light / outline-secondary / outline-dark all become the same calm "default" button */
.btn-outline-secondary, .btn-light, .btn-secondary, .btn-outline-dark, .btn-outline-light {
  --bs-btn-color: var(--ink-2); --bs-btn-bg: var(--surface); --bs-btn-border-color: var(--line-strong);
  --bs-btn-hover-color: var(--ink); --bs-btn-hover-bg: var(--surface-3); --bs-btn-hover-border-color: var(--line-strong);
  --bs-btn-active-color: var(--ink); --bs-btn-active-bg: var(--surface-3); --bs-btn-active-border-color: var(--subtle);
  --bs-btn-disabled-color: var(--subtle); --bs-btn-disabled-bg: var(--surface); --bs-btn-disabled-border-color: var(--line);
  box-shadow: var(--shadow-xs); }
.btn-secondary { --bs-btn-bg: var(--surface-3); }
.btn-success { --bs-btn-bg: #059669; --bs-btn-border-color: #059669; --bs-btn-hover-bg: #047857; --bs-btn-hover-border-color: #047857; --bs-btn-active-bg: #065f46; }
.btn-danger { --bs-btn-bg: #dc2626; --bs-btn-border-color: #dc2626; --bs-btn-hover-bg: #b91c1c; --bs-btn-hover-border-color: #b91c1c; --bs-btn-active-bg: #991b1b; }
.btn-warning { --bs-btn-bg: #f59e0b; --bs-btn-border-color: #f59e0b; --bs-btn-color: #1f1300; --bs-btn-hover-bg: #d97706; --bs-btn-hover-border-color: #d97706; --bs-btn-hover-color: #1f1300; }
.btn-info { --bs-btn-bg: #0284c7; --bs-btn-border-color: #0284c7; --bs-btn-color: #fff; --bs-btn-hover-bg: #0369a1; --bs-btn-hover-border-color: #0369a1; --bs-btn-hover-color: #fff; }
.btn-outline-success { --bs-btn-color: var(--ok); --bs-btn-border-color: var(--ok-line); --bs-btn-hover-bg: var(--ok-bg); --bs-btn-hover-color: var(--ok); --bs-btn-hover-border-color: var(--ok); --bs-btn-active-bg: var(--ok-bg); --bs-btn-active-color: var(--ok); background: var(--surface); }
.btn-outline-danger { --bs-btn-color: var(--bad); --bs-btn-border-color: var(--bad-line); --bs-btn-hover-bg: var(--bad-bg); --bs-btn-hover-color: var(--bad); --bs-btn-hover-border-color: var(--bad); --bs-btn-active-bg: var(--bad-bg); --bs-btn-active-color: var(--bad); background: var(--surface); }
.btn-outline-warning { --bs-btn-color: var(--warn); --bs-btn-border-color: var(--warn-line); --bs-btn-hover-bg: var(--warn-bg); --bs-btn-hover-color: var(--warn); --bs-btn-hover-border-color: var(--warn); --bs-btn-active-bg: var(--warn-bg); --bs-btn-active-color: var(--warn); background: var(--surface); }
.btn-outline-info { --bs-btn-color: var(--info); --bs-btn-border-color: var(--info-line); --bs-btn-hover-bg: var(--info-bg); --bs-btn-hover-color: var(--info); --bs-btn-hover-border-color: var(--info); --bs-btn-active-bg: var(--info-bg); --bs-btn-active-color: var(--info); background: var(--surface); }
.btn-link { --bs-btn-color: var(--brand); --bs-btn-hover-color: var(--bs-link-hover-color); text-decoration: none; }
.btn-ghost { --bs-btn-color: var(--muted); --bs-btn-hover-color: var(--ink); --bs-btn-hover-bg: var(--surface-3); --bs-btn-border-color: transparent; --bs-btn-hover-border-color: transparent; --bs-btn-active-bg: var(--surface-3); }
.btn-group > .btn { box-shadow: none; }
.btn-group { box-shadow: var(--shadow-xs); border-radius: var(--radius); }
.btn-close { --bs-btn-close-focus-shadow: var(--ring); }

/* ---------------------------------------------------------------- forms */
.form-control, .form-select { --bs-border-color: var(--line-strong); border-radius: var(--radius); font-size: .875rem; padding: .48rem .75rem;
  background-color: var(--surface); color: var(--ink); box-shadow: var(--shadow-xs); transition: border-color .15s, box-shadow .15s; }
.form-select { padding-right: 2.25rem; }
.form-control-sm, .form-select-sm { padding: .3rem .6rem; font-size: .8125rem; border-radius: var(--radius-sm); }
.form-select-sm { padding-right: 2rem; }
.form-control-lg, .form-select-lg { padding: .65rem .9rem; font-size: .95rem; }
.form-control:hover, .form-select:hover { border-color: var(--subtle); }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: var(--ring); }
.form-control::placeholder { color: var(--subtle); }
.form-control:disabled, .form-select:disabled, .form-control[readonly] { background-color: var(--surface-2); color: var(--muted); }
.form-label { font-size: .8125rem; font-weight: 550; color: var(--ink-2); margin-bottom: .35rem; }
.form-text { font-size: .76rem; color: var(--muted); margin-top: .3rem; }
.form-check-input { border-color: var(--line-strong); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-check-input:focus { border-color: var(--brand); box-shadow: var(--ring); }
.form-switch .form-check-input { width: 2.2em; height: 1.2em; margin-top: .15em; }
.form-check-label { font-size: .86rem; }
.input-group-text { background: var(--surface-2); border-color: var(--line-strong); color: var(--muted); font-size: .84rem; }
.input-group > .form-control, .input-group > .form-select { box-shadow: none; }
.input-group { box-shadow: var(--shadow-xs); border-radius: var(--radius); }
.input-group-sm { border-radius: var(--radius-sm); }
.was-validated .form-control:invalid, .form-control.is-invalid { border-color: var(--bad); }
.invalid-feedback { font-size: .76rem; }
fieldset legend { font-size: .9rem; font-weight: 650; color: var(--ink); }
.form-range::-webkit-slider-thumb { background: var(--brand); }

/* filter bar above lists */
.filter-bar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: end; }
.filter-bar .form-control, .filter-bar .form-select { width: auto; min-width: 150px; }
.filter-bar .form-label { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .2rem; }
.card > .card-body.filter-bar, .toolbar { background: var(--surface-2); }
.toolbar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; padding: .75rem 1rem; border-bottom: 1px solid var(--line); }
.search-input { position: relative; }
.search-input > .bi { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--subtle); pointer-events: none; }
.search-input > .form-control { padding-left: 2.1rem; }

/* ---------------------------------------------------------------- tables */
.table { --bs-table-bg: transparent; --bs-table-border-color: var(--line); --bs-table-hover-bg: var(--surface-2); --bs-table-striped-bg: var(--surface-2);
  --bs-table-color: var(--ink-2); --bs-table-hover-color: var(--ink); font-size: .84rem; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .7rem .9rem; vertical-align: middle; border-bottom-color: var(--line); }
.table-sm > :not(caption) > * > * { padding: .5rem .75rem; }
.table-sm { font-size: .8125rem; }
.table thead th, .table > thead > tr > th { background: var(--surface-2); color: var(--muted); font-size: .7rem; font-weight: 650; text-transform: uppercase;
  letter-spacing: .06em; white-space: nowrap; border-bottom: 1px solid var(--line); padding-top: .6rem; padding-bottom: .6rem; }
.table thead th a { color: inherit; }
.table thead th a:hover { color: var(--ink); text-decoration: none; }
.table tbody tr { transition: background-color .1s; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: var(--surface-2); }
.table tbody tr:last-child > * { border-bottom: 0; }
.table td a:not(.btn) { font-weight: 550; }
/* data tables inside .table-responsive keep one line per cell (scroll sideways instead of tall rows);
   add .td-wrap / .wrap on cells with free text */
.table-responsive > .table > tbody > tr > td, .table-responsive > .table > thead > tr > th { white-space: nowrap; }
.table-responsive > .table > tbody > tr > td.td-wrap, .table-responsive > .table > tbody > tr > td.wrap,
.table-responsive > .table > tbody > tr > td.text-wrap { white-space: normal; min-width: 220px; }
.td-truncate { max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.table .text-end, .table td.num { font-variant-numeric: tabular-nums; }
.table-light, .table > thead.table-light > tr > th { --bs-table-bg: var(--surface-2); --bs-table-color: var(--muted); }
.table-responsive { border-radius: inherit; position: relative; }  /* keeps .visually-hidden labels inside the scroll box */
.card > .table-responsive { border-top-left-radius: 0; border-top-right-radius: 0; }
.table-bordered > :not(caption) > * > * { border-color: var(--line); }
.table-active, .table > tbody > tr.table-active > * { --bs-table-bg-state: rgba(var(--brand-rgb), .06); }
.table-danger { --bs-table-bg: var(--bad-bg); --bs-table-color: var(--ink); }
.table-warning { --bs-table-bg: var(--warn-bg); --bs-table-color: var(--ink); }
.table-success { --bs-table-bg: var(--ok-bg); --bs-table-color: var(--ink); }
.table-info { --bs-table-bg: var(--info-bg); --bs-table-color: var(--ink); }
.table-secondary { --bs-table-bg: var(--neutral-bg); --bs-table-color: var(--ink); }
.table-sticky thead th { position: sticky; top: var(--topbar-h); z-index: 2; }
.cell-title { color: var(--ink); font-weight: 600; }
.cell-sub { color: var(--muted); font-size: .76rem; }
.row-actions { display: inline-flex; gap: .25rem; }

/* definition lists (profile facts) */
dl.facts { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: .55rem 1rem; margin: 0; font-size: .84rem; }
dl.facts dt { color: var(--muted); font-weight: 500; }
dl.facts dd { margin: 0; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.kv-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }

/* ---------------------------------------------------------------- badges / status pills */
.badge { --bs-badge-font-weight: 600; --bs-badge-font-size: .72rem; --bs-badge-padding-y: .3em; --bs-badge-padding-x: .6em; --bs-badge-border-radius: 6px;
  letter-spacing: .01em; display: inline-flex; align-items: center; gap: .3em; line-height: 1.1; vertical-align: middle; }
.text-bg-primary { background: rgba(var(--brand-rgb), .12) !important; color: var(--bs-primary-text-emphasis) !important; }
.text-bg-success { background: var(--ok-bg) !important; color: var(--ok) !important; }
.text-bg-danger { background: var(--bad-bg) !important; color: var(--bad) !important; }
.text-bg-warning { background: var(--warn-bg) !important; color: var(--warn) !important; }
.text-bg-info { background: var(--info-bg) !important; color: var(--info) !important; }
.text-bg-secondary, .text-bg-dark { background: var(--neutral-bg) !important; color: var(--neutral) !important; }
.text-bg-light { background: var(--surface-3) !important; color: var(--ink-2) !important; }
.badge.border { border-color: var(--line) !important; }
.pill { display: inline-flex; align-items: center; gap: .4em; padding: .28em .65em .28em .55em; border-radius: 999px; font-size: .72rem; font-weight: 600;
  line-height: 1.1; white-space: nowrap; border: 1px solid transparent; vertical-align: middle; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.pill-success { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-line); }
.pill-danger { color: var(--bad); background: var(--bad-bg); border-color: var(--bad-line); }
.pill-warning { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.pill-info { color: var(--info); background: var(--info-bg); border-color: var(--info-line); }
.pill-primary { color: var(--bs-primary-text-emphasis); background: rgba(var(--brand-rgb), .1); border-color: rgba(var(--brand-rgb), .25); }
.pill-secondary { color: var(--neutral); background: var(--neutral-bg); border-color: var(--neutral-line); }
.pill-live::before { box-shadow: 0 0 0 0 currentColor; animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 50%, transparent); } 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--subtle); flex-shrink: 0; }
.dot-primary { background: var(--brand); } .dot-success { background: #10b981; } .dot-danger { background: #ef4444; } .dot-warning { background: #f59e0b; } .dot-info { background: #0ea5e9; }

/* ---------------------------------------------------------------- tabs / pills nav */
.nav-tabs { --bs-nav-tabs-border-color: var(--line); --bs-nav-tabs-link-active-bg: transparent; --bs-nav-tabs-link-active-border-color: transparent;
  --bs-nav-tabs-border-radius: 0; gap: .25rem; border-bottom: 1px solid var(--line); flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--muted); font-weight: 550; font-size: .84rem;
  padding: .65rem .8rem; white-space: nowrap; display: inline-flex; align-items: center; gap: .4rem; }
.nav-tabs .nav-link:hover { color: var(--ink); border-bottom-color: var(--line-strong); }
.nav-tabs .nav-link.active, .nav-tabs .nav-item.show .nav-link { color: var(--ink); border-bottom-color: var(--brand); background: transparent; }
.nav-tabs .nav-link .bi { opacity: .7; }
.nav-pills { --bs-nav-pills-link-active-bg: var(--surface); --bs-nav-pills-link-active-color: var(--ink); --bs-nav-pills-border-radius: var(--radius-sm);
  background: var(--surface-3); padding: 3px; border-radius: var(--radius); display: inline-flex; flex-wrap: wrap; gap: 2px; }
.nav-pills .nav-link { color: var(--muted); font-weight: 550; font-size: .8125rem; padding: .35rem .75rem; }
.nav-pills .nav-link:hover { color: var(--ink); }
.nav-pills .nav-link.active { box-shadow: var(--shadow-sm); }
.list-group { --bs-list-group-border-color: var(--line); --bs-list-group-bg: var(--surface); --bs-list-group-action-hover-bg: var(--surface-2);
  --bs-list-group-active-bg: rgba(var(--brand-rgb), .1); --bs-list-group-active-color: var(--bs-primary-text-emphasis); --bs-list-group-active-border-color: var(--line);
  --bs-list-group-border-radius: var(--radius-lg); font-size: .86rem; }
.list-group-item { padding: .7rem 1rem; }
.list-group-flush { --bs-list-group-border-radius: 0; }

/* ---------------------------------------------------------------- dropdowns, modals, popovers */
.dropdown-menu { --bs-dropdown-border-color: var(--line); --bs-dropdown-border-radius: var(--radius-lg); --bs-dropdown-box-shadow: var(--shadow-lg);
  --bs-dropdown-link-hover-bg: var(--surface-3); --bs-dropdown-link-active-bg: rgba(var(--brand-rgb), .12); --bs-dropdown-link-active-color: var(--ink);
  --bs-dropdown-font-size: .84rem; --bs-dropdown-item-padding-y: .42rem; --bs-dropdown-item-padding-x: .75rem; --bs-dropdown-padding-x: .3rem;
  --bs-dropdown-bg: var(--surface); --bs-dropdown-link-color: var(--ink-2); box-shadow: var(--shadow-lg); padding: .3rem; }
.dropdown-item { border-radius: var(--radius-sm); display: flex; align-items: center; gap: .55rem; }
.dropdown-item .bi { color: var(--muted); width: 1rem; }
.dropdown-item.text-danger .bi { color: inherit; }
.dropdown-header { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 650; color: var(--subtle); }
.dropdown-divider { border-color: var(--line); margin: .3rem 0; }
.modal { --bs-modal-border-radius: var(--radius-xl); --bs-modal-border-color: var(--line); --bs-modal-bg: var(--surface); --bs-modal-box-shadow: var(--shadow-lg); }
.modal-header { border-bottom-color: var(--line); }
.modal-footer { border-top-color: var(--line); background: var(--surface-2); border-bottom-left-radius: var(--bs-modal-inner-border-radius); border-bottom-right-radius: var(--bs-modal-inner-border-radius); }
.modal-title { font-weight: 650; font-size: 1.05rem; }
.modal-backdrop { --bs-backdrop-bg: #020617; --bs-backdrop-opacity: .55; }
.offcanvas { --bs-offcanvas-border-color: var(--line); --bs-offcanvas-bg: var(--surface); }
.tooltip { --bs-tooltip-bg: #0f172a; --bs-tooltip-font-size: .75rem; --bs-tooltip-border-radius: 6px; }
.popover { --bs-popover-border-color: var(--line); --bs-popover-border-radius: var(--radius-lg); --bs-popover-box-shadow: var(--shadow-lg); }

/* ---------------------------------------------------------------- alerts & toasts */
.alert { --bs-alert-border-radius: var(--radius-lg); --bs-alert-padding-y: .8rem; --bs-alert-padding-x: 1rem; font-size: .86rem; border-width: 1px; display: block; }
.alert-success { --bs-alert-color: var(--ink); --bs-alert-bg: var(--ok-bg); --bs-alert-border-color: var(--ok-line); --bs-alert-link-color: var(--ok); }
.alert-danger { --bs-alert-color: var(--ink); --bs-alert-bg: var(--bad-bg); --bs-alert-border-color: var(--bad-line); --bs-alert-link-color: var(--bad); }
.alert-warning { --bs-alert-color: var(--ink); --bs-alert-bg: var(--warn-bg); --bs-alert-border-color: var(--warn-line); --bs-alert-link-color: var(--warn); }
.alert-info, .alert-primary { --bs-alert-color: var(--ink); --bs-alert-bg: var(--info-bg); --bs-alert-border-color: var(--info-line); --bs-alert-link-color: var(--info); }
.alert-secondary, .alert-light, .alert-dark { --bs-alert-color: var(--ink-2); --bs-alert-bg: var(--surface-2); --bs-alert-border-color: var(--line); }
.alert > .bi:first-child, .alert .alert-icon { font-size: 1.05rem; }
.alert-success > .bi:first-child { color: var(--ok); } .alert-danger > .bi:first-child { color: var(--bad); }
.alert-warning > .bi:first-child { color: var(--warn); } .alert-info > .bi:first-child, .alert-primary > .bi:first-child { color: var(--info); }
.alert.d-flex { display: flex !important; }
.alert-heading { color: var(--ink); font-size: .95rem; font-weight: 650; }

.toast-stack { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 1090; display: flex; flex-direction: column; gap: .6rem; width: min(420px, calc(100vw - 2rem)); pointer-events: none; }
.toast-item { pointer-events: auto; display: flex; gap: .7rem; align-items: flex-start; padding: .8rem .9rem; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); font-size: .86rem; color: var(--ink);
  animation: toast-in .25s var(--ease); position: relative; overflow: hidden; }
.toast-item::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--tone, var(--brand)); }
.toast-item .toast-icon { color: var(--tone, var(--brand)); font-size: 1.1rem; line-height: 1.3; }
.toast-item .toast-body { flex: 1; min-width: 0; padding: 0; overflow-wrap: anywhere; }
.toast-item .btn-close { font-size: .65rem; margin-top: .2rem; }
.toast-item.leaving { animation: toast-out .2s var(--ease) forwards; }
.toast-success { --tone: #10b981; } .toast-danger { --tone: #ef4444; } .toast-warning { --tone: #f59e0b; } .toast-info { --tone: #0ea5e9; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }

/* ---------------------------------------------------------------- pagination, progress, misc */
.pagination { --bs-pagination-border-color: var(--line); --bs-pagination-color: var(--ink-2); --bs-pagination-hover-bg: var(--surface-3);
  --bs-pagination-hover-color: var(--ink); --bs-pagination-hover-border-color: var(--line); --bs-pagination-active-bg: var(--brand);
  --bs-pagination-active-border-color: var(--brand); --bs-pagination-focus-box-shadow: var(--ring); --bs-pagination-bg: var(--surface);
  --bs-pagination-disabled-bg: var(--surface); --bs-pagination-border-radius: var(--radius-sm); gap: 3px; }
.pagination .page-link { border-radius: var(--radius-sm) !important; min-width: 32px; text-align: center; font-weight: 550; font-variant-numeric: tabular-nums; }
.progress { --bs-progress-bg: var(--surface-3); --bs-progress-border-radius: 999px; --bs-progress-height: .5rem; --bs-progress-bar-bg: var(--brand); }
.progress-bar.bg-success { background-color: #10b981 !important; } .progress-bar.bg-danger { background-color: #ef4444 !important; }
.progress-bar.bg-warning { background-color: #f59e0b !important; } .progress-bar.bg-info { background-color: #0ea5e9 !important; }
.bg-primary { background-color: var(--brand) !important; }
.text-primary { color: var(--brand) !important; }
[data-bs-theme="dark"] .text-primary { color: color-mix(in srgb, var(--brand) 70%, #fff) !important; }
.border-primary { border-color: var(--brand) !important; }
.bg-light, .bg-body-tertiary { background-color: var(--surface-2) !important; }
.bg-white, .bg-body { background-color: var(--surface) !important; }
.text-dark { color: var(--ink) !important; }
.border { border-color: var(--line) !important; }
.rounded { border-radius: var(--radius) !important; } .rounded-3 { border-radius: var(--radius-lg) !important; }
.shadow-sm { box-shadow: var(--shadow-sm) !important; } .shadow { box-shadow: var(--shadow-md) !important; } .shadow-lg { box-shadow: var(--shadow-lg) !important; }
.accordion { --bs-accordion-border-color: var(--line); --bs-accordion-border-radius: var(--radius-lg); --bs-accordion-inner-border-radius: calc(var(--radius-lg) - 1px);
  --bs-accordion-active-bg: var(--surface-2); --bs-accordion-active-color: var(--ink); --bs-accordion-btn-focus-box-shadow: var(--ring); --bs-accordion-bg: var(--surface); }
.accordion-button { font-weight: 600; font-size: .88rem; }
.spinner-border-sm { --bs-spinner-border-width: .15em; }

/* empty state (macros.empty) */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state .empty-icon { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto .9rem; display: grid; place-items: center; font-size: 1.5rem;
  color: var(--muted); background: var(--surface-3); border: 1px solid var(--line); }
.empty-state .empty-title { color: var(--ink); font-weight: 600; font-size: .95rem; margin-bottom: .25rem; }
.empty-state .empty-text { font-size: .84rem; max-width: 420px; margin: 0 auto; }
.empty-state .empty-actions { margin-top: 1rem; display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }

/* meters (usage bars) */
.meter { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: var(--brand); transition: width .4s var(--ease); }

/* timeline (activity / history) */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 1rem 1.6rem; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: -6px; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 0; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); }

/* charts */
.chart-box { position: relative; height: 280px; }
.chart-box-sm { position: relative; height: 200px; }
canvas { max-width: 100%; }

/* leaflet maps sit inside cards */
.leaflet-container { font-family: var(--font-sans); border-radius: inherit; }
.leaflet-container canvas { max-width: none; }  /* Leaflet canvas renderer must not be squashed by the canvas rule */
[data-bs-theme="dark"] .leaflet-tile-pane { filter: brightness(.75) invert(1) contrast(.9) hue-rotate(200deg) saturate(.4) brightness(.9); }

/* ---------------------------------------------------------------- command palette */
.cmdk { position: fixed; inset: 0; z-index: 1080; display: none; align-items: flex-start; justify-content: center; padding: 12vh 1rem 1rem;
  background: rgba(2, 6, 23, .55); backdrop-filter: blur(2px); }
.cmdk.open { display: flex; animation: fade .15s var(--ease); }
.cmdk-panel { width: min(640px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
  overflow: hidden; animation: pop .18s var(--ease); }
.cmdk-input { display: flex; align-items: center; gap: .7rem; padding: .9rem 1rem; border-bottom: 1px solid var(--line); }
.cmdk-input .bi { color: var(--muted); font-size: 1.1rem; }
.cmdk-input input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 1rem; color: var(--ink); }
.cmdk-list { max-height: min(60vh, 440px); overflow-y: auto; padding: .4rem; }
.cmdk-group { font-size: .68rem; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--subtle); padding: .6rem .7rem .3rem; }
.cmdk-item { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: var(--radius); color: var(--ink-2); cursor: pointer; font-size: .88rem; text-decoration: none; }
.cmdk-item .bi { color: var(--muted); width: 1.1rem; text-align: center; }
.cmdk-item .hint { margin-left: auto; color: var(--subtle); font-size: .75rem; }
.cmdk-item.sel, .cmdk-item:hover { background: rgba(var(--brand-rgb), .1); color: var(--ink); text-decoration: none; }
.cmdk-item.sel .bi { color: var(--brand); }
.cmdk-empty { padding: 1.5rem; text-align: center; color: var(--muted); font-size: .86rem; }
.cmdk-foot { display: flex; gap: 1rem; padding: .55rem 1rem; border-top: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: .72rem; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.985); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- auth (login / portal login / captive) */
.auth-split { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--surface); }
.auth-hero { position: relative; overflow: hidden; color: #e2e8f0; padding: 3rem 3.5rem; display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(var(--brand-rgb), .55), transparent 60%),
    radial-gradient(700px 500px at 110% 110%, rgba(var(--brand-rgb), .32), transparent 60%),
    linear-gradient(160deg, #0b1220 0%, color-mix(in srgb, var(--brand) 16%, #0b1220) 55%, #0d1117 100%); }
.auth-hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .35;
  background-image: linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(ellipse at 30% 40%, #000 30%, transparent 75%); }
.auth-hero > * { position: relative; z-index: 1; }
.auth-hero .brand-row { display: flex; align-items: center; gap: .75rem; font-weight: 700; font-size: 1.1rem; color: #fff; }
.auth-hero h2 { color: #fff; font-size: 2.1rem; line-height: 1.15; letter-spacing: -.03em; font-weight: 700; max-width: 520px; margin: 0 0 1rem; }
.auth-hero p.lead { color: #94a3b8; font-size: 1rem; max-width: 480px; }
.auth-features { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; gap: .9rem; max-width: 460px; }
.auth-features li { display: flex; gap: .8rem; align-items: flex-start; font-size: .9rem; color: #cbd5e1; }
.auth-features .fi { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1); color: #fff; }
.auth-features b { color: #fff; font-weight: 600; display: block; }
.auth-stats { display: flex; gap: 2rem; color: #94a3b8; font-size: .8rem; }
.auth-stats b { display: block; color: #fff; font-size: 1.25rem; letter-spacing: -.02em; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 2rem 1.5rem; }
.auth-form { width: 100%; max-width: 380px; }
.auth-form h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.025em; margin-bottom: .35rem; }
.auth-form .lead-sub { color: var(--muted); margin-bottom: 1.75rem; }
.auth-form .form-control { padding: .62rem .85rem; font-size: .92rem; }
.auth-form .btn-primary { padding: .65rem 1rem; font-size: .92rem; }
.auth-alt { margin-top: 1.75rem; padding-top: 1.25rem; border-top: 1px solid var(--line); font-size: .84rem; color: var(--muted); text-align: center; }
.pw-field { position: relative; }
.pw-field .form-control { padding-right: 2.6rem; }
.pw-toggle { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted);
  width: 32px; height: 32px; border-radius: 6px; display: grid; place-items: center; }
.pw-toggle:hover { color: var(--ink); background: var(--surface-3); }
@media (max-width: 991.98px) { .auth-split { grid-template-columns: 1fr; } .auth-hero { display: none; } }
/* legacy single-card auth wrapper (portal / captive) */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem;
  background: radial-gradient(800px 400px at 50% -10%, rgba(var(--brand-rgb), .18), transparent 70%), var(--bg); }
.auth-card { width: 100%; max-width: 420px; border-radius: var(--radius-xl) !important; box-shadow: var(--shadow-lg) !important; border: 1px solid var(--line) !important; }

/* ---------------------------------------------------------------- customer portal shell */
.portal-nav { position: sticky; top: 0; z-index: 1030; background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid var(--line); }
.portal-nav .bar { display: flex; align-items: center; gap: 1rem; height: 60px; }
.portal-nav .brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.portal-links { display: flex; gap: .15rem; margin-left: 1rem; }
.portal-links a { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .7rem; border-radius: var(--radius); color: var(--muted);
  font-weight: 550; font-size: .86rem; text-decoration: none; }
.portal-links a:hover { color: var(--ink); background: var(--surface-3); }
.portal-links a.active { color: var(--brand); background: rgba(var(--brand-rgb), .08); }
.portal-main { padding-top: 1.75rem; padding-bottom: 6rem; }
.portal-title { font-size: 1.5rem; font-weight: 700; letter-spacing: -.022em; margin-bottom: 1.25rem; }
.tabbar { display: none; }
@media (max-width: 991.98px) {
  .portal-links { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
    padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom)); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .3rem 0; min-height: 48px; justify-content: center;
    color: var(--muted); font-size: .68rem; font-weight: 600; text-decoration: none; border-radius: var(--radius); }
  .tabbar a .bi { font-size: 1.2rem; }
  .tabbar a.active { color: var(--brand); }
}
.hero-card { color: #fff; overflow: hidden; position: relative; border-radius: var(--radius-lg); border: 1px solid rgba(255, 255, 255, .06);
  background: color-mix(in srgb, var(--brand) 16%, #0b1220); box-shadow: var(--shadow-sm); }
.hero-card .card-body { padding: 1.5rem; }
.hero-card .text-muted, .hero-card .small { color: rgba(255,255,255,.78) !important; }
.hero-card h2, .hero-card h3, .hero-card .h2, .hero-card .h3 { color: #fff; }

/* ---------------------------------------------------------------- print */
@media print {
  .sidebar, .topbar, .no-print, .toast-stack, .cmdk, .app-footer, .tabbar, .portal-nav { display: none !important; }
  .content { padding: 0; max-width: none; }
  body.app { background: #fff; }
  .card { box-shadow: none; }
}

/* filter bars on phones: fields share the row evenly instead of ragged widths */
@media (max-width: 767.98px) {
  .filter-bar > * { flex: 1 1 150px; min-width: 0; }
  .filter-bar .form-control, .filter-bar .form-select, .filter-bar .input-group { width: 100% !important; min-width: 0; }
  .filter-bar > .btn, .filter-bar > button { flex: 0 0 auto; }
  .page-header .actions { width: 100%; }
}

/* ---------------------------------------------------------------- splash screen (partials/splash.html) */
.nx-splash { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center;
  background: radial-gradient(900px 520px at 50% 35%, rgba(var(--brand-rgb), .14), transparent 70%), var(--surface);
  transition: opacity .45s var(--ease), visibility .45s; }
.nx-splash[hidden] { display: none; }
.nx-splash.is-leaving { opacity: 0; visibility: hidden; }
.nx-splash.is-leaving .nx-splash-inner { transform: scale(1.03); }
html.nx-splashing { overflow: hidden; }
.nx-splash-inner { display: flex; flex-direction: column; align-items: center; gap: .9rem; padding: 2rem; text-align: center;
  transition: transform .45s var(--ease); animation: nx-splash-in .6s var(--ease) both; }
.nx-splash-art { position: relative; display: grid; place-items: center; min-width: 120px; min-height: 120px; }
.nx-ring { position: absolute; left: 50%; top: 50%; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%;
  border: 2px solid rgba(var(--brand-rgb), .45); opacity: 0; animation: nx-ring 2.2s cubic-bezier(.2, .6, .3, 1) infinite; }
.nx-ring:nth-child(2) { animation-delay: .55s; }
.nx-ring:nth-child(3) { animation-delay: 1.1s; }
.nx-splash-mark { position: relative; width: 84px; height: 84px; border-radius: 24px; display: grid; place-items: center; color: #fff; font-size: 2.3rem;
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 82%, #fff), color-mix(in srgb, var(--brand) 62%, #000));
  box-shadow: 0 18px 40px -12px rgba(var(--brand-rgb), .7); animation: nx-pop .7s cubic-bezier(.2, 1.4, .4, 1) both; }
.nx-splash-logo { position: relative; display: block; overflow: hidden; border-radius: 16px; background: #fff; padding: 10px 16px;
  box-shadow: 0 20px 50px -18px rgba(15, 23, 42, .35), 0 0 0 1px rgba(15, 23, 42, .05); animation: nx-pop .7s cubic-bezier(.2, 1.3, .4, 1) both; }
.nx-splash-logo img { display: block; height: clamp(72px, 14vw, 120px); width: auto; max-width: min(78vw, 420px); object-fit: contain; }
.nx-splash-logo::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .75) 50%, transparent 65%);
  transform: translateX(-120%); animation: nx-sweep 1.6s .45s ease-in-out infinite; }
/* uploaded round/square emblem: no plate, rings pulse out from behind it, slow gentle float + shine */
.nx-splash-art.has-emblem { min-width: 190px; min-height: 190px; }
.nx-splash-art.has-emblem .nx-ring { width: 170px; height: 170px; margin: -85px 0 0 -85px; border-width: 3px; }
.nx-splash-emblem { position: relative; display: block; width: clamp(130px, 34vw, 172px); aspect-ratio: 1; border-radius: 50%;
  animation: nx-pop .8s cubic-bezier(.2, 1.35, .4, 1) both, nx-float 3.2s 1s ease-in-out infinite;
  filter: drop-shadow(0 18px 30px rgba(15, 23, 42, .22)); }
.nx-splash-emblem img { width: 100%; height: 100%; object-fit: contain; display: block; }
.nx-splash-emblem::after { content: ""; position: absolute; inset: 6%; border-radius: 50%; pointer-events: none;
  background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, .55) 50%, transparent 62%);
  background-size: 250% 100%; background-position: 120% 0; animation: nx-shine 2.2s .6s ease-in-out infinite; mix-blend-mode: soft-light; }
@keyframes nx-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes nx-shine { 0% { background-position: 120% 0; } 60%, 100% { background-position: -40% 0; } }
@media (prefers-reduced-motion: reduce) { .nx-splash-emblem, .nx-splash-emblem::after { animation: none; } }
.nx-splash-name { font-size: 1.35rem; font-weight: 750; letter-spacing: -.02em; color: var(--ink); animation: nx-rise .6s .15s var(--ease) both; }
.nx-splash-sub { font-size: .72rem; font-weight: 650; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-top: -.5rem;
  animation: nx-rise .6s .22s var(--ease) both; }
.nx-splash-bar { width: 180px; height: 4px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: .4rem;
  animation: nx-rise .6s .3s var(--ease) both; }
.nx-splash-bar span { display: block; width: 40%; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 40%, #10b981)); animation: nx-indet 1.1s ease-in-out infinite; }
.nx-splash-status { font-size: .8rem; color: var(--muted); animation: nx-rise .6s .38s var(--ease) both; }
/* safety net if the script never runs to completion */
.nx-splash:not([hidden]) { animation: nx-splash-fallback .3s 4.5s forwards; }
@keyframes nx-splash-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes nx-pop { from { opacity: 0; transform: scale(.82); } to { opacity: 1; transform: none; } }
@keyframes nx-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes nx-ring { 0% { opacity: .7; transform: scale(.55); } 100% { opacity: 0; transform: scale(2.1); } }
@keyframes nx-sweep { 0% { transform: translateX(-120%); } 60%, 100% { transform: translateX(120%); } }
@keyframes nx-indet { 0% { transform: translateX(-110%); } 100% { transform: translateX(280%); } }
@keyframes nx-splash-fallback { to { opacity: 0; visibility: hidden; pointer-events: none; } }
@media (prefers-reduced-motion: reduce) { .nx-ring, .nx-splash-logo::after { display: none; } }

/* ---------------------------------------------------------------- customer app chrome (portal_base) */
.portal-greet { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; padding-left: .75rem; margin-left: .1rem;
  border-left: 1px solid var(--line); }
.portal-greet b { font-size: .95rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.portal-greet span { font-size: .78rem; color: var(--muted); }
.portal-bell { position: relative; font-size: 1.15rem; }
.portal-bell-dot { position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; font-size: .62rem;
  font-weight: 700; line-height: 16px; text-align: center; color: #fff; background: #ef4444; box-shadow: 0 0 0 2px var(--surface); }
.portal-avatar { background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 85%, #fff), color-mix(in srgb, var(--brand) 62%, #000)); }
.portal-count { margin-left: .3rem; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: #ef4444; color: #fff;
  font-size: .66rem; font-weight: 700; line-height: 18px; text-align: center; }
.tabbar .tab-ic { position: relative; display: inline-block; }
.tabbar .tab-badge { position: absolute; top: -4px; right: -10px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; font-size: .6rem;
  line-height: 16px; font-weight: 700; color: #fff; background: #ef4444; box-shadow: 0 0 0 2px var(--surface); }
@media (max-width: 991.98px) {
  .tabbar a { position: relative; }
  .tabbar a.active { color: var(--brand); font-weight: 700; }
  .tabbar a.active::before { content: ""; position: absolute; top: -.35rem; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); }
  .portal-nav .brand-logo-inline { height: 38px; }
}
@media (min-width: 992px) and (max-width: 1299.98px) { .portal-links a { padding: .45rem .5rem; font-size: .82rem; } .portal-links a .bi { display: none; } }

.portal-links a { white-space: nowrap; }

/* admin header alert bell */
.admin-bell { position: relative; }
.admin-bell-dot { position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; font-size: .62rem;
  font-weight: 700; line-height: 16px; text-align: center; color: #fff; background: var(--bad, #ef4444); box-shadow: 0 0 0 2px var(--surface); }
.admin-bell-menu { width: 320px; max-width: calc(100vw - 24px); padding: 0; }
.admin-bell-item { display: flex; align-items: flex-start; gap: .6rem; padding: .55rem .9rem; font-size: .84rem; white-space: normal; }
.admin-bell-item .sev { width: 8px; height: 8px; border-radius: 99px; margin-top: .4rem; flex-shrink: 0; background: var(--info, #0ea5e9); }
.admin-bell-item .sev-warning { background: var(--warn, #f59e0b); }
.admin-bell-item .sev-critical { background: var(--bad, #ef4444); }
