/* Ryan Review Center — reusable components */

/* Accessibility: consistent keyboard focus ring across interactive elements.
   Mouse clicks stay clean (focus-visible only fires for keyboard/AT users). */
/* Screen-reader-only text (announce state without visual clutter). */
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
/* Lock background scroll while a modal/overlay is open. */
body.has-modal { overflow: hidden; }

/* Skeleton placeholders — shimmer that mimics content shape (perceived speed). */
.skeleton {
    display: block; border-radius: var(--radius-sm);
    background: linear-gradient(90deg, var(--mist) 25%, #f4f8ff 37%, var(--mist) 63%);
    background-size: 400% 100%;
    animation: skeleton-shimmer 1.4s ease-in-out infinite;
}
.skeleton-line { height: 12px; margin-bottom: var(--space-2); }
.skeleton-line.lg { height: 18px; margin-bottom: var(--space-3); }
.skeleton-btn { height: 40px; width: 60%; margin-top: var(--space-4); border-radius: var(--radius-sm); }
.skeleton-avatar { width: 40px; height: 40px; border-radius: var(--radius-pill); flex: 0 0 auto; }
.skeleton-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
    padding: var(--space-5);
}
.skeleton-list { display: flex; flex-direction: column; gap: var(--space-3); }
.skeleton-row {
    display: flex; align-items: center; gap: var(--space-3);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: var(--space-3) var(--space-4);
}
.skeleton-row .skeleton-line { margin: 0; }
@keyframes skeleton-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--police-blue);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    font-family: var(--font-head);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 11px 18px;
    min-height: 42px;                 /* comfortable tap target (>=40px) */
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--dur-fast) var(--ease-out),
                box-shadow var(--dur-fast) var(--ease-out),
                transform var(--dur-fast) var(--ease-out),
                border-color var(--dur-fast) var(--ease-out);
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; transform: none; }

.btn-primary {
    background: var(--police-blue); color: var(--white);
    box-shadow: 0 1px 2px rgba(10,31,68,.14);
}
.btn-primary:hover { background: var(--police-blue-600); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn-primary:active { background: var(--police-blue-700); transform: translateY(0); box-shadow: var(--shadow-sm); }

.btn-gold {
    background: var(--gold); color: var(--navy);
    box-shadow: 0 1px 2px rgba(180,120,0,.22);
}
.btn-gold:hover { background: var(--gold-600); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn-gold:active { transform: translateY(0); box-shadow: var(--shadow-sm); }

.btn-secondary { background: var(--white); color: var(--navy); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--police-blue); color: var(--police-blue-700); }

.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #B91C1C; box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn-danger:active { transform: translateY(0); }

.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: #15803D; box-shadow: var(--shadow-md); transform: translateY(-1px); }

.btn-ghost { background: transparent; color: var(--slate); }
.btn-ghost:hover { background: var(--mist); color: var(--navy); }

.btn-sm { padding: 7px 12px; min-height: 34px; font-size: 0.85rem; }
.btn-block { width: 100%; }
.btn .ico-svg { width: 18px; height: 18px; }

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: var(--space-5);
    transition: box-shadow var(--dur) var(--ease-out),
                transform var(--dur) var(--ease-out),
                border-color var(--dur) var(--ease-out);
}
.card + .card { margin-top: var(--space-4); }
.card-title { margin-bottom: var(--space-3); }
/* Interactive cards (whole card acts as a link/tile) get a hover lift. */
.card-interactive { cursor: pointer; }
.card-interactive:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--border-strong);
}
/* A thin brand accent rail — used to add hierarchy to key cards. */
.card-accent { position: relative; overflow: hidden; }
.card-accent::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    background: var(--navy-grad);
}

/* Stat cards */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--space-4);
}
.stat-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-5) var(--space-4);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card .stat-value {
    font-family: var(--font-head);
    font-size: 2rem;
    font-weight: 700;
    color: var(--navy);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.stat-card .stat-label {
    color: var(--slate); font-size: var(--fs-sm);
    margin-top: var(--space-1);
}
.stat-card.gold { border-top: 3px solid var(--gold); }
.stat-card.blue { border-top: 3px solid var(--police-blue); }
/* Optional leading icon chip inside a stat card. */
.stat-card .stat-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: var(--radius-sm);
    background: var(--mist); color: var(--police-blue);
    margin-bottom: var(--space-3);
}
.stat-card .stat-icon .ico-svg { width: 22px; height: 22px; }

/* Forms */
.form-group { margin-bottom: var(--space-4); }
.form-label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--navy);
    margin-bottom: var(--space-2);
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 11px 12px;
    min-height: 42px;
    font: inherit;
    color: var(--ink);
    background: var(--white);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--muted); }
.form-input:hover, .form-select:hover, .form-textarea:hover { border-color: var(--police-blue); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--police-blue);
    box-shadow: 0 0 0 3px var(--ring);
}
/* Inline validation state (add .is-invalid to the field). */
.form-input.is-invalid, .form-select.is-invalid, .form-textarea.is-invalid {
    border-color: var(--danger);
}
.form-input.is-invalid:focus { box-shadow: 0 0 0 3px var(--danger-tint); }
.form-error { color: var(--danger); font-size: var(--fs-xs); margin-top: var(--space-1); font-weight: 600; }
.form-textarea { min-height: 90px; resize: vertical; }
.form-hint { font-size: 0.8rem; color: var(--muted); margin-top: var(--space-1); }
.form-check { display: flex; align-items: center; gap: var(--space-2); }
.form-check input { width: 18px; height: 18px; }
.area-checklist {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    max-height: 220px;
    overflow-y: auto;
    padding: var(--space-2);
    border: 1px solid var(--mist);
    border-radius: var(--radius);
    margin-top: var(--space-1);
}
.area-checklist .form-check { margin: 0; }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.badge-success { background: var(--success-tint); color: #15803d; box-shadow: inset 0 0 0 1px rgba(21,128,61,.14); }
.badge-danger { background: var(--danger-tint); color: #b91c1c; box-shadow: inset 0 0 0 1px rgba(185,28,28,.14); }
.badge-muted { background: var(--mist); color: var(--slate); box-shadow: inset 0 0 0 1px var(--border); }
.badge-gold { background: var(--warning-tint); color: #92400e; box-shadow: inset 0 0 0 1px rgba(146,64,14,.14); }
.badge-info { background: var(--info-tint); color: #1d4ed8; box-shadow: inset 0 0 0 1px rgba(29,78,216,.14); }

/* Alerts */
.alert {
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 0.9rem;
    margin-bottom: var(--space-4);
    border: 1px solid transparent;
}
.alert-danger { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.alert-success { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.alert-info { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.alert-warning { background: #fffbeb; color: #b45309; border-color: #fde68a; }

/* Spinner */
.spinner {
    width: 22px; height: 22px;
    border: 3px solid rgba(11, 61, 145, 0.25);
    border-top-color: var(--police-blue);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: inline-block;
}
.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
.spinner-light { border-color: rgba(255,255,255,.4); border-top-color: #fff; }
.loading-center { display: flex; justify-content: center; padding: var(--space-6); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--white); }
.table { width: 100%; border-collapse: collapse; min-width: 520px; }
.table th, .table td { padding: 13px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.table th {
    background: var(--mist); color: var(--navy); font-weight: 600; white-space: nowrap;
    font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .04em;
    position: sticky; top: 0;
}
.table tbody tr { transition: background var(--dur-fast) var(--ease-out); }
.table tbody tr:hover { background: var(--surface-2); }
.table tr:last-child td { border-bottom: none; }
.table .actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* Responsive: stack table rows into cards on phones.
   Cells use data-label="Header" to show their column name. */
@media (max-width: 640px) {
    .table-wrap { overflow-x: visible; border: none; background: transparent; }
    .table { min-width: 0; border-collapse: separate; border-spacing: 0; }
    .table thead { display: none; }
    .table tr {
        display: block; background: var(--white);
        border: 1px solid var(--border); border-radius: var(--radius);
        box-shadow: var(--shadow-sm); margin-bottom: var(--space-3); padding: var(--space-2) 0;
    }
    .table td {
        display: flex; justify-content: space-between; align-items: center; gap: var(--space-3);
        border-bottom: 1px solid var(--mist); text-align: right; padding: 10px 14px;
    }
    .table tr td:last-child { border-bottom: none; }
    .table td::before {
        content: attr(data-label);
        font-weight: 600; color: var(--navy); text-align: left; white-space: nowrap;
    }
    .table td.actions { justify-content: flex-end; flex-wrap: wrap; }
    .table td.actions::before { align-self: center; }
}

/* Modal
   Layout: the dialog is a flex column so the header and footer stay put while
   ONLY the body scrolls. This keeps the title and action buttons always
   visible — no more scrolling a tall form inside a small box. */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(10, 31, 68, 0.55);
    display: flex; align-items: center; justify-content: center;
    padding: var(--space-4);
    z-index: 100;
    animation: modal-fade var(--dur) var(--ease-out);
}
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
    display: flex; flex-direction: column;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%; max-width: 640px;               /* roomier default */
    max-height: min(90vh, 860px);
    overflow: hidden;                            /* body handles scrolling */
    animation: modal-pop var(--dur-slow) var(--ease-out);
}
@keyframes modal-pop {
    from { opacity: 0; transform: translateY(12px) scale(.98); }
    to { opacity: 1; transform: none; }
}
.modal-header {
    flex: 0 0 auto;
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border);
    background: var(--white);
}
.modal-header h3 { margin: 0; font-size: var(--fs-md); }
.modal-body {
    flex: 1 1 auto;
    padding: var(--space-5);
    overflow-y: auto;                            /* the only scroll region */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
.modal-footer {
    flex: 0 0 auto;
    display: flex; justify-content: flex-end; gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--border);
    background: var(--white);
}
.modal-close {
    flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: var(--radius-sm);
    background: none; border: none; font-size: 1.5rem; line-height: 1;
    color: var(--slate); cursor: pointer;
    transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.modal-close:hover { background: var(--mist); color: var(--navy); }

/* Toasts */
#toast-container {
    position: fixed; top: calc(var(--topbar-h) + 12px); right: 16px;
    z-index: 200; display: flex; flex-direction: column; gap: var(--space-2);
    max-width: 90vw;
}
.toast {
    background: var(--navy); color: var(--white);
    padding: 12px 16px; border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md); font-size: 0.9rem;
    animation: toast-in .2s ease-out;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--info); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* Empty state — a real, designed first impression (not an afterthought). */
.empty {
    display: flex; flex-direction: column; align-items: center;
    text-align: center; padding: var(--space-7) var(--space-5); color: var(--slate);
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
}
.empty .empty-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 56px; height: 56px; border-radius: var(--radius-pill);
    background: var(--mist); color: var(--police-blue);
    margin-bottom: var(--space-3);
}
.empty .empty-icon .ico-svg { width: 28px; height: 28px; }
.empty .empty-icon.error { background: var(--danger-tint); color: var(--danger); }
.empty.error-state { border-color: #f6cccc; }
.empty .empty-title {
    font-family: var(--font-head); font-weight: 600; color: var(--navy);
    font-size: var(--fs-md); margin-bottom: var(--space-1);
}
.empty p { color: var(--muted); margin: 0 0 var(--space-4); max-width: 46ch; }
.empty .btn { margin-top: var(--space-1); }

/* Category filter bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}
.filter-chip {
    display: inline-flex;
    align-items: center;
    font-family: var(--font-head);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--white);
    color: var(--slate);
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.filter-chip:hover { background: var(--mist); }
.filter-chip.active {
    background: var(--police-blue);
    color: var(--white);
    border-color: var(--police-blue);
    box-shadow: 0 2px 8px rgba(22,87,217,.28);
}

/* Video watch progress */
.progress-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    font-size: 0.8rem;
    color: var(--slate);
    margin-top: var(--space-2);
}
.progress-track {
    height: 6px;
    width: 100%;
    background: var(--mist);
    border-radius: 999px;
    overflow: hidden;
    margin-top: var(--space-1);
}
.progress-fill {
    height: 100%;
    width: 0;
    background: var(--police-blue);
    border-radius: 999px;
    transition: width .2s ease-out;
}
.progress-fill.is-complete { background: var(--success); }

/* Upload progress (file uploads in forms/modals) */
.upload-progress {
    margin-top: var(--space-3);
    padding: var(--space-3);
    background: var(--mist);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.upload-progress .progress-track {
    height: 10px;
    background: var(--white);
    margin-top: var(--space-2);
}
.upload-progress-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--font-head);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--navy);
}
.upload-progress-head span:last-child {
    font-variant-numeric: tabular-nums;
    color: var(--police-blue);
}
.upload-progress .progress-fill { transition: width .2s ease-out, background .2s; }
.upload-progress .progress-fill.is-indeterminate {
    background: linear-gradient(90deg, var(--police-blue), #4f83d6, var(--police-blue));
    background-size: 200% 100%;
    animation: upload-indeterminate 1.2s ease-in-out infinite;
}
@keyframes upload-indeterminate {
    0%   { width: 15%; margin-left: 0; }
    50%  { width: 55%; margin-left: 45%; }
    100% { width: 15%; margin-left: 85%; }
}
.upload-progress .form-hint { margin-top: var(--space-2); margin-bottom: 0; }

/* Toolbar: search + filters above a list (Students page, etc.) */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}
.toolbar .search-field { position: relative; flex: 1 1 240px; min-width: 200px; }
.toolbar .search-field .form-input { padding-left: 36px; }
.search-icon {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: var(--muted); pointer-events: none; font-size: 0.9rem;
}
.toolbar-count { color: var(--slate); font-size: 0.85rem; white-space: nowrap; }
.toolbar-spacer { flex: 1 1 auto; }

/* Pagination control */
.pager {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--space-3); flex-wrap: wrap;
    margin-top: var(--space-3);
}
.pager-info { color: var(--slate); font-size: 0.85rem; }
.pager-controls { display: flex; align-items: center; gap: var(--space-2); }
.pager-page {
    font-size: 0.85rem; color: var(--navy); font-weight: 600;
    white-space: nowrap; min-width: 92px; text-align: center;
    font-variant-numeric: tabular-nums;
}

/* Reusable searchable / multi-select picker */
.picker { display: flex; flex-direction: column; gap: var(--space-2); }
.picker-search { position: relative; }
.picker-search-icon {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: var(--muted); pointer-events: none; font-size: 0.9rem;
}
.picker-search .picker-input { padding-left: 36px; }
.picker-status { margin: 0; }

.picker-selected {
    background: var(--mist);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-3);
}
.picker-selected-head {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 0.82rem; font-weight: 600; color: var(--navy);
    margin-bottom: var(--space-2);
}
.picker-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--white); border: 1px solid var(--border);
    border-radius: 999px; padding: 4px 6px 4px 12px;
    font-size: 0.8rem; color: var(--navy);
}
.chip-x {
    border: none; background: var(--mist); color: var(--slate);
    width: 18px; height: 18px; border-radius: 50%; cursor: pointer;
    line-height: 1; font-size: 0.9rem; display: inline-flex;
    align-items: center; justify-content: center;
}
.chip-x:hover { background: var(--danger); color: var(--white); }

.picker-list {
    max-height: 300px; overflow-y: auto;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.picker-row {
    display: flex; align-items: center; gap: var(--space-3);
    padding: 10px 12px; cursor: pointer;
    border-bottom: 1px solid var(--mist);
}
.picker-row:last-child { border-bottom: none; }
.picker-row:hover { background: var(--mist); }
.picker-row input[type=checkbox] { width: 18px; height: 18px; flex-shrink: 0; }
.picker-row-main { display: flex; flex-direction: column; min-width: 0; }
.picker-row-name {
    font-weight: 600; color: var(--navy); font-size: 0.9rem;
    display: flex; align-items: center; gap: var(--space-2);
}
.picker-row-email {
    color: var(--muted); font-size: 0.8rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.picker-empty { text-align: center; color: var(--muted); padding: var(--space-5); margin: 0; }

/* Bulk action toolbar inside modals (e.g. members list) */
.bulk-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--space-3); flex-wrap: wrap;
    padding: var(--space-2) 0;
}
.bulk-toolbar-left { display: flex; align-items: center; gap: var(--space-2); }

/* Member/assigned rows with a leading checkbox */
.list-row {
    display: flex; align-items: center; gap: var(--space-3);
    padding: 10px 0; border-bottom: 1px solid var(--border);
}
.list-row:last-child { border-bottom: none; }
.list-row input[type=checkbox] { width: 18px; height: 18px; flex-shrink: 0; }
.list-row-main { flex: 1 1 auto; min-width: 0; }
.list-row-name { color: var(--navy); }
.list-row-email { color: var(--muted); font-size: 0.85rem; }

/* Modal sizes (desktop widths) */
.modal.modal-sm  { max-width: 460px; }
.modal.modal-lg  { max-width: 820px; }
.modal.modal-xl  { max-width: 1040px; }
/* Full-canvas modal for big, dense forms (e.g. exam generator). */
.modal.modal-full {
    max-width: 1100px; width: 100%;
    max-height: min(94vh, 1000px);
}

/* Mobile: turn every modal into a full-height bottom sheet that's easy to read,
   with the action footer always reachable above the home indicator. */
@media (max-width: 640px) {
    .modal-overlay { padding: 0; align-items: flex-end; }
    .modal,
    .modal.modal-sm,
    .modal.modal-lg,
    .modal.modal-xl,
    .modal.modal-full {
        max-width: 100%; width: 100%;
        height: 100dvh; max-height: 100dvh;
        border-radius: 0;
        animation: modal-sheet-up var(--dur-slow) var(--ease-out);
    }
    .modal-header {
        position: sticky; top: 0; z-index: 2;
        padding-top: calc(var(--space-4) + env(safe-area-inset-top, 0));
    }
    .modal-body { padding: var(--space-4); }
    .modal-footer {
        position: sticky; bottom: 0; z-index: 2;
        padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0));
        box-shadow: 0 -6px 18px rgba(10,31,68,.08);
    }
    /* Full-width, thumb-friendly actions stacked on phones. */
    .modal-footer .btn { flex: 1 1 auto; }
}
@keyframes modal-sheet-up {
    from { opacity: .4; transform: translateY(100%); }
    to { opacity: 1; transform: none; }
}

/* Slightly taller phones can keep a rounded top edge for a sheet feel. */
@media (max-width: 640px) and (min-height: 720px) {
    .modal, .modal.modal-full {
        height: auto; max-height: 92dvh;
        border-top-left-radius: var(--radius-lg);
        border-top-right-radius: var(--radius-lg);
    }
}

/* Group card meta line */
.group-meta { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-1); }
