/* ═══════════════════════════════════════════════════════════════
   shared.css — MTM Entrance Viva
   Single source of truth for all design tokens, layout primitives,
   and reusable components. Imported by every page.
═══════════════════════════════════════════════════════════════ */

/* ── Fonts ───────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Design tokens ───────────────────────────────────────────── */
:root {
  /* Colours */
  --bg:        #f5f7fa;
  --surface:   #ffffff;
  --surface-soft: #f7f9fc;  /* recessed panel fill — table headers, transcript strips */
  --border:    #d8e2ef;
  --text:      #1a2332;
  --muted:     #5e6e8a;
  --accent:    #005EB8;
  --accent2:   #0072ce;
  /* Fill behind white text (primary buttons). Same as --accent in light; a
     deeper blue in dark, where white on --accent is below 4.5:1 contrast. */
  --accent-fill: #005EB8;
  /* Buttons: sidebar navy everywhere (hover a touch lighter) */
  --btn-bg: #0f1f3d;
  --btn-bg-hover: #1a3263;
  --btn-outline: #0f1f3d;
  --green:     #00A499;
  --red:       #d4351c;
  --yellow:    #f59e0b;
  --blue:      #0072ce;
  --scroll-thumb: #c7d3e6;

  /* Gradients */
  --gradient-brand: linear-gradient(135deg, #003087 0%, #005EB8 100%);

  /* Status tints — light fill + readable text, used by badges/alerts/scores */
  --tint-success-bg: #d1fae5; --tint-success-text: #065f46; --tint-success-border: #86efac;
  --tint-warning-bg: #fef3c7; --tint-warning-text: #92400e; --tint-warning-border: #fcd34d;
  --tint-info-bg:    #dbeafe; --tint-info-text:    #1e40af; --tint-info-border:    #93c5fd;
  --tint-danger-bg:  #fee2e2; --tint-danger-text:  #991b1b; --tint-danger-border:  #fca5a5;

  /* "Parchment" — the read-aloud scenario/question card in the viva flow */
  --parchment-bg:        #fefdf7;
  --parchment-border:    #e2d9b8;
  --parchment-header-bg: #f5efda;
  --parchment-text:      #2d2a1e;
  --parchment-text-muted:#7a6520;
  --parchment-scroll:    #c9bb80;

  /* Type scale — edit here to resize everything uniformly */
  --text-xs:   0.72rem;   /* tiny labels, chips, badges     */
  --text-sm:   0.90rem;   /* secondary text, meta           */
  --text-base: 1rem;      /* body copy                      */
  --text-md:   1.1rem;    /* sub-headings                   */
  --text-lg:   1.35rem;   /* section headings               */
  --text-xl:   1.5rem;    /* page / card titles             */

  /* Layout */
  --header-h:   56px;
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
}

/* ── Dark theme ──────────────────────────────────────────────────
   Two ways in: the OS/browser preference (prefers-color-scheme, no
   explicit choice made yet) or an explicit choice from the toggle in
   the header, persisted to localStorage and applied as data-theme on
   <html> by js/theme.js. The explicit attribute always wins over the
   system preference in either direction. ─────────────────────────*/
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #0d1220;
    --surface:   #161d2c;
    --surface-soft: #1d2536;
    --border:    #2a3346;
    --text:      #e8edf7;
    --muted:     #92a0b8;
    --accent:    #3d94e6;
    --accent2:   #5aa8f0;
    --accent-fill: #1f6fc5;
  --btn-bg: #24467f;
  --btn-bg-hover: #2d5598;
  --btn-outline: #9fc0ff;
    --btn-bg: #24467f;
    --btn-bg-hover: #2d5598;
    --btn-outline: #9fc0ff;
    --green:     #17b8a6;
    --red:       #f0574a;
    --yellow:    #f2a93c;
    --blue:      #5aa8f0;
    --scroll-thumb: #3a4558;
    --gradient-brand: linear-gradient(135deg, #0c2a5e 0%, #14508f 100%);

    --tint-success-bg: rgba(16,185,129,.16); --tint-success-text: #6ee7b7; --tint-success-border: rgba(16,185,129,.35);
    --tint-warning-bg: rgba(245,158,11,.16); --tint-warning-text: #fbbf24; --tint-warning-border: rgba(245,158,11,.35);
    --tint-info-bg:    rgba(59,130,246,.18); --tint-info-text:    #93c5fd; --tint-info-border:    rgba(59,130,246,.35);
    --tint-danger-bg:  rgba(239,68,68,.18);  --tint-danger-text:  #fca5a5; --tint-danger-border:  rgba(239,68,68,.35);

    --parchment-bg:        #211d14;
    --parchment-border:    #4a4128;
    --parchment-header-bg: #2a2418;
    --parchment-text:      #ece4c8;
    --parchment-text-muted:#c9b87a;
    --parchment-scroll:    #5a4f2e;
  }
}
:root[data-theme="dark"] {
  --bg:        #0d1220;
  --surface:   #161d2c;
  --surface-soft: #1d2536;
  --border:    #2a3346;
  --text:      #e8edf7;
  --muted:     #92a0b8;
  --accent:    #3d94e6;
  --accent2:   #5aa8f0;
  --accent-fill: #1f6fc5;
  --green:     #17b8a6;
  --red:       #f0574a;
  --yellow:    #f2a93c;
  --blue:      #5aa8f0;
  --scroll-thumb: #3a4558;
  --gradient-brand: linear-gradient(135deg, #0c2a5e 0%, #14508f 100%);

  --tint-success-bg: rgba(16,185,129,.16); --tint-success-text: #6ee7b7; --tint-success-border: rgba(16,185,129,.35);
  --tint-warning-bg: rgba(245,158,11,.16); --tint-warning-text: #fbbf24; --tint-warning-border: rgba(245,158,11,.35);
  --tint-info-bg:    rgba(59,130,246,.18); --tint-info-text:    #93c5fd; --tint-info-border:    rgba(59,130,246,.35);
  --tint-danger-bg:  rgba(239,68,68,.18);  --tint-danger-text:  #fca5a5; --tint-danger-border:  rgba(239,68,68,.35);

  --parchment-bg:        #211d14;
  --parchment-border:    #4a4128;
  --parchment-header-bg: #2a2418;
  --parchment-text:      #ece4c8;
  --parchment-text-muted:#c9b87a;
  --parchment-scroll:    #5a4f2e;
}

/* Viewport-responsive root: 14 px on small screens → 18 px on wide */
html { font-size: clamp(14px, 1.0vw, 18px); }

html, body {
  height: 100%;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  min-height: 100vh;
  overflow-y: auto;
  padding-top: var(--header-h);
  transition: background-color .15s ease, color .15s ease;
}

/* ═══════════════════════════════════════════════════════════════
   APP HEADER  — fixed, appears on every page
═══════════════════════════════════════════════════════════════ */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 500;
  display: flex;
  align-items: center;
}

.header-inner {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
}

/* Left: logo + brand */
.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.logo-mark {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  background: var(--gradient-brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 800; color: #fff;
  letter-spacing: -.02em;
  flex-shrink: 0;
}

.header-brand {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
}

.header-brand-sub {
  display: none;
  font-size: var(--text-xs);
  color: var(--muted);
  margin-left: 6px;
  padding-left: 6px;
  border-left: 1px solid var(--border);
}

/* Nav tabs */
.header-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 24px;
  flex: 1;
}

.nav-tab {
  background: none;
  border: none;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--muted);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color .15s, background .15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.nav-tab:hover  { color: var(--text); background: var(--bg); }
.nav-tab.active { color: var(--accent); background: rgba(0,94,184,.08); font-weight: 600; }

/* Right: breadcrumb + student pill */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.header-crumb { font-size: var(--text-sm); color: var(--muted); }
.header-crumb .crumb-sep { margin: 0 4px; opacity: .45; }
.header-crumb .crumb-cur { color: var(--text); font-weight: 500; }

/* ── Avatar menu (avatar-only, dropdown contains logout) ──── */
.avatar-menu {
  position: relative;
}

.avatar-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--gradient-brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700; color: #fff;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color .15s;
  flex-shrink: 0;
  user-select: none;
}

.avatar-btn:hover { border-color: var(--accent); }

/* ── Theme toggle — wired up by js/theme.js, present on every page ── */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: color .15s, background .15s, border-color .15s;
}
.theme-toggle:hover { color: var(--text); background: var(--bg); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-moon { display: none; }
.theme-toggle.is-dark .icon-sun  { display: none; }
.theme-toggle.is-dark .icon-moon { display: block; }

.avatar-dropdown {
  display: none;
  position: absolute;
  right: 0; top: calc(100% + 8px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  min-width: 140px;
  z-index: 1100;
  overflow: hidden;
}

.avatar-dropdown.open { display: block; }

.avatar-dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  font-size: var(--text-sm);
  font-family: inherit;
  font-weight: 500;
  color: var(--text);
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background .12s;
}

.avatar-dropdown-item:hover { background: var(--bg); }
.avatar-dropdown-item.danger { color: var(--red); }
.avatar-dropdown-item.danger:hover { background: rgba(212,53,28,.06); }

/* Menu entry with a value on the right (e.g. "Wallet   42 min") */
a.avatar-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  text-decoration: none;
}
.avatar-dropdown-item .menu-meta { font-size: var(--text-xs); font-weight: 700; color: var(--accent2); }
.avatar-dropdown-item[hidden] { display: none; }

/* ── Minutes balance: sidebar "Wallet" item + mobile tab (students only;
   filled in by shared.js, hidden until the balance is known) ── */
.side-link[hidden], .mob-tab[hidden] { display: none !important; }
.side-wallet-meta {
  margin-left: auto;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,.10);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: 700;
  white-space: nowrap;
}
.side-wallet.active::after { margin-left: 8px; }
/* Below one station's worth: amber, so it's noticed before it blocks a start */
.side-wallet.is-low .side-wallet-meta { background: #f2b84b; color: #1a2332; }
.mob-tab .wallet-meta { font-size: var(--text-xs); font-weight: 700; margin-left: 4px; }
.mob-tab.is-low .wallet-meta { color: var(--tint-warning-text); }

/* ═══════════════════════════════════════════════════════════════
   LAYOUT PRIMITIVES
═══════════════════════════════════════════════════════════════ */

/* Standard content column */
.page-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 36px 20px;
  width: 100%;
}

/* Narrow column for forms / feedback */
.page-content-narrow {
  max-width: 50%;
  margin: 0 auto;
  padding: 36px 20px;
  width: 100%;
}

/* Full-height centred layout for entry / briefing screens */
.page-centered {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--header-h));
  padding: 20px;
}

/* Single-page screen switcher */
.screen { display: none; }
.screen.active { display: block; }

.screen-centered { display: none; }
.screen-centered.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--header-h));
  padding: 20px;
}

/* ═══════════════════════════════════════════════════════════════
   CARD
═══════════════════════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
}

/* ═══════════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  font-size: var(--text-base);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform .1s, opacity .15s;
  letter-spacing: .02em;
  text-decoration: none;
}

.btn:hover  { opacity: .88; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .35; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--btn-bg); color: #fff; }
.btn-primary:hover { background: var(--btn-bg-hover); opacity: 1; }
/* Secondary: navy outline so it matches the navy primary but reads as secondary */
.btn-ghost   { background: transparent; color: var(--btn-outline); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--btn-outline) 45%, var(--border)); }
.btn-ghost:hover { background: color-mix(in srgb, var(--btn-outline) 6%, transparent); opacity: 1; }
.btn-success { background: var(--btn-bg); color: #fff; }
.btn-danger  { background: #dc2626; color: #fff; }

/* White button — used on dark/gradient backgrounds */
.btn-white { background: #fff; color: var(--btn-outline); }
.btn-white:hover { background: #f0f4f8; opacity: 1; }

/* Muted bordered button — e.g. "I don't know — skip" */
.btn-warn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: var(--text-sm);
  padding: 8px 16px;
}
.btn-warn:hover { border-color: var(--red); color: var(--red); }

/* Red end-call button */
.btn-end-call {
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 8px 20px;
  font-size: var(--text-sm);
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background .15s, transform .1s;
}
.btn-end-call:hover  { background: #b02e18; transform: translateY(-1px); }
.btn-end-call:active { transform: translateY(0); }

/* ═══════════════════════════════════════════════════════════════
   FORM ELEMENTS
═══════════════════════════════════════════════════════════════ */
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

.input-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }

.input-group label {
  font-size: var(--text-sm);
  color: var(--muted);
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.input-group input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 16px;
  color: var(--text);
  font-size: var(--text-base);
  font-family: inherit;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.input-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,94,184,.15);
}

/* ═══════════════════════════════════════════════════════════════
   UTILITY CLASSES
═══════════════════════════════════════════════════════════════ */

/* Uppercase label — e.g. section titles, chip labels */
.label-caps {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 700;
  color: var(--muted);
}

/* ═══════════════════════════════════════════════════════════════
   TOPBAR COMPONENT  — reused in session dialog + viewer
═══════════════════════════════════════════════════════════════ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.topbar-left { display: flex; align-items: center; gap: 12px; }

/* ═══════════════════════════════════════════════════════════════
   BADGES
═══════════════════════════════════════════════════════════════ */
.live-badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(212,53,28,.1);
  border: 1px solid rgba(212,53,28,.2);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.live-badge .live-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--red);
  animation: livepulse 1s infinite;
}
@keyframes livepulse { 0%,100%{opacity:1} 50%{opacity:.3} }

.score-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: var(--text-xs);
  font-weight: 700;
}
.score-badge.high { background: var(--tint-success-bg); color: var(--tint-success-text); }
.score-badge.mid  { background: var(--tint-warning-bg); color: var(--tint-warning-text); }
.score-badge.low  { background: var(--tint-danger-bg);  color: var(--tint-danger-text); }

/* ═══════════════════════════════════════════════════════════════
   SPINNER
═══════════════════════════════════════════════════════════════ */
.spinner {
  width: 48px; height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════════
   ENTRY META BADGES
═══════════════════════════════════════════════════════════════ */
.entry-meta { display: flex; gap: 16px; margin-top: 20px; flex-wrap: wrap; }

.entry-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--muted);
}

.entry-badge .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
}

/* ═══════════════════════════════════════════════════════════════
   FEEDBACK SHARED STYLES
═══════════════════════════════════════════════════════════════ */
.fb-section { margin-bottom: 18px; }
.fb-section h3 {
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin-bottom: 10px;
  font-weight: 700;
}

.fb-list { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.fb-list li {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  line-height: 1.6;
}
.fb-list.strengths    li { background: rgba(0,164,153,.08); border-left: 3px solid var(--green); }
.fb-list.improvements li { background: rgba(212,53,28,.08); border-left: 3px solid var(--red); }
.fb-list.topics       li { background: rgba(0,114,206,.08); border-left: 3px solid var(--blue); }

/* ═══════════════════════════════════════════════════════════════
   SIDEBAR SHELL — opt-in via renderSidebar() in shared.js.
   Dark navy in both themes, so its colours are fixed rather
   than taken from the light/dark tokens.
═══════════════════════════════════════════════════════════════ */
:root { --sidebar-w: 248px; }

/* On desktop there is no top bar, so anything a page offsets by the
   header height (fixed overlays, min-heights) now starts at the top.
   --sidebar-offset is for fixed bars that span the content area
   (e.g. a sticky footer) so they start right of the sidebar. */
@media (min-width: 641px) {
  body.has-sidebar {
    --header-h: 0px;
    --sidebar-offset: var(--sidebar-w);
    padding-top: 0;
    padding-left: var(--sidebar-w);
  }
}

/* Below page modals/overlays (z-index 300+) so they cover the sidebar */
.app-sidebar {
  position: fixed;
  top: 0; bottom: 0; left: 0;
  width: var(--sidebar-w);
  background: #0E1A3A;
  color: rgba(255,255,255,.78);
  display: flex;
  flex-direction: column;
  padding: 22px 16px 18px;
  z-index: 250;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px;
  margin-bottom: 30px;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  text-decoration: none;
}
.side-logo {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: #2F5BEA;
  font-size: 0.95rem;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.side-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  color: rgba(255,255,255,.78);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  transition: background .15s, color .15s;
}
.side-link svg { width: 20px; height: 20px; flex-shrink: 0; }
.side-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-link:focus-visible,
.side-user-btn:focus-visible { outline: 2px solid #8FA8FF; outline-offset: 2px; }
.side-link.active {
  background: rgba(255,255,255,.10);
  color: #fff;
  font-weight: 600;
}
/* 3px accent bar on the left edge of the current page */
.side-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #5B82F5;
}

/* Practice streak card (filled in by setSidebarStreak) */
.side-streak {
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px;
  padding: 14px 14px 12px;
}
.side-streak-title {
  display: flex; align-items: center; gap: 10px;
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 700;
}
.side-streak-title svg { width: 20px; height: 20px; color: #F5C451; flex-shrink: 0; }
.streak-week {
  list-style: none;
  display: flex;
  justify-content: space-between;
  margin: 12px 0 10px;
}
.streak-day {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.28);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.66rem;
  font-weight: 700;
  color: rgba(255,255,255,.78);
}
.streak-day.done { background: #F5C451; border-color: #F5C451; color: #0E1A3A; }
.streak-day.today:not(.done) { border-color: #F5C451; color: #fff; }
.side-streak p { font-size: var(--text-xs); color: rgba(255,255,255,.78); line-height: 1.4; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.side-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.side-user-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 12px;
  border: none;
  border-radius: 12px;
  background: rgba(255,255,255,.06);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.side-user-btn:hover { background: rgba(255,255,255,.1); }
.side-user-btn .avatar-btn {
  width: 36px; height: 36px;
  background: #E6ECFF;
  color: #2F5BEA;
  font-size: 0.75rem;
}
.side-user-name {
  flex: 1;
  min-width: 0;
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.side-chev { width: 16px; height: 16px; flex-shrink: 0; color: rgba(255,255,255,.78); }

.side-dropdown {
  top: auto;
  bottom: calc(100% + 8px);
  left: 0;
  right: 0;
}
.side-dropdown .avatar-dropdown-item { min-height: 44px; display: flex; align-items: center; }

/* "My reports" unread replies: count in the menu, dot on the avatar */
.menu-count {
  margin-left: auto; min-width: 20px; padding: 2px 7px; border-radius: 99px;
  background: var(--red); color: #fff; font-size: 11px; font-weight: 700; text-align: center;
}
.menu-count[hidden] { display: none; }
.side-user-btn .avatar-btn { position: relative; }
.side-user-btn .avatar-btn.has-unread::after {
  content: ''; position: absolute; top: -2px; right: -2px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--red); border: 2px solid var(--sidebar-bg, #0f1f3d);
}

/* Theme switch as a menu row (overrides the round .theme-toggle button) */
.theme-toggle.side-theme-item {
  width: 100%; height: auto;
  border: none;
  border-radius: 0;
  background: none;
  color: var(--text);
  justify-content: flex-start;
  gap: 10px;
  padding: 10px 16px;
}
.theme-toggle.side-theme-item:hover { background: var(--bg); }

/* ═══════════════════════════════════════════════════════════════
   MOBILE BOTTOM NAV
═══════════════════════════════════════════════════════════════ */
.mobile-bottom-nav {
  display: none;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════════ */
@media (min-width: 640px) {
  .header-brand-sub { display: inline; }
}

@media (max-width: 860px) {
  .card { padding: 28px 22px; }
}

@media (max-width: 640px) {
  /* Hide desktop nav — replaced by bottom nav */
  .header-nav    { display: none; }
  /* Hide brand text — keep just the M logo mark */
  .header-brand  { display: none; }
  .header-inner  { padding: 0 16px; }
  /* Push avatar to the right when nav is hidden */
  .header-right  { margin-left: auto; gap: 8px; }
  .card          { padding: 20px 14px; border-radius: var(--radius-md); }
  .page-content,
  .page-content-narrow { padding: 20px 14px; }
  /* Extra bottom space so content doesn't hide behind bottom nav */
  body           { padding-bottom: 60px; }

  /* Bottom nav bar — z-index above all page content */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 56px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 1000;
    justify-content: space-around;
    align-items: stretch;
  }

  .mob-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--muted);
    padding: 4px 2px;
    transition: color .15s;
  }

  .mob-tab.active {
    color: var(--accent);
    font-weight: 700;
  }

  .mob-tab:hover {
    color: var(--text);
  }

  /* Sidebar collapses to a slim top bar; bottom nav handles navigation */
  body.has-sidebar { padding-top: var(--header-h); }
  .app-sidebar {
    bottom: auto; right: 0;
    width: auto;
    height: var(--header-h);
    flex-direction: row;
    align-items: center;
    padding: 0 16px;
  }
  .side-brand { margin-bottom: 0; padding: 0; }
  .side-nav { display: none; }
  .side-foot { margin-top: 0; margin-left: auto; flex-direction: row; align-items: center; }
  .side-user-btn { padding: 4px; background: none; }
  .side-user-btn .avatar-btn { width: 32px; height: 32px; }
  .side-user-name, .side-chev { display: none; }
  .side-user-btn { width: auto; min-height: 44px; }
  .side-streak { display: none; }
  .side-dropdown { top: calc(100% + 8px); bottom: auto; left: auto; right: 0; min-width: 210px; }
}


/* Narrow phones: the breadcrumb gives way so the balance chip, theme toggle
   and avatar fit on one row. */
@media (max-width: 380px) {
  .header-crumb { display: none; }
}
