/* Shared behaviour from src/ux.js: toasts and Undo, field errors, sortable headings, connection and session notices. */
.ui-toasts { position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%); z-index: 1001; display: grid; gap: 8px; width: max-content; max-width: min(560px, calc(100vw - 32px)); pointer-events: none; }
.ui-toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; border-radius: 12px; background: var(--svu-text-primary, #0F172A); color: var(--svu-surface-primary, #fff); box-shadow: 0 8px 24px rgba(0,0,0,.18); font-weight: 550; animation: ui-toast-in var(--svu-dur, 160ms) var(--svu-ease, ease-out); }
.ui-toast.is-leaving { opacity: 0; transition: opacity 200ms; }
.ui-toast-error { background: var(--svu-danger, #b42318); color: #fff; }
.ui-toast [data-toast-text] { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ui-toast-action { border: 0; background: transparent; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.ui-toast-action:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.ui-toast .icon-button { color: inherit; background: transparent; border-color: rgba(255,255,255,.35); flex-shrink: 0; }
@keyframes ui-toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.ui-field-error { display: block; margin-top: 6px; color: var(--svu-red-text, #B91C1C); font-size: 13px; font-weight: 550; }
[aria-invalid="true"].input, input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--svu-red, #DC2626) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--svu-red, #DC2626) 16%, transparent); }

th[aria-sort] { white-space: nowrap; }
.ui-sort { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font: inherit; color: inherit; border-radius: 6px; }
.ui-sort::after { content: ""; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; opacity: .25; }
th[aria-sort="ascending"] .ui-sort::after { border-top: 0; border-bottom: 5px solid currentColor; opacity: .8; }
th[aria-sort="descending"] .ui-sort::after { opacity: .8; }
.ui-sort:hover::after { opacity: .6; }
.ui-sort:focus-visible { outline: 2px solid var(--svu-focus, #021A3C); outline-offset: 2px; }

.ui-offline-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 1002; padding: 8px 16px; text-align: center; background: var(--svu-amber-soft, #FFF8E7); color: var(--svu-amber-text, #B45309); border-bottom: 1px solid var(--svu-amber, #D97706); font-weight: 600; font-size: 14px; }

.ui-session-warning { position: fixed; right: 16px; bottom: 16px; z-index: 1003; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); padding: 16px; border-radius: 14px; background: var(--svu-surface-primary, #fff); color: var(--svu-text-primary, #0F172A); border: 1px solid var(--svu-border-strong, rgba(15,23,42,.12)); box-shadow: var(--svu-shadow-3, 0 24px 64px rgba(15,23,42,.18)); }
.ui-session-warning span { color: var(--svu-text-secondary, #5B6B80); font-size: 14px; }
.ui-session-warning .ui-actions { justify-content: flex-end; }

.notice-info { background: var(--svu-blue-soft, #EEF1F6); color: var(--svu-blue, #021A3C); }
h1[tabindex="-1"]:focus { outline: none; }

.theme-choice { display: flex; flex-wrap: wrap; gap: 8px; border: 0; padding: 0; margin: 0; }
.theme-choice label { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--svu-border-strong, #D0D5DD); border-radius: 10px; cursor: pointer; }
.theme-choice label:has(input:checked) { border-color: var(--svu-blue, #021A3C); background: var(--svu-blue-soft, #EEF1F6); }

@media (max-width: 720px) {
  .ui-toasts { bottom: 84px; }
  .ui-session-warning { left: 16px; right: 16px; width: auto; bottom: 84px; }
}
@media (prefers-reduced-motion: reduce) { .ui-toast { animation: none; } }

/* ---------- Alignment (page-by-page UI check, 2026-11-11) ---------- */
/* Checkboxes and radios sit centred on the first line of their label, not on the text baseline. */
.page-container input[type="checkbox"], .page-container input[type="radio"] { vertical-align: -4px; }
.check-option { display: inline-flex; align-items: center; gap: 8px; }
.check-option > :is(input[type="checkbox"], input[type="radio"]) { flex: 0 0 auto; margin: 0; }
/* In a form grid, buttons beside labelled fields line up with the field boxes (not the labels) at the same height. */
.form-grid > :is(button, .button),
.form-grid > :is(div:not([class]), .button-row, .form-actions, .hero-actions, .ui-actions):has(> :is(button, .button)):not(:has(input:not([type="hidden"]), select, textarea)) { align-self: end; }
.form-grid > :is(button, .button),
.form-grid > :is(div:not([class]), .button-row, .form-actions, .hero-actions, .ui-actions):has(> :is(button, .button)):not(:has(input:not([type="hidden"]), select, textarea)) > :is(button, .button) { min-height: 44px; }
/* An unread count with nothing to show takes no room, so a tab's underline fits its label. */
.chat-alert-badge[data-empty=true] { display: none; }
/* Abuse reports: the My reports / Safety review switch sits on its own line above the status filter. */
.private-actions > .message-modes { flex: 1 0 100%; margin-bottom: 4px; }
/* Student record: the Results tab spaces its sections like the other tabs. */
#record-results:not([hidden]) { display: grid; gap: var(--svu-space-6, 24px); }
/* Students list: the quick views wrap instead of running off the edge. */
.registry-workspace .worklist-views.academic-tabs, .staff-body .worklist-views.academic-tabs { flex-wrap: wrap; overflow: visible; position: static; }
/* Student record on a phone: Back on its own line, then Previous · Student n of N · Next on one line. */
@media (max-width: 640px) {
  .staff-body .record-nav-steps { flex: 1 1 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; }
  .staff-body .record-nav-steps .ui-meta { text-align: center; }
  .staff-body .record-nav-view { display: none; }
}
/* A row of text with one button after it: on a phone the button goes under the text instead of squeezing it to a narrow column. */
@media (max-width: 640px) {
  .ui-row:has(> div:first-child + :is(.button, button):last-child) { flex-wrap: wrap; row-gap: var(--svu-space-2, 8px); }
  .ui-row:has(> div:first-child + :is(.button, button):last-child) > div:first-child { flex: 1 1 100%; min-width: 0; }
}
/* Rows that open a record from anywhere on them show it: a pointer and a hover tint across the whole row. */
tr[data-row-opens] { cursor: pointer; }
tr[data-row-opens]:hover > td { background: var(--svu-blue-soft, #eef2ff); }
tr[data-row-opens] :is(input, label) { cursor: default; }

/* Sign-in is the signed-out home: Apply sits under the form as the one other way in. */
.signin-apply { display: grid; gap: var(--svu-space-2, 8px); justify-items: center; padding-top: var(--svu-space-5, 20px); border-top: 1px solid var(--svu-border, #e2e8f0); text-align: center; }
.signin-apply .meta { margin: 0; }
.signin-card .signin-apply .button { width: 100%; justify-content: center; }
