/* ─────────────────────────────────────────────────────────────
   LevTech shell — sidebar + topbar + page container
   Lifted from design_handoff_levtech_wave1/app.css lines 1-172 + 957-968.
   Step 1 additions: .sidebar-footer-logout, .school-pill
   refinements for the native <select> behind it, .account-pill--static.
   ───────────────────────────────────────────────────────────── */

/* ─── Shell layout ─── */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

/* ─── Sidebar ─── */
.sidebar {
  background: var(--bg-raised);
  border-right: 1px solid var(--border-divider);
  display: flex; flex-direction: column;
  padding: 20px 14px 14px;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px 18px;
  letter-spacing: -0.02em;
}
.brand-mark {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: var(--n-900);
  color: var(--n-0);
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px;
  letter-spacing: -0.02em;
}
.brand-name { font-size: 17px; font-weight: 600; color: var(--text-primary); }

.nav-eyebrow {
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-quaternary);
  padding: 14px 10px 6px;
}
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  height: 32px; padding: 0 10px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13.5px; font-weight: 500;
  cursor: pointer;
  transition: background var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
  text-decoration: none;
}
.nav-item:hover { background: var(--bg-sunken); color: var(--text-primary); }
.nav-item[aria-current="page"] {
  background: var(--bg-sunken);
  color: var(--text-primary);
  font-weight: 600;
}
.nav-item .icon { color: var(--text-tertiary); flex: 0 0 auto; width: 16px; height: 16px; }

/* A child of the nav line above it (Insights > Weekly summary): indented and
   a shade lighter so it reads as a second view of the same thing, not a
   fifth top-level destination. */
.nav-item--sub {
  margin-left: 26px;
  font-size: 13px;
  color: var(--text-tertiary);
}
.nav-item--sub .icon { width: 14px; height: 14px; }
.nav-item[aria-current="page"] .icon { color: var(--accent); }

/* SVG icon defaults — used wherever <svg class="icon"><use href="...#name"/></svg> appears */
.icon { width: 16px; height: 16px; flex: 0 0 auto; display: inline-block; vertical-align: middle; }
.icon-13 { width: 13px; height: 13px; }
.icon-14 { width: 14px; height: 14px; }
.icon-20 { width: 20px; height: 20px; }
.icon-24 { width: 24px; height: 24px; }

.sidebar-spacer { flex: 1; }

.account-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  cursor: default;
  position: relative;
}
.account-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--n-300), var(--n-500));
  color: var(--n-0);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600;
}
.account-meta { flex: 1; min-width: 0; }
.account-email {
  font-size: 12.5px; font-weight: 500;
  color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.account-role {
  font-size: 11px; color: var(--text-tertiary);
}

/* Sidebar-footer Sign out link — low-key, lives below the account chip.
   Step 1 only. Removed when the topbar account popover lands. */
.sidebar-footer-logout {
  display: block;
  margin-top: 8px;
  padding: 6px 10px;
  font-size: var(--text-caption);
  color: var(--text-tertiary);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: background var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.sidebar-footer-logout:hover {
  background: var(--bg-sunken);
  color: var(--text-primary);
}
/* ─── Topbar ─── */
.topbar {
  height: 56px;
  padding: 0 32px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border-divider);
  background: color-mix(in oklab, var(--bg-root) 80%, transparent);
  backdrop-filter: saturate(160%) blur(8px);
  -webkit-backdrop-filter: saturate(160%) blur(8px);
  position: sticky; top: 0; z-index: 5;
}
.crumb {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-secondary);
}
.crumb b { color: var(--text-primary); font-weight: 600; }
.crumb-sep { color: var(--text-quaternary); }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.school-pill {
  height: 32px; padding: 0 12px 0 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-default);
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 500;
  color: var(--text-secondary); background: var(--bg-raised);
  cursor: default;
  position: relative;
}
.school-pill .dot { width: 6px; height: 6px; }

/* Restyle the native <select> as a pill — chrome hidden, chevron sibling */
.school-pill--select {
  cursor: pointer;
  padding-right: 32px; /* room for chevron */
}
.school-pill--select select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  padding: 0;
  margin: 0;
  outline: none;
  cursor: pointer;
  min-width: 0;
  max-width: 200px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
.school-pill--select .school-pill-chevron {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}

.account-pill {
  height: 32px; width: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--n-400), var(--n-700));
  color: var(--n-0);
  display: grid; place-items: center;
  font-size: 11.5px; font-weight: 600;
  cursor: default;
  border: 1px solid var(--border-default);
}

/* ─── Page container ─── */
.page {
  padding: 32px 40px 80px;
  max-width: 1280px;
}
.page-header {
  display: flex; align-items: end; justify-content: space-between;
  margin-bottom: 28px;
}
.page-title { margin: 0; }
.eyebrow {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

/* ─── Sidebar back-nav (Exec Director drilled into a school) ─── */
.nav-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500;
  color: var(--text-tertiary);
  padding: 8px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
  text-decoration: none;
  margin-bottom: 6px;
}
.nav-back:hover { background: var(--bg-sunken); color: var(--text-primary); }

/* ─── Django messages framework (kept from existing app.css) ─── */
.messages {
  list-style: none;
  margin: 0 0 16px 0;
  padding: 0;
}
.messages li {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  font-size: var(--text-body);
}
.messages li.msg-success {
  background: var(--status-healthy-weak);
  color: #1F6B41;
  border: 1px solid color-mix(in oklab, var(--status-healthy) 18%, transparent);
}
.messages li.msg-error,
.messages li.msg-danger {
  background: var(--status-offline-weak);
  color: #8B2A20;
  border: 1px solid color-mix(in oklab, var(--status-offline) 18%, transparent);
}
.messages li.msg-warning {
  background: var(--status-degraded-weak);
  color: var(--status-degraded-ink);
  border: 1px solid color-mix(in oklab, var(--status-degraded) 18%, transparent);
}
.messages li.msg-info {
  background: var(--accent-weak);
  color: var(--accent);
}

/* ─── Account pill + popover (topbar) ─── */
.account-pill-wrap { position: relative; }

button.account-pill {
  appearance: none;
  border: 1px solid var(--border-default);
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  transition: box-shadow var(--dur-1) var(--ease-out);
}
button.account-pill:hover {
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 18%, transparent);
}
button.account-pill:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button.account-pill[aria-expanded="true"] {
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 28%, transparent);
}

.popover {
  position: absolute;
  z-index: 50;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3, 0 1px 0 rgba(17,19,25,0.04), 0 10px 28px rgba(17,19,25,0.10));
  padding: 8px;
  font-size: 14px;
}

.popover-head {
  padding: 12px 12px 10px;
}
.popover-name {
  font-size: 14px; font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 2px;
}
.popover-email {
  font-size: 13px;
  color: var(--text-secondary);
  word-break: break-all;
}
.popover-role {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 6px;
}
.popover-divider {
  height: 1px;
  background: var(--border-divider);
  margin: 4px -8px 4px;
}

.popover-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  border: 0;
  background: transparent;
  color: var(--text-primary);
  font: 500 14px/1.3 var(--font-sans);
  text-decoration: none;
  cursor: pointer;
  text-align: left;
}
.popover-item:hover { background: var(--bg-sunken); }
.popover-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.popover-item--disabled {
  color: var(--text-tertiary);
  cursor: default;
  pointer-events: none;
}
.popover-item-soon {
  margin-left: auto;
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: var(--bg-inset);
  color: var(--text-tertiary);
}
.popover-logout-form { margin: 0; }

/* ─── Forms (settings, invite, user management) ───
   Loaded globally via base.html. Input/label rules are scoped to .form-row so
   other native controls (the school-switcher <select>) keep their own styling. */
.subtitle {
  margin: -4px 0 20px;
  font-size: var(--text-body);
  color: var(--text-secondary);
}
.card { padding: var(--space-5); }
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-row label {
  font-size: var(--text-caption);
  font-weight: 500;
  color: var(--text-secondary);
}
.form-row input,
.form-row select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--bg-raised);
  color: var(--text-primary);
  font: 400 14px/1 var(--font-sans);
  outline: none;
  transition: border-color var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out);
}
.form-row input:focus,
.form-row select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 22%, transparent);
}
.form-hint { color: var(--text-tertiary); font-weight: 400; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.form-readonly {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}
.form-readonly-row {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: var(--text-body);
  padding: 4px 0;
}
.form-readonly-label { color: var(--text-secondary); }

/* ─── Range tabs: the one time-selector control (Overview, Incidents, Insights) ─── */
.range-tabs-wrap { position: relative; }
.range-tabs {
  display: inline-flex;
  padding: 3px;
  background: var(--bg-sunken);
  border-radius: var(--radius-md);
  gap: 1px;
}
.range-tab {
  appearance: none; border: 0; background: transparent;
  height: 28px; padding: 0 12px;
  border-radius: 6px;
  font: 500 12.5px/1 var(--font-sans);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.range-tab[aria-selected="true"] {
  background: var(--bg-raised);
  color: var(--text-primary);
  box-shadow: var(--shadow-1);
}
.range-tab[aria-selected="true"] { cursor: default; }
/* The date pill sits between two fixed-width arrows, so its own width has to
   be fixed too: "Tue, May 12" and "Wed, May 6" are different widths, and a
   content-sized pill shifted off-centre as the reader paged through days
   (Scott, 2026-08-27). Centred text in a stable box holds the centre. */
.range-tabs > .range-tab:not(.range-tab--icon) {
  /* 🚨 inline-flex + center, NOT just text-align. The date is a <span>, so it
     defaults to a BLOCK box: with height:28px and line-height:12.5px the one
     line of text sat at the TOP, 8px above the pill's centre, while every
     box-level measurement said "centred" (Scott kept seeing it off; two
     earlier fixes measured the BOXES and found 0px, because the misalignment
     was the glyphs inside the box). The arrows never showed it —
     `.range-tab--icon` is already inline-flex/center. */
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 104px; text-align: center; padding: 0 8px;
  font-variant-numeric: tabular-nums;
}
.range-tab--icon { padding: 0 8px; display: inline-flex; align-items: center; }
.range-tab--icon .icon { width: 14px; height: 14px; }
.range-tab:disabled { opacity: .35; cursor: default; }
a.range-tab { text-decoration: none; }

/* Generic data table (People page and future admin lists). Mirrors
   alerts.css .ar-table — that one predates this and stays local to its page;
   this is the shared version so no page ships an unstyled table again. */
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
  background: var(--bg-sunken);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  text-align: left;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-divider);
  white-space: nowrap;
}
.data-table tbody td {
  padding: 14px 20px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-divider);
  font-size: 13.5px;
  color: var(--text-primary);
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--bg-sunken); }
