/* SamayIQ shared component library — used by every page (login, signup,
   admin, kiosk). Depends on tokens.css being loaded first. Page-specific
   layout (nav shell, kiosk screens, stat grids) lives in admin.css /
   kiosk.css instead; this file is the reusable primitives every one of
   them is built from, so no page should be independently reinventing a
   button, input, card, table, badge, modal, or toast style. */

/* ── Icons ─────────────────────────────────────────────────────────────
   One consistent stroke-icon family, referenced everywhere as
   <svg class="icon"><use href="/img/icons.svg#name"/></svg>. fill/stroke
   are set here (not on the sprite file) because attributes on a <symbol>'s
   ancestor don't carry through <use> cloning — only inherited CSS
   properties do, and fill/stroke both inherit. */
.icon {
  width: 1.15em;
  height: 1.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  vertical-align: -0.2em;
}
.icon-lg {
  width: 1.6em;
  height: 1.6em;
}
.icon-xl {
  width: 2.4em;
  height: 2.4em;
  stroke-width: 1.6;
}
.icon-spin {
  animation: icon-spin 0.8s linear infinite;
}
@keyframes icon-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Brand lockup — the SamayIQ mark (public/img/logo-mark.svg) plus the
   wordmark as real text, not baked into the image, so it stays crisp and
   accessible at any size. `.brand-mark` sizes/frames the icon; swap the
   <img> src for logo-mark-white.svg when the row sits on a dark/colored
   surface (see admin.css's nav). ── */
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}
.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
}
.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.brand-name {
  font: var(--text-h2);
  color: var(--color-text);
  letter-spacing: -0.01em;
}
.brand-tagline {
  font: var(--text-caption);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-faint);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: 1.5px solid transparent;
  border-radius: var(--radius-md);
  font-size: 0.925rem;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition:
    opacity var(--duration-fast) var(--ease-standard),
    transform var(--duration-fast) var(--ease-standard),
    background var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard);
}
.btn:active {
  transform: scale(0.98);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-on-primary);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
}
.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border-strong);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--color-neutral-bg);
  color: var(--color-text);
}
.btn-danger {
  background: var(--color-danger);
  color: #fff;
}
.btn-danger:hover:not(:disabled) {
  filter: brightness(0.92);
}
.btn-danger-outline {
  background: var(--color-surface);
  color: var(--color-danger);
  border-color: var(--color-danger-border);
}
.btn-danger-outline:hover:not(:disabled) {
  background: var(--color-danger-bg);
}
/* Success-colored primary action (e.g. kiosk-style "Check In") — added so
   call sites stop hand-rolling this exact color via an inline
   style="background:..." (which a plain :hover selector can never
   override, since inline style always wins on specificity — the actual
   cause of "Check In doesn't feel responsive" found during the
   interaction-feedback audit). Same shape as every other .btn-* variant
   above: one resting state, one :hover:not(:disabled) state. */
.btn-success {
  background: var(--color-success);
  color: #fff;
}
.btn-success:hover:not(:disabled) {
  filter: brightness(0.92);
}
.btn-block {
  width: 100%;
}
.btn-sm {
  padding: 7px 14px;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}
.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  border-color: transparent;
}
.btn-icon:hover:not(:disabled) {
  background: var(--color-neutral-bg);
  color: var(--color-text);
}
/* :not(:disabled) added to the two variants below (was missing) — a
   disabled danger/warn icon button must not light up on hover, same rule
   every other .btn-icon state already follows (Section 1D). */
.btn-icon.danger:hover:not(:disabled) {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}
.btn-icon.warn:hover:not(:disabled) {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}
/* Success tint variant — same role as .danger/.warn above, for the
   check-in icon button (previously an inline style="background:..." that
   a CSS :hover rule could never override). Resting background is the
   variant's OWN class now, not an inline style, so :hover:not(:disabled)
   below can actually win. */
.btn-icon.success {
  background: var(--color-success-bg);
}
.btn-icon.success:hover:not(:disabled) {
  background: var(--color-success-bg);
  filter: brightness(0.95);
  color: var(--color-success-strong);
}

/* ── Form fields ── */
.field {
  margin-bottom: var(--space-4);
}
.field label {
  display: block;
  font: var(--text-label);
  color: var(--color-text);
  margin-bottom: 6px;
}
.field-note {
  font-size: 0.8rem;
  color: var(--color-text-faint);
  margin-top: 4px;
  line-height: 1.4;
}
.field-error {
  font-size: 0.8rem;
  color: var(--color-danger);
  margin-top: 4px;
  font-weight: 600;
}
.input,
input[type='text'],
input[type='email'],
input[type='password'],
input[type='number'],
input[type='date'],
input[type='datetime-local'],
select,
textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: var(--color-text);
  background: var(--color-surface);
  outline: none;
  font-family: inherit;
  transition: border-color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard);
}
.input:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 20%, transparent);
}
.input:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  background: var(--color-neutral-bg);
  color: var(--color-text-faint);
  cursor: not-allowed;
}
select {
  cursor: pointer;
  /* A minimal chevron baked in as a data-URI background — CSP's img-src
     allows data:, and this avoids the browser's own inconsistent native
     select arrow styling across platforms. */
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
}

/* Checkboxes/radios — sized up from the browser default (touch-friendly,
   matches the rest of the input scale) without a custom-paint hack that
   could fight the OS's own accessibility rendering. */
input[type='checkbox'],
input[type='radio'] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

/* A visible focus ring on every interactive element reached by keyboard —
   :focus-visible so a mouse click doesn't show it, only Tab navigation. */
.btn:focus-visible,
.tab-btn:focus-visible,
.nav-item:focus-visible,
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2.5px solid var(--color-primary);
  outline-offset: 2px;
}
input::placeholder,
textarea::placeholder {
  color: var(--color-text-faint);
}
textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.5;
}

/* ── Search field — an input with a leading icon, used in every toolbar ── */
.search-field {
  position: relative;
}
.search-field .icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-faint);
  pointer-events: none;
}
.search-field input {
  padding-left: 38px;
  /* Step 7B: these inputs switched from type="text" to type="search" (a
     stronger, more reliable signal to the browser to exclude them from
     profile/address/email autofill than autocomplete="off" alone — see
     that attribute's own comment). Safari/WebKit gives type="search" its
     own default rounded/inset chrome; this keeps it visually identical to
     every other .input on the page. */
  -webkit-appearance: none;
  appearance: none;
}

/* ── Password field — an input with a trailing show/hide toggle. The
   toggle button itself never disappears/reappears based on field state
   (typing, focus, validity) — only its icon and aria-label swap between
   eye/eye-off when clicked. See attachPasswordToggle() in shared.js. ── */
.password-field {
  position: relative;
}
.password-field input {
  padding-right: 44px;
}
.password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
}

/* ── Page header — every admin tab starts with this: title, optional
   description, and a primary action on the right where one exists. Keeps
   every tab structurally consistent instead of repeating the page name
   across cards. ── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.page-title {
  font: var(--text-h1);
  color: var(--color-text);
}
.page-description {
  font: var(--text-small);
  color: var(--color-text-muted);
  margin-top: 4px;
  max-width: 560px;
}
.page-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* ── Cards ── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: var(--space-5);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font: var(--text-h3);
  color: var(--color-text);
}
.card-title .icon {
  color: var(--color-primary);
}

/* ── Alerts (inline banners — distinct from toast, which is transient) ── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: var(--space-4);
  border: 1.5px solid transparent;
}
.alert .icon {
  flex-shrink: 0;
  margin-top: 1px;
}
.alert-error {
  background: var(--color-danger-bg);
  border-color: var(--color-danger-border);
  color: var(--color-danger);
}
.alert-success {
  background: var(--color-success-bg);
  border-color: var(--color-success);
  color: var(--color-success-strong);
}
.alert-info {
  background: var(--color-info-bg);
  border-color: var(--color-info);
  color: var(--color-info);
}
.alert-warning {
  background: var(--color-warning-bg);
  border-color: var(--color-warning);
  color: var(--color-warning);
}

/* ── File upload dropzone — a proper drag/drop + click target replacing a
   bare <input type="file">, which renders as an easy-to-miss native
   browser control. Shared/reusable design-system component (currently
   used by Center Setup's student-spreadsheet upload step). ── */
.file-dropzone {
  border: 2px dashed var(--color-border-strong);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  padding: var(--space-6) var(--space-5);
  text-align: center;
  cursor: pointer;
  transition:
    border-color 0.15s,
    background 0.15s;
}
.file-dropzone:hover,
.file-dropzone:focus-visible {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  outline: none;
}
.file-dropzone.drag-active {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}
.file-dropzone .icon {
  color: var(--color-text-faint);
  margin-bottom: var(--space-2);
}
.file-dropzone-title {
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 4px;
}
.file-dropzone-hint {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-bottom: var(--space-3);
  line-height: 1.5;
}
.file-dropzone-note {
  color: var(--color-text-faint);
  font-size: 0.8rem;
  margin-top: var(--space-3);
}

/* The post-selection state: filename, status, and the two required
   actions (Choose Different File / Remove File). */
.file-info-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  padding: var(--space-4) var(--space-5);
  flex-wrap: wrap;
}
.file-info-card .icon {
  flex-shrink: 0;
  color: var(--color-primary);
}
.file-info-main {
  flex: 1;
  min-width: 160px;
}
.file-info-name {
  font-weight: 700;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-info-status {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin-top: 2px;
}
.file-info-actions {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: var(--radius-pill);
  padding: 3px 11px;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
}
.badge-success {
  background: var(--color-success-bg);
  color: var(--color-success-strong);
}
.badge-neutral {
  background: var(--color-neutral-bg);
  color: var(--color-text-muted);
}
.badge-accent {
  background: var(--color-primary-light);
  color: var(--color-primary);
}
.badge-warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}
.badge-danger {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}
/* Severe overtime: a stronger, still non-flashing indicator — a bold
   border, per the accessibility requirement that nothing rely on
   flashing or color alone (the label text itself always says "Severe"). */
.badge-severe {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border: 1.5px solid var(--color-danger);
}

/* ── Spreadsheet Import V2 (Step 7D) review screen — shared between
   admin.html's Students-tab importer and center-setup.html's onboarding
   importer, via public/js/importReview.js. ── */
.import-filter-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}
.import-filter-tab {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  padding: 5px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
}
.import-filter-tab:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.import-filter-tab.active {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ── Review-row cards (7F.2) — replaces a wide traditional table, which
   could not fit this many fields at normal desktop/laptop widths without
   either horizontal scrolling or shrinking text past readability. Each
   candidate is one self-contained, vertically-stacked card: nothing here
   ever needs a horizontal scrollbar, since every element wraps or stacks
   instead of competing for one row's worth of width. ── */
.import-row-list-select-all {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: var(--space-2);
}
.import-row-list-select-all input {
  width: auto;
}
.import-row-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 480px;
  overflow-y: auto;
  padding-right: 2px;
}
.import-row-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
}
.import-row-card[data-import-row-status='needsReview'] {
  border-color: var(--color-warning);
}
.import-row-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.import-row-card-top input[type='checkbox'] {
  width: auto;
  flex-shrink: 0;
}
.import-row-card-name {
  font-weight: 700;
  font-size: 0.95rem;
  flex: 1;
  min-width: 0;
  overflow-wrap: break-word;
}
.import-row-card-badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.import-row-card-summary {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 4px;
  padding-left: 28px;
  overflow-wrap: break-word;
}
.import-row-card-merged {
  font-size: 0.8rem;
  color: var(--color-primary);
  font-weight: 600;
  margin-top: 6px;
  padding-left: 28px;
}
.import-row-card-warning {
  font-size: 0.85rem;
  color: var(--color-warning-strong, var(--color-warning));
  background: var(--color-warning-bg);
  border-radius: var(--radius-md);
  padding: 6px 8px;
  margin-top: 8px;
  margin-left: 28px;
}
.import-row-card-details {
  margin-top: 8px;
  margin-left: 28px;
  font-size: 0.85rem;
}
.import-row-card-details summary {
  cursor: pointer;
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.82rem;
}
.import-row-card-details[open] summary {
  margin-bottom: 6px;
}
@media (max-width: 640px) {
  .import-row-card-summary,
  .import-row-card-merged,
  .import-row-card-warning,
  .import-row-card-details {
    padding-left: 0;
    margin-left: 0;
  }
}

/* A row's inline "fix it here" control — a short label plus a small
   input/select, never a full spreadsheet-editor grid. */
.import-fix {
  margin-top: 4px;
  padding: 6px 8px;
  background: var(--color-warning-bg);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
}
.import-row-card .import-fix {
  margin-left: 28px;
  margin-top: 8px;
}
@media (max-width: 640px) {
  .import-row-card .import-fix {
    margin-left: 0;
  }
}

/* The persistent post-import summary — replaces a toast (which disappears
   in 3 seconds) with a state the owner can actually read and act on. */
.import-result-card {
  border: 1px solid var(--color-success);
  background: var(--color-success-bg);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-top: var(--space-4);
}

/* A plain, real <button> styled to read as a text link — for an inline
   toggle/action (e.g. "2 checked out ▾") that shouldn't compete visually
   with a primary/secondary .btn but still needs to be keyboard-focusable
   and screen-reader-announced as a button, unlike a bare onclick on text. */
.link-btn {
  background: none;
  border: none;
  padding: 0;
  margin-left: 8px;
  color: var(--color-primary);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: underline;
}
.link-btn:hover {
  color: var(--color-primary-hover);
}

/* ── Tables ──
   overflow-x: auto so a wide table (Books inventory, Loans, per-student
   reports) scrolls horizontally on a tablet/narrow-desktop viewport
   instead of clipping columns off-screen. */
.table-wrap {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
}
thead th {
  /* Horizontal padding trimmed from --space-5 (24px) to --space-4 (16px) —
     7F.1 Local Testing Fix Pass: this alone removes 16px per column of pure
     padding across every table site-wide, a meaningful share of why normal
     desktop/laptop widths needed horizontal scrolling on wider tables
     (Students, Live Attendance, Spreadsheet Import review). Vertical
     padding/font-size untouched — this is not a "shrink the text" fix. */
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--color-surface-sunken);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--color-border);
  transition: background var(--duration-fast) var(--ease-standard);
}
tbody tr:last-child {
  border-bottom: none;
}
tbody tr:hover {
  background: var(--color-primary-light);
}
tbody td {
  padding: var(--space-4) var(--space-5);
  font-size: 0.9rem;
  vertical-align: middle;
}

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-4) 0;
}
.pagination-info {
  font-size: 0.825rem;
  color: var(--color-text-muted);
  margin: 0 var(--space-2);
}

/* ── Tabs (top-level nav on kiosk-adjacent pages, and in-page segmented
   toggles like Books' Inventory/Loans switch) ── */
.tabs {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  gap: 4px;
}
.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 14px 16px;
  border: none;
  background: none;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -1px;
  font-family: inherit;
  transition:
    color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard);
}
.tab-btn:hover {
  color: var(--color-primary);
}
.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}
.tab-content {
  display: none;
}
.tab-content.active {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  animation: fade-in var(--duration-base) var(--ease-standard);
}
@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(2px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* A segmented-control look for an in-page toggle that isn't the top-level
   .tabs nav (e.g. Books' Inventory/Loans switch, Reports' date presets). */
.segmented-btn {
  padding: 8px 16px;
  border: 1.5px solid var(--color-border-strong);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition:
    background var(--duration-fast) var(--ease-standard),
    color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard);
}
.segmented-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* ── Loading / empty states ── */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.empty {
  text-align: center;
  padding: 56px 20px;
  color: var(--color-text-faint);
}
.empty .icon {
  width: 40px;
  height: 40px;
  margin-bottom: 14px;
  color: var(--color-text-faint);
  stroke-width: 1.5;
}
.empty h3 {
  font: var(--text-h3);
  color: var(--color-text-muted);
  margin-bottom: 6px;
}
.empty p {
  font-size: 0.875rem;
  max-width: 360px;
  margin: 0 auto;
  line-height: 1.5;
}
.empty .btn {
  margin-top: var(--space-4);
}

/* Skeleton loading placeholders — used while a table/card's real content
   is still in flight, instead of a blank area suddenly populating. */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--color-neutral-bg);
  border-radius: var(--radius-sm);
  color: transparent;
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--color-surface) 55%, transparent),
    transparent
  );
  animation: skeleton-sweep 1.4s ease-in-out infinite;
}
@keyframes skeleton-sweep {
  100% {
    transform: translateX(100%);
  }
}
.skeleton-text {
  height: 0.9em;
  width: 100%;
  border-radius: 4px;
}
.skeleton-text + .skeleton-text {
  margin-top: 8px;
}

/* ── Tooltip — hover/focus only, brief supplementary text ── */
.tooltip {
  position: relative;
}
.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(2px);
  background: var(--color-text);
  color: var(--color-surface);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity var(--duration-fast) var(--ease-standard),
    transform var(--duration-fast) var(--ease-standard);
  z-index: 40;
}
.tooltip:hover::after,
.tooltip:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Dropdown menu (staff row actions, etc.) ── */
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 180px;
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 6px;
  z-index: 60;
  display: none;
}
.dropdown-menu.open {
  display: block;
  animation: menu-in var(--duration-fast) var(--ease-standard);
}
@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.dropdown-item:hover {
  background: var(--color-neutral-bg);
}
.dropdown-item.danger {
  color: var(--color-danger);
}
.dropdown-item.danger:hover {
  background: var(--color-danger-bg);
}

/* ── Compact expandable row (email templates, and any future settings list
   where "one giant form" would be overwhelming) ── */
.compact-row {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}
.compact-row + .compact-row {
  margin-top: var(--space-3);
}
.compact-row-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4);
}
.compact-row-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 2px;
}
.compact-row-desc {
  font-size: 0.825rem;
  color: var(--color-text-muted);
}
.compact-row-editor {
  padding: 0 var(--space-4) var(--space-4);
  border-top: 1px solid var(--color-border);
  margin-top: 0;
  padding-top: var(--space-4);
}
.email-editor-textarea {
  min-height: 260px;
}

/* ── Dialogs / modals ── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop.open {
  display: flex;
}
.modal {
  background: var(--color-surface-elevated);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modal-in var(--duration-base) var(--ease-standard);
}
@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}
.modal-header h2 {
  font: var(--text-h2);
}
.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--color-neutral-bg);
  cursor: pointer;
  color: var(--color-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.modal-close:hover {
  background: var(--color-border);
  color: var(--color-text);
}
.modal-footer {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-6);
}
.modal-footer .btn {
  flex: 1;
}
.modal-footer .btn-primary {
  flex: 2;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-text);
  color: var(--color-surface);
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition:
    opacity var(--duration-base) var(--ease-standard),
    transform var(--duration-base) var(--ease-standard);
  z-index: 999;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.error {
  background: var(--color-danger);
  color: #fff;
}
.toast.success {
  background: var(--color-success-strong);
  color: #fff;
}

/* Inline placeholder hints (e.g. {{student_name}} in template-editing UI) */
code {
  background: var(--color-neutral-bg);
  color: var(--color-primary);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.85em;
  font-family: var(--font-mono);
}

/* ── Small utility classes used across pages, so inline styles don't have
   to repeat the same handful of layout tweaks ── */
.text-muted {
  color: var(--color-text-muted);
}
.text-faint {
  color: var(--color-text-faint);
}
.text-center {
  text-align: center;
}
.stack-sm > * + * {
  margin-top: var(--space-2);
}
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.row-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.spacer {
  flex: 1;
}
.divider {
  border: none;
  border-top: 1px solid var(--color-border);
}
