/*
 * application.css
 *
 * Section index:
 *  1. BASE / TOKENS         — :root design variables (colors, spacing, type, radius, layout)
 *  2. BASE / RESET          — @font-face, box-sizing, base element styles
 *  3. LAYOUT / SHELL        — .tenant-app-shell, .tenant-shell, .tenant-content
 *  4. LAYOUT / SIDEBAR      — .tenant-sidebar, sidebar collapse, sidebar toggle
 *  5. LAYOUT / NAV          — .tenant-nav, .tenant-subnav, .tenant-breadcrumb
 *  6. LAYOUT / PAGE HEADER  — .tenant-topbar, .tenant-header
 *  7. LAYOUT / GRID         — .tenant-grid variants, .workspace-panel
 *  8. UI / BRAND            — .brand-lockup, .brand-mark, .app-preview
 *  9. UI / FORMS            — inputs, labels, fieldsets, form-specific components
 * 10. UI / BUTTONS          — .button and all variants
 * 11. UI / STATUS           — .flash, .status-pill, .empty-state
 * 12. UI / OVERLAYS         — .lifecycle-drawer, .confirm-dialog, .row-popover
 * 13. UI / DATA DISPLAY     — tables, .detail-list, .list-row, .module-card, .stat-strip
 * 14. UI / AVATARS          — .avatar-initials, .sidebar-user-avatar
 * 15. UI / NAV ICONS        — .nav-icon
 * 16. FEATURE / ATTENDANCE  — attendance-specific components
 * 17. FEATURE / TRANSPORT   — QR scanner components
 * 18. FEATURE / STUDENTS    — student photo / guardian components
 * 19. FEATURE / SETUP       — .setup-progress, .setup-checklist, .setup-step
 * 20. FEATURE / INBOX       — .inbox-filters, .inbox-item, .record-body
 * 21. PUBLIC / AUTH         — public home, auth panels
 * 20. RESPONSIVE ≤1100px  (phones + portrait tablets)
 * 20b. RESPONSIVE 1101–1440px (small desktop / landscape tablet)
 * 21. PRINT
 * 22. RESPONSIVE ≤520px
 */

/* ═══════════════════════════════════════════════════════════
   1. BASE / TOKENS
   ═══════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════
   2. BASE / RESET
   ═══════════════════════════════════════════════════════════ */

/* inter-latin-wght-normal */
@font-face {
  font-family: 'Inter Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('https://cdn.jsdelivr.net/fontsource/fonts/inter:vf@5.2.8/latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* ── Brand ─────────────────────────────── */
  --brand-h: 174;
  --brand-s: 77%;
  --brand-l: 24%;
  --brand: hsl(var(--brand-h), var(--brand-s), var(--brand-l));
  --brand-dark: hsl(var(--brand-h), var(--brand-s), 10%);
  --brand-light: hsl(var(--brand-h), var(--brand-s), 95%);
  --accent: hsl(38, 92%, 50%);
  --accent-text: hsl(38, 92%, 28%);
  --danger: hsl(2, 71%, 41%);
  --focus: hsl(214, 84%, 56%);

  /* ── Surface ────────────────────────────── */
  --background: hsl(210, 20%, 98%);
  --surface: hsl(0, 0%, 100%);
  --surface-muted: hsl(210, 20%, 96%);
  --text: hsl(213, 53%, 11%);
  --muted: hsl(213, 18%, 46%);
  --line: rgba(0, 0, 0, 0.08);
  --paper: #f2f4f7;

  /* ── Elevation ──────────────────────────── */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);

  /* ── Motion ─────────────────────────────── */
  --ease-out-cubic: cubic-bezier(0.33, 1, 0.68, 1);
  --transition-fast: 0.12s var(--ease-out-cubic);
  --transition-normal: 0.22s var(--ease-out-cubic);

  /* ── Spacing scale ──────────────────────── */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;

  /* ── Type scale ─────────────────────────── */
  --fs-xs: 0.72rem;
  --fs-sm: 0.82rem;
  --fs-base: 1rem;
  --fs-md: 1.1rem;
  --fs-lg: 1.2rem;
  --fs-xl: 1.45rem;

  /* ── Radius scale ───────────────────────── */
  --r-sm: 0.35rem;
  --r-md: 0.5rem;
  --r-lg: 0.75rem;
  --r-full: 999px;

  /* ── Layout ─────────────────────────────── */
  --sidebar-expanded: 17rem;
  --sidebar-icon: 3.5rem;
  --shell-max: 92rem;
  --content-max: 76rem;
}

* {
  box-sizing: border-box;
}

::selection {
  background: rgba(14, 107, 99, 0.2);
  /* Soft brand color for highlighted text */
  color: var(--text);
}

html {
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: "Inter Variable", system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  accent-color: var(--brand);
  caret-color: var(--brand);
}

a {
  color: inherit;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.35rem;
  font-size: 1.45rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h2 {
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h3 {
  margin-bottom: 0.2rem;
  font-size: 1rem;
  line-height: 1.25;
}

p {
  margin-bottom: 0.45rem;
  color: var(--muted);
}

button,
input,
select,
textarea {
  font: inherit;
}

/* ═══════════════════════════════════════════════════════════
   11. UI / STATUS
   ═══════════════════════════════════════════════════════════ */

.flash-stack {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  display: grid;
  gap: 0.5rem;
  width: min(28rem, calc(100vw - 2rem));
}

.flash {
  border: 1px solid var(--line);
  border-left: 0.3rem solid var(--brand);
  border-radius: 0.5rem;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 0.85rem 1rem;
}

.flash--alert {
  border-left-color: var(--danger);
}

/* Flash used inline (not in flash-stack) needs top separation */
* + .flash {
  margin-top: var(--sp-3);
}

/* ═══════════════════════════════════════════════════════════
   19. FEATURE / SETUP
   ═══════════════════════════════════════════════════════════ */

/* ── Progress bar ────────────────────────────────────────── */

.setup-progress {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.setup-progress__track {
  flex: 1;
  height: 0.3rem;
  background: var(--surface-muted);
  border-radius: var(--r-full);
  overflow: hidden;
}

.setup-progress__fill {
  height: 100%;
  background: var(--brand);
  border-radius: var(--r-full);
  width: var(--progress, 0%);
  transition: width 0.5s var(--ease-out-cubic);
}

.setup-progress__label {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  min-width: 2rem;
  text-align: right;
}

/* ── Setup stepper ───────────────────────────────────────── */

.setup-checklist {
  list-style: none;
  margin: 0;
  padding: 0;
}

.setup-step {
  display: grid;
  grid-template-columns: 1.75rem 1fr;
  gap: 0 var(--sp-3);
  padding: var(--sp-3) 0;
  position: relative;
}

.setup-step + .setup-step {
  border-top: 1px solid var(--line);
}

/* Connector line running from indicator to next step */
.setup-step:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 0.8rem;
  top: calc(var(--sp-3) + 1.75rem + 0.15rem);
  bottom: 0;
  width: 2px;
  background: var(--line);
}

.setup-step--done:not(:last-child)::before {
  background: hsl(var(--brand-h), var(--brand-s), 82%);
}

.setup-step__indicator {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.62rem;
  font-weight: 800;
  margin-top: 0.1rem;
  position: relative;
  z-index: 1;
}

.setup-step--done .setup-step__indicator {
  background: var(--brand);
  color: #fff;
}

.setup-step--current .setup-step__indicator {
  background: var(--surface);
  border: 2px solid var(--brand);
  color: var(--brand);
}

.setup-step--pending .setup-step__indicator {
  background: var(--surface-muted);
  border: 2px solid var(--line);
  color: var(--muted);
}

.setup-step__body {
  min-width: 0;
  padding-top: 0.15rem;
}

.setup-step__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
}

.setup-step__title {
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0;
  line-height: 1.4;
}

.setup-step--pending .setup-step__title {
  color: var(--muted);
  font-weight: 600;
}

.setup-step__description {
  margin: var(--sp-1) 0 var(--sp-2) 0;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.setup-step__actions {
  flex-shrink: 0;
  display: flex;
  gap: var(--sp-2);
  align-items: center;
}

/* ═══════════════════════════════════════════════════════════
   20. FEATURE / INBOX
   ═══════════════════════════════════════════════════════════ */

/* ── Filter bar ──────────────────────────────────────────── */

.inbox-filters {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: var(--sp-3);
}

.inbox-filter {
  padding: 0.3rem var(--sp-3);
  border-radius: var(--r-full);
  font-size: var(--fs-sm);
  font-weight: 700;
  text-decoration: none;
  color: var(--muted);
  border: 1px solid var(--line);
  background: transparent;
  transition: background var(--transition-fast), color var(--transition-fast);
  white-space: nowrap;
}

.inbox-filter:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.inbox-filter--active {
  background: var(--brand-light);
  color: var(--brand-dark);
  border-color: hsl(var(--brand-h), var(--brand-s), 75%);
}

.inbox-filter-form {
  margin-left: auto;
}

.inbox-state-select {
  padding: 0.3rem var(--sp-3);
  border-radius: var(--r-full);
  font-size: var(--fs-sm);
  font-weight: 700;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.inbox-state-select:hover {
  background: var(--surface-muted);
  color: var(--text);
}

/* ── Inbox item list ─────────────────────────────────────── */

.inbox-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--line);
  transition: color var(--transition-fast);
}

.inbox-item:last-child {
  border-bottom: none;
}

.inbox-item:hover .inbox-item__title {
  color: var(--brand-dark);
}

/* Unread indicator dot */
.inbox-item__dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  flex-shrink: 0;
  background: transparent;
}

.inbox-item--unread .inbox-item__dot {
  background: var(--brand);
}

.inbox-item__body {
  flex: 1;
  min-width: 0;
}

.inbox-item__title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--transition-fast);
}

.inbox-item--unread .inbox-item__title {
  font-weight: 800;
}

.inbox-item__meta {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inbox-item__badge {
  flex-shrink: 0;
}

/* ── Notice body prose ───────────────────────────────────── */

.record-body {
  line-height: 1.75;
}

.record-body p {
  color: var(--text);
  margin-bottom: var(--sp-3);
}

.record-body p:last-child {
  margin-bottom: 0;
}

/* ═══════════════════════════════════════════════════════════
   21. PUBLIC / AUTH
   ═══════════════════════════════════════════════════════════ */

.auth-page {
  display: grid;
  min-height: 100vh;
  padding: 2rem 1rem;
  place-items: center;
}

.public-home {
  min-height: 100vh;
  background: var(--background);
}

.public-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(18rem, 0.9fr);
  gap: 2rem;
  align-items: center;
  width: min(100%, 72rem);
  min-height: 74vh;
  margin: 0 auto;
  padding: 4rem 1rem 2rem;
}

.public-hero__content {
  max-width: 42rem;
}

.public-hero__logo {
  margin-bottom: 1.25rem;
}

.public-hero__lead {
  max-width: 37rem;
  font-size: 1.08rem;
}

.public-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.public-legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 1rem;
  font-size: 0.9rem;
}

.public-legal-links a {
  color: var(--muted);
  font-weight: 700;
}

.public-legal-links a:focus-visible,
.public-legal-links a:hover {
  color: var(--brand-dark);
}

.public-hero__snapshot {
  display: grid;
  gap: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 1rem;
}

.public-hero__snapshot div {
  display: grid;
  gap: 0.15rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  background: var(--surface-muted);
  padding: 0.9rem;
}

.public-hero__snapshot span {
  color: var(--brand-dark);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.public-section {
  width: min(100%, 72rem);
  margin: 0 auto;
  padding: 1rem 1rem 4rem;
}

.public-workflow-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.auth-panel {
  width: min(100%, 32rem);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.auth-panel--wide {
  width: min(100%, 42rem);
}

.auth-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  margin-top: 1.25rem;
  padding-top: 1rem;
}

.workspace-panel--reading {
  max-width: 42rem;
}

/* ═══════════════════════════════════════════════════════════
   9. UI / FORMS
   ═══════════════════════════════════════════════════════════ */

.stacked-form {
  display: grid;
  gap: 1rem;
}

.field {
  display: grid;
  gap: 0.35rem;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

label,
legend {
  color: var(--text);
  font-weight: 700;
}

fieldset {
  display: grid;
  gap: var(--sp-4);
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-4);
}

.checkbox-field {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  font-weight: 800;
}

input[type="email"],
input[type="password"],
input[type="search"],
input[type="text"],
input[type="date"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  background: var(--surface);
  padding: 0.6rem 0.75rem;
  resize: vertical;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input[type="email"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="text"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
  border-color: var(--focus);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02), 0 0 0 2px white, 0 0 0 4px var(--focus);
  outline: none;
}

.form-hint {
  margin-bottom: 0;
  font-size: var(--fs-sm);
}

.form-field-error {
  margin-bottom: 0;
  color: var(--danger);
  font-size: var(--fs-sm);
  font-weight: 600;
}

input:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.locked-context {
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  background: var(--surface-muted);
  padding: 0.7rem 0.75rem;
}

.form-errors {
  border: 1px solid rgb(179 38 30 / 35%);
  border-radius: 0.5rem;
  background: #fff5f4;
  padding: 1rem;
}

.form-errors h2 {
  color: var(--danger);
}

.form-errors ul {
  margin: 0;
  padding-left: 1.2rem;
}

.preserve-lines {
  white-space: pre-wrap;
}

.option-list {
  display: grid;
  gap: 0.6rem;
}

.option-list__item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.65rem;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  background: var(--surface);
  padding: 0.75rem;
}

.option-list__item small {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════
   3. LAYOUT / SHELL
   ═══════════════════════════════════════════════════════════ */

.tenant-shell {
  width: min(100%, 76rem);
  margin: 0 auto;
  padding: 1.25rem;
}

.tenant-app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w, var(--sidebar-expanded)) minmax(0, 1fr);
  gap: var(--sp-2);
  align-items: start;
  width: min(100%, var(--shell-max));
  margin: 0 auto;
  padding: var(--sp-3);
  transition: grid-template-columns 0.2s var(--ease-out-cubic);
}

.tenant-app-shell > * {
  min-width: 0;
}

.tenant-app-shell .tenant-shell {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
}

/* ═══════════════════════════════════════════════════════════
   4. LAYOUT / SIDEBAR
   ═══════════════════════════════════════════════════════════ */

.tenant-sidebar {
  position: sticky;
  top: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: var(--sp-4);
  max-height: calc(100dvh - 2 * var(--sp-3));
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.tenant-sidebar__brand {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.85rem;
}

.tenant-sidebar__tenant {
  margin-bottom: 0.15rem;
  color: var(--text);
  font-weight: 900;
  font-size: 1.1rem;
  line-height: 1.2;
}

.tenant-sidebar__meta-label {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.35;
}

.tenant-sidebar__ay-badge {
  display: inline-block;
  margin-top: var(--sp-1);
  padding: 0.15rem var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: 800;
  background: #fff6e8;
  color: hsl(30, 80%, 32%);
  border: 1px solid rgba(154, 90, 0, 0.25);
  border-radius: var(--r-sm);
  width: fit-content;
}

.tenant-content {
  display: grid;
  gap: 0.5rem;
}

/* ═══════════════════════════════════════════════════════════
   6. LAYOUT / PAGE HEADER
   ═══════════════════════════════════════════════════════════ */

.tenant-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-2);
}

.tenant-topbar p {
  margin-bottom: 0;
}

.tenant-topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto;
}

.tenant-topbar__logo {
  /* margin-left: auto handled by parent .tenant-topbar__actions */
}

/* Bell icon button in mobile topbar */
.topbar-bell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  border-radius: var(--r-sm);
  flex-shrink: 0;
}

.topbar-bell:hover {
  background: var(--surface-muted);
}

.topbar-bell .notification-badge {
  top: 0.3rem;
  right: 0.3rem;
}

.tenant-topbar__page-title {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--muted);
  margin: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.tenant-topbar__menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  border-radius: var(--r-sm);
  flex-shrink: 0;
}

.tenant-topbar__menu-btn:hover {
  background: var(--surface-muted);
}

/* ── Mobile nav drawer ───────────────────────────────────── */

.mobile-nav-dialog {
  position: fixed;
  inset: 0;
  margin: 0;
  padding: 0;
  width: min(22rem, 88vw);
  height: 100dvh;
  max-height: 100dvh;
  border: none;
  border-right: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 8px 0 32px rgba(0, 0, 0, 0.12);
  overflow-y: auto;
  animation: mobile-nav-in 0.22s var(--ease-out-cubic);
}

.mobile-nav-dialog:not([open]) {
  display: none;
}

.mobile-nav-dialog[open] {
  display: block;
}

.mobile-nav-dialog::backdrop {
  background: rgba(0, 0, 0, 0.3);
  animation: backdrop-fade-in 0.2s ease-out;
}

@keyframes mobile-nav-in {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}

.mobile-nav-dialog__inner {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-4);
  min-height: 100%;
}

.mobile-nav-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--line);
}

.mobile-nav-dialog__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
}

.mobile-nav-dialog__close:hover {
  color: var(--text);
  background: var(--line);
}

.mobile-nav-dialog__tenant {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.mobile-nav-dialog__user {
  margin-top: auto;
  padding-top: var(--sp-3);
  border-top: 1px solid var(--line);
}

.tenant-header {
  display: grid;
  gap: 0.65rem;
  padding: var(--sp-3) 0;
}

.tenant-header__title-row {
  display: flex;
  gap: var(--sp-4);
  align-items: flex-start;
  justify-content: space-between;
}

/* ═══════════════════════════════════════════════════════════
   5. LAYOUT / NAV
   ═══════════════════════════════════════════════════════════ */

.tenant-nav {
  display: grid;
  gap: 0.15rem;
}

.tenant-nav-mobile-summary {
  display: none !important;
}

.tenant-nav-content.hidden {
  display: grid !important;
}

.tenant-nav-content {
  display: grid;
  gap: 0.15rem;
}

.tenant-nav a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border-radius: var(--r-sm);
  padding: 0.6rem 0.8rem;
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
  transition: background 0.15s ease, color 0.15s ease;
}

.tenant-nav a:hover:not([aria-current="page"]) {
  background: var(--surface-muted);
  color: var(--text);
}

.tenant-nav a[aria-current="page"] {
  background: rgba(14, 107, 99, 0.08);
  /* Soft translucent teal pill */
  color: var(--brand-dark);
  font-weight: 800;
}

.tenant-nav__section-label {
  margin: 0.6rem 0 0.2rem 0.8rem;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.tenant-nav__section-divider {
  display: none;
}

.tenant-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 0.35rem;
}

.tenant-subnav a {
  border-radius: 0.4rem;
  padding: 0.55rem 0.8rem;
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
}

.tenant-subnav a[aria-current="page"] {
  background: var(--surface-muted);
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--brand);
}

.tenant-subnav__group {
  width: 100%;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.4rem 0.8rem 0;
  margin: 0;
}

.tenant-breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
}

.tenant-breadcrumb li {
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.tenant-breadcrumb li+li::before {
  content: "/";
  margin: 0 0.4rem;
  color: var(--line);
  font-weight: 400;
}

.tenant-breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.tenant-breadcrumb a:hover {
  color: var(--text);
  text-decoration: underline;
}

.tenant-breadcrumb li[aria-current="page"] {
  color: var(--text);
}

/* Unread count badge — positioned on the bell icon */
.notification-badge {
  position: absolute;
  top: -0.3rem;
  right: -0.3rem;
  min-width: 1rem;
  height: 1rem;
  background: var(--danger);
  color: #fff;
  font-size: 0.55rem;
  font-weight: 800;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.2rem;
  line-height: 1;
  pointer-events: none;
}

/* ── Sidebar user block ───────────────────────────────────── */

.tenant-sidebar__user {
  display: grid;
  gap: 0.3rem;
  min-width: 0;
  border-top: 1px solid var(--line);
  padding-top: 0.85rem;
  margin-top: auto;
}

.tenant-sidebar__user p {
  margin-bottom: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tenant-sidebar__user-name {
  color: var(--text);
  font-weight: 700;
}

.tenant-sidebar__user-role {
  font-size: var(--fs-sm);
}

/* ═══════════════════════════════════════════════════════════
   7. LAYOUT / GRID
   ═══════════════════════════════════════════════════════════ */

.tenant-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 0.42fr);
  gap: var(--sp-4);
  align-items: start;
}

.tenant-grid > * {
  min-width: 0;
}

/* Right-rail aside — sticky within page scroll, scrolls independently */
.tenant-grid > aside {
  position: sticky;
  top: var(--sp-3);
  max-height: calc(100dvh - 2 * var(--sp-3));
  overflow-y: auto;
  overflow-x: hidden;
  align-self: start;
}

/* Narrower context rail — 72/28 split for compact asides */
.tenant-grid--narrow-rail {
  grid-template-columns: minmax(0, 1fr) minmax(12rem, 0.3fr);
}

/* Full-width single column — no aside */
.tenant-grid--full {
  grid-template-columns: minmax(0, 1fr);
}

.workspace-panel {
  width: 100%;
  min-width: 0;
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.workspace-stack {
  display: grid;
  gap: var(--sp-3);
  min-width: 0;
}

/* ── Bottom tab bar — mobile primary navigation ───────────── */
/* Default: hidden (shown only on mobile via responsive section) */

.bottom-tab-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: var(--sp-1) var(--sp-2);
  padding-bottom: max(var(--sp-2), env(safe-area-inset-bottom));
}

.bottom-tab-bar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  flex: 1;
  padding: 0.45rem var(--sp-1);
  color: var(--muted);
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  font-weight: 500;
  transition: color var(--transition-fast);
  min-width: 0;
}

.bottom-tab-bar__item--active,
.bottom-tab-bar__item[aria-current="page"] {
  color: var(--brand);
}

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

.bottom-tab-bar__icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.bottom-tab-bar__label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.section-heading,
.list-row,
.module-row {
  display: flex;
  gap: var(--sp-4);
  align-items: center;
  justify-content: space-between;
}

.section-heading {
  margin-bottom: var(--sp-3);
}

.status-cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  justify-content: flex-end;
}

.action-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  justify-content: flex-end;
}

.action-group form {
  margin: 0;
}

.compact-status-form {
  display: grid;
  gap: 0.45rem;
  width: min(100%, 18rem);
}

.compact-status-form label {
  display: grid;
  gap: var(--sp-1);
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 700;
}

.checkbox-field {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.eyebrow {
  margin-bottom: var(--sp-1);
  color: var(--brand);
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-lockup {
  display: inline-flex;
  gap: 0.55rem;
  align-items: center;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.brand-lockup__wordmark {
  display: inline-flex;
  align-items: baseline;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.brand-lockup__wordmark span+span {
  color: var(--brand);
}

.brand-mark {
  display: inline-flex;
  flex: 0 0 auto;
  width: 2.45rem;
  height: 2.45rem;
  align-items: center;
  justify-content: center;
  border: 1px solid rgb(13 27 42 / 12%);
  border-radius: 0.55rem;
  background: var(--paper);
}

.brand-mark svg {
  display: block;
  width: 82%;
  height: 82%;
}

.brand-mark__teal-module {
  fill: var(--brand);
}

.brand-mark__navy-module {
  fill: var(--text);
}

.tenant-sidebar__logo .brand-mark {
  width: 2.1rem;
  height: 2.1rem;
}

/* Tenant custom logo — sized via CSS, not inline styles */
.tenant-sidebar__custom-logo {
  max-height: 1.75rem;
  max-width: 100%;
  object-fit: contain;
  border-radius: 0.15rem;
}

.mobile-nav-dialog__header .tenant-sidebar__custom-logo {
  max-height: 1.5rem;
}

.tenant-sidebar__logo .brand-lockup__wordmark,
.tenant-topbar__logo .brand-lockup__wordmark {
  font-size: 1rem;
}

.task-list,
.module-list {
  display: grid;
  gap: 0.65rem;
}

.record-section {
  margin-top: 1rem;
}

/* ═══════════════════════════════════════════════════════════
   18. FEATURE / STUDENTS  (guardians inline)
   ═══════════════════════════════════════════════════════════ */

.inline-guardian-rows {
  display: grid;
  gap: 1rem;
}

.inline-guardian-row {
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 0.9rem;
}

.inline-guardian-row__header {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.inline-guardian-row__header h3 {
  margin: 0;
}

.inline-guardian-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  gap: 0.75rem;
}

/* ── Data tables ─────────────────────────────────────────── */

.report-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.report-table th,
.report-table td {
  border-bottom: 1px solid var(--line);
  padding: 0.75rem;
  text-align: left;
  vertical-align: top;
}

.report-table th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.report-table td span {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
}

.report-table td .status-pill {
  display: inline-flex;
  margin-top: 0;
  color: inherit;
}

.list-row,
.module-row {
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--surface);
  padding: 0.9rem;
  transition: background 0.15s ease;
}

.list-row:hover,
.module-row:hover {
  background: #fafbfc;
}

.list-row--stacked {
  display: grid;
  gap: 0.9rem;
  align-items: stretch;
}

.staff-row__header,
.staff-row__status,
.assignment-list,
.inline-form,
.search-form {
  display: flex;
  gap: 0.65rem;
  align-items: end;
  flex-wrap: wrap;
}

.staff-row__header {
  align-items: flex-start;
  justify-content: space-between;
}

.staff-row__status,
.assignment-list {
  align-items: center;
}

.inline-form,
.search-form {
  margin-top: 0.75rem;
}

.form-field--checkbox {
  align-items: center;
  display: flex;
  gap: 0.55rem;
  min-height: 2.75rem;
}

.form-field--checkbox input {
  min-height: 1.15rem;
  min-width: 1.15rem;
}

/* ═══════════════════════════════════════════════════════════
   16. FEATURE / ATTENDANCE
   ═══════════════════════════════════════════════════════════ */

.summary-strip {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}

.inline-form .field,
.search-form .field {
  min-width: min(100%, 13rem);
  flex: 1 1 13rem;
}

.attendance-correction-reason {
  flex: 2 1 18rem;
}

.attendance-entry-progress {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1rem;
}

.movement-entry-context {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1rem;
}

.attendance-entry-row {
  align-items: center;
}

.attendance-entry-row__student {
  min-width: 0;
}

.attendance-entry-list {
  padding-bottom: 4.5rem;
}

.movement-entry-fields {
  display: grid;
  gap: 1rem;
  padding-bottom: 4.5rem;
}

.movement-entry-fieldset {
  background: var(--surface-muted);
}

.movement-entry-inline-fields {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
}

.attendance-status-field {
  width: min(100%, 14rem);
}

.attendance-entry-actions,
.movement-entry-actions {
  position: sticky;
  bottom: 0.75rem;
  z-index: 2;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--surface);
  box-shadow: 0 -0.6rem 1.5rem rgb(27 31 35 / 8%);
  padding: 0.75rem;
}

.module-row[aria-disabled="true"] {
  background: #fafbfc;
  opacity: 0.55;
}

.module-row[aria-disabled="true"] button,
.module-row[aria-disabled="true"] a {
  cursor: not-allowed;
  pointer-events: none;
}

.step-action {
  display: grid;
  gap: 0.55rem;
  justify-items: end;
}

.empty-state {
  display: grid;
  gap: 0.5rem;
  justify-items: start;
  min-height: 8rem;
  align-content: center;
}

.detail-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.detail-list--compact {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
}

.detail-list div {
  border-top: 1px solid var(--line);
  min-width: 0;
  padding: 0.65rem 0;
}

.detail-list div:last-child {
  border-bottom: 1px solid var(--line);
}

.detail-list dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.detail-list dd {
  margin: 0.15rem 0 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.attendance-review-table th,
.attendance-review-table td {
  vertical-align: top;
}

.attendance-correction-form {
  display: grid;
  grid-template-columns: minmax(9rem, 0.65fr) minmax(12rem, 1fr) auto;
  gap: 0.65rem;
  align-items: end;
  min-width: min(100%, 34rem);
}

.attendance-correction-form .field {
  margin: 0;
}

/* ═══════════════════════════════════════════════════════════
   18. FEATURE / STUDENTS  (photos, QR codes)
   ═══════════════════════════════════════════════════════════ */

.student-photo-card,
.student-photo-preview,
.student-qr-print-photo {
  margin: 0 0 1rem;
}

.student-photo-card__image,
.student-photo-preview__image,
.student-qr-print-photo__image {
  display: block;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: #ffffff;
  object-fit: cover;
}

.student-photo-card__image {
  width: min(100%, 10rem);
  aspect-ratio: 1;
}

.student-photo-preview {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.student-photo-preview__image {
  width: 4.5rem;
  aspect-ratio: 1;
}

.student-qr-card,
.student-qr-print-layout {
  display: grid;
  grid-template-columns: minmax(10rem, 15rem) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.student-qr-print-identity {
  min-width: 0;
}

.student-qr-print-photo__image {
  width: min(100%, 9rem);
  aspect-ratio: 3 / 4;
}

.student-qr-card__code {
  width: min(100%, 15rem);
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: #ffffff;
  padding: 0.75rem;
}

.student-qr-card__code svg {
  display: block;
  width: 100%;
  height: auto;
}

.student-qr-print-card {
  width: min(100%, 44rem);
  margin: 0 auto;
}

/* ═══════════════════════════════════════════════════════════
   17. FEATURE / TRANSPORT  (QR scanner)
   ═══════════════════════════════════════════════════════════ */

.tenant-grid--scanner {
  grid-template-columns: minmax(0, 1.35fr) minmax(18rem, 0.65fr);
}

.transport-scanner {
  min-width: 0;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.segmented-control__option {
  display: grid;
  min-height: 2.75rem;
  align-items: center;
  justify-items: center;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  background: var(--surface);
  font-weight: 800;
}

.segmented-control__option:has(input:checked) {
  border-color: var(--brand);
  background: #e8f5f1;
  color: var(--brand-dark);
}

.segmented-control__option input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.scanner-camera {
  display: grid;
  gap: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: #111827;
  color: #ffffff;
  overflow: hidden;
}

.scanner-camera__video {
  width: 100%;
  min-height: 16rem;
  aspect-ratio: 4 / 3;
  background: #111827;
  object-fit: cover;
}

.scanner-camera__status {
  margin: 0;
  padding: 0 0.9rem 0.9rem;
  color: #ffffff;
  font-weight: 800;
}

.scanner-recent {
  display: grid;
  gap: 0.5rem;
}

.scanner-recent h3,
.scanner-recent ul {
  margin: 0;
}

.scanner-recent ul {
  display: grid;
  gap: 0.45rem;
  padding-left: 1.2rem;
}

.qr-confirmation {
  gap: 1rem;
  max-width: 54rem;
}

.inline-flags {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 1.8rem;
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  padding: 0.2rem 0.6rem;
  background: var(--surface);
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
}

.status-pill--active {
  border-color: rgb(20 108 93 / 35%);
  background: #e8f5f1;
  color: var(--brand-dark);
}

.status-pill--pending {
  border-color: rgb(154 90 0 / 35%);
  background: #fff6e8;
  color: var(--accent-text);
}

.status-pill--blocked {
  border-color: rgb(179 38 30 / 35%);
  background: #fff5f4;
  color: var(--danger);
}

.status-stack {
  align-items: flex-end;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-end;
}

/* ═══════════════════════════════════════════════════════════
   10. UI / BUTTONS
   ═══════════════════════════════════════════════════════════ */

.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  justify-content: flex-end;
  margin-top: var(--sp-3);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 0.55rem var(--sp-4);
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  transition: background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.button:hover:not(:disabled) {
  border-color: var(--text);
  background: var(--surface-muted);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button--primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
}

.button--primary:hover:not(:disabled) {
  border-color: var(--brand-dark);
  background: var(--brand-dark);
  color: #ffffff;
}

.button--secondary {
  background: var(--surface-muted);
  border-color: transparent;
}

.button--secondary:hover:not(:disabled) {
  background: var(--line);
  border-color: transparent;
}

.button--ghost {
  background: transparent;
}

.button--ghost:hover:not(:disabled) {
  background: var(--surface-muted);
}

.button--full {
  width: 100%;
  justify-content: center;
}

.button:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

/* ═══════════════════════════════════════════════════════════
   20. RESPONSIVE ≤1100px  (phones + portrait tablets up to iPad Pro)
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 1100px) {

  .public-hero,
  .public-workflow-grid {
    grid-template-columns: 1fr;
  }

  .public-hero {
    min-height: auto;
    padding-top: 2rem;
  }

  .tenant-app-shell {
    display: block;
    padding: 0.75rem;
  }

  /* Sidebar hidden on mobile — accessed via hamburger drawer */
  .tenant-sidebar {
    display: none;
  }

  /* Sticky topbar — hamburger + page title + brand + bell */
  .tenant-topbar {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 10;
  }

  /* Bottom tab bar — primary nav for mobile */
  .bottom-tab-bar {
    display: flex;
  }

  /* Lift content above the fixed bottom tab bar, accounting for iPhone home indicator */
  .tenant-shell {
    padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
  }

  .tenant-header__title-row,
  .section-heading,
  .list-row,
  .module-row,
  .staff-row__header,
  .inline-guardian-row__header,
  .inline-form,
  .search-form,
  .step-action {
    align-items: stretch;
    flex-direction: column;
  }

  .step-action {
    justify-items: stretch;
  }

  /* Avatar rows stay horizontal — don't stack the avatar above content */
  .list-row--with-avatar {
    flex-direction: row !important;
    align-items: center !important;
  }

  .list-row--with-avatar .list-row__actions {
    flex-direction: row !important;
    align-items: center !important;
    flex-shrink: 0;
  }

  /* Subnav scrolls horizontally rather than wrapping to multiple lines */
  .tenant-subnav {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .tenant-subnav::-webkit-scrollbar {
    display: none;
  }

  .tenant-subnav a {
    white-space: nowrap;
    flex-shrink: 0;
  }

  .tenant-grid {
    grid-template-columns: 1fr;
  }

  /* Disable sticky right-rail — single-column layout, natural flow instead */
  .tenant-grid > aside {
    position: static;
    max-height: none;
    overflow-y: visible;
  }

  .tenant-grid--scanner {
    grid-template-columns: 1fr;
  }

  .student-qr-card,
  .student-qr-print-layout {
    grid-template-columns: 1fr;
  }

  .attendance-correction-form {
    grid-template-columns: 1fr;
  }

  .action-bar {
    justify-content: stretch;
  }

  .button,
  .action-bar form,
  .action-bar input[type="submit"],
  .attendance-status-field,
  .public-hero__actions .button {
    width: 100%;
  }

  /* Enlarge touch targets to 44px minimum */
  .row-popover__trigger {
    width: 2.75rem;
    height: 2.75rem;
  }

  .tenant-nav a {
    min-height: 2.75rem;
  }

  .attendance-entry-actions {
    bottom: 0.5rem;
  }

  .attendance-entry-list {
    padding-bottom: 8rem;
  }

  .movement-entry-actions {
    bottom: 0.5rem;
  }

  .movement-entry-fields {
    padding-bottom: 8rem;
  }

  /* Module cards: 2-column grid on mid-range mobile (portrait tablet / large phone) */
  .module-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* iOS safe-area padding so content clears the home indicator */
  .tenant-app-shell {
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  }

  .auth-page {
    padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
  }
}

/* ═══════════════════════════════════════════════════════════
   20b. RESPONSIVE 1101px–1440px  (small desktop / landscape tablet)
   ═══════════════════════════════════════════════════════════ */

@media (min-width: 1101px) and (max-width: 1440px) {
  /* Narrow sidebar so the content column isn't cramped on small desktops */
  .tenant-app-shell {
    --sidebar-w: 14rem;
    padding: var(--sp-2);
    gap: var(--sp-2);
  }
}

/* ═══════════════════════════════════════════════════════════
   21. PRINT
   ═══════════════════════════════════════════════════════════ */

@media print {
  @page {
    size: A4;
    margin: 12mm;
  }

  body {
    background: #ffffff;
  }

  .flash-stack,
  .tenant-sidebar,
  .tenant-topbar,
  .tenant-nav,
  .tenant-subnav,
  .tenant-breadcrumb,
  .bottom-tab-bar,
  .student-qr-print-hide {
    display: none;
  }

  .tenant-app-shell {
    display: block;
    width: 100%;
    padding: 0;
  }

  .tenant-shell {
    width: 100%;
    padding: 0;
  }

  .student-qr-print-card {
    width: 100%;
    max-width: 180mm;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .student-qr-print-layout {
    grid-template-columns: 52mm minmax(0, 1fr);
    align-items: start;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .student-qr-card__code {
    width: 52mm;
    padding: 4mm;
  }

  .student-qr-print-photo__image {
    width: 34mm;
  }

  .workspace-panel,
  .student-qr-card__code,
  .detail-list div {
    border-color: #111111;
    box-shadow: none;
  }
}

/* ═══════════════════════════════════════════════════════════
   22. RESPONSIVE ≤520px
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 520px) {
  h1 {
    font-size: 1.3rem;
  }

  .auth-page,
  .tenant-app-shell,
  .tenant-shell {
    padding: 0.75rem;
  }

  /* Restore bottom padding so content clears the fixed bottom tab bar */
  .tenant-shell {
    padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
  }

  .tenant-header,
  .workspace-panel,
  .auth-panel {
    padding: 0.85rem;
  }

  /* Single-column module cards on small phones */
  .module-card-grid {
    grid-template-columns: 1fr;
  }

  /* Compact stat strip on small phones */
  .stat-strip {
    grid-template-columns: 1fr 1fr;
  }

  .staff-access-row {
    align-items: flex-start !important;
    flex-wrap: wrap;
  }

  .staff-access-row .list-row__body {
    flex: 1 1 calc(100% - 3.3rem);
  }

  .staff-access-row .list-row__actions {
    flex: 1 0 100% !important;
    justify-content: stretch !important;
    width: 100%;
  }

  .staff-access-row .list-row__actions .button {
    flex: 1 1 9rem;
    width: auto;
  }

  /* Tighten the flash stack to go edge-to-edge at very small sizes */
  .flash-stack {
    top: 0.5rem;
    right: 0.5rem;
    width: calc(100vw - 1rem);
  }

  /* Shorter camera viewfinder on very small phones */
  .scanner-camera__video {
    min-height: 12rem;
  }
}

/* ═══════════════════════════════════════════════════════════
   12. UI / OVERLAYS
   ═══════════════════════════════════════════════════════════ */

/* ── Lifecycle drawer ────────────────────────────────────── */

.lifecycle-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: auto;
  width: min(28rem, 92vw);
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: none;
  border-left: 1px solid var(--line);
  background: var(--surface);
  overflow-y: auto;
  box-shadow: -8px 0 32px rgb(0 0 0 / 10%);
  animation: drawer-slide-in 0.2s ease-out;
}

.lifecycle-drawer::backdrop {
  background: rgb(0 0 0 / 22%);
  animation: backdrop-fade-in 0.2s ease-out;
}

@keyframes drawer-slide-in {
  from {
    transform: translateX(100%);
  }

  to {
    transform: translateX(0);
  }
}

@keyframes backdrop-fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.drawer-form {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.drawer-form__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.drawer-form__header h2 {
  margin: 0;
}

.drawer-form__header p.eyebrow {
  margin-bottom: 0.25rem;
}

/* ── Confirm dialog ──────────────────────────────────────── */

.confirm-dialog {
  width: min(28rem, 92vw);
  margin: auto;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: confirm-dialog-in 0.15s ease-out;
}

.confirm-dialog::backdrop {
  background: rgb(0 0 0 / 22%);
  animation: backdrop-fade-in 0.15s ease-out;
}

@keyframes confirm-dialog-in {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(-0.5rem);
  }

  to {
    opacity: 1;
  }
}

/* ── Contextual Popover Row Actions ───────────────────────── */

.row-popover {
  position: relative;
  display: inline-block;
}

.row-popover__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: all var(--transition-fast);
}

.row-popover__trigger:hover {
  border-color: var(--text);
  color: var(--text);
  background: var(--surface-muted);
}

.row-popover__menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  min-width: 10.5rem;
  margin-top: 0.25rem;
  padding: 0.35rem 0;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  animation: popover-fade-in 0.15s var(--ease-out-cubic);
}

.row-popover__menu.hidden {
  display: none !important;
}

.row-popover__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem 0.85rem;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.row-popover__item:hover {
  background: var(--surface-muted);
  color: var(--brand-dark);
}

.row-popover__item--danger {
  color: var(--danger);
}

.row-popover__item--danger:hover {
  background: hsl(2, 71%, 97%);
  color: var(--danger);
}

@keyframes popover-fade-in {
  from {
    opacity: 0;
    transform: translateY(-0.25rem) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ── Logo preview (settings page) ───────────────────────── */

.logo-preview {
  display: inline-block;
  margin-bottom: 0.75rem;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--surface);
}

.logo-preview__image {
  display: block;
  max-height: 40px;
  max-width: 100%;
  object-fit: contain;
}

/* ── Aside panel differentiation ────────────────────────── */

aside.workspace-panel {
  background: var(--surface-muted);
  box-shadow: none;
}

/* ── Detail list ─────────────────────────────────────────── */

.detail-list dd {
  margin: 0.2rem 0 0;
  font-size: 1rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

/* ── Auth panel identity block ───────────────────────────── */

.auth-panel__identity {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-panel__tenant-logo {
  display: block;
  max-height: 60px;
  max-width: 100%;
  width: auto;
  object-fit: contain;
  border-radius: 0.25rem;
  margin: 0 auto 0.75rem;
}

.auth-panel__tenant-name {
  margin-bottom: 0;
  font-size: 1.5rem;
}

.auth-panel__tagline {
  color: var(--muted);
  margin-top: 0.25rem;
  margin-bottom: 0;
}

/* ── Form Loading Transitions ────────────────────────────── */

.button--loading {
  cursor: not-allowed !important;
  opacity: 0.75 !important;
}

/* ═══════════════════════════════════════════════════════════
   15. UI / NAV ICONS
   ═══════════════════════════════════════════════════════════ */

/* ── Navigation Icons ────────────────────────────────────── */

.nav-icon {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
}

/* ═══════════════════════════════════════════════════════════
   14. UI / AVATARS
   ═══════════════════════════════════════════════════════════ */

/* ── Avatar Initials ─────────────────────────────────────── */

.avatar-initials {
  flex: 0 0 auto;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: hsl(var(--avatar-hue, 174), 50%, 42%);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  flex-shrink: 0;
}

.list-row--with-avatar {
  display: flex;
  gap: 0.9rem;
  align-items: center;
}

.list-row--with-avatar .list-row__body {
  flex: 1 1 0;
  min-width: 0;
}

.list-row--with-avatar .list-row__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ═══════════════════════════════════════════════════════════
   13. UI / DATA DISPLAY
   ═══════════════════════════════════════════════════════════ */

/* ── Module Cards ────────────────────────────────────────── */

.module-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.module-card-grid > .module-card:last-child:nth-child(2n+1) {
  grid-column: 1 / -1;
}

.module-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--surface);
  padding: 1rem;
  transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}

.module-card:not(.module-card--blocked):hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.module-card--blocked {
  opacity: 0.6;
  background: var(--surface-muted);
}

.module-card__icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.45rem;
  background: var(--brand-light);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.module-card--blocked .module-card__icon {
  background: var(--surface-muted);
  color: var(--muted);
}

/* Smaller icon variant for module-row list context */
.module-card__icon--sm {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
}

.module-card__icon--blocked {
  background: var(--surface-muted);
  color: var(--muted);
}

/* Content area inside a module-row (icon + text group) */
.module-row__content {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
}

/* Student card header in guardian view (avatar + name/number) */
.module-card__student-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.module-card__student-meta h3 {
  margin-bottom: var(--sp-1);
}

.module-card__student-meta p {
  margin: 0;
  font-size: var(--fs-sm);
}

.module-card__body {
  flex: 1;
}

.module-card__body h3 {
  margin-bottom: 0.2rem;
}

.module-card__body p {
  font-size: 0.88rem;
  margin-bottom: 0;
}

.module-card__footer {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
  margin-top: auto;
}

/* ── Stat Strip ──────────────────────────────────────────── */

.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
  gap: 0.75rem;
  margin-bottom: var(--sp-3);
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--surface);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-card__value {
  font-size: 1.75rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1;
}

.stat-card__value--brand { color: var(--brand); }
.stat-card__value--accent { color: var(--accent-text); }
.stat-card__value--danger { color: var(--danger); }

.stat-card__label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Empty State Illustration ────────────────────────────── */

.empty-state {
  padding: 1.5rem 0.5rem;
}

.empty-state__illustration {
  width: 3.5rem;
  height: 3.5rem;
  margin-bottom: 0.85rem;
  color: var(--muted);
  opacity: 0.35;
}

/* ── Eyebrow Variant ─────────────────────────────────────── */

.eyebrow--accent {
  color: var(--accent-text);
}

/* ═══════════════════════════════════════════════════════════
   8. UI / BRAND
   ═══════════════════════════════════════════════════════════ */

/* ── App Preview (Public Hero Mockup) ────────────────────── */

.app-preview {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  padding: 0.75rem;
  user-select: none;
  pointer-events: none;
  height: 20rem;
}

.app-preview__sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  border-right: 1px solid var(--line);
  padding-right: 0.6rem;
}

.app-preview__logo {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}

.app-preview__logo-dot {
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 0.3rem;
  background: var(--brand);
  flex: 0 0 auto;
}

.app-preview__logo-text {
  height: 0.55rem;
  border-radius: 99px;
  background: var(--text);
  opacity: 0.6;
  flex: 1;
}

.app-preview__nav-item {
  height: 1.6rem;
  border-radius: 0.3rem;
  background: var(--surface-muted);
  position: relative;
  overflow: hidden;
}

.app-preview__nav-item::before {
  content: "";
  position: absolute;
  left: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 0.15rem;
  background: var(--muted);
  opacity: 0.3;
}

.app-preview__nav-item::after {
  content: "";
  position: absolute;
  left: 1.4rem;
  top: 50%;
  transform: translateY(-50%);
  height: 0.4rem;
  right: 0.4rem;
  border-radius: 99px;
  background: var(--muted);
  opacity: 0.2;
}

.app-preview__nav-item--active {
  background: rgba(14, 107, 99, 0.1);
}

.app-preview__nav-item--active::before {
  background: var(--brand);
  opacity: 0.8;
}

.app-preview__nav-item--active::after {
  background: var(--brand);
  opacity: 0.5;
}

.app-preview__nav-spacer {
  flex: 1;
}

.app-preview__nav-user {
  height: 1rem;
  border-radius: 0.3rem;
  background: var(--surface-muted);
}

.app-preview__main {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
  overflow: hidden;
}

.app-preview__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}

.app-preview__title-block {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.app-preview__eyebrow {
  height: 0.45rem;
  width: 2.8rem;
  border-radius: 99px;
  background: var(--brand);
  opacity: 0.55;
}

.app-preview__title {
  height: 0.6rem;
  width: 5.5rem;
  border-radius: 99px;
  background: var(--text);
  opacity: 0.75;
}

.app-preview__badge {
  height: 1.5rem;
  width: 4.5rem;
  border-radius: 0.35rem;
  background: var(--brand);
  opacity: 0.85;
}

.app-preview__card {
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  overflow: hidden;
}

.app-preview__row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid var(--line);
}

.app-preview__row:last-child {
  border-bottom: none;
}

.app-preview__avatar {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: hsl(174, 50%, 42%);
  flex: 0 0 auto;
}

.app-preview__avatar--2 { background: hsl(38, 70%, 52%); }
.app-preview__avatar--3 { background: hsl(252, 52%, 56%); }
.app-preview__avatar--4 { background: hsl(340, 60%, 48%); }

.app-preview__text-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  min-width: 0;
}

.app-preview__line {
  height: 0.45rem;
  border-radius: 99px;
  background: var(--text);
  opacity: 0.15;
}

.app-preview__line--full  { width: 82%; }
.app-preview__line--3q    { width: 64%; }
.app-preview__line--half  { width: 44%; }
.app-preview__line--q     { width: 28%; }

.app-preview__pill {
  height: 1.2rem;
  width: 3.2rem;
  border-radius: 99px;
  background: var(--surface-muted);
  flex: 0 0 auto;
  border: 1px solid var(--line);
}

.app-preview__pill--active {
  background: #e8f5f1;
  border-color: rgba(14, 107, 99, 0.28);
}

.app-preview__pill--accent {
  background: #fff6e8;
  border-color: rgba(154, 90, 0, 0.28);
}

.app-preview__stat-strip {
  display: flex;
  gap: 0.4rem;
}

.app-preview__stat {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  padding: 0.4rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.app-preview__stat-number {
  height: 0.8rem;
  width: 1.8rem;
  border-radius: 99px;
  background: var(--brand);
  opacity: 0.7;
}

.app-preview__stat-number--accent { background: var(--accent); opacity: 0.8; }
.app-preview__stat-number--muted  { background: var(--muted); opacity: 0.35; }

.app-preview__stat-label {
  height: 0.38rem;
  width: 80%;
  border-radius: 99px;
  background: var(--text);
  opacity: 0.12;
}

@media (max-width: 1100px) {
  .app-preview {
    display: none;
  }
}

@media (max-width: 520px) {
  .stat-strip {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── Layout overflow prevention ──────────────────────────── */

/* All flex/grid children that contain variable-length text */
.tenant-content,
.tenant-shell,
.workspace-stack,
.list-row__body,
.module-card__body,
.tenant-sidebar__tenant,
.tenant-sidebar__meta-label,
.tenant-sidebar__user p {
  min-width: 0;
}

/* Break long text (emails, URLs, long names) inside containers */
.detail-list dd,
.list-row h3,
.list-row p,
.module-card__body p,
.module-card__body h3,
.tenant-sidebar__tenant,
.section-heading > div p {
  overflow-wrap: break-word;
}

/* Images never exceed their container */
img {
  max-width: 100%;
  height: auto;
}

/* Workspace panels inside grids — never push the grid wider */
.tenant-grid .workspace-panel,
.tenant-grid aside.workspace-panel {
  min-width: 0;
  width: 100%;
}

/* ── Sidebar toggle & collapse ───────────────────────────── */

.sidebar-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  align-self: flex-end;
  padding: 0.3rem 0.6rem;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-fast), color var(--transition-fast);
  flex-shrink: 0;
  white-space: nowrap;
}

.sidebar-toggle:hover {
  background: var(--line);
  color: var(--text);
}

.sidebar-toggle__chevron {
  flex-shrink: 0;
  transition: transform 0.2s var(--ease-out-cubic);
}

.sidebar-toggle__label {
  overflow: hidden;
  white-space: nowrap;
  transition: max-width 0.2s var(--ease-out-cubic), opacity 0.15s ease;
  max-width: 8rem;
  opacity: 1;
}

/* ── Collapsible sidebar ─────────────────────────────────── */

.tenant-app-shell.sidebar-collapsed {
  --sidebar-w: var(--sidebar-icon);
}

.tenant-app-shell.sidebar-collapsed .tenant-sidebar {
  padding: 0.65rem 0.4rem;
  align-items: center;
}

/* Hide brand text, keep logo mark */
.tenant-app-shell.sidebar-collapsed .tenant-sidebar__brand-meta {
  display: none;
}

.tenant-app-shell.sidebar-collapsed .tenant-sidebar__ay-badge {
  display: none;
}

/* Brand area: center the logo mark */
.tenant-app-shell.sidebar-collapsed .tenant-sidebar__brand {
  align-items: center;
  padding-bottom: 0.5rem;
}

.tenant-app-shell.sidebar-collapsed .tenant-sidebar__brand .brand-lockup__wordmark,
.tenant-app-shell.sidebar-collapsed .tenant-sidebar__brand .tenant-sidebar__custom-logo {
  display: none;
}

/* Nav items: icon-only, centered */
.tenant-app-shell.sidebar-collapsed .tenant-nav a {
  justify-content: center;
  padding: 0.55rem 0.3rem;
}

.tenant-app-shell.sidebar-collapsed .tenant-nav a span:not(.nav-icon) {
  display: none;
}

.tenant-app-shell.sidebar-collapsed .tenant-nav__section-label {
  display: none;
}

/* Thin divider instead of section label when collapsed */
.tenant-app-shell.sidebar-collapsed .tenant-nav__section-divider {
  display: block;
  height: 1px;
  background: var(--line);
  margin: 0.35rem 0;
}

/* Toggle button: rotate chevron when collapsed, hide label */
.tenant-app-shell.sidebar-collapsed .sidebar-toggle__chevron {
  transform: rotate(180deg);
}

.tenant-app-shell.sidebar-collapsed .sidebar-toggle__label {
  max-width: 0;
  opacity: 0;
}

/* Collapsed: center the toggle since it has no label */
.tenant-app-shell.sidebar-collapsed .sidebar-toggle {
  align-self: center;
  padding: 0.35rem 0.5rem;
}

/* User section: hide text + sign-out, keep minimal */
.tenant-app-shell.sidebar-collapsed .tenant-sidebar__user {
  padding-top: 0.5rem;
}

.tenant-app-shell.sidebar-collapsed .tenant-sidebar__user p,
.tenant-app-shell.sidebar-collapsed .tenant-sidebar__user .button {
  display: none;
}

/* User avatar when collapsed */
.tenant-app-shell.sidebar-collapsed .sidebar-user-avatar {
  display: flex !important;
}

.sidebar-user-avatar {
  display: none;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--brand-light);
  color: var(--brand-dark);
  font-size: 0.68rem;
  font-weight: 800;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

/* ── Nav section visual hierarchy ────────────────────────── */

.tenant-nav__section-label--management {
  color: var(--muted);
  opacity: 0.7;
}

.tenant-nav__section-label--operations {
  color: var(--brand-dark);
  opacity: 0.9;
}

/* Collapsed nav item tooltips — rendered into <body> by nav-tooltip controller */
.nav-tooltip {
  position: fixed;
  transform: translateY(-50%);
  background: var(--text);
  color: var(--surface);
  font-size: var(--fs-xs);
  font-weight: 700;
  white-space: nowrap;
  padding: 0.3rem 0.6rem;
  border-radius: var(--r-sm);
  pointer-events: none;
  z-index: 200;
  animation: nav-tooltip-in 0.12s var(--ease-out-cubic);
}

@keyframes nav-tooltip-in {
  from { opacity: 0; transform: translateY(-50%) translateX(-4px); }
  to   { opacity: 1; transform: translateY(-50%); }
}

/* ── Desktop sidebar collapse not shown on mobile ────────── */
@media (max-width: 1100px) {
  .tenant-app-shell.sidebar-collapsed {
    --sidebar-w: auto;
  }
  .sidebar-toggle {
    display: none;
  }
}
