/* Éléments d'interface partagés par le portail, le Manager et l'espace client. */
.password-visibility-field {
    position: relative;
    display: block;
    width: 100%;
}

.password-visibility-field > input {
    width: 100%;
    padding-right: 48px !important;
}

.password-visibility-toggle {
    position: absolute;
    z-index: 2;
    top: 50%;
    right: 8px;
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    transform: translateY(-50%);
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #607089;
    cursor: pointer;
}

.password-visibility-toggle:hover,
.password-visibility-toggle:focus-visible {
    background: #e8f4fc;
    color: #0369a1;
    outline: none;
}

.password-visibility-toggle svg {
    width: 21px;
    height: 21px;
    pointer-events: none;
}

/* Une action destructive ou une sortie de session doit être identifiable immédiatement. */
.logout-button,
.danger-button,
.button.danger,
button[data-action="delete"] {
    border-color: #fecaca !important;
    background: #fef2f2 !important;
    color: #b91c1c !important;
}

.logout-button:hover,
.logout-button:focus-visible,
.danger-button:hover,
.danger-button:focus-visible,
.button.danger:hover,
.button.danger:focus-visible,
button[data-action="delete"]:hover,
button[data-action="delete"]:focus-visible {
    border-color: #ef4444 !important;
    background: #fee2e2 !important;
    color: #991b1b !important;
}

/* Alertes partagées : une hiérarchie courte, lisible et cohérente sur les trois espaces. */
.app-alert {
    --alert-accent: #0284c7;
    --alert-border: #bae6fd;
    --alert-surface: #eff9ff;
    --alert-text: #164e63;
    position: relative;
    min-height: 68px;
    padding: 14px 18px 14px 58px !important;
    border: 1px solid var(--alert-border) !important;
    border-left: 4px solid var(--alert-accent) !important;
    border-radius: 12px !important;
    background: var(--alert-surface) !important;
    color: var(--alert-text) !important;
    box-shadow: 0 10px 28px rgba(3, 105, 161, .08) !important;
    font-size: 13px !important;
    font-weight: 520 !important;
    line-height: 1.55 !important;
    text-align: left !important;
}

.app-alert::before {
    content: attr(data-alert-title);
    display: block;
    margin-bottom: 2px;
    color: var(--alert-text);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.35;
}

.app-alert::after {
    content: "i";
    position: absolute;
    top: 50%;
    left: 16px;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    transform: translateY(-50%);
    border-radius: 9px;
    background: var(--alert-accent);
    color: #fff;
    box-shadow: 0 6px 16px color-mix(in srgb, var(--alert-accent) 22%, transparent);
    font-size: 15px;
    font-weight: 850;
    line-height: 1;
}

.app-alert[data-alert-tone="success"] {
    --alert-accent: #0f9f72;
    --alert-border: #a7e6cf;
    --alert-surface: #effbf6;
    --alert-text: #12634d;
}

.app-alert[data-alert-tone="success"]::after { content: "✓"; }

.app-alert[data-alert-tone="warning"] {
    --alert-accent: #e69318;
    --alert-border: #f5d28f;
    --alert-surface: #fff9eb;
    --alert-text: #854d0e;
}

.app-alert[data-alert-tone="warning"]::after { content: "!"; }

.app-alert[data-alert-tone="error"] {
    --alert-accent: #dc4c64;
    --alert-border: #f4bdc7;
    --alert-surface: #fff4f6;
    --alert-text: #9f2940;
}

.app-alert[data-alert-tone="error"]::after { content: "!"; }
.app-alert[hidden] { display: none !important; }
.status-message.app-alert.is-visible,
.form-error.app-alert.is-visible { display: block !important; }

/* Les alertes flottantes restent compactes ; les notifications de tâches gardent leur design dédié. */
.global-notice.app-alert:not(.is-task-notice) {
    width: min(460px, calc(100vw - 48px));
    pointer-events: auto;
}

@media (max-width: 640px) {
    .app-alert { padding: 13px 14px 13px 52px !important; border-radius: 10px !important; }
    .app-alert::after { left: 13px; width: 27px; height: 27px; }
    .global-notice.app-alert:not(.is-task-notice) { right: 16px; bottom: 16px; width: calc(100vw - 32px); max-width: none; }
}
