/* ============================================================
   HAMDAM — Component styles
   Cards, buttons, pills, forms, tables, avatars, and more.
   Design tokens must be loaded first (tokens.css).
   Base styles live in base.css.
   ============================================================ */

/* ============================================================
   Card
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  padding: var(--pad-4);
}
.card.flush { padding: 0; }
.card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}
.card-link:hover {
  border-color: color-mix(in oklch, var(--accent) 38%, var(--line));
  box-shadow: var(--shadow-soft);
}
.card-link:active { transform: translateY(1px); }

/* ============================================================
   Button
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease, border-color 120ms ease;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}
.btn.primary:hover { background: color-mix(in oklch, var(--accent) 92%, black 8%); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 32px; padding: 0 14px; font-size: 13px; }
.btn.lg { height: 50px; padding: 0 26px; font-size: 15px; }
.btn:disabled, .btn.disabled { opacity: 0.4; pointer-events: none; }

.dashboard-form-actions {
  gap: 10px;
  margin-top: 4px;
}
.dashboard-form-actions-cancel { margin-left: auto; }

@media (max-width: 640px) {
  .dashboard-form-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  .dashboard-form-actions .btn {
    justify-content: center;
    width: 100%;
    height: auto;
    min-height: 44px;
    padding-block: 10px;
    text-align: center;
    line-height: 1.2;
    white-space: normal;
  }
  .dashboard-form-actions-cancel { margin-left: 0; }
}

/* ============================================================
   Pill / badge
   ============================================================ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 11.5px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.pill.dot::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 999px;
  background: currentColor;
}
.pill.accent { background: color-mix(in oklch, var(--accent) 14%, var(--surface)); border-color: color-mix(in oklch, var(--accent) 30%, var(--line)); color: var(--accent); }
.pill.success { background: color-mix(in oklch, var(--success) 14%, var(--surface)); border-color: color-mix(in oklch, var(--success) 30%, var(--line)); color: var(--success); }
.pill.warning { background: color-mix(in oklch, var(--warning) 18%, var(--surface)); border-color: color-mix(in oklch, var(--warning) 32%, var(--line)); color: oklch(0.45 0.10 75); }
.pill.count-pill {
  height: 18px;
  min-width: 18px;
  padding: 0 5px;
  justify-content: center;
  gap: 0;
  font-size: 10px;
  letter-spacing: 0;
  line-height: 1;
  flex: none;
}
.btn .count-pill { margin-left: 2px; }
.nav-item .count-pill { margin-left: auto; }

.status-pill {
  --status-pill-c: currentColor;
  position: relative;
  max-width: 100%;
  white-space: nowrap;
  color: var(--status-pill-c);
  background: color-mix(in oklch, var(--status-pill-c) 13%, var(--surface));
  border-color: color-mix(in oklch, var(--status-pill-c) 30%, var(--line));
  cursor: help;
  outline: none;
}
.status-pill > svg {
  width: 14px;
  height: 14px;
  flex: none;
}
.status-pill-label {
  overflow: hidden;
  text-overflow: ellipsis;
}
.status-pill:focus-visible {
  box-shadow: 0 0 0 2px color-mix(in oklch, var(--status-pill-c) 36%, transparent);
}
.status-pill[data-track] { --status-pill-c: var(--track-c, var(--accent)); }
.status-pill[data-publication="draft"] { --status-pill-c: var(--muted); }
.status-pill[data-publication="open"] { --status-pill-c: var(--accent); }
.status-pill[data-publication="archived"] { --status-pill-c: var(--ink-soft); }
.status-pill[data-funding="fundraising"] { --status-pill-c: var(--success); }
.status-pill[data-funding="funded"] { --status-pill-c: var(--success); }
.status-pill[data-intake="accepting"] { --status-pill-c: var(--accent-2); }
.status-pill[data-intake="closed"] { --status-pill-c: var(--warning); }
.project-status-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}

/* ============================================================
   Banner / Alert
   ============================================================ */
.banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r-2);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 13.5px;
}
.banner .ico {
  width: 18px;
  height: 18px;
  flex: none;
  margin-top: 1px;
  color: var(--ink-soft);
}
.banner .body { flex: 1; min-width: 0; }
.banner .title { font-weight: 500; color: var(--ink); margin-bottom: 2px; }
.banner .actions { display: inline-flex; gap: 6px; margin-top: 10px; }
.banner.info {
  background: color-mix(in oklch, var(--accent-2) 8%, var(--surface));
  border-color: color-mix(in oklch, var(--accent-2) 28%, var(--line));
}
.banner.info .ico { color: var(--accent-2); }
.banner.success {
  background: color-mix(in oklch, var(--success) 8%, var(--surface));
  border-color: color-mix(in oklch, var(--success) 28%, var(--line));
}
.banner.success .ico { color: var(--success); }
.banner.warning {
  background: color-mix(in oklch, var(--warning) 12%, var(--surface));
  border-color: color-mix(in oklch, var(--warning) 32%, var(--line));
}
.banner.warning .ico { color: oklch(0.45 0.10 75); }
.banner.danger,
.banner.error {
  background: color-mix(in oklch, var(--danger) 8%, var(--surface));
  border-color: color-mix(in oklch, var(--danger) 28%, var(--line));
}
.banner.danger .ico,
.banner.error .ico { color: var(--danger); }

/* ============================================================
   File upload / dropzone
   ============================================================ */
.dropzone {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 28px 20px;
  border-radius: var(--r-3);
  border: 1.5px dashed var(--line);
  background: var(--surface-2);
  text-align: center;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}
.dropzone input[type="file"] {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}
.dropzone:hover, .dropzone.dragging {
  border-color: var(--accent);
  background: color-mix(in oklch, var(--accent) 5%, var(--surface));
  color: var(--ink);
}
.dropzone .ico {
  width: 28px;
  height: 28px;
  margin: 0 auto 4px;
  color: var(--muted);
}
.dropzone:hover .ico, .dropzone.dragging .ico { color: var(--accent); }
.dropzone .primary-line { color: var(--ink); font-weight: 500; font-size: 14px; }
.dropzone .sub-line {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dropzone.has-file .sub-line { color: var(--accent); }

/* ============================================================
   Cell badge — condensed icon + tooltip for table columns
   (Track, Status). A stamped colored disc whose full label
   shows on hover AND focus/tap (mobile) via the generic .tip
   tooltip below — no JS. Color comes from data-track/data-status.
   ============================================================ */
.cell-ico {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 999px;
  cursor: help;
  outline: none;
  color: var(--badge-c, var(--ink-soft));
  background: color-mix(in oklch, var(--badge-c, var(--ink-soft)) 14%, transparent);
}
.cell-ico > svg { width: 16px; height: 16px; }
.cell-ico:focus-visible { box-shadow: 0 0 0 2px color-mix(in oklch, var(--badge-c, var(--accent)) 40%, transparent); }

/* Track colors (mirror design/prototypes track-iconographics) */
.cell-ico[data-track="scholarship"]       { --badge-c: var(--accent); }
.cell-ico[data-track="teacher_stipend"]   { --badge-c: var(--accent-2); }
.cell-ico[data-track="it_course"]         { --badge-c: color-mix(in oklch, var(--ink) 65%, var(--accent-2) 35%); }
.cell-ico[data-track="medical_program"]   { --badge-c: var(--danger); }
.cell-ico[data-track="humanitarian_aid"]  { --badge-c: var(--warning); }
.cell-ico[data-track="full_year_support"] { --badge-c: var(--ink-soft); }

/* Status colors */
.cell-ico[data-status="draft"]     { --badge-c: var(--muted); }
.cell-ico[data-status="open"]      { --badge-c: var(--accent); }
.cell-ico[data-status="funded"]    { --badge-c: var(--success); }
.cell-ico[data-status="completed"] { --badge-c: var(--success); }
.cell-ico[data-status="pending"]   { --badge-c: var(--warning); }
.cell-ico[data-status="archived"]  { --badge-c: var(--ink-soft); }
.cell-ico[data-publication="draft"]    { --badge-c: var(--muted); }
.cell-ico[data-publication="open"]     { --badge-c: var(--accent); }
.cell-ico[data-publication="archived"] { --badge-c: var(--ink-soft); }
.cell-ico[data-funding="fundraising"]  { --badge-c: var(--success); }
.cell-ico[data-funding="funded"]       { --badge-c: var(--success); }

/* Application-intake colors shown beside financial/lifecycle status. */
.cell-ico[data-intake="accepting"] { --badge-c: var(--accent-2); }
.cell-ico[data-intake="closed"]    { --badge-c: var(--warning); }

.status-duo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
}

/* Track & Status columns hold a single icon badge — keep them to content width
   instead of letting the auto table layout hand them slack (the table is
   stretched by its min-width, so unconstrained columns would balloon). */
.tbl td:has(> .cell-ico),
.tbl td:has(> .status-duo) { width: 1%; white-space: nowrap; text-align: center; }
.tbl th.th-sort:has(a[href*="sort=track"]),
.tbl th.th-sort:has(a[href*="sort=status"]) { width: 1%; white-space: nowrap; text-align: center; }

/* Generic tooltip bubble — attach `.tip` to a positioned trigger and put a
   `.tip-pop` child inside. Reveals on hover, keyboard focus, and tap. */
.tip { position: relative; }
.tip-pop {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translate(-50%, 4px);
  background: var(--ink);
  color: var(--bg);
  padding: 5px 9px;
  border-radius: var(--r-1);
  font-size: 11.5px;
  font-family: var(--font-body);
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
  z-index: 200;
}
.tip-pop::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--ink);
}
.tip:hover .tip-pop,
.tip:focus .tip-pop,
.tip:focus-within .tip-pop {
  opacity: 1;
  transform: translate(-50%, 0);
}
.tip.tip-right .tip-pop {
  left: auto;
  right: 0;
  transform: translateY(4px);
}
.tip.tip-right .tip-pop::after {
  left: auto;
  right: 12px;
  transform: none;
}
.tip.tip-right:hover .tip-pop,
.tip.tip-right:focus .tip-pop,
.tip.tip-right:focus-within .tip-pop {
  transform: translateY(0);
}
.tip.is-open .tip-pop {
  opacity: 1;
  pointer-events: none;
}
.tip.tip-right.is-open .tip-pop { transform: translateY(0); }
/* ============================================================
   Divider
   ============================================================ */
.divider {
  border: none; border-top: 1px solid var(--line);
  margin: 0;
}

/* ============================================================
   Photo placeholder
   Striped background with label. Use wherever a real photo goes.
   ============================================================ */
.photo {
  position: relative;
  border-radius: var(--r-3);
  overflow: hidden;
  background:
    repeating-linear-gradient(
      135deg,
      color-mix(in oklch, var(--accent) 18%, var(--surface)) 0 14px,
      color-mix(in oklch, var(--accent) 8%, var(--surface)) 14px 28px
    );
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  color: var(--ink);
  isolation: isolate;
}
.photo .label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 4px 10px;
  margin: 12px;
  color: var(--ink-soft);
}
.photo.muted {
  background:
    repeating-linear-gradient(
      135deg,
      var(--surface-2) 0 14px,
      color-mix(in oklch, var(--surface-2) 80%, var(--ink-soft) 20%) 14px 28px
    );
}

/* ============================================================
   Stat card
   ============================================================ */
.stat {
  display: flex; flex-direction: column; gap: 8px;
  min-width: 0;
}
.stat .v {
  font-family: var(--font-display);
  font-size: clamp(24px, 2.6vw, 44px);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
  word-break: keep-all;
}
.stat .l {
  font-family: var(--font-mono);
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.stat .d {
  font-size: 12.5px;
  color: var(--ink-soft);
}

/* ============================================================
   Forms
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--ink-soft); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; }
.input, .textarea, .select {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 18%, transparent);
}
.textarea { resize: vertical; min-height: 100px; }

/* ============================================================
   Table
   ============================================================ */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; }
.tbl th { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; font-size: 10.5px; color: var(--muted); font-weight: 500; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: color-mix(in oklch, var(--surface-2) 60%, transparent); }

/* Sortable column headers. A header is a plain link that changes the query's
   ORDER BY (full page reload); the caret shows the active sort + direction.
   The neutral caret is faint until hover so unsorted columns stay quiet. */
.th-sort { padding: 0; }
.th-sort-link {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 12px 14px;
    color: inherit; text-decoration: none; cursor: pointer;
    user-select: none; white-space: nowrap;
}
.th-sort[style*="right"] .th-sort-link { flex-direction: row-reverse; }
.th-sort-link:hover { color: var(--ink); }
.th-sort .sort-ico {
    width: 11px; height: 11px; flex: none;
    opacity: 0; transition: opacity 0.12s ease, color 0.12s ease;
}
.th-sort-link:hover .sort-ico { opacity: 0.5; }
.th-sort.is-sorted .sort-ico { opacity: 0.95; color: var(--accent); }

/* ============================================================
   Avatar
   ============================================================ */
.avatar {
  width: 36px; height: 36px;
  border-radius: 999px;
  background: linear-gradient(135deg, color-mix(in oklch, var(--accent) 35%, var(--surface)), color-mix(in oklch, var(--accent-2) 35%, var(--surface)));
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--ink);
  border: 1px solid var(--line);
  flex: none;
}
.avatar.sm { width: 28px; height: 28px; font-size: 13px; }
.avatar.lg { width: 56px; height: 56px; font-size: 22px; }

/* ============================================================
   Notification dot
   ============================================================ */
.dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 999px;
  background: var(--accent);
}

/* ============================================================
   Typography utilities (also referenced from tokens)
   ============================================================ */
.eyebrow {
  font-family: var(--font-mono);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--muted);
}
.mono { font-family: var(--font-mono); }

/* ============================================================
   Toast — floating notification (from widgets blueprint)
   ============================================================ */
.toast-stack {
  position: fixed;
  top: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}
.toast {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  color: var(--ink);
  min-width: 280px;
  max-width: 360px;
  align-items: flex-start;
  pointer-events: auto;
  animation: toast-in 200ms cubic-bezier(.2,.7,.2,1);
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.toast .ico {
  width: 16px;
  height: 16px;
  flex: none;
  margin-top: 2px;
  color: var(--accent);
}
.toast .body { flex: 1; }
.toast .title { font-weight: 500; }
.toast .body .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.toast .close {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  padding: 0 4px;
}
.toast .close:hover { color: var(--ink); }
.toast.success .ico { color: var(--success); }
.toast.error .ico   { color: var(--danger); }
.toast.info .ico    { color: var(--accent); }

/* Spinner */
.spin { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn.loading { opacity: 0.6; pointer-events: none; }

/* Public payment status */
.payment-status-icon {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--pad-3);
  border-radius: 50%;
  color: var(--bg);
  font-size: 2rem;
}
.payment-status-icon.completed { background: var(--success); }
.payment-status-icon.pending { background: var(--warning); }
.payment-status-icon.refunded { background: var(--info, var(--accent)); }
.payment-status-icon.failed { background: var(--danger); }
.payment-status-spinner {
  width: 34px;
  height: 34px;
}
.payment-status-processing {
  min-height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.payment-status-announcement {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .payment-status-spinner { animation: none; }
}

/* ============================================================
   Scrollbar
   ============================================================ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   Dropdown / Select / Menu — replaces the native <select> with
   a fully-styled, themed popover. Three roles:
     .dd                 — value-bearing select (Select component)
     .dd.menu            — action menu (no selection state)
     .dd.combo           — search-filterable combobox
   ============================================================ */
.dd { position: relative; display: inline-block; }

.dd-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 12px 0 14px;
  border: 1px solid var(--line); border-radius: var(--r-2);
  background: var(--surface); color: var(--ink);
  font-family: inherit; font-size: 14px;
  cursor: pointer; min-width: 180px;
  transition: background 120ms ease, border-color 120ms ease;
}
.dd-trigger .placeholder { color: var(--muted); }
.dd-trigger .caret {
  margin-left: auto; opacity: 0.55; font-size: 10px;
  transform: translateY(1px);
  transition: transform 140ms ease;
}
.dd-trigger:hover { background: var(--surface-2); }
.dd-trigger[aria-expanded="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 18%, transparent);
}
.dd-trigger[aria-expanded="true"] .caret { transform: rotate(180deg) translateY(-1px); }
.dd-trigger.sm { height: 32px; font-size: 13px; padding: 0 10px 0 12px; min-width: 140px; }
.dd-trigger.ghost {
  border-color: transparent; background: transparent;
}
.dd-trigger.ghost:hover { background: var(--surface-2); }

/* Icon-only menu trigger (kebab / overflow) */
.dd-trigger.icon {
  min-width: 0; width: 36px; height: 36px;
  padding: 0; justify-content: center;
  border-color: transparent; background: transparent;
}
.dd-trigger.icon:hover { background: var(--surface-2); }
.dd-trigger.icon .caret { display: none; }

.dd-menu {
  position: absolute; top: calc(100% + 6px); left: 0;
  min-width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 100;
  max-height: 320px; overflow: auto;
  animation: dd-pop 140ms cubic-bezier(.2,.7,.2,1);
}
.dd-menu.right { left: auto; right: 0; }
.dd-menu.wide { min-width: 260px; }
@keyframes dd-pop {
  from { opacity: 0; transform: translateY(-4px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.dd-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-1);
  cursor: pointer;
  font-size: 14px;
  color: var(--ink);
  user-select: none;
  white-space: nowrap;
}
button.dd-item {
  width: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  text-align: left;
}
a.dd-item {
  text-decoration: none;
}
.dd-item:hover { background: var(--surface-2); }
.dd-item[aria-selected="true"] {
  background: color-mix(in oklch, var(--accent) 10%, var(--surface));
  color: var(--accent);
}
.dd-item[aria-selected="true"] .check {
  display: inline-flex;
  width: 14px;
  height: 14px;
  flex: none;
}
.dd-item[aria-selected="true"] .check svg {
  width: 14px;
  height: 14px;
}
.dd-item .check {
  display: none;
}
.dd-item.no-check { padding-left: 10px; }
.dd-item .ico { width: 14px; height: 14px; flex: none; color: var(--ink-soft); }
.dd-item .hint {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}
.dd-item.danger { color: var(--danger); }
.dd-item.danger:hover { background: color-mix(in oklch, var(--danger) 10%, var(--surface)); }
.dd-item.disabled { opacity: 0.4; pointer-events: none; }

.dd-separator { height: 1px; background: var(--line-soft); margin: 6px 4px; border: 0; }
.dd-section-label {
  font-family: var(--font-mono);
  text-transform: uppercase;
  font-size: 10px; letter-spacing: 0.1em;
  color: var(--muted);
  padding: 10px 10px 4px;
}

.dd-search {
  padding: 8px 10px 4px;
  border-bottom: 1px solid var(--line-soft);
  margin: -6px -6px 6px;
}
.dd-search input {
  width: 100%; border: none; background: transparent;
  font-family: inherit; font-size: 13px; outline: none;
  padding: 4px 2px;
  color: var(--ink);
}
.dd-search input::placeholder { color: var(--muted); }

/* ============================================================
   Modal — centered overlay dialog. Uses fixed positioning
   with backdrop. Adapted from widgets-new.jsx Modal component.
   ============================================================ */
@keyframes modal-fade { from { opacity: 0; } }
@keyframes modal-in {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.97); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.modal-backdrop {
  position: fixed; inset: 0;
  background: oklch(0.2 0.02 60 / 0.35);
  z-index: 80;
  animation: modal-fade 160ms ease;
}
.modal-dialog {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(96vw, 720px);
  max-height: 88vh;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-4);
  box-shadow: var(--shadow-lg);
  z-index: 81;
  display: flex; flex-direction: column;
  animation: modal-in 160ms ease;
}
dialog.modal-dialog {
  padding: 0;
  margin: 0;
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  box-sizing: border-box;
  color: var(--ink);
}
dialog.modal-dialog:not([open]) { display: none; }
dialog.modal-dialog::backdrop {
  background: oklch(0.2 0.02 60 / 0.35);
  animation: modal-fade 160ms ease;
}
.modal-dialog.sm { width: min(96vw, 460px); }
.modal-header {
  display: flex; align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
}
.modal-header .title {
  font-size: 17px; font-weight: 500; margin-top: 2px;
}
.modal-body { padding: 22px 24px; flex: 1; overflow-y: auto; }
.modal-footer {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  justify-content: flex-end;
}

/* ============================================================
   Drawer — right-side panel
   ============================================================ */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: oklch(0.2 0.02 60 / 0.3);
  z-index: 50;
  opacity: 0; pointer-events: none;
  transition: opacity 180ms ease;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; bottom: 0; right: 0;
  width: min(96vw, 520px);
  background: var(--bg);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  z-index: 51;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 220ms ease;
}
.drawer.open { transform: translateX(0); }
.drawer-header {
  padding: 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
}
.drawer-header .title {
  font-family: var(--font-display); font-size: 20px; font-weight: 400;
}
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }
.drawer-form-actions {
  display: flex;
  justify-content: flex-end;
}
.drawer-form-actions .btn {
  width: auto;
  flex: none;
}

/* ============================================================
   Checkbox / Radio / Switch — the prototype currently relies on
   native <input>, which doesn't theme. These wrap the native
   control with a styled box.
   ============================================================ */
.check-input, .radio-input, .toggle-input {
  position: relative;
  display: inline-flex; align-items: center; gap: 10px;
  cursor: pointer; user-select: none;
  font-family: var(--font-body);
  font-size: 14px; color: var(--ink);
  letter-spacing: 0;
  text-transform: none;
}
.field .check-input,
.field .radio-input,
.field .toggle-input {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: 0;
  text-transform: none;
}
.check-input input,
.radio-input input,
.toggle-input input {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  opacity: 0; pointer-events: none;
}

/* Checkbox */
.check-input .box {
  width: 18px; height: 18px; flex: none;
  border-radius: var(--r-1);
  border: 1.5px solid var(--line);
  background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 120ms ease, border-color 120ms ease;
}
.check-input .box svg { opacity: 0; color: var(--accent-ink); width: 12px; height: 12px; transition: opacity 120ms ease; }
.check-input input:checked + .box {
  background: var(--accent); border-color: var(--accent);
}
.check-input input:checked + .box svg { opacity: 1; }
.check-input input:focus-visible + .box {
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 22%, transparent);
}
.check-input input:disabled + .box { opacity: 0.4; }
.check-input input:disabled ~ * { color: var(--muted); }
.check-input input:indeterminate + .box {
  background: var(--accent); border-color: var(--accent);
}
.check-input input:indeterminate + .box svg { opacity: 0; }
.check-input input:indeterminate + .box::after {
  content: ''; display: block; width: 9px; height: 2px;
  background: var(--accent-ink); border-radius: 1px;
}

/* Radio */
.radio-input .dot-outer {
  width: 18px; height: 18px; flex: none;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center;
  transition: border-color 120ms ease;
}
.radio-input .dot-inner {
  width: 8px; height: 8px; border-radius: 999px;
  background: var(--accent);
  opacity: 0; transform: scale(0.3);
  transition: opacity 140ms ease, transform 140ms ease;
}
.radio-input input:checked + .dot-outer { border-color: var(--accent); }
.radio-input input:checked + .dot-outer .dot-inner { opacity: 1; transform: scale(1); }
.radio-input input:focus-visible + .dot-outer {
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 22%, transparent);
}

/* Toggle switch */
.toggle-track {
  width: 38px; height: 22px; flex: none;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  position: relative;
  transition: background 160ms ease, border-color 160ms ease;
}
.toggle-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 1px 3px oklch(0.2 0.02 60 / 0.18);
  transition: transform 180ms cubic-bezier(.2,.7,.2,1);
}
.toggle-input input:checked ~ .toggle-track {
  background: var(--accent); border-color: var(--accent);
}
.toggle-input input:checked ~ .toggle-track .toggle-thumb {
  transform: translateX(16px);
}
.toggle-input input:focus-visible ~ .toggle-track {
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 22%, transparent);
}

/* ============================================================
   Tabs — underline tab strip
   ============================================================ */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
}
.tab {
  padding: 12px 18px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  font-size: 14px;
  font-family: inherit;
  margin-bottom: -1px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.tab:hover { color: var(--ink-soft); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.tab .count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: var(--r-pill);
}
.tab.active .count { color: var(--accent); }

/* Condensed tabs — always render horizontal filter tabs as a single dropdown. */
.tabs-filter-row {
  display: flex;
  align-items: center;
  width: 100%;
}
.tabs-filter-row .tabs-dd {
  width: min(360px, 100%);
}
.tabs-dd-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  min-height: 44px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}
.tabs-dd-trigger:hover {
  background: var(--surface-2);
  border-color: var(--ink-soft);
}
.tabs-dd-trigger[aria-expanded="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 18%, transparent);
}
.tabs-dd-trigger .cur {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  font-size: 14px;
}
.tabs-dd-trigger .cur > span:not(.count) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tabs-dd-trigger .count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: var(--r-pill);
  flex: none;
}
.tabs-dd-trigger .caret {
  color: var(--muted);
  font-size: 11px;
  flex: none;
  transition: transform 140ms ease;
}
.tabs-dd-trigger[aria-expanded="true"] .caret {
  transform: rotate(180deg);
}
.tabs-dd .dd-menu {
  min-width: 100%;
}

.project-detail-tabs-dropdown,
.report-tabs-dropdown {
  display: none;
}
.project-overview-funding-card,
.project-overview-facts,
.project-overview-facts .row,
.project-overview-facts .row > span {
  min-width: 0;
}

@media (max-width: 640px) {
  .status-pill {
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
    gap: 0;
    overflow: visible;
  }
  .status-pill > svg {
    width: 17px;
    height: 17px;
  }
  .status-pill-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .project-detail-tabs {
    display: none;
  }
  .report-tabs {
    display: none;
  }
  .project-detail-tabs-dropdown,
  .report-tabs-dropdown {
    display: flex;
  }
  .project-detail-tabs-dropdown .tabs-dd,
  .report-tabs-dropdown .tabs-dd {
    width: 100%;
  }
  .project-overview-funding-card {
    overflow: hidden;
  }
  .project-overview-facts .row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 8px 12px;
  }
  .project-overview-facts .row > .muted {
    line-height: 1.25;
    overflow-wrap: anywhere;
  }
  .project-overview-facts .row > .right {
    margin-left: 0;
    max-width: 100%;
    justify-self: end;
    text-align: right;
    line-height: 1.25;
    overflow-wrap: anywhere;
  }
  .project-overview-facts .money {
    white-space: normal;
  }
}

/* ============================================================
   Segmented control — pill-style 2/3-up toggle.
   ============================================================ */
.seg {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  gap: 4px;
}
.seg button {
  padding: 6px 14px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color 120ms ease, background 120ms ease;
}
.seg button:hover { color: var(--ink-soft); }
.seg button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* ============================================================
   Field — label, helper, error sub-text
   ============================================================ */
.field .helper {
  font-size: 12px;
  color: var(--muted);
  font-family: inherit;
  text-transform: none;
  letter-spacing: 0;
}
.field .error {
  font-size: 12px;
  color: var(--danger);
  font-family: inherit;
  text-transform: none;
  letter-spacing: 0;
}
.field.error .input,
.field.error .textarea,
.field.error .select,
.field.error .dd-trigger {
  border-color: var(--danger);
}

/* ============================================================
   Auth protection — self-hosted ALTCHA + passive honeypot
   ============================================================ */
.auth-protection {
  --altcha-border-color: var(--line);
  --altcha-border-radius: var(--r-2);
  --altcha-checkbox-border-color: var(--line);
  --altcha-checkbox-border-radius: var(--r-1);
  --altcha-checkbox-outline-color: var(--accent);
  --altcha-color-base: var(--surface);
  --altcha-color-base-content: var(--ink);
  --altcha-color-error: var(--danger);
  --altcha-color-error-content: var(--accent-ink);
  --altcha-color-neutral: var(--line);
  --altcha-color-neutral-content: var(--ink-soft);
  --altcha-color-primary: var(--accent);
  --altcha-color-primary-content: var(--accent-ink);
  --altcha-color-success: var(--success);
  --altcha-color-success-content: var(--accent-ink);
  --altcha-input-background-color: var(--surface);
  --altcha-input-border-radius: var(--r-1);
  --altcha-max-width: 100%;
  --altcha-padding: 14px 16px;
  --altcha-shadow: drop-shadow(
    0 10px 24px color-mix(in oklch, var(--ink) 13%, transparent)
  );
  margin-bottom: var(--pad-3);
}
.auth-protection altcha-widget {
  display: block;
  width: 100%;
}
.auth-protection .altcha-main {
  max-width: 100%;
}
.auth-protection .banner {
  margin-top: 8px;
}
.form-honeypot {
  position: absolute !important;
  left: -10000px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}
.input-wrap { position: relative; }
.input-wrap .input { padding-left: 36px; }
.input-wrap .input.r { padding-left: 14px; padding-right: 36px; }
.input-wrap .leading,
.input-wrap .trailing {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--muted);
  pointer-events: none;
}
.input-wrap .leading { left: 12px; }
.input-wrap .trailing { right: 12px; }

/* ============================================================
   Empty state — centered message for tables/panels with no data
   ============================================================ */
.empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
}
.empty .title {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.empty .sub {
  font-size: 13.5px;
  max-width: 380px;
  margin: 0 auto 18px;
  line-height: 1.5;
}

/* ============================================================
   Bilingual fields — RU / TJ language inputs and textareas.
   Two variants:
     .bi-tabs    — tabbed switcher for short fields (title, location)
     .bi-tr      — side-by-side translate for long fields (description)
   ============================================================ */

/* AUTO badge — marks an auto-translated value not yet human-reviewed */
.auto-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  background: color-mix(in oklch, var(--accent-2) 12%, var(--surface));
  color: var(--accent-2);
  border: 1px solid color-mix(in oklch, var(--accent-2) 30%, var(--line));
}
.auto-badge::before {
  content: '\2728';
  font-size: 10px;
  filter: grayscale(1);
  opacity: 0.7;
}

/* Caption row under an auto-translated field */
.auto-caption {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--ink-soft);
  padding: 0 2px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.auto-caption .spacer { flex: 1; }
.auto-caption button {
  border: none; background: transparent;
  font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: 0.05em;
  color: var(--ink-soft); cursor: pointer;
  padding: 2px 6px; border-radius: var(--r-1);
}
.auto-caption button:hover { background: var(--surface-2); color: var(--ink); }

/* ---- variant: tabs ---- */
.bi-tabs {
  display: flex; flex-direction: column; gap: 6px;
}
.bi-tabs .row-head {
  display: flex; align-items: center; gap: 10px;
}
.bi-tabs > .row-head > label {
  font-size: 12px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.bi-tabs .lang-pills {
  margin-left: auto;
  display: inline-flex;
  padding: 2px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  gap: 2px;
}
.bi-tabs .lang-pills button {
  padding: 3px 10px;
  border: none; background: transparent; border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
  font-weight: 500;
}
.bi-tabs .lang-pills button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.bi-tabs .lang-pills .filled-dot {
  width: 5px; height: 5px; border-radius: 999px;
  background: var(--success);
}
.bi-tabs .lang-pills .empty-dot {
  width: 5px; height: 5px; border-radius: 999px;
  background: var(--line);
}
.bi-tabs .lang-pills .translating-dot {
  width: 5px; height: 5px; border-radius: 999px;
  background: var(--warning);
}
.bi-tabs .lang-pills button[data-auto="1"] { color: var(--accent-2); }
.bi-tabs .lang-pills button[data-auto="1"] .filled-dot { background: var(--accent-2); }
.bi-tabs .lang-pills button[data-state="translating"] { color: var(--warning); }
.bi-tabs .lang-pills button[data-state="filled"] { color: var(--success); }
.bi-tabs .lang-pills button[data-state="filled"] .filled-dot { background: var(--success); }

/* ---- variant: translate ---- */
.bi-tr {
  display: flex; flex-direction: column; gap: 6px;
}
.bi-tr .field-head {
  display: flex; align-items: center; gap: 10px;
}
.bi-tr .field-head label {
  font-size: 12px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.bi-tr .source-pill {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
}
.bi-tr .suggestion {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 12px;
  background: color-mix(in oklch, var(--accent) 5%, var(--surface));
  border: 1px dashed color-mix(in oklch, var(--accent) 35%, var(--line));
  border-radius: var(--r-2);
  font-size: 13.5px;
  color: var(--ink-soft);
}
.bi-tr .suggestion .badge {
  font-family: var(--font-mono);
  font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent);
  border: 1px solid color-mix(in oklch, var(--accent) 30%, var(--line));
  flex: none;
}
.bi-tr .suggestion .text {
  flex: 1; min-width: 0;
  color: var(--ink);
  white-space: pre-wrap; word-break: break-word;
  overflow: auto;
}
.bi-tr .suggestion .actions { display: inline-flex; gap: 4px; }
.bi-tr .suggestion button {
  border: none; background: transparent;
  padding: 4px 8px; border-radius: var(--r-1);
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.05em;
  color: var(--ink-soft); cursor: pointer;
}
.bi-tr .suggestion button:hover { background: color-mix(in oklch, var(--accent) 10%, var(--surface)); color: var(--ink); }
.bi-tr .suggestion button.primary { color: var(--accent); }
.bi-tr .accepted {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 12px;
  background: color-mix(in oklch, var(--success) 6%, var(--surface));
  border: 1px solid color-mix(in oklch, var(--success) 28%, var(--line));
  border-radius: var(--r-2);
  font-size: 13.5px;
  color: var(--ink-soft);
  overflow: hidden;
}
.bi-tr .accepted .badge {
  font-family: var(--font-mono);
  font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--success);
  border: 1px solid color-mix(in oklch, var(--success) 30%, var(--line));
  flex: none;
}
.bi-tr .accepted .text {
  flex: 1; min-width: 0;
  color: var(--ink);
  white-space: pre-wrap; word-break: break-word;
  overflow: auto;
}
.bi-tr .accepted .actions,
.bi-tr .edit-actions {
  display: flex; gap: 4px; align-items: center;
}
.bi-tr .accepted .edit-btn,
.bi-tr .edit-actions button {
  border: none; background: transparent; cursor: pointer;
  color: var(--muted); font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.05em; padding: 4px 8px; border-radius: var(--r-1);
}
.bi-tr .accepted .edit-btn:hover,
.bi-tr .edit-actions button:hover { background: var(--surface-2); color: var(--ink); }
.bi-tr .edit-actions button.primary { color: var(--accent); }
.project-public-body-form .bi-tr .accepted.project-public-body-accepted {
  position: relative;
  padding-bottom: 12px;
}
.project-public-body-form .project-public-body-accepted .text {
  height: 100%;
  padding-bottom: 12px;
}
.project-public-body-accepted-footer {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 20px);
  padding: 2px;
  border-radius: 999px;
  background: color-mix(in oklch, var(--surface) 88%, transparent);
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--success) 18%, transparent);
}
.project-public-body-accepted-footer .badge {
  width: max-content;
  max-width: 100%;
}
.project-public-body-accepted-footer .actions {
  flex: none;
}
.project-public-body-accepted-footer .edit-btn {
  padding: 2px 7px;
}
.news-body-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}
.news-body-actions .btn {
  width: auto;
  flex: none;
}

/* Loading shimmer used by the translate variant */
.translating {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px dashed var(--line);
  border-radius: var(--r-2);
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.06em;
  color: var(--muted); text-transform: uppercase;
}
.translating .dot {
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--accent);
  animation: tr-pulse 900ms ease-in-out infinite;
}
.translating .dot:nth-child(2) { animation-delay: 150ms; }
.translating .dot:nth-child(3) { animation-delay: 300ms; }
@keyframes tr-pulse {
  0%, 100% { opacity: 0.25; transform: scale(0.85); }
  50%      { opacity: 1;    transform: scale(1); }
}

/* Input-level error state (applied directly to .input / .textarea) */
.input.error, .textarea.error {
  border-color: var(--danger);
}
.input.error:focus, .textarea.error:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--danger) 18%, transparent);
}

/* Field-level error message */
.field-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 2px;
}

/* ============================================================
   Pagination
   ============================================================ */
.pagination {
  display: flex; gap: 4px; align-items: center; justify-content: center;
}
.pagination a, .pagination span.current {
  min-width: 32px; height: 32px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: var(--r-1);
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  font-family: var(--font-mono);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none;
  transition: background 120ms ease, color 120ms ease;
}
.pagination a:hover {
  background: var(--surface-2); color: var(--ink);
}
.pagination span.current {
  background: var(--ink); color: var(--bg);
  border-color: var(--ink);
  cursor: default;
}
.pagination .ellipsis {
  color: var(--muted); padding: 0 4px; user-select: none;
  font-family: var(--font-mono); font-size: 13px;
}

/* ============================================================
   Track colours — scoped via [data-track] on project cards
   ============================================================ */
:root {
  --c-scholarship: var(--accent);
  --c-teacher:     var(--accent-2);
  --c-it:          oklch(0.42 0.14 265);
  --c-medical:     var(--danger);
  --c-humanitarian: var(--warning);
  --c-year:        oklch(0.52 0.10 195);
}
[data-track="scholarship"]       { --track-c: var(--c-scholarship); }
[data-track="teacher_stipend"]   { --track-c: var(--c-teacher); }
[data-track="it_course"]         { --track-c: var(--c-it); }
[data-track="medical_program"]   { --track-c: var(--c-medical); }
[data-track="humanitarian_aid"]  { --track-c: var(--c-humanitarian); }
[data-track="full_year_support"] { --track-c: var(--c-year); }

/* ============================================================
   Project card — editorial grid header art
   ============================================================ */
.p-card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.p-card-link {
  color: inherit;
  text-decoration: none;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}
.p-card-link:hover {
  border-color: color-mix(in oklch, var(--track-c) 55%, var(--line));
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.p-card .p-art {
  aspect-ratio: 16 / 7;
  position: relative;
  overflow: hidden;
}
.p-card .p-status {
  position: absolute;
  bottom: 8px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 10.5px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.p-card .p-status.success {
  background: color-mix(in oklch, var(--success) 14%, var(--surface));
  color: var(--success);
  border-color: transparent;
}
.p-card .p-status > svg {
  width: 14px;
  height: 14px;
  flex: none;
}
.p-card .p-art svg {
  width: 100%;
  height: 100%;
  display: block;
}
.p-card .p-art .p-status > svg {
  width: 14px;
  height: 14px;
}
.public-news-card .p-art {
  aspect-ratio: 16 / 9;
}
@media (max-width: 640px) {
  .p-card .p-status.status-pill {
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
  }
  .p-card .p-art .p-status.status-pill > svg {
    width: 17px;
    height: 17px;
  }
}
.img-treatment-natural {
  filter: none;
}
.img-treatment-documentary {
  filter: saturate(0.92) contrast(1.04);
}
.img-treatment-editorial {
  filter: saturate(0.9) sepia(0.08) contrast(1.03);
}
.img-treatment-warm {
  filter: saturate(1.04) sepia(0.12);
}

/* ============================================================
   Project cover manager
   ============================================================ */
.project-cover-card {
  padding: 0;
  overflow: hidden;
}
.project-cover-trigger {
  position: relative;
  width: 100%;
  display: block;
  padding: 0;
  border: 0;
  background: var(--surface-muted);
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.project-cover-trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.project-cover-media {
  display: block;
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}
.project-cover-media > img,
.project-cover-media > .photo {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.project-cover-media > .photo {
  aspect-ratio: auto;
}
.project-cover-trigger.is-empty .project-cover-media {
  border: 1px dashed color-mix(in oklch, var(--accent) 42%, var(--line));
}
.project-cover-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: color-mix(in oklch, var(--ink) 44%, transparent);
  color: var(--surface);
  opacity: 0;
  transition: opacity 160ms ease;
}
.project-cover-trigger:hover .project-cover-overlay,
.project-cover-trigger:focus-visible .project-cover-overlay,
.project-cover-trigger.is-empty .project-cover-overlay {
  opacity: 1;
}
.project-cover-overlay .ico {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-pill);
  border: 1px solid color-mix(in oklch, var(--surface) 55%, transparent);
  background: color-mix(in oklch, var(--surface) 16%, transparent);
  font-size: 22px;
  line-height: 1;
}
.project-cover-overlay .label {
  font-size: 13px;
  font-weight: 600;
}
.project-cover-caption {
  padding: 12px 14px;
  border-top: 1px solid var(--line-soft);
}
.modal-dialog.project-cover-dialog {
  width: min(96vw, 980px);
  height: min(760px, calc(100vh - 48px));
  max-height: calc(100vh - 48px);
  overflow: hidden;
}
.project-cover-dialog form {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}
.project-cover-dialog .modal-body {
  padding: 0;
  overflow: hidden;
  display: flex;
  min-height: 0;
  flex-direction: column;
}
.project-cover-dialog .modal-footer {
  flex: none;
}
.project-cover-tabs {
  flex: none;
  padding: 0 18px;
  background: var(--surface);
}
.project-cover-tabs .tab:disabled {
  color: var(--muted);
  opacity: 0.45;
  cursor: not-allowed;
}
.project-cover-workspace {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.project-cover-panel {
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
}
.project-cover-select-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: 18px;
}
.project-cover-dropzone {
  min-height: 180px;
  height: auto;
  align-content: center;
}
.project-cover-crop-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
  padding: 18px;
}
.project-cover-crop-main {
  min-width: 0;
  min-height: 0;
}
.project-cover-cropper-shell {
  height: calc(100% - 28px);
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  background: var(--surface-muted);
}
.project-cover-cropper-shell img {
  display: block;
  max-width: 100%;
}
.project-cover-crop-help {
  font-size: 12px;
  line-height: 1.45;
  margin: 8px 0 0;
}
.project-cover-empty {
  min-height: 0;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: var(--r-2);
  color: var(--ink-soft);
  background: var(--surface-muted);
  text-align: center;
  padding: 18px;
}
.project-cover-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow: auto;
}
.field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 500;
}
.project-cover-style-picker {
  display: flex;
  gap: 8px;
}
.project-cover-style-picker button {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}
.project-cover-style-picker button:hover {
  border-color: var(--accent);
  background: var(--surface-2);
}
.project-cover-style-picker button[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 18%, transparent);
}
.project-cover-style-picker .tip-pop {
  top: calc(100% + 8px);
  bottom: auto;
}
.project-cover-style-picker .tip-pop::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: var(--ink);
}
.project-cover-style-picker .tip:focus:not(:focus-visible) .tip-pop,
.project-cover-style-picker .tip:focus-within:not(:focus-visible) .tip-pop {
  opacity: 0;
  transform: translate(-50%, 4px);
}
.project-cover-style-picker .tip:hover .tip-pop,
.project-cover-style-picker .tip:focus-visible .tip-pop {
  opacity: 1;
  transform: translate(-50%, 0);
}
.style-icon {
  width: 22px;
  height: 22px;
  display: block;
  border-radius: 50%;
  border: 1px solid color-mix(in oklch, var(--ink-soft) 35%, transparent);
}
.style-icon.natural {
  background: linear-gradient(135deg, #f7efe6 0 48%, #496f5d 49% 100%);
}
.style-icon.documentary {
  background: linear-gradient(135deg, #1f2933 0 50%, #d7cfc2 51% 100%);
  filter: saturate(0.75);
}
.style-icon.editorial {
  border-radius: 6px;
  background:
    linear-gradient(135deg, color-mix(in oklch, var(--accent) 58%, #fff) 0 46%, transparent 47%),
    linear-gradient(45deg, #2f2b27 0 50%, #eee1d1 51% 100%);
}
.project-cover-preview {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  background: var(--surface-muted);
  aspect-ratio: 16 / 9;
}
.project-cover-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.project-updates-layout {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.project-documents-layout {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.project-document-title-field {
  width: min(100%, 620px);
}
.project-document-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
}
.project-document-item {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  background: var(--surface);
}
.project-document-item-main {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}
.project-document-thumb {
  position: relative;
  display: grid;
  place-items: center;
  width: 92px;
  height: 68px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  background: var(--surface-2);
  cursor: pointer;
}
.project-document-thumb:hover {
  border-color: color-mix(in oklch, var(--accent) 45%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 12%, transparent);
}
.project-document-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.project-document-thumb canvas {
  max-width: 100%;
  max-height: 100%;
  display: block;
  background: #fff;
}
.project-document-thumb-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
}
.project-document-thumb-loading[hidden] {
  display: none;
}
.project-document-thumb-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: color-mix(in oklch, var(--surface-2) 82%, transparent);
}
.project-document-thumb-loading .spinner.sm {
  width: 18px;
  height: 18px;
}
.project-document-info {
  min-width: 0;
}
.project-document-info b {
  display: block;
  font-size: 14px;
  line-height: 1.35;
}
.project-document-meta {
  margin-top: 4px;
  font-size: 11px;
}
.project-document-visibility-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.project-document-visibility-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
}
.project-document-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.project-document-preview-modal[hidden] {
  display: none;
}
.project-document-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
}
.modal-dialog.project-document-preview-dialog {
  position: fixed;
  left: 50%;
  top: 50%;
  width: min(92vw, 1040px);
  height: min(92vh, 860px);
  max-height: calc(100vh - 32px);
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
}
.project-document-preview-body {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--surface-2);
  border-top: 1px solid var(--line);
}
.project-document-preview-image {
  display: block;
  max-width: 100%;
  max-height: none;
  margin: 0 auto;
}
.project-document-preview-pages[hidden] {
  display: none;
}
.project-document-preview-pages {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 18px;
}
.project-document-preview-page {
  display: block;
  max-width: 100%;
  height: auto;
  background: #fff;
  box-shadow: 0 10px 24px color-mix(in oklch, var(--ink) 13%, transparent);
}
.project-document-preview-loading {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  background: color-mix(in oklch, var(--surface) 68%, transparent);
}
.spinner.sm {
  width: 22px;
  height: 22px;
  border: 2px solid color-mix(in oklch, var(--accent) 22%, var(--line));
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.project-updates-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.project-update-item {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.project-update-date {
  position: sticky;
  top: 78px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-top: 12px;
  color: var(--ink-soft);
  font-size: 11.5px;
}
.project-update-bubble {
  position: relative;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.project-update-bubble::before {
  content: '';
  position: absolute;
  left: -7px;
  top: 18px;
  width: 12px;
  height: 12px;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  transform: rotate(45deg);
}
.project-update-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.project-update-notice {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  color: var(--success);
  margin-left: auto;
}
.project-update-bubble h4 {
  margin: 0 0 8px;
  font-size: 17px;
  line-height: 1.35;
}
.project-update-body {
  color: var(--ink-soft);
  white-space: pre-line;
  font-size: 13.5px;
  line-height: 1.65;
}
.project-update-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.project-update-visibility-inline {
  display: flex;
  align-items: center;
  min-width: 0;
}
.project-update-mini-seg {
  width: fit-content;
  max-width: 100%;
}
.project-update-mini-seg button {
  padding: 5px 11px;
  font-size: 12px;
  white-space: nowrap;
}
.project-update-delete {
  margin-left: auto;
}
.project-update-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.project-update-visibility .seg {
  align-self: flex-start;
  width: fit-content;
  max-width: 100%;
}
.project-update-visibility .seg button {
  white-space: nowrap;
}
.project-update-visibility-help {
  max-width: 640px;
  font-size: 12.5px;
  line-height: 1.5;
}
.project-update-form-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 2px;
}
@media (max-width: 760px) {
  .modal-dialog.project-cover-dialog {
    height: calc(100vh - 32px);
    max-height: calc(100vh - 32px);
    overflow-x: hidden;
  }
  .project-cover-dialog form,
  .project-cover-dialog .modal-body,
  .project-cover-workspace {
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
  }
  .project-cover-tabs {
    padding: 0 12px;
  }
  .project-cover-tabs .tab {
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
    padding-inline: 8px;
  }
  .project-cover-select-panel,
  .project-cover-crop-panel {
    grid-template-columns: 1fr;
    gap: 18px;
    align-content: start;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
  }
  .project-cover-select-panel > *,
  .project-cover-crop-panel > *,
  .project-cover-dropzone,
  .project-cover-empty,
  .project-cover-side {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }
  .project-cover-dropzone {
    width: 100%;
    padding-inline: 16px;
  }
  .project-cover-cropper-shell {
    height: 300px;
  }
  .project-cover-crop-main {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: visible;
  }
  .project-cover-crop-help {
    margin: 0;
    overflow-wrap: anywhere;
  }
  .project-cover-cropper-shell .cropper-container {
    max-width: 100%;
  }
  .project-cover-side {
    gap: 16px;
    overflow: visible;
  }
  .project-cover-side .input,
  .project-cover-preview {
    min-width: 0;
    max-width: 100%;
  }
  .project-cover-dropzone .sub-line,
  .project-cover-empty .muted {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    line-height: 1.45;
  }
  .project-update-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .project-update-date {
    position: static;
    flex-direction: row;
    padding-top: 0;
  }
  .project-update-actions {
    align-items: flex-start;
    flex-direction: column;
  }
  .project-update-delete {
    margin-left: 0;
  }
  .project-document-item-main {
    grid-template-columns: 72px minmax(0, 1fr);
  }
  .project-document-thumb {
    width: 72px;
    height: 56px;
  }
  .project-document-visibility-cell {
    grid-column: 1 / -1;
  }
  .project-document-row-actions {
    justify-content: flex-start;
  }
  .modal-dialog.project-document-preview-dialog {
    width: calc(100vw - 24px);
    height: calc(100vh - 24px);
  }
  .project-update-bubble::before {
    display: none;
  }
}
.p-card .p-body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.p-card .p-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.p-card .pill {
  background: color-mix(in oklch, var(--track-c) 14%, var(--surface));
  color: var(--track-c);
  border-color: transparent;
}
.p-card .pill svg {
  width: 14px;
  height: 14px;
}
.p-card .code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  margin-left: auto;
}
.p-card .p-excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.p-card .p-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 13px;
}
.p-card .p-foot .amount {
  font-family: var(--font-display);
  font-size: 20px;
}
.p-card .p-foot .of {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  margin-left: auto;
}
.p-card .bar {
  height: 5px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
}
.p-card .bar > i {
  display: block;
  height: 100%;
  background: var(--track-c);
  border-radius: inherit;
}
.public-news-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: var(--pad-4);
  align-items: start;
}
.public-news-neighbor-nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin-top: var(--pad-3);
}
.public-news-neighbor {
  min-height: 72px;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  color: var(--ink-soft);
  text-decoration: none;
  background: color-mix(in oklch, var(--surface-2) 72%, var(--surface));
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}
.public-news-neighbor:hover {
  border-color: color-mix(in oklch, var(--accent) 36%, var(--line-soft));
  background: var(--surface);
  color: var(--ink);
}
.public-news-neighbor.next {
  text-align: right;
  align-items: flex-end;
}
.public-news-neighbor > span:last-child {
  font-family: var(--font-display);
  font-size: clamp(1rem, 1.55vw, 1.18rem);
  line-height: 1.18;
}
.public-news-neighbor.placeholder {
  visibility: hidden;
}
@media (max-width: 760px) {
  .public-news-detail-grid {
    grid-template-columns: 1fr;
  }
  .public-news-neighbor-nav {
    display: flex;
    overflow-x: auto;
    gap: 12px;
    margin-inline: calc(var(--pad-4) * -1);
    padding: 2px var(--pad-4) 12px;
    scroll-padding-inline: var(--pad-4);
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .public-news-neighbor-nav::-webkit-scrollbar {
    display: none;
  }
  .public-news-neighbor {
    flex: 0 0 min(82vw, 340px);
    scroll-snap-align: center;
  }
  .public-news-neighbor.placeholder {
    display: none;
  }
  .public-news-neighbor.next {
    text-align: left;
    align-items: flex-start;
  }
}

/* ============================================================
   Breadcrumb
   ============================================================ */
.breadcrumb {
  display: inline-flex; align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--ink-soft); cursor: pointer; text-decoration: none; }
.breadcrumb a:hover { color: var(--ink); }
.breadcrumb .sep { color: var(--line); font-size: 11px; opacity: 0.7; }
.breadcrumb .current { color: var(--ink); }

/* Budget breakdown — donor student budget tab + admin expenditures */
.budget-bar {
  position: relative;
  display: flex;
  height: 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  overflow: hidden;
}
.budget-bar-spent {
  height: 100%;
  background: var(--accent);
  transition: width 240ms ease;
}
.budget-bar-pending {
  height: 100%;
  background:
    repeating-linear-gradient(
      45deg,
      color-mix(in oklch, var(--accent) 35%, var(--surface-2)) 0 6px,
      color-mix(in oklch, var(--accent) 55%, var(--surface-2)) 6px 12px
    );
  transition: width 240ms ease;
}
.budget-legend-swatch {
  display: inline-block;
  width: 12px;
  height: 8px;
  border-radius: 2px;
  border: 1px solid var(--line);
  margin-right: 6px;
  vertical-align: middle;
}
.budget-cats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.budget-cat {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.budget-cat h4 {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--ink);
}
.budget-cat-amounts {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.budget-cat-amounts > span:first-child {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}
@media (max-width: 640px) {
  .budget-cats {
    display: flex;
    grid-template-columns: none;
    gap: 14px;
    overflow-x: auto;
    padding: 2px 0 12px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  .budget-cats::-webkit-scrollbar {
    display: none;
  }
  .budget-cats > .budget-cat {
    flex: 0 0 min(82vw, 340px);
    min-width: 0;
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }
}
.proof-link {
  color: var(--accent);
  font-size: 12.5px;
  cursor: pointer;
  font-weight: 500;
}
.proof-link:hover { text-decoration: underline; }

/* ============================================================
   City Overlay
   ============================================================ */
.city-overlay-backdrop {
  position: fixed;
  inset: 0;
  background: oklch(0.2 0.02 60 / 0.3);
  z-index: 60;
}
.city-overlay-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg);
  border-radius: var(--r-3);
  padding: 24px;
  min-width: 400px;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 61;
  box-shadow: var(--shadow-lg, 0 8px 32px oklch(0.2 0.02 60 / 0.15));
}
.city-group { margin-bottom: 14px; }
.city-group__region {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.city-group__list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.city-group__item {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.city-group__item:hover {
  border-color: var(--accent);
}
.city-group__item--active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* ============================================================
   Lookup Overlay — remote searchable picker for long catalogs
   ============================================================ */
.lookup-trigger {
  justify-content: space-between;
  width: 100%;
  min-height: 38px;
  text-align: left;
}
.lookup-trigger span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lookup-overlay-backdrop {
  position: fixed;
  inset: 0;
  background: oklch(0.2 0.02 60 / 0.3);
  z-index: 60;
}
.lookup-overlay-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: var(--r-3);
  padding: 24px;
  width: min(88vw, 460px);
  height: min(60vh, 560px);
  max-height: 66vh;
  overflow: hidden;
  z-index: 61;
  box-shadow: var(--shadow-lg, 0 8px 32px oklch(0.2 0.02 60 / 0.15));
}
.lookup-list {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 6px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}
.lookup-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--r-2);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.lookup-item:hover {
  border-color: var(--accent);
}
.lookup-item--focused {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in oklch, var(--accent) 18%, transparent);
}
.lookup-item--active {
  border-color: var(--accent);
  background: color-mix(in oklch, var(--accent) 10%, var(--surface));
}
.lookup-item__title {
  font-size: 14px;
  line-height: 1.35;
}
.lookup-item__subtitle {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.lookup-item mark {
  background: color-mix(in oklch, var(--accent) 22%, transparent);
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
}
@media (max-width: 560px) {
  .lookup-overlay-panel {
    width: calc(100vw - 24px);
    height: 66vh;
    padding: 18px;
  }
}

/* ============================================================
   Project Multi-Select — searchable checkbox list for CP forms
   ============================================================ */
.news-project-picker {
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  background: var(--surface);
  overflow: hidden;
}
.news-project-picker__count {
  min-width: 28px;
  justify-content: center;
}
.news-project-picker__head {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.news-project-picker__head .input {
  height: 36px;
}
.news-project-picker__list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 260px;
  overflow-y: auto;
  padding: 10px;
}
.news-project-picker__item {
  width: 100%;
  align-items: flex-start;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  background: var(--bg);
  transition: background 120ms ease, border-color 120ms ease;
}
.news-project-picker__item:hover {
  border-color: var(--accent);
}
.news-project-picker__item.is-selected {
  border-color: color-mix(in oklch, var(--accent) 65%, var(--line));
  background: color-mix(in oklch, var(--accent) 9%, var(--bg));
}
.news-project-picker__text {
  display: block;
  min-width: 0;
}
.news-project-picker__title {
  display: block;
  line-height: 1.35;
}
.news-project-picker__code {
  display: block;
  margin-top: 2px;
  font-size: 11px;
}
.news-project-picker__empty {
  margin: 10px;
  padding: 18px;
}
.news-project-summary {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  justify-content: space-between;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-2);
}
.news-project-summary__list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 26px;
  align-items: center;
}
.news-project-summary__chip {
  background: var(--surface);
}
.news-project-dialog {
  width: min(720px, calc(100vw - 32px));
}
.news-project-dialog .modal-body {
  max-height: min(68vh, 620px);
  overflow: hidden;
}
.news-project-dialog .news-project-picker__list {
  max-height: min(50vh, 430px);
}
.news-status-field .seg {
  width: fit-content;
  max-width: 100%;
}
.news-status-field .seg button {
  white-space: nowrap;
}
.news-status-control {
  margin-top: 14px;
}
.news-status-toggle {
  width: 100%;
}
.news-status-toggle form {
  display: contents;
}
.news-status-toggle button {
  flex: 1 1 0;
  min-width: 0;
  padding-inline: 10px;
  white-space: nowrap;
}
.news-status-toggle button:disabled {
  cursor: default;
}
.admin-news-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.75fr);
  gap: 18px;
  align-items: start;
}
@media (max-width: 860px) {
  .admin-news-detail-grid {
    grid-template-columns: 1fr;
  }
  .news-project-summary {
    align-items: stretch;
    flex-direction: column;
  }
  .news-project-summary .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ============================================================
   Money — TJS amount with USD-on-hover tooltip (dashboards only).
   Rendered by the `money::tjs` Askama macro on cp/* pages.
   ============================================================ */
.money {
  position: relative;
  display: inline;
  white-space: nowrap;
  cursor: help;
  text-decoration: underline dotted;
  text-decoration-color: color-mix(in oklch, var(--ink) 35%, transparent);
  text-underline-offset: 3px;
  outline: none;
}
.money-pop {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translate(-50%, 4px);
  background: var(--ink);
  color: var(--bg);
  padding: 6px 10px;
  border-radius: var(--r-1);
  font-size: 12px;
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
  z-index: 200;
}
.money-pop::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--ink);
}
.money:hover .money-pop,
.money:focus .money-pop,
.money:focus-within .money-pop {
  opacity: 1;
  transform: translate(-50%, 0);
}
.money:focus {
  text-decoration-color: var(--accent);
}

.donor-donation-project {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.donor-donation-project-code {
  font-size: 11px;
  line-height: 1.25;
  white-space: nowrap;
}
.donor-donation-project-title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.donor-projects-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.donor-project-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}
.donor-project-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.donor-project-title-block {
  flex: 1 1 auto;
  min-width: 0;
}
.donor-project-code {
  margin-bottom: 4px;
}
.donor-project-title {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.donor-project-status {
  flex: 0 0 auto;
}
.donor-project-progress {
  min-width: 0;
}
.donor-project-bar {
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
}
.donor-project-bar > div {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
}
.donor-project-progress-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  min-width: 0;
}
.donor-project-meta-text {
  font-size: 12px;
  min-width: 0;
}
.donor-project-progress-meta .money,
.donor-project-contribution .money {
  max-width: 100%;
}
.donor-project-contribution {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  color: var(--ink-soft);
  font-size: 13px;
  min-width: 0;
}
.donor-project-contribution span {
  color: var(--ink);
  font-weight: 600;
}

/* ============================================================
   Responsive — tables & overlays on narrow screens
   ------------------------------------------------------------
   Default for EVERY table: its wrapping `.card.flush` scrolls
   horizontally so wide tables don't break the layout. Tables that
   read better stacked opt in with `.tbl-cards` on the <table>;
   each row becomes a labelled card on mobile, cells supplying their
   header via data-label="…". The Admin Projects table is canonical.
   ============================================================ */
/* ---- Generic two-mode table host (tables.js) ---- */
/* Horizontal mode: the table scrolls within its box at ALL widths. */
.table-scroll { overflow-x: auto; }
.table-scroll > .tbl { min-width: 600px; }

/* Center every column header label over its column. */
.tbl th.th-sort .th-sort-link { width: 100%; justify-content: center; }

/* Title cell: title prominent, dates drop to their own row. */
.ttl-cell { display: flex; flex-direction: column; gap: 3px; min-width: 0; }

/* Inline text label beside a Track/Status icon — revealed only when stacked. */
.cell-ico-text { display: none; }

/* Table utility buttons: reset filters + layout mode. */
.table-reset-filters,
.table-mode-toggle { flex: none; }
.table-reset-filters svg,
.table-mode-toggle svg { width: 15px; height: 15px; display: block; }
.table-mode-toggle .mode-ico-h { display: none; }
/* Below the threshold the layout is locked to vertical — hide the toggle. */
.table-host.is-forced .table-mode-toggle { display: none; }

/* VERTICAL (stacked) — driven by tables.js at any width. */
.table-host.is-stacked .table-scroll { overflow-x: visible; }
.table-host.is-stacked .tbl { min-width: 0; display: block; }
.table-host.is-stacked .tbl thead { display: none; }
.table-host.is-stacked .tbl tbody,
.table-host.is-stacked .tbl tr,
.table-host.is-stacked .tbl td { display: block; width: 100%; }
.table-host.is-stacked .tbl tr {
  position: relative;
  padding: 14px 16px 54px;            /* bottom room for the corner kebab */
  border-bottom: 1px solid var(--line);
}
.table-host.is-stacked .tbl tr:last-child { border-bottom: none; }
.table-host.is-stacked .tbl tr:hover td { background: transparent; }
.table-host.is-stacked .tbl td {
  border: none;
  padding: 4px 0;
  text-align: left !important;
  white-space: normal !important;
  width: 100% !important;
  max-width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 14px;
}
.table-host.is-stacked .tbl td::before {
  content: attr(data-label);
  flex: 0 0 auto;
  min-width: 88px;                    /* shared label column → values line up */
  white-space: nowrap;
  font-family: var(--font-mono);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding-top: 2px;
}
.table-host.is-stacked .tbl td:not([data-label])::before,
.table-host.is-stacked .tbl td[data-label=""]::before { content: none; }
/* The value side claims the remaining width where it helps. */
.table-host.is-stacked .tbl td > .ttl-cell,
.table-host.is-stacked .tbl td > .row { flex: 1 1 auto; min-width: 0; }
.table-host.is-stacked .tbl td > .ttl-cell > b {
  display: block;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.25;
}
/* Track/Status: reveal the small text label next to the icon. */
.table-host.is-stacked .cell-ico-text { display: inline; font-size: 11px; color: var(--ink-soft); }
.table-host.is-stacked .tbl td:has(> .status-duo) .cell-ico-text { display: none; }
/* Badge cells: center the icon, its text, and the label on one line. */
.table-host.is-stacked .tbl td:has(> .cell-ico),
.table-host.is-stacked .tbl td:has(> .status-duo) { align-items: center; }
/* Kebab → circular, more visible button pinned to the card's bottom-left. */
.table-host.is-stacked .tbl td.cell-actions {
  position: absolute; right: 12px; bottom: 12px;
  width: auto !important; max-width: none;
  padding: 0; margin: 0;
}
.table-host.is-stacked .tbl td.cell-actions::before { content: none; }
.table-host.is-stacked .tbl td.cell-actions .dd-trigger.icon {
  width: 36px; height: 36px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
/* Toggle icon: stacked shows the "back to grid" glyph. */
.table-host.is-stacked .table-mode-toggle .mode-ico-v { display: none; }
.table-host.is-stacked .table-mode-toggle .mode-ico-h { display: block; }

.project-events-table-host .project-event-actions {
  text-align: right;
  white-space: nowrap;
}
.project-events-table-host .project-event-actions form { display: inline; }
.table-host.is-stacked .tbl td.project-event-actions {
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 10px;
}

.expenditure-cell-value {
  min-width: 0;
  overflow-wrap: anywhere;
}
.expenditure-project-title {
  display: block;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.expenditure-category-value {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.expenditure-date-cell { white-space: nowrap; }
.expenditure-status-cell { white-space: nowrap; }
.expenditure-status-date { margin-left: 7px; }
.expenditure-complete-form {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.table-host.is-stacked .tbl td.project-event-actions form {
  display: inline-flex !important;
}
@media (max-width: 640px) {
  .project-events-toolbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .project-events-toolbar > div {
    flex: 1 1 100%;
    min-width: 0;
  }
  .project-events-toolbar .btn.right {
    width: 100%;
    margin-left: 0;
    justify-content: center;
  }
  .table-host.is-stacked.project-events-table-host .tbl tr {
    padding-bottom: 16px;
  }
}

@media (max-width: 1024px) {
  .card.flush { overflow-x: auto; }
  .card.flush .tbl { min-width: 720px; }
  .card.flush.table-host.is-stacked { overflow-x: visible; }
  .card.flush.table-host.is-stacked .tbl { min-width: 0; }
}

@media (max-width: 640px) {
  .donor-projects-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .donor-project-card-head {
    gap: 10px;
  }
  .donor-project-title {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }
  .donor-project-status {
    margin-top: 1px;
  }
  .donor-project-progress-meta {
    flex-wrap: wrap;
  }
  .donor-project-progress-meta > .donor-project-meta-text {
    flex: 1 1 130px;
  }
  .donor-project-progress-meta > .donor-project-meta-text:last-child {
    text-align: right;
  }
  .donor-project-contribution {
    line-height: 1.45;
  }

  /* ---- Stacked-card table (opt-in via .tbl-cards) ---- */
  .card.flush .tbl.tbl-cards,
  .tbl.tbl-cards { min-width: 0; }
  .tbl.tbl-cards thead { display: none; }
  .tbl.tbl-cards,
  .tbl.tbl-cards tbody,
  .tbl.tbl-cards tr,
  .tbl.tbl-cards td { display: block; width: 100%; }
  .tbl.tbl-cards tr {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
  }
  .tbl.tbl-cards tr:hover td { background: transparent; }
  .tbl.tbl-cards td {
    border: none;
    padding: 4px 0;
    text-align: left !important;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
  }
  .tbl.tbl-cards td > .donor-donation-project {
    flex: 1 1 auto;
    min-width: 0;
  }
  .tbl.tbl-cards td::before {
    content: attr(data-label);
    flex: 0 0 40%;
    font-family: var(--font-mono);
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.08em;
    color: var(--muted);
  }
  /* Cells with no label (e.g. the actions cell) go full width */
  .tbl.tbl-cards td[data-label=""]::before,
  .tbl.tbl-cards td:not([data-label])::before { content: none; }
  .tbl.tbl-cards td[data-label=""],
  .tbl.tbl-cards td.cell-actions {
    justify-content: flex-start;
    padding-top: 10px;
  }

  .tbl.tbl-cards.expenditures-table tr {
    display: flex;
    flex-direction: column;
  }
  .tbl.tbl-cards.expenditures-table td {
    width: 100%;
    min-width: 0;
  }
  .expenditures-table .expenditure-project-cell { order: 1; }
  .expenditures-table .expenditure-date-cell { order: 2; }
  .expenditures-table .expenditure-student-cell { order: 3; }
  .expenditures-table .expenditure-category-cell { order: 4; }
  .expenditures-table .expenditure-budgeted-cell { order: 5; }
  .expenditures-table .expenditure-spent-cell { order: 6; }
  .expenditures-table .expenditure-status-cell { order: 7; }
  .expenditures-table .expenditure-actions-cell { order: 8; }
  .expenditures-table .expenditure-project-title {
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    font-weight: 600;
    line-height: 1.35;
  }
  .expenditures-table .expenditure-cell-value {
    flex: 1 1 auto;
  }
  .expenditures-table .expenditure-category-value,
  .expenditures-table .expenditure-status-cell {
    flex-wrap: wrap;
  }
  .expenditures-table .expenditure-category-value {
    white-space: normal;
  }
  .expenditures-table .expenditure-actions-cell {
    padding-top: 12px;
  }
  .expenditure-complete-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }
  .expenditure-complete-form .input {
    grid-column: 1 / -1;
    width: 100% !important;
    font-size: 16px;
  }
  .expenditure-complete-form .btn {
    min-width: 0;
    width: 100%;
    justify-content: center;
  }

  /* ---- Modal → bottom sheet ---- */
  .modal-dialog {
    top: auto !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    transform: none !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: 92vh !important;
    border-radius: var(--r-4) var(--r-4) 0 0 !important;
    animation: sheet-up 240ms cubic-bezier(.2, .7, .2, 1) !important;
  }
  /* ---- Side drawer → full width ---- */
  .drawer {
    width: 100% !important;
    max-width: 100% !important;
  }
}

@keyframes sheet-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

/* ============================================================
   Public mobile bottom navigation + More sheet
   Composes the canonical BottomNav and BottomSheet blueprints.
   ============================================================ */
.public-mobile-nav-shell { display: none; }

.bottom-nav {
  display: flex;
  align-items: stretch;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding:
    6px calc(4px + env(safe-area-inset-right, 0px))
    calc(6px + env(safe-area-inset-bottom, 0px))
    calc(4px + env(safe-area-inset-left, 0px));
}
.bottom-nav-item {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 5px 2px;
  border: 0;
  border-radius: var(--r-2);
  background: transparent;
  color: var(--muted);
  font: inherit;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav-item .ico {
  width: 38px;
  height: 25px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  transition: background 140ms ease, color 140ms ease;
}
.bottom-nav-item .ico svg {
  width: 22px;
  height: 22px;
}
.bottom-nav-item .lbl {
  max-width: 100%;
  overflow: hidden;
  color: inherit;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bottom-nav-item:hover { color: var(--ink); }
.bottom-nav-item.active { color: var(--accent); }
.bottom-nav-item.active .ico {
  background: color-mix(in oklch, var(--accent) 14%, var(--surface));
}
.bottom-nav-item[aria-expanded="true"] .ico {
  background: color-mix(in oklch, var(--ink) 9%, var(--surface));
  color: var(--ink);
}
.bottom-nav-item.active[aria-expanded="true"] .ico {
  background: color-mix(in oklch, var(--accent) 14%, var(--surface));
  color: var(--accent);
}
.bottom-nav-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}

dialog.public-more-sheet {
  position: fixed;
  inset: auto 0 0;
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  max-height: 88vh;
  max-height: 88dvh;
  margin: 0;
  padding:
    10px max(20px, env(safe-area-inset-right, 0px))
    calc(20px + env(safe-area-inset-bottom, 0px))
    max(20px, env(safe-area-inset-left, 0px));
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--r-4) var(--r-4) 0 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  animation: sheet-up 240ms cubic-bezier(.2, .7, .2, 1);
}
dialog.public-more-sheet:not([open]) { display: none; }
dialog.public-more-sheet::backdrop {
  background: oklch(0.2 0.02 60 / 0.4);
  animation: modal-fade 160ms ease;
}
.public-more-grabber {
  width: 38px;
  height: 4px;
  margin: 0 auto 8px;
  border-radius: 999px;
  background: var(--line);
}
.public-more-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
}
.public-more-header h2 {
  margin: 0;
  flex: 1;
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 400;
}
.public-more-close {
  width: 44px;
  height: 44px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.public-more-close:hover { background: var(--surface-2); }
.public-more-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.public-more-close svg { width: 20px; height: 20px; }
.public-more-body {
  display: grid;
  gap: 20px;
  padding-top: 16px;
}
.public-more-utilities {
  display: grid;
  gap: 14px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line-soft);
}
.public-more-language {
  display: flex;
  align-items: center;
}
.public-more-language .lang-toggle a {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.public-more-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.public-more-actions > :only-child { grid-column: 1 / -1; }
.public-more-actions .btn {
  width: 100%;
  min-width: 0;
  padding-inline: 10px;
  justify-content: center;
  font-size: 13px;
  white-space: nowrap;
}
.public-more-section {
  display: grid;
  gap: 9px;
}
.public-more-section-title {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}
.public-more-resource-list,
.public-more-contact {
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-3);
  background: var(--surface);
}
.public-more-resource-list {
  display: grid;
}
.public-more-resource {
  min-height: 62px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink);
  text-decoration: none;
}
.public-more-resource:last-child { border-bottom: 0; }
.public-more-resource:hover { background: var(--surface-2); }
.public-more-resource-icon,
.public-more-contact-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-2);
  background: color-mix(in oklch, var(--accent) 8%, var(--surface-2));
  color: var(--accent);
}
.public-more-resource-icon svg,
.public-more-contact-icon svg {
  width: 18px;
  height: 18px;
}
.public-more-resource-copy,
.public-more-contact-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.public-more-resource-title {
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
}
.public-more-resource-meta,
.public-more-contact-label {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.07em;
  line-height: 1.3;
  text-transform: uppercase;
}
.public-more-resource-chevron,
.public-more-contact-chevron {
  width: 18px;
  height: 18px;
  color: var(--muted);
}
.public-more-contact {
  display: grid;
  font-style: normal;
}
.public-more-contact-row {
  min-height: 60px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink);
  text-decoration: none;
}
.public-more-contact-row:last-child { border-bottom: 0; }
.public-more-contact-row > .public-more-contact-copy:last-child {
  grid-column: 2 / -1;
}
a.public-more-contact-row:hover { background: var(--surface-2); }
.public-more-contact-value {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
a.public-more-contact-row .public-more-contact-value {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: color-mix(in oklch, var(--ink) 28%, transparent);
  text-underline-offset: 3px;
}
.public-more-social-label { display: none; }
.public-more-socials {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 0;
}
.public-more-socials .footer-social-btn {
  width: 100%;
  height: 48px;
  min-width: 0;
  gap: 7px;
  padding: 0 8px;
  border-radius: var(--r-2);
}
.public-more-socials .footer-social-btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}
.public-more-socials .public-more-social-label {
  min-width: 0;
  display: inline;
  overflow: hidden;
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.public-more-open { overflow: hidden; }

@media (max-width: 640px) {
  .public-mobile-nav-shell { display: block; }
  .public-mobile-nav-spacer {
    height: calc(64px + env(safe-area-inset-bottom, 0px));
  }
  .public-mobile-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 40;
  }
  .public-shell :focus-visible {
    scroll-margin-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }
}

@media (prefers-reduced-motion: reduce) {
  dialog.public-more-sheet,
  dialog.public-more-sheet::backdrop,
  .bottom-nav-item .ico { animation: none; transition: none; }
}

/* Stage 6 education components */
.pill.danger { color: var(--danger); background: color-mix(in oklch, var(--danger) 12%, var(--surface)); border-color: color-mix(in oklch, var(--danger) 30%, var(--line)); }
.btn.danger { color: var(--danger); border-color: color-mix(in oklch, var(--danger) 35%, var(--line)); }
.btn.danger:hover { background: color-mix(in oklch, var(--danger) 10%, var(--surface)); }
.rate-flash { display: inline-flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid color-mix(in oklch, var(--success) 35%, var(--line)); background: color-mix(in oklch, var(--success) 10%, var(--surface)); border-radius: var(--r-2); color: var(--ink); font-size: 13px; }
.rate-flash.error { border-color: color-mix(in oklch, var(--danger) 35%, var(--line)); background: color-mix(in oklch, var(--danger) 9%, var(--surface)); }
/* ============================================================
   HAMDAM · Stage 6 · Req 1 — Record grades (report card)
   New CSS classes. Token-driven; consumes ../common tokens.
   ============================================================ */
.rg-card { padding: 0; overflow: hidden; }

.rg-masthead {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
  padding: 24px 26px;
  background: color-mix(in oklch, var(--accent) 7%, var(--surface));
  border-bottom: 1px solid var(--line);
}
.rg-term { min-width: 240px; }

.rg-legend {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 26px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12px; color: var(--muted);
}
.rg-legend .mono { font-family: var(--font-mono); letter-spacing: 0.04em; }
.rg-band { display: inline-flex; align-items: center; gap: 6px; }
.rg-band .dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; }
.dot.success { background: var(--success); }
.dot.accent  { background: var(--accent); }
.dot.warning { background: var(--warning); }
.dot.danger  { background: var(--danger); }

/* Gradebook table sits flush inside the card */
.gradebook { margin: 0; }
.gradebook thead th { padding-left: 26px; }
.gradebook tbody td { padding-left: 26px; vertical-align: middle; }
.gradebook thead th:last-child,
.gradebook tbody td:last-child { padding-right: 22px; padding-left: 0; }

.grade-cell { position: relative; display: inline-flex; flex-direction: column; align-items: center; gap: 3px; }
.grade-input {
  width: 64px; height: 44px;
  text-align: center;
  font-family: var(--font-mono); font-size: 20px; font-weight: 500;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--r-2);
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}
.grade-input::placeholder { color: var(--muted); font-weight: 400; }
.grade-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 18%, transparent);
}
.grade-input.honour {
  background: color-mix(in oklch, var(--success) 12%, var(--surface));
  border-color: color-mix(in oklch, var(--success) 38%, var(--line));
  color: var(--success);
}
.grade-input.invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--danger) 16%, transparent);
}
.grade-err {
  font-size: 10.5px; color: var(--danger);
  font-family: var(--font-mono); white-space: nowrap;
}

/* Per-row year sparkline of the four terms */
.rg-sparks { display: flex; gap: 6px; }
.rg-spark {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 34px;
  padding: 5px 4px;
  border-radius: var(--r-1);
  background: var(--surface-2);
  border: 1px solid transparent;
}
.rg-spark.cur { border-color: color-mix(in oklch, var(--accent) 40%, var(--line)); background: color-mix(in oklch, var(--accent) 8%, var(--surface)); }
.rg-spark-l { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.06em; color: var(--muted); text-transform: uppercase; }
.rg-spark-v { font-family: var(--font-mono); font-size: 14px; color: var(--ink-soft); }
.rg-spark-v.honour { color: var(--success); font-weight: 600; }

.rg-remove {
  width: 30px; height: 30px; border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 18px; line-height: 1; cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}
.rg-remove:hover { color: var(--danger); border-color: color-mix(in oklch, var(--danger) 40%, var(--line)); background: color-mix(in oklch, var(--danger) 8%, var(--surface)); }

.rg-add {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 16px 26px 0;
}

.rg-footer {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
  padding: 0 26px 24px;
}
.rg-summary { display: flex; align-items: flex-end; gap: 32px; flex-wrap: wrap; }
.rg-avg-num {
  font-family: var(--font-display);
  font-size: 52px; line-height: 1; color: var(--ink);
}
.rg-att-input { display: inline-flex; align-items: center; gap: 6px; }
.rg-att-input .input.invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--danger) 16%, transparent);
}
.rg-pct { font-family: var(--font-mono); color: var(--muted); font-size: 15px; }

@media (max-width: 640px) {
  .rg-masthead, .rg-legend, .rg-add, .rg-footer { padding-left: 18px; padding-right: 18px; }
  .gradebook thead th, .gradebook tbody td { padding-left: 18px; }
  .rg-summary { gap: 20px; }
  .rg-avg-num { font-size: 40px; }
}

/* ============================================================
   HAMDAM · Stage 6 · Req 2 — Quarterly assessment
   New CSS classes. Token-driven.
   ============================================================ */
.qa-form { display: flex; flex-direction: column; }
.qa-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding-bottom: 16px; margin-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
}
.qa-period { display: flex; gap: 8px; }
.qa-period .select { width: auto; min-width: 88px; height: 38px; }

.qa-warn {
  padding: 10px 14px; margin-bottom: 16px;
  background: color-mix(in oklch, var(--warning) 16%, var(--surface));
  border: 1px solid color-mix(in oklch, var(--warning) 32%, var(--line));
  border-radius: var(--r-2);
  font-size: 13px; color: oklch(0.45 0.10 75);
}

.qa-status-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
}

/* Segmented status picker */
.status-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.status-opt {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-pill);
  font-family: var(--font-body); font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}
.status-opt .status-dot {
  width: 9px; height: 9px; border-radius: 999px;
  background: var(--muted);
  transition: background 120ms ease;
}
.status-opt:hover { border-color: var(--ink-soft); }
.status-opt.success .status-dot { background: var(--success); }
.status-opt.accent  .status-dot { background: var(--accent); }
.status-opt.warning .status-dot { background: var(--warning); }
.status-opt.danger  .status-dot { background: var(--danger); }

.status-opt.on { font-weight: 500; color: var(--ink); }
.status-opt.success.on { background: color-mix(in oklch, var(--success) 14%, var(--surface)); border-color: color-mix(in oklch, var(--success) 42%, var(--line)); color: var(--success); }
.status-opt.accent.on  { background: color-mix(in oklch, var(--accent) 14%, var(--surface));  border-color: color-mix(in oklch, var(--accent) 42%, var(--line));  color: var(--accent); }
.status-opt.warning.on { background: color-mix(in oklch, var(--warning) 20%, var(--surface)); border-color: color-mix(in oklch, var(--warning) 42%, var(--line)); color: oklch(0.45 0.10 75); }
.status-opt.danger.on  { background: color-mix(in oklch, var(--danger) 12%, var(--surface));  border-color: color-mix(in oklch, var(--danger) 42%, var(--line));  color: var(--danger); }

.qa-notes { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* On-file history */
.qa-list { display: flex; flex-direction: column; }
.qa-item {
  display: flex; gap: 18px; align-items: flex-start;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-soft);
}
.qa-item:last-child { border-bottom: none; }
.qa-item-period {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  width: 56px; flex: none; padding-top: 2px;
}
.qa-q {
  font-family: var(--font-display); font-size: 24px; line-height: 1; color: var(--ink);
}
.qa-item-body { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.qa-item-status { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.qa-item-ach { font-size: 13.5px; color: var(--ink-soft); }

@media (max-width: 640px) {
  .qa-status-grid, .qa-notes { grid-template-columns: 1fr; }
}

/* ============================================================
   HAMDAM · Stage 6 · Req 3 — Scholarship review
   New CSS classes. Token-driven.
   ============================================================ */
.sr-progress {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
}
.sr-progress-bar {
  flex: 1; height: 8px; border-radius: 999px;
  background: var(--surface-2); overflow: hidden;
}
.sr-progress-fill {
  height: 100%; border-radius: 999px;
  background: var(--accent);
  transition: width 260ms cubic-bezier(.2,.7,.2,1);
}
.sr-progress.done .sr-progress-fill { background: var(--success); }
.sr-progress-label { font-size: 12px; color: var(--ink-soft); white-space: nowrap; }

.sr-intro {
  font-size: 14px; line-height: 1.6; color: var(--ink-soft);
  max-width: 760px;
}

.sr-list { display: flex; flex-direction: column; gap: 16px; }

/* Card */
.sr-card { padding: 22px 24px; transition: opacity 200ms ease, border-color 200ms ease; }
.sr-card.is-done { border-left: 4px solid var(--line); }
.sr-card.is-done.success { border-left-color: var(--success); }
.sr-card.is-done.warning { border-left-color: var(--warning); }
.sr-card.is-done.danger  { border-left-color: var(--danger); }

.sr-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 18px;
}
.sr-suggest {
  font-size: 12.5px; color: var(--muted);
  padding: 6px 12px; border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid var(--line);
  white-space: nowrap;
}
.sr-suggest b { color: var(--ink-soft); }

/* Metrics row */
.sr-metrics {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px;
  padding: 16px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}
.sr-metric-l {
  font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  margin-bottom: 4px;
}
.sr-metric-v { font-family: var(--font-display); font-size: 30px; line-height: 1; color: var(--ink); }
.sr-pct { font-size: 16px; color: var(--muted); }

/* Latest assessment */
.sr-assess { padding: 14px 0 4px; display: flex; flex-direction: column; gap: 8px; }
.sr-assess-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sr-ach { font-size: 13px; color: var(--ink-soft); }

/* Decision area */
.sr-decision {
  display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap;
}
.sr-decision .field:first-child { flex: none; }
.sr-outcomes { display: flex; gap: 6px; }
.sr-outcome {
  padding: 9px 16px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-2);
  font-family: var(--font-body); font-size: 13.5px; font-weight: 500;
  color: var(--ink-soft); cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}
.sr-outcome:hover { border-color: var(--ink-soft); }
.sr-outcome.success.on { background: color-mix(in oklch, var(--success) 14%, var(--surface)); border-color: var(--success); color: var(--success); }
.sr-outcome.warning.on { background: color-mix(in oklch, var(--warning) 20%, var(--surface)); border-color: var(--warning); color: oklch(0.45 0.10 75); }
.sr-outcome.danger.on  { background: color-mix(in oklch, var(--danger) 12%, var(--surface));  border-color: var(--danger);  color: var(--danger); }
.sr-confirm { flex: none; height: 42px; }

/* Decided state */
.sr-decided {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 14px 16px;
  background: var(--surface-2);
  border-radius: var(--r-2);
}
.sr-decided-note { flex: 1; }

@media (max-width: 900px) {
  .sr-metrics { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .sr-decision { flex-direction: column; align-items: stretch; }
  .sr-confirm { width: 100%; justify-content: center; }
}

/* ============================================================
   HAMDAM · Stage 6 · Req 4 — Student progress tracker (10-point)
   New CSS classes. Token-driven.
   ============================================================ */
.pt-legend { display: flex; gap: 14px; flex: none; }
.pt-leg { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.pt-leg .sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.pt-leg .sw.success { background: color-mix(in oklch, var(--success) 24%, var(--surface)); border: 1px solid color-mix(in oklch, var(--success) 40%, var(--line)); }
.pt-leg .sw.danger  { background: color-mix(in oklch, var(--danger) 14%, var(--surface));  border: 1px solid color-mix(in oklch, var(--danger) 28%, var(--line)); }

/* Grades table */
.pt-grades th { font-size: 11px; }
.pt-grade {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 30px; padding: 0 6px;
  font-family: var(--font-mono); font-size: 14px; color: var(--ink-soft);
  border-radius: var(--r-1);
}
.pt-grade.honour {
  background: color-mix(in oklch, var(--success) 14%, var(--surface));
  color: var(--success); font-weight: 600;
}
.pt-avg {
  font-family: var(--font-mono); font-size: 14px; font-weight: 600; color: var(--ink);
}
.pt-avg.honour { color: var(--success); }

.pt-foot td {
  border-top: 2px solid var(--line);
  background: var(--surface-2);
  font-weight: 500;
}
.pt-foot td:first-child {
  font-family: var(--font-mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
}

/* Quarterly assessments list */
.pt-assess-list { display: flex; flex-direction: column; }
.pt-assess {
  display: flex; gap: 18px; align-items: flex-start;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-soft);
}
.pt-assess:last-child { border-bottom: none; }
.pt-assess-q {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  width: 56px; flex: none; padding-top: 2px;
}
.pt-q { font-family: var(--font-display); font-size: 24px; line-height: 1; color: var(--ink); }
.pt-assess-body { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.pt-assess-status { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pt-ach {}

@media (max-width: 640px) {
  .pt-legend { display: none; }
}

/* ============================================================
   HAMDAM · Stage 6 · Req 5 — IT course enrollment card
   New CSS classes. Token-driven. Minimal — one card.
   ============================================================ */
.enroll-card { max-width: 460px; display: flex; flex-direction: column; gap: 16px; }

.enroll-head { display: flex; gap: 14px; align-items: flex-start; }
.enroll-ico {
  width: 42px; height: 42px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-2);
  background: color-mix(in oklch, var(--accent) 12%, var(--surface));
  color: var(--accent);
}
.enroll-ico svg { width: 22px; height: 22px; }
.enroll-title {
  font-family: var(--font-display); font-weight: 400; font-size: 21px;
  line-height: 1.15; margin-top: 2px; color: var(--ink);
}

.enroll-meta {
  display: flex; gap: 28px; flex-wrap: wrap;
  padding: 14px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}
.enroll-meta-item { display: flex; flex-direction: column; gap: 3px; }
.enroll-meta-l {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.enroll-meta-v { font-size: 14px; color: var(--ink); }

.enroll-note {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px;
}
.enroll-note.success { color: var(--success); }
.enroll-note.muted { color: var(--muted); }
.enroll-note svg { stroke: var(--success); }


.teacher-project-card { display: flex; gap: 18px; min-height: 220px; }
.teacher-project-photo { width: 200px; aspect-ratio: 4 / 3; flex: none; }
.teacher-project-body { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.apply-form { padding: 24px; }
.apply-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.apply-child { border: 1px solid var(--line); border-radius: var(--r-3); padding: 18px; background: var(--surface-1); }
.application-review-card { padding: 28px; }
.application-detail-head { display: flex; align-items: flex-start; gap: 18px; }
.application-section { padding: 24px; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-head h3 { margin: 4px 0 0; font-size: 22px; }
.application-review-grid { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 24px; }
.review-statement { border: 1px solid var(--line-soft); border-radius: var(--r-2); padding: 12px; background: var(--surface-1); font-size: 13.5px; color: var(--ink-soft); white-space: pre-wrap; }
.application-statement-card { display: flex; flex-direction: column; gap: 10px; }
.application-statement-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.statement-translation {
  border: 1px solid color-mix(in oklch, var(--accent) 24%, var(--line-soft));
  border-radius: var(--r-2);
  padding: 12px;
  background: color-mix(in oklch, var(--accent) 7%, var(--surface));
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 160ms ease, transform 160ms ease;
}
.statement-translation.visible { opacity: 1; transform: translateY(0); }
.statement-translation.muted { color: var(--muted); }
.statement-translation.error {
  border-color: color-mix(in oklch, var(--danger) 35%, var(--line-soft));
  background: color-mix(in oklch, var(--danger) 7%, var(--surface));
  color: var(--danger);
}
.child-row { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line-soft); border-radius: var(--r-2); padding: 10px 12px; }
.application-cockpit-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.85fr); gap: 18px; align-items: start; }
.application-admin-support-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.8fr); gap: 18px; align-items: start; }
.application-thread { padding-bottom: 18px; }
.message-thread { display: flex; flex-direction: column; gap: 10px; }
.message-row { display: flex; align-items: flex-start; gap: 10px; max-width: 88%; }
.message-row.mine { margin-left: auto; flex-direction: row-reverse; }
.message-bubble { flex: 1; min-width: 0; border: 1px solid var(--line-soft); border-radius: var(--r-2); padding: 10px 12px; background: var(--surface-1); }
.message-row.mine .message-bubble { background: color-mix(in oklch, var(--accent) 8%, var(--surface)); border-color: color-mix(in oklch, var(--accent) 24%, var(--line)); }
.message-body { margin-top: 6px; white-space: pre-wrap; font-size: 13.5px; color: var(--ink-soft); line-height: 1.45; }
.message-form .textarea { min-height: 92px; }
.document-upload-form .textarea { min-height: 76px; }
.review-notes { min-height: 140px; }
.document-row { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line-soft); border-radius: var(--r-2); padding: 10px 12px; background: var(--surface-1); }
.empty.compact { padding: 18px; min-height: auto; }
.review-actions { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 18px; }
.review-buttons { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rg-term-controls { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
@media (max-width: 900px) {
  .teacher-project-card { flex-direction: column; }
  .teacher-project-photo { width: 100%; }
  .apply-form-grid, .application-review-grid, .application-cockpit-grid, .application-admin-support-grid { grid-template-columns: 1fr; }
  .application-detail-head, .section-head, .document-row { flex-direction: column; align-items: stretch; }
  .message-row { max-width: 100%; }
}

/* Impersonation banner (DEC-B13) — server-injected on every page (public + dashboard) */
.impersonation-banner { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 8px 16px; background: var(--danger); color: #fff; border-bottom: 1px solid color-mix(in oklch, var(--danger) 70%, black); font-size: 13.5px; position: sticky; top: 0; z-index: 60; }
.impersonation-banner b { color: #fff; }
.impersonation-banner form { margin: 0; display: inline; }
/* Make the stop action read as a button against the red bar. */
.impersonation-banner .btn { background: rgba(255, 255, 255, 0.18); color: #fff; border: 1px solid rgba(255, 255, 255, 0.55); }
.impersonation-banner .btn:hover { background: rgba(255, 255, 255, 0.3); border-color: #fff; }

/* ============================================================
   Notification bell + drawer (Stage 8)
   ============================================================ */
.notif-bell {
  position: relative;
  width: 40px;
  padding: 0;
  justify-content: center;
}
.notif-bell .ico { width: 16px; height: 16px; display: inline-block; }
.notif-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 9.5px;
  font-weight: 600;
  line-height: 15px;
  text-align: center;
}
.notif-overlay {
  position: fixed;
  inset: 0;
  background: oklch(0.2 0.02 60 / 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  z-index: 50;
}
.notif-overlay.open { opacity: 1; pointer-events: auto; }
.notif-drawer {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: min(420px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--line);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 180ms ease, visibility 0s linear 180ms;
  z-index: 51;
  display: flex;
  flex-direction: column;
}
.notif-drawer.open {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transition: opacity 180ms ease;
}
.notif-drawer-head {
  padding: 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
}
.notif-drawer-head h3 { font-family: var(--font-display); font-size: 22px; margin: 0; }
.notif-drawer-head .right { margin-left: auto; }
.notif-drawer-body { flex: 1; overflow: auto; padding: 12px; }
.notif-mark-all { margin-bottom: 8px; display: flex; justify-content: flex-end; }
.notif-empty { padding: 24px 14px; color: var(--muted); font-size: 13.5px; text-align: center; }
.notif-item {
  padding: 14px;
  border-radius: var(--r-2);
  background: transparent;
  border: 1px solid var(--line-soft);
  margin-bottom: 8px;
}
.notif-item.unread {
  background: color-mix(in oklch, var(--accent) 8%, var(--surface));
  border-color: color-mix(in oklch, var(--accent) 22%, var(--line));
}
.notif-item form { margin: 0; }
.notif-item-btn {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
}
.notif-item-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.notif-item-title { font-size: 13.5px; font-weight: 500; }
.notif-item-body { font-size: 13px; margin-top: 4px; color: var(--ink-soft); }
.notif-item-time {
  font-size: 10.5px;
  margin-top: 6px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.notif-item .dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent);
  flex: none;
  margin-top: 5px;
}

/* ── Stage 12 · Director dashboard — My assistants + assistant detail ── */
.da-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.da-card { display: flex; flex-direction: column; gap: 14px; }
.da-head { display: flex; align-items: center; gap: 12px; }
.da-stats { display: flex; gap: 28px; }
.da-stats > div { display: flex; flex-direction: column; }
.da-stat-v { font-family: var(--font-display); font-size: 26px; line-height: 1; color: var(--ink); }
.da-stat-of { font-size: 15px; color: var(--muted); }
.da-stat-l { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-top: 3px; }
.da-view { align-self: flex-start; }

.da-detail-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.da-detail-bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.da-detail-bar > div { height: 100%; border-radius: 999px; background: var(--accent); }

.back-btn { align-self: flex-start; padding-left: 0; }

/* ============================================================
   HAMDAM · Stage 12 · Req 4 — Admin task constructor drawer
   New CSS classes. Token-driven.
   ============================================================ */
.tc-scrim {
  position: fixed; inset: 0; z-index: 60;
  background: oklch(0.2 0.02 60 / 0.35);
  animation: tc-fade 160ms ease;
}
@keyframes tc-fade { from { opacity: 0; } to { opacity: 1; } }

.tc-drawer {
  position: fixed; right: 0; top: 0; bottom: 0; z-index: 61;
  width: min(520px, 100vw);
  background: var(--bg);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
}
@media (prefers-reduced-motion: no-preference) {
  .tc-drawer { animation: tc-slide 220ms cubic-bezier(.2,.7,.2,1); }
}
@keyframes tc-slide { from { transform: translateX(24px); opacity: 0.4; } to { transform: translateX(0); opacity: 1; } }

.tc-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
  flex: none;
}
.tc-body { flex: 1; overflow-y: auto; padding: 22px; }
.tc-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 22px; border-top: 1px solid var(--line);
  background: var(--surface); flex: none;
}

/* Verifier / level segmented buttons */
.tc-verifier { display: flex; gap: 6px; }
.tc-vbtn {
  flex: 1;
  padding: 9px 12px;
  border: 1.5px solid var(--line); background: var(--surface);
  border-radius: var(--r-2);
  font-family: var(--font-body); font-size: 13px; color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}
.tc-vbtn:hover { border-color: var(--ink-soft); }
.tc-vbtn.on {
  border-color: var(--accent);
  background: color-mix(in oklch, var(--accent) 12%, var(--surface));
  color: var(--accent); font-weight: 500;
}

.tc-hint { font-size: 11px; color: var(--muted); font-family: var(--font-mono); margin-top: 2px; }
.tc-opt {
  font-family: var(--font-mono); font-size: 9.5px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 7px; margin-left: 6px;
}

/* ============================================================
   Stage 12 · Req 1 — Assistant My Tasks + task detail
   ============================================================ */
/* Segmented tabs (Active / Archive) — also extend .seg-tab to anchors */
.seg-tabs {
  display: inline-flex; gap: 3px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-2); padding: 3px; align-self: flex-start;
}
.seg-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px; border: none; background: transparent;
  border-radius: var(--r-1); cursor: pointer; text-decoration: none;
  font-family: var(--font-body); font-size: 13.5px; color: var(--muted);
  transition: background 120ms ease, color 120ms ease;
}
.seg-tab.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg-count {
  font-family: var(--font-mono); font-size: 11px;
  background: color-mix(in oklch, var(--ink) 8%, transparent);
  border-radius: 999px; padding: 1px 7px; color: inherit;
}

/* Task rows */
.task-rows { display: flex; flex-direction: column; gap: 10px; }
.task-row {
  display: flex; align-items: center; gap: 16px;
  width: 100%; text-align: left; text-decoration: none;
  padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-3); cursor: pointer;
  position: relative;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}
.task-row:hover { border-color: color-mix(in oklch, var(--accent) 36%, var(--line)); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.task-row-open { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.task-row-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.task-row-main { flex: 1; min-width: 0; position: relative; z-index: 2; pointer-events: none; }
.task-row-title { font-size: 15px; font-weight: 500; color: var(--ink); margin-bottom: 8px; }
.task-row-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.task-row-deadline { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); }
.task-row-deadline svg { width: 12px; height: 12px; }
.task-row-verifier { font-size: 11.5px; color: var(--muted); }
.task-row-right { display: flex; align-items: center; gap: 12px; flex: none; position: relative; z-index: 2; pointer-events: none; }
.task-row-arrow { width: 16px; height: 16px; color: var(--muted); }
.task-row-arrow svg { width: 16px; height: 16px; }
.task-row .edu-category-chip,
.task-row .task-status-chip { pointer-events: auto; }
.task-status-chip { gap: 6px; cursor: help; white-space: nowrap; }
.task-status-icon { width: 15px; height: 15px; flex: none; }

.back-btn { align-self: flex-start; padding-left: 0; }

/* Task detail */
.td-head { display: flex; gap: 16px; }
.td-meta { display: flex; gap: 32px; flex-wrap: wrap; margin-top: 16px; }
.td-meta > div { display: flex; flex-direction: column; gap: 3px; }
.td-meta-l { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.td-meta-v { font-size: 14px; color: var(--ink); }

.td-ref {
  display: flex; align-items: center; gap: 12px;
  margin-top: 16px; padding: 12px 14px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-2); text-decoration: none; color: inherit;
  transition: border-color 120ms ease;
}
.td-ref:hover { border-color: color-mix(in oklch, var(--accent) 36%, var(--line)); }
.td-ref-ico { width: 20px; height: 20px; color: var(--accent); flex: none; }
.td-ref-ico svg { width: 20px; height: 20px; }
.td-ref-l { display: block; font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.td-ref-t { display: block; font-size: 13.5px; color: var(--ink); margin-top: 1px; }
.td-ref-open { font-size: 12.5px; color: var(--accent); font-weight: 500; }

/* Returned-for-revision callout */
.td-returned {
  padding: 16px 18px;
  background: color-mix(in oklch, var(--danger) 8%, var(--surface));
  border: 1px solid color-mix(in oklch, var(--danger) 26%, var(--line));
  border-radius: var(--r-3);
}
.td-returned-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.td-returned-ico { width: 18px; height: 18px; color: var(--danger); }
.td-returned-ico svg { width: 18px; height: 18px; stroke: var(--danger); }
.td-returned-comment { font-size: 14px; line-height: 1.55; color: var(--ink); font-style: italic; margin: 0; }

/* Submission history */
.td-history { display: flex; flex-direction: column; }
.td-sub { display: flex; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.td-sub:last-child { border-bottom: none; }
.td-sub-dot { flex: none; padding-top: 1px; }
.td-sub-body { flex: 1; min-width: 0; }
.td-sub-review {
  margin-top: 8px; padding: 10px 12px; border-radius: var(--r-2); font-size: 13px; line-height: 1.5;
}
.td-sub-review.ok   { background: color-mix(in oklch, var(--success) 10%, var(--surface)); }
.td-sub-review.warn { background: color-mix(in oklch, var(--warning) 14%, var(--surface)); }
.td-sub-review b { font-weight: 600; }

/* Category chips */
.chip {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-family: var(--font-mono);
  background: color-mix(in oklch, var(--accent) 12%, var(--surface));
  color: var(--accent); border: 1px solid color-mix(in oklch, var(--accent) 22%, var(--line));
}
.chip.cat-subject_test          { --chip-hue: 220; }
.chip.cat-peer_lesson_attendance { --chip-hue: 160; }
.chip.cat-cross_lesson_attendance { --chip-hue: 35; }
.chip.cat-own_lessons_conducted  { --chip-hue: 280; }
.chip.cat-university_progress    { --chip-hue: 200; }
.chip.cat-social_conduct         { --chip-hue: 340; }
.chip.cat-self_development       { --chip-hue: 90; }

@media (max-width: 640px) {
  .task-row { padding: 14px; }
  .task-row-right { gap: 8px; }
  .task-row .edu-category-chip,
  .task-row .task-status-chip {
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
    border-radius: 999px;
  }
  .task-row .edu-category-chip-label,
  .task-row .task-status-chip-label { display: none; }
  .td-meta { gap: 20px; }
}

/* ============================================================
   Review queue (12b-4) — .rq-* classes
   Source: design-requests/12.3-director-dashboard/director-dashboard.css
   ============================================================ */
.rq-list { display: flex; flex-direction: column; gap: 16px; }
.rq-card { display: flex; flex-direction: column; gap: 12px; transition: opacity 200ms ease, border-color 200ms ease; }
.rq-card.resolved { opacity: 0.78; }
.rq-card.resolved.approved { border-left: 4px solid var(--success); }
.rq-card.resolved.returned { border-left: 4px solid var(--warning); }

.rq-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rq-task { font-family: var(--font-display); font-size: 20px; line-height: 1.15; color: var(--ink); }
.rq-report { font-size: 14px; line-height: 1.6; color: var(--ink-soft); margin: 0; }

.rq-page-head { align-items: flex-start; gap: 12px; }
.rq-page-head .breadcrumb { min-width: 0; }
.rq-page-head > :first-child { min-width: 0; }
.rq-count {
  height: 34px;
  min-width: 48px;
  padding: 0 9px;
  justify-content: center;
  flex: none;
  white-space: nowrap;
  letter-spacing: 0;
  text-transform: none;
  cursor: help;
}
.rq-count-icon { width: 16px; height: 16px; flex: none; }
.rq-count-number { font-size: 12px; font-weight: 600; }
.edu-category-chip { gap: 6px; cursor: help; }
.edu-category-icon { width: 15px; height: 15px; flex: none; }

.rq-attach { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.rq-thumbs { display: flex; gap: 8px; flex-wrap: wrap; }

.rq-actions-wrap { border-top: 1px solid var(--line-soft); padding-top: 14px; }
.rq-actions { display: flex; justify-content: flex-end; gap: 10px; }
.rq-approve { }
.rq-ru {
  font-family: var(--font-mono); font-size: 10px; opacity: 0.7;
  border-left: 1px solid color-mix(in oklch, currentColor 40%, transparent);
  padding-left: 7px; margin-left: 2px;
}
.rq-ru.on-accent { border-color: color-mix(in oklch, var(--accent-ink) 40%, transparent); }

.rq-return { background: var(--surface-2); border-radius: var(--r-2); padding: 14px; }
.rq-resolved-note {
  font-size: 13.5px; font-style: italic; color: var(--ink-soft);
  background: color-mix(in oklch, var(--warning) 12%, var(--surface));
  border-radius: var(--r-2); padding: 10px 12px;
}

@media (max-width: 560px) {
  .review-queue-topbar {
    margin-top: 0 !important;
    min-width: 0;
  }
  .review-queue-topbar .kicker { display: none; }
  .review-queue-topbar-title {
    max-width: 100%;
    font-size: 20px !important;
    line-height: 1.05;
    padding-block: 1px;
    white-space: normal;
    overflow-wrap: normal;
  }
  .rq-head > .row:first-child { flex: 1 1 auto; min-width: 0; }
  .rq-head > .row:last-child { flex: none; }
  .rq-head .edu-category-chip {
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
    border-radius: 999px;
  }
  .rq-head .edu-category-chip-label { display: none; }
  .rq-actions { flex-direction: column; align-items: stretch; min-width: 0; }
  .rq-return,
  .rq-return .field,
  .rq-return .textarea {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .rq-actions .btn { width: 100%; justify-content: center; }
}

/* ─── Library (12b-5) ────────────────────────────────────────────────── */
.lib-filters { display: flex; flex-direction: column; gap: 12px; }
.lib-spheres { display: flex; gap: 6px; flex-wrap: wrap; }
.lib-sphere {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--r-pill); font-size: 12.5px; color: var(--ink-soft); cursor: pointer;
  text-decoration: none;
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}
.lib-sphere:hover { border-color: var(--ink-soft); }
.lib-sphere.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.lib-list { display: flex; flex-direction: column; gap: 12px; }
.lib-item {
  display: flex; gap: 16px; align-items: center;
  padding: 16px 18px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-3);
}
.lib-item-cover {
  width: 56px; height: 72px; flex: none; border-radius: var(--r-2);
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2);
}
.lib-item-cover svg { width: 22px; height: 22px; }
.lib-item-body { flex: 1; min-width: 0; }
.lib-kind {
  font-family: var(--font-mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted);
}
.lib-item-title { font-family: var(--font-display); font-size: 19px; line-height: 1.15; color: var(--ink); margin-top: 2px; }
.lib-item-desc { font-size: 13px; color: var(--ink-soft); margin: 6px 0 0; line-height: 1.5; }
.lib-item-actions { display: flex; gap: 6px; flex: none; }

@media (max-width: 560px) {
  .lib-item { flex-wrap: wrap; }
  .lib-item-actions { width: 100%; }
  .lib-item-actions .btn { flex: 1; justify-content: center; }
}

/* ============================================================
   Progress tracker (12b-6) — .pr-* classes
   Source: design-requests/12.2-assistant-progress/assistant-progress.css
   ============================================================ */
.pr-top { display: grid; grid-template-columns: auto 1fr 1fr; gap: 14px; align-items: stretch; }
.pr-ring {
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.pr-ring svg { display: block; }
.pr-ring-center {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center; line-height: 1.1;
}
.pr-ring-pct { font-size: 22px; font-weight: 600; color: var(--ink); }
.pr-ring-label { font-size: 10px; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.pr-stat { display: flex; flex-direction: column; justify-content: center; }
.pr-of { font-size: 18px; color: var(--muted); margin-left: 6px; }

.pr-cats { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 28px; margin-top: 12px; }
.pr-cat { display: flex; flex-direction: column; gap: 7px; }
.pr-cat-head { display: flex; align-items: center; justify-content: space-between; }
.pr-cat-name { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink); }
.pr-cat-count { font-size: 12px; color: var(--muted); }
.pr-cat-done { color: var(--success) !important; }
.pr-cat-bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.pr-cat-fill { height: 100%; border-radius: 999px; transition: width 300ms ease; }

@media (max-width: 760px) {
  .pr-top { grid-template-columns: 1fr 1fr; }
  .pr-ring { grid-column: 1 / -1; }
  .pr-cats { grid-template-columns: 1fr; }
}

/* Overdue deadline (S-AST-049) */
.task-row-deadline.overdue { color: var(--danger); font-weight: 500; }
.task-row.overdue { border-color: color-mix(in oklch, var(--danger) 26%, var(--line)); }
.task-row.overdue:hover { border-color: color-mix(in oklch, var(--danger) 50%, var(--line)); }
/* Donor overview contribution chart */
.donor-contribution-labels {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  padding: 6px 6.667% 0;
}

.donor-contribution-labels > span {
  min-width: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: clamp(8px, 1.2vw, 11px);
  line-height: 1;
  text-align: center;
}
