/*
  School platform — design system shared by the school portal and the staff control panel. RTL first.

  Identity: warm paper neutrals (stone / paper) and ONE calm pine green; muted semantic colours; surfaces are
  separated by 1px hairlines and generous spacing, never by shadows. Reads like an elegant ledger rather than a
  technical dashboard: serious, easy on the eyes in a long working session, legible in a lit office.
  Rules: no neon, no gradients on interactive elements, no coloured shadows, no over-rounded corners, and colour is
  never the only signal (there is always an icon or a word next to it).
  The one place a gradient is allowed is a DARK SURFACE (hero panel, toasts, floating cards): it is a background,
  not a control.
*/

:root {
  /* Font: the first one actually installed on the device wins. */
  --font: "Dubai", "Sakkal Majalla", "Segoe UI", Tahoma, system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;

  /* Pine green (the only brand colour) */
  --primary: #2A6150;
  --primary-hover: #23523F;
  --primary-press: #1B4034;
  --primary-ink: #1B4034;       /* dark text of the same family */
  --primary-soft: #E8F0EC;      /* light: badge backgrounds, selected rows */
  --primary-soft-2: #CFE1D8;    /* soft: text selection, soft-button hover */
  --on-primary: #FFFFFF;

  /* Surfaces */
  --ink: #1C2320;               /* dark surfaces: hero, toasts, floating cards */
  --mint: #8FCBA9;              /* accent on dark surfaces only */
  --bg: #F4F3EF;                /* the app background is paper, never white */
  --surface: #FFFFFF;           /* cards, fields */
  --surface-2: #F7F6F2;         /* row hover, table header, quiet boxes */
  --surface-3: #EFEDE8;         /* secondary / neutral / disabled */

  /* Text: four steps */
  --heading: #1D2320;
  --text: #343B37;
  --muted: #6D726D;
  --faint: #A3A7A1;

  /* Hairlines: always 1px */
  --border: #E4E1DA;
  --border-strong: #CDC9BF;     /* fields */
  --row-line: #F0EEE9;          /* between table rows */

  /* Semantic colours, each a triple: main (icon, border) / light background / ink (text) */
  --ok: #2F7A51;      --ok-soft: #E8F3EC;      --ok-ink: #1F5739;
  --danger: #B3432F;  --danger-soft: #FAEDE9;  --danger-ink: #8A3122;  --danger-field: #FFFBFA;
  --warn: #AD7619;    --warn-soft: #FAF1E1;    --warn-ink: #76500F;
  --info: #3E6B83;    --info-soft: #E9F0F3;    --info-ink: #2B4B5C;
  --neutral: #6D726D; --neutral-soft: #EFEDE8; --neutral-ink: #343B37;
  --on-dark-danger: #E7A596;    /* the error tint that stays readable on dark surfaces */

  /* Shape: conservative and consistent */
  --r-field: 9px;               /* buttons and fields */
  --r-menu: 10px;               /* dropdowns, context menus */
  --r-card: 14px;
  --r-item: 12px;               /* tables, item cards */
  --r-badge: 10px;
  --r-check: 5px;
  --r-scroll: 3px;

  --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-scroll); }
::selection { background: var(--primary-soft-2); color: var(--heading); }
html { color-scheme: light; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }
a:focus-visible, .tab:focus-visible, .segmented button:focus-visible, .link-btn:focus-visible, .icon-btn:focus-visible,
.btn:focus-visible, .quick-pick:focus-visible, .chip input:focus-visible + span, input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.35; color: var(--heading); }
p { margin: 0; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); direction: ltr; unicode-bidi: isolate; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: 16px; }
.grow { flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------------------------------------------------------------- buttons
   Nine families from one base: primary, secondary, ghost, soft, danger, danger-soft, warn-soft, success, dark.
   A disabled button is always #EFEDE8 with faint text, whatever its family. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--r-field);
  border: 1px solid transparent; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  background: var(--primary); color: var(--on-primary); transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
  white-space: nowrap;
}
.btn:hover { background: var(--primary-hover); text-decoration: none; color: var(--on-primary); }
.btn:active { background: var(--primary-press); }
.btn.secondary { background: var(--surface); color: var(--heading); border-color: var(--border-strong); }
.btn.secondary:hover { background: var(--surface-2); color: var(--heading); }
.btn.secondary:active { background: var(--surface-3); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-3); color: var(--heading); }
.btn.soft { background: var(--primary-soft); color: var(--primary-ink); }
.btn.soft:hover { background: var(--primary-soft-2); color: var(--primary-ink); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { background: var(--danger-ink); color: #fff; }
.btn.danger-soft, .btn.danger-ghost { background: var(--danger-soft); color: var(--danger-ink); }
.btn.danger-soft:hover, .btn.danger-ghost:hover { background: #F4DCD5; color: var(--danger-ink); }
.btn.warn-soft { background: var(--warn-soft); color: var(--warn-ink); }
.btn.warn-soft:hover { background: #F4E6C9; color: var(--warn-ink); }
.btn.success { background: var(--ok); color: #fff; }
.btn.success:hover { background: var(--ok-ink); color: #fff; }
.btn.dark { background: var(--ink); color: #fff; }
.btn.dark:hover { background: #2B3531; color: #fff; }
.btn:disabled, .btn:disabled:hover { background: var(--surface-3); color: var(--faint); border-color: transparent; cursor: not-allowed; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn .spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; border-radius: var(--r-field);
  display: inline-flex; transition: background-color .15s var(--ease), color .15s var(--ease); }
.icon-btn:hover { background: var(--surface-3); color: var(--heading); }
.icon-btn:disabled { color: var(--faint); background: none; cursor: not-allowed; }
.icon { width: 18px; height: 18px; flex: none; }

/* ---------------------------------------------------------------- forms */
.field { display: grid; gap: 6px; }
.field > label, .label { font-weight: 600; font-size: 14px; color: var(--heading); }
.field .req { color: var(--danger); margin-inline-start: 2px; }
.input, select.input, textarea.input {
  width: 100%; height: 42px; padding: 8px 14px; border-radius: var(--r-field);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit;
  transition: border-color .15s var(--ease);
}
.input::placeholder { color: var(--faint); }
textarea.input { height: auto; min-height: 96px; padding: 10px 14px; resize: vertical; }
/* Focus is a green 1px border: no halo. */
.input:focus { outline: none; border-color: var(--primary); }
.input.invalid { border-color: var(--danger); background: var(--danger-field); }
.input[readonly] { background: var(--surface-2); }
.input:disabled { background: var(--surface-3); color: var(--faint); }
select.input {
  appearance: none; padding-left: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%236D726D' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 14px center; background-size: 12px 8px;
}
.hint { font-size: 13px; color: var(--muted); }
.error-text { font-size: 13px; color: var(--danger); min-height: 0; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }
.input-wrap { position: relative; }
.input-wrap .input { padding-inline-end: 44px; }
.input-wrap .icon-btn { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); }

/* Checkbox: 20px, 5px corners, 1.5px border; checked = pine green with a white tick (inline SVG). */
input[type="checkbox"] {
  appearance: none; flex: none; width: 20px; height: 20px; margin: 0; cursor: pointer;
  border: 1.5px solid var(--border-strong); border-radius: var(--r-check); background: var(--surface);
  transition: background-color .15s var(--ease), border-color .15s var(--ease);
}
input[type="checkbox"]:hover { border-color: var(--primary); }
input[type="checkbox"]:checked {
  background-color: var(--primary); border-color: var(--primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M3.5 8.5l3 3 6-7' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center; background-size: 14px 14px;
}
input[type="checkbox"].invalid { border-color: var(--danger); background-color: var(--danger-field); }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block; padding: 5px 12px; border-radius: var(--r-field); border: 1px solid var(--border-strong);
  background: var(--surface); font-size: 13px; cursor: pointer; user-select: none;
  transition: background-color .15s var(--ease), border-color .15s var(--ease);
}
.chip span:hover { border-color: var(--primary); }
.chip input:checked + span { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-ink); font-weight: 600; }
.chip input:checked + span::before { content: "✓ "; color: var(--primary); }
.chip-group { display: grid; gap: 6px; }
.chip-group .label { font-size: 13px; color: var(--muted); font-weight: 500; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 5px 6px; min-height: 42px; align-items: center;
  border: 1px solid var(--border-strong); border-radius: var(--r-field); background: var(--surface); }
.tags:focus-within { border-color: var(--primary); }
.tag { display: inline-flex; gap: 4px; align-items: center; background: var(--primary-soft); color: var(--primary-ink);
  padding: 2px 4px 2px 10px; border-radius: 8px; font-size: 13px; font-weight: 600; }
.tag button { background: none; border: 0; color: inherit; cursor: pointer; font-size: 16px; line-height: 1; padding: 0 4px; }
.tags input { border: 0; outline: none; flex: 1; min-width: 120px; font: inherit; background: transparent; color: var(--text);
  height: 30px; }

/* An alert: state border + state-ink text on the light state background. */
.alert { padding: 12px 14px; border-radius: var(--r-field); font-size: 14px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); }
.alert.error { background: var(--danger-soft); border-color: var(--danger); color: var(--danger-ink); }
.alert.ok { background: var(--ok-soft); border-color: var(--ok); color: var(--ok-ink); }
.alert.info { background: var(--info-soft); border-color: var(--info); color: var(--info-ink); }
.alert.warn { background: var(--warn-soft); border-color: var(--warn); color: var(--warn-ink); }
.alert.error a, .alert.info a { color: inherit; font-weight: 600; text-decoration: underline; }

/* ---------------------------------------------------------------- surfaces */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); }
.card-body { padding: 20px; }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center;
  justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { font-size: 16px; font-weight: 700; }
@media (max-width: 640px) { .card-body { padding: 18px; } .card-head { padding: 14px 18px; } }

.badge { --dot: var(--neutral); display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--r-badge);
  font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--neutral-soft); color: var(--neutral-ink); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--dot); }
.badge.plain::before { display: none; }
.badge.PENDING, .badge.warn { --dot: var(--warn); background: var(--warn-soft); color: var(--warn-ink); }
.badge.ACTIVE, .badge.ok { --dot: var(--ok); background: var(--ok-soft); color: var(--ok-ink); }
.badge.REJECTED, .badge.danger { --dot: var(--danger); background: var(--danger-soft); color: var(--danger-ink); }
.badge.SUSPENDED, .badge.neutral { --dot: var(--neutral); background: var(--neutral-soft); color: var(--neutral-ink); }
.badge.info { --dot: var(--info); background: var(--info-soft); color: var(--info-ink); }

.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.kpi { padding: 18px; display: grid; gap: 4px; }
.kpi .kpi-label { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.kpi .kpi-value { font-size: 26px; font-weight: 700; color: var(--heading); font-variant-numeric: tabular-nums; line-height: 1.3; }
.kpi .kpi-sub { font-size: 13px; color: var(--muted); }
button.kpi { text-align: start; cursor: pointer; font: inherit; color: inherit; transition: background-color .15s var(--ease), border-color .15s var(--ease); }
button.kpi:hover { border-color: var(--border-strong); background: var(--surface-2); }
button.kpi.active { border-color: var(--primary); background: var(--primary-soft); }

/* ---------------------------------------------------------------- app shell */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--heading); }
.brand:hover { text-decoration: none; color: var(--heading); }
.brand-mark { width: 34px; height: 34px; border-radius: var(--r-field); display: grid; place-items: center;
  background: var(--primary); color: #fff; flex: none; }
/* The symbol of Riwaq (a horseshoe arcade), painted in the text colour of its container. Source: brand/ */
.brand-mark::before { content: ''; width: 22px; height: 22px; background: currentColor;
  -webkit-mask: url("../brand/mark.svg") center / contain no-repeat; mask: url("../brand/mark.svg") center / contain no-repeat; }
.brand small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
.user-menu { margin-inline-start: auto; display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: var(--r-field); display: grid; place-items: center; font-weight: 700;
  background: var(--primary-soft); color: var(--primary-ink); flex: none; }
@media (max-width: 640px) { .user-chip .who { display: none; } }

.page { max-width: 1180px; margin: 0 auto; padding: 24px 20px 64px; display: grid; gap: 20px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 700; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; font: inherit; font-size: 14px;
  font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; display: inline-flex; gap: 8px;
  align-items: center; transition: color .15s var(--ease); }
.tab:hover { color: var(--heading); }
.tab[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }
.tab .count { background: var(--neutral-soft); color: var(--neutral-ink); border-radius: var(--r-badge); padding: 0 8px; font-size: 12px; }
.tab[aria-selected="true"] .count { background: var(--primary-soft); color: var(--primary-ink); }

.segmented { display: inline-flex; background: var(--surface-3); border-radius: var(--r-menu);
  padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented button { border: 1px solid transparent; background: none; font: inherit; font-size: 13px; padding: 5px 12px; border-radius: 8px;
  cursor: pointer; color: var(--muted); font-weight: 600; display: inline-flex; gap: 6px; align-items: center;
  transition: background-color .15s var(--ease), color .15s var(--ease); }
.segmented button:hover { color: var(--heading); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--heading); border-color: var(--border-strong); }
.segmented .count { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- tables: no grid lines, only row separators */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: start; font-weight: 700; color: var(--muted); font-size: 13px; padding: 11px 16px;
  background: var(--surface-2); white-space: nowrap; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--row-line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; transition: background-color .15s var(--ease); }
.table tbody tr.clickable:hover { background: var(--surface-2); }
.table tbody tr.selected, .table tbody tr[aria-selected="true"] { background: var(--primary-soft); }
.cell-title { font-weight: 600; color: var(--heading); }
.cell-sub { color: var(--muted); font-size: 13px; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); display: grid; gap: 8px; justify-items: center; }
.empty .icon { width: 36px; height: 36px; color: var(--faint); }
@media (max-width: 760px) {
  .table.responsive thead { display: none; }
  .table.responsive tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 14px 16px;
    border-bottom: 1px solid var(--row-line); }
  .table.responsive td { padding: 0; border: 0; }
  .table.responsive td[data-hide-mobile] { display: none; }
}
.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px;
  border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }

/* ---------------------------------------------------------------- dialogs, drawer (hairlines, no shadows), toasts (dark) */
dialog { border: 1px solid var(--border-strong); padding: 0; border-radius: var(--r-card); background: var(--surface); color: var(--text);
  width: min(520px, calc(100vw - 32px)); }
dialog::backdrop { background: rgb(28 35 32 / .45); }
.dialog-body { padding: 20px; display: grid; gap: 16px; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

.drawer { position: fixed; inset-block: 0; inset-inline-end: 0; width: min(560px, 100vw); background: var(--surface);
  border-inline-start: 1px solid var(--border-strong); z-index: 40; display: flex;
  flex-direction: column; transform: translateX(-100%); visibility: hidden;
  transition: transform .22s var(--ease), visibility 0s linear .22s; }
/* Pages are RTL: inline-end is the left edge, so the drawer slides in from the left. */
.drawer.open { transform: translateX(0); visibility: visible; transition: transform .22s var(--ease), visibility 0s; }
.drawer-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; gap: 12px; align-items: flex-start; }
.drawer-body { padding: 20px; overflow-y: auto; display: grid; gap: 22px; align-content: start; flex: 1; }
.drawer-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; flex-wrap: wrap; background: var(--surface-2); }
.scrim { position: fixed; inset: 0; background: rgb(28 35 32 / .4); z-index: 35; }

/* Dark surface: ink gradient + a 5% white dot grid. The only gradient of the identity (a background, not a control). */
.surface-dark, .toast, .auth-hero {
  background-color: var(--ink);
  background-image:
    radial-gradient(rgb(255 255 255 / .05) 1px, transparent 1.4px),
    linear-gradient(160deg, var(--primary-press), var(--ink));
  background-size: 18px 18px, 100% 100%;
  color: #F4F3EF;
}
.toasts { position: fixed; bottom: 20px; inset-inline-start: 20px; display: grid; gap: 10px; z-index: 60; }
.toast { padding: 12px 16px; border-radius: var(--r-menu); font-size: 14px; max-width: 360px; animation: toast-in .2s var(--ease);
  display: flex; gap: 10px; align-items: flex-start; border-inline-start: 3px solid var(--mint); }
.toast::before { content: "●"; color: var(--mint); font-size: 10px; line-height: 24px; flex: none; }
.toast.ok::before { content: "✓"; font-size: 14px; font-weight: 700; }
.toast.error { border-inline-start-color: var(--danger); }
.toast.error::before { content: "!"; color: var(--on-dark-danger); font-size: 14px; font-weight: 700; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ---------------------------------------------------------------- details */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 10px 20px; font-size: 14px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; overflow-wrap: anywhere; color: var(--heading); }
.section-title { font-size: 16px; font-weight: 700; color: var(--heading); margin-bottom: 10px; display: flex; gap: 8px; align-items: center; }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.timeline li { display: grid; grid-template-columns: 14px 1fr; gap: 12px; position: relative; }
.timeline li::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--primary);
  margin-top: 8px; }
.timeline .note { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-field); padding: 8px 10px;
  margin-top: 6px; font-size: 14px; white-space: pre-wrap; }

.minimap { height: 180px; border-radius: var(--r-item); border: 1px solid var(--border); overflow: hidden; }
/* Leaflet panes use z-index up to 1000: keep them inside the map so they never cover the sticky header. */
.minimap, .map-picker { isolation: isolate; position: relative; z-index: 0; }
.map-picker { height: 320px; border-radius: var(--r-item); border: 1px solid var(--border-strong); overflow: hidden; }

.copy-box { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px dashed var(--border-strong);
  border-radius: var(--r-item); padding: 10px 12px; }
.copy-box code { flex: 1; font-family: var(--mono); font-size: 14px; direction: ltr; text-align: left;
  overflow-wrap: anywhere; color: var(--heading); }
.secret { border-style: solid; border-color: var(--warn); background: var(--warn-soft); }

.skeleton { background: var(--surface-3); animation: pulse 1.4s ease-in-out infinite; border-radius: var(--r-field); min-height: 16px; }
@keyframes pulse { 50% { opacity: .5; } }

/* ---------------------------------------------------------------- auth screens */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-hero { padding: 48px clamp(28px, 5vw, 72px);
  display: flex; flex-direction: column; gap: 32px; position: relative; overflow: hidden; }
.auth-hero .brand { color: #fff; }
.auth-hero .brand-mark { background: rgb(255 255 255 / .08); color: var(--mint); }
.auth-hero .brand small { color: rgb(244 243 239 / .65); }
.hero-title { font-size: clamp(28px, 3.2vw, 40px); font-weight: 700; line-height: 1.3; max-width: 520px; color: #fff; }
.hero-text { font-size: 16px; color: rgb(244 243 239 / .82); max-width: 500px; }
.features { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; max-width: 480px; }
.features li { display: grid; grid-template-columns: 40px 1fr; gap: 14px; align-items: start; }
.features .f-icon { width: 40px; height: 40px; border-radius: var(--r-item); display: grid; place-items: center;
  background: rgb(255 255 255 / .07); border: 1px solid rgb(255 255 255 / .1); color: var(--mint); }
.features strong { display: block; font-size: 15px; color: #fff; }
.features span { color: rgb(244 243 239 / .7); font-size: 14px; }
.hero-foot { margin-top: auto; font-size: 13px; color: rgb(244 243 239 / .55); }

/* The floating cards: slow float, a new front card every few seconds, soft oval shadow, a faint rim of light. */
.float-stage { position: relative; height: 210px; max-width: 420px; perspective: 900px; margin-block: 8px 20px; }
.float-stage .float-rig { position: absolute; inset: 0; transform-style: preserve-3d; animation: float 7s ease-in-out infinite; }
.float-stage::after { content: ""; position: absolute; left: 50%; bottom: -14px; width: 68%; height: 22px; transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgb(0 0 0 / .38), transparent 70%); filter: blur(5px); pointer-events: none; }
.float-card { position: absolute; inset-inline: 0; top: 0; padding: 16px; border-radius: var(--r-card); background: #F9F8F5; color: var(--text);
  border: 1px solid rgb(255 255 255 / .55); display: grid; gap: 8px; transform-origin: 50% 100%;
  transition: transform .9s var(--ease), opacity .9s var(--ease), box-shadow .9s var(--ease); will-change: transform; }
.float-card[data-pos="0"] { transform: translate3d(0, 38px, 0) rotateX(0deg) rotateY(-7deg); opacity: 1; z-index: 3;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .9), 0 0 0 1px rgb(143 203 169 / .35), 0 0 28px rgb(143 203 169 / .14); }
.float-card[data-pos="1"] { transform: translate3d(14px, 14px, -70px) rotateY(-7deg); opacity: .86; z-index: 2; box-shadow: none; }
.float-card[data-pos="2"] { transform: translate3d(28px, -10px, -140px) rotateY(-7deg); opacity: .6; z-index: 1; box-shadow: none; }
.float-card .fc-head { display: flex; align-items: center; gap: 10px; }
.float-card .fc-icon { width: 34px; height: 34px; border-radius: var(--r-field); display: grid; place-items: center; flex: none; }
.float-card .fc-icon.ok { background: var(--ok-soft); color: var(--ok); }
.float-card .fc-icon.warn { background: var(--warn-soft); color: var(--warn); }
.float-card .fc-icon.info { background: var(--info-soft); color: var(--info); }
.float-card strong { color: var(--heading); font-size: 15px; }
.float-card p { font-size: 14px; color: var(--text); }
.float-card .fc-bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.float-card .fc-bar span { display: block; height: 100%; width: 66%; background: var(--ok); border-radius: 3px; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@media (prefers-reduced-motion: reduce) {
  .float-stage .float-rig { animation: none; }
  .float-card { transition: none; }
}

.auth-panel { display: grid; place-items: center; padding: 40px 20px; }
.auth-card { width: min(520px, 100%); }
.auth-card .card-body { padding: 28px; }
.auth-title { font-size: 24px; margin-bottom: 4px; }
.switch-line { text-align: center; font-size: 14px; color: var(--muted); }
.link-btn { background: none; border: 0; color: var(--primary); font: inherit; font-weight: 600; cursor: pointer; padding: 0; }
.link-btn:hover { text-decoration: underline; color: var(--primary-hover); }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-hero { padding: 28px 20px; gap: 18px; }
  .auth-hero .features, .auth-hero .hero-foot, .auth-hero .hero-text, .auth-hero .float-stage { display: none; }
  .hero-title { font-size: 22px; }
  .auth-card .card-body { padding: 22px; }
}

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; counter-reset: step; }
.step { display: grid; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.step::before { content: ""; height: 4px; border-radius: 2px; background: var(--border); }
.step.done::before, .step.current::before { background: var(--primary); }
.step.current { color: var(--primary); }

/* ---------------------------------------------------------------- status banner */
.status-panel { display: grid; grid-template-columns: 56px 1fr; gap: 18px; align-items: start; }
.status-icon { width: 56px; height: 56px; border-radius: var(--r-item); display: grid; place-items: center; }
.status-icon .icon { width: 28px; height: 28px; }
.status-icon.PENDING { background: var(--warn-soft); color: var(--warn); }
.status-icon.REJECTED { background: var(--danger-soft); color: var(--danger); }
.status-icon.SUSPENDED { background: var(--neutral-soft); color: var(--neutral); }
.status-icon.ACTIVE { background: var(--ok-soft); color: var(--ok); }
.progress-steps { list-style: none; margin: 14px 0 0; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.progress-steps li { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.progress-steps li + li::before { content: ""; width: 24px; height: 1px; background: var(--border-strong); }
.progress-steps .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px;
  font-weight: 700; background: var(--neutral-soft); color: var(--neutral-ink); }
.progress-steps .done .dot { background: var(--ok); color: #fff; }
.progress-steps .now .dot { background: var(--warn-soft); color: var(--warn-ink); border: 1px solid var(--warn); }
.progress-steps .done, .progress-steps .now { color: var(--heading); }

.howto { counter-reset: how; list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.howto li { counter-increment: how; display: grid; grid-template-columns: 30px 1fr; gap: 12px; }
.howto li::before { content: counter(how); width: 30px; height: 30px; border-radius: var(--r-field); display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary-ink); font-weight: 700; font-size: 14px; }

.center-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.loader { width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%;
  animation: spin .8s linear infinite; }

/* ------------------------------------------------------------ sign-up helpers */
button.step { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; font-weight: 600; text-align: start; cursor: default; }
button.step.done { cursor: pointer; }
button.step.done:hover { color: var(--heading); }
button.step:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

.strength { display: grid; gap: 4px; }
.strength-bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.strength-bar span { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--danger); transition: width .2s var(--ease), background-color .2s var(--ease); }
.strength[data-level="1"] .strength-bar span { width: 25%; background: var(--danger); }
.strength[data-level="2"] .strength-bar span { width: 50%; background: var(--warn); }
.strength[data-level="3"] .strength-bar span { width: 75%; background: var(--info); }
.strength[data-level="4"] .strength-bar span { width: 100%; background: var(--ok); }
.strength-label { font-size: 13px; color: var(--muted); }

.checklist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 4px 12px; font-size: 13px; color: var(--muted); }
.checklist li::before { content: "○"; margin-inline-end: 6px; color: var(--faint); }
.checklist li.ok { color: var(--ok-ink); }
.checklist li.ok::before { content: "✓"; color: var(--ok); font-weight: 700; }

.quick-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.quick-pick { border: 1px dashed var(--border-strong); background: transparent; color: var(--muted); border-radius: var(--r-field); padding: 3px 11px;
  font: inherit; font-size: 13px; cursor: pointer; transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease); }
.quick-pick:hover { color: var(--heading); border-color: var(--primary); }
.quick-pick[aria-pressed="true"] { background: var(--primary-soft); color: var(--primary-ink); border-style: solid; border-color: var(--primary); font-weight: 600; }
.quick-pick[aria-pressed="true"]::before { content: "✓ "; color: var(--primary); }

.chip-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.chip-head .link-btn { font-size: 13px; }
.alert.row { align-items: center; }

/* ------------------------------------------------------------ documents, review aids, control tabs */
.doc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.doc-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-item);
  background: var(--surface); }
.doc-row .doc-icon { width: 36px; height: 36px; border-radius: var(--r-field); display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.doc-row .grow { min-width: 0; }
.doc-row .cell-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.doc-form select.input { width: auto; min-width: 180px; height: 32px; padding-block: 0; font-size: 13px; }

.count-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-badge);
  background: var(--warn-soft); color: var(--warn-ink); border: 1px solid var(--warn); font-size: 12px; font-weight: 700; margin-inline-start: 6px; }
.toolbar-2 { border-bottom: 1px solid var(--border); }
.review-checks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px 14px; font-size: 14px; }
.review-checks li::before { content: "✓"; margin-inline-end: 6px; font-weight: 700; }
.review-checks li.ok { color: var(--ok-ink); }
.review-checks li.ok::before { color: var(--ok); }
.review-checks li.miss { color: var(--warn-ink); }
.review-checks li.miss::before { content: "!"; color: var(--warn); }
.dupes { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.queue-nav { display: flex; align-items: center; gap: 2px; margin-inline-start: auto; }
.queue-nav .pos { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; padding: 0 6px; }
.act-list { list-style: none; margin: 0; padding: 0; }
.act-item { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--row-line); align-items: start; }
.act-item:last-child { border-bottom: 0; }
.act-icon { width: 36px; height: 36px; border-radius: var(--r-field); display: grid; place-items: center; }
.act-icon.approve, .act-icon.reactivate { background: var(--ok-soft); color: var(--ok); }
.act-icon.reject, .act-icon.suspend { background: var(--danger-soft); color: var(--danger); }
.act-icon.resubmit { background: var(--info-soft); color: var(--info); }
.act-item .note { margin-top: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-field); padding: 6px 10px; font-size: 14px; white-space: pre-wrap; }
tr.row-warn td:first-child { box-shadow: inset -3px 0 0 var(--warn); }

@media (max-width: 640px) {
  .hide-mobile { display: none !important; }
  .brand { white-space: nowrap; }
  .topbar-inner { padding-inline: 14px; gap: 10px; }
  .tab { padding: 10px 10px; white-space: nowrap; }
}

/* ---------------------------------------------------------------- portal: the desktop program tab */
.intent { background: var(--surface-2); }
.programs { list-style: none; margin: 0; padding: 0; display: grid; }
.program { display: flex; align-items: center; gap: 14px; padding: 14px 0; }
.program + .program { border-top: 1px solid var(--row-line); }
.program-ic { width: 42px; height: 42px; border-radius: var(--r-item); background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; flex: none; }
.machine-input { direction: ltr; text-align: left; letter-spacing: .06em; font-size: 15px; }
.ok-text { color: var(--ok); font-weight: 600; }
.kind-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 640px) { .kind-options { grid-template-columns: 1fr; } }
.kind-option { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border-strong);
  border-radius: var(--r-item); background: var(--surface); cursor: pointer;
  transition: border-color .15s var(--ease), background-color .15s var(--ease); }
.kind-option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.kind-option.disabled { cursor: not-allowed; background: var(--surface-2); color: var(--faint); }
.kind-option input { margin-top: 4px; accent-color: var(--primary); }
.kind-option strong { display: block; color: var(--heading); font-size: 14px; }
.kind-option.disabled strong { color: var(--faint); }
.kind-option small { color: var(--muted); font-size: 12.5px; }
.issued { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--ok); background: var(--ok-soft); border-radius: var(--r-item); }
.issued .copy-box { background: var(--surface); }
.license-text { font-size: 12px !important; line-height: 1.6; max-height: 96px; overflow: auto; word-break: break-all; }
