/* ============================================================
   SB Admin 2 layout over the Cisco / Meraki palette
   ============================================================ */
/* The SB Admin 2 look — the free admin theme by Start Bootstrap (MIT) — ported
   onto the Bootstrap 5.3 CSS this console already vendors, and recoloured to
   this project's brand palette.

   How it is layered. `styles.css` stays the base skin: it owns the component
   rules (cards, chips, tables, dialogs, snackbar, the two-column layout) and the
   Material-3 token names. This file is loaded after it and does two things:

     1. It retargets the tokens (`--md-*` and friends) to SB Admin 2's roles in
        the project's colours, so every existing component rule repaints without
        being touched.
     2. It overrides the geometry the template defines — sidebar, topbar, card,
        table, chip, button and control shape — and adds the shell markup the
        pages now carry (sidebar + topbar + content wrapper + footer).

   Anything not overridden here still comes from `styles.css`, which is why this
   is a skin rather than a rewrite: the 4,000-line `app.js` keeps generating the
   same class names and they all still resolve.

   Why not the template as published? SB Admin 2 ships Bootstrap 4, jQuery,
   jQuery Easing, Font Awesome, Chart.js and Google Fonts, and loads them from
   CDNs. The console runs under `default-src 'self'` (see `src/security.ts`), so
   nothing may be fetched from another origin; Bootstrap 4 is end-of-life; and
   `app.js` is vanilla JS over native `<dialog>`. So the template's *layout,
   palette roles, spacing and type scale* are reproduced here on this app's
   stack: no jQuery, no Bootstrap 4, icons as inline SVG, Nunito vendored
   locally, and no chart library (the API has no time-series endpoint to plot).

   Palette. The brand hexes are this project's published Cisco/Meraki colours
   (documented in `styles.css`): Cisco Blue `#049FD9` / `#00BCEB` for actions,
   links and the sidebar gradient, and Meraki green `#56BA32` / `#A1D73C` for
   online / live states. SB Admin 2's own blue (`#4e73df`) is deliberately NOT
   used — the template's structure in our colours was the requirement. The
   neutral scale *is* the template's (`#f8f9fc` … `#3a3b45`), because that is
   what gives SB Admin 2 its soft, low-contrast feel: a `#f8f9fc` page, white
   cards, `#e3e6f0` hairlines.

   Sizes taken from the template: sidebar `14rem` (`6.5rem` collapsed), topbar
   `4.375rem`, card radius `.35rem`, card shadow
   `0 .15rem 1.75rem 0 rgba(58,59,69,.15)`, stat-card accent `.25rem`, body
   `14px/1.5`, headings weight 400, Nunito.

   Dark mode. SB Admin 2 is light-only. Its roles are mapped onto the dark
   surfaces this app already had, so System / Light / Dark keeps working and a
   dark deployment still reads as the same theme. */

/* Nunito — vendored, not fetched from Google Fonts, so `font-src 'self'` holds.
   Two subsets only (latin, latin-ext): the console's copy is English, and a
   client name with an accent is covered by latin-ext. SIL OFL 1.1; the licence
   ships beside the files in public/vendor/nunito/OFL.txt. */
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('./vendor/nunito/nunito-latin-ext.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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('./vendor/nunito/nunito-latin.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;
}
/* Light colour mode: the template's neutrals, this project's brand. */
:root,
[data-bs-theme="light"] {
  /* Brand palette (unchanged hexes from styles.css). */
  --meraki-blue: #049fd9;
  --meraki-green: #56ba32;
  --meraki-green-bright: #a1d73c;
  --brand-blue: #049fd9;
  --brand-blue-bright: #00bceb;

  /* SB Admin 2's neutral scale, verbatim. */
  --sb-gray-100: #f8f9fc;
  --sb-gray-200: #eaecf4;
  --sb-gray-300: #dddfeb;
  --sb-gray-400: #d1d3e2;
  --sb-gray-500: #b7b9cc;
  --sb-gray-600: #858796;
  --sb-gray-700: #6e707e;
  --sb-gray-800: #5a5c69;
  --sb-gray-900: #3a3b45;
  --sb-border: #e3e6f0;
  --sb-card-bg: #ffffff;
  --sb-page-bg: var(--sb-gray-100);
  --sb-shadow: 0 .15rem 1.75rem 0 rgba(58, 59, 69, .15);
  --sb-shadow-sm: 0 .125rem .25rem 0 rgba(58, 59, 69, .2);

  /* Template geometry. */
  --sb-radius: .35rem;
  --sb-sidebar-width: 14rem;
  --sb-sidebar-collapsed: 6.5rem;
  --sb-topbar-height: 4.375rem;

  /* Shape overrides for the base skin: SB Admin 2 is a .35rem theme, not a
     Material-3 pill theme, and it sets type at 14px. */
  --radius-sm: 4px;
  --radius-md: var(--sb-radius);
  --radius-lg: var(--sb-radius);
  --radius-xl: 10rem;
  --font: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
    'Segoe UI Symbol';

  /* Actions. #049FD9 is only 3.0:1 on white, so the accessible action shade is a
     step down the same hue (5.6:1 white-on-fill) — the same reasoning
     `styles.css` documents. The bright blue is kept for dark surfaces. */
  --bs-primary: #036f99;
  --bs-primary-rgb: 3, 111, 153;
  --bs-link-color: #036f99;
  --bs-link-hover-color: #025a7d;
  --bs-focus-ring-color: rgba(4, 159, 217, .4);
  --bs-body-bg: var(--sb-page-bg);
  --bs-body-color: var(--sb-gray-800);
  --bs-secondary-bg: var(--sb-gray-200);
  --bs-tertiary-bg: var(--sb-gray-100);
  --bs-border-color: var(--sb-border);

  --md-primary: var(--bs-primary);
  --md-on-primary: #ffffff;
  --md-primary-container: #d6eff9;
  --md-on-primary-container: #003a50;
  --md-secondary-container: var(--sb-gray-200);
  --md-on-secondary-container: var(--sb-gray-800);
  --md-error: #b3261e;
  --md-on-error: #ffffff;
  --md-error-container: #ffdad6;
  --md-on-error-container: #410002;
  --md-background: var(--sb-page-bg);
  --md-on-surface: var(--sb-gray-900);
  --md-surface-variant: var(--sb-gray-200);
  --md-on-surface-variant: var(--sb-gray-600);
  --md-outline: var(--sb-gray-400);
  --md-outline-variant: var(--sb-border);
  --md-surface-container-lowest: var(--sb-card-bg);
  --md-surface-container-low: var(--sb-gray-100);
  --md-surface-container: var(--sb-gray-200);
  --md-surface-container-high: var(--sb-gray-300);
  --md-inverse-surface: var(--sb-gray-800);
  --md-inverse-on-surface: var(--sb-gray-100);
  --md-hover: rgba(3, 111, 153, .08);

  /* Status roles. Meraki dashboard semantics: green = online / no alerts,
     yellow = online with alerts, red = offline or compromised, grey = dormant. */
  --ok-bg: #e6f6d8;
  --ok-fg: #2f6b18;
  --warn-bg: #fff1cc;
  --warn-fg: #6b4a00;
  --live: #3f8e1e;
  --live-ring: rgba(86, 186, 50, .55);
  --info-bg: #d6eff9;
  --info-fg: #03556f;

  /* Elevation: the template's one soft shadow, plus a hairline-adjacent step. */
  --elev-1: var(--sb-shadow-sm);
  --elev-2: var(--sb-shadow);
  --elev-3: var(--sb-shadow);

  /* Sidebar surface: the template's 180deg gradient, in Cisco Blue. */
  --sb-sidebar-grad: linear-gradient(180deg, #049fd9 10%, #036f99 100%);
  --sb-sidebar-fg: rgba(255, 255, 255, .85);
  --sb-sidebar-fg-strong: #ffffff;
  --sb-sidebar-hover: rgba(255, 255, 255, .12);
  --sb-sidebar-divider: rgba(255, 255, 255, .18);
}
/* Dark colour mode. SB Admin 2 has none, so the template's roles are mapped onto
   the dark surfaces this app already shipped (#101a21 page, #16232c panels). */
[data-bs-theme="dark"] {
  --sb-border: #2b3a45;
  --sb-card-bg: #16232c;
  --sb-page-bg: #101a21;
  --sb-shadow: 0 .15rem 1.75rem 0 rgba(0, 0, 0, .5);
  --sb-shadow-sm: 0 .125rem .25rem 0 rgba(0, 0, 0, .5);

  --bs-primary: #00bceb;
  --bs-primary-rgb: 0, 188, 235;
  --bs-link-color: #00bceb;
  --bs-link-hover-color: #7ad9f5;
  --bs-focus-ring-color: rgba(0, 188, 235, .45);
  --bs-body-bg: var(--sb-page-bg);
  --bs-body-color: #e2eaf0;
  --bs-secondary-bg: #1b2a34;
  --bs-tertiary-bg: #16232c;
  --bs-border-color: var(--sb-border);

  --md-primary: #00bceb;
  --md-on-primary: #00232e;
  --md-primary-container: #014b60;
  --md-on-primary-container: #b8e9fa;
  --md-secondary-container: #263a48;
  --md-on-secondary-container: #cfe3ee;
  --md-error: #ffb4ab;
  --md-on-error: #690005;
  --md-error-container: #93000a;
  --md-on-error-container: #ffdad6;
  --md-surface-variant: #2b3a45;
  --md-on-surface-variant: #b6c6d1;
  --md-outline: #7d8f9b;
  --md-outline-variant: var(--sb-border);
  --md-surface-container-lowest: #0c141a;
  --md-surface-container-low: #131f27;
  --md-surface-container: #18262f;
  --md-surface-container-high: #22323c;
  --md-inverse-surface: #e2eaf0;
  --md-inverse-on-surface: #16232c;
  --md-hover: rgba(0, 188, 235, .14);

  /* #A1D73C, the bright stop of the Meraki wordmark, is the online colour. */
  --ok-bg: #1d4d17;
  --ok-fg: #a1d73c;
  --warn-bg: #4a3200;
  --warn-fg: #ffd48a;
  --live: #a1d73c;
  --live-ring: rgba(161, 215, 60, .5);
  --info-bg: #014b60;
  --info-fg: #b8e9fa;

  --elev-1: 0 1px 3px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .05);
  --elev-2: 0 2px 6px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .07);
  --elev-3: 0 6px 12px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .09);

  --sb-sidebar-grad: linear-gradient(180deg, #0b3d52 10%, #06222e 100%);
  --sb-sidebar-fg: rgba(255, 255, 255, .82);
  --sb-sidebar-hover: rgba(255, 255, 255, .1);
  --sb-sidebar-divider: rgba(255, 255, 255, .16);
}

/* ============================================================
   Base type + the template's utility classes
   ============================================================ */
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--sb-gray-800);
  background-color: var(--sb-page-bg);
}
[data-bs-theme="dark"] body { color: var(--bs-body-color); }
h1, h2, h3, h4, h5, h6 { font-weight: 400; color: var(--sb-gray-900); }
[data-bs-theme="dark"] h1,
[data-bs-theme="dark"] h2,
[data-bs-theme="dark"] h3,
[data-bs-theme="dark"] h4,
[data-bs-theme="dark"] h5,
[data-bs-theme="dark"] h6 { color: var(--bs-body-color); }
a { color: var(--bs-link-color); }

/* SB Admin 2's type helpers, kept under their template names because the theme's
   markup (and its utility classes) are what is being reproduced. */
.text-xs { font-size: .7rem; }
.text-gray-100 { color: var(--sb-gray-100) !important; }
.text-gray-200 { color: var(--sb-gray-200) !important; }
.text-gray-300 { color: var(--sb-gray-300) !important; }
.text-gray-400 { color: var(--sb-gray-400) !important; }
.text-gray-500 { color: var(--sb-gray-500) !important; }
.text-gray-600 { color: var(--sb-gray-600) !important; }
.text-gray-700 { color: var(--sb-gray-700) !important; }
.text-gray-800 { color: var(--sb-gray-800) !important; }
.text-gray-900 { color: var(--sb-gray-900) !important; }
.text-uppercase { text-transform: uppercase !important; }
/* The template's 180deg gradients, on our brand hexes for primary/success/info
   and on the neutral scale for the rest. `.bg-gradient-primary` paints the login
   page; the rest are here so a stat card can adopt the template's look. */
.bg-gradient-primary { background-color: #049fd9; background-image: linear-gradient(180deg, #049fd9 10%, #036f99 100%); background-size: cover; }
.bg-gradient-success { background-color: #56ba32; background-image: linear-gradient(180deg, #56ba32 10%, #3f8e1e 100%); background-size: cover; }
.bg-gradient-info { background-color: #049fd9; background-image: linear-gradient(180deg, #00bceb 10%, #036f99 100%); background-size: cover; }
.bg-gradient-warning { background-color: #f6c23e; background-image: linear-gradient(180deg, #f6c23e 10%, #dda20a 100%); background-size: cover; }
.bg-gradient-danger { background-color: #e74a3b; background-image: linear-gradient(180deg, #e74a3b 10%, #be2617 100%); background-size: cover; }
.bg-gradient-light { background-color: var(--sb-gray-100); background-image: linear-gradient(180deg, var(--sb-gray-100) 10%, #c2cbe5 100%); background-size: cover; }
/* Stat-card accents: `.25rem` down the left edge, exactly as the template. */
.border-left-primary { border-left: .25rem solid var(--md-primary) !important; }
.border-left-success { border-left: .25rem solid #1cc88a !important; }
.border-left-info { border-left: .25rem solid #36b9cc !important; }
.border-left-warning { border-left: .25rem solid #f6c23e !important; }
.border-left-danger { border-left: .25rem solid #e74a3b !important; }
.border-left-secondary { border-left: .25rem solid var(--sb-gray-600) !important; }
/* The template's circular icon button (`.btn-circle`). */
.btn-circle {
  border-radius: 100%;
  height: 2.5rem;
  width: 2.5rem;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-circle.btn-sm { height: 1.8rem; width: 1.8rem; font-size: .75rem; }
/* ============================================================
   Controls: buttons and form fields in the template's shape
   ============================================================ */
/* The base skin draws 40px pills; SB Admin 2 draws compact `.35rem` controls
   with `.85rem` type. Only the shape is overridden here — every variant keeps
   the colours the base skin gives it (which now come from the brand tokens). */
.btn {
  height: auto;
  min-height: 2.25rem;
  padding: .375rem .75rem;
  border-radius: var(--sb-radius);
  font-size: .85rem;
  font-weight: 400;
  letter-spacing: normal;
  gap: 6px;
}
.btn:disabled { opacity: .65; }
/* The template's "Sign in" button (`.btn-user`): full width, pill, .8rem. */
.btn-user {
  font-size: .8rem;
  border-radius: var(--radius-xl);
  padding: .75rem 1rem;
  width: 100%;
}
/* Template focus treatment: a 1px border plus a soft ring, instead of the base
   skin's 2px border (which re-pads the field and makes it jump on focus). */
.btn:focus-visible,
.field input:focus,
.field select:focus,
.field textarea:focus,
.search-bar input:focus,
.filter-field select:focus,
.filter-field input:focus,
.range-field input:focus,
.theme-control select:focus {
  outline: none;
  border-width: 1px;
  border-color: var(--md-primary);
  box-shadow: 0 0 0 .2rem var(--bs-focus-ring-color);
}

/* Form fields. `.form-control` in the template is a .85rem control with .35rem
   corners; the base skin's 16px/52px field is what makes a form look "Material",
   so it is stepped down here. */
.field { margin-bottom: 1rem; }
.field > label { font-size: .85rem; font-weight: 700; color: var(--sb-gray-800); }
[data-bs-theme="dark"] .field > label { color: var(--bs-body-color); }
.field input,
.field select,
.field textarea {
  height: 2.375rem;
  padding: 0 .75rem;
  font-size: .85rem;
  border-radius: var(--sb-radius);
}
.field textarea { height: auto; min-height: 4rem; padding: .5rem .75rem; }
.field input:focus,
.field select:focus,
.field textarea:focus { padding: 0 .75rem; }
.field textarea:focus { padding: .5rem .75rem; }
.field .helper { font-size: .75rem; color: var(--sb-gray-600); }
[data-bs-theme="dark"] .field .helper { color: var(--md-on-surface-variant); }
.hint-optional { font-weight: 400; }
/* Search inputs, filter selects and the date/time controls follow the same
   scale: the template's controls are all one size. */
.search-bar input,
.filter-field select,
.filter-field input[type="search"],
.filter-field input[type="datetime-local"],
.range-field input,
.theme-control select {
  height: 2.375rem;
  padding: 0 .75rem;
  font-size: .85rem;
  border-radius: var(--sb-radius);
}
.filter-field select:focus,
.filter-field input:focus,
.search-bar input:focus,
.range-field input:focus { padding: 0 .75rem; }
/* ============================================================
   The shell: sidebar, content wrapper, footer
   ============================================================ */
/* `#wrapper` is the template's flex row: a sidebar beside a full-width content
   wrapper. The sidebar itself is `position: fixed` rather than a flex column so
   a phone can slide it off-canvas without reflowing the page behind it. */
#wrapper { display: flex; }
#content-wrapper {
  background-color: var(--sb-page-bg);
  /* The sidebar is `position: fixed`, so it is out of flow: the wrapper must take
     the *remaining* width. `width: 100%` plus the 14rem margin would make its box
     14rem wider than the viewport (a horizontal scrollbar, and a centred column
     pushed off to the right). */
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin-left: var(--sb-sidebar-width);
  transition: margin-left .2s ease;
}
#content { flex: 1 0 auto; }

/* Sidebar: `14rem`, the template's 180deg gradient, `.85rem` links. */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1030;
  width: var(--sb-sidebar-width);
  display: flex;
  flex-direction: column;
  background: var(--sb-sidebar-grad);
  overflow-y: auto;
  overscroll-behavior: contain;
  transition: width .2s ease, transform .2s ease;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  height: var(--sb-topbar-height);
  flex: none;
  padding: 0 1rem;
  color: var(--sb-sidebar-fg-strong);
  /* Smaller than the base skin's 1rem so the official lockup and the app's own name
     fit the rail side by side (224px wide, 192px of usable width). */
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .05rem;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}
/* Brand: the official Cisco Meraki logo (see public/vendor/meraki/SOURCE.md) — the
   lockup where the rail is open, its "M" mark, on Meraki's own green, when the rail
   is collapsed to icons. Neither is a redraw: both are the published artwork. */
.sidebar-brand__logo {
  width: 96px;
  height: auto;
  flex: none;
}
.sidebar-brand__mark {
  display: none;
  width: 1.625rem;
  height: 1.625rem;
  border-radius: .35rem;
  flex: none;
  align-items: center;
  justify-content: center;
  background: #62b144; /* the green of the official artwork, not --meraki-green */
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .25);
}
.sidebar-brand__mark img { width: 1.05rem; height: auto; display: block; }
.sidebar-divider { border: 0; border-top: 1px solid var(--sb-sidebar-divider); margin: 0 1rem; }
.sidebar-heading {
  margin: 0;
  padding: .5rem 1rem;
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .05rem;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .55);
}
.sidebar-nav { list-style: none; margin: 0 0 .5rem; padding: 0; }
.sidebar .nav-item { width: 100%; }
.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
  padding: .75rem 1rem;
  color: var(--sb-sidebar-fg);
  font-size: .85rem;
  text-align: left;
  text-decoration: none;
  border: 0;
  background: transparent;
  transition: color .15s, background-color .15s;
}
.sidebar .nav-link svg { width: 1rem; height: 1rem; flex: none; fill: currentColor; }
.sidebar .nav-link:hover { color: var(--sb-sidebar-fg-strong); background-color: var(--sb-sidebar-hover); }
.sidebar .nav-link:focus-visible { outline: 2px solid rgba(255, 255, 255, .7); outline-offset: -2px; }
/* The current page. Each page marks its own link with `aria-current="page"`. */
.sidebar .nav-item.active .nav-link,
.sidebar .nav-link[aria-current="page"] {
  color: var(--sb-sidebar-fg-strong);
  font-weight: 700;
  background-color: var(--sb-sidebar-hover);
}

/* Collapsed: icons only, `6.5rem` wide. `initShell()` toggles the body class and
   remembers the choice per browser. */
body.sidebar-toggled .sidebar { width: var(--sb-sidebar-collapsed); }
body.sidebar-toggled #content-wrapper { margin-left: var(--sb-sidebar-collapsed); }
body.sidebar-toggled .sidebar .nav-link { justify-content: center; padding-left: 0; padding-right: 0; }
body.sidebar-toggled .sidebar .nav-link span,
body.sidebar-toggled .sidebar-brand__text,
body.sidebar-toggled .sidebar-brand__logo,
body.sidebar-toggled .sidebar-heading { display: none; }
body.sidebar-toggled .sidebar-brand__mark { display: flex; }
body.sidebar-toggled .sidebar-brand { justify-content: center; padding-left: 0; padding-right: 0; }

/* A phone gets the sidebar as an overlay behind a scrim, which `initShell()`
   shows on demand (the toggle lives in the topbar). */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1020;
  padding: 0;
  border: 0;
  background: rgba(58, 59, 69, .5);
}
@media (max-width: 767.98px) {
  .sidebar { transform: translateX(-100%); width: var(--sb-sidebar-width); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  #content-wrapper { margin-left: 0 !important; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar, #content-wrapper { transition: none; }
}
/* ============================================================
   Topbar
   ============================================================ */
/* The template's topbar: `4.375rem`, white, a soft shadow, sticky so the search
   and the session controls stay in reach while a long list scrolls. It is a
   *minimum* height, so a narrow window can wrap the controls onto a second row
   instead of overflowing the bar. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex: none;
  min-height: var(--sb-topbar-height);
  padding: 0 1rem;
  background-color: var(--sb-card-bg);
  box-shadow: var(--sb-shadow-sm);
}
.topbar__left,
.topbar__actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
/* A page's own actions (Import from Meraki, Change password …), grouped so they
   wrap as one unit — and so a phone can give them a row of their own. */
.topbar__page-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
/* Sidebar toggle: the template's circular button (light grey on hover). */
.topbar__toggle {
  height: 2.5rem;
  width: 2.5rem;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 100%;
  background: transparent;
  color: var(--sb-gray-600);
}
.topbar__toggle:hover { background-color: var(--sb-gray-200); color: var(--sb-gray-800); }
.topbar__toggle:focus-visible { outline: 2px solid var(--md-primary); outline-offset: 1px; }
.topbar__toggle svg { width: 1.25rem; height: 1.25rem; fill: currentColor; }
[data-bs-theme="dark"] .topbar__toggle { color: var(--md-on-surface-variant); }
[data-bs-theme="dark"] .topbar__toggle:hover { background-color: var(--md-surface-container); color: var(--bs-body-color); }
/* The template's topbar search box is deliberately NOT reproduced: each page's
   search input lives in its menu bar, where `app.js` binds it by id
   (`#key-search`, `#clients-search`). A second, decorative search box in the
   topbar would be a control that does nothing. */
/* The operator chip. `app.js` writes the name into `#session-user` (as
   `.top-app-bar__user-name`) and appends its Live/Offline indicator to
   `.top-app-bar__actions`, so both of those class names are kept on the shell. */
.top-app-bar__user {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  max-width: 15rem;
  height: 2rem;
  padding: 0 .625rem;
  border-radius: var(--radius-xl);
  background: var(--sb-gray-200);
  color: var(--sb-gray-800);
  font-size: .75rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* A green dot marks a live session; the name/title says whose. */
.top-app-bar__user::before {
  content: '';
  width: .375rem;
  height: .375rem;
  border-radius: 50%;
  background: var(--live);
  flex: none;
}
.top-app-bar__user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-bs-theme="dark"] .top-app-bar__user { background: var(--md-surface-container); color: var(--bs-body-color); }
/* Live-update indicator (WebSocket). */
.realtime-status { font-size: .75rem; color: var(--sb-gray-600); }
[data-bs-theme="dark"] .realtime-status { color: var(--md-on-surface-variant); }
/* Theme selector, in the template's control shape. */
.theme-control { font-size: .75rem; color: var(--sb-gray-600); }
[data-bs-theme="dark"] .theme-control { color: var(--md-on-surface-variant); }
.theme-control select { height: 2rem; font-size: .75rem; }
/* A hairline between the page actions and the session controls, as the template
   has between its search box and its icons. */
.topbar-divider {
  width: 0;
  height: 1.5rem;
  border-right: 1px solid var(--sb-border);
  margin: 0 .25rem;
}
/* ============================================================
   Page content: container, page header, breadcrumb, footer
   ============================================================ */
/* The template pads its container by 1.5rem. The base skin's `.content` is
   1120px centred with a 96px bottom pad (room for the floating action button);
   inside the shell the footer follows the content, so that pad drops back. */
/* The template's `.container-fluid`: the content fills the shell beside the
   sidebar. The base skin centred a 1120px column, which on a wide screen left the
   cards huddled in the middle with empty gutters on both sides.
   `width: 100%` is load-bearing: `#content` is a flex item of the column-flex
   wrapper, and `margin: 0 auto` on a flex item cancels `align-self: stretch` — so
   without an explicit width the box shrink-to-fits its content (one card per row)
   instead of filling the shell. The cap only engages on very wide displays, where
   an unbounded table is hard to scan. */
.content,
.layout { width: 100%; max-width: 1800px; margin: 0 auto; padding: 1.5rem; }
.content__header { margin-bottom: 1.5rem; }
.headline { margin: 0 0 .25rem; font-size: 1.75rem; font-weight: 400; color: var(--sb-gray-800); }
.supporting { font-size: .85rem; color: var(--sb-gray-600); }
[data-bs-theme="dark"] .headline,
[data-bs-theme="dark"] .page-header__title { color: var(--bs-body-color); }
[data-bs-theme="dark"] .supporting { color: var(--md-on-surface-variant); }
/* The template's page header: title and actions on one row, a breadcrumb above. */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.page-header__title { margin: 0; font-size: 1.75rem; font-weight: 400; color: var(--sb-gray-800); }
[data-bs-theme="dark"] .breadcrumb { color: var(--md-on-surface-variant); }
/* The template's footer: 2rem of breathing room, `.8rem` copyright. */
.sticky-footer { padding: 2rem 1.5rem; flex-shrink: 0; }
.sticky-footer .copyright { font-size: .8rem; line-height: 1; color: var(--sb-gray-600); }
[data-bs-theme="dark"] .sticky-footer .copyright { color: var(--md-on-surface-variant); }
/* The keys/clients menu bar becomes one of the template's cards, and it now
   sticks below the topbar rather than the old 80px app bar. */
.menu-bar {
  top: calc(var(--sb-topbar-height) + 1rem);
  max-height: calc(100vh - var(--sb-topbar-height) - 2rem);
  padding: 1rem;
  background: var(--sb-card-bg);
  border: 1px solid var(--sb-border);
  border-radius: var(--sb-radius);
  box-shadow: var(--sb-shadow-sm);
}
.menu-bar__title { font-size: .85rem; font-weight: 700; color: var(--sb-gray-800); }
.menu-bar__label { font-size: .65rem; font-weight: 800; color: var(--sb-gray-600); }
/* The collapse button exists only on a phone (see the responsive block): on a
   desktop the panel is always open, so the control would be noise. */
.filters-toggle { display: none; }
[data-bs-theme="dark"] .menu-bar__title { color: var(--bs-body-color); }
[data-bs-theme="dark"] .menu-bar__label { color: var(--md-on-surface-variant); }
.search-count { font-size: .75rem; }
.source-line { font-size: .75rem; color: var(--sb-gray-600); }
[data-bs-theme="dark"] .source-line { color: var(--md-on-surface-variant); }
/* ============================================================
   Cards, badges (chips) and the report's stat cards
   ============================================================ */
/* The template's card: a white surface, a `#e3e6f0` hairline, `.35rem` corners
   and one soft shadow. The base skin's Material card (borderless, 12px radius,
   elevation on hover) is overridden here. */
.card {
  --bs-card-bg: var(--sb-card-bg);
  --bs-card-border-color: var(--sb-border);
  --bs-card-border-width: 1px;
  --bs-card-border-radius: var(--sb-radius);
  background: var(--sb-card-bg);
  border: 1px solid var(--sb-border);
  border-radius: var(--sb-radius);
  box-shadow: var(--sb-shadow);
  padding: 1.25rem;
  gap: .75rem;
}
.card__title { font-size: 1rem; font-weight: 700; color: var(--sb-gray-800); }
.card__meta { font-size: .85rem; color: var(--sb-gray-600); gap: .375rem; }
.card__meta strong { font-weight: 700; color: var(--sb-gray-800); }
.card__actions { gap: .5rem; }
/* A compromised key: the template's `.border-left-danger` accent plus the alert
   body, so the state reads before the text does. */
.card__alert {
  border-left: .25rem solid #e74a3b;
  border-radius: var(--sb-radius);
  padding: .5rem .625rem;
  font-size: .8rem;
  background: var(--md-error-container);
  color: var(--md-on-error-container);
}
[data-bs-theme="dark"] .card__title,
[data-bs-theme="dark"] .card__meta strong { color: var(--bs-body-color); }
[data-bs-theme="dark"] .card__meta { color: var(--md-on-surface-variant); }
.key-grid { gap: 1.5rem; }

/* The base skin's chips are Material pills; the template's badge is a `.35rem`
   chip with 75% type and a bold weight. Every variant keeps its token colours. */
.chip {
  height: auto;
  padding: .25rem .5rem;
  border-radius: var(--sb-radius);
  font-size: .7rem;
  font-weight: 700;
}
.chip--source { height: auto; padding: .2rem .4rem; font-size: .65rem; }
/* A counter badge, as the template's topbar/sidebar counters (`.badge-counter`). */
.badge-counter {
  display: inline-block;
  padding: .25em .4em;
  font-size: 75%;
  font-weight: 700;
  line-height: 1;
  border-radius: 10rem;
}

/* Report tiles become the template's stat cards: a `.25rem` coloured edge, a
   bold value, and an uppercase coloured label above the hint. */
.report-tiles { gap: 1.5rem; }
.report-tile {
  background: var(--sb-card-bg);
  border: 1px solid var(--sb-border);
  border-left: .25rem solid var(--md-primary);
  border-radius: var(--sb-radius);
  box-shadow: var(--sb-shadow-sm);
  padding: .75rem 1rem;
}
.report-tile__value { font-size: 1.5rem; font-weight: 700; color: var(--sb-gray-800); }
.report-tile__label {
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .05rem;
  text-transform: uppercase;
  color: var(--md-primary);
}
.report-tile__hint { font-size: .7rem; color: var(--sb-gray-600); }
.report-tile--danger { border-left-color: #e74a3b; }
.report-tile--danger .report-tile__label { color: #e74a3b; }
.report-tile--warn { border-left-color: #f6c23e; }
.report-tile--warn .report-tile__label { color: #b07d00; }
[data-bs-theme="dark"] .report-tile__value { color: var(--bs-body-color); }
[data-bs-theme="dark"] .report-tile__hint { color: var(--md-on-surface-variant); }
[data-bs-theme="dark"] .report-tile--warn .report-tile__label { color: var(--warn-fg); }
/* Section headings, as the template's card headers. */
.report-section-title {
  margin: 1.5rem 0 .625rem;
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .05rem;
  text-transform: uppercase;
  color: var(--sb-gray-600);
}
[data-bs-theme="dark"] .report-section-title { color: var(--md-on-surface-variant); }
.report-exceptions li {
  background: var(--sb-card-bg);
  border: 1px solid var(--sb-border);
  border-left: .25rem solid var(--sb-gray-400);
  border-radius: var(--sb-radius);
  font-size: .85rem;
}
.report-exceptions li.report-exception--danger { border-left-color: #e74a3b; }
.report-exceptions li.report-exception--warn { border-left-color: #f6c23e; }
/* ============================================================
   Tables — the template's `.table` (`.table-striped .table-hover`)
   ============================================================ */
.table-wrap {
  background: var(--sb-card-bg);
  border: 1px solid var(--sb-border);
  border-radius: var(--sb-radius);
  box-shadow: var(--sb-shadow-sm);
  overflow-x: auto;
}
.data-table,
.report-table__grid {
  background: var(--sb-card-bg);
  border-collapse: collapse;
  font-size: .85rem;
}
/* Header: uppercase `.7rem` bold on the page grey, as the template. */
.data-table th,
.report-table__grid th {
  padding: .75rem;
  background: var(--sb-gray-100);
  color: var(--sb-gray-700);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .05rem;
  text-transform: uppercase;
  border-bottom: 1px solid var(--sb-border);
}
.data-table td,
.report-table__grid td {
  padding: .75rem;
  font-size: .85rem;
  color: var(--sb-gray-800);
  border-bottom: 1px solid var(--sb-border);
}
/* Striped rows and a hover tint, exactly as the template's table classes. */
.data-table tbody tr:nth-child(even),
.report-table__grid tbody tr:nth-child(even) { background: var(--sb-gray-100); }
.data-table tbody tr:hover,
.report-table__grid tbody tr:hover { background: var(--sb-gray-200); }
/* The last row's hairline would double up against the wrapper's border. */
.data-table tbody tr:last-child td,
.report-table__grid tbody tr:last-child td { border-bottom: 0; }
[data-bs-theme="dark"] .data-table th,
[data-bs-theme="dark"] .report-table__grid th {
  background: var(--md-surface-container);
  color: var(--md-on-surface-variant);
}
[data-bs-theme="dark"] .data-table td,
[data-bs-theme="dark"] .report-table__grid td { color: var(--bs-body-color); }
[data-bs-theme="dark"] .data-table tbody tr:nth-child(even),
[data-bs-theme="dark"] .report-table__grid tbody tr:nth-child(even) { background: var(--md-surface-container-low); }
[data-bs-theme="dark"] .data-table tbody tr:hover,
[data-bs-theme="dark"] .report-table__grid tbody tr:hover { background: var(--md-surface-container); }
.row-actions .btn { padding: .25rem .5rem; font-size: .75rem; }
.audit-when { font-size: .8rem; }
.audit-who { font-weight: 700; }
.audit-details,
.audit-ip,
.report-mac,
.report-count { font-size: .75rem; }

/* ============================================================
   Panels, dialogs, and the small pieces
   ============================================================ */
/* The template's modal: a white sheet with a `.35rem` corner and one shadow. */
dialog.dialog {
  border: 1px solid var(--sb-border);
  border-radius: var(--sb-radius);
  padding: 1.25rem;
  background: var(--sb-card-bg);
  color: var(--sb-gray-800);
  box-shadow: var(--sb-shadow);
}
[data-bs-theme="dark"] dialog.dialog { color: var(--bs-body-color); }
dialog.dialog::backdrop { background: rgba(58, 59, 69, .6); }
.dialog h2 { margin: 0 0 1rem; font-size: 1.25rem; font-weight: 700; }
.dialog__actions { gap: .5rem; }
.passphrase-box {
  background: var(--sb-gray-100);
  border: 1px solid var(--sb-border);
  border-radius: var(--sb-radius);
  font-size: .85rem;
}
[data-bs-theme="dark"] .passphrase-box { background: var(--md-surface-container); }
.panel-section {
  margin: 1rem 0 .25rem;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .05rem;
  text-transform: uppercase;
  color: var(--sb-gray-600);
}
[data-bs-theme="dark"] .panel-section { color: var(--md-on-surface-variant); }
/* Device rows in a key card's panel: `.8rem`, secondary detail beneath. */
.client-list li > span:first-child { font-size: .85rem; }
.client-detail { font-size: .75rem; }
.client-allow,
.client-unallow,
.client-block { font-size: .75rem; padding: 0 .375rem; }
.mac-list li {
  border-radius: var(--sb-radius);
  background: var(--sb-gray-200);
  color: var(--sb-gray-700);
  font-size: .75rem;
}
[data-bs-theme="dark"] .mac-list li { background: var(--md-surface-container-high); color: var(--md-on-surface-variant); }
/* Filter chips (the clients page's window selector): the template's pill, filled
   with the action colour when pressed. */
.filter-bar { gap: .5rem; margin-top: .75rem; }
.filter-chip {
  height: 2rem;
  padding: 0 .875rem;
  border: 1px solid var(--sb-border);
  border-radius: var(--radius-xl);
  background: var(--sb-card-bg);
  color: var(--sb-gray-700);
  font-size: .75rem;
  font-weight: 700;
}
.filter-chip:hover { background: var(--sb-gray-100); }
.filter-chip[aria-pressed="true"] {
  background: var(--md-primary);
  border-color: var(--md-primary);
  color: #fff;
}
.filter-toggle,
.filter-field,
.range-field,
.range-hint { font-size: .75rem; }
.filter-field { color: var(--sb-gray-600); }
.range-bar { gap: .75rem; margin-top: .75rem; }
/* Snackbar: the template's toast — `.35rem`, `.85rem`, one shadow. */
.snackbar { border-radius: var(--sb-radius); font-size: .85rem; box-shadow: var(--sb-shadow); }
/* Empty states: the template's muted grey, with the icon stepped back. */
.empty-state { color: var(--sb-gray-600); }
.empty-state .icon { opacity: .55; }
[data-bs-theme="dark"] .empty-state { color: var(--md-on-surface-variant); }
/* The floating action button, as the template's `.btn-circle btn-primary` —
   pinned bottom-right, because the keys page keeps its actions in the card. */
.fab {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 100%;
  background: var(--md-primary);
  color: #fff;
  font-size: 1.75rem;
  box-shadow: var(--sb-shadow);
}
#clients-table[aria-busy="true"] { opacity: .55; }

/* ============================================================
   Login — the template's gradient page with a centred card
   ============================================================ */
/* The template puts an Unsplash photo behind a login card; a remote image is
   blocked by `img-src 'self' data:`, so the same slot is filled with the
   sidebar's brand gradient, which keeps the page unmistakably SB Admin 2. */
.login-wrap { min-height: 100vh; padding: 1.5rem; background: var(--sb-sidebar-grad); }
.login-card {
  max-width: 26rem;
  padding: 2rem;
  border-radius: var(--sb-radius);
  background: var(--sb-card-bg);
  box-shadow: 0 1rem 3rem rgba(58, 59, 69, .35);
}
.login-card::before { background: linear-gradient(90deg, var(--meraki-green-bright), var(--meraki-green)); }
.login-card h1 { font-size: 1.5rem; font-weight: 400; }
.login-card .subtitle { font-size: .85rem; color: var(--sb-gray-600); }
/* The template's `.form-control-user`: `.8rem`, a 10rem pill, taller padding. */
.login-card .field input {
  height: 3.125rem;
  padding: 0 1rem;
  border-radius: var(--radius-xl);
  font-size: .8rem;
}
.login-card .field input:focus { padding: 0 1rem; }
.login-card .field > label { font-weight: 700; }
.login-card .btn { border-radius: var(--radius-xl); font-size: .8rem; padding: .75rem 1rem; }
.login-card .field { margin-bottom: 1rem; }
.login-divider { font-size: .75rem; }
/* The theme selector floats over the gradient, so it needs light text. */
.login-theme { position: fixed; top: 1rem; right: 1rem; color: rgba(255, 255, 255, .9); }
.login-theme select { background: rgba(255, 255, 255, .95); color: var(--sb-gray-800); border-color: transparent; }
/* ============================================================
   Print — the report on paper, not the console
   ============================================================ */
@media print {
  /* The shell, the filters and every action are screen affordances. */
  .sidebar,
  .sidebar-backdrop,
  .topbar,
  .topbar__toggle,
  .sticky-footer,
  .fab,
  .menu-bar,
  .theme-control,
  .page-actions,
  .report-actions,
  .filter-bar,
  .range-bar,
  .snackbar,
  .source-line,
  .report-placeholder,
  .report-viewing,
  .breadcrumb { display: none !important; }
  #content-wrapper { margin-left: 0 !important; }
  .content, .layout { max-width: none; padding: 0; }
  /* Ink, not surfaces: flatten the theme's cards and tables. */
  .card,
  .menu-bar,
  .report-tile,
  .report-exceptions li,
  .table-wrap,
  .data-table,
  .report-table__grid {
    box-shadow: none !important;
    background: #ffffff !important;
    border-color: #bbbbbb !important;
  }
  .data-table th,
  .report-table__grid th { background: #f2f2f2 !important; color: #333333 !important; }
  .data-table td,
  .report-table__grid td { color: #000000 !important; }
  .data-table tbody tr:hover,
  .report-table__grid tbody tr:hover { background: transparent !important; }
  .card__title,
  .headline,
  .page-header__title,
  .report-tile__value { color: #000000 !important; }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 991.98px) {
  /* The operator's name is the first thing to shorten, so the page actions keep
     their room. */
  .top-app-bar__user { max-width: 8rem; }
}
/* The sidebar costs `14rem`, so the base skin's 900px "stack the menu bar above
   the list" rule fires too late inside the shell: at 1024–1199px the key cards
   would be squeezed into a single column beside the filters. Stacking them from
   `xl` down gives the cards the full width instead. */
@media (max-width: 1199.98px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .menu-bar { position: static; max-height: none; }
  .menu-bar .search-bar { flex-direction: row; align-items: center; }
  .menu-bar .filter-bar { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .menu-bar .filter-field { flex-direction: row; align-items: center; }
  .menu-bar .filter-field select { width: auto; }
  .menu-bar .range-bar { flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
  .menu-bar .range-hint { padding-bottom: 0; }
  .menu-bar .btn { width: auto; }
}
@media (max-width: 767.98px) {
  /* The topbar wraps on a phone rather than clipping its controls: the toggle and
     the session controls share the first row, and the page's own actions take a
     second one. (`flex: 1 1 100%` on the whole actions group instead stranded the
     toggle alone on a line and pushed everything else onto a third.) */
  .topbar {
    flex-wrap: wrap;
    padding: .5rem;
    gap: .375rem;
    /* Top-aligned, so the toggle sits on the first row beside the session controls
       instead of floating halfway down a two-row bar. */
    align-items: flex-start;
  }
  .topbar__left { flex: 0 0 auto; }
  /* `flex-basis: 0` (not `auto`) is what lets this group share the first row with
     the toggle: a basis of `auto` makes its hypothetical width its max-content —
     every control on one line — which cannot fit beside the toggle, so the whole
     group wrapped and left the toggle alone on a row of its own. */
  .topbar__actions { flex: 1 1 0; min-width: 0; justify-content: flex-end; gap: .25rem; }
  .topbar__page-actions { order: 2; flex: 1 1 100%; }
  .topbar-divider { display: none; }
  /* The bare "Theme" label is the first thing to go on a phone: the select carries
     its own `aria-label`, and those five characters are the room the session row
     needs to keep the Live/Offline badge beside the operator's name. */
  .theme-control { font-size: 0; }

  /* A phone reads title → filters → list. `.layout__main` holds the header *and*
     the list, so `display: contents` lets those two be ordered around the filter
     panel instead of the filters filling the whole first screen. It is a plain
     <div>, so nothing loses semantics. */
  .layout__main { display: contents; }
  .layout__main > * { order: 3; }
  .layout .content__header { order: 1; }
  .layout .menu-bar { order: 2; }

  /* The filters become a compact two-column panel instead of a screen of stacked
     selects, and the list keeps clear of the floating action button. */
  .menu-bar .filter-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
  .menu-bar .filter-field { flex-direction: column; align-items: stretch; }
  .menu-bar .filter-field select { width: 100%; }

  /* On a phone the panel starts collapsed behind its own button, so the first
     screen is the page's list rather than its filters. `initFiltersToggle()`
     flips `menu-bar--open`; the button itself is hidden everywhere else. */
  .filters-toggle { display: inline-flex; }
  .menu-bar:not(.menu-bar--open) .menu-bar__group { display: none; }
  .menu-bar__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
  }

  .headline, .page-header__title { font-size: 1.5rem; }
  /* The 5rem of bottom padding is what keeps the last row clear of the fixed FAB. */
  .content, .layout { padding: 1rem 1rem 5rem; }
  .key-grid, .report-tiles { gap: 1rem; }
  .report-tile__value { font-size: 1.25rem; }
  /* The footer is a sibling of the content, so it needs its own clearance from the
     fixed FAB — otherwise the copyright line runs underneath it. */
  .sticky-footer { padding: 1.5rem 1rem 5rem; }
}

/* ============================================================
   Attribution
   ============================================================ */
/* The layout, palette roles, type scale, card/table/badge shapes, the 180deg
   gradients and the sidebar/topbar dimensions here are taken from SB Admin 2 —
   "Start Bootstrap - SB Admin 2", Copyright 2013-2021 Start Bootstrap LLC,
   released under the MIT licence
   (https://github.com/StartBootstrap/startbootstrap-sb-admin-2). The colours are
   this project's own; the icons are inline SVG rather than Font Awesome; the
   font is Nunito (SIL OFL 1.1, see public/vendor/nunito/OFL.txt). */










