/* ═══════════════════════════════════════════════════════════════════════════
   HemiolePro — app.css
   Importe les tokens, les Google Fonts, et le reset minimal.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400;12..96,500;12..96,600;12..96,700&family=Manrope:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── Tokens ── */
@import url('./css/tokens.css');

/* ── Reset minimal ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: var(--text-md);
    line-height: 1.6;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--ink);
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img, svg {
    display: block;
    max-width: 100%;
}

button {
    cursor: pointer;
    font-family: var(--font-body);
}

/* ── Blazor error UI ── */
#blazor-error-ui {
    background: var(--danger-soft);
    border: 1px solid var(--danger-border);
    border-radius: var(--radius-md);
    color: var(--danger);
    padding: var(--space-3) var(--space-4);
    display: none;
    position: fixed;
    bottom: var(--space-4);
    right: var(--space-4);
    z-index: 1000;
    font-size: var(--text-sm);
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    margin-left: var(--space-3);
    font-style: normal;
}

/* ── Validation form ── */
.valid.modified:not([type=checkbox]) {
    outline: 2px solid var(--success);
    outline-offset: 1px;
}

.invalid {
    outline: 2px solid var(--danger);
    outline-offset: 1px;
}

.validation-message {
    color: var(--danger);
    font-size: var(--text-xs);
    margin-top: var(--space-1);
}

/* ── Blazor error boundary ── */
.blazor-error-boundary {
    background: var(--danger-soft);
    border: 1px solid var(--danger-border);
    border-radius: var(--radius-md);
    color: var(--danger);
    padding: var(--space-4);
}

.blazor-error-boundary::after {
    content: "Une erreur est survenue.";
}

/* ═══════════════════════════════════════════════════════════════════════════
   Auth — styles globaux (Login, Register, Onboarding)
   NE PAS mettre dans AuthLayout.razor.css : le CSS scopé ne descend pas
   dans les composants enfants en Blazor Server.
   ═══════════════════════════════════════════════════════════════════════════ */

.auth-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Split-screen container ── */
.auth-split {
    flex: 1;
    display: flex;
    min-height: 100vh;
}

/* ── Left panel (gradient, decorative) ── */
.auth-split__left {
    width: 46%;
    position: relative;
    overflow: hidden;
    background: linear-gradient(140deg, var(--accent) 0%, var(--exercice) 100%);
    color: #fff;
    padding: 40px 44px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-shrink: 0;
}

/* ── Decorative music score overlay ── */
.auth-split__score {
    position: absolute;
    inset: 0;
    opacity: 0.14;
    pointer-events: none;
}

.auth-split__score-row {
    position: absolute;
    left: -20px;
    right: -20px;
    height: 60px;
}

.auth-split__score-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: #fff;
}

.auth-split__score-note {
    position: absolute;
    width: 16px;
    height: 12px;
    border-radius: 12px;
    background: #fff;
    transform: rotate(-14deg);
}

/* ── Left panel content zones ── */
.auth-split__left-logo {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.auth-split__left-logo-brand {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #fff;
}

.auth-split__left-body {
    position: relative;
    z-index: 1;
}

.auth-split__left-kicker {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.85;
    margin-bottom: 14px;
}

.auth-split__left-headline {
    font-family: var(--font-display);
    font-size: 42px;
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.05;
    color: #fff;
}

.auth-split__left-headline span {
    opacity: 0.78;
}

.auth-split__left-desc {
    margin-top: 18px;
    font-size: 14.5px;
    line-height: 1.6;
    max-width: 380px;
    opacity: 0.92;
}

.auth-split__badges {
    display: flex;
    gap: 10px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.auth-split__badge {
    padding: 5px 11px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.16);
    font-size: 12px;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.24);
    backdrop-filter: blur(4px);
    color: #fff;
}

.auth-split__left-footer {
    position: relative;
    z-index: 1;
    font-size: 12px;
    opacity: 0.8;
    display: flex;
    gap: 18px;
}

.auth-split__left-footer a {
    color: #fff;
    text-decoration: none;
}

.auth-split__left-footer a:hover {
    text-decoration: underline;
}

/* ── Right form panel ── */
.auth-split__right {
    flex: 1;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 48px;
    overflow: auto;
}

.auth-split__form-wrap {
    width: 100%;
    max-width: 400px;
}

/* ── Card centrale (legacy — kept for Onboarding compatibility) ── */
.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-10) var(--space-8);
    box-shadow: var(--shadow-screen);
}

/* ── Logo ── */
.auth-card__logo {
    display: flex;
    align-items: center;
    gap: var(--space-2-5);
    margin-bottom: var(--space-8);
}

.auth-card__brand {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.auth-card__brand-accent {
    color: var(--accent);
}

/* ── Titres ── */
.auth-card__title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin-bottom: var(--space-1-5);
}

.auth-card__subtitle {
    font-size: var(--text-sm);
    color: var(--ink-muted);
    margin-bottom: var(--space-6);
    line-height: 1.6;
}

/* ── Alerte erreur ── */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2-5);
    padding: var(--space-3) var(--space-4);
    background: var(--danger-soft);
    border: 1px solid var(--danger-border);
    border-radius: var(--radius-md);
    color: var(--danger);
    font-size: var(--text-sm);
    margin-bottom: var(--space-5);
    line-height: 1.5;
}

/* ── Formulaire ── */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-1-5);
}

.auth-label {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--ink-subtle);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.auth-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.auth-forgot {
    font-size: var(--text-xs);
    color: var(--accent);
    font-weight: 500;
}

.auth-input {
    all: unset;
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 11px var(--space-3);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    color: var(--ink);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    min-height: 44px;
}

.auth-input::placeholder {
    color: var(--ink-subtle);
}

.auth-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    outline: none;
}

.auth-validation {
    font-size: var(--text-xs);
    color: var(--danger);
    margin-top: var(--space-1);
}

/* ── Boutons ── */
.auth-btn-primary {
    all: unset;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    width: 100%;
    box-sizing: border-box;
    padding: 12px var(--space-4);
    background: var(--accent);
    color: #fff;
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    min-height: 44px;
    transition: opacity var(--transition-fast);
    margin-top: var(--space-2);
}

.auth-btn-primary:hover {
    opacity: 0.92;
}

.auth-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-btn-ghost {
    all: unset;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    width: 100%;
    box-sizing: border-box;
    padding: 10px var(--space-4);
    background: var(--surface-alt);
    color: var(--ink);
    border: 1px solid var(--border);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    min-height: 44px;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.auth-btn-ghost:hover {
    border-color: var(--border-strong);
    background: var(--surface);
}

/* ── Spinner bouton ── */
.auth-btn-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: auth-spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes auth-spin {
    to { transform: rotate(360deg); }
}

/* ── Séparateur ── */
.auth-separator {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    color: var(--ink-subtle);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin: var(--space-2) 0;
}

.auth-separator::before,
.auth-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ── Footer ── */
.auth-footer-text {
    text-align: center;
    font-size: var(--text-sm);
    color: var(--ink-muted);
    margin-top: var(--space-5);
}

.auth-link {
    color: var(--accent);
    font-weight: 600;
}

/* ── Page wrapper (inside right panel) ── */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

/* ── Auth form inner layout ── */
.auth-form-inner {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* ── Auth kicker (uppercase label above h1) ── */
.auth-kicker {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--ink-subtle);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* ── Auth heading block ── */
.auth-heading {
    margin-bottom: var(--space-2);
}

.auth-heading h1 {
    font-family: var(--font-display);
    font-size: 34px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--ink);
    margin: 6px 0 0;
}

.auth-heading p {
    margin: 10px 0 0;
    font-size: 13.5px;
    color: var(--ink-muted);
    line-height: 1.55;
}

/* ── Google OAuth button ── */
.auth-btn-google {
    all: unset;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
    padding: 12px var(--space-4);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--ink);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
    min-height: 44px;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.auth-btn-google:hover {
    border-color: var(--border-strong);
    background: var(--surface-alt);
}

/* ── Divider "ou avec votre e-mail" ── */
.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    color: var(--ink-subtle);
    font-size: 11.5px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ── Checkbox row ── */
.auth-check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--ink-muted);
    cursor: pointer;
    user-select: none;
}

.auth-check-box {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1.5px solid var(--border-strong);
    background: var(--surface-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}

.auth-check-box--checked {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ── Name row (2-col grid) ── */
.auth-name-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ── Responsive: hide left panel on small screens ── */
@media (max-width: 767px) {
    .auth-split__left {
        display: none;
    }

    .auth-split__right {
        padding: 32px 24px;
    }

    .auth-split {
        min-height: 100vh;
    }
}

/* ── Onboarding : cards choix de profil ── */
.auth-profile-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
    margin: var(--space-5) 0;
}

.auth-profile-card {
    all: unset;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-5) var(--space-4);
    background: var(--surface-alt);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
    min-height: 100px;
    text-align: left;
}

.auth-profile-card:hover {
    border-color: var(--accent-border);
    background: var(--accent-soft);
}

.auth-profile-card--selected {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.auth-profile-card__icon {
    color: var(--accent);
}

.auth-profile-card__title {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--ink);
}

.auth-profile-card__desc {
    font-size: var(--text-xs);
    color: var(--ink-muted);
    line-height: 1.4;
}

/* ── Progress steps ── */
.auth-steps {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-8);
}

.auth-step {
    flex: 1;
    height: 3px;
    border-radius: var(--radius-pill);
    background: var(--border);
    transition: background var(--transition);
}

.auth-step--active {
    background: var(--accent);
}

/* ── Routes : spinner "Vérification en cours" ── */
.routes-authorizing {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    background: var(--bg);
}

.routes-authorizing__spinner {
    width: 32px;
    height: 32px;
    border: 2.5px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: routes-spin 0.7s linear infinite;
}

.routes-authorizing__label {
    font-family: var(--font-body);
    font-size: var(--text-sm);
    color: var(--ink-muted);
}

@keyframes routes-spin {
    to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Utilitaires globaux — hp-field, hp-btn, hp-select
   Placés ici (non scopés) car utilisés dans des composants enfants Blazor
   (InputText, InputDate, InputSelect) qui ne reçoivent pas l'attribut scope
   du parent → le CSS scopé .razor.css ne les atteint pas.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Champ de formulaire ── */
.hp-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-1-5);
}

.hp-field--full {
    grid-column: 1 / -1;
}

.hp-field--checkbox {
    flex-direction: row;
    align-items: center;
    gap: var(--space-2-5);
    grid-column: 1 / -1;
}

.hp-field--checkbox label {
    font-size: var(--text-sm);
    color: var(--ink);
    cursor: pointer;
}

.hp-field__label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--ink);
}

.hp-field__required {
    color: var(--danger);
    margin-left: var(--space-1);
}

.hp-field__input {
    width: 100%;
    padding: 0 var(--space-3);
    height: 44px;
    min-height: 44px;
    background: var(--surface-alt);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    color: var(--ink);
    transition: border-color var(--transition), box-shadow var(--transition);
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.hp-field__input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.hp-field__input--textarea {
    height: auto;
    min-height: 88px;
    padding: var(--space-2-5) var(--space-3);
    resize: vertical;
}

.hp-field__input--select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238E89A6' stroke-width='1.6' 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 var(--space-3) center;
    padding-right: var(--space-8);
}

.hp-field__error {
    display: block;
    font-size: var(--text-xs);
    color: var(--danger);
}

/* ── sr-only ── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ── Page layout (pages admin) ── */
.page {
    padding: var(--space-8) var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.page__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-6);
    flex-wrap: wrap;
}

.page__header-left {
    display: flex;
    flex-direction: column;
    gap: var(--space-1-5);
}

.page__header-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding-top: var(--space-1);
}

.page__kicker {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.page__title {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--ink);
    line-height: 1.1;
}

.page__subtitle {
    font-size: var(--text-sm);
    color: var(--ink-muted);
    line-height: 1.6;
    max-width: 560px;
}

/* ── Page loading / empty ── */
.page-loading {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-10) 0;
    color: var(--ink-muted);
    font-size: var(--text-sm);
}

.page-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: page-spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes page-spin { to { transform: rotate(360deg); } }

.page-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-16) 0;
    text-align: center;
    color: var(--ink-muted);
    font-size: var(--text-sm);
}

.page-empty svg { opacity: 0.35; }

/* ── hp-field suppléments ── */
.hp-field__hint {
    font-size: var(--text-xs);
    color: var(--ink-muted);
    line-height: 1.4;
}

/* ── hp-card ── */
.hp-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.hp-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border);
}

.hp-card__title {
    font-family: var(--font-display);
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.hp-card__body {
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

/* ── hp-table ── */
.hp-table-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow-x: auto;
}

.hp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
    color: var(--ink);
}

.hp-table thead { background: var(--surface-alt); }

.hp-table th {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--ink-subtle);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

.hp-table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    line-height: 1.5;
}

.hp-table tbody tr:last-child td { border-bottom: none; }

.hp-table tbody tr:hover {
    background: var(--surface-alt);
    transition: background var(--transition-fast);
}

.hp-table__col-center { text-align: center; }
.hp-table__col-right  { text-align: right; }
.hp-table__col-num    { text-align: right; font-family: var(--font-mono); font-size: var(--text-xs); }
.hp-table__col-actions { text-align: right; white-space: nowrap; width: 1%; }
.hp-table__row--inactive { opacity: 0.5; }
.hp-table__row--depassement { background: var(--danger-soft); }
.hp-table__mono { font-family: var(--font-mono); }

/* ── hp-drawer__form (EditForm dans un drawer) ── */
.hp-drawer__form {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

/* ── Boutons globaux ── */
.hp-btn {
    all: unset;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: var(--text-sm);
    padding: 0 var(--space-4);
    height: 44px;
    min-height: 44px;
    border-radius: var(--radius-md);
    transition: opacity var(--transition), background var(--transition), border-color var(--transition);
    white-space: nowrap;
    box-sizing: border-box;
}

.hp-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.hp-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.hp-btn--primary {
    background: var(--accent);
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.hp-btn--primary:hover:not(:disabled) {
    opacity: 0.88;
}

.hp-btn--ghost {
    background: var(--surface-alt);
    color: var(--ink);
    border: 1px solid var(--border);
}

.hp-btn--ghost:hover:not(:disabled) {
    background: var(--border);
}

.hp-btn--secondary {
    background: var(--surface-alt);
    color: var(--accent);
    border: 1px solid var(--accent-border);
}

.hp-btn--secondary:hover:not(:disabled) {
    background: var(--accent-soft);
}

.hp-btn--danger {
    background: var(--danger);
    color: #fff;
}

.hp-btn--danger:hover:not(:disabled) {
    opacity: 0.88;
}

.hp-btn--ghost.hp-btn--danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger-border);
}

.hp-btn--ghost.hp-btn--danger:hover:not(:disabled) {
    background: var(--danger-soft);
}

.hp-btn--sm {
    min-height: 44px;
    font-size: var(--text-xs);
    padding: 0 var(--space-3);
}

.hp-btn--icon {
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    flex-shrink: 0;
}

.hp-btn__spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: hp-btn-spin 600ms linear infinite;
    flex-shrink: 0;
}

@keyframes hp-btn-spin {
    to { transform: rotate(360deg); }
}

/* ── Variantes hp-field supplémentaires ── */
.hp-field--inline {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.hp-field-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: var(--space-4);
    align-items: start;
}

.hp-field__input--short {
    width: 120px;
    min-width: unset;
    box-sizing: border-box;
}

.hp-field__input--mono {
    font-family: var(--font-mono);
}

/* ── Alertes inline hp-alert ── */
.hp-alert {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2-5);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    line-height: 1.5;
    border: 1px solid transparent;
}

.hp-alert--error {
    background: var(--danger-soft);
    border-color: var(--danger-border);
    color: var(--danger);
}

.hp-alert--info {
    background: var(--notion-soft);
    border-color: var(--notion-border);
    color: var(--notion);
}

.hp-alert--success {
    background: var(--success-soft);
    border-color: var(--success-border);
    color: var(--success);
}

/* ── Toasts inline ── */
.hp-toast {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2-5) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
}

.hp-toast--success {
    background: var(--success-soft);
    color: var(--success);
    border: 1px solid var(--success-border);
}

.hp-toast--error {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid var(--danger-border);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Drawer — hp-drawer (panneau latéral slide-in depuis la droite)
   Convention : overlay + aside.hp-drawer imbriqués dans le même @if
   ═══════════════════════════════════════════════════════════════════════════ */

@keyframes hp-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes hp-drawer-slide-in {
    from { transform: translateX(100%); opacity: 0.6; }
    to   { transform: translateX(0);    opacity: 1; }
}

/* ── Overlay ── */
.hp-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 6, 28, 0.45);
    z-index: 400;
    animation: hp-fade-in var(--transition-slow) ease;
}

[data-theme="dark"] .hp-drawer-overlay {
    background: rgba(0, 0, 0, 0.65);
}

/* ── Panneau ── */
.hp-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 420px;
    max-width: 100vw;
    background: var(--surface);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-modal);
    z-index: 401;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: hp-drawer-slide-in var(--transition-slow) ease;
}

@media (max-width: 480px) {
    .hp-drawer {
        width: 100%;
    }
}

/* ── Header ── */
.hp-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.hp-drawer__title {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

/* ── Bouton fermer (cible 44×44 min) ── */
.hp-drawer__close {
    all: unset;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: var(--radius-md);
    color: var(--ink-muted);
    transition: background var(--transition-fast), color var(--transition-fast);
    flex-shrink: 0;
}

.hp-drawer__close:hover {
    background: var(--surface-alt);
    color: var(--ink);
}

.hp-drawer__close:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ── Body scrollable ── */
.hp-drawer__body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

/* ── Footer avec actions ── */
.hp-drawer__footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Modale — hp-modal (boîte de dialogue centrée avec overlay)
   Convention : overlay contient la modale OU overlay + div séparés
   ═══════════════════════════════════════════════════════════════════════════ */

@keyframes hp-modal-pop {
    from { opacity: 0; transform: translate(-50%, calc(-50% - 8px)); }
    to   { opacity: 1; transform: translate(-50%, -50%); }
}

/* ── Overlay modale ── */
.hp-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 6, 28, 0.45);
    z-index: 400;
    animation: hp-fade-in var(--transition-slow) ease;
}

[data-theme="dark"] .hp-modal-overlay {
    background: rgba(0, 0, 0, 0.65);
}

/* ── Boîte centrée ── */
.hp-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: calc(100% - var(--space-8));
    max-width: 480px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-modal);
    z-index: 401;
    display: flex;
    flex-direction: column;
    animation: hp-modal-pop var(--transition-slow) ease;
}

/* ── Header ── */
.hp-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.hp-modal__title {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.02em;
}

/* ── Body ── */
.hp-modal__body {
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.hp-modal__desc {
    font-size: var(--text-sm);
    color: var(--ink-muted);
    line-height: 1.6;
}

/* ── Footer ── */
.hp-modal__footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

/* ── Variantes de taille ── */
.hp-modal--sm {
    max-width: 400px;
}
