/* =============================================================================
   sidenav.css — Targeted modern overrides on top of the LEGACY sidenav.

   The full sidebar implementation lives in style.css + theme.css.  This file
   loads last and applies surgical refinements ONLY to the pieces the user
   wanted modernised:

     1. Brand row     — flat solid mark, cleaner type, no subtitle
     2. Provider mode — Apple-style segmented control (no neon, no shadow)
     3. Footer utility row — compact 30 px shared surface
     4. Admin Panel  — clean card, no glow, no accent bar
     5. Theme toggle — only ONE icon visible at a time (sun OR moon)

   Specificity strategy
     Every rule is prefixed with `#sidenav` (1 ID) so it wins against the
     legacy `body .sidenav-…` (0,1,1) and `body.provider-…` (0,2,1) rules
     without needing !important.  Where the legacy uses !important we
     match it; sidenav.css loads after theme.css so equal specificity +
     !important resolves in our favour by source order.
   ========================================================================== */

/* ───────────────────────────────────────────────────────────────────────
   1. Brand row — flat solid mark, no glow, no subtitle
   ─────────────────────────────────────────────────────────────────────── */

#sidenav .sidenav-brand-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 12px 10px;
  border-bottom: 0;
  margin-bottom: 0;
  flex-shrink: 0;
  min-width: 0;
}

#sidenav .sidenav-brand {
  flex: 1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  padding: 4px 6px;
  border-radius: 8px;
  min-width: 0;
  transition: background 130ms cubic-bezier(0.4, 0, 0.2, 1);
}
#sidenav .sidenav-brand:hover {
  background: var(--th-ghost, rgba(255, 255, 255, 0.04));
}

/* Brand mark — modern monochrome chip with accent-tinted glyph.
   Linear / Vercel-style: subtle dark surface with the provider glyph in
   its accent colour.  No gradient, no border halo, no glow.

   Every property carries !important because style.css contains a legacy
   .sidenav-brand-mark rule (line ~6407) that paints a gradient bg, a
   tinted border AND `box-shadow: ... 0 4px 12px var(--primary-glow)`
   with !important on each declaration — without matching !important
   here our rules silently lose. */
#sidenav .sidenav-brand-mark {
  width: 28px !important;
  height: 28px !important;
  border-radius: 7px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: var(--th-surface-2, rgba(255, 255, 255, 0.04)) !important;
  background-image: none !important;
  color: var(--th-accent, #25d366) !important;
  border: 1px solid var(--th-border, rgba(255, 255, 255, 0.08)) !important;
  box-shadow: none !important;
  flex-shrink: 0;
  transition: background 130ms cubic-bezier(0.4, 0, 0.2, 1),
              border-color 130ms cubic-bezier(0.4, 0, 0.2, 1);
}
#sidenav .sidenav-brand:hover .sidenav-brand-mark {
  background: var(--th-ghost, rgba(255, 255, 255, 0.06)) !important;
  border-color: var(--th-border-strong, rgba(255, 255, 255, 0.14)) !important;
}
#sidenav .sidenav-brand-mark svg {
  display: block;
  width: 16px;
  height: 16px;
  color: inherit;
  fill: currentColor;
  filter: none !important;
}

/* Provider-tinted glyph (active provider colour, no neon) */
body.provider-telegram  #sidenav .sidenav-brand-mark { color: #5aaaf2 !important; }
body.provider-whatsapp  #sidenav .sidenav-brand-mark { color: #2ee479 !important; }

#sidenav .sidenav-brand-text {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}
#sidenav .sidenav-brand-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: var(--th-text-strong, #f5f5f5);
  text-overflow: ellipsis;
  overflow: hidden;
}
/* Subtitle is removed from the template; hide if anyone re-adds it. */
#sidenav .sidenav-brand-sub { display: none; }

/* Collapse button — neutral, slightly smaller */
#sidenav .sidenav-collapse-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: transparent;
  border: 0;
  color: var(--th-muted, #94a3b8);
}
#sidenav .sidenav-collapse-btn:hover {
  background: var(--th-ghost, rgba(255, 255, 255, 0.04));
  color: var(--th-text, #e5e7eb);
  border-color: transparent;
}
#sidenav .sidenav-collapse-btn svg { width: 14px; height: 14px; }

html.sidenav-is-collapsed #sidenav .sidenav-brand-text { display: none; }

/* ───────────────────────────────────────────────────────────────────────
   2. Provider switcher — Apple/Vercel-style segmented control
      Two text pills inside a soft 32 px track.  Active pill has a clean
      surface background (no shadow, no border), active text gets the
      provider accent colour.  No underline, no glow.
   ─────────────────────────────────────────────────────────────────────── */

#sidenav .sidenav-mode {
  /* Force flex layout — legacy uses display: grid + grid-template-columns
     in collapsed mode which leaves us with two tiny, side-by-side pills
     that look invisible at the 68px collapsed width. */
  display: flex !important;
  flex-direction: row !important;
  align-items: stretch !important;
  margin: 0 12px 12px !important;
  padding: 3px !important;
  gap: 0 !important;
  background: var(--th-surface-2, rgba(255, 255, 255, 0.03)) !important;
  border: 1px solid var(--th-border, rgba(255, 255, 255, 0.08)) !important;
  border-radius: 8px !important;
  height: 32px !important;
  flex-shrink: 0;
  grid-template-columns: none !important;
}

#sidenav .sidenav-mode-pill {
  flex: 1 1 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px;
  height: 100% !important;
  padding: 0 4px !important;
  border-radius: 5px !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: var(--th-muted, #9ca3af) !important;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  min-width: 0;
  position: relative;
  transition: color      130ms cubic-bezier(0.4, 0, 0.2, 1),
              background 130ms cubic-bezier(0.4, 0, 0.2, 1);
}

#sidenav .sidenav-mode-pill svg {
  width: 11px;
  height: 11px;
  display: block;
  flex-shrink: 0;
  opacity: 0.85;
}

#sidenav .sidenav-mode-pill:hover:not(.is-active) {
  color: var(--th-text, #e5e7eb) !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* Active pill: clean surface fill, NO inset ring, NO neon shadow.
   The legacy at style.css:6425 sets
     box-shadow: 0 1px 3px rgba(0,0,0,0.18), inset 0 0 0 1px var(--border) !important
   which paints the unwanted 1-px inner ring around the active pill.
   Match the !important to win. */
#sidenav .sidenav-mode-pill.is-active,
body.provider-whatsapp #sidenav .sidenav-mode-pill.is-active,
body.provider-telegram #sidenav .sidenav-mode-pill.is-active {
  color: var(--th-text-strong, #f5f5f5) !important;
  background: var(--th-surface, rgba(255, 255, 255, 0.08)) !important;
  border: 0 !important;
  box-shadow: none !important;
}
#sidenav .sidenav-mode-pill.is-active::after { content: none; display: none; }
#sidenav .sidenav-mode-pill.is-active svg { opacity: 1; }

body.provider-whatsapp #sidenav .sidenav-mode-pill.is-active svg { color: #2ee479; }
body.provider-telegram  #sidenav .sidenav-mode-pill.is-active svg { color: #5aaaf2; }

/* ─── Collapsed sidebar (68 px) — keep the switcher visible ─────────
   Two icon tiles stacked vertically.  Pills become 32px-tall icon-only
   surfaces; the SVG is bumped to 14px so it's actually readable.
   The text label inside <span> is hidden by the legacy collapsed rules. */
html.sidenav-is-collapsed #sidenav .sidenav-mode {
  display: flex !important;
  flex-direction: column !important;
  height: auto !important;
  margin: 0 10px 12px !important;
  padding: 3px !important;
  gap: 3px !important;
  background: var(--th-surface-2, rgba(255, 255, 255, 0.03)) !important;
  border: 1px solid var(--th-border, rgba(255, 255, 255, 0.08)) !important;
  border-radius: 8px !important;
  grid-template-columns: none !important;
}
html.sidenav-is-collapsed #sidenav .sidenav-mode-pill {
  flex: 0 0 auto !important;
  height: 32px !important;
  width: 100% !important;
  padding: 0 !important;
  gap: 0 !important;
  border-radius: 5px !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}
html.sidenav-is-collapsed #sidenav .sidenav-mode-pill svg {
  width: 14px !important;
  height: 14px !important;
  opacity: 0.65;
}
html.sidenav-is-collapsed #sidenav .sidenav-mode-pill.is-active {
  background: var(--th-surface, rgba(255, 255, 255, 0.08)) !important;
}
html.sidenav-is-collapsed #sidenav .sidenav-mode-pill.is-active svg { opacity: 1; }
html.sidenav-is-collapsed #sidenav .sidenav-mode-pill:hover:not(.is-active) svg { opacity: 0.9; }

/* ───────────────────────────────────────────────────────────────────────
   3. Footer utility row — compact 30 px shared surface
   Beats the legacy `#sidenav .sidenav-utility-row !important` block by
   matching its specificity AND being later in source order.
   ─────────────────────────────────────────────────────────────────────── */

#sidenav .sidenav-utility-row {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap;
  align-items: stretch !important;
  align-content: stretch;
  justify-content: flex-start;
  width: 100%;
  min-width: 0;
  height: 30px !important;
  min-height: 30px !important;
  max-height: 30px !important;
  background: var(--th-surface-2, rgba(255, 255, 255, 0.03)) !important;
  border: 1px solid var(--th-border, rgba(255, 255, 255, 0.08)) !important;
  border-radius: 8px !important;
  padding: 2px !important;
  gap: 2px !important;
  margin: 0;
  box-sizing: border-box !important;
}

#sidenav .sidenav-utility-row > .sidenav-ut-slot {
  flex: 1 1 auto;
  min-width: 0;
  height: 100% !important;
  min-height: 100% !important;
  max-height: 100% !important;
  display: flex !important;
  align-items: stretch;
  position: relative;
  margin: 0;
  padding: 0;
  overflow: visible;
  box-sizing: border-box;
}

#sidenav .sidenav-utility-row > .sidenav-ut-slot > .sidenav-tz {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  height: 100%;
  display: block;
  position: relative;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

#sidenav .sidenav-utility-row > .sidenav-ut-slot .sidenav-utility-btn {
  display: flex !important;
  align-items: center;
  gap: 6px;
  width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
  max-height: 100% !important;
  padding: 0 8px !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 4px !important;
  color: var(--th-muted, #94a3b8);
  font-size: 11px;
  font-weight: 500;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  letter-spacing: 0;
  box-sizing: border-box !important;
  margin: 0;
  transition: background 130ms cubic-bezier(0.4, 0, 0.2, 1),
              color    130ms cubic-bezier(0.4, 0, 0.2, 1);
}

#sidenav .sidenav-utility-row > .sidenav-ut-slot .sidenav-utility-btn:hover,
#sidenav .sidenav-utility-row > .sidenav-ut-slot .sidenav-utility-btn[aria-expanded="true"] {
  background: var(--th-ghost, rgba(255, 255, 255, 0.04)) !important;
  color: var(--th-text-strong, #f5f5f5);
  border: 0 !important;
}

#sidenav .sidenav-utility-row > .sidenav-ut-slot .sidenav-utility-btn > svg {
  width: 12px !important;
  height: 12px !important;
  flex-shrink: 0;
  opacity: 0.7;
  display: block;
}

#sidenav .sidenav-utility-row .sidenav-utility-btn-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

#sidenav .sidenav-utility-row .sidenav-utility-caret {
  width: 8px;
  height: 8px;
  opacity: 0.5;
  flex-shrink: 0;
  transition: transform 130ms cubic-bezier(0.4, 0, 0.2, 1);
}
#sidenav [data-pop].is-open .sidenav-utility-caret { transform: rotate(180deg); }

/* Theme toggle + logout: 26 px square cells, no individual border.
   IMPORTANT: do NOT force display on the inner SVGs here — the theme
   toggle relies on .sun-ic/.moon-ic being hidden/shown by data-theme. */
#sidenav .sidenav-utility-row > .sidenav-utility-icon,
#sidenav .sidenav-utility-row > button.sidenav-utility-icon,
#sidenav .sidenav-utility-row > a.sidenav-utility-icon,
#sidenav .sidenav-utility-row > button#sidenav-theme {
  display: flex !important;
  align-items: center;
  justify-content: center;
  flex: 0 0 26px !important;
  width: 26px !important;
  min-width: 26px !important;
  max-width: 26px !important;
  height: 100% !important;
  min-height: 100% !important;
  max-height: 100% !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 4px !important;
  color: var(--th-muted, #94a3b8);
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  margin: 0 !important;
  padding: 0 !important;
  align-self: stretch;
  position: relative;
  box-sizing: border-box !important;
  transition: background 130ms cubic-bezier(0.4, 0, 0.2, 1),
              color    130ms cubic-bezier(0.4, 0, 0.2, 1);
}

#sidenav .sidenav-utility-row > .sidenav-utility-icon:hover,
#sidenav .sidenav-utility-row > button.sidenav-utility-icon:hover,
#sidenav .sidenav-utility-row > a.sidenav-utility-icon:hover,
#sidenav .sidenav-utility-row > button#sidenav-theme:hover {
  background: var(--th-ghost, rgba(255, 255, 255, 0.04)) !important;
  color: var(--th-text-strong, #f5f5f5) !important;
  border: 0 !important;
}

#sidenav .sidenav-utility-row > .sidenav-utility-icon:active,
#sidenav .sidenav-utility-row > button.sidenav-utility-icon:active,
#sidenav .sidenav-utility-row > a.sidenav-utility-icon:active {
  transform: none;
}

/* Size the SVGs for the LOGOUT and other non-theme icon buttons.
   The theme button's sun/moon SVGs have their own visibility control
   below — do not force display: block here. */
#sidenav .sidenav-utility-row > .sidenav-utility-icon:not(.sidenav-theme-btn) > svg,
#sidenav .sidenav-utility-row > button.sidenav-utility-icon:not(.sidenav-theme-btn) > svg,
#sidenav .sidenav-utility-row > a.sidenav-utility-icon:not(.sidenav-theme-btn) > svg {
  display: block;
  width: 13px !important;
  height: 13px !important;
  margin: 0;
}

/* "On" state for theme toggle if used (tested via aria-pressed) */
#sidenav .sidenav-utility-icon.is-on {
  color: var(--th-accent-hi, var(--th-accent, #25d366)) !important;
  background: var(--th-accent-dim, rgba(37, 211, 102, 0.10)) !important;
  border: 0 !important;
  box-shadow: none !important;
}

/* ─── Theme button: only ONE icon visible at a time (sun OR moon) ─── */

/* Hide both by default so nothing leaks if data-theme isn't set yet */
#sidenav .sidenav-theme-btn .sun-ic,
#sidenav .sidenav-theme-btn .moon-ic {
  display: none !important;
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

/* Dark theme → moon */
html[data-theme="dark"] #sidenav .sidenav-theme-btn .moon-ic,
html:not([data-theme="light"]) #sidenav .sidenav-theme-btn .moon-ic {
  display: block !important;
}

/* Light theme → sun */
html[data-theme="light"] #sidenav .sidenav-theme-btn .sun-ic {
  display: block !important;
}

/* Collapsed mode: revert to a stacked column of bordered icon cells */
html.sidenav-is-collapsed #sidenav .sidenav-utility-row {
  flex-direction: column !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
  gap: 6px !important;
}

html.sidenav-is-collapsed #sidenav .sidenav-utility-row > .sidenav-ut-slot {
  width: 100%;
  max-width: 100%;
  justify-content: center;
  height: 32px !important;
  min-height: 32px !important;
  max-height: 32px !important;
}

html.sidenav-is-collapsed #sidenav .sidenav-utility-row > .sidenav-ut-slot .sidenav-utility-btn {
  background: var(--th-surface-2, rgba(255, 255, 255, 0.03)) !important;
  border: 1px solid var(--th-border, rgba(255, 255, 255, 0.08)) !important;
  border-radius: 8px !important;
  padding: 0 !important;
  justify-content: center;
}

html.sidenav-is-collapsed #sidenav .sidenav-utility-row > .sidenav-utility-icon,
html.sidenav-is-collapsed #sidenav .sidenav-utility-row > button.sidenav-utility-icon,
html.sidenav-is-collapsed #sidenav .sidenav-utility-row > a.sidenav-utility-icon,
html.sidenav-is-collapsed #sidenav .sidenav-utility-row > button#sidenav-theme {
  flex: 0 0 32px !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  height: 32px !important;
  min-height: 32px !important;
  max-height: 32px !important;
  background: var(--th-surface-2, rgba(255, 255, 255, 0.03)) !important;
  border: 1px solid var(--th-border, rgba(255, 255, 255, 0.08)) !important;
  border-radius: 8px !important;
}

/* ───────────────────────────────────────────────────────────────────────
   4. Admin Panel button — clean card, no glow, no accent left bar
   ─────────────────────────────────────────────────────────────────────── */

#sidenav .sidenav-admin-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--th-surface-2, rgba(255, 255, 255, 0.03));
  border: 1px solid var(--th-border, rgba(255, 255, 255, 0.08));
  color: var(--th-text-strong, #f5f5f5);
  text-decoration: none;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  min-width: 0;
  box-shadow: none;
  transition: background    130ms cubic-bezier(0.4, 0, 0.2, 1),
              border-color  130ms cubic-bezier(0.4, 0, 0.2, 1);
}

#sidenav .sidenav-admin-btn:hover {
  background: var(--th-ghost, rgba(255, 255, 255, 0.05));
  border-color: var(--th-border-strong, rgba(255, 255, 255, 0.12));
  box-shadow: none;
}

/* Kill the legacy ::before accent left bar with a glow */
#sidenav .sidenav-admin-btn::before {
  content: none !important;
  display: none !important;
}

#sidenav .sidenav-admin-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: var(--th-accent-dim, rgba(37, 211, 102, 0.12));
  color: var(--th-accent-hi, var(--th-accent, #25d366));
  border: 0;
  box-shadow: none;
}
#sidenav .sidenav-admin-icon svg {
  display: block;
  width: 11px;
  height: 11px;
}

#sidenav .sidenav-admin-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: inherit;
}

#sidenav .sidenav-admin-arrow {
  flex-shrink: 0;
  width: 11px;
  height: 11px;
  color: var(--th-dim, var(--th-muted, #6b7280));
  opacity: 1;
  transition: color     130ms cubic-bezier(0.4, 0, 0.2, 1),
              transform 130ms cubic-bezier(0.4, 0, 0.2, 1);
}
#sidenav .sidenav-admin-btn:hover .sidenav-admin-arrow {
  color: var(--th-muted, #94a3b8);
  transform: translateX(1px);
}

/* Collapsed mode: icon-only, no surface */
html.sidenav-is-collapsed #sidenav .sidenav-admin-btn {
  padding: 0;
  justify-content: center;
  height: 36px;
  background: transparent;
  border-color: transparent;
}
html.sidenav-is-collapsed #sidenav .sidenav-admin-btn:hover {
  background: var(--th-ghost, rgba(255, 255, 255, 0.05));
  border-color: var(--th-border, rgba(255, 255, 255, 0.08));
}
html.sidenav-is-collapsed #sidenav .sidenav-admin-text,
html.sidenav-is-collapsed #sidenav .sidenav-admin-arrow {
  display: none;
}
html.sidenav-is-collapsed #sidenav .sidenav-admin-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
}

/* ───────────────────────────────────────────────────────────────────────
   Mobile (≤880 px) — ensure the row stays horizontal
   ─────────────────────────────────────────────────────────────────────── */

@media (max-width: 880px) {
  html.sidenav-is-collapsed #sidenav .sidenav-mode {
    flex-direction: row;
    height: 32px;
    margin: 0 12px 12px;
    padding: 3px;
  }
  html.sidenav-is-collapsed #sidenav .sidenav-mode-pill {
    height: 100%;
    border-radius: 5px;
    padding: 0 4px;
  }

  html.sidenav-is-collapsed #sidenav .sidenav-utility-row {
    flex-direction: row !important;
    background: var(--th-surface-2, rgba(255, 255, 255, 0.03)) !important;
    border: 1px solid var(--th-border, rgba(255, 255, 255, 0.08)) !important;
    border-radius: 8px !important;
    height: 30px !important;
    padding: 2px !important;
    gap: 2px !important;
  }
  html.sidenav-is-collapsed #sidenav .sidenav-utility-row > .sidenav-ut-slot,
  html.sidenav-is-collapsed #sidenav .sidenav-utility-row > .sidenav-utility-icon,
  html.sidenav-is-collapsed #sidenav .sidenav-utility-row > button.sidenav-utility-icon,
  html.sidenav-is-collapsed #sidenav .sidenav-utility-row > a.sidenav-utility-icon,
  html.sidenav-is-collapsed #sidenav .sidenav-utility-row > button#sidenav-theme {
    background: transparent !important;
    border: 0 !important;
    height: 100% !important;
    border-radius: 4px !important;
  }

  html.sidenav-is-collapsed #sidenav .sidenav-admin-btn {
    padding: 8px 10px;
    background: var(--th-surface-2, rgba(255, 255, 255, 0.03));
    border-color: var(--th-border, rgba(255, 255, 255, 0.08));
    height: auto;
    justify-content: flex-start;
  }
  html.sidenav-is-collapsed #sidenav .sidenav-admin-text,
  html.sidenav-is-collapsed #sidenav .sidenav-admin-arrow { display: revert; }
}

/* ───────────────────────────────────────────────────────────────────────
   Light theme — keep contrast crisp for the four overridden pieces
   ─────────────────────────────────────────────────────────────────────── */

/* Brand mark in light theme: subtle light surface with the accent glyph */
html[data-theme="light"] #sidenav .sidenav-brand-mark {
  background: #f1f5f9 !important;
  border-color: rgba(15, 23, 42, 0.10) !important;
  color: var(--th-accent, #16a34a) !important;
}
html[data-theme="light"] #sidenav .sidenav-brand-mark svg { color: inherit !important; }
html[data-theme="light"] body.provider-telegram #sidenav .sidenav-brand-mark { color: #2563eb !important; }
html[data-theme="light"] body.provider-whatsapp #sidenav .sidenav-brand-mark { color: #16a34a !important; }
html[data-theme="light"] #sidenav .sidenav-brand:hover .sidenav-brand-mark {
  background: #e2e8f0 !important;
  border-color: rgba(15, 23, 42, 0.18) !important;
}

html[data-theme="light"] #sidenav .sidenav-mode {
  background: var(--th-surface-2, #f7f8fa) !important;
  border-color: var(--th-border, rgba(15, 23, 42, 0.10)) !important;
}
html[data-theme="light"] #sidenav .sidenav-mode-pill.is-active {
  background: #ffffff !important;
  color: var(--th-text-strong, #0f172a) !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06) !important;
}
html[data-theme="light"] #sidenav .sidenav-utility-row {
  background: var(--th-surface-2, #f7f8fa) !important;
  border-color: var(--th-border, rgba(15, 23, 42, 0.10)) !important;
}
html[data-theme="light"] #sidenav .sidenav-admin-btn {
  background: var(--th-surface-2, #f7f8fa);
  border-color: var(--th-border, rgba(15, 23, 42, 0.10));
}

/* Live login feed (was inline in app_shell.html — extracted so HTML stays
   no-store while this CSS is cached with the sidenav sheet). */
.lf-stack {
  position: fixed;
  right: 18px; bottom: 18px;
  display: flex; flex-direction: column-reverse; gap: 10px;
  z-index: 10000;
  pointer-events: none;
  width: min(380px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
}
.lf-card {
  pointer-events: auto;
  background: #14181f;
  color: #e8ecf2;
  border-radius: 14px;
  padding: 14px 14px 12px;
  box-shadow: 0 18px 48px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.05);
  position: relative;
  overflow: hidden;
  animation: lf-in 280ms cubic-bezier(.2,.7,.2,1);
  border-left: 3px solid #5b9dff;
}
.lf-card[data-role="admin"]                  { border-left-color: #f5b945; }
.lf-card[data-role="admin"][data-newip="1"]  { border-left-color: #ef5760; }
.lf-card[data-role="agent"]                  { border-left-color: #2bd17e; }
.lf-card.lf-leaving { animation: lf-out 220ms ease forwards; }
@keyframes lf-in  { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes lf-out { from { opacity: 1; transform: translateX(0); }  to { opacity: 0; transform: translateX(20px); } }
.lf-head {
  display: grid;
  grid-template-columns: 32px 1fr 24px;
  gap: 10px;
  align-items: center;
}
.lf-icon {
  width: 32px; height: 32px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(91,157,255,.14);
  color: #5b9dff;
}
.lf-card[data-role="admin"]   .lf-icon { background: rgba(245,185,69,.16); color: #f5b945; }
.lf-card[data-role="agent"]   .lf-icon { background: rgba(43,209,126,.16); color: #2bd17e; }
.lf-card[data-role="admin"][data-newip="1"] .lf-icon { background: rgba(239,87,96,.18); color: #ef5760; }
.lf-title { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lf-h {
  font-size: 13.5px; font-weight: 700; color: #f1f4f9;
  margin: 0; line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lf-pill-row { display: inline-flex; align-items: center; gap: 6px; line-height: 1; }
.lf-pill {
  display: inline-flex; align-items: center;
  font-size: 9.5px; font-weight: 700;
  padding: 2px 6px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.05em;
  background: rgba(255,255,255,.07); color: #a8b2c0;
  line-height: 1.4;
}
.lf-card[data-role="admin"] .lf-pill { background: rgba(245,185,69,.18); color: #f5b945; }
.lf-card[data-role="agent"] .lf-pill { background: rgba(43,209,126,.18); color: #2bd17e; }
.lf-card[data-role="admin"][data-newip="1"] .lf-pill { background: rgba(239,87,96,.20); color: #ef5760; }
.lf-pill--self { background: rgba(91,157,255,.14) !important; color: #93c1ff !important; }
.lf-x {
  background: transparent; border: 0; cursor: pointer;
  color: #6f7a8a; width: 24px; height: 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 17px; line-height: 1; padding: 0;
  transition: background 120ms, color 120ms;
}
.lf-x:hover { background: rgba(255,255,255,.08); color: #e8ecf2; }
.lf-body { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.lf-row {
  font-size: 12px;
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 8px;
  align-items: baseline;
}
.lf-k {
  font-size: 9.5px; color: #6f7a8a; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.lf-v {
  color: #e8ecf2;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11.5px;
  word-break: break-all;
  line-height: 1.4;
}
.lf-v--text { font-family: inherit; font-size: 12px; word-break: normal; }
.lf-acts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.lf-acts.lf-acts--single { grid-template-columns: 1fr; }
.lf-btn {
  appearance: none; -webkit-appearance: none;
  background: rgba(255,255,255,.05);
  color: #d4dae5;
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 8px;
  padding: 7px 10px;
  font: 600 11.5px/1 inherit;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 100ms, border-color 100ms, color 100ms, transform 60ms;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 0;
}
.lf-btn:hover { background: rgba(255,255,255,.09); color: #fff; border-color: rgba(255,255,255,.10); }
.lf-btn:active { transform: translateY(1px); }
.lf-btn:focus-visible { outline: 2px solid rgba(91,157,255,.55); outline-offset: 2px; }
.lf-btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.lf-btn--warn { background: rgba(245,185,69,.10); color: #f5b945; border-color: rgba(245,185,69,.22); }
.lf-btn--warn:hover { background: rgba(245,185,69,.18); color: #ffd97a; border-color: rgba(245,185,69,.40); }
.lf-btn--danger { background: rgba(239,87,96,.10); color: #ef5760; border-color: rgba(239,87,96,.22); }
.lf-btn--danger:hover { background: rgba(239,87,96,.20); color: #ff7a82; border-color: rgba(239,87,96,.45); }
.lf-btn--ok { background: rgba(43,209,126,.10); color: #2bd17e; border-color: rgba(43,209,126,.22); }
.lf-btn--ok:hover { background: rgba(43,209,126,.18); color: #57e29c; border-color: rgba(43,209,126,.40); }
.lf-status { grid-column: 1 / -1; text-align: center; font-size: 11.5px; color: #99a3b3; padding: 7px 10px; }
.lf-status[data-tone="ok"]  { color: #2bd17e; }
.lf-status[data-tone="err"] { color: #ef5760; }
.lf-self-hint {
  font-size: 10.5px;
  color: #6f7a8a;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,.06);
}
