/* ============================================================
   ADMIN SECTION
   ============================================================ */

@import url("./variables.css");

/* ── Layout ────────────────────────────────────────────────────────────── */
.admin-body {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Keep admin header single-row like public header */
.admin-body header nav {
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: thin;
}
.admin-body header nav > a,
.admin-body header nav ul {
    flex-shrink: 0;
}
.admin-body header nav,
.admin-body header nav ul,
.admin-body header nav li {
    list-style: none;
    flex-wrap: nowrap;
}

.admin-body header nav ul [data-nav-logout] a {
    opacity: 0.6;
}
.admin-body header nav ul [data-nav-logout] a:hover {
    opacity: 1;
}

/* Public-site link icon in admin nav */
.admin-body header nav > a svg {
    vertical-align: middle;
    margin-right: 0.4em;
}

/* Active nav link — non-colour indicator required by WCAG 1.4.1 */
.admin-body header nav ul a[aria-current="page"] {
    border-bottom: 2px solid currentColor;
    padding-bottom: 1px;
}

.admin-body main {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: var(--space-l) var(--space-l) var(--space-2xl);
    max-width: 1100px;
    width: 100%;
    margin-inline: auto;
}

.admin-body main > h1,
.admin-list-header > h1 {
    font-size: var(--step-2);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0 0 var(--space-l) 0;
}

/* ── Form styles → see form.css ─────────────────────────────────────────── */

/* ── Buttons ────────────────────────────────────────────────────────────── */
.admin-form-footer {
    margin-top: var(--space-l);
    padding-top: var(--space-m);
}

.admin-btn {
    padding: var(--space-2xs) var(--space-l);
    background: var(--accent-primary);
    color: var(--accent-foreground);
    border: none;
    border-radius: 3px;
    font-size: var(--step--1);
    font-family: inherit;
    cursor: pointer;
    letter-spacing: 0.04em;
    text-decoration: none;
    display: inline-block;
    transition: background 0.15s;
}

.admin-btn:hover {
    background: var(--accent-secondary);
}

.admin-btn-secondary {
    padding: var(--space-3xs) var(--space-m);
    background: transparent;
    color: var(--text-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 3px;
    font-size: var(--step--1);
    font-family: inherit;
    cursor: pointer;
    letter-spacing: 0.04em;
    text-decoration: none;
    display: inline-block;
    transition: all 0.15s;
}

.admin-btn-secondary:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

/* Small size modifier */
.admin-btn--sm {
    padding: var(--space-3xs) var(--space-2xs);
    font-size: var(--step--2);
}

/* Semantic colour modifiers */
.admin-btn--warning {
    background: var(--accent-yellow);
    color: var(--text-primary);
    border: none;
}
.admin-btn--warning:hover {
    filter: brightness(0.9);
}

.admin-btn--danger {
    background: var(--accent-red);
    color: var(--accent-foreground);
    border: none;
}
.admin-btn--danger:hover {
    filter: brightness(0.9);
}

/* ── Toast messages (top-right, CSS-only auto-fade) ─────────────────── */
#toast-region {
    position: fixed;
    top: var(--space-l);
    right: var(--space-l);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    pointer-events: none;
    max-width: min(480px, calc(100vw - 2 * var(--space-l)));
}

.toast {
    padding: var(--space-xs) var(--space-s);
    border-radius: 6px;
    font-size: var(--step--1);
    border-left: 3px solid;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    pointer-events: auto;
    backdrop-filter: blur(6px);
    /* enter then fade out — total visible ~4.35 s */
    animation: toast-enter 0.35s ease-out,
               toast-exit  0.4s  ease-in  4s forwards;
}

.toast--error {
    background: var(--accent-muted);
    border-color: var(--error);
    color: var(--text-primary);
}

.toast--success {
    background: var(--success-muted-bg);
    border-color: var(--success);
    color: var(--text-primary);
}

@keyframes toast-enter {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes toast-exit {
    from { opacity: 1; }
    to   { opacity: 0; pointer-events: none; }
}

/* ── Stats cards ────────────────────────────────────────────────────────── */
.admin-stats {
    display: flex;
    gap: var(--space-s);
    flex-wrap: wrap;
    margin: 0;
}

.admin-stat {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    padding: var(--space-2xs) var(--space-s);
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.admin-stat__number {
    font-size: var(--step-1);
    font-weight: 700;
    color: var(--accent-primary);
    line-height: 1;
    order: 1;
    margin: 0;
}

.admin-stat__label {
    font-size: var(--step--2);
    color: var(--text-secondary);
    margin-top: var(--space-3xs);
    order: 2;
}

/* ── Maintenance bar ────────────────────────────────────────────────────── */
.admin-maintenance-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-s);
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    padding: var(--space-2xs) var(--space-s);
    margin-bottom: var(--space-m);
    font-size: var(--step--1);
}

.admin-maintenance-bar--active {
    background: var(--warning-muted-bg);
    border-color: var(--warning);
    color: var(--text-primary);
}

.admin-maintenance-bar form {
    display: inline;
}

/* Result-count line above the thesis table */
.admin-list-meta {
    color: var(--text-secondary);
    font-size: var(--step--1);
    margin-bottom: var(--space-2xs);
}

/* Empty-state message below the thesis table */
.admin-empty {
    color: var(--text-secondary);
    padding: var(--space-s) 0;
}

/* Identifier column in the thesis table */
.admin-table-id {
    color: var(--text-secondary);
    font-size: var(--step--2);
}

/* ── Filters bar ────────────────────────────────────────────────────────── */
.admin-filters {
    display: flex;
    gap: var(--space-xs);
    margin-bottom: var(--space-m);
    flex-wrap: wrap;
    align-items: center;
}

.admin-filters input[type="text"],
.admin-filters select {
    border: 1px solid var(--border-primary);
    border-radius: 3px;
    font-size: var(--step--1);
    font-family: inherit;
    padding: var(--space-3xs) var(--space-xs);
    background: transparent;
    cursor: pointer;
}

.admin-filters input[type="text"]:focus,
.admin-filters select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.admin-filters-btn {
    padding: var(--space-3xs) var(--space-s);
    background: var(--accent-primary);
    color: var(--accent-foreground);
    border: none;
    border-radius: 3px;
    font-size: var(--step--1);
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
}

.admin-filters-btn:hover {
    background: var(--accent-secondary);
}

.admin-filters-reset {
    font-size: var(--step--1);
    color: var(--text-secondary);
    background: none;
    border: 1px solid var(--border-primary);
    border-radius: 3px;
    font-family: inherit;
    padding: var(--space-3xs) var(--space-xs);
    cursor: pointer;
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s;
}

.admin-filters-reset:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

/* ── Bulk actions bar ───────────────────────────────────────────────────── */
.admin-bulk-actions {
    display: none;
    align-items: center;
    gap: var(--space-s);
    padding: var(--space-2xs) var(--space-s);
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    margin-bottom: var(--space-s);
    font-size: var(--step--1);
}

.admin-bulk-btns {
    display: flex;
    gap: var(--space-2xs);
}

/* ── Table ──────────────────────────────────────────────────────────────── */
.admin-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--step--1);
}

.admin-body main > table {
    margin-top: var(--space-m);
}

.admin-body table th {
    text-align: left;
    font-size: var(--step--2);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: var(--space-3xs) var(--space-xs);
    border-bottom: 1px solid var(--border-primary);
    color: var(--text-secondary);
    font-weight: 400;
    white-space: nowrap;
}

/* Sortable column headers */
.admin-sort-link {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    transition: color 0.15s;
}

.admin-sort-link:hover {
    color: var(--accent-primary);
}

.admin-body table td {
    padding: var(--space-2xs) var(--space-xs);
    border-bottom: 1px solid var(--border-primary);
    vertical-align: top;
}

.admin-body table tr:hover td {
    background: var(--bg-secondary);
}

.admin-body table .thesis-title {
    font-weight: 500;
}

.admin-body table .thesis-subtitle {
    font-size: var(--step--1);
    color: var(--text-secondary);
    font-style: italic;
}

/* ── Status badges ──────────────────────────────────────────────────────── */
.status-badge {
    display: inline-block;
    padding: var(--space-3xs) var(--space-2xs);
    border-radius: 3px;
    font-size: var(--step--2);
    font-weight: 500;
    letter-spacing: 0.04em;
}

.status-published {
    background: var(--green-muted-bg);
    color: var(--accent-green);
}

.status-pending {
    background: var(--warning-muted-bg);
    color: var(--warning);
}

.status-access {
    display: inline-block;
    font-size: var(--step--2);
    padding: var(--space-3xs) var(--space-3xs);
    border-radius: 3px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    letter-spacing: 0.03em;
}

.status-access--libre {
    background: var(--green-muted-bg);
    color: var(--accent-green);
}

.status-access--interne {
    background: var(--blue-muted-bg);
    color: var(--accent-blue);
}

.status-access--interdit {
    background: var(--error-muted-bg);
    color: var(--error);
}

/* ── Action buttons in table ────────────────────────────────────────────── */
.admin-actions {
    display: flex;
    gap: var(--space-3xs);
    flex-wrap: wrap;
}

.admin-btn-sm {
    padding: var(--space-3xs) var(--space-2xs);
    min-height: 2rem;
    border-radius: 3px;
    font-size: var(--step--2);
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    border: 1px solid transparent;
    transition: all 0.15s;
    white-space: nowrap;
}

.admin-btn-view {
    background: var(--blue-muted-bg);
    color: var(--accent-blue);
    border-color: var(--blue-muted-border);
}
.admin-btn-view:hover {
    background: var(--blue-muted-bg-hover);
}

.admin-btn-visit {
    background: var(--success-muted-bg);
    color: var(--success);
    border-color: var(--success-muted-border);
}
.admin-btn-visit:hover {
    background: var(--green-muted-bg-hover);
}

.admin-btn-edit {
    background: var(--yellow-muted-bg);
    color: var(--accent-yellow);
    border-color: var(--yellow-muted-border);
}
.admin-btn-edit:hover {
    background: var(--yellow-muted-bg-hover);
}

.admin-btn-publish {
    background: var(--green-muted-bg);
    color: var(--accent-green);
    border-color: var(--green-muted-border);
}
.admin-btn-publish:hover {
    background: var(--green-muted-bg-hover);
}

.admin-btn-unpublish {
    background: var(--bg-secondary);
    color: var(--text-tertiary);
    border-color: var(--border-primary);
}
.admin-btn-unpublish:hover {
    background: var(--bg-tertiary);
}

.admin-btn-delete {
    background: var(--error-muted-bg);
    color: var(--error);
    border-color: var(--error-muted-border, var(--border-primary));
}
.admin-btn-delete:hover {
    filter: brightness(0.9);
}

.publish-form {
    display: inline;
    margin: 0;
}

/* ── Thesis info sections (thanks page) ─────────────────────────────────── */
.admin-body main > section:not([aria-labelledby^="settings-"]) {
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    padding: var(--space-m);
    margin-bottom: var(--space-m);
}

.admin-body main > section:not([aria-labelledby^="settings-"]) h2 {
    margin: 0 0 var(--space-s);
    font-size: var(--step-1);
    border-bottom: 1px solid var(--border-primary);
    padding-bottom: var(--space-2xs);
}

.admin-body main > section:not([aria-labelledby^="settings-"]) dl {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: var(--space-3xs) var(--space-s);
}

.admin-body main > section:not([aria-labelledby^="settings-"]) dt {
    font-weight: 600;
    font-size: var(--step--1);
    color: var(--text-secondary);
}

.admin-body main > section:not([aria-labelledby^="settings-"]) dd {
    margin: 0;
    font-size: var(--step--1);
}

/* ── Paramètres page top-level sections (flat, no border card) ──────────── */
.admin-body main > section[aria-labelledby^="settings-"] {
    border: none;
    border-radius: 0;
    padding: 0;
    margin-bottom: var(--space-xl);
}

.admin-body main > section[aria-labelledby^="settings-"] > h2 {
    font-size: var(--step-1);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin: 0 0 var(--space-m);
    padding-bottom: var(--space-2xs);
    border-bottom: 1px solid var(--border-primary);
}

.admin-action-bar {
    margin-top: var(--space-m);
    display: flex;
    gap: var(--space-xs);
    flex-wrap: wrap;
}

.admin-muted {
    color: var(--text-secondary);
}

/* ── Section titles (account, etc.) ─────────────────────────────────────── */
.admin-section-title {
    font-size: var(--step-0);
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin: var(--space-l) 0 var(--space-s);
    padding-bottom: var(--space-2xs);
    border-bottom: 1px solid var(--border-primary);
}

.admin-section-title--danger {
    color: var(--error);
    border-color: var(--error);
}

/* ── Account status block ───────────────────────────────────────────────── */
.admin-account-status {
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    padding: var(--space-s) var(--space-m);
    margin-bottom: var(--space-l);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.admin-account-status__row {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--step--1);
}

.admin-account-status__label {
    color: var(--text-secondary);
    min-width: 220px;
}

.admin-account-status__code {
    font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
    font-size: var(--step--2);
    border: 1px solid var(--border-primary);
    border-radius: 3px;
    padding: var(--space-3xs) var(--space-3xs);
    color: var(--text-secondary);
    background: var(--bg-secondary);
}

.admin-account-status__note {
    font-size: var(--step--1);
    color: var(--text-secondary);
    margin: 0;
}

/* ── Danger zone (account page) ─────────────────────────────────────────── */
.admin-danger-zone {
    border: 1px solid var(--danger-border-muted);
    border-radius: 4px;
    padding: var(--space-m) var(--space-m);
    display: flex;
    align-items: center;
    gap: var(--space-m);
    flex-wrap: wrap;
}

.admin-danger-zone__description {
    flex: 1;
    font-size: var(--step--1);
}

/* ── Login page ─────────────────────────────────────────────────────────── */
.admin-login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 60px);
}

.admin-login-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    padding: var(--space-l);
    width: 100%;
    max-width: 380px;
}

.admin-login-box h2 {
    margin: 0 0 var(--space-m);
    font-size: var(--step-0);
    font-weight: 500;
    text-align: center;
}

.admin-login-box .admin-form > div:not(.admin-form-footer) {
    grid-template-columns: 1fr;
    border: none;
    padding: var(--space-3xs) 0;
}

.admin-login-box .admin-form > div:not(.admin-form-footer) > label {
    font-size: var(--step--1);
    color: var(--text-secondary);
    margin-bottom: var(--space-3xs);
}

.admin-login-box .admin-form-footer {
    margin-top: var(--space-s);
    padding-top: var(--space-2xs);
}

.admin-login-box .admin-btn {
    width: 100%;
}

/* ════ Import status card (dialog) ═══════════════════════════════════════ */
.admin-import-status-card {
    margin: 0;
    padding: var(--space-m) var(--space-l);
}

.admin-import-status-card__success {
    background: var(--success-muted-bg);
    border: 1px solid var(--success);
    border-left: 3px solid var(--success);
    border-radius: 4px;
    padding: var(--space-xs) var(--space-s);
    font-size: var(--step--1);
    margin: 0;
}

.admin-import-status-card__errors {
    background: var(--accent-muted);
    border: 1px solid var(--error);
    border-left: 3px solid var(--error);
    border-radius: 4px;
    padding: var(--space-xs) var(--space-s);
    font-size: var(--step--1);
    margin-bottom: var(--space-s);
}

.admin-import-status-card__errors .admin-error-list {
    margin: var(--space-2xs) 0 0;
    padding-left: var(--space-s);
}

/* Import log details/summary */
.admin-import-log-details {
    margin: 0;
    padding: 0 var(--space-l) var(--space-m);
}

.admin-import-log-details summary {
    cursor: pointer;
    font-size: var(--step--1);
    font-weight: 600;
    color: var(--text-secondary);
    padding: var(--space-2xs) 0;
    border-top: 1px solid var(--border-primary);
}

.admin-import-log-details summary:hover {
    color: var(--text-primary);
}

/* Hint text under the file input */
.admin-file-hint {
    display: block;
    margin-top: var(--space-2xs);
}

/* Error list inside role="alert" */
.admin-error-list {
    margin: var(--space-2xs) 0 0;
    padding-left: var(--space-s);
}

/* Import results panel (legacy, kept for backward compat) */
.admin-import-results {
    margin-top: var(--space-l);
}

.admin-import-results__title {
    font-size: var(--step-0);
    font-weight: 600;
    margin-bottom: var(--space-xs);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border: none;
    padding: 0;
}

/* ── Jury fieldset → see form.css ───────────────────────────────────────── */

/* ── Inline form (tags page) ────────────────────────────────────────────── */
.admin-inline-form {
    display: flex;
    align-items: center;
    gap: var(--space-3xs);
    flex-wrap: wrap;
}

.admin-input--inline,
.admin-inline-form input[type="text"] {
    font-size: var(--step--1);
    width: 160px;
}

.admin-select--inline,
.admin-inline-form select {
    font-size: var(--step--1);
    width: 160px;
}

/* Stack secondary forms (merge, delete) below the rename form */
.admin-inline-form + .admin-inline-form {
    margin-top: var(--space-3xs);
}

/* Tags table column sizing */
.admin-body table:has(.admin-tags-count) th:nth-child(1) {
    width: 40%;
}
.admin-body table:has(.admin-tags-count) th:nth-child(2) {
    width: 12%;
}
.admin-body table:has(.admin-tags-count) th:nth-child(3) {
    width: 48%;
}
.admin-tags-count {
    text-align: center;
}

/* ── Banner preview ─────────────────────────────────────────────────────── */
.admin-banner-preview img {
    max-width: 320px;
    max-height: 100px;
    object-fit: cover;
    border: 1px solid var(--border-primary);
    border-radius: 3px;
    display: block;
    margin-top: var(--space-2xs);
}

/* ── List page toolbar (title + filters + stats + import, one row) ───────── */
.admin-list-toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-m);
    margin-bottom: var(--space-m);
    flex-wrap: wrap;
}

.admin-list-toolbar h1 {
    margin: 0;
    white-space: nowrap;
    flex-shrink: 0;
}

.admin-list-toolbar .admin-filters {
    flex: 1;
    margin-bottom: 0;
    flex-wrap: nowrap;
}

.admin-list-toolbar__right {
    display: flex;
    align-items: center;
    gap: var(--space-s);
    flex-shrink: 0;
}

/* ── Dialog ───────────────────────────────────────────────────────────── */
.admin-dialog {
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 0;
    max-width: 680px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

.admin-dialog::backdrop {
    background: rgba(0,0,0,0.45);
}

.admin-dialog__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-m) var(--space-l);
    border-bottom: 1px solid var(--border-primary);
}

.admin-dialog__header h2 {
    font-size: var(--step-0);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin: 0;
    color: var(--text-secondary);
}

.admin-dialog__close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: var(--step-0);
    color: var(--text-tertiary);
    padding: var(--space-3xs);
    line-height: 1;
    border-radius: 3px;
    transition: color 0.15s;
}

.admin-dialog__close:hover {
    color: var(--text-primary);
}

.admin-dialog .admin-form,
.admin-dialog .admin-import-results,
.admin-dialog .toast,
.admin-dialog__alert {
    margin: 0;
    padding: var(--space-m) var(--space-l);
}

.admin-dialog .admin-form {
    padding-top: var(--space-m);
    padding-bottom: 0;
}

.admin-dialog .admin-form-footer {
    display: flex;
    gap: var(--space-xs);
    padding-bottom: var(--space-m);
}

/* ── Import results log ─────────────────────────────────────────────── */
.admin-import-log {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-3xs);
    max-height: 260px;
    overflow-y: auto;
    font-size: var(--step--2);
    font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
    border: 1px solid var(--border-primary);
    border-radius: 3px;
    padding: var(--space-xs);
    background: var(--bg-secondary);
}

.admin-import-log__item::before {
    margin-right: var(--space-3xs);
}

.admin-import-log__item--ok::before    { content: '✓'; color: var(--accent-green); }
.admin-import-log__item--skip::before  { content: '⚠'; color: var(--warning); }
.admin-import-log__item--error::before { content: '✗'; color: var(--error); }

/* ── Paramètres page (flat, semantic) ──────────────────────────────────── */
.param-maintenance-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-s);
    padding: var(--space-xs) var(--space-m);
    margin-bottom: var(--space-m);
    font-size: var(--step--1);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    background: var(--bg-secondary);
}

.param-maintenance-row:has( .param-btn-warning ) {
    background: var(--warning-muted-bg);
    border-color: var(--warning);
}

.param-maintenance-row p {
    margin: 0;
}

.param-maintenance-row form {
    flex-shrink: 0;
}

.param-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-m);
}

.param-form fieldset {
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    padding: var(--space-m);
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.param-form legend {
    font-weight: 600;
    font-size: var(--step--1);
    color: var(--text-secondary);
    padding: 0 var(--space-xs);
}

.param-checkbox {
    display: flex;
    align-items: flex-start;
    gap: var(--space-xs);
    font-size: var(--step--1);
    cursor: pointer;
}

.param-checkbox--disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.param-checkbox input[type="checkbox"] {
    accent-color: var(--accent-primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
}

.param-checkbox--disabled input[type="checkbox"] {
    cursor: not-allowed;
}

.param-checkbox small {
    color: var(--text-secondary);
    font-size: var(--step--2);
}

.param-note {
    font-size: var(--step--1);
    color: var(--text-secondary);
    margin: 0;
}

.param-account-status {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    font-size: var(--step--1);
    margin-bottom: var(--space-m);
}

.param-account-status > div {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.param-account-status dt {
    color: var(--text-secondary);
    min-width: 200px;
}

.param-account-status dd {
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.param-account-status code {
    font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
    font-size: var(--step--2);
    border: 1px solid var(--border-primary);
    border-radius: 3px;
    padding: var(--space-3xs);
    color: var(--text-secondary);
    background: var(--bg-secondary);
}

.param-form > div {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-3xs);
    border-top: 1px solid var(--border-primary);
    padding: var(--space-xs) 0;
}

.param-form > div:first-of-type {
    border-top: none;
    padding-top: 0;
}

.param-form input[type="password"] {
    width: 100%;
    max-width: 380px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-primary);
    font-size: var(--step--1);
    font-family: inherit;
    padding: var(--space-3xs) 0;
    border-radius: 0;
    transition: border-color 0.15s;
}

.param-form input[type="password"]:focus {
    outline: none;
    border-bottom-color: var(--accent-primary);
}

.param-form > button {
    align-self: flex-start;
    padding: var(--space-2xs) var(--space-l);
    background: var(--accent-primary);
    color: var(--accent-foreground);
    border: none;
    border-radius: 3px;
    font-size: var(--step--1);
    font-family: inherit;
    cursor: pointer;
    letter-spacing: 0.04em;
    transition: background 0.15s;
}

.param-form > button:hover {
    background: var(--accent-secondary);
}

.param-btn-warning {
    padding: var(--space-3xs) var(--space-s);
    background: var(--accent-yellow);
    color: var(--text-primary);
    border: none;
    border-radius: 3px;
    font-size: var(--step--1);
    font-family: inherit;
    cursor: pointer;
    transition: filter 0.15s;
}

.param-btn-warning:hover {
    filter: brightness(0.9);
}

.param-btn-danger {
    padding: var(--space-3xs) var(--space-s);
    background: var(--accent-red);
    color: var(--accent-foreground);
    border: none;
    border-radius: 3px;
    font-size: var(--step--1);
    font-family: inherit;
    cursor: pointer;
    transition: filter 0.15s;
}

.param-btn-danger:hover {
    filter: brightness(0.9);
}

.param-danger-zone {
    border: 1px solid var(--danger-border-muted);
    border-radius: 4px;
    padding: var(--space-m);
    margin-bottom: var(--space-m);
    background: var(--bg-secondary);
}

.param-danger-zone legend {
    width: auto;
    font-weight: 600;
    color: var(--error);
    font-size: var(--step-0);
    padding: 0 var(--space-xs);
}

.param-danger-zone p {
    font-size: var(--step--1);
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}

.param-danger-zone form {
    margin-top: var(--space-xs);
}

/* ── Export zone (maintenance section) ───────────────────────────────── */
.param-export-zone {
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    padding: var(--space-m);
    margin-bottom: var(--space-m);
    background: var(--bg-secondary);
}

.param-export-zone legend {
    width: auto;
    font-weight: 600;
    font-size: var(--step-0);
    padding: 0 var(--space-xs);
}

.param-export-zone p {
    font-size: var(--step--1);
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}

.param-btn-export {
    padding: var(--space-3xs) var(--space-s);
    background: var(--primary, #2563eb);
    color: var(--accent-foreground, #fff);
    border: none;
    border-radius: 3px;
    font-size: var(--step--1);
    font-family: inherit;
    cursor: pointer;
    transition: filter 0.15s;
}

.param-btn-export:hover {
    filter: brightness(0.9);
}


/* ── SMTP section ─────────────────────────────────────────────────────── */
.param-smtp-test {
    margin-top: var(--space-m);
}
.param-smtp-test-form {
    margin-top: var(--space-s);
}
.param-smtp-test-row {
    display: flex;
    align-items: flex-end;
    gap: var(--space-s);
    flex-wrap: wrap;
}
.param-smtp-test-row > div {
    flex: 1 1 260px;
}
.param-smtp-test-row label {
    display: block;
    font-size: var(--step--1);
    font-weight: 600;
    margin-bottom: var(--space-2xs);
    color: var(--text-secondary);
}
.param-smtp-test-row input[type="email"] {
    width: 100%;
    padding: var(--space-xs) var(--space-s);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: var(--step--1);
    box-sizing: border-box;
}
.param-smtp-test-row input[type="email"]:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 1px;
}
.param-smtp-test-row > button {
    white-space: nowrap;
    flex-shrink: 0;
}

.param-smtp-status {
    display: flex;
    align-items: center;
    gap: var(--space-s);
    font-size: var(--step--1);
    margin: var(--space-xs) 0 var(--space-s);
    color: var(--text-secondary);
}
.param-badge-ok {
    color: var(--accent-green);
    font-weight: 600;
}
.param-badge-warn {
    color: var(--warning);
    font-weight: 600;
}
.param-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-s);
}
.param-grid label {
    display: flex;
    flex-direction: column;
    gap: var(--space-3xs);
    font-size: var(--step--1);
    color: var(--text-secondary);
}
.param-grid input[type="text"],
.param-grid input[type="number"],
.param-grid input[type="email"],
.param-grid select {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-primary);
    font-size: var(--step--1);
    font-family: inherit;
    padding: var(--space-3xs) 0;
    border-radius: 0;
    transition: border-color 0.15s;
}
.param-grid input:focus,
.param-grid select:focus {
    outline: none;
    border-bottom-color: var(--accent-primary);
}
.param-grid select {
    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'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0 center;
    padding-right: 1.2rem;
    -webkit-appearance: none;
    appearance: none;
}
.param-fieldset-inline {
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    padding: var(--space-m);
    background: var(--bg-secondary);
}
.param-fieldset-inline legend {
    font-weight: 600;
    font-size: var(--step--1);
    color: var(--text-secondary);
    padding: 0 var(--space-xs);
}

/* ── Settings page sections — legacy aliases (kept for any remaining use) ─ */
.admin-settings-section {
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    padding: var(--space-m) var(--space-l);
    margin-bottom: var(--space-l);
}

.admin-settings-section__title {
    font-size: var(--step-0);
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin: 0 0 var(--space-m);
    padding-bottom: var(--space-2xs);
    border-bottom: 1px solid var(--border-primary);
}

.admin-maintenance-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-s);
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    padding: var(--space-xs) var(--space-m);
    font-size: var(--step--1);
}

.admin-maintenance-status--active {
    background: var(--warning-muted-bg);
    border-color: var(--warning);
}

.admin-maintenance-status__msg {
    margin: 0;
}

.admin-maintenance-status form {
    display: inline;
    flex-shrink: 0;
}

.admin-account-status {
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    padding: var(--space-s) var(--space-m);
    margin-bottom: var(--space-l);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.admin-account-status__row {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--step--1);
}

.admin-account-status__label {
    color: var(--text-secondary);
    min-width: 220px;
}

.admin-account-status__code {
    font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
    font-size: var(--step--2);
    border: 1px solid var(--border-primary);
    border-radius: 3px;
    padding: var(--space-3xs) var(--space-3xs);
    color: var(--text-secondary);
    background: var(--bg-secondary);
}

.admin-account-status__note {
    font-size: var(--step--1);
    color: var(--text-secondary);
    margin: 0;
}

.admin-danger-zone {
    border: 1px solid var(--danger-border-muted);
    border-radius: 4px;
    padding: var(--space-m) var(--space-m);
    display: flex;
    align-items: center;
    gap: var(--space-m);
    flex-wrap: wrap;
}

.admin-danger-zone__description {
    flex: 1;
    font-size: var(--step--1);
}

.admin-settings-toggles {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin-bottom: var(--space-m);
}

.admin-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-m);
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    padding: var(--space-xs) var(--space-m);
    cursor: pointer;
}

.admin-toggle-row--disabled {
    opacity: 0.6;
}

.admin-toggle-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.admin-toggle-label strong {
    font-size: var(--step-0);
}

.admin-toggle-label small {
    color: var(--text-secondary);
    font-size: var(--step--2);
}

.admin-toggle {
    appearance: none;
    -webkit-appearance: none;
    width: 40px;
    height: 22px;
    background: var(--border-primary);
    border-radius: 11px;
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
}

.admin-toggle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
}

.admin-toggle:checked {
    background: var(--accent-primary);
}

.admin-toggle:checked::after {
    transform: translateX(18px);
}

/* ── Cancel link ────────────────────────────────────────────────────────── */
.admin-cancel-link {
    font-size: var(--step--1);
    color: var(--text-secondary);
    text-decoration: underline;
}

/* ── Pagination (admin list) ─────────────────────────────────────────────── */
.admin-body .pagination-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-2xs);
    padding: var(--space-m) 0 var(--space-2xs);
}

.admin-body .pagination-wrap ul {
    display: flex;
    gap: var(--space-3xs);
    list-style: none;
    margin: 0;
    padding: 0;
}

.admin-body .pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.75rem;
    min-height: 2.75rem;
    padding: 0 var(--space-2xs);
    border: 1px solid var(--border-secondary);
    border-radius: 3px;
    color: var(--text-primary);
    font-size: var(--step--1);
    text-decoration: none;
    transition:
        border-color 0.15s,
        color 0.15s;
}

.admin-body .pagination-btn:hover:not(.disabled) {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.admin-body .pagination-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.admin-body .pagination-info {
    font-size: var(--step--1);
    color: var(--text-secondary);
    padding: 0 var(--space-2xs);
}

.admin-body #editor {
    height: 50vh;
    border: 1px solid var(--border-primary);
}

/* ── Settings: formulaire toggles ──────────────────────────────────────────── */
.admin-settings-toggles {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin-bottom: var(--space-m);
}

.admin-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-m);
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    padding: var(--space-xs) var(--space-m);
    cursor: pointer;
}

.admin-toggle-row--disabled {
    opacity: 0.6;
}

.admin-toggle-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.admin-toggle-label strong {
    font-size: var(--step-0);
}

.admin-toggle-label small {
    color: var(--text-secondary);
    font-size: var(--step--2);
}

/* Native checkbox styled as toggle pill */
.admin-toggle {
    appearance: none;
    -webkit-appearance: none;
    width: 40px;
    height: 22px;
    background: var(--border-primary);
    border-radius: 11px;
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
}

.admin-toggle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
}

.admin-toggle:checked {
    background: var(--accent-primary);
}

.admin-toggle:checked::after {
    transform: translateX(18px);
}


/* ── Form group, student mode, thanks page → see form.css ───────────────── */
