/* ============================================================================
   app-shell.css — the skin for the authenticated application shell.

   This file was `theme-v2.css`, where every rule was prefixed `body.theme-v2`
   and the flag that added that class was never turned on in production. The
   prefix is gone: these rules now describe how the app looks, full stop.

   It is a SKIN, not a layout and not a component library. It retargets the
   chrome the shell emits — `.sidebar`, `.navbar`, `.page-header`, the body
   canvas, the building-selector modal — and owns no markup, no geometry that
   content depends on, and no functional rule. The shared CONTROLS (button,
   field, table, card, badge) are in components.css, which loads after this
   file; they were here until 2026-11-27 and having them in a skin is what
   made the skin the fourth definition of each. Modals are deliberately
   absent too — their solidity and z-index live in background-override.css
   and must apply identically under every theme.

   NO HEX LITERALS. Every colour is a token from dashboard-common.css, which
   is what makes a second theme a block of token values rather than a second
   copy of this file. The only literals are white-on-dark alphas, which read
   correctly against any sidebar colour a theme chooses.

   Load order (layouts/base.html): main.css -> legacy-page-fixes.css ->
   {% block style %} (the shell's own inline block) -> background-override ->
   THIS -> dashboard-common.css -> components.css -> {% block page_css %}.
   Dropping the `body.theme-v2` prefix cost one class of specificity, so this
   file wins over the shell's inline block by source order at equal
   specificity — which is why the legacy cosmetic rules it used to
   out-specify had to be deleted rather than left to lose.
   ========================================================================== */

/* ---- App canvas: off-white with a faint accent aura up top --------------- */
body,
body.fixed-nav,
body.sticky-footer {
  background:
    radial-gradient(1200px 520px at 78% -8%, var(--eq-aura), transparent 60%),
    linear-gradient(180deg, var(--eq-ground) 0%, var(--eq-ground-2) 100%);
  /* The shorthand above resets background-color to transparent, and
     `attachment: fixed` paints the IMAGES over the viewport only — so on a
     page taller than the window the canvas below the fold was whatever
     <html> is, which is nothing, which is white. Invisible for as long as
     the app was light; under the dark theme it is a white band down the
     left of every long page, beside the sidebar. A background-color is not
     affected by attachment and propagates to the canvas, so this fills it.
     It has to be here and not on <html>: the theme classes land on body and
     a var() on <html> would freeze at the light value. */
  background-color: var(--eq-ground-2);
  background-attachment: fixed;
  font-family: var(--eq-font);
  color: var(--eq-text);
}
.main-content { background: transparent; }
/* The page gutter, on the scale: 36px was the only 36 in the application. */
.main-content .container-fluid { padding: var(--eq-space-8); }

/* ---- Sidebar: rich navy, rounded active pill with glow ------------------- */
.sidebar {
  background: linear-gradient(185deg, var(--eq-sidebar-1) 0%, var(--eq-sidebar-2) 100%);
  border-right: 1px solid rgba(255,255,255,.05);
  box-shadow: 1px 0 0 rgba(0,0,0,.2), inset -1px 0 0 rgba(255,255,255,.03);
}
.sidebar-logo { padding: var(--eq-space-4) var(--eq-space-3); border-bottom: 1px solid rgba(255,255,255,.06); }
.sidebar-building-selector,
.sidebar-profile { border-bottom-color: rgba(255,255,255,.06); }

/* `.navbar-sidenav` is layouts/app.html's older shell, still rendered by
   /welcome/. Bootstrap's `.navbar-light` paints its links `rgba(0,0,0,.5)`,
   which on this navy is 1.14:1 in EVERY theme — a pre-existing failure the
   2026-11-28 coverage run happened to surface. Same treatment as the
   current shell. */
.navbar-sidenav .nav-item .nav-link,
.navbar-sidenav .nav-item .nav-link.dropdown-toggle {
  /* NOT a white literal. This navbar takes --eq-navbar, which is near-navy
     in dark and pure WHITE in high contrast, so a translucent white here
     fixes one theme and breaks another — it measured 1.04:1 under high
     contrast, worse than the 1.14:1 it replaced. --eq-text tracks the
     surface in all three. */
  color: var(--eq-text);
}
.navbar-sidenav .nav-item .nav-link:hover,
.navbar-sidenav .nav-item .nav-link:focus { color: var(--eq-ink); }

.sidebar-nav .nav-item .nav-link {
  color: rgba(255,255,255,.66);
  border-radius: var(--eq-radius-control);
  /* 2px vertical, below the scale on purpose: these sit in a list of fourteen,
     and a 4px gap between each adds 28px to a sidebar that already overflows at
     768px tall.

     HORIZONTAL IS DELIBERATELY *NOT* ON THE SCALE. The sidebar is a fixed
     220px, so every px of inset is a px taken from the label. At
     `--eq-space-3` (12px) the budget is 220 - 24 margin - 24 padding - 30
     icon+gap = 142px, while "Create New Visitor" needs ~137px and "Bulk
     Check-in" plus its Upgrade chip needs ~157px. The 2026-11-28 scale sweep
     moved this from a 10px literal to the 12px token and called it a pure
     conversion; 10 and 12 are not the same number, and the extra 2px per side
     clipped three labels in production. A fixed-width container is a size,
     not a rhythm.

     8px restores a 150px budget. The flex rules below are the real guarantee:
     the label shrinks and ellipsises, so a longer nav item in a future
     language or a renamed route degrades to "Create New Vis..." instead of
     silently running under the sidebar edge. */
  margin: 2px var(--eq-space-2);
  padding: var(--eq-space-2) var(--eq-space-3);
  display: flex;
  align-items: center;
  min-width: 0;
  font-size: var(--eq-text-base);
  font-weight: var(--eq-weight-medium);
  border-left: 0;
  /* The pill fills and the glyph brightens together; nothing moves, because
     a nav item that slides under the pointer is a nav item people misclick.
     `padding-left` is still animated out of the hover rule below for the
     same reason it was there: it used to shift. */
  transition: background-color var(--eq-dur-1) var(--eq-ease),
              color var(--eq-dur-1) var(--eq-ease),
              box-shadow var(--eq-dur-2) var(--eq-ease);
}
/* The label takes the slack and truncates; the icon and the trailing Upgrade
   chip on gated items keep their size. Without `min-width: 0` a flex child
   refuses to shrink below its content and the ellipsis never fires -- it just
   overflows, which is exactly the bug this replaced. */
.sidebar-nav .nav-item .nav-link > i,
.sidebar-nav .nav-item .nav-link > .badge { flex: 0 0 auto; }
/* The gated-feature padlock: dimmer than the item's own glyph, because it
   qualifies the label rather than naming it. */
.sidebar-nav .nav-item .nav-link > .nav-lock {
  margin-left: auto;
  padding-left: var(--eq-space-2);
  font-size: var(--eq-text-xs);
  opacity: .55;
}
.sidebar-nav .nav-item .nav-link:hover > .nav-lock { opacity: .9; }
.sidebar-nav .nav-item .nav-link > .nav-link-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-nav .nav-item .nav-link:hover {
  color:#fff; background: rgba(255,255,255,.06); padding-left: var(--eq-space-3);
}
.sidebar-nav .nav-item .nav-link.active {
  color:#fff;
  background: linear-gradient(100deg, var(--eq-accent-vivid), var(--eq-accent-strong));
  border-left: 0;
  box-shadow: 0 8px 20px -8px var(--eq-accent-shadow), inset 0 1px 0 rgba(255,255,255,.18);
}
.sidebar-nav .nav-item .nav-link i { color: rgba(255,255,255,.42); }
.sidebar-nav .nav-item .nav-link:hover i { color:#fff; }
.sidebar-nav .nav-item .nav-link.active i { color:#fff; }
.sidebar-nav hr { border-color: rgba(255,255,255,.07); }

.building-selector-btn {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--eq-radius-sm);
  transition: background-color var(--eq-dur-1) var(--eq-ease),
              border-color var(--eq-dur-1) var(--eq-ease);
}
.building-selector-btn:hover { background: var(--eq-accent-tint); border-color: var(--eq-accent-edge); }
.building-selector-btn i:first-child { color: var(--eq-emerald); }

/* ---- Page header --------------------------------------------------------- */
.page-header h1,
.page-header h2 { color: var(--eq-ink); font-weight: var(--eq-weight-bold);
  letter-spacing: var(--eq-tracking-tight); line-height: var(--eq-leading-snug); }
.page-header p  { color: var(--eq-muted); font-size: var(--eq-text-sm); }

/* ---- Buttons, cards, tables, badges and form controls are NOT here ---------
   They were, until 2026-11-27: this file carried a `.btn`, `.btn-primary`,
   `.card`, `.card-header`, `.table`, `.badge` and `.form-control` of its own,
   which made it the fourth place in the head defining each of them after
   Bootstrap, main.css and the shell's inline block — and it declared only
   SOME of their properties, so the shell's hardcoded `#007bff`, UPPERCASE
   tracking and 15.2px fields survived underneath whatever this file said.

   They all live in components.css now, which loads after dashboard-common.css
   and therefore after this file. A skin and a component layer are different
   jobs: this file retargets the chrome the shell emits (sidebar, navbar,
   canvas, page header) and owns no control. */

/* ---- Links & accents ------------------------------------------------------
   Links use --eq-accent-ink, not --eq-accent: the accent is a FILL colour and
   a tenant may legitimately pick a pale one. The ink variant is the same hue
   darkened until it clears 4.5:1 as text on the surface (lib/theme.py). */
a { color: var(--eq-accent-ink); }
a:hover { color: var(--eq-accent-2); }
.text-primary { color: var(--eq-accent-ink) !important; }

/* ---- Top navbar ---------------------------------------------------------- */
.navbar {
  background-color: var(--eq-navbar);
  backdrop-filter: saturate(150%) blur(8px);
  -webkit-backdrop-filter: saturate(150%) blur(8px);
  border-bottom: 1px solid var(--eq-line);
  box-shadow: var(--eq-shadow-xs);
}

/* ---- Building-selector modal + profile badge (these live in the
   eduqueue.html shell's own inline <style>, which renders earlier). ------- */
.nav-profile-image::after { background: var(--eq-accent); }
/* --eq-accent -> --eq-accent-deep, not --eq-accent-2 -> --eq-accent. These
   three carry white text (`.btn-building-submit` is "Continue to Dashboard",
   the only control on the building picker), and --eq-on-accent is only
   computed against --eq-accent: white on the lighter --eq-accent-2 measures
   3.68:1 and fails AA. Same change as .btn-primary in components.css. */
.building-icon-bg,
.building-card input[type="radio"]:checked + .building-card-content,
.btn-building-submit { background: linear-gradient(135deg, var(--eq-accent) 0%, var(--eq-accent-deep) 100%); }
.building-icon-particles span { background: var(--eq-accent-2); }
.building-card-icon i,
.current-location-note i { color: var(--eq-accent-ink); }

/* ---- Page-specific inline-style overrides -------------------------------- *
   Two scan buttons carry their gradient in an inline style attribute, which
   no selector can beat without !important. Both ids are page-unique. */
#eq-fast-scan-btn {
  background: linear-gradient(135deg, var(--eq-accent) 0%, var(--eq-accent-deep) 100%) !important;
  color: var(--eq-on-accent) !important;
}
#scan-id-btn {
  background: linear-gradient(135deg, var(--eq-accent) 0%, var(--eq-accent-deep) 100%) !important;
  color: var(--eq-on-accent) !important;
}

/* The icon has to follow the fill these two rules impose, or it disappears.
   `vm-desk.css` paints `.vm-deskbtn i` in `--eq-accent-ink`, which is the
   same value as `--eq-accent` — the gradient's own start colour. On the stock
   light palette that is a measured 1.00:1: the magnifier on "Scan a licence",
   the primary action of the busiest screen in the product, was not there at
   all. Inheriting gives 6.70:1 against the gradient start and 7.69:1 against
   its end. It belongs here rather than in vm-desk.css because the rule above
   is what causes it, and because that sheet cannot reach an id anyway. */
#eq-fast-scan-btn i,
#scan-id-btn i { color: inherit !important; }

/* ---- Motion ----------------------------------------------------------------
   The shell animates two things and both are colour. Switched off together
   here, so a reader looking for "what moves in the chrome" finds one block. */
@media (prefers-reduced-motion: reduce) {
  .sidebar-nav .nav-item .nav-link,
  .building-selector-btn { transition: none; }
}
