/* ---------------------------------------------------------------------------
   Pages de compte (rendu statique, sans composants interactifs), façon Vuexy.
   Pas encore de préférence d'utilisateur : le mode sombre suit celui du système.
   --------------------------------------------------------------------------- */
.account-page {
    --auth-bg: #f8f7fa;
    --auth-shape: #efeef3;
    --auth-panel: #fff;
    --auth-heading: #444050;
    --auth-text: #6d6b77;
    --auth-muted: #acaab1;
    --auth-border: #d1d0d4;
    --auth-primary: #7367f0;
    --auth-error: #ff4c51;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--auth-bg);
    color: var(--auth-text);
    font-family: "Public Sans", Roboto, Helvetica, Arial, sans-serif;
    font-size: .9375rem;
}
@media (prefers-color-scheme: dark) {
    .account-page {
        --auth-bg: #25293c;
        --auth-shape: #2b2f45;
        --auth-panel: #2f3349;
        --auth-heading: #cfcde4;
        --auth-text: #acabc1;
        --auth-muted: #76778e;
        --auth-border: #56596f;
    }
}

/* Connexion : diaporama du site à gauche, formulaire à droite (sous 992px, formulaire seul) */
.auth-cover {
    position: relative;
    display: flex;
    width: 100%;
    min-height: 100vh;
}
.auth-brand {
    position: absolute;
    top: 32px;
    left: 40px;
    z-index: 2;
    text-decoration: none;
}
.auth-brand .brand-text {
    color: var(--auth-heading);
}
.auth-illustration {
    position: relative;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 96px 48px 48px;
    overflow: hidden;
}
.auth-illustration::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -12%;
    height: 44%;
    background: var(--auth-shape);
    border-top-left-radius: 160px;
    transform: skewY(-5deg);
    transform-origin: right bottom;
}
.auth-slides {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1100px;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 6px;
    background: var(--auth-shape);
    box-shadow: 0 .25rem 1.125rem 0 rgba(47, 43, 61, .16);
}
.auth-slide {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    transition: opacity 1.2s ease;
}
.auth-slide.active {
    opacity: 1;
}
.auth-slide img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.auth-slide figcaption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 56px 28px 22px;
    background: linear-gradient(transparent, rgba(0, 0, 0, .6));
    color: #fff;
    font-weight: 500;
}

.auth-form {
    flex: 0 0 33.333%;
    min-width: 440px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    background: var(--auth-panel);
}
.auth-form-inner {
    width: 100%;
    max-width: 400px;
}
@media (max-width: 991.98px) {
    .auth-illustration {
        display: none;
    }
    .auth-cover {
        background: var(--auth-panel);
    }
    .auth-form {
        flex: 1 1 auto;
        min-width: 0;
        padding: 96px 24px 48px;
    }
    .auth-brand {
        left: 24px;
    }
}
.auth-form h4 {
    margin: 0 0 6px;
    font-size: 1.5rem;
    font-weight: 500;
    line-height: 1.37;
    color: var(--auth-heading);
}
.auth-subtitle {
    margin: 0 0 24px;
}
.auth-field {
    margin-bottom: 24px;
}
.auth-field label {
    display: block;
    margin-bottom: 4px;
    font-size: .8125rem;
    color: var(--auth-heading);
}
.auth-field input {
    width: 100%;
    box-sizing: border-box;
    height: 38px;
    padding: 7px 14px;
    border: 1px solid var(--auth-border);
    border-radius: 6px;
    background: transparent;
    color: var(--auth-heading);
    font: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.auth-field input::placeholder {
    color: var(--auth-muted);
}
.auth-field input:focus {
    outline: none;
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 1px var(--auth-primary), 0 .125rem .375rem 0 rgba(115, 103, 240, .3);
}
.auth-field input.invalid {
    border-color: var(--auth-error);
}
.auth-password {
    position: relative;
}
.auth-password input {
    padding-right: 42px;
}
.auth-eye {
    position: absolute;
    top: 0;
    right: 0;
    width: 42px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: none;
    color: var(--auth-text);
    cursor: pointer;
}
.auth-eye svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.auth-eye .eye-on,
.auth-eye.shown .eye-off {
    display: none;
}
.auth-eye.shown .eye-on {
    display: block;
}
.auth-remember {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    color: var(--auth-heading);
    cursor: pointer;
}
.auth-remember input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--auth-primary);
    cursor: pointer;
}
.auth-submit {
    display: block;
    width: 100%;
    height: 38px;
    border: 0;
    border-radius: 6px;
    background: var(--auth-primary);
    color: #fff;
    font: inherit;
    font-weight: 500;
    box-shadow: 0 .125rem .375rem 0 rgba(115, 103, 240, .3);
    cursor: pointer;
    transition: background-color .15s;
}
.auth-submit:hover {
    background: #685dd8;
}
.auth-form .validation-message {
    margin-top: 4px;
    font-size: .8125rem;
    color: var(--auth-error);
}
.login-error {
    margin-bottom: 20px;
    padding: 10px 14px;
    border-radius: 6px;
    background: color-mix(in srgb, var(--auth-error) 16%, transparent);
    color: var(--auth-error);
}

/* Accès refusé, erreur : carte centrée */
.login-card {
    width: 100%;
    max-width: 420px;
    margin: 24px;
    padding: 40px;
    box-sizing: border-box;
    border-radius: 6px;
    background: var(--auth-panel);
    box-shadow: 0 .1875rem .75rem 0 rgba(47, 43, 61, .14) !important;
}
.login-card h1 {
    margin: 0 0 8px;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--auth-heading);
}
.login-card p {
    margin: 0 0 16px;
}
.login-card a {
    color: var(--auth-primary);
    text-decoration: none;
}

/* Matrice des droits (fiche profil) */
.rights-table td, .rights-table th {
    padding-top: 2px !important;
    padding-bottom: 2px !important;
}

.rights-table input[type=radio] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #37474f;
}

/* Texte brut (détail des logs...) */
.log-text {
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow: auto;
    padding: 8px;
    background: var(--mud-palette-background-gray);
    border-radius: 4px;
    font-size: .8rem;
}

/* Email invalide : texte d'aide en rouge sans bloquer l'enregistrement (comme GPad) */
.bad-email .mud-input-helper-text {
    color: #c62828;
}

/* Saisie de code HTML */
.html-source textarea {
    font-family: Consolas, "Courier New", monospace;
    font-size: .8rem;
}

/* Exemplaires d'une œuvre du Kardex (colonnes de 15, couleur de l'édition, vendus barrés sur fond rouge) */
.k-copies {
    border-collapse: collapse;
    font-size: .8rem;
    min-width: 220px;
}
.k-copies th, .k-copies td {
    border: 1px solid var(--mud-palette-lines-default);
    padding: 1px 6px;
    white-space: nowrap;
}
.k-copies tbody tr {
    cursor: pointer;
}
.k-copies tbody tr:hover td {
    filter: brightness(.95);
}
.k-copies .k-sold {
    text-decoration: line-through;
}
.k-copies .k-sold-state {
    background: #e53935;
    color: #fff;
}

/* ---------------------------------------------------------------------------
   Thème inspiré de Vuexy, clair et sombre (couleurs et arrondis : Components/Layout/Themes.cs).
   Ici, ce que la palette ne couvre pas ; les couleurs passent par les variables de MudBlazor
   pour suivre le mode sombre.
   --------------------------------------------------------------------------- */
:root {
    --vx-shadow: 0 .1875rem .75rem 0 rgba(47, 43, 61, .14);
    --vx-shadow-sm: 0 .125rem .5rem 0 rgba(47, 43, 61, .12);
    --vx-shadow-modal: 0 .25rem 1.125rem 0 rgba(47, 43, 61, .16);
    --vx-panel-top: 80px;
}

.app-layout {
    background: var(--mud-palette-background);
}

/* Barre du haut : carte flottante sur fond flouté */
.mud-appbar {
    background: color-mix(in srgb, var(--mud-palette-background) 88%, transparent) !important;
    backdrop-filter: blur(6px);
    padding: 12px 24px 0;
    box-shadow: none !important;
}
.mud-appbar .mud-toolbar-appbar {
    height: 56px;
    background: var(--mud-palette-surface);
    border-radius: 6px;
    box-shadow: var(--vx-shadow-sm);
    padding: 0 12px;
}
.mud-main-content {
    padding-top: var(--vx-panel-top) !important;
}

/* Menu latéral : logo, liens arrondis, élément actif en dégradé */
.mud-drawer {
    box-shadow: var(--vx-shadow-sm);
}
.brand {
    min-height: 64px;
    padding: 16px 22px 8px;
}
.brand-link {
    display: flex;
    align-items: center;
    gap: 10px;
}
.brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(72.47deg, #7367f0 22.16%, rgba(115, 103, 240, .7) 76.47%);
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
}
.brand-text {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--mud-palette-text-primary);
    letter-spacing: .01em;
}
.mud-drawer .mud-navmenu {
    padding: 0 14px;
}
.mud-drawer .mud-nav-link {
    border-radius: 6px;
    padding: 8px 12px;
    margin: 2px 0;
    color: var(--mud-palette-text-primary);
    font-size: .9375rem;
}
.mud-drawer .mud-nav-link:hover:not(.active) {
    background-color: var(--mud-palette-background-gray);
}
.mud-drawer .mud-nav-link.active:not(.mud-nav-link-disabled),
.mud-drawer .mud-nav-link.active:not(.mud-nav-link-disabled):hover {
    background: linear-gradient(270deg, rgba(115, 103, 240, .7) 0%, #7367f0 100%);
    color: #fff;
    border-inline-end-width: 0;
    box-shadow: 0 .125rem .375rem 0 rgba(115, 103, 240, .3);
}
.mud-drawer .mud-nav-link.active .mud-nav-link-icon,
.mud-drawer .mud-nav-link.active .mud-nav-link-text {
    color: #fff;
}
.mud-drawer .mud-navgroup .mud-collapse-container .mud-nav-link {
    padding-left: 34px;
}

/* Panneaux : cartes ombrées, sans bordure ; pas de seconde ombre pour une grille imbriquée */
.mud-main-content .mud-paper:not(.mud-popover) {
    box-shadow: var(--vx-shadow);
}
.mud-paper-outlined {
    border: 0;
}
.mud-paper .mud-paper:not(.mud-popover),
.mud-paper .mud-table,
.mud-dialog .mud-paper:not(.mud-popover) {
    box-shadow: none !important;
}
.mud-dialog .mud-paper-outlined {
    border: 1px solid var(--mud-palette-lines-default);
}
.data-list {
    padding: 16px 20px !important;
}

/* Boutons : sans majuscules, ombre colorée ; bouton neutre en teinte pâle (btn-label-secondary) */
.mud-button-root.mud-button-filled-primary {
    box-shadow: 0 .125rem .375rem 0 rgba(115, 103, 240, .3);
}
.mud-button-root.mud-button-filled-primary:hover {
    box-shadow: 0 .125rem .375rem 0 rgba(115, 103, 240, .45);
}
.mud-button-root.mud-button-filled-error {
    box-shadow: 0 .125rem .375rem 0 rgba(255, 76, 81, .3);
}
.mud-button-root.mud-button-filled-default {
    background: color-mix(in srgb, var(--mud-palette-secondary) 16%, transparent);
    color: var(--mud-palette-secondary);
    box-shadow: none;
}

/* Listes : en-têtes en petites capitales, lignes aérées */
.mud-table .mud-table-head .mud-table-cell {
    color: var(--mud-palette-text-primary);
    font-size: .8125rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .2px;
    background: var(--mud-palette-surface);
}
.mud-table.mud-table-dense .mud-table-row .mud-table-cell {
    padding-top: 9px;
    padding-bottom: 9px;
}
.mud-table .mud-table-body .mud-table-cell {
    color: var(--mud-palette-text-secondary);
}
.mud-table.mud-table-striped .mud-table-body .mud-table-row:nth-of-type(odd) {
    background-color: transparent;
}

/* Champs : arrondi 6px */
.mud-input.mud-input-outlined .mud-input-outlined-border {
    border-radius: 6px;
}

/* Pagination : page courante pleine, autres sur fond gris */
.mud-pagination .mud-pagination-item .mud-button-root {
    background: var(--mud-palette-background-gray);
    color: var(--mud-palette-text-primary);
    border-radius: 6px;
    margin: 0 2px;
}
.mud-pagination .mud-pagination-item-selected .mud-button-root {
    background: #7367f0;
    color: #fff;
    box-shadow: 0 .125rem .25rem 0 rgba(115, 103, 240, .4);
}

/* Pastilles : fond pâle de la couleur */
.mud-chip.mud-chip-filled.mud-chip-color-warning {
    background: color-mix(in srgb, var(--mud-palette-warning) 16%, transparent);
    color: var(--mud-palette-warning);
}
.mud-chip.mud-chip-filled.mud-chip-color-success {
    background: color-mix(in srgb, var(--mud-palette-success) 16%, transparent);
    color: var(--mud-palette-success);
}
.mud-chip.mud-chip-filled.mud-chip-color-error {
    background: color-mix(in srgb, var(--mud-palette-error) 16%, transparent);
    color: var(--mud-palette-error);
}
.mud-chip.mud-chip-filled.mud-chip-color-primary {
    background: color-mix(in srgb, var(--mud-palette-primary) 16%, transparent);
    color: var(--mud-palette-primary);
}
.mud-chip.mud-chip-filled.mud-chip-color-info {
    background: color-mix(in srgb, var(--mud-palette-info) 16%, transparent);
    color: var(--mud-palette-info);
}

.rights-table input[type=radio] {
    accent-color: #7367f0;
}

/* ---------------------------------------------------------------------------
   Fiches d'édition (Edit_Frame) : panneau qui recouvre la liste, à droite du menu,
   avec un bouton de retour à la liste en haut à gauche
   --------------------------------------------------------------------------- */
.mud-dialog.edit-panel {
    position: fixed;
    top: var(--vx-panel-top);
    left: 24px;
    right: 24px;
    bottom: 24px;
    width: auto !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 6px;
    background: var(--mud-palette-surface);
    box-shadow: var(--vx-shadow);
    animation: edit-panel-in .18s ease-out both;
}
@media (min-width: 960px) {
    body:has(.mud-drawer.mud-drawer--open.mud-drawer-pos-left) .mud-dialog.edit-panel {
        left: calc(var(--mud-drawer-width-left) + 24px);
    }
}
@keyframes edit-panel-in {
    from { opacity: 0; transform: translateX(32px); }
    to { opacity: 1; transform: none; }
}
.mud-dialog.edit-panel .mud-dialog-title {
    display: none;
}
.mud-dialog.edit-panel .mud-focus-trap {
    display: flex !important;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}
.mud-dialog.edit-panel .mud-dialog-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0 !important;
    margin: 0;
    overflow: hidden;
}
.mud-dialog.edit-panel .edit-panel-frame {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.edit-panel-header {
    border-bottom: 1px solid var(--mud-palette-lines-default);
}
.edit-panel-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}
.edit-panel-footer {
    border-top: 1px solid var(--mud-palette-lines-default);
}
/* Mode édition : le panneau prend toute la place (en-tête masqué, menu refermé) ; la marge autour est voilée, inactive ;
   un clic sur ce voile propose de quitter la fiche (js/gpad.js). Un panneau ouvert depuis un autre le recouvre sans voiler davantage. */
.app-layout.editing .mud-appbar {
    display: none;
}
body:has(.app-layout.editing) .mud-dialog.edit-panel {
    top: 12px;
    left: 12px;
    right: 12px;
    bottom: 12px;
}
.mud-dialog-container:has(> .mud-dialog.edit-panel) > .mud-overlay {
    background: transparent !important;
    cursor: pointer;
}
.mud-dialog-container:has(> .mud-dialog.edit-panel) > .mud-overlay .mud-overlay-scrim {
    background: color-mix(in srgb, var(--mud-palette-background) 55%, transparent) !important;
    backdrop-filter: grayscale(.8);
}
.mud-dialog-container:has(> .mud-dialog.edit-panel) ~ .mud-dialog-container:has(> .mud-dialog.edit-panel) > .mud-overlay .mud-overlay-scrim {
    background: transparent !important;
    backdrop-filter: none;
}

/* ---------------------------------------------------------------------------
   Dialogues bloquants (confirmations, saisies, choix) : modales façon Vuexy
   --------------------------------------------------------------------------- */
.mud-dialog:not(.edit-panel) {
    border-radius: 8px;
    box-shadow: var(--vx-shadow-modal);
    overflow: visible;
}
.mud-dialog:not(.edit-panel) .mud-dialog-title {
    padding: 24px 24px 0;
}
.mud-dialog:not(.edit-panel) .mud-dialog-title .mud-typography,
.mud-dialog:not(.edit-panel) .mud-dialog-title > h6 {
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--mud-palette-text-primary);
}
.mud-dialog:not(.edit-panel) .mud-dialog-content {
    padding: 20px 24px;
    max-height: calc(100vh - 220px);
    overflow-y: auto;
}
.mud-dialog:not(.edit-panel) .mud-dialog-actions {
    padding: 0 24px 24px;
    gap: 8px;
}
.mud-dialog:not(.edit-panel) .mud-dialog-actions .mud-button-text.mud-button-text-default {
    background: color-mix(in srgb, var(--mud-palette-secondary) 16%, transparent);
    color: var(--mud-palette-secondary);
    padding: 6px 18px;
}
/* Bouton de fermeture : petit carré blanc ombré, à cheval sur le coin supérieur droit */
.mud-dialog:not(.edit-panel) .mud-dialog-title .mud-button-close {
    top: -12px;
    right: -12px;
    width: 32px;
    height: 32px;
    padding: 4px;
    border-radius: 4px;
    background: var(--mud-palette-surface);
    box-shadow: 0 .0625rem .375rem 0 rgba(47, 43, 61, .1);
    color: var(--mud-palette-text-secondary);
}
.mud-dialog:not(.edit-panel) .mud-dialog-title .mud-button-close:hover {
    background: var(--mud-palette-surface);
    transform: translate(-1px, 1px);
}

/* Classes utilitaires de texte, absentes de MudBlazor 9 (alignement des montants, troncature) */
.text-right {
    text-align: right;
}
.text-center {
    text-align: center;
}
.text-nowrap {
    white-space: nowrap;
}
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mud-table-head .text-right .column-header {
    justify-content: flex-end;
}

/* Ligne de totaux en pied de liste (Data_List, paramètre Total) */
.data-list .mud-table-foot .mud-table-cell {
    font-weight: 600;
    color: var(--mud-palette-text-primary);
    background: var(--mud-palette-surface);
    border-top: 1px solid var(--mud-palette-lines-default);
}

/* Page de liste (Data_List directement dans la page) : la page tient dans la hauteur de l'écran et la liste
   occupe la place restante, sous les barres de filtres quelle que soit leur hauteur ; seule la liste défile.
   Remplace la hauteur calculée (paramètre Height), qui laissait une barre de défilement générale de quelques pixels. */
.mud-main-content:has(> .data-list) {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.mud-main-content:has(> .data-list) > * {
    flex: none;
}
.mud-main-content:has(> .data-list) > .data-list {
    flex: 1 1 auto;
    min-height: 320px;
    display: flex;
    flex-direction: column;
}
.mud-main-content > .data-list > .mud-data-grid {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.mud-main-content > .data-list > .mud-data-grid > .mud-table-container {
    flex: 1 1 auto;
    min-height: 0;
    height: auto !important;
}
/* Pagination (plus de 100 lignes) : hauteur propre, sinon la colonne flexible l'écrase à quelques pixels */
.mud-main-content > .data-list > .mud-data-grid > .mud-table-pagination {
    flex: none;
}

/* Groupes de champs des fiches (Form_Box, équivalent des GroupBox de GPad) */
.form-box {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 6px;
    padding: 12px 16px 16px;
    background: var(--mud-palette-surface);
}
.form-box-head {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 30px;
    margin-bottom: 8px;
}
.form-box-title {
    font-size: .8125rem;
    font-weight: 500;
    letter-spacing: .2px;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
}

/* Fiche facture : totaux, lignes (contributeur | montants et rétribution | description | image du tirage | suppression) */
.invoice-amounts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    padding: 8px 12px;
    border-radius: 6px;
    background: var(--mud-palette-background-gray);
    color: var(--mud-palette-text-secondary);
}
.invoice-amounts b {
    color: var(--mud-palette-text-primary);
    font-weight: 600;
}
.invoice-line {
    display: grid;
    grid-template-columns: 160px minmax(300px, 380px) minmax(200px, 1fr) auto auto;
    gap: 12px;
    align-items: start;
    padding: 10px 0;
    border-top: 1px solid var(--mud-palette-lines-default);
}
.invoice-line:first-of-type {
    border-top: 0;
}
.invoice-line-picture {
    width: 160px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 6px;
    background: var(--mud-palette-background-gray);
    overflow: hidden;
    cursor: pointer;
}
.invoice-line-picture img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
@media (max-width: 959.98px) {
    .invoice-line {
        grid-template-columns: 1fr auto;
    }
    .invoice-line > :not(:last-child) {
        grid-column: 1;
    }
    .invoice-line > :last-child {
        grid-column: 2;
        grid-row: 1;
    }
}

/* Préférences : choix sous forme de cartes (thème, densité) */
.pref-choices {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.pref-choice {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 6px;
    cursor: pointer;
    transition: border-color .15s, background-color .15s;
}
.pref-choice:hover {
    border-color: var(--mud-palette-primary);
}
.pref-choice.selected {
    border-color: var(--mud-palette-primary);
    background: color-mix(in srgb, var(--mud-palette-primary) 8%, transparent);
}
.pref-choice.selected .mud-icon-root {
    color: var(--mud-palette-primary);
}
.pref-choice-title {
    font-weight: 500;
    color: var(--mud-palette-text-primary);
}
.pref-choice-text {
    font-size: .8125rem;
    color: var(--mud-palette-text-secondary);
}
/* Groupes côte à côte (Class="h-100") : même hauteur */
.mud-grid-item:has(> .form-box.h-100) {
    display: flex;
    flex-direction: column;
}
.mud-grid-item > .form-box.h-100 {
    flex: 1 1 auto;
    height: auto !important;
}

/* Champ HTML (Html_Field) : icône de l'éditeur en haut à droite du champ */
.html-field {
    position: relative;
}
.html-field-tools {
    position: absolute;
    top: 4px;
    right: 6px;
    z-index: 1;
    display: flex;
    gap: 2px;
    border-radius: 6px;
    background: color-mix(in srgb, var(--mud-palette-surface) 85%, transparent);
}
.html-field .html-source textarea {
    padding-right: 40px;
}
/* Aperçu du contenu (Preview) : affiché comme sur le site, clic = éditeur */
.html-field-preview .mud-input-control,
.html-field-preview .mud-field {
    width: 100%;
}
.html-preview {
    min-height: 1.5em;
    overflow: auto;
    padding-right: 36px;
    font-size: .875rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.html-preview-editable {
    cursor: pointer;
}
.html-preview-empty {
    color: var(--mud-palette-text-disabled);
    font-style: italic;
}
.html-preview-helper {
    padding: 2px 14px 0;
}

/* Choix de la langue d'une page (Other pages) */
.lang-toggle .mud-toggle-item {
    min-width: 56px;
    padding: 4px 14px;
}
/* Éditeur HTML : boutons copier / coller de la barre d'outils */
.note-toolbar .html-tool-icon {
    width: 16px;
    height: 16px;
    vertical-align: -3px;
    fill: currentColor;
}
.note-toolbar .html-tool-ok {
    color: var(--mud-palette-success) !important;
}
.note-toolbar .html-tool-error {
    color: var(--mud-palette-error) !important;
}

/* Connexion : icône discrète à la couleur principale après le titre */
.auth-form h4 .auth-title-icon {
    width: 1.375rem;
    height: 1.375rem;
    margin-left: 4px;
    vertical-align: -2px;
    color: var(--auth-primary);
}

/* Newsletter : vignette (lien vers l'image), visibilité et titre modifiables dans la liste */
.newsletter-thumb-mini {
    display: block;
    height: 36px;
    max-width: 64px;
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid var(--mud-palette-lines-default);
}
.list-switch.mud-input-control,
.newsletter-title.mud-input-control {
    margin: 0;
}
.list-switch {
    white-space: nowrap;
}
/* Statut de publication : étiquette de couleur dans les listes, switch dans les fiches (à la hauteur des champs) */
.state-switch {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    max-width: 100%;
    gap: 8px;
}
.state-label.mud-chip {
    margin: 0;
    background-color: color-mix(in srgb, currentColor 16%, transparent);
}
/* Dans une liste, l'étiquette ne rehausse pas la ligne : hauteur d'une ligne de texte */
.mud-table-cell .state-label.mud-chip {
    margin: -1px 0;
}
.state-field {
    min-height: 40px;
    display: flex;
    align-items: center;
}
/* Retour d'une fiche ouverte depuis une autre : titre de la fiche d'origine, abrégé si trop long */
.edit-back {
    text-transform: none;
}
.edit-back-text {
    display: inline-block;
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}
/* Retour en haut à gauche de la fiche : fond teinté de la couleur principale */
.edit-back.edit-back-head {
    flex-shrink: 0;
    padding: 4px 14px;
    border-radius: 6px;
    color: var(--mud-palette-primary);
    background: color-mix(in srgb, var(--mud-palette-primary) 12%, transparent);
}
.edit-back.edit-back-head:hover {
    background: color-mix(in srgb, var(--mud-palette-primary) 22%, transparent);
}
.edit-back.edit-back-head.mud-button-disabled {
    color: var(--mud-palette-text-disabled);
    background: var(--mud-palette-action-disabled-background);
}
.newsletter-title {
    min-width: 260px;
}
.newsletter-title .mud-input {
    font-size: inherit;
}

/* Éditeur HTML visuel (Summernote Lite dans une grande fenêtre) */
.html-editor-dialog .note-editor.note-frame {
    border-color: var(--mud-palette-lines-default);
    border-radius: 6px;
}
.html-editor-dialog .note-editor .note-editing-area .note-editable {
    background: #fff;
    color: #222;
}
/* Le contenu édité retrouve les marges usuelles (MudBlazor les remet à zéro) */
.html-editor-dialog .note-editable p { margin: 0 0 .8em; }
.html-editor-dialog .note-editable h1 { font-size: 2em; margin: .6em 0 .4em; }
.html-editor-dialog .note-editable h2 { font-size: 1.5em; margin: .6em 0 .4em; }
.html-editor-dialog .note-editable h3 { font-size: 1.17em; margin: .6em 0 .4em; }
.html-editor-dialog .note-editable h4,
.html-editor-dialog .note-editable h5,
.html-editor-dialog .note-editable h6 { font-size: 1em; margin: .6em 0 .4em; }
.html-editor-dialog .note-editable ul,
.html-editor-dialog .note-editable ol { padding-left: 2em; margin: 0 0 .8em; }
.html-editor-dialog .note-editable ul { list-style: disc; }
.html-editor-dialog .note-editable ol { list-style: decimal; }
.html-editor-dialog .note-editable a { color: #0645ad; text-decoration: underline; }

/* Aperçu d'un champ HTML : marges usuelles du contenu (MudBlazor les remet à zéro) */
.html-preview p { margin: 0 0 .5em; }
.html-preview h1, .html-preview h2, .html-preview h3,
.html-preview h4, .html-preview h5, .html-preview h6 { font-size: 1.1em; font-weight: 600; margin: .3em 0; }
.html-preview ul, .html-preview ol { padding-left: 1.6em; margin: 0 0 .5em; }
.html-preview ul { list-style: disc; }
.html-preview ol { list-style: decimal; }
.html-preview a { color: var(--mud-palette-primary); text-decoration: underline; }
.html-preview > :last-child { margin-bottom: 0; }
.html-preview img { max-width: 100%; height: auto; }

/* Image d'une fiche (Image_Field) : aperçu et zone de dépôt d'un fichier, menu des actions « ⋮ » sur la ligne du titre */
.image-drop {
    position: relative;
    margin: 4px 0;
    min-width: 160px;
    min-height: 120px;
    max-width: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--mud-palette-lines-inputs);
    border-radius: 6px;
    padding: 6px;
    background: var(--mud-palette-background-gray);
}
.image-drop img {
    display: block;
    max-width: 240px;
    max-height: 240px;
    border-radius: 4px;
    cursor: zoom-in;
}
.image-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--mud-palette-text-disabled);
    font-size: .8rem;
    text-align: center;
}
/* Champ de fichier invisible sur la zone : il ne reçoit la souris que pendant un glisser de fichier */
.image-drop-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
}
body.drag-files .image-drop-input {
    pointer-events: auto;
    cursor: copy;
}
body.drag-files .image-drop:has(.image-drop-input) {
    border-color: var(--mud-palette-primary);
    background: color-mix(in srgb, var(--mud-palette-primary) 8%, transparent);
}
.image-busy {
    position: absolute;
}
.image-drop.busy img {
    opacity: .4;
}
.image-field-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
/* Sans titre propre (le cadre de la fiche le porte) : menu à droite du titre du cadre */
.form-box:has(.image-field-menu-box) {
    position: relative;
}
.image-field-menu-box {
    position: absolute;
    top: 12px;
    right: 12px;
}
.image-menu-label {
    display: block;
    width: 100%;
    cursor: pointer;
}
/* Choix d'un fichier du dossier d'intégration du serveur */
.image-server-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    max-height: 55vh;
    overflow-y: auto;
}
.image-server-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 6px;
    cursor: pointer;
    font-size: .75rem;
    overflow-wrap: anywhere;
    text-align: center;
}
.image-server-item:hover {
    border-color: var(--mud-palette-primary);
}
.image-server-item img {
    width: 96px;
    height: 96px;
    object-fit: contain;
}
/* Image agrandie */
.image-zoom {
    display: flex;
    justify-content: center;
    cursor: zoom-out;
}
.image-zoom img {
    max-width: 100%;
    max-height: 75vh;
}

/* Vignette dans une liste (colonne « Icon » du Kardex) : à la hauteur d'une ligne */
/* Vignette de liste : la ligne qui en a une est un quart plus haute qu'une ligne de texte */
.list-thumb {
    display: block;
    height: 44px;
    max-width: 78px;
    object-fit: contain;
    margin: -6px 0;
    border-radius: 3px;
}

/* Barre de sélection du Kardex : le menu des actions est collé à la liste déroulante, à sa hauteur */
.selection-bar {
    display: inline-flex;
    align-items: center;
    gap: 0;
    margin-right: 12px;   /* distinct du menu « ⋮ » de la liste */
}
/* Liste déroulante et bouton des actions soudés en un seul contrôle : bord commun, même hauteur, même couleur de contour */
.selection-bar .mud-input-outlined-border {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.selection-bar .selection-menu {
    height: 39px;
    width: 40px;
    margin-top: 4px;
    margin-left: -1px;
    border-radius: 0 6px 6px 0;
    border-color: var(--mud-palette-lines-inputs);
}

/* Fiche avec l'image en colonne à gauche (œuvres du Kardex) : repère visuel en haut à gauche */
.editor-side-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}
@media (max-width: 800px) {
    .editor-side-layout {
        grid-template-columns: minmax(0, 1fr);
    }
}
.editor-thumb {
    display: block;
    max-width: 100%;
    max-height: 240px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 4px;
}

/* Catalogue du Kardex : informations affichées sur plusieurs colonnes */
.catalogue-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}

/* Website > News files : arborescence à gauche, contenu du dossier à droite, sur toute la hauteur */
.mud-main-content:has(> .files-page) {
    height: 100vh;
    display: flex;
    flex-direction: column;
}
.files-page {
    flex: 1 1 auto;
    min-height: 360px;
    display: grid;
    grid-template-columns: minmax(200px, 280px) 1fr;
    gap: 12px;
}
.files-tree {
    overflow: auto;
    padding: 4px 0;
}
.files-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}
.files-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}
.files-crumbs {
    min-width: 0;
}
.files-upload {
    cursor: pointer;
}
.files-upload.mud-disabled {
    pointer-events: none;
}
.files-drop {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.files-grid {
    flex: 1 1 auto;
    min-height: 0;
}
.files-name {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.files-actions {
    white-space: nowrap;
    text-align: right;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}
/* Champ de fichier invisible sur la liste : il ne reçoit la souris que pendant un glisser de fichier */
.files-drop-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    z-index: 2;
}
body.drag-files .files-drop-input:not([disabled]) {
    pointer-events: auto;
    cursor: copy;
}
body.drag-files .files-drop:has(.files-drop-input:not([disabled])) {
    outline: 2px dashed var(--mud-palette-primary);
    outline-offset: -4px;
    background: color-mix(in srgb, var(--mud-palette-primary) 6%, transparent);
}
@media (max-width: 760px) {
    .mud-main-content:has(> .files-page) {
        height: auto;
    }
    .files-page {
        grid-template-columns: 1fr;
    }
    .files-tree {
        max-height: 240px;
    }
}

/* ---------------------------------------------------------------------------
   Accueil : tableau de bord du Kardex (cartes de chiffres clés, répartitions), façon Vuexy CRM
   --------------------------------------------------------------------------- */
.dash-head {
    margin-bottom: 16px;
}
.dash-kpis,
.dash-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}
.dash-kpi,
.dash-card {
    padding: 20px;
    border-radius: 6px;
}
.dash-kpi-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.dash-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 6px;
    color: var(--dash-color);
    background: color-mix(in srgb, var(--dash-color) 16%, transparent);
}
.dash-kpi-value {
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.2;
}
.dash-kpi-title {
    font-size: 1rem;
    font-weight: 500;
}
.dash-kpi-detail,
.dash-card-sub {
    color: var(--mud-palette-text-secondary);
    font-size: .8125rem;
}
.dash-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 8px;
}
.dash-card-title {
    font-size: 1.125rem;
    font-weight: 500;
}
.dash-section {
    margin-top: 16px;
}
.dash-section-title {
    font-size: .75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--mud-palette-text-secondary);
    margin-bottom: 8px;
}
/* Histogramme : zone des barres de hauteur fixe posée sur une ligne de base commune (façon « Earning Reports » de Vuexy),
   libellés en dessous : un libellé sur deux lignes ne décale pas sa barre */
.dash-columns {
    --dash-plot: 132px;
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding-top: 8px;
}
.dash-columns::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: calc(8px + var(--dash-plot));
    border-top: 1px solid var(--mud-palette-lines-default);
    pointer-events: none;
}
.dash-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
}
.dash-column-plot {
    height: var(--dash-plot);
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}
.dash-column-value {
    font-size: .75rem;
    margin-bottom: 4px;
}
.dash-column-bar {
    width: 100%;
    max-width: 40px;
    border-radius: 6px 6px 0 0;
    background: color-mix(in srgb, var(--dash-color, var(--mud-palette-primary)) 18%, transparent);
}
.dash-column.top .dash-column-bar {
    background: var(--dash-color, var(--mud-palette-primary));
}
.dash-column-label {
    margin-top: 8px;
    font-size: .75rem;
    color: var(--mud-palette-text-secondary);
    text-align: center;
    line-height: 1.2;
}
@media (max-width: 1100px) {
    .dash-kpis,
    .dash-cards {
        grid-template-columns: minmax(0, 1fr);
    }
}
/* Colonnes du tableau de bord : un clic ouvre la liste filtrée */
a.dash-column {
    color: inherit;
    text-decoration: none;
}
a.dash-column.disabled {
    cursor: default;
}
a.dash-column[href]:hover .dash-column-bar {
    filter: brightness(1.15);
    outline: 2px solid color-mix(in srgb, var(--mud-palette-primary) 40%, transparent);
}

/* Listes : menu « ⋮ » des actions en haut à droite ; le choix des colonnes s'ouvre sous ce menu */
.data-list-menu {
    position: relative;
    display: inline-flex;
}
/* Voile transparent sous le choix des colonnes (un clic à côté le ferme) : sous la fenêtre, pas par-dessus */
.data-list-columns-overlay {
    z-index: 1199 !important;
}
/* Bandeau d'une fiche d'œuvre ou de tirage : artiste en lien après le titre */
.edit-header-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
}

/* Fiche d'une œuvre (K_Work_Panel), comme GPad : vignette | informations générales | tailles, cadres de même hauteur */
.work-top {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr) minmax(0, 1.4fr);
    gap: 12px;
    align-items: stretch;
}
.work-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.work-col > .form-box {
    flex: 1 1 auto;
}
@media (max-width: 1100px) {
    .work-top {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Champs à largeur fixe dans une rangée (dialogues) : nombres et dimensions étroits, code ou montant un peu plus large,
   texte court ; plutôt que la largeur d'une colonne de grille */
.field-row { display:flex; flex-wrap:wrap; align-items:flex-start; column-gap:12px; row-gap:4px; }
.field-row > .mud-checkbox, .field-row > .unit-switch, .field-row > .field-row-label { align-self:center; }
.field-row-label { font-size:.8rem; font-weight:600; color: var(--mud-palette-text-secondary); text-transform:uppercase; letter-spacing:.04em; }
.mud-input-control.field-num { flex:0 0 auto; width:120px; }
.mud-input-control.field-code { width:200px; max-width:100%; }
.mud-input-control.field-amount { width:160px; max-width:100%; }
.mud-input-control.field-text { flex:0 1 320px; min-width:200px; }
.unit-switch .mud-radio { margin-right:0; }

/* Identifiant technique d'une fiche, dans le pied à côté de Delete : le plus discret possible, sélectionnable pour copie */
.edit-record-id { font-size:.68rem; font-family: ui-monospace, Consolas, monospace; color: var(--mud-palette-text-disabled); opacity:.7; user-select:all; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; min-width:0; }

/* Champ vide : le label affiché dans le champ (avant saisie, hors focus) prend le style du texte désactivé, comme « Empty »
   des champs HTML, pour ne pas être pris pour une valeur saisie ; dès que le label remonte (valeur, focus), style normal */
.mud-input:not(.mud-shrink):not(:focus-within):not(:has(:-webkit-autofill)) ~ label.mud-input-label.mud-input-label-inputcontrol:not(.mud-input-error) {
    color: var(--mud-palette-text-disabled);
    font-style: italic;
}
