/* =============================================================================
   Ops Room — global stylesheet
   Design tokens exactly as specified. Everything else builds on these.
   Mobile-first. No horizontal scroll from 320px up.
   ========================================================================== */

:root {
  --bg: #05080f;
  --surface: #0b0f1a;
  --surface2: #111827;
  --surface3: #161e2e;
  --border: rgba(255, 255, 255, 0.07);
  --border2: rgba(255, 255, 255, 0.11);

  --accent: #00d4aa;
  --accent2: #00b894;
  --accent-dim: rgba(0, 212, 170, 0.08);

  --white: #f0f4f8;
  --gray: #7a8899;
  --gray2: #a0adb8;

  --red: #f0566a;
  --red-dim: rgba(240, 86, 106, 0.09);
  --green: #10d48e;
  --green-dim: rgba(16, 212, 142, 0.09);
  --orange: #f59e0b;
  --orange-dim: rgba(245, 158, 11, 0.09);

  --radius: 9px;
  --radius-lg: 13px;
  --transition: 0.18s cubic-bezier(0.4, 0, 0.2, 1);

  --font-heading: "Cormorant Garamond", Georgia, "Noto Serif Bengali", serif;
  --font-body: "Manrope", -apple-system, "Segoe UI", "Noto Sans Bengali", system-ui, sans-serif;
  --font-mono: "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --header-h: 64px;
  --sidebar-w: 260px;
}

/* ── reset ─────────────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  background: var(--bg);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}
img,
svg {
  display: block;
  max-width: 100%;
}
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

/* Bengali text should never clip or overflow its container. */
:lang(bn),
.bn {
  font-family: var(--font-body);
  line-height: 1.55;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* ── typography ────────────────────────────────────────────────────────────── */
h1,
h2,
h3,
h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.4em;
  color: var(--white);
}
h1 {
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.15;
}
h2 {
  font-size: clamp(22px, 3.4vw, 28px);
  line-height: 1.2;
}
h3 {
  font-size: 18px;
  line-height: 1.3;
}
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--gray);
}
.muted {
  color: var(--gray);
}
.muted2 {
  color: var(--gray2);
}

/* ── app chrome ────────────────────────────────────────────────────────────── */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: rgba(5, 8, 15, 0.86);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 40;
}
.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.brand-logo {
  height: 32px;
  width: auto;
}
.brand-text {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.icon-btn {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--gray2);
  transition: color var(--transition), background var(--transition);
}
.icon-btn:hover,
.icon-btn:focus-visible {
  color: var(--white);
  background: var(--surface2);
  outline: none;
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--gray2);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: border-color var(--transition), color var(--transition);
}
.sync-pill:hover {
  border-color: var(--accent);
  color: var(--white);
}
.sync-pill.sync-unsynced {
  border-color: rgba(245, 158, 11, 0.4);
  color: var(--orange);
}
.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(16, 212, 142, 0.14);
}
.sync-pill.sync-unsynced .sync-dot {
  background: var(--orange);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16);
}
.sync-pill.sync-busy .sync-dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.18);
}
.sync-label {
  display: inline-block;
  white-space: nowrap;
  max-width: 42vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── sidebar ───────────────────────────────────────────────────────────────── */
.app-sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--sidebar-w);
  max-width: 82vw;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 18px 12px 12px;
  display: flex;
  flex-direction: column;
  transform: translateX(-102%);
  transition: transform var(--transition);
  z-index: 60;
  overflow-y: auto;
}
body.sidebar-open .app-sidebar {
  transform: translateX(0);
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: var(--radius);
  color: var(--gray2);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}
.sidebar-item .icon {
  flex: 0 0 auto;
  color: currentColor;
  opacity: 0.85;
}
.sidebar-item:hover,
.sidebar-item:focus-visible {
  background: var(--surface2);
  color: var(--white);
  outline: none;
}
.sidebar-item.active {
  background: var(--accent-dim);
  color: var(--accent);
}
.sidebar-item.active .icon {
  opacity: 1;
}
.sidebar-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.sidebar-signout {
  width: 100%;
  justify-content: flex-start;
  color: var(--gray2);
}
.sidebar-signout:hover {
  color: var(--red);
  background: var(--red-dim);
}

.app-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 50;
  opacity: 0;
  transition: opacity var(--transition);
}
.app-overlay[hidden] {
  display: none;
}
body.sidebar-open .app-overlay {
  opacity: 1;
}

/* ── main content area ─────────────────────────────────────────────────────── */
.app-content {
  padding: calc(var(--header-h) + 20px) 16px 60px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}
.page-head {
  margin-bottom: 20px;
}
.page-head h1 {
  margin-bottom: 4px;
}
.page-head .crumb {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--gray);
  margin-bottom: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.page-head .crumb a {
  color: var(--gray2);
  transition: color var(--transition);
}
.page-head .crumb a:hover {
  color: var(--accent);
}

/* ── cards / sections ──────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
}
.card + .card {
  margin-top: 14px;
}
.section {
  margin-bottom: 24px;
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.section-head h2,
.section-head h3 {
  margin: 0;
}
.grid {
  display: grid;
  gap: 14px;
}

/* ── buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition),
    color var(--transition), transform var(--transition);
  white-space: nowrap;
}
.btn .icon {
  flex: 0 0 auto;
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  background: var(--accent);
  color: #04140f;
}
.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--accent2);
  outline: none;
}
.btn-ghost {
  background: transparent;
  border-color: var(--border2);
  color: var(--white);
}
.btn-ghost:hover,
.btn-ghost:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}
.btn-danger {
  background: transparent;
  border-color: rgba(240, 86, 106, 0.4);
  color: var(--red);
}
.btn-danger:hover,
.btn-danger:focus-visible {
  background: var(--red-dim);
  border-color: var(--red);
  outline: none;
}
.btn-block {
  width: 100%;
}
.btn[disabled],
.btn.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* ── progress bar ──────────────────────────────────────────────────────────── */
.progress {
  height: 8px;
  width: 100%;
  border-radius: 999px;
  background: var(--surface3);
  overflow: hidden;
}
.progress-sm {
  height: 5px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent2), var(--accent));
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── counter ───────────────────────────────────────────────────────────────── */
.counter {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  background: var(--surface2);
  padding: 3px;
  min-height: 44px;
}
.counter-btn {
  width: 40px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--gray2);
  transition: background var(--transition), color var(--transition);
}
.counter-btn:hover:not(:disabled) {
  background: var(--surface3);
  color: var(--white);
}
.counter-btn:disabled,
.counter-btn.is-disabled {
  opacity: 0.28;
  cursor: not-allowed;
}
.counter-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  min-width: 38px;
  text-align: center;
  font-size: 15px;
  color: var(--white);
}
.counter-compact .counter-btn {
  width: 34px;
  height: 32px;
}
.counter-compact .counter-value {
  min-width: 30px;
  font-size: 14px;
}

/* ── toggle ────────────────────────────────────────────────────────────────── */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 4px;
  border-radius: var(--radius);
  color: var(--gray2);
  transition: color var(--transition);
}
.toggle:hover {
  color: var(--white);
}
.toggle-track {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: var(--surface3);
  border: 1px solid var(--border2);
  position: relative;
  flex: 0 0 auto;
  transition: background var(--transition), border-color var(--transition);
}
.toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--gray);
  transition: transform var(--transition), background var(--transition);
}
.toggle.on .toggle-track {
  background: var(--accent-dim);
  border-color: rgba(0, 212, 170, 0.55);
}
.toggle.on .toggle-knob {
  transform: translateX(18px);
  background: var(--accent);
}
.toggle-label {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── stage row (chapter tracker) ───────────────────────────────────────────── */
.stage {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.stage + .stage {
  margin-top: 10px;
}
.stage-num {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid var(--border2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--gray2);
}
.stage.done .stage-num {
  background: var(--green-dim);
  border-color: rgba(16, 212, 142, 0.55);
  color: var(--green);
}
.stage-body {
  flex: 1 1 auto;
  min-width: 0;
}
.stage-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 2px;
}
.stage-title.bn {
  font-weight: 500;
}
.stage-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--gray);
  letter-spacing: 0.02em;
}
.stage-control {
  flex: 0 0 auto;
}

/* ── stat display (dashboard hero) ─────────────────────────────────────────── */
.hero {
  padding: 22px 18px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: radial-gradient(
      120% 100% at 0% 0%,
      rgba(0, 212, 170, 0.08),
      transparent 55%
    ),
    var(--surface);
  margin-bottom: 22px;
}
.hero-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.hero-pct {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(44px, 11vw, 72px);
  line-height: 0.95;
  font-weight: 500;
  letter-spacing: -0.03em;
  color: var(--white);
}
.hero-pct .pct {
  font-size: 0.5em;
  color: var(--gray);
  margin-left: 2px;
}
.hero-meta {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  padding-bottom: 6px;
}
.hero-meta .stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hero-meta .stat-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--gray);
}
.hero-meta .stat-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 17px;
  color: var(--white);
}
.hero-meta .stat-value .div {
  color: var(--gray);
  margin: 0 2px;
}
.coin-val {
  color: var(--orange);
}

/* ── subject / paper cards ─────────────────────────────────────────────────── */
.subject-card {
  display: block;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  transition: border-color var(--transition), background var(--transition);
}
.subject-card:hover,
.subject-card:focus-visible {
  border-color: var(--border2);
  background: var(--surface2);
  outline: none;
}
.subject-card .row-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.subject-card .subj-name {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 600;
}
.subject-card .subj-name-bn {
  font-size: 13px;
  color: var(--gray2);
  margin-top: 1px;
}
.subject-card .pct {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  color: var(--gray2);
  white-space: nowrap;
}
.subject-card .meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

/* ── pills / badges ────────────────────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid var(--border2);
  color: var(--gray2);
  background: var(--surface2);
  white-space: nowrap;
}
.pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gray);
}
.pill.ok {
  color: var(--green);
  border-color: rgba(16, 212, 142, 0.4);
  background: var(--green-dim);
}
.pill.ok .dot {
  background: var(--green);
}
.pill.warn {
  color: var(--orange);
  border-color: rgba(245, 158, 11, 0.4);
  background: var(--orange-dim);
}
.pill.warn .dot {
  background: var(--orange);
}
.pill.danger {
  color: var(--red);
  border-color: rgba(240, 86, 106, 0.4);
  background: var(--red-dim);
}
.pill.danger .dot {
  background: var(--red);
}
.pill.custom {
  color: var(--accent);
  border-color: rgba(0, 212, 170, 0.4);
  background: var(--accent-dim);
}

/* ── chapter list (subject view) ───────────────────────────────────────────── */
.chapter-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chapter-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  min-height: 60px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  transition: border-color var(--transition), background var(--transition);
}
.chapter-row:hover,
.chapter-row:focus-visible {
  border-color: var(--border2);
  background: var(--surface2);
  outline: none;
}
.chapter-row .cr-idx {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--gray);
  min-width: 24px;
}
.chapter-row .cr-body {
  flex: 1 1 auto;
  min-width: 0;
}
.chapter-row .cr-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--white);
  word-break: break-word;
}
.chapter-row .cr-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--gray);
  margin-top: 2px;
}
.chapter-row .cr-status {
  flex: 0 0 auto;
}
.cr-check {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--gray);
}
.cr-check.done {
  background: var(--green-dim);
  border-color: rgba(16, 212, 142, 0.55);
  color: var(--green);
}

/* ── tabs ──────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin-bottom: 18px;
}
.tabs::-webkit-scrollbar {
  display: none;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 6px;
  color: var(--gray2);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
}
.tab:hover {
  color: var(--white);
}
.tab.active {
  background: var(--surface3);
  color: var(--accent);
}

/* ── forms ─────────────────────────────────────────────────────────────────── */
.field {
  margin-bottom: 14px;
}
.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--gray);
  margin-bottom: 7px;
}
.input {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border2);
  background: var(--surface2);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 15px;
  transition: border-color var(--transition), background var(--transition);
}
.input::placeholder {
  color: var(--gray);
}
.input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}
.field-hint {
  font-size: 12px;
  color: var(--gray);
  margin-top: 6px;
}
.field-error {
  font-size: 12.5px;
  color: var(--red);
  margin-top: 6px;
  min-height: 1.2em;
}

/* ── toast ─────────────────────────────────────────────────────────────────── */
.toast-host {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
  pointer-events: none;
  align-items: center;
}
.toast {
  pointer-events: auto;
  max-width: 480px;
  width: fit-content;
  padding: 11px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border2);
  background: var(--surface2);
  color: var(--white);
  font-size: 13.5px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  transform: translateY(8px);
  opacity: 0;
  transition: transform var(--transition), opacity var(--transition);
  cursor: pointer;
}
.toast.in {
  transform: translateY(0);
  opacity: 1;
}
.toast-error {
  border-color: rgba(240, 86, 106, 0.5);
  background: linear-gradient(0deg, var(--red-dim), var(--red-dim)), var(--surface2);
}
.toast-success {
  border-color: rgba(16, 212, 142, 0.4);
}
.toast-info {
  border-color: rgba(0, 212, 170, 0.35);
}

/* ── modal ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 90;
  opacity: 0;
  transition: opacity var(--transition);
}
.modal-overlay.in {
  opacity: 1;
}
.modal {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
.modal-title {
  margin: 0 0 8px;
  font-family: var(--font-heading);
  font-size: 22px;
}
.modal-body {
  margin: 0 0 18px;
  color: var(--gray2);
  font-size: 14px;
  line-height: 1.55;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── empty / loading / error states ────────────────────────────────────────── */
.state {
  padding: 36px 20px;
  text-align: center;
  border: 1px dashed var(--border2);
  border-radius: var(--radius-lg);
  color: var(--gray);
}
.state .state-title {
  font-family: var(--font-heading);
  font-size: 20px;
  color: var(--white);
  margin-bottom: 6px;
}
.state .state-body {
  font-size: 13.5px;
  margin-bottom: 16px;
}
.spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border2);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── utility ───────────────────────────────────────────────────────────────── */
.row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.row-between {
  justify-content: space-between;
}
.row-wrap {
  flex-wrap: wrap;
}
.stack > * + * {
  margin-top: 10px;
}
.hr {
  height: 1px;
  background: var(--border);
  border: 0;
  margin: 18px 0;
}
.hidden {
  display: none !important;
}
.nowrap {
  white-space: nowrap;
}
.tnum {
  font-variant-numeric: tabular-nums;
}

/* Set on <body> before boot to prevent unstyled flash; removed by Ops.boot(). */
body.booting {
  visibility: hidden;
}

/* =============================================================================
   ≥640px — wider layouts
   ========================================================================== */
@media (min-width: 640px) {
  .app-content {
    padding-left: 22px;
    padding-right: 22px;
  }
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

/* =============================================================================
   ≥860px — sidebar permanently visible, no hamburger
   ========================================================================== */
@media (min-width: 860px) {
  .app-header {
    left: var(--sidebar-w);
    padding: 0 24px;
  }
  .app-sidebar {
    transform: translateX(0);
    border-right: 1px solid var(--border);
  }
  .app-overlay {
    display: none !important;
  }
  .app-content {
    margin-left: var(--sidebar-w);
    max-width: calc(1100px + var(--sidebar-w));
    padding: calc(var(--header-h) + 26px) 28px 80px;
  }
  .header-left .icon-btn {
    display: none;
  }
  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
  .hero {
    padding: 26px 24px;
  }
}

/* =============================================================================
   ≥1100px — breathing room
   ========================================================================== */
@media (min-width: 1100px) {
  .grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ── accessibility ─────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
