* , *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  /* Base fill plus a fixed aurora behind it — the ground is dark indigo with
     light in it, not a flat black rectangle. Fixed so the glows sit behind
     the page like ambient light rather than scrolling with the content. */
  background-color: var(--bg);
  background-image: var(--bg-aura);
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--text);
  font-family: var(--font-body);
  /* 15px, not 14: the single largest readability win in the panel, and these
     screens are read by business owners, not only by staff. */
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
}
/* Whole-app film grain: fixed so it never scrolls with content, one shared
   texture instead of every dark panel being a flat, uninterrupted color
   swatch. Above everything visually but pointer-events:none so it never
   intercepts a click. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  background-image: var(--grain);
  opacity: 0.5;
  mix-blend-mode: overlay;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; margin: 0 0 var(--sp-2); letter-spacing: -0.015em; color: var(--text); }
h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.025em; }
h2 { font-size: 19px; }
h3 { font-size: 16px; font-weight: 600; }
h4 { font-size: 14px; font-weight: 600; }
p { margin: 0 0 var(--sp-3); color: var(--text-muted); }
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* One visible focus treatment everywhere, so keyboard users never lose their
   place against the dark ground. */
:focus-visible {
  outline: 2px solid var(--primary-text);
  outline-offset: 2px;
}
/* No border-radius here on purpose. It is not outline styling — it restyles
   the element itself for as long as it is focused, and it outranks the plain
   `input, select, textarea` rule, so every classless <select> and <textarea>
   in the app used to snap from 9px to 4px on focus. The outline already
   follows each element's own radius, and a classless element with no radius
   of its own is square anyway. */

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--n-300); border-radius: var(--r-pill); border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--n-400); background-clip: content-box; }

/* ---- app shell ----
   The chrome (sidebar, topbar) sits at page background and recedes; only data
   surfaces are lifted. That keeps the brightest thing on screen the content
   the person actually came to read. */
#app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  /* Transparent, not a flat fill — lets the body aurora glow through the
     one panel that's on screen at all times instead of blocking it. */
  background: transparent;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: var(--sp-4) var(--sp-3);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 40;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-2) var(--sp-6);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.02em;
}
.sidebar__brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--grad-brand);
  background-size: 220% 220%;
  animation: brand-drift 7s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes brand-drift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.sidebar__tenant { margin: 0 var(--sp-2) var(--sp-4); }

.nav-group { display: flex; flex-direction: column; gap: 2px; margin-bottom: var(--sp-5); }
.nav-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--text-faint); padding: var(--sp-2) var(--sp-2) var(--sp-1); font-weight: 700;
}

.nav-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 9px var(--sp-3);
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav-item:hover { background: var(--n-100); color: var(--text); }

/* The signature. weblj.si's indigo→violet gradient becomes a rail that marks
   position in the panel — the brand carried by structure, not decoration. */
.nav-item.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
}
/* Declared on every item, not just the active one: a pseudo-element cannot
   transition into existence, so the rail used to pop in. At opacity 0 it is
   invisible and costs nothing. */
.nav-item::before {
  content: "";
  position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 3px; border-radius: var(--r-pill);
  background: var(--grad-brand);
  box-shadow: 0 0 10px 0 oklch(0.62 0.24 265 / 0.7);
  opacity: 0; transform: scaleY(0.3); transform-origin: center;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.nav-item.active::before { opacity: 1; transform: none; }
.nav-item.active svg { color: var(--primary-text); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
/* Reproduces the old padding-left:+3px nudge (icon carried a further +1px) on
   the compositor instead of in layout. Scoped to the direct children so
   .badge-count keeps its margin-left:auto and stays pinned right. */
.nav-item > svg, .nav-item > span { transition: transform var(--dur) var(--ease); }
.nav-item:hover > svg { transform: translateX(4px); }
.nav-item:hover > span { transform: translateX(3px); }
.nav-item .badge-count { margin-left: auto; }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--sp-6);
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 30;
  gap: var(--sp-4);
}
#topbar-title { font-family: var(--font-display); font-size: 15px; letter-spacing: -0.01em; }

.content { padding: var(--sp-6); flex: 1; max-width: 1280px; width: 100%; margin: 0 auto; }

/* Router.js builds one .route-host per navigation, so this plays on every tab
   change and softens what was a hard cut. Note there is no resting opacity:0
   and no `backwards` fill — the element's own state is fully visible, and the
   keyframe only animates *from* transparent. If the animation never runs
   (reduced motion, older engine) the content is simply already there. */
.route-host { animation: route-in var(--dur) var(--ease); }
@keyframes route-in { from { opacity: 0; transform: translateY(4px); } }

.menu-btn { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 900px) {
  #app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 82vw; max-width: 300px;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--shadow-md);
    /* Opaque again here. The transparent treatment above only works while the
       sidebar sits inline in the grid and the body aurora shows through it;
       as a drawer it floats OVER the content, and see-through nav labels on
       top of a table are unreadable. Re-painting the same colour + aura
       (fixed, so it lines up with the body's) keeps it looking identical. */
    background-color: var(--bg);
    background-image: var(--bg-aura);
    background-attachment: fixed;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; background: oklch(0.08 0.03 270 / .7); z-index: 39; }
  .sidebar-backdrop.open { display: block; }
  .menu-btn { display: inline-flex; }
  .content { padding: var(--sp-4); }
  .topbar { padding: 0 var(--sp-4); }
  h1 { font-size: 22px; }
}
