/* My Maktab design system (U24d, 5 Nov 2026). One spacing scale, one type scale, elevation, button sizes, status pills,
   empty states and skeleton loaders, for both looks, light and dark. Documented in docs/design/DESIGN-SYSTEM.md.
   Loaded on every page straight after csp.css; school colours (U23 Theme.css) still load last and win.
   New work uses these tokens and classes (ds-*); older page styles keep working and move over as pages are touched. */
:root {
  /* Spacing: a 4px grid. Use these for padding, margins and gaps; nothing in between. */
  --ds-space-0: 0; --ds-space-1: .25rem; --ds-space-2: .5rem; --ds-space-3: .75rem; --ds-space-4: 1rem;
  --ds-space-5: 1.5rem; --ds-space-6: 2rem; --ds-space-7: 3rem; --ds-space-8: 4rem;
  /* Type: rem only (zoom and the U13 text-size setting scale it); 14px is the smallest text anywhere. */
  --ds-text-sm: .875rem; --ds-text-base: 1rem; --ds-text-md: 1.125rem; --ds-text-lg: 1.25rem;
  --ds-text-xl: 1.5rem; --ds-text-2xl: 1.75rem; --ds-text-3xl: 2.25rem;
  --ds-leading-tight: 1.25; --ds-leading: 1.55;
  --ds-weight-normal: 400; --ds-weight-medium: 600; --ds-weight-bold: 750;
  /* Corners. */
  --ds-radius-sm: 10px; --ds-radius-md: 14px; --ds-radius-lg: 20px; --ds-radius-pill: 999px;
  /* Elevation: 0 flat, 1 resting card, 2 raised (hover, sticky header), 3 floating (menus, dialogs). */
  --ds-elev-0: none;
  --ds-elev-1: 0 1px 2px rgba(16,24,20,.06), 0 4px 16px rgba(16,24,20,.06);
  --ds-elev-2: 0 2px 4px rgba(16,24,20,.08), 0 12px 28px rgba(16,24,20,.10);
  --ds-elev-3: 0 4px 8px rgba(16,24,20,.10), 0 24px 48px rgba(16,24,20,.16);
  /* Control heights (U15 neat buttons): every target at least 40px. */
  --ds-control-sm: 2.5rem; --ds-control-md: 2.75rem; --ds-control-lg: 3rem;
  /* Status colours: text on its own soft background, WCAG AA in both modes (ReadabilityTests). */
  --ds-ok: #0b6b45; --ds-ok-bg: #dff5ea; --ds-warn: #7a4f00; --ds-warn-bg: #fff2d6; --ds-danger: #a1271b; --ds-danger-bg: #fde7e5;
  --ds-info: #1d4ed8; --ds-info-bg: #e6eefc; --ds-neutral: #4b5563; --ds-neutral-bg: #eceff2; --ds-special: #5b34a8; --ds-special-bg: #efe8fb;
  /* Surfaces for components (the new look's own tokens when it's on; plain values in the classic look). */
  --ds-surface: var(--mm-surface, #ffffff); --ds-surface-2: var(--mm-surface-2, #f8faf9); --ds-line: var(--mm-line, #dde4e0);
  --ds-ink: var(--mm-ink, #17231e); --ds-ink-muted: var(--mm-ink-muted, #4c5a53); --ds-accent: var(--mm-accent, #146c43);
  --ds-skeleton: #e4ebe7; --ds-skeleton-shine: #f3f7f5;
}
[data-theme="dark"] {
  --ds-elev-1: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
  --ds-elev-2: 0 2px 6px rgba(0,0,0,.5), 0 12px 28px rgba(0,0,0,.4);
  --ds-elev-3: 0 4px 10px rgba(0,0,0,.55), 0 24px 48px rgba(0,0,0,.5);
  --ds-ok: #7ce3b4; --ds-ok-bg: #12352a; --ds-warn: #ffd27a; --ds-warn-bg: #3a2e10; --ds-danger: #ff9a91; --ds-danger-bg: #401b18;
  --ds-info: #a9c5ff; --ds-info-bg: #1b2a44; --ds-neutral: #c2c9d3; --ds-neutral-bg: #262c33; --ds-special: #cdb2ff; --ds-special-bg: #2c1d47;
  --ds-skeleton: #24302b; --ds-skeleton-shine: #2e3b35;
}
@media (prefers-color-scheme: dark) {
  [data-theme="auto"] {
    --ds-elev-1: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
    --ds-elev-2: 0 2px 6px rgba(0,0,0,.5), 0 12px 28px rgba(0,0,0,.4);
    --ds-elev-3: 0 4px 10px rgba(0,0,0,.55), 0 24px 48px rgba(0,0,0,.5);
    --ds-ok: #7ce3b4; --ds-ok-bg: #12352a; --ds-warn: #ffd27a; --ds-warn-bg: #3a2e10; --ds-danger: #ff9a91; --ds-danger-bg: #401b18;
    --ds-info: #a9c5ff; --ds-info-bg: #1b2a44; --ds-neutral: #c2c9d3; --ds-neutral-bg: #262c33; --ds-special: #cdb2ff; --ds-special-bg: #2c1d47;
    --ds-skeleton: #24302b; --ds-skeleton-shine: #2e3b35;
  }
}

/* Cards: one look, three elevations. */
.ds-card { background: var(--ds-surface); border: 1px solid var(--ds-line); border-radius: var(--ds-radius-md); box-shadow: var(--ds-elev-1); padding: var(--ds-space-5); }
.ds-card-flat { box-shadow: var(--ds-elev-0); }
.ds-card-raised { box-shadow: var(--ds-elev-2); }
a.ds-card { display: block; color: var(--ds-ink); text-decoration: none; transition: box-shadow .15s ease, transform .15s ease; }
a.ds-card:hover { box-shadow: var(--ds-elev-2); transform: translateY(-1px); }

/* Button sizes, on top of Bootstrap's .btn (U15): small, normal, large. Each is at least 40px high. */
.btn.ds-btn-sm { min-height: var(--ds-control-sm); padding: 0 var(--ds-space-3); font-size: var(--ds-text-sm); display: inline-flex; align-items: center; gap: var(--ds-space-2); }
.btn.ds-btn-md { min-height: var(--ds-control-md); padding: 0 var(--ds-space-4); font-size: var(--ds-text-base); display: inline-flex; align-items: center; gap: var(--ds-space-2); }
.btn.ds-btn-lg { min-height: var(--ds-control-lg); padding: 0 var(--ds-space-5); font-size: var(--ds-text-md); display: inline-flex; align-items: center; gap: var(--ds-space-2); }

/* Status pills: a word (never colour alone) on a soft background. Not clickable: for a clickable pill use .mm-pill. */
.ds-status { display: inline-flex; align-items: center; gap: var(--ds-space-1); padding: .15rem .6rem; border-radius: var(--ds-radius-pill);
  font-size: var(--ds-text-sm); font-weight: var(--ds-weight-bold); line-height: 1.5; white-space: nowrap; color: var(--ds-neutral); background: var(--ds-neutral-bg); }
.ds-status::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }
.ds-status-ok { color: var(--ds-ok); background: var(--ds-ok-bg); }
.ds-status-warn { color: var(--ds-warn); background: var(--ds-warn-bg); }
.ds-status-danger { color: var(--ds-danger); background: var(--ds-danger-bg); }
.ds-status-info { color: var(--ds-info); background: var(--ds-info-bg); }
.ds-status-neutral { color: var(--ds-neutral); background: var(--ds-neutral-bg); }
.ds-status-special { color: var(--ds-special); background: var(--ds-special-bg); }

/* Empty states: an icon, what's missing, and the next step (partial _EmptyState). */
.ds-empty { display: flex; flex-direction: column; align-items: center; gap: var(--ds-space-2); padding: var(--ds-space-6) var(--ds-space-4); text-align: center; color: var(--ds-ink-muted); }
.ds-empty-icon { display: inline-flex; align-items: center; justify-content: center; width: 3.5rem; height: 3.5rem; border-radius: 50%;
  background: var(--ds-surface-2); border: 1px solid var(--ds-line); color: var(--ds-accent); }
.ds-empty-icon .mm-icon { width: 1.75rem; height: 1.75rem; }
.ds-empty-title { margin: var(--ds-space-2) 0 0; font-size: var(--ds-text-md); font-weight: var(--ds-weight-bold); color: var(--ds-ink); }
.ds-empty p { margin: 0; max-width: 46ch; }
.ds-empty .btn { margin-top: var(--ds-space-2); }

/* Skeleton loaders: grey shapes where content is still on its way (anything filled in after the page loads).
   The block is hidden from screen readers; the surrounding region says "Loading…" in words. Still for "reduce motion". */
.ds-skeleton { display: block; border-radius: var(--ds-radius-sm); background: var(--ds-skeleton); }
.ds-skeleton-line { height: 1rem; margin: var(--ds-space-2) 0; }
.ds-skeleton-line.is-short { width: 60%; }
.ds-skeleton-block { height: 6rem; }
@media (prefers-reduced-motion: no-preference) {
  .ds-skeleton { background: linear-gradient(90deg, var(--ds-skeleton) 0%, var(--ds-skeleton-shine) 50%, var(--ds-skeleton) 100%); background-size: 200% 100%; animation: ds-shimmer 1.4s ease-in-out infinite; }
}
@keyframes ds-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* Stack and cluster helpers on the spacing scale. */
.ds-stack > * + * { margin-top: var(--ds-space-4); }
.ds-cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ds-space-2); }
