/* ============================================================
   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; }

/* ============================================================
   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; }

/* ============================================================
   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); }

/* ============================================================
   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);
}

/* ============================================================
   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="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);
}
/* ============================================================
   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; }

/* ============================================================
   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 .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;
  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; }

/* ============================================================
   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); }

/* ============================================================
   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);
}
.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 button[data-auto="1"] { color: var(--accent-2); }
.bi-tabs .lang-pills button[data-auto="1"] .filled-dot { background: var(--accent-2); }

/* ---- 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;
}
.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);
}
.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;
}
.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); }

/* 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 .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-art svg {
  width: 100%;
  height: 100%;
  display: block;
}
.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-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;
}

/* ============================================================
   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 — sponsor 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;
}
.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;
  }
}

/* ============================================================
   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);
}

/* ============================================================
   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: auto !important;
  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; }
/* 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); }
/* 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; 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; }

@media (max-width: 1024px) {
  .card.flush { overflow-x: auto; }
  .card.flush .tbl { min-width: 720px; }
}

@media (max-width: 640px) {
  /* ---- Stacked-card table (opt-in via .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::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;
  }

  /* ---- 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); }
}

/* 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; }
.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 dashboard page */
.impersonation-banner { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 8px 16px; background: color-mix(in oklch, var(--warning, #b45309) 14%, var(--surface)); border-bottom: 1px solid color-mix(in oklch, var(--warning, #b45309) 35%, var(--line)); font-size: 13.5px; position: sticky; top: 0; z-index: 60; }
.impersonation-banner form { margin: 0; display: inline; }

/* ============================================================
   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);
  transform: translateX(100%);
  transition: transform 220ms ease;
  z-index: 51;
  display: flex;
  flex-direction: column;
}
.notif-drawer.open { transform: translateX(0); }
.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;
}
