/* Palki Academy — Bangla-first, factory-floor-grade.
   Brand-aligned: Cloud Dancer canvas + Deep Forest primary.
   AAA contrast. WCAG 2.2. Touch targets ≥48px. */

:root {
  /* ----- Surfaces (Palki brand: Cloud Dancer) ----- */
  --c-bg:        #F5F2ED;   /* Cloud Dancer — warm off-white, low glare */
  --c-surface:   #FFFFFF;
  --c-surface-2: #EDE8DC;   /* slightly darker tint for cards/accordion */

  /* ----- Text (AAA on canvas) ----- */
  --c-text:        #0A0A0A; /* Near-Black — 16:1 on canvas, AAA */
  --c-text-muted:  #4A4A4A; /* 9:1, AAA */
  --c-text-soft:   #6B6B6B; /* 5.5:1, AA */

  /* ----- Borders ----- */
  --c-border:        #E0DAC8;
  --c-border-strong: #C4BCA8;

  /* ----- Primary (Palki Deep Forest — works on Cloud Dancer) ----- */
  --c-primary:        #0D3B2E;  /* Deep Forest, AAA on white */
  --c-primary-dark:   #052B20;
  --c-primary-soft:   #D8E8E0;  /* tint for badges, hover */

  /* ----- Accent (Palki Electric Lime — DARK SURFACES ONLY) ----- */
  --c-accent-lime:  #CDFF00;

  /* ----- States ----- */
  --c-success:      #15803D;
  --c-success-soft: #DCFCE7;
  --c-success-fg:   #166534;
  --c-warn:         #92400E;
  --c-warn-soft:    #FEF3C7;     /* amber — used for "not quite" wrong answers */
  --c-danger:       #B91C1C;     /* DANGER ONLY, never for "wrong" */
  --c-danger-soft:  #FEE2E2;
  --c-info-soft:    #DBEAFE;
  --c-info-fg:      #1E3A8A;

  /* ----- Focus ----- */
  --c-focus:        #0D3B2E;
  --c-focus-bg:     rgba(13, 59, 46, 0.08);

  /* ----- Radii (4-pt base) ----- */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* ----- Shadows ----- */
  --shadow-sm: 0 1px 2px rgba(10, 10, 10, .05), 0 1px 1px rgba(10, 10, 10, .03);
  --shadow-md: 0 4px 12px rgba(10, 10, 10, .07), 0 2px 4px rgba(10, 10, 10, .04);
  --shadow-lg: 0 12px 32px rgba(10, 10, 10, .10), 0 4px 8px rgba(10, 10, 10, .05);

  /* ----- Spacing (4-pt) ----- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-8: 3rem;

  /* ----- Typography ----- */
  --font-ui:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-bn:    'Hind Siliguri', 'Inter', sans-serif;
  --font-prose: 'Source Serif 4', Charter, 'Iowan Old Style', Georgia, serif;
  --font-prose-bn: 'Hind Siliguri', 'Source Serif 4', serif;
  --font-mono:  ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
}

[data-theme="sepia"] {
  --c-bg:        #FBF0D9;   /* warm cream — Apple Books sepia */
  --c-surface:   #F8EAC9;
  --c-surface-2: #F1E0BC;
  --c-text:        #3B2C1A;  /* deep sepia text */
  --c-text-muted:  #6B5236;
  --c-text-soft:   #9A7E5C;
  --c-border:        #E5D5B5;
  --c-border-strong: #C8B595;
  --c-primary:        #5B3A1F;  /* sepia primary */
  --c-primary-dark:   #3F2611;
  --c-primary-soft:   #ECDDB9;
}

[data-theme="dark"] {
  --c-bg:        #1A1A1A;
  --c-surface:   #232323;
  --c-surface-2: #2C2C2C;
  --c-text:        #E8E8E8;   /* ~13:1 */
  --c-text-muted:  #B5B5B5;   /* ~7:1 */
  --c-text-soft:   #8C8C8C;
  --c-border:        #353535;
  --c-border-strong: #4A4A4A;
  --c-primary:        #5FA8FF;
  --c-primary-dark:   #3E8AE6;
  --c-primary-soft:   #1E3A5F;
}

[data-theme="hc"] {
  --c-bg: #FFFFFF;
  --c-text: #000000;
  --c-text-muted: #1A1A1A;
  --c-primary: #052B20;
  --c-border-strong: #000000;
}

/* Reader prose font scale — controlled by chrome menu (1.0 default; 0.85 / 1.0 / 1.15 / 1.3 / 1.5) */
:root { --prose-scale: 1; }

/* ============================================================
   Z-INDEX SCALE — single source of truth for sticky/fixed chrome.
   Layer values left to right: lowest to highest.
   ============================================================ */
:root {
  --z-progress:   1;    /* reading progress bar (sticky, top of viewport) */
  --z-toolbar:    5;    /* sticky inline toolbars (mobile editor markdown bar) */
  --z-topnav:    50;    /* topnav (sticky, top) */
  --z-cta:       55;    /* end-chapter sticky CTA (above content, below bottomtab) */
  --z-bottomtab: 60;    /* bottomtab (fixed, bottom) */
  --z-fab:       65;    /* reader FAB + reader settings menu */
  --z-toast:     70;    /* pull-to-refresh indicator + transient toasts */
  --z-banner:    80;    /* PWA install banner */
  --z-drawer-bd: 89;    /* drawer backdrop */
  --z-drawer:    90;    /* drawer foreground (e.g. editor outline drawer) */
  --z-popover:  100;    /* dropdown menus, note drawer, hamburger menu open */
  --z-modal:    200;    /* full-screen overlays (slash menu, gen overlay, image zoom) */
}

@media (prefers-contrast: more) {
  :root { --c-text: #000; --c-text-muted: #1A1A1A; }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Bangla typography — wider line-height per spec */
body.locale-bn { font-family: var(--font-bn); line-height: 1.85; }
body.locale-bn .prose { font-family: var(--font-prose-bn); line-height: 1.9; max-width: 55ch; }

/* English typography */
body.locale-en .prose { font-family: var(--font-prose); line-height: 1.7; max-width: 66ch; }

/* Focus rings — never outline:none */
:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: 2px;
  border-radius: 3px;
}

a {
  color: var(--c-primary);
  text-decoration: underline;
  text-decoration-color: rgba(13, 59, 46, .35);
  text-underline-offset: 2px;
}
a:hover { text-decoration-color: currentColor; }

h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.25;
  color: var(--c-text);
  font-weight: 700;
}
h1 { font-size: 1.75rem; letter-spacing: -.01em; }       /* 28px */
h2 { font-size: 1.375rem; margin-bottom: .75rem; }       /* 22px */
h3 { font-size: 1.125rem; font-weight: 600; }            /* 18px */
body.locale-bn h1, body.locale-bn h2, body.locale-bn h3 { line-height: 1.4; }

@media (min-width: 768px) {
  h1 { font-size: 2.25rem; }       /* 36px desktop */
  h2 { font-size: 1.75rem; }       /* 28px */
  h3 { font-size: 1.375rem; }      /* 22px */
}

p { margin: 0 0 1rem; }

code {
  font-family: var(--font-mono); font-size: 13px;
  background: var(--c-surface-2); padding: 1px 6px; border-radius: 4px;
}
pre code { display: block; padding: 12px; overflow: auto; }

.muted { color: var(--c-text-muted); }
.small { font-size: .875rem; line-height: 1.5; }
body.locale-bn .small { line-height: 1.7; }

/* ============================================================
   TOP NAV
   ============================================================ */
.topnav {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  position: sticky; top: 0; z-index: 50;
}
/* Admin-mode chrome: lime accent stripe so admin always knows they're in admin context */
.topnav-admin { border-top: 3px solid var(--c-accent-lime); }
.admin-tag {
  display: inline-block;
  background: var(--c-accent-lime); color: var(--c-primary);
  font-size: 10px; font-weight: 800; letter-spacing: .08em;
  padding: 2px 7px; border-radius: 999px; vertical-align: middle;
  text-transform: uppercase;
}
.bottomtab-admin { border-top: 2px solid var(--c-accent-lime); }

/* ============================================================
   USERS & PERMISSIONS (/admin/users) — compact rows + inline edit
   ============================================================ */
.users-page { padding-bottom: 80px; }
.users-head { margin-bottom: 16px; }
.users-head h1 { margin: 0 0 4px; font-size: 1.5rem; line-height: 1.2; }

/* ---- Invite bar (always visible at top) ---- */
.invite-bar {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.invite-bar-head h2 {
  margin: 0 0 10px;
  font-size: .9375rem; font-weight: 700;
  color: var(--c-primary);
}
.invite-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.invite-email {
  width: 100%; min-height: 44px;
  padding: 10px 14px;
  font: inherit; font-size: 16px;        /* 16px → no iOS zoom */
  border: 1px solid var(--c-border-strong); border-radius: 8px;
  background: var(--c-surface);
}
.invite-role {
  width: 100%; min-height: 44px;
  padding: 10px 14px;
  font: inherit; font-size: 15px;
  border: 1px solid var(--c-border-strong); border-radius: 8px;
  background: var(--c-surface);
}
.invite-submit {
  width: 100%; min-height: 44px;
  font-size: .9375rem;
}
.invite-more {
  margin-top: 10px;
}
.invite-more > summary {
  cursor: pointer; padding: 8px 0;
  font-size: .875rem; color: var(--c-text-muted);
  list-style: none;
}
.invite-more > summary::-webkit-details-marker { display: none; }
.invite-more > summary::before {
  content: '▸ ';
}
.invite-more[open] > summary::before { content: '▾ '; }
.invite-more-row {
  display: grid; gap: 10px; padding-top: 6px;
}
.invite-more-row label {
  display: flex; flex-direction: column; gap: 4px;
}
.invite-more-row input {
  width: 100%; min-height: 44px;
  padding: 10px 14px; font: inherit; font-size: 16px;
  border: 1px solid var(--c-border-strong); border-radius: 8px;
  background: var(--c-surface);
}
.invite-help { margin: 10px 0 0; }

/* ---- Section header ---- */
.users-section { margin-bottom: 20px; }
.users-section-head h2 {
  margin: 0 0 10px;
  font-size: .8125rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--c-text-muted);
}

/* ---- User row (compact) ---- */
.users-list {
  display: flex; flex-direction: column; gap: 8px;
}
.user-row {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.user-row.is-self {
  border-color: var(--c-accent-lime);
  background: linear-gradient(0deg, var(--c-surface) 0%, var(--c-surface) 100%);
  box-shadow: 0 0 0 1px var(--c-accent-lime);
}
.user-row.is-inactive {
  opacity: .7;
  background: var(--c-surface-2);
}
.user-row.is-editing {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 1px var(--c-primary);
}

/* Compact view — single row layout */
.user-row-view {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
}
.user-avatar {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--c-primary-soft); color: var(--c-primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}
.user-info { flex: 1; min-width: 0; }
.user-name-line {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 2px;
}
.user-name {
  font-size: .9375rem; font-weight: 600; color: var(--c-text);
  word-break: break-word;
}
.user-you-badge {
  display: inline-block;
  background: var(--c-accent-lime); color: var(--c-primary);
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
  padding: 2px 6px; border-radius: 999px;
}
.user-meta { word-break: break-all; }
.user-actions {
  display: flex; gap: 6px; flex-shrink: 0;
}
.user-suspend-form { margin: 0; }
.user-suspend-btn { color: var(--c-danger, #c0392b); }
.user-suspend-btn:hover:not(:disabled) { background: rgba(192, 57, 43, .08); }
.user-suspend-btn:disabled { opacity: .35; cursor: not-allowed; }

/* Inline edit form (revealed by JS) */
.user-row-edit[hidden] { display: none; }
.user-row-edit {
  padding: 14px;
  background: var(--c-surface-2);
  border-top: 1px solid var(--c-border);
  display: flex; flex-direction: column; gap: 12px;
}
.user-edit-grid {
  display: grid; gap: 10px;
  grid-template-columns: 1fr;
}
.user-edit-grid label {
  display: flex; flex-direction: column; gap: 4px;
}
.user-edit-grid input,
.user-edit-grid select {
  width: 100%; min-height: 44px;
  padding: 10px 12px; font: inherit; font-size: 16px;
  border: 1px solid var(--c-border-strong); border-radius: 6px;
  background: var(--c-surface);
}
.user-edit-warn {
  background: #fff8e6; border: 1px solid #f3d97a;
  color: #7a5500; padding: 8px 10px; border-radius: 6px; margin: 0;
}
.user-edit-actions {
  display: flex; gap: 8px; justify-content: flex-end;
}

/* Empty state */
.users-empty {
  text-align: center; padding: 40px 24px;
  border: 1px dashed var(--c-border-strong);
  border-radius: var(--r-md);
  background: var(--c-surface);
  margin-bottom: 16px;
}

/* Suspended section <details> */
.users-section-suspended details > summary {
  cursor: pointer; padding: 8px 0;
  list-style: none;
  color: var(--c-text-muted);
}
.users-section-suspended details > summary::-webkit-details-marker { display: none; }
.users-section-suspended details > summary::before { content: '▸ '; }
.users-section-suspended details[open] > summary::before { content: '▾ '; }
.users-section-suspended details > summary > h2 { color: var(--c-text-muted); }

/* ---- Pill badges (shared) — kept identical to before ---- */
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.pill-member { background: var(--c-surface-2); color: var(--c-text-muted); }
.pill-admin  { background: var(--c-primary-soft); color: var(--c-primary); }
.pill-owner  { background: var(--c-accent-lime); color: var(--c-primary); }

/* ============================================================
   SOURCE OF TRUTH (/admin/data)
   ============================================================ */
.data-page { padding-bottom: 80px; }
.sot-snapshot {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
  margin-bottom: 24px;
}
@media (min-width: 700px) { .sot-snapshot { grid-template-columns: repeat(4, 1fr); } }
.sot-snap-cell {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-md); padding: 14px; text-align: center;
}
.sot-snap-num { font-size: 1.5rem; font-weight: 700; line-height: 1.1; margin-top: 4px; }
.sot-group { margin-bottom: 20px; }
.sot-group-title {
  font-size: .8125rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--c-text-muted); margin: 0 0 10px;
}
.sot-rows { display: flex; flex-direction: column; gap: 6px; }
.sot-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-sm); padding: 12px 14px;
}
.sot-row-label { min-width: 0; }
.sot-key { font-weight: 600; font-size: .9375rem; }
.sot-meta { display: flex; gap: 6px; align-items: center; margin-top: 2px; }
.sot-source {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  background: var(--c-surface-2); color: var(--c-text-muted);
}
.sot-source-odoo   { background: #ede7ff; color: #5b3a9f; }
.sot-source-sheet  { background: var(--c-success-soft); color: var(--c-success-fg); }
.sot-source-wallex { background: #e3f2ff; color: #1565c0; }
.sot-source-bank   { background: #fff3e0; color: #9a6500; }
.sot-source-os     { background: var(--c-accent-lime); color: var(--c-primary); }

/* Sync source control bar */
.sot-syncbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 20px;
}
.sot-syncbar-state { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sot-syncbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sot-pill-on  { display: inline-block; background: var(--c-success-soft); color: var(--c-success-fg); font-weight: 700; font-size: 12px; padding: 2px 10px; border-radius: 999px; }
.sot-pill-off { display: inline-block; background: #ffe2e2; color: #b00020; font-weight: 700; font-size: 12px; padding: 2px 10px; border-radius: 999px; }

/* Editable metric rows */
.sot-add { margin-bottom: 16px; }
.sot-row { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-sm); margin-bottom: 6px; overflow: hidden; }
.sot-row.is-archived { opacity: .55; }
.sot-row-view { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.sot-row-view .sot-row-label { flex: 1; min-width: 0; }
.sot-row-view .sot-row-value { font-weight: 700; font-size: 1.0625rem; white-space: nowrap; }
.sot-row-view .sot-meta code { background: var(--c-surface-2); padding: 1px 5px; border-radius: 4px; font-size: 11px; }
.sot-edit-btn { flex-shrink: 0; }
.sot-row-edit { padding: 14px; background: var(--c-surface-2); border-top: 1px solid var(--c-border); }
.sot-row-edit[hidden] { display: none; }
.sot-edit-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 700px) { .sot-edit-grid { grid-template-columns: 1fr 1fr; } }
.sot-edit-grid label { display: flex; flex-direction: column; gap: 4px; }
.sot-edit-grid input, .sot-edit-grid select {
  min-height: 44px; padding: 8px 12px; font: inherit; font-size: 16px;
  border: 1px solid var(--c-border-strong); border-radius: 6px; background: var(--c-surface);
}
.sot-edit-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.sot-edit-actions .danger { color: var(--c-danger, #c0392b); }
.sot-row-value { font-weight: 700; font-size: 1.0625rem; white-space: nowrap; flex-shrink: 0; }
.sot-foot { margin-top: 16px; text-align: center; opacity: .85; }

/* ============================================================
   API TOKENS (/admin/api-tokens)
   ============================================================ */
.api-tokens-page { padding-bottom: 60px; }
.new-token-banner { padding: 18px 20px; }
.token-plaintext {
  background: #0D3B2E; color: #CDFF00;
  padding: 12px 16px; border-radius: 8px;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, monospace);
  font-size: 13px; line-height: 1.5;
  margin: 12px 0 8px; overflow-x: auto;
  user-select: all;
}
.scopes-grid {
  display: grid; gap: 8px;
  grid-template-columns: 1fr;
  margin-top: 8px;
}
@media (min-width: 600px) { .scopes-grid { grid-template-columns: repeat(2, 1fr); } }
.scope-check {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: 8px;
  cursor: pointer;
}
.scope-check:has(input:checked) {
  background: var(--c-primary-soft); border-color: var(--c-primary);
}
.scope-check input[type="checkbox"] {
  width: 18px; height: 18px; accent-color: var(--c-primary);
}
.scope-check code {
  font-size: 13px; color: var(--c-text);
}
.token-rows { display: flex; flex-direction: column; gap: 8px; }
.token-row {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.token-row.is-revoked { opacity: .6; background: var(--c-surface-2); }
.token-row-info { flex: 1; min-width: 0; }
.token-name {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 4px;
}
.token-meta code { background: var(--c-surface-2); padding: 1px 6px; border-radius: 4px; }
.pill-revoked { background: #E5E5E0; color: #525252; }

/* ============================================================
   TASKS (/tasks) — employee work view (ClickUp wrapper)
   ============================================================ */
.tasks-page { padding-bottom: 100px; }
.tasks-head { margin-bottom: 12px; }
.tasks-head h1 { margin: 0 0 4px; font-size: 1.5rem; }
.cu-dot { color: var(--c-success, #2e7d32); font-size: 10px; vertical-align: middle; }

.tasks-tabs {
  display: flex; gap: 4px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 16px;
  position: sticky; top: 64px; z-index: 10;
}
.tasks-tab {
  flex: 1; min-height: 40px;
  border: 0; background: transparent;
  font: inherit; font-weight: 600; font-size: .875rem;
  color: var(--c-text-muted); cursor: pointer;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.tasks-tab.active { background: var(--c-surface); color: var(--c-primary); box-shadow: var(--shadow-sm); }
.tasks-count {
  font-size: .75rem; font-weight: 700;
  background: var(--c-border); color: var(--c-text-muted);
  border-radius: 999px; padding: 1px 7px; min-width: 18px; text-align: center;
}
.tasks-tab.active .tasks-count { background: var(--c-primary); color: white; }

.tasks-panel { display: flex; flex-direction: column; gap: 8px; }
.tasks-subhead {
  font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--c-text-muted); margin: 16px 0 4px;
}
.tasks-empty {
  text-align: center; padding: 32px 16px;
  color: var(--c-text-muted);
  background: var(--c-surface); border: 1px dashed var(--c-border-strong);
  border-radius: var(--r-md);
}
.tasks-foot { margin-top: 16px; text-align: center; opacity: .8; }

/* Task row */
.task-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  text-decoration: none; color: inherit;
  min-height: 56px;
}
.task-row:hover { background: var(--c-surface-2); text-decoration: none; }
.task-row.is-overdue { border-left: 3px solid var(--c-danger, #c0392b); }
.task-row-main { flex: 1; min-width: 0; }
.task-row-title { font-weight: 600; font-size: .9375rem; color: var(--c-text); word-break: break-word; }
.task-row-meta { display: flex; gap: 6px; align-items: center; margin-top: 3px; flex-wrap: wrap; }
.task-status {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  background: color-mix(in srgb, var(--st) 18%, transparent);
  color: var(--st);
  border: 1px solid color-mix(in srgb, var(--st) 35%, transparent);
}
.task-row-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.task-prio { font-size: 12px; }
.task-due {
  font-size: .8125rem; font-weight: 600; color: var(--c-text-muted);
  white-space: nowrap;
}
.task-due.is-overdue { color: var(--c-danger, #c0392b); }

/* 5-item bottom tab: tighten so Bangla labels fit */
.bottomtab a { font-size: .6875rem; }
body.locale-bn .bottomtab a { font-size: .6875rem; }
.bottomtab a .icon { font-size: 20px; }
@media (min-width: 480px) {
  .bottomtab a { font-size: .8125rem; }
}

/* ============================================================
   QUIZ LIST (/admin/quizzes) — compact rows with quick actions
   ============================================================ */
.quiz-rows {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 8px;
}
.quiz-row {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.quiz-row-title {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 4px;
  text-decoration: none; color: inherit;
  word-break: break-word;
}
.quiz-row-title:hover strong { text-decoration: underline; }
.quiz-row-actions {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
  flex-shrink: 0;
}
.quiz-status-form { margin: 0; }
.quiz-delete-form { margin: 0; }
.quiz-delete-btn { color: var(--c-danger, #c0392b); }
.quiz-delete-btn:hover { background: rgba(192,57,43,.08); }
/* Status select styled like a pill */
.pill-select {
  appearance: none; -webkit-appearance: none;
  font: inherit; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
  padding: 4px 26px 4px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.pill-select:hover { filter: brightness(.95); }
.pill-select:focus { outline: 2px solid var(--c-focus); outline-offset: 2px; }

@media (min-width: 700px) {
  .quiz-row { flex-wrap: nowrap; }
}

/* ---- Tablet+ responsive: invite-row goes inline ---- */
@media (min-width: 700px) {
  .invite-row {
    grid-template-columns: 1fr 180px auto;
  }
  .invite-submit { width: auto; padding: 0 22px; }
  .invite-more-row { grid-template-columns: 1fr 1fr; }
}

/* ---- Desktop: tighter spacing, role/title side-by-side in edit ---- */
@media (min-width: 1024px) {
  .users-page { max-width: 960px; margin: 0 auto; padding-bottom: 60px; }
  .user-edit-grid { grid-template-columns: 1fr 200px; }
  .user-edit-grid-wide { grid-column: 1 / -1; }
  .user-row-view { padding: 14px 18px; }
  .user-avatar { width: 44px; height: 44px; font-size: 15px; }
}

/* ============================================================
   MEMBER DASHBOARD — mobile-first
   ============================================================ */
.dashboard { padding-bottom: 100px; }   /* clear bottomtab */

.dash-greeting { margin: 8px 0 16px; }
.dash-greeting h1 { margin: 0; font-size: 1.375rem; line-height: 1.2; }
.dash-greeting p  { margin: 4px 0 0; }
@media (min-width: 768px) {
  .dash-greeting h1 { font-size: 1.75rem; }
}

.dash-kpi {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 12px;
  margin-bottom: 8px;
}
.dash-kpi-cell { text-align: center; padding: 6px 4px; }
.dash-kpi-num { font-size: 1.5rem; font-weight: 700; line-height: 1.1; margin-top: 2px; }
@media (min-width: 480px) { .dash-kpi-num { font-size: 1.75rem; } }
.dash-privacy { margin: 0 4px 20px; opacity: .85; }

/* Hero card — biggest CTA on the page */
.dash-hero {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 16px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.dash-hero-resume { border-left: 4px solid var(--c-warn); }
.dash-hero-rest   { background: var(--c-surface-2); }
.dash-hero-meta   { margin-bottom: 14px; }
.dash-hero-tag {
  display: inline-block;
  background: var(--c-primary-soft); color: var(--c-primary);
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
  padding: 3px 10px; border-radius: 999px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.dash-hero-tag-new {
  background: var(--c-accent-lime); color: var(--c-primary);
}
.dash-hero-title {
  margin: 4px 0 6px; font-size: 1.125rem; line-height: 1.3;
}
@media (min-width: 768px) {
  .dash-hero-title { font-size: 1.25rem; }
}
.dash-hero-cta { margin-top: 12px; display: block; }
.dash-hero-cta button { width: 100%; }

/* Section heading */
.dash-section { margin-bottom: 20px; }
.dash-section-title {
  font-size: .8125rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--c-text-muted);
  margin: 0 0 10px;
}

/* Compact list item (more quizzes, recent) */
.dash-item {
  display: block;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  margin-bottom: 8px;
  text-decoration: none; color: inherit;
  min-height: 56px;
}
.dash-item:hover, .dash-item:active {
  background: var(--c-surface-2);
  text-decoration: none;
}
.dash-item-body { display: flex; flex-direction: column; gap: 2px; }
.dash-item-title { font-weight: 600; font-size: .9375rem; color: var(--c-text); }
.dash-item-form { margin: 0; }
.dash-item-btn {
  width: 100%; text-align: left;
  font: inherit; cursor: pointer;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  padding: 12px 14px;
}
.dash-item-form .dash-item-btn { margin-bottom: 8px; }

/* ============================================================
   ADMIN HOME — KPI cards
   ============================================================ */
.admin-home { padding-bottom: 100px; }
.ah-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
@media (min-width: 600px) { .ah-kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .ah-kpi-grid { grid-template-columns: repeat(5, 1fr); gap: 14px; } }

.ah-kpi-card {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 14px;
  text-decoration: none; color: inherit;
  min-height: 96px;
}
.ah-kpi-card:hover { box-shadow: var(--shadow-sm); text-decoration: none; }
.ah-kpi-card.is-warn { border-color: var(--c-warn); background: var(--c-warn-soft); }
.ah-kpi-label {
  font-size: .75rem; font-weight: 600;
  color: var(--c-text-muted);
  text-transform: uppercase; letter-spacing: .04em;
}
.ah-kpi-num { font-size: 1.75rem; font-weight: 700; line-height: 1; margin: 4px 0 2px; }
.ah-kpi-link { font-size: .8125rem; color: var(--c-primary); margin-top: auto; }

.ah-quick-actions {
  display: flex; flex-direction: column; gap: 8px;
}
@media (min-width: 600px) {
  .ah-quick-actions { flex-direction: row; flex-wrap: wrap; }
  .ah-quick-actions .btn { flex: 1 1 200px; }
}

/* ============================================================
   ADMIN HANDBOOK — chapter list
   ============================================================ */
.ah-handbook { padding-bottom: 100px; }
.ah-handbook-title { font-size: 1.5rem; line-height: 1.25; margin: 0; word-break: break-word; }
@media (min-width: 768px) { .ah-handbook-title { font-size: 1.75rem; } }

.ah-chapter { margin-bottom: 24px; }
.ah-chapter-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 10px;
  padding-bottom: 6px; border-bottom: 1px solid var(--c-border);
}
.ah-chapter-title {
  font-size: 1rem; font-weight: 700; line-height: 1.3;
  margin: 0; color: var(--c-text);
  flex: 1; min-width: 0; word-break: break-word;
}
@media (min-width: 768px) { .ah-chapter-title { font-size: 1.125rem; } }

.ah-section-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  margin-bottom: 6px;
  text-decoration: none; color: inherit;
  min-height: 56px;
}
.ah-section-card:hover, .ah-section-card:active {
  background: var(--c-surface-2);
  text-decoration: none;
}
.ah-section-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ah-section-title { font-weight: 600; font-size: .9375rem; word-break: break-word; }
.ah-section-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .75rem; }
.ah-section-chev { color: var(--c-text-muted); font-size: 24px; line-height: 1; flex-shrink: 0; }

.ah-pill {
  display: inline-block;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
}
.ah-pill-pub   { background: var(--c-success-soft); color: var(--c-success-fg); }
.ah-pill-draft { background: var(--c-surface-2); color: var(--c-text-muted); }

/* ============================================================
   GRADING QUEUE — stacked form, quick-score chips
   ============================================================ */
.grading { padding-bottom: 100px; }
.grading-empty {
  text-align: center; padding: 48px 16px;
  background: var(--c-surface);
  border: 1px dashed var(--c-border-strong);
  border-radius: var(--r-md);
}
.grading-empty-emoji { font-size: 3rem; line-height: 1; margin-bottom: 12px; }
.grading-empty h2 { margin: 0 0 4px; font-size: 1.125rem; }

.grading-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 16px;
  margin-bottom: 16px;
  display: flex; flex-direction: column; gap: 14px;
}
.grading-card-head {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.grading-points { font-size: .8125rem; color: var(--c-text-muted); font-weight: 600; }
.grading-meta { flex: 1 1 100%; margin-top: 4px; }
@media (min-width: 600px) { .grading-meta { flex: 0 1 auto; margin-top: 0; margin-left: auto; } }

.grading-prompt { font-weight: 500; }
.grading-answer {
  background: var(--c-surface-2);
  border-left: 3px solid var(--c-primary);
  padding: 12px 14px; border-radius: var(--r-sm);
}
.grading-label {
  font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--c-text-muted); margin-bottom: 4px;
}
.grading-text { white-space: pre-wrap; word-break: break-word; }

.grading-aux > summary {
  cursor: pointer; font-size: .8125rem; font-weight: 600; color: var(--c-text-muted);
  padding: 6px 0;
}

.grading-ai {
  background: var(--c-info-soft, #e7f0ff);
  border: 1px solid var(--c-info-fg, #3b82f6);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.grading-ai-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.grading-ai-score { font-size: 1.125rem; font-weight: 700; color: var(--c-info-fg, #1e40af); }
.grading-ai-feedback, .grading-ai-reason { margin: 0; }
.grading-ai-cta { margin-top: 6px; }

.grading-form { display: flex; flex-direction: column; gap: 12px; }
.grading-quick { display: flex; flex-direction: column; gap: 6px; }
.grading-quick-label { font-weight: 600; }
.grading-quick-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.grading-quick-chips .ai-chip { min-width: 56px; }
.grading-field { display: flex; flex-direction: column; gap: 6px; }
.grading-field span { font-size: .875rem; font-weight: 600; }
.grading-field input {
  min-height: 48px; padding: 10px 14px;
  font: inherit; font-size: 16px;
  border: 1px solid var(--c-border-strong); border-radius: 8px;
  background: var(--c-surface);
}
.grading-score-input { font-weight: 700; font-size: 18px !important; text-align: center; }

/* ============================================================
   QUIZ EDIT (admin) — settings + per-question inline edit
   ============================================================ */
.quiz-edit { padding-bottom: 100px; }
.qe-settings {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 12px 16px;
  margin-bottom: 24px;
}
.qe-settings > summary {
  cursor: pointer; list-style: none; min-height: 40px; display: flex; align-items: center;
  font-weight: 600;
}
.qe-settings > summary::-webkit-details-marker { display: none; }
.qe-settings-form { padding-top: 12px; }
.qe-grid-2 {
  display: grid; grid-template-columns: 1fr; gap: 12px;
}
@media (min-width: 480px) { .qe-grid-2 { grid-template-columns: 1fr 1fr; } }

.qe-questions { margin-top: 8px; }
.qe-questions-title { font-size: 1.125rem; margin: 0 0 12px; }

.qe-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 14px;
  margin-bottom: 12px;
  transition: background-color .35s ease;
}
.qe-card.qe-flash { background: var(--c-success-soft); }

.qe-card-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding-bottom: 10px; border-bottom: 1px solid var(--c-border);
  margin-bottom: 12px;
}
.qe-num { font-weight: 700; font-size: .875rem; color: var(--c-primary); }
.qe-points { font-size: .75rem; color: var(--c-text-muted); font-weight: 600; }
.qe-type { font-size: 10px; }

.qe-prompt { font-weight: 500; margin-bottom: 8px; }

.qe-choices {
  list-style: none; padding: 0; margin: 8px 0;
  display: flex; flex-direction: column; gap: 4px;
}
.qe-choices li {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px 10px; border-radius: 6px;
  background: var(--c-surface-2);
  font-size: .9375rem;
}
.qe-choices li.is-correct {
  background: var(--c-success-soft); color: var(--c-success-fg);
  font-weight: 600;
}
.qe-choice-mark { flex-shrink: 0; font-weight: 700; min-width: 14px; }

.qe-aux > summary { cursor: pointer; font-size: .8125rem; color: var(--c-text-muted); padding: 6px 0; }
.qe-aux .prose { padding: 8px 0 0; }

.qe-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding-top: 12px; border-top: 1px solid var(--c-border);
  margin-top: 12px;
}
.qe-actions .btn-ghost.danger { color: var(--c-danger); }
.qe-actions .btn-ghost.danger:hover { background: rgba(192,57,43,.08); }

/* Inline edit form */
.qe-edit { display: contents; }
.qe-edit-form {
  display: flex; flex-direction: column; gap: 12px;
  padding-top: 8px;
}
.qe-field { display: flex; flex-direction: column; gap: 6px; }
.qe-field span, .qe-field-label {
  font-size: .8125rem; font-weight: 600; color: var(--c-text);
}
.qe-field input[type="text"],
.qe-field input[type="number"],
.qe-field textarea {
  width: 100%; min-height: 44px;
  padding: 10px 12px;
  font: inherit; font-size: 16px;
  border: 1px solid var(--c-border-strong); border-radius: 6px;
  background: var(--c-surface);
}
.qe-field textarea { min-height: 80px; line-height: 1.5; resize: vertical; }

.qe-edit-choices {
  display: flex; flex-direction: column; gap: 8px;
  margin: 4px 0 8px;
}
.qe-choice-row {
  display: flex; align-items: center; gap: 10px;
}
.qe-choice-row input[type="checkbox"] {
  width: 24px; height: 24px; flex-shrink: 0;
  accent-color: var(--c-primary);
}
.qe-choice-row input[type="text"] {
  flex: 1; min-height: 44px; padding: 8px 12px;
  border: 1px solid var(--c-border-strong); border-radius: 6px;
  font: inherit; font-size: 16px;
}

.qe-edit-actions {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding-top: 8px; border-top: 1px solid var(--c-border);
  margin-top: 4px;
}
.qe-edit-status { flex: 1; min-width: 100px; }
.qe-edit-status.error { color: var(--c-danger); }

/* Add-question form (already-existing) — tighten on mobile */
.qe-add-form {
  background: var(--c-surface);
  border: 1px dashed var(--c-border-strong);
  border-radius: var(--r-md);
  padding: 12px 16px;
  margin-top: 16px;
}
.qe-add-form > summary {
  cursor: pointer; list-style: none; font-weight: 600; min-height: 44px;
  display: flex; align-items: center;
}
.qe-add-form > summary::-webkit-details-marker { display: none; }

/* ============================================================
   AI QUIZ GENERATION — mobile-first
   ============================================================ */
.ai-gen-container { max-width: 760px; padding-bottom: 120px; }
.ai-gen-head { margin-bottom: 16px; }
.ai-gen-head h1 { margin: 0 0 4px; font-size: 1.5rem; }
@media (min-width: 768px) {
  .ai-gen-head h1 { font-size: 1.75rem; }
}

.ai-gen-form { gap: 16px; }
.ai-block {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 14px;
}
@media (min-width: 768px) {
  .ai-block { padding: 18px; }
}
.ai-block + .ai-block { /* gap handled by .form, but tighten heading spacing */ }
.ai-block-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 10px;
}
.ai-block-head h2 {
  margin: 0; font-size: .9375rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
  color: var(--c-text-muted);
}

/* ---- Search input ---- */
.ai-search {
  width: 100%; min-height: 44px;
  padding: 10px 14px;
  font: inherit; font-size: 16px;
  border: 1px solid var(--c-border-strong); border-radius: 8px;
  background: var(--c-surface-2); color: var(--c-text);
  margin-bottom: 10px;
}
.ai-search:focus {
  outline: 2px solid var(--c-focus); outline-offset: 1px;
}

/* ---- Chip row (select all, presets) ---- */
.ai-quick-row {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.ai-chip {
  flex-shrink: 0;
  min-height: 36px; padding: 6px 14px;
  font: inherit; font-size: 13px; font-weight: 600;
  background: var(--c-surface-2); color: var(--c-text);
  border: 1px solid var(--c-border-strong); border-radius: 999px;
  cursor: pointer;
}
.ai-chip:hover { background: var(--c-surface); }
.ai-chip.is-active {
  background: var(--c-primary); color: white; border-color: var(--c-primary);
}

/* ---- Section picker (chapter-grouped) ---- */
/* DESIGN NOTE: no inner scroll. The picker grows with content and the page
   scrolls naturally. Nested scroll containers are unreliable on iOS Safari
   (they steal/leak gestures) and get covered by the sticky submit bar. */
.sec-picker {
  display: flex; flex-direction: column; gap: 10px;
  padding: 0;
}
.chap-group {
  border: 1px solid var(--c-border);
  border-radius: 10px;
  background: var(--c-surface);
  overflow: hidden;
}
.chap-summary {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 14px 14px;
  cursor: pointer; min-height: 56px;
  font-weight: 700; font-size: 15px;
  list-style: none;
  background: var(--c-primary-soft);
  color: var(--c-primary);
}
.chap-summary::-webkit-details-marker { display: none; }
.chap-summary::before {
  content: '▶'; font-size: 11px;
  margin-right: 4px; flex-shrink: 0;
  transition: transform .15s ease;
  opacity: .7;
}
.chap-group[open] > .chap-summary::before { transform: rotate(90deg); }
/* Allow long chapter titles to wrap on mobile instead of clipping */
.chap-title {
  flex: 1; min-width: 0;
  word-break: break-word;
  line-height: 1.35;
}
.chap-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700;
  flex-shrink: 0;
}
.chap-count { min-width: 14px; text-align: right; }
.chap-pick-all {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--c-surface); border: 1px solid var(--c-primary);
  font: inherit; font-size: 18px; font-weight: 700; line-height: 1;
  color: var(--c-primary); cursor: pointer;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
}
.chap-pick-all:hover, .chap-pick-all:active { background: var(--c-primary); color: white; }
.chap-sections {
  display: flex; flex-direction: column;
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
}
.sec-check {
  display: flex;
  /* Override .form label { flex-direction: column } — keep checkbox + text inline */
  flex-direction: row !important;
  align-items: flex-start; gap: 14px;
  padding: 14px 16px; min-height: 56px;
  border-bottom: 1px solid var(--c-border);
  cursor: pointer; line-height: 1.45;
}
.sec-check:last-child { border-bottom: 0; }
.sec-check:hover { background: var(--c-surface-2); }
.sec-check:has(input:checked) { background: var(--c-primary-soft); }
.sec-check input[type="checkbox"] {
  width: 24px; height: 24px; accent-color: var(--c-primary);
  flex-shrink: 0; margin-top: 1px;
}
.sec-picker .sec-check > span {
  flex: 1; min-width: 0;
  /* Override .form label > span (0.875rem). Bangla needs the room and 16px
     also prevents iOS Safari from auto-zooming when the input next to it gets focus. */
  font-size: 16px !important;
  font-weight: 500;
  word-break: break-word;
  color: var(--c-text);
}
.sec-picker .chap-summary { font-size: 15px !important; }
.sec-picker .chap-meta { font-size: 13px !important; }
/* Bangla typography: a hair larger + tighter line-height so 16px diacritics breathe */
body.locale-bn .sec-check span,
body.locale-bn .chap-summary { line-height: 1.55; }

/* ---- Stepper (-/+ for numbers) ---- */
.stepper {
  display: flex; align-items: stretch;
  border: 1px solid var(--c-border-strong); border-radius: 8px;
  overflow: hidden; background: var(--c-surface);
}
.stepper-btn {
  width: 48px; min-height: 48px; flex-shrink: 0;
  background: var(--c-surface-2); color: var(--c-text);
  border: 0; font: inherit; font-size: 22px; font-weight: 700; line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
}
.stepper-btn:active { background: var(--c-primary-soft); color: var(--c-primary); }
.stepper input {
  flex: 1; min-width: 0; min-height: 48px;
  border: 0; padding: 0 14px;
  font: inherit; font-size: 18px; font-weight: 700; text-align: center;
  background: transparent; color: var(--c-text);
  /* Hide spinners */
  appearance: textfield;
  -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { outline: 2px solid var(--c-focus); outline-offset: -2px; }

/* ---- Segmented radio control ---- */
.seg-group { border: 0; padding: 0; margin: 12px 0 0; }
.seg-group legend {
  font-size: .875rem; font-weight: 600; color: var(--c-text);
  margin-bottom: 6px; padding: 0;
}
.seg-control {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.seg-item {
  flex: 1 1 calc(50% - 3px);
  min-height: 44px;
  display: flex; align-items: center; justify-content: center;
  padding: 8px 12px;
  border: 1px solid var(--c-border-strong); border-radius: 8px;
  background: var(--c-surface); color: var(--c-text-muted);
  font-weight: 600; font-size: 14px;
  cursor: pointer; text-align: center;
}
.seg-item input { display: none; }
.seg-item.is-active {
  background: var(--c-primary); color: white;
  border-color: var(--c-primary);
}
@media (min-width: 480px) {
  .seg-item { flex: 1 1 0; }   /* equal width on wider screens */
}

/* ---- Manual mix grid (2 cols on phone, 5 cols on desktop) ---- */
.ai-advanced { margin-top: 12px; }
.ai-advanced summary {
  cursor: pointer; padding: 10px 12px;
  background: var(--c-surface-2); border: 1px solid var(--c-border);
  border-radius: 8px; font-weight: 600; font-size: 14px;
  list-style: none; min-height: 44px; display: flex; align-items: center;
}
.ai-advanced summary::-webkit-details-marker { display: none; }
.ai-advanced[open] summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }

.mix-grid {
  display: grid; gap: 10px;
  grid-template-columns: 1fr 1fr;
  padding: 12px;
  background: var(--c-surface);
  border: 1px solid var(--c-border); border-top: 0;
  border-radius: 0 0 8px 8px;
}
@media (min-width: 700px) {
  .mix-grid { grid-template-columns: repeat(5, 1fr); }
}
.mix-cell { display: flex; flex-direction: column; gap: 4px; }
.mix-label { font-size: 12px; font-weight: 600; color: var(--c-text-muted); }
.mix-cell input {
  min-height: 44px; padding: 8px 10px;
  font: inherit; font-size: 16px; text-align: center;
  border: 1px solid var(--c-border-strong); border-radius: 6px;
  background: var(--c-surface);
}

/* ---- Dual grid (time + pass) ---- */
.dual-grid {
  display: grid; gap: 12px;
  grid-template-columns: 1fr;
}
@media (min-width: 480px) {
  .dual-grid { grid-template-columns: 1fr 1fr; }
}

/* ---- Sticky submit bar ---- */
.ai-submit-bar {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--c-surface);
  padding: 12px 14px;
  border: 1px solid var(--c-border-strong); border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
}
.ai-submit-info { text-align: center; }
.btn-lg { min-height: 56px; font-size: 1rem; font-weight: 700; }

/* On mobile, pin the submit bar to the bottom of the viewport (above the bottomtab) */
@media (max-width: 1023px) {
  .ai-submit-bar {
    position: fixed;
    left: 8px; right: 8px;
    bottom: calc(72px + env(safe-area-inset-bottom, 8px));  /* clear the bottomtab */
    z-index: 55;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(10,10,10,.18);
  }
  .ai-gen-container { padding-bottom: 180px; }
}

/* ---- Generation progress overlay ---- */
.gen-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(13, 59, 46, .92);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.gen-overlay[hidden] { display: none; }
.gen-overlay-card {
  background: var(--c-surface);
  border-radius: 16px; padding: 32px 24px;
  text-align: center; max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.gen-overlay-card h3 { margin: 16px 0 8px; font-size: 1.125rem; }
.gen-overlay-card p { margin: 4px 0; }
.gen-spinner {
  width: 48px; height: 48px; margin: 0 auto;
  border: 4px solid var(--c-border);
  border-top-color: var(--c-primary);
  border-radius: 50%;
  animation: gen-spin 1s linear infinite;
}
@keyframes gen-spin { to { transform: rotate(360deg); } }
.topnav-inner {
  max-width: 1200px; margin: 0 auto; padding: 14px 16px;
  display: flex; align-items: center; gap: 16px;
  min-height: 64px;
}
@media (min-width: 768px) {
  .topnav-inner { padding: 14px 24px; min-height: 72px; }
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--c-text); font-weight: 700; font-size: 16px; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--c-primary);
  color: var(--c-accent-lime);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; letter-spacing: .04em;
}
.brand-mark-lg { width: 64px; height: 64px; border-radius: 14px; font-size: 22px; }
.brand-name { display: none; }
@media (min-width: 480px) { .brand-name { display: inline; } }

.topnav-links { display: none; gap: 4px; align-items: center; flex: 1; }
.topnav-links a {
  color: var(--c-text-muted); padding: 8px 12px; border-radius: var(--r-sm);
  font-weight: 500; font-size: .9375rem;
  text-decoration: none;
}
.topnav-links a:hover { background: var(--c-surface-2); color: var(--c-text); }
.topnav-links a.active { background: var(--c-primary-soft); color: var(--c-primary); font-weight: 600; }
.nav-sep { width: 1px; height: 18px; background: var(--c-border); margin: 0 6px; }
@media (min-width: 1024px) { .topnav-links { display: flex; } }

.topnav-user { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.user-name { display: none; color: var(--c-text-muted); font-size: .875rem; text-decoration: none; }
.user-name:hover { color: var(--c-text); text-decoration: underline; }
@media (min-width: 480px) { .user-name { display: inline; } }
.hamburger {
  background: none; border: 1px solid var(--c-border-strong); border-radius: var(--r-sm);
  padding: 8px 12px; font-size: 18px; cursor: pointer; min-height: 40px;
}
@media (min-width: 1024px) { .hamburger { display: none; } }

.topnav-links.open {
  display: flex; flex-direction: column; align-items: stretch;
  position: absolute; top: 64px; left: 0; right: 0;
  background: var(--c-surface); padding: 12px 16px;
  border-bottom: 1px solid var(--c-border); box-shadow: var(--shadow-md);
  gap: 0;
}
.topnav-links.open a { padding: 14px 12px; border-radius: var(--r-sm); min-height: 48px; }

/* Language pill in nav */
.lang-pill {
  display: inline-flex; gap: 0; border: 1px solid var(--c-border-strong);
  border-radius: 999px; overflow: hidden; background: var(--c-surface);
}
.lang-pill button {
  border: 0; padding: 6px 14px; font-size: .8125rem; cursor: pointer;
  background: transparent; color: var(--c-text-muted); font-family: inherit;
}
.lang-pill button.active { background: var(--c-primary); color: white; font-weight: 600; }

/* ============================================================
   BOTTOM TAB BAR (mobile only)
   ============================================================ */
.bottomtab {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  background: var(--c-surface); border-top: 1px solid var(--c-border-strong);
  display: flex; justify-content: space-around;
  padding: 8px 4px env(safe-area-inset-bottom, 8px);
  box-shadow: 0 -4px 12px rgba(10, 10, 10, .04);
}
.bottomtab a {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  gap: 2px; padding: 8px 4px; min-height: 56px;
  color: var(--c-text-muted); text-decoration: none;
  font-size: .75rem; font-weight: 500; letter-spacing: -.005em;
}
.bottomtab a .icon { font-size: 22px; line-height: 1; }
.bottomtab a.active { color: var(--c-primary); font-weight: 700; }
.bottomtab a.active .icon { transform: scale(1.05); }
body.locale-bn .bottomtab a { font-size: .8125rem; }

/* Hide topnav links on mobile when bottomtab is shown */
@media (max-width: 1023px) {
  .page { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0)); }
}
@media (min-width: 1024px) { .bottomtab { display: none; } }

/* ============================================================
   PAGE / CONTAINERS
   ============================================================ */
.page { padding: 16px; max-width: 1200px; margin: 0 auto; }
@media (min-width: 768px) { .page { padding: 24px 32px; } }

.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 768px) { .container { padding: 0 24px; } }
.container.narrow { max-width: 720px; }
.container-reading { max-width: 720px; margin: 0 auto; padding: 0 16px; position: relative; }
@media (min-width: 768px) { .container-reading { padding: 0 24px; } }

.page-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 24px;
}
.page-header h1 { margin: 0; }

/* ============================================================
   BUTTONS — sizes per spec (sm 40, md 48, lg 56, xl 64)
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 0 20px; min-height: 48px;
  border: 1px solid transparent; border-radius: var(--r-md);
  font: inherit; font-weight: 600; font-size: 1rem;
  cursor: pointer; text-decoration: none;
  transition: background .15s, transform .05s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary { background: var(--c-primary); color: white; border-color: var(--c-primary); }
.btn-primary:hover { background: var(--c-primary-dark); text-decoration: none; }
.btn-secondary { background: var(--c-surface); color: var(--c-text); border-color: var(--c-border-strong); }
.btn-secondary:hover { background: var(--c-surface-2); }
.btn-ghost { background: transparent; color: var(--c-primary); }
.btn-ghost:hover { background: var(--c-primary-soft); text-decoration: none; }
.btn-danger { background: var(--c-danger); color: white; border-color: var(--c-danger); }

.btn-sm { min-height: 40px; font-size: .875rem; padding: 0 14px; }
.btn-md { min-height: 48px; }
.btn-lg { min-height: 56px; padding: 0 28px; font-size: 1.0625rem; }
.btn-xl { min-height: 64px; padding: 0 32px; font-size: 1.125rem; font-weight: 700; }

.btn-block { width: 100%; }

/* ============================================================
   FORMS
   ============================================================ */
.form { display: flex; flex-direction: column; gap: 16px; }
.form label { display: flex; flex-direction: column; gap: 6px; }
.form label > span { font-size: .875rem; font-weight: 600; color: var(--c-text); }
.form input[type="text"],
.form input[type="email"],
.form input[type="password"],
.form input[type="number"],
.form input[type="tel"],
.form input[type="date"],
.form input[type="datetime-local"],
.form select,
.form textarea {
  font: inherit; font-size: 1rem; padding: 12px 14px; min-height: 48px;
  border: 1px solid var(--c-border-strong); border-radius: var(--r-sm);
  background: var(--c-surface); color: var(--c-text);
  width: 100%;
}
.form textarea { min-height: 96px; line-height: 1.5; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus {
  outline: 2px solid var(--c-focus); outline-offset: 1px; border-color: var(--c-focus);
}
.form-row, .row {
  display: grid; gap: 12px;
}
@media (min-width: 600px) {
  .form-row { grid-template-columns: 1fr 1fr; }
}
.row { display: flex; align-items: center; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-md); padding: 16px; box-shadow: var(--shadow-sm);
}
@media (min-width: 768px) { .card { padding: 24px; } }
.card-link {
  display: flex; align-items: center; justify-content: space-between;
  text-decoration: none; color: inherit; gap: 16px;
  transition: transform .1s, box-shadow .15s;
  margin-bottom: 12px;
}
.card-link:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); text-decoration: none; }
.card-title { font-weight: 600; font-size: 1rem; color: var(--c-text); margin-bottom: 4px; }
.card-sub { font-size: .8125rem; color: var(--c-text-muted); }
.card-inset { background: var(--c-surface-2); padding: 12px 14px; border-radius: var(--r-sm); font-size: .9375rem; }
.chev { color: var(--c-text-muted); font-size: 14px; }

/* ============================================================
   PILLS / BADGES
   ============================================================ */
.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: .75rem; font-weight: 700; letter-spacing: .02em;
  text-transform: uppercase;
}
.pill-draft     { background: #E5E5E0; color: #525252; }
.pill-scheduled { background: var(--c-info-soft); color: var(--c-info-fg); }
.pill-open      { background: var(--c-success-soft); color: var(--c-success-fg); }
.pill-closed    { background: #E5E5E0; color: #525252; }
.pill-type      { background: var(--c-primary-soft); color: var(--c-primary); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .6875rem; font-weight: 600; vertical-align: middle; margin-left: 6px; }
.badge-ok   { background: var(--c-success-soft); color: var(--c-success-fg); }
.badge-warn { background: var(--c-warn-soft); color: var(--c-warn); }
.badge-info { background: var(--c-info-soft); color: var(--c-info-fg); }

/* ============================================================
   ALERTS
   ============================================================ */
.alert { padding: 14px 16px; border-radius: var(--r-md); margin-bottom: 16px; font-size: .9375rem; }
.alert-success { background: var(--c-success-soft); color: var(--c-success-fg); border-left: 3px solid var(--c-success); }
.alert-warn    { background: var(--c-warn-soft); color: var(--c-warn); border-left: 3px solid var(--c-warn); }
.alert-error   { background: var(--c-danger-soft); color: var(--c-danger); border-left: 3px solid var(--c-danger); }
.alert-info    { background: var(--c-info-soft); color: var(--c-info-fg); border-left: 3px solid var(--c-info-fg); }

/* ============================================================
   AUTH SHELL
   ============================================================ */
.auth-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px 16px; background: var(--c-bg);
}
.auth-card {
  width: 100%; max-width: 420px; background: var(--c-surface);
  border: 1px solid var(--c-border); border-radius: var(--r-lg);
  padding: 32px 24px; box-shadow: var(--shadow-md);
}
@media (min-width: 480px) { .auth-card { padding: 40px 32px; } }
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-brand h1 { font-size: 1.75rem; margin: 12px 0 6px; }
.auth-brand .brand-mark-lg { display: inline-flex; }
.auth-help { text-align: center; }

/* ============================================================
   PROSE (handbook reading)
   ============================================================ */
.prose {
  font-size: calc(1.0625rem * var(--prose-scale, 1));   /* 17px × scale, mobile */
  line-height: 1.7;
  color: var(--c-text);
}
@media (min-width: 768px) { .prose { font-size: calc(1.125rem * var(--prose-scale, 1)); line-height: 1.7; } }
.prose img { max-width: 100%; height: auto; border-radius: var(--r-sm); cursor: zoom-in; }

/* Notion-style callout blocks (markdown ::: info / :::tip / :::warn / :::danger) */
.callout {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; margin: 16px 0; border-radius: 8px;
  border-left: 4px solid; background: var(--c-surface-2);
}
.callout-icon { font-size: 1.25rem; line-height: 1.2; flex-shrink: 0; padding-top: 1px; }
.callout-body { flex: 1; min-width: 0; }
.callout-title { font-weight: 700; margin-bottom: 4px; color: var(--c-text); font-size: 1rem; }
.callout-content > p:last-child { margin-bottom: 0; }
.callout-content > p:first-child { margin-top: 0; }
.callout-info   { background: #DBEAFE; border-left-color: #1E40AF; }
.callout-info   .callout-title { color: #1E3A8A; }
.callout-tip    { background: #DCFCE7; border-left-color: #15803D; }
.callout-tip    .callout-title { color: #14532D; }
.callout-warn   { background: #FEF3C7; border-left-color: #B45309; }
.callout-warn   .callout-title { color: #92400E; }
.callout-danger { background: #FEE2E2; border-left-color: #B91C1C; }
.callout-danger .callout-title { color: #7F1D1D; }
[data-theme="dark"] .callout-info   { background: #172554; }
[data-theme="dark"] .callout-tip    { background: #052E16; }
[data-theme="dark"] .callout-warn   { background: #451A03; }
[data-theme="dark"] .callout-danger { background: #450A0A; }

/* Footnote popovers (markdown-it-footnote) */
.footnote-ref { font-size: .8em; vertical-align: super; line-height: 0; }
.footnote-ref a { background: var(--c-primary-soft); color: var(--c-primary); padding: 1px 6px; border-radius: 4px; text-decoration: none; }
.footnote-ref a:hover { background: var(--c-primary); color: white; }
.footnotes { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--c-border); font-size: .9375rem; color: var(--c-text-muted); }
.footnotes ol { padding-left: 24px; }
.footnotes li { margin-bottom: 8px; }
.footnote-backref { margin-left: 6px; text-decoration: none; }

.prose h1, .prose h2, .prose h3 { font-family: var(--font-ui); margin-top: 1.75em; }
.prose h2 { font-size: 1.375rem; margin: 2em 0 .65em; }
.prose h3 { font-size: 1.125rem; margin: 1.5em 0 .5em; }
.prose p { margin: 0 0 1em; }
.prose ul, .prose ol { padding-left: 24px; margin: 0 0 1em; }
.prose li { margin-bottom: .35em; }
.prose strong { font-weight: 700; color: var(--c-text); }
.prose a { color: var(--c-primary); text-decoration: underline; text-underline-offset: 2px; }
.prose blockquote {
  border-left: 3px solid var(--c-primary); padding: 4px 16px;
  margin: 1em 0; color: var(--c-text-muted); background: var(--c-primary-soft);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}

.q-prompt { font-family: var(--font-ui); font-size: 1.0625rem; line-height: 1.55; color: var(--c-text); }
body.locale-bn .q-prompt { font-family: var(--font-bn); line-height: 1.75; }
.q-prompt p:last-child { margin-bottom: 0; }

/* Reading page progress bar (top sticky) */
.reading-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: var(--c-primary); z-index: 70;
  transition: width .15s linear;
}
.reading-foot { padding: 32px 0 96px; text-align: center; border-top: 1px solid var(--c-border); margin-top: 32px; color: var(--c-text-muted); font-size: .875rem; }
.back-link { display: inline-block; margin: 16px 0; color: var(--c-text-muted); font-size: .875rem; }

/* Section "Mark as read" toggle */
.mark-read {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 8px;
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--c-border-strong);
  background: var(--c-surface); color: var(--c-text-muted); cursor: pointer; font-size: .875rem;
}
.mark-read.done { background: var(--c-success-soft); color: var(--c-success-fg); border-color: var(--c-success); }
.mark-read.done::before { content: "✓ "; }

/* End-of-chapter sticky CTA — sits above the bottomtab on mobile */
.endchapter-cta {
  position: fixed; left: 0; right: 0;
  /* bottomtab is ~72-80px tall; clear it + safe area on iPhone notched devices */
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  z-index: var(--z-cta);
  background: linear-gradient(to top, rgba(245,242,237,1) 60%, rgba(245,242,237,0));
  padding: 12px 16px 16px;
  display: flex; justify-content: center;
  pointer-events: none;
}
.endchapter-cta .btn { pointer-events: auto; box-shadow: var(--shadow-lg); }
@media (min-width: 1024px) { .endchapter-cta { bottom: 16px; } }

/* ============================================================
   QUIZ — one question per screen
   ============================================================ */
.quiz-stage {
  max-width: 640px; margin: 0 auto; padding: 16px;
}
.quiz-progress-dots {
  display: flex; gap: 6px; justify-content: center; margin: 8px 0 24px;
}
.quiz-progress-dots span {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--c-border-strong);
}
.quiz-progress-dots span.done   { background: var(--c-primary); }
.quiz-progress-dots span.current{ background: var(--c-primary); transform: scale(1.25); }

.quiz-counter { text-align: center; font-size: .875rem; color: var(--c-text-muted); margin-bottom: 8px; }
.quiz-stem {
  font-size: 1.25rem; line-height: 1.5; font-weight: 600;
  margin: 12px 0 24px; color: var(--c-text);
}
body.locale-bn .quiz-stem { line-height: 1.75; font-size: 1.1875rem; }

/* Stacked answer buttons (≥56px tall, full width) */
.answer-list { display: grid; gap: 12px; margin-bottom: 24px; }
.answer-btn {
  display: flex; align-items: flex-start; gap: 12px;
  width: 100%; min-height: 56px; padding: 14px 16px;
  background: var(--c-surface); border: 2px solid var(--c-border-strong);
  border-radius: var(--r-md); text-align: left; font: inherit;
  font-size: 1rem; line-height: 1.45; color: var(--c-text); cursor: pointer;
  transition: background .15s, border-color .15s;
}
.answer-btn:hover { background: var(--c-surface-2); border-color: var(--c-text-muted); }
.answer-btn.selected { border-color: var(--c-primary); background: var(--c-primary-soft); }
.answer-btn.correct { border-color: var(--c-success); background: var(--c-success-soft); color: var(--c-success-fg); }
.answer-btn.wrong   { border-color: var(--c-warn); background: var(--c-warn-soft); color: var(--c-warn); }
.answer-btn .marker {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%; font-weight: 700; font-size: .8125rem;
  flex-shrink: 0; background: var(--c-border); color: var(--c-text);
}
.answer-btn.correct .marker { background: var(--c-success); color: white; }
.answer-btn.wrong .marker   { background: var(--c-warn); color: white; }
@media (min-width: 768px) {
  .answer-btn { min-height: 64px; }
}

.quiz-feedback {
  background: var(--c-primary-soft); border-radius: var(--r-md);
  padding: 14px 16px; margin-bottom: 16px; font-size: .9375rem;
}
.quiz-feedback.correct { background: var(--c-success-soft); color: var(--c-success-fg); }
.quiz-feedback.wrong   { background: var(--c-warn-soft); color: var(--c-warn); }
.quiz-feedback a { color: inherit; font-weight: 600; }

.privacy-footer {
  position: sticky; bottom: 16px; margin-top: 24px;
  font-size: .75rem; color: var(--c-text-muted); text-align: center;
}

/* Result screen — descriptive band */
.result-circle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 140px; height: 140px; border-radius: 50%;
  border: 8px solid var(--c-primary); color: var(--c-primary);
  font-size: 2.25rem; font-weight: 800; margin: 16px auto;
}
.result-circle.amber  { border-color: var(--c-warn); color: var(--c-warn); }
.result-circle.green  { border-color: var(--c-success); color: var(--c-success); }
.result-circle.blue   { border-color: var(--c-info-fg); color: var(--c-info-fg); }
.result-band-label {
  font-size: 1.25rem; font-weight: 700; text-align: center; margin: 8px 0 24px;
}

/* ============================================================
   DATA TABLES (admin)
   ============================================================ */
.data-table { width: 100%; border-collapse: collapse; background: var(--c-surface); border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow-sm); }
.data-table th, .data-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--c-border); }
.data-table th { font-size: .75rem; text-transform: uppercase; color: var(--c-text-muted); font-weight: 600; letter-spacing: .04em; background: var(--c-surface-2); }
.data-table tr:last-child td { border-bottom: 0; }
.bar-cell { display: flex; align-items: center; gap: 10px; }
.bar { flex: 1; max-width: 180px; height: 6px; background: var(--c-border); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--c-primary); }

/* Sections / page-header bits */
.section { margin-bottom: 32px; }
.empty-state-sm { padding: 32px 16px; text-align: center; color: var(--c-text-muted); border: 1px dashed var(--c-border-strong); border-radius: var(--r-md); }
/* Full empty-state with emoji + headline + actions */
.empty-state {
  text-align: center;
  padding: 56px 20px 40px;
  margin: 24px auto;
  max-width: 480px;
}
.empty-emoji {
  font-size: 4rem; line-height: 1;
  margin-bottom: 16px;
  opacity: .85;
}
.empty-state h1, .empty-state h2 {
  margin: 0 0 8px;
  font-size: 1.25rem; line-height: 1.3;
  color: var(--c-text);
}
.empty-state p { margin: 0 auto 20px; max-width: 340px; }
.empty-actions {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
  margin-top: 16px;
}
.empty-actions .btn { min-width: 140px; }

/* ============================================================
   HANDBOOK SECTION VERSIONS — version cards
   ============================================================ */
.version-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 14px;
  margin-bottom: 12px;
}
.version-card-head {
  display: flex; flex-direction: column; gap: 8px;
  padding-bottom: 10px; border-bottom: 1px solid var(--c-border);
  margin-bottom: 10px;
}
@media (min-width: 600px) {
  .version-card-head { flex-direction: row; justify-content: space-between; align-items: flex-start; }
}
.version-card-meta { flex: 1; min-width: 0; }
.version-card-num { font-weight: 700; font-size: 1rem; display: flex; gap: 8px; align-items: center; }
.version-card-note { font-style: italic; margin-top: 4px; }
.version-card-stats { white-space: nowrap; }
.version-card-body > summary {
  cursor: pointer; padding: 6px 0;
  font-weight: 600;
}
.version-content { padding-top: 8px; }
.version-content h4 { margin: 12px 0 6px; }
.version-pre {
  /* No inner scroll — page scrolls naturally */
  white-space: pre-wrap; word-break: break-word;
  background: var(--c-surface-2);
  padding: 12px; border-radius: 6px;
  font-size: .8125rem; line-height: 1.55;
  /* Soft cap with fade — but no overflow:auto trap */
  max-height: 50vh; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;       /* keep gesture inside */
}
.version-pre-en { font-family: var(--font-mono); }
.version-pre-bn { font-family: var(--font-bn); font-size: .9375rem; }

/* Question grading-card legacy */
.question-card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-md); padding: 16px 20px; margin-bottom: 16px; }
.q-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; font-size: .875rem; }
.q-points { color: var(--c-text-muted); font-size: .875rem; }
.answer-block { background: var(--c-surface-2); padding: 12px 14px; border-radius: var(--r-sm); margin: 8px 0; }
.answer-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: var(--c-text-muted); margin-bottom: 4px; font-weight: 600; }
.answer-text { white-space: pre-wrap; font-size: .9375rem; }
.form-inline { display: grid; grid-template-columns: 100px 1fr auto; gap: 12px; align-items: end; margin-top: 8px; }
.form-inline label { display: flex; flex-direction: column; gap: 4px; }
.form-inline .grow { grid-column: 2; }
/* On phones, the 3-col grid jams. Stack everything full-width. */
@media (max-width: 600px) {
  .form-inline {
    display: flex; flex-direction: column; align-items: stretch;
    gap: 10px;
  }
  .form-inline .grow { grid-column: auto; }
  .form-inline > button,
  .form-inline > .btn { width: 100%; min-height: 48px; }
  .form-inline label > input,
  .form-inline label > select,
  .form-inline label > textarea { width: 100%; }
}

/* Misc */
.add-form summary { cursor: pointer; font-weight: 600; padding: 12px 0; }
.add-form { margin-bottom: 20px; }

/* Reading view: language switch */
.lang-switch { padding: 6px 0; margin-bottom: 12px; border-bottom: 1px dashed var(--c-border); font-size: .875rem; }

/* Highlight marks */
mark.hl { padding: 0 2px; border-radius: 2px; background: transparent; }
mark.hl-yellow { background: #fef3c7; }
mark.hl-green  { background: #d1fae5; }
mark.hl-pink   { background: #fce7f3; }

/* Annotation toolbar */
.annot-toolbar {
  position: absolute; z-index: 50; display: flex; gap: 4px;
  background: var(--c-text); color: #fff; padding: 6px; border-radius: 8px;
  box-shadow: var(--shadow-lg);
}
.annot-btn {
  background: transparent; border: 0; color: #fff; padding: 6px 10px;
  font-size: 16px; cursor: pointer; border-radius: 4px; min-height: 36px;
}
.annot-btn:hover { background: rgba(255,255,255,.15); }

.note-drawer {
  position: fixed; bottom: 88px; right: 16px; z-index: 100;
  width: min(420px, calc(100vw - 32px));
  background: var(--c-surface); border: 1px solid var(--c-border-strong);
  border-radius: var(--r-md); padding: 16px; box-shadow: var(--shadow-lg);
  transition: background .3s;
}
@media (min-width: 1024px) { .note-drawer { bottom: 24px; right: 24px; } }
.note-drawer h3 { margin: 0 0 8px; font-size: 1rem; }
.note-drawer textarea {
  width: 100%; padding: 10px; border: 1px solid var(--c-border-strong);
  border-radius: var(--r-sm); font: inherit; resize: vertical; min-height: 80px;
}

/* KPI grid + responsive chart wrappers */
.kpi-page { padding-bottom: 100px; }
.kpi-charts { display: grid; gap: 16px; grid-template-columns: 1fr; margin-bottom: 24px; }
@media (min-width: 900px) { .kpi-charts { grid-template-columns: 1fr 1fr; } }
.kpi-chart-title { font-size: .9375rem; margin: 0 0 8px; font-weight: 600; }
.kpi-chart-wrap {
  position: relative;
  width: 100%; height: 220px;        /* fixed height; Chart.js fills */
}
@media (min-width: 768px) { .kpi-chart-wrap { height: 260px; } }
/* Chart.js fills the wrap (responsive: true, maintainAspectRatio: false) */
.kpi-chart-wrap canvas { width: 100% !important; height: 100% !important; }

/* .bar-cell mobile stack (definition is at line 1380; this just stacks on phones) */
@media (max-width: 480px) {
  .bar-cell { flex-direction: column; align-items: flex-start; gap: 4px; }
  .bar-cell .bar { width: 100%; max-width: none; }
}

/* Quiz review CTAs — primary first (full-width), others secondary/ghost */
.qr-actions {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 24px;
}
@media (min-width: 600px) {
  .qr-actions { flex-direction: row; justify-content: center; }
  .qr-actions .btn { flex: 0 1 auto; }
  .qr-actions .btn-block { width: auto; }
}

/* Checkbox list (AI gen wizard) */
.checkbox-list { display: grid; gap: 8px; max-height: 280px; overflow-y: auto; padding: 12px; border: 1px solid var(--c-border); border-radius: var(--r-sm); background: var(--c-surface); }
.checkbox-list .check { display: flex; gap: 10px; align-items: flex-start; padding: 6px; cursor: pointer; min-height: 40px; }
.checkbox-list .check:hover { background: var(--c-surface-2); }
.checkbox-list .check input[type="checkbox"] { width: 18px; height: 18px; margin-top: 3px; }

/* ============================================================
   READER CHROME (Apple Books-style settings menu)
   ============================================================ */

/* Auto-hide top nav on scroll-down (toggled via .nav-hidden class on body) */
body.nav-hidden .topnav { transform: translateY(-100%); }
.topnav { transition: transform .25s ease; will-change: transform; }

/* Reader settings floating button (bottom-right, above bottomtab + endchapter-cta) */
.reader-fab {
  position: fixed; right: 16px;
  /* clear bottomtab + endchapter-cta */
  bottom: calc(140px + env(safe-area-inset-bottom, 0px));
  z-index: var(--z-fab);
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--c-primary); color: var(--c-accent-lime);
  display: flex; align-items: center; justify-content: center;
  border: 0; cursor: pointer; font-weight: 800; font-size: 18px;
  box-shadow: var(--shadow-lg); -webkit-tap-highlight-color: transparent;
  font-family: serif; letter-spacing: -.04em;
}
.reader-fab:hover { transform: scale(1.05); }
@media (min-width: 1024px) { .reader-fab { bottom: 24px; right: 24px; } }

/* Reader settings popover */
.reader-menu {
  position: fixed; right: 16px;
  bottom: calc(200px + env(safe-area-inset-bottom, 0px));
  z-index: var(--z-fab);
  width: min(320px, calc(100vw - 32px));
  max-height: 70vh; overflow-y: auto;
  background: var(--c-surface); border: 1px solid var(--c-border-strong);
  border-radius: var(--r-md); padding: 16px; box-shadow: var(--shadow-lg);
  display: none; color: var(--c-text);
}
.reader-menu.open { display: block; }
@media (min-width: 1024px) { .reader-menu { bottom: 80px; right: 24px; } }
.reader-menu h4 { margin: 0 0 8px; font-size: .8125rem; text-transform: uppercase; letter-spacing: .05em; color: var(--c-text-muted); font-weight: 600; }
.reader-menu .row { display: flex; gap: 4px; }
.reader-menu .group { margin-bottom: 16px; }
.reader-menu .group:last-child { margin-bottom: 0; }

/* Font-size buttons (A− A A+) */
.font-btn {
  flex: 1; min-height: 44px; border: 1px solid var(--c-border-strong);
  background: var(--c-surface); color: var(--c-text); cursor: pointer;
  font-family: serif; font-weight: 600; border-radius: var(--r-sm);
}
.font-btn:hover { background: var(--c-surface-2); }
.font-btn.active { background: var(--c-primary); color: white; border-color: var(--c-primary); }
.font-btn.f0 { font-size: 13px; }
.font-btn.f1 { font-size: 16px; }
.font-btn.f2 { font-size: 19px; }
.font-btn.f3 { font-size: 22px; }
.font-btn.f4 { font-size: 26px; }

/* Theme picker */
.theme-btn {
  flex: 1; min-height: 44px; border-radius: var(--r-sm);
  border: 2px solid var(--c-border-strong); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 600; gap: 4px;
}
.theme-btn.active { border-color: var(--c-primary); }
.theme-btn[data-theme="light"] { background: #FFFFFF; color: #0A0A0A; }
.theme-btn[data-theme="sepia"] { background: #FBF0D9; color: #3B2C1A; }
.theme-btn[data-theme="dark"]  { background: #1A1A1A; color: #E8E8E8; }
.theme-btn[data-theme="hc"]    { background: #FFFFFF; color: #000000; border-color: #000; font-weight: 800; }

/* Image zoom overlay */
.img-zoom-overlay {
  position: fixed; inset: 0; background: rgba(10, 10, 10, .92);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; cursor: zoom-out; padding: 24px;
}
.img-zoom-overlay img { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 8px 40px rgba(0,0,0,.5); }
.img-zoom-overlay::after {
  content: '×'; position: fixed; top: 16px; right: 24px;
  font-size: 32px; color: white; opacity: .8;
}

/* Reading time badge */
.reading-time { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; background: var(--c-surface-2); border-radius: 999px; font-size: .8125rem; color: var(--c-text-muted); }

/* ============================================================
   ADMIN EDITOR — Google Docs feel (3-col on desktop)
   ============================================================ */
.editor-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  grid-template-areas: "outline main";
  gap: 24px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px;
  min-height: calc(100vh - 80px);
}
.editor-outline { grid-area: outline; }
.editor-main    { grid-area: main; }

/* Backdrop only exists for the mobile slide-in drawer; hide on desktop. */
.editor-outline-backdrop { display: none; }

.editor-outline {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 16px;
  position: sticky; top: 80px; align-self: flex-start;
  max-height: calc(100vh - 96px); overflow-y: auto;
  font-size: .875rem;
}
.outline-head { padding-bottom: 12px; border-bottom: 1px solid var(--c-border); margin-bottom: 8px; }
.outline-list { list-style: none; padding: 0; margin: 0; }
.outline-list li { margin: 0; }
.outline-list a {
  display: block; padding: 6px 8px; border-radius: 4px;
  color: var(--c-text); text-decoration: none; line-height: 1.4;
}
.outline-list a:hover { background: var(--c-surface-2); }
.outline-list .outline-h1 a { font-weight: 700; }
.outline-list .outline-h2 a { padding-left: 16px; }
.outline-list .outline-h3 a { padding-left: 28px; font-size: .8125rem; color: var(--c-text-muted); }
.outline-foot { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--c-border); }

.editor-main {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  display: flex; flex-direction: column;
  min-height: 600px;
}

.editor-topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--c-border);
  flex-wrap: wrap;
}
.title-input {
  flex: 1; min-width: 240px; min-height: 40px;
  font: inherit; font-size: 1.25rem; font-weight: 700;
  border: 1px solid transparent; background: transparent;
  padding: 6px 10px; border-radius: var(--r-sm); color: var(--c-text);
}
.title-input:focus { border-color: var(--c-border-strong); outline: 2px solid var(--c-focus); outline-offset: 1px; }
.editor-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.save-status { white-space: nowrap; }
.save-status.error { color: var(--c-danger); }

.editor-pane {
  padding: 16px; border-bottom: 1px solid var(--c-border);
}
.editor-pane:last-of-type { border-bottom: 0; }
.pane-label { padding-bottom: 8px; }

/* Toast UI Editor overrides — slimmer chrome, our color */
.toastui-editor-defaultUI { border: 0 !important; }
.toastui-editor-toolbar { border-bottom: 1px solid var(--c-border) !important; background: var(--c-surface-2) !important; }
.toastui-editor-defaultUI button:focus { outline-color: var(--c-focus) !important; }
.toastui-editor .ProseMirror { min-height: 320px; font-family: var(--font-ui) !important; }
body.locale-bn .toastui-editor .ProseMirror { font-family: var(--font-bn) !important; }
.toastui-editor h1 { font-size: 1.75rem; }
.toastui-editor h2 { font-size: 1.375rem; }
.toastui-editor img { max-width: 100%; height: auto; border-radius: 6px; }

.editor-footer {
  padding: 8px 16px; border-top: 1px solid var(--c-border);
  display: flex; justify-content: space-between; align-items: center;
  background: var(--c-surface-2);
  border-bottom-left-radius: var(--r-md);
  border-bottom-right-radius: var(--r-md);
}

/* Slash command menu (Notion-style) */
.slash-menu {
  position: fixed; z-index: 200;
  width: 280px; max-height: 320px; overflow-y: auto;
  background: var(--c-surface); border: 1px solid var(--c-border-strong);
  border-radius: var(--r-md); padding: 6px;
  box-shadow: var(--shadow-lg);
  font-size: .9375rem;
}
.slash-menu .slash-section { padding: 6px 10px 2px; font-size: .6875rem; text-transform: uppercase; letter-spacing: .05em; color: var(--c-text-muted); font-weight: 700; }
.slash-menu button {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 8px 10px; text-align: left;
  background: transparent; border: 0; cursor: pointer;
  font: inherit; font-size: .9375rem; border-radius: 6px;
  color: var(--c-text);
}
.slash-menu button:hover, .slash-menu button.active {
  background: var(--c-primary-soft); color: var(--c-primary);
}
.slash-menu .slash-icon {
  flex-shrink: 0; width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--c-surface-2); border: 1px solid var(--c-border);
  border-radius: 6px; font-size: 16px; font-weight: 600;
}
.slash-menu .slash-info { flex: 1; min-width: 0; }
.slash-menu .slash-title { font-weight: 600; line-height: 1.2; }
.slash-menu .slash-hint { font-size: .75rem; color: var(--c-text-muted); margin-top: 2px; }
.slash-menu button.active .slash-icon { background: var(--c-primary); color: var(--c-accent-lime); border-color: var(--c-primary); }

/* Templates dropdown */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: 100%; left: 0; z-index: 100;
  background: var(--c-surface); border: 1px solid var(--c-border-strong);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  min-width: 220px; padding: 6px; list-style: none; margin: 4px 0 0;
}
.dropdown-menu li { margin: 0; }
.dropdown-menu button {
  display: block; width: 100%; text-align: left;
  background: transparent; border: 0; padding: 10px 12px;
  font: inherit; cursor: pointer; border-radius: 4px; color: var(--c-text);
}
.dropdown-menu button:hover { background: var(--c-surface-2); }

/* ============================================================
   MOBILE-FIRST OVERRIDES
   ============================================================ */

/* --- Topnav: slim on mobile so brand + lang + signout fit --- */
@media (max-width: 767px) {
  .topnav-inner { padding: 10px 12px; min-height: 56px; gap: 8px; }
  .brand-mark { width: 32px; height: 32px; font-size: 12px; border-radius: 7px; }
  .brand-name { display: none; }
  .topnav-user { gap: 6px; }
  .lang-pill button, .lang-pill a { padding: 4px 10px !important; font-size: 13px !important; min-height: 32px; }
  .topnav-user .btn-sm { min-height: 36px; padding: 0 10px; font-size: 13px; }
  .user-name { display: none; }
  .hamburger { padding: 4px 10px; min-height: 36px; font-size: 16px; }
}
@media (max-width: 480px) {
  /* On smallest phones, drop full English/বাংলা labels in pill — single-letter version */
  .lang-pill a span, .lang-pill button span { display: none; }
}

/* Hamburger menu drawer (when open) — covers nav links + admin links + sign out */
.topnav-links.open {
  position: fixed; top: 56px; left: 0; right: 0; bottom: 0;
  background: var(--c-surface); padding: 16px;
  border-bottom: 0; box-shadow: var(--shadow-lg);
  z-index: 100; overflow-y: auto;
  display: flex !important; flex-direction: column;
  gap: 4px; align-items: stretch;
}
.topnav-links.open a { padding: 14px 12px; min-height: 48px; border-radius: var(--r-sm); font-size: 1rem; }
.topnav-links.open .nav-sep { display: block; height: 1px; width: 100%; background: var(--c-border); margin: 8px 0; }

/* --- Editor: outline becomes drawer on small screens --- */
@media (max-width: 1023px) {
  .editor-shell {
    grid-template-columns: 1fr;
    grid-template-areas: "main";
    padding: 8px; gap: 8px;
  }
  .editor-outline {
    position: fixed; top: 56px; left: -300px; bottom: 0; width: 280px;
    z-index: 90; padding: 16px;
    transition: left .25s ease; overflow-y: auto;
    border-radius: 0; max-height: none;
    box-shadow: var(--shadow-lg);
  }
  .editor-outline.open { left: 0; }
  .editor-outline-backdrop {
    position: fixed; inset: 56px 0 0 0; background: rgba(10,10,10,.4); z-index: 89;
  }
  .editor-outline.open ~ .editor-outline-backdrop { display: block; }

  .outline-toggle {
    display: inline-flex !important; align-items: center; justify-content: center;
    background: var(--c-surface-2); border: 1px solid var(--c-border-strong);
    width: 40px; height: 40px; border-radius: var(--r-sm); cursor: pointer;
    font-size: 18px;
  }

  /* Editor topbar wraps on mobile */
  .editor-topbar { padding: 8px 10px; gap: 6px; }
  .title-input { font-size: 1.0625rem; min-height: 40px; padding: 4px 8px; }
  .editor-actions { gap: 4px; width: 100%; }
  .editor-actions .btn-sm { font-size: 12px; padding: 0 10px; min-height: 36px; }
  .save-status { font-size: 11px; flex-basis: 100%; text-align: right; order: -1; }

  /* Toast UI Editor — scroll-x toolbar + tighter on phones */
  .toastui-editor-toolbar { overflow-x: auto !important; }
  .toastui-editor-toolbar-icons, .toastui-editor-toolbar-group { flex-wrap: nowrap !important; }
  .toastui-editor-defaultUI button { min-height: 36px !important; min-width: 36px !important; }
  .toastui-editor .ProseMirror { padding: 12px !important; min-height: 240px !important; }

  /* ---- Mobile editor: native textarea + sticky markdown toolbar ---- */
  .mobile-editor {
    display: flex; flex-direction: column;
    background: var(--c-surface);
    border-radius: var(--r-md);
    overflow: hidden;
  }
  .mobile-editor-toolbar {
    display: flex; gap: 6px;
    padding: 8px; overflow-x: auto;
    background: var(--c-surface-2);
    border-bottom: 1px solid var(--c-border);
    position: sticky; top: 0; z-index: 5;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .mobile-editor-toolbar::-webkit-scrollbar { display: none; }
  .mobile-editor-toolbar button {
    flex-shrink: 0;
    min-width: 40px; min-height: 40px;
    padding: 0 12px;
    background: var(--c-surface);
    border: 1px solid var(--c-border-strong);
    border-radius: 8px;
    font: inherit; font-weight: 700; font-size: 15px;
    color: var(--c-text);
    cursor: pointer;
  }
  .mobile-editor-toolbar button:active {
    background: var(--c-primary-soft); color: var(--c-primary);
  }
  .mobile-editor-textarea {
    width: 100%;
    min-height: 60vh;
    padding: 16px;
    border: 0; outline: 0;
    /* 16px font-size prevents iOS Safari from auto-zooming when the textarea focuses */
    font-size: 16px; line-height: 1.65;
    font-family: var(--font-bn), var(--font-ui), system-ui, sans-serif;
    color: var(--c-text);
    background: var(--c-surface);
    resize: vertical;
    -webkit-appearance: none;
    appearance: none;
    /* Long words wrap; preserve newlines */
    white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere;
    /* No border-radius so it sits flush inside the rounded .mobile-editor wrapper */
    border-radius: 0;
  }
  .mobile-editor-textarea:focus {
    outline: 2px solid var(--c-focus);
    outline-offset: -2px;
  }

  /* BN/EN as TABS instead of stacked */
  .editor-pane { border-bottom: 0; padding: 0; }
  .pane-tabs {
    display: flex; gap: 0; border-bottom: 1px solid var(--c-border);
    padding: 0 8px; background: var(--c-surface-2);
  }
  .pane-tabs button {
    flex: 1; min-height: 44px; border: 0; background: transparent;
    color: var(--c-text-muted); font: inherit; font-weight: 600;
    cursor: pointer; border-bottom: 2px solid transparent;
  }
  .pane-tabs button.active { color: var(--c-primary); border-bottom-color: var(--c-primary); }
}
@media (min-width: 1024px) {
  .outline-toggle { display: none !important; }
  .pane-tabs { display: none; }
}

/* --- Admin data tables → cards on small screens --- */
@media (max-width: 720px) {
  .data-table { display: block; box-shadow: none; background: transparent; }
  .data-table thead { display: none; }
  .data-table tbody { display: block; }
  .data-table tr {
    display: block;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    margin-bottom: 12px; padding: 12px 14px;
    box-shadow: var(--shadow-sm);
  }
  .data-table td {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 6px 0; border: 0;
    align-items: center;
  }
  .data-table td:first-child { font-weight: 700; font-size: 1.125rem; padding-top: 0; }
  .data-table td:not(:last-child) { border-bottom: 1px dashed var(--c-border); }
  .data-table td::before {
    content: attr(data-label);
    color: var(--c-text-muted); font-size: .8125rem; font-weight: 500;
    text-transform: uppercase; letter-spacing: .03em;
    flex: 0 0 40%;
  }
  .data-table td:first-child::before { display: none; }
  .bar-cell { width: 100%; max-width: 220px; }
}

/* --- Form row default to stack; opt-in 2-col via .form-row-md @ ≥600px (already handled) --- */
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr !important; }
  .container, .container.narrow { padding: 0 12px; }
  .page { padding: 12px; padding-bottom: 88px; }
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.1875rem; }
}

/* --- Admin home cards — already grid responsive, but tighten gap --- */
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr 1fr !important; gap: 8px !important; }
}

/* --- Bottom-sheet utility (replaces centered modals on phones) --- */
@media (max-width: 720px) {
  .bottom-sheet, .dropdown-menu.bottom-sheet,
  .templates-bottom-sheet {
    position: fixed !important;
    left: 0 !important; right: 0 !important; top: auto !important; bottom: 0 !important;
    width: 100% !important; max-width: 100% !important; min-width: 0 !important;
    margin: 0 !important; border-radius: 16px 16px 0 0 !important;
    padding: 16px !important;
    box-shadow: 0 -8px 32px rgba(10, 10, 10, .25) !important;
    max-height: 70vh; overflow-y: auto;
    animation: sheet-up .25s ease;
    z-index: 110;
  }
  .bottom-sheet::before {
    content: ''; display: block; width: 36px; height: 4px;
    background: var(--c-border-strong); border-radius: 2px;
    margin: -4px auto 12px;
  }
  .bottom-sheet button, .templates-bottom-sheet button {
    min-height: 48px !important; padding: 12px 14px !important;
    font-size: 1rem !important; text-align: left !important;
  }
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* When dropdown-menu is opened on mobile, swap to bottom-sheet styling */
@media (max-width: 720px) {
  .dropdown-menu { /* admin templates etc */ }
}

/* PWA install banner — pushed up if reader-fab is showing */
#pwa-install-banner { font-size: .9375rem; }

/* --- Reader chrome z-stack on mobile (above bottomtab, below modals) --- */
.reader-fab { z-index: 65; }
.bottomtab   { z-index: 60; }
.endchapter-cta { z-index: 55; }
.note-drawer { z-index: 100; }
.img-zoom-overlay { z-index: 200; }

/* --- Quiz answer buttons: ensure 56-64px on mobile, smaller markers --- */
@media (max-width: 480px) {
  .answer-btn { min-height: 56px; padding: 12px 14px; font-size: .9375rem; }
  .answer-btn .marker { width: 22px; height: 22px; font-size: .75rem; }
  .quiz-stem { font-size: 1.0625rem; line-height: 1.5; margin: 8px 0 16px; }
  .quiz-stage { padding: 8px; }
}

/* --- Profile page form spacing --- */
@media (max-width: 480px) {
  .auth-card { padding: 24px 16px; }
}

/* --- Endchapter sticky CTA — better mobile placement --- */
@media (max-width: 1023px) {
  .endchapter-cta { bottom: 80px; padding: 8px 12px 12px; }
}

/* Print */
@media print {
  .topnav, .bottomtab, .endchapter-cta, .annot-toolbar, .note-drawer, .privacy-footer, .reader-fab, .reader-menu, .editor-outline, .editor-topbar, .editor-footer, .outline-toggle, .pane-tabs { display: none !important; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}

/* ============================================================
   DESKTOP OVERRIDES (≥ 1024px)
   Mobile/tablet styles above are NOT modified.
   These rules only kick in on real desktop viewports.
   ============================================================ */
@media (min-width: 1024px) {

  /* ---- 1. Wider .container.narrow — 720px was tablet-grade ---- */
  .container.narrow { max-width: 920px; }

  /* ---- 2. Hide PWA "Add to Home Screen" banner on desktop ---- */
  #pwa-install-banner { display: none !important; }

  /* ---- 3. Member dashboard — hero card + greeting prominence ---- */
  .dashboard { padding-bottom: 32px; }
  .dash-greeting h1 { font-size: 2rem; }
  .dash-hero { padding: 24px 28px; }
  .dash-hero-meta { margin-bottom: 18px; }
  .dash-hero-title { font-size: 1.5rem; }
  .dash-kpi-num { font-size: 2rem; }
  .dash-hero-cta button, .dash-hero-cta .btn { max-width: 280px; }

  /* ---- 4. Admin home — Quick actions: don't stretch full width ---- */
  .ah-quick-actions {
    flex-direction: row; flex-wrap: nowrap;
    justify-content: flex-start; gap: 12px;
  }
  .ah-quick-actions .btn {
    flex: 0 1 auto;
    max-width: 320px; min-width: 200px;
  }

  /* ---- 5. Admin handbook — 2-col section card grid ---- */
  /* Section cards span full width on mobile (already), 2-col on desktop */
  .ah-chapter {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-items: start;
  }
  .ah-chapter > .ah-chapter-head,
  .ah-chapter > .add-form {
    grid-column: 1 / -1;
  }
  .ah-section-card { margin-bottom: 0; }

  /* ---- 6. AI quiz generator — 2-col layout ---- */
  .ai-gen-container { max-width: 1100px; padding-bottom: 32px; }
  .ai-gen-form {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    grid-template-areas:
      "title    title"
      "sections settings"
      "sections mix"
      "sections time"
      "sections focus"
      "submit   submit";
    gap: 16px;
    align-items: start;
  }
  .ai-gen-form > section.ai-block:nth-of-type(1) { grid-area: title; }
  .ai-gen-form > section.ai-block:nth-of-type(2) { grid-area: sections; }
  .ai-gen-form > section.ai-block:nth-of-type(3) { grid-area: settings; }
  .ai-gen-form > section.ai-block:nth-of-type(4) { grid-area: mix; }
  .ai-gen-form > section.ai-block:nth-of-type(5) { grid-area: time; }
  .ai-gen-form > section.ai-block:nth-of-type(6) { grid-area: focus; }
  .ai-gen-form > .ai-submit-bar { grid-area: submit; }
  /* Submit bar is inline (not sticky) on desktop — already handled by mobile-only sticky rule */

  /* ---- 7. Empty states — bigger and centered ---- */
  .empty-state { padding: 64px 24px; max-width: 520px; }
  .empty-emoji { font-size: 5rem; }
  .grading-empty {
    max-width: 520px; margin: 32px auto;
    padding: 48px 32px;
  }
  .grading-empty-emoji { font-size: 4.5rem; }

  /* ---- 8. Editor — cap prose width inside huge editor pane for readability ---- */
  .toastui-editor .ProseMirror,
  .toastui-editor .ProseMirror-virtual {
    max-width: 760px; margin-left: auto; margin-right: auto;
  }

  /* ---- 9. Member handbook chapter view — 2-col section list ---- */
  /* (the chapter page lists sections as cards) */
  .container > .card-link + .card-link { /* leave alone */ }

  /* ---- 10. Member quizzes list — limit width so cards don't stretch empty ---- */
  /* The /quizzes page uses default .container; cap it. */
  body.locale-bn .quiz-list,
  body.locale-en .quiz-list,
  .quiz-list-page .container,
  .container > .quiz-card { max-width: 720px; }

  /* ---- 11. Permission cards — already 3-col grid; ensure good gutters on big screens ---- */
  .perm-grid { gap: 16px; }

  /* ---- 12. Tighten pull-to-refresh / iOS-only chrome on desktop ---- */
  #pull-refresh-indicator { display: none !important; }

  /* ---- 13. KPI dashboard — keep charts 2-col but ensure gap ---- */
  .kpi-charts { gap: 20px; }

  /* ---- 14. Profile page — compact card grid ---- */
  .container.narrow .form.card { padding: 24px; }

  /* ---- 15. Quiz-take page already has its own max-width on .quiz-stage ---- */
  /* (no change needed — already 640px which is good for one-question-per-screen) */

  /* ---- 16. Reading container — already capped, leave alone ---- */
  /* .container-reading is already well-sized for prose */
}

/* ===== Palki OS — home launcher (module tiles) ===== */
.os-launcher{display:grid;grid-template-columns:repeat(2,1fr);gap:12px;margin:16px 0}
.os-tile{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:18px 12px;background:var(--card,#fff);border:1px solid var(--border,#e6e6e6);border-radius:14px;text-decoration:none;color:inherit;min-height:92px;transition:transform .08s ease,box-shadow .12s ease}
.os-tile:active{transform:scale(.97)}
.os-tile-icon{font-size:26px;line-height:1}
.os-tile-label{font-size:14px;font-weight:600;text-align:center}
.os-tile-active{border-color:var(--brand,#0D3B2E);box-shadow:0 0 0 2px rgba(13,59,46,.12)}
@media (min-width:1024px){.os-launcher{grid-template-columns:repeat(4,1fr);gap:16px;margin:20px 0}.os-tile{min-height:108px}}

/* ===== Palki OS — Tasks one-stop actions + proof modal ===== */
.task-row{flex-wrap:wrap}
.task-row-main{display:block;flex:1 1 60%;text-decoration:none;color:inherit;min-width:0}
.task-actions{flex:1 1 100%;display:flex;gap:8px;margin-top:10px;padding-top:10px;border-top:1px solid var(--border,#eee)}
.task-act{display:inline-flex;align-items:center;gap:5px;font-size:13px;font-weight:600;padding:8px 14px;border-radius:9px;border:1px solid var(--border,#ddd);background:var(--card,#fff);color:var(--ink,#1a1a1a);cursor:pointer}
.task-act:active{transform:scale(.97)}
.task-act-done{border-color:#0D3B2E;color:#0D3B2E}
.task-act-done:hover{background:#0D3B2E;color:#fff}
.task-act-doneflag{border-color:#cfe8da;background:#eef8f2;color:#1f7a4d;cursor:default}
.task-act-proof{margin-left:auto}
.task-act-form{margin:0}
.task-row.is-done{opacity:.62}
.tasks-flash{margin-bottom:14px}
.task-modal{position:fixed;inset:0;z-index:1000;display:flex;align-items:center;justify-content:center;padding:16px}
.task-modal[hidden]{display:none}
.task-modal-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.45)}
.task-modal-card{position:relative;background:var(--card,#fff);border-radius:16px;padding:20px;max-width:460px;width:100%;box-shadow:0 12px 40px rgba(0,0,0,.25)}
.task-modal-card h3{margin:0 0 4px;font-size:17px}
.task-modal-textarea{width:100%;padding:12px;border:1px solid var(--border,#ddd);border-radius:10px;font:inherit;font-size:15px;resize:vertical;margin:10px 0 4px;box-sizing:border-box}
.task-modal-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:12px}
@media (min-width:1024px){.task-row-main{flex-basis:55%}}

/* ===== Palki OS — KPI module ===== */
.kpi-page .page-header{margin-bottom:12px}
.kpi-hero{text-align:center;padding:24px;border-radius:16px;background:var(--card,#fff);border:1px solid var(--border,#e6e6e6);margin-bottom:14px}
.kpi-hero-num{font-size:44px;font-weight:800;line-height:1}
.kpi-hero-label{margin-top:6px;font-weight:600;display:flex;gap:8px;align-items:center;justify-content:center;flex-wrap:wrap}
.kpi-tier-badge{font-size:12px;font-weight:700;padding:2px 10px;border-radius:9px;background:var(--surface-3,#eee)}
.kpi-hero.tier-outstanding{border-color:#bfe6cf;background:#f0faf4}
.kpi-hero.tier-good{border-color:#cfe0f5;background:#f2f7fd}
.kpi-hero.tier-average{border-color:#f5e6c0;background:#fdf8ee}
.kpi-hero.tier-critical{border-color:#f3c9c6;background:#fdf1f0}
.kpi-split{display:grid;grid-template-columns:repeat(2,1fr);gap:10px;margin-bottom:14px}
.kpi-page .kpi-split:has(.kpi-split-cell:nth-child(3)){grid-template-columns:repeat(3,1fr)}
.kpi-split-cell{background:var(--card,#fff);border:1px solid var(--border,#e6e6e6);border-radius:12px;padding:14px;text-align:center}
.kpi-split-num{font-size:26px;font-weight:700;margin-top:4px}
.kpi-bar-row{margin:10px 0}
.kpi-bar-label{display:flex;justify-content:space-between;gap:8px;font-size:13px;font-weight:600;margin-bottom:4px}
.kpi-bar{height:8px;border-radius:6px;background:var(--surface-3,#eee);overflow:hidden}
.kpi-bar>span{display:block;height:100%;background:#0D3B2E;border-radius:6px}
.kpi-hist-row{display:flex;justify-content:space-between;align-items:center;padding:12px 14px;background:var(--card,#fff);border:1px solid var(--border,#e6e6e6);border-radius:12px;margin-bottom:8px}
.kpi-hist-period{font-weight:600}
.kpi-hist-score{font-size:20px;font-weight:700}
.kpi-pill{display:inline-block;padding:3px 12px;border-radius:9px;font-weight:700;background:var(--surface-3,#eee)}
.kpi-pill.tier-outstanding{background:#e2f5ea;color:#1f7a4d}
.kpi-pill.tier-good{background:#e6effb;color:#2456b5}
.kpi-pill.tier-average{background:#fbf1d8;color:#9a6b0d}
.kpi-pill.tier-critical{background:#fbe0de;color:#b23b34}
.kpi-form-row{display:flex;flex-direction:column;gap:4px;margin-bottom:12px}
.kpi-form-row input{padding:10px;border:1px solid var(--border,#ddd);border-radius:9px;font:inherit}
.kpi-crit-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:10px;margin-bottom:12px}
.kpi-crit{display:flex;flex-direction:column;gap:4px}
.kpi-crit-name{font-size:13px;font-weight:600}
.kpi-crit input{padding:9px;border:1px solid var(--border,#ddd);border-radius:9px;font:inherit}
@media (min-width:1024px){.kpi-crit-grid{grid-template-columns:repeat(3,1fr)}}

/* ===== Palki OS — Mandatory tasks editor ===== */
.mand-toolbar{display:flex;gap:10px;align-items:center;justify-content:space-between;flex-wrap:wrap;margin-bottom:12px}
.mand-toolbar .tasks-tabs{margin-bottom:0;flex:1}
.mand-syncall{margin:0}
.mand-add{background:var(--card,#fff);border:1px dashed var(--border,#ccc);border-radius:12px;padding:12px 14px;margin-bottom:12px}
.mand-add summary{cursor:pointer;font-weight:600;font-size:14px}
.mand-add[open] summary{margin-bottom:10px}
.mand-row{background:var(--card,#fff);border:1px solid var(--border,#e6e6e6);border-radius:12px;padding:14px;margin-bottom:8px}
.mand-row.is-inactive{opacity:.6}
.mand-row-head{display:flex;justify-content:space-between;gap:10px;align-items:flex-start}
.mand-row-main{min-width:0;flex:1}
.mand-row-title{font-weight:600;font-size:14px;line-height:1.35}
.mand-row-meta{margin-top:4px;display:flex;gap:6px;flex-wrap:wrap}
.mand-row-actions{display:flex;gap:6px;flex-shrink:0}
.mand-warn{color:#b23b34;font-weight:600}
.mand-sync-ok{color:#1f7a4d;font-weight:600}
.mand-edit-form{margin-top:12px;padding-top:12px;border-top:1px solid var(--border,#eee)}
.mand-form{display:flex;flex-direction:column;gap:10px}
.mand-field{display:flex;flex-direction:column;gap:4px;font-size:13px;font-weight:600}
.mand-field input,.mand-field select,.mand-field textarea{padding:9px;border:1px solid var(--border,#ddd);border-radius:9px;font:inherit;font-weight:400}
.mand-field-row{display:grid;grid-template-columns:1fr;gap:10px}
.mand-check{display:flex;align-items:center;gap:8px;font-size:14px}
.btn-danger{background:#fbe0de;color:#b23b34;border:1px solid #f3c9c6}
.btn-danger:hover{background:#b23b34;color:#fff}
@media (min-width:1024px){.mand-field-row{grid-template-columns:1fr 1fr}}

/* ===== Palki OS — admin nav groups (top + bottom-sheet) ===== */
.topnav-chip{display:inline-flex;align-items:center;gap:4px;padding:6px 12px;border-radius:9px;text-decoration:none;color:inherit;font-weight:600;font-size:14px}
.topnav-chip:hover{background:rgba(0,0,0,.05)}
.topnav-chip.active{background:var(--brand,#0D3B2E);color:#fff}
.topnav-group{position:relative;display:inline-block;list-style:none}
.topnav-group>summary{cursor:pointer;list-style:none}
.topnav-group>summary::-webkit-details-marker{display:none}
.topnav-group.active>summary{background:var(--brand,#0D3B2E);color:#fff}
.topnav-caret{font-size:10px;opacity:.8}
.topnav-drop{position:absolute;top:calc(100% + 6px);left:0;background:var(--card,#fff);border:1px solid var(--border,#e6e6e6);border-radius:12px;box-shadow:0 8px 28px rgba(0,0,0,.12);min-width:200px;padding:6px;z-index:1100;display:flex;flex-direction:column;gap:2px}
.topnav-drop a{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:8px;text-decoration:none;color:inherit;font-weight:500;font-size:14px}
.topnav-drop a:hover{background:rgba(0,0,0,.05)}
.topnav-drop a.active{background:var(--brand,#0D3B2E);color:#fff}
.topnav-drop-icon{font-size:16px}
.topnav-search{background:none;border:1px solid var(--border,#e6e6e6);border-radius:9px;padding:6px 10px;cursor:pointer;font-size:14px;color:inherit}
.topnav-search:hover{background:rgba(0,0,0,.05)}
@media (max-width:1023px){
  .topnav-group .topnav-drop{position:static;box-shadow:none;border:none;padding-left:18px}
}

/* Bottom-sheet (admin mobile group nav) */
.bottomtab-group{background:none;border:none;font:inherit;color:inherit;cursor:pointer;display:flex;flex-direction:column;align-items:center;gap:2px;padding:6px 8px}
.bottomsheet{position:fixed;inset:0;z-index:1200;display:flex;align-items:flex-end;justify-content:center}
.bottomsheet[hidden]{display:none}
.bottomsheet-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.45);opacity:0;transition:opacity .2s}
.bottomsheet.open .bottomsheet-backdrop{opacity:1}
.bottomsheet-panel{position:relative;background:var(--card,#fff);border-radius:16px 16px 0 0;width:100%;max-width:520px;padding:16px;transform:translateY(100%);transition:transform .22s cubic-bezier(.2,.8,.2,1);box-shadow:0 -10px 30px rgba(0,0,0,.18);max-height:80vh;overflow-y:auto}
.bottomsheet.open .bottomsheet-panel{transform:translateY(0)}
.bottomsheet-title{font-weight:700;font-size:14px;color:var(--muted,#666);padding:4px 8px 10px;border-bottom:1px solid var(--border,#eee);margin-bottom:8px}
.bottomsheet-link{display:flex;align-items:center;gap:12px;padding:14px 8px;text-decoration:none;color:inherit;font-weight:600;font-size:15px;border-radius:10px}
.bottomsheet-link:active{background:rgba(0,0,0,.05)}
.bottomsheet-link.active{background:var(--brand,#0D3B2E);color:#fff}
.bottomsheet-link-icon{font-size:20px}

/* ===== Palki OS — Cmd+K modal ===== */
.cmdk{position:fixed;inset:0;z-index:1300;display:flex;align-items:flex-start;justify-content:center;padding-top:12vh}
.cmdk[hidden]{display:none}
.cmdk-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.4);opacity:0;transition:opacity .15s}
.cmdk.open .cmdk-backdrop{opacity:1}
.cmdk-panel{position:relative;width:100%;max-width:600px;background:var(--card,#fff);border-radius:14px;box-shadow:0 20px 60px rgba(0,0,0,.25);overflow:hidden;display:flex;flex-direction:column;max-height:70vh;transform:translateY(-8px);opacity:0;transition:transform .15s,opacity .15s}
.cmdk.open .cmdk-panel{transform:translateY(0);opacity:1}
.cmdk-input{width:100%;padding:18px 20px;border:none;border-bottom:1px solid var(--border,#eee);font:inherit;font-size:17px;background:transparent;outline:none;color:inherit}
.cmdk-results{flex:1;overflow-y:auto;padding:8px 0}
.cmdk-empty{padding:24px;text-align:center;color:var(--muted,#888);font-size:14px}
.cmdk-group{padding:8px 16px 4px;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:var(--muted,#888)}
.cmdk-row{display:block;padding:10px 16px;text-decoration:none;color:inherit;border-left:3px solid transparent}
.cmdk-row:hover,.cmdk-row.is-active{background:rgba(0,0,0,.05);border-left-color:var(--brand,#0D3B2E)}
.cmdk-row-label{display:block;font-weight:600;font-size:14px}
.cmdk-row-sub{display:block;font-size:12px;color:var(--muted,#888);margin-top:2px}
.cmdk-hints{display:flex;gap:14px;padding:8px 16px;border-top:1px solid var(--border,#eee);font-size:11px;color:var(--muted,#888)}
.cmdk-hints kbd{display:inline-block;padding:1px 6px;border:1px solid var(--border,#ddd);border-radius:4px;background:rgba(0,0,0,.03);font-family:inherit;font-size:10px;margin-right:2px}

/* ===== Palki OS — admin ops dashboard ===== */
.ops-head{margin-bottom:14px}
.ops-head h1{margin:0 0 4px;font-size:22px}
.ops-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:10px;margin-bottom:14px}
.ops-card{display:flex;flex-direction:column;gap:4px;padding:16px;border-radius:14px;background:var(--card,#fff);border:1px solid var(--border,#e6e6e6);text-decoration:none;color:inherit}
.ops-card.is-warn{border-color:#f0c14b;background:#fff8e8}
.ops-card.is-ok{border-color:#bfe6cf;background:#f3faf6}
.ops-label{font-size:12px;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--muted,#666)}
.ops-num{font-size:28px;font-weight:800;line-height:1}
.ops-sub{font-size:12px;color:var(--muted,#666)}
.ops-row{display:flex;flex-wrap:wrap;gap:10px;margin-bottom:14px}
.ops-pill{display:flex;align-items:center;gap:10px;padding:10px 14px;background:var(--card,#fff);border:1px solid var(--border,#e6e6e6);border-radius:12px;flex:1 1 200px}
.ops-pill.is-warn{border-color:#f0c14b;background:#fff8e8}
.ops-pill-icon{font-size:20px}
.ops-pill-label{font-size:12px;color:var(--muted,#666)}
.ops-pill-val{font-weight:600}
.ops-recent{background:var(--card,#fff);border:1px solid var(--border,#e6e6e6);border-radius:12px;padding:12px;margin-bottom:14px}
.ops-recent-title{font-size:13px;font-weight:700;color:var(--muted,#666);margin:0 0 8px;text-transform:uppercase;letter-spacing:.04em}
.ops-recent-row{display:flex;align-items:center;gap:10px;padding:8px 4px;border-top:1px solid var(--border,#eee)}
.ops-recent-row:first-of-type{border-top:none}
.ops-recent-dot{width:22px;text-align:center;font-size:14px}
.ops-recent-body{flex:1;min-width:0}
.ops-recent-text{font-size:13px;font-weight:500}
@media (min-width:1024px){.ops-grid{grid-template-columns:repeat(4,1fr)}}

/* ===== Palki OS — Today: weekly-health pill + daily checklist ===== */
.dash-health{display:flex;align-items:baseline;gap:12px;padding:12px 16px;margin:8px 0 14px;background:linear-gradient(90deg,#eef8f2,#fff);border:1px solid #cfe8da;border-radius:12px;text-decoration:none;color:inherit}
.dash-health-num{font-size:24px;font-weight:800;color:#0D3B2E;line-height:1}
.dash-health-label{font-weight:600}
.dash-hero-checklist{padding:18px;border-radius:14px;background:#fff8e8;border:1px solid #f0c14b}
.dash-hero-checklist .dash-hero-title{margin:6px 0 12px;font-size:20px}
.dash-checklist{display:flex;flex-direction:column;gap:0}
.dash-check-row{display:flex;align-items:center;gap:10px;margin:0;padding:10px 0;border-top:1px solid rgba(0,0,0,.06)}
.dash-check-row:first-child{border-top:none}
.dash-check-box{background:none;border:1.5px solid #0D3B2E;border-radius:50%;width:24px;height:24px;flex-shrink:0;font-size:14px;color:#0D3B2E;cursor:pointer;line-height:1;padding:0}
.dash-check-box:hover{background:#0D3B2E;color:#fff}
.dash-check-label{flex:1;color:inherit;text-decoration:none;font-size:14px;font-weight:500;line-height:1.4;min-width:0;word-break:break-word}
.dash-check-more{display:inline-block;margin-top:10px}
.dash-kpi-small .dash-kpi-num{font-size:18px}
.dash-kpi-small{margin-top:18px}

/* ===== Cross-links bar (admin handbook-edit) ===== */
.xlink-bar{display:flex;flex-direction:column;gap:8px;padding:12px 14px;margin:12px 0;background:#f5f8f6;border:1px solid #d9e6df;border-radius:12px}
.xlink-chunk{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.xlink-label{font-size:13px;font-weight:700;color:#0D3B2E;margin-right:4px}
.xlink-chip{display:inline-flex;align-items:center;gap:4px;padding:4px 10px;border-radius:14px;background:#fff;border:1px solid #cfe0d6;font-size:13px;font-weight:500;color:inherit;text-decoration:none}
.xlink-chip:hover{background:#0D3B2E;color:#fff;border-color:#0D3B2E}
.xlink-chip-draft{opacity:.7}
.xlink-chip-open{border-color:#1f7a4d}
.xlink-chip-closed{opacity:.5}

/* "Tests:" sub-line on admin quizzes list */
.quiz-row-tests{margin-top:4px}

/* Member: Test-yourself CTA at the bottom of a section page */
.hb-test-yourself{margin:24px auto 32px}
