/* Boutons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding: 0 16px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--white);
    color: var(--ink);
    font-size: var(--text-md);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.btn:hover {
    background: var(--hover);
    color: var(--ink);
}

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

.btn--primary {
    border-color: var(--teal);
    background: var(--teal);
    color: var(--white);
}

.btn--primary:hover {
    border-color: var(--teal-dark);
    background: var(--teal-dark);
    color: var(--white);
}

.btn--ghost {
    border-color: transparent;
    background: transparent;
}

.btn--icon {
    width: 40px;
    height: 40px;
    padding: 0;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-pill);
    border: 0;
    background: var(--navy);
    color: var(--white);
    font-size: var(--text-md);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    background: var(--blue);
    color: var(--muted-strong);
    font-size: var(--text-xs);
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.badge--accent { background: var(--aqua); color: var(--navy); }
.badge--mint { background: var(--mint); color: var(--teal-dark); }
.badge--success { background: var(--green-bg); color: var(--green); }
.badge--warning { background: var(--amber-bg); color: var(--amber-ink); }
.badge--danger { background: var(--red-bg); color: var(--red-ink); }
.badge--dark { background: var(--navy); color: var(--white); }

/* Carte */
.card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card__title {
    font-size: 16px;
    font-weight: 700;
}

.card__subtitle {
    font-size: var(--text-md);
    color: var(--muted);
}

.card__actions {
    display: flex;
    gap: 10px;
    font-size: var(--text-md);
    font-weight: 600;
}

.card__actions a {
    text-decoration: none;
}

/* KPI */
.kpi {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: inherit;
    text-decoration: none;
}

a.kpi {
    transition: border-color .2s ease, box-shadow .2s ease;
}

a.kpi:hover {
    border-color: #9fd9d1;
    box-shadow: var(--elev);
    color: inherit;
}

.kpi__label {
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
}

.kpi__values {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.kpi__value {
    font-size: 28px;
    font-weight: 800;
    color: var(--navy);
    font-variant-numeric: tabular-nums;
}

.kpi__detail {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--teal);
}

/* Tuile (accueil) */
.tile {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 22px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    color: var(--ink);
    text-decoration: none;
    transition: transform .2s var(--ease-out), box-shadow .2s ease, border-color .2s ease;
    animation: rise .45s var(--ease-out) both;
    animation-delay: calc(var(--i, 0) * 60ms);
}

.tile:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: var(--aqua);
    color: var(--ink);
}

.tile__icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-md);
    background: var(--mint);
    color: var(--teal);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tile__text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tile__title {
    font-size: 17px;
    font-weight: 700;
    color: var(--navy);
}

.tile__description {
    font-size: var(--text-md);
    color: var(--muted);
}

.tile__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    color: var(--teal);
}

.tile__go {
    margin-left: auto;
    transition: transform .2s ease;
}

.tile:hover .tile__go {
    transform: translateX(3px);
}

.tile--dark {
    background: var(--navy);
    border-color: var(--navy);
    color: var(--white);
}

.tile--dark:hover {
    color: var(--white);
}

.tile--dark .tile__icon {
    background: rgba(41, 203, 183, .16);
    color: var(--aqua);
}

.tile--dark .tile__title { color: var(--white); }
.tile--dark .tile__description { color: #b9dcd8; }
.tile--dark .tile__footer { color: var(--aqua); }

@keyframes rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

/* Onglets (un onglet = une URL) */
.tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
    width: fit-content;
    max-width: 100%;
}

.tabs__link {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 14px;
    border-radius: var(--radius-sm);
    color: var(--muted-strong);
    font-size: var(--text-md);
    font-weight: 600;
    text-decoration: none;
    transition: background .2s ease, color .2s ease;
}

.tabs__link:hover {
    background: var(--hover);
    color: var(--ink);
}

.tabs__link[aria-current='page'] {
    background: var(--navy);
    color: var(--white);
}

.tabs__count {
    font-size: var(--text-xs);
    font-weight: 700;
    padding: 1px 8px;
    border-radius: var(--radius-pill);
    background: var(--blue);
    color: var(--muted-strong);
}

.tabs__link[aria-current='page'] .tabs__count {
    background: var(--aqua);
    color: var(--navy);
}

/* Fenêtre modale centrée (<dialog>, DECISIONS.md D14) */
.modal {
    width: min(720px, calc(100vw - 32px));
    max-height: min(88vh, 900px);
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: var(--radius-xl);
    background: var(--white);
    color: var(--ink);
    box-shadow: 0 24px 60px rgba(5, 47, 56, .22);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.modal[open] {
    animation: modal-in .22s var(--ease-out) both;
}

.modal::backdrop {
    background: rgba(5, 47, 56, .38);
    animation: fade .2s ease both;
}

.modal__close {
    position: sticky;
    top: 12px;
    float: right;
    z-index: 2;
    margin: 12px 12px 0 0;
    background: var(--white);
}

.modal__body {
    padding: 26px 28px 28px;
}

.modal__toolbar {
    display: flex;
    justify-content: flex-start;
    margin: -10px 0 14px;
    font-size: var(--text-sm);
}

.modal__toolbar a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

@keyframes modal-in {
    from { opacity: 0; transform: translateY(12px) scale(.98); }
    to { opacity: 1; transform: none; }
}

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

/* Notifications (popover : couche supérieure, au-dessus d'un panneau modal ouvert) */
.toasts {
    position: fixed;
    inset: auto 20px 20px auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    overflow: visible;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(420px, calc(100vw - 40px));
    padding: 11px 14px;
    border-radius: var(--radius);
    background: var(--navy);
    color: var(--white);
    box-shadow: var(--shadow);
    font-size: var(--text-md);
    font-weight: 700;
    pointer-events: auto;
    animation: rise .25s var(--ease-out) both;
}

.toast--success { border-left: 4px solid var(--aqua); }
.toast--warning { border-left: 4px solid var(--amber); }
.toast--error { border-left: 4px solid #e07a6f; }

.toast.is-leaving {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .2s ease, transform .2s ease;
}

/* Encadrés */
.notice {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: var(--amber-bg);
    color: var(--amber-ink);
    font-size: var(--text-md);
}

.empty-state {
    padding: 28px;
    text-align: center;
    color: var(--muted);
}

.btn--block {
    width: 100%;
}

/* Formulaires */
.form-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field__label {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--ink);
}

.field__label.required::after {
    content: ' *';
    color: var(--red);
}

.input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--white);
    font-size: var(--text-md);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.field--invalid .input {
    border-color: var(--red);
}

.field__help {
    font-size: var(--text-sm);
    color: var(--muted);
}

.field__errors {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--red-ink);
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: var(--text-md);
    cursor: pointer;
}

.checkbox input {
    width: 18px;
    height: 18px;
    accent-color: var(--teal);
}

.alert {
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: var(--text-md);
    font-weight: 600;
}

.alert--error {
    background: var(--red-bg);
    color: var(--red-ink);
}

/* Menu du compte */
.account-menu {
    position: relative;
}

.account-menu > summary {
    list-style: none;
    cursor: pointer;
}

.account-menu > summary::-webkit-details-marker {
    display: none;
}

.account-menu__panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 20;
    min-width: 240px;
    padding: 8px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.account-menu__identity {
    display: flex;
    flex-direction: column;
    padding: 8px 10px 10px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--line-soft);
}

.account-menu__name {
    font-weight: 700;
    color: var(--navy);
}

.account-menu__email {
    font-size: var(--text-sm);
    color: var(--muted);
}

.account-menu__item {
    display: block;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--ink);
    font-size: var(--text-md);
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.account-menu__item:hover {
    background: var(--hover);
    color: var(--ink);
}

/* Listes de l'accueil */
.task-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.task-list__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line-soft);
    font-size: var(--text-md);
}

.task-list__item:last-child {
    border-bottom: 0;
}

.task-list__item .stack {
    flex-grow: 1;
}

.dot {
    width: 8px;
    height: 8px;
    flex-shrink: 0;
    border-radius: var(--radius-pill);
    background: var(--line);
}

.dot--haute { background: var(--amber); }
.dot--urgente { background: var(--red); }
.dot--normale { background: var(--aqua); }

.bars {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bars__row {
    display: grid;
    grid-template-columns: 160px 1fr 28px;
    align-items: center;
    gap: 12px;
    font-size: var(--text-md);
}

.bars__label {
    color: var(--muted-strong);
}

.bars__track {
    height: 10px;
    border-radius: var(--radius-pill);
    background: var(--hover);
}

.bars__fill {
    display: block;
    height: 10px;
    border-radius: var(--radius-pill);
    background: var(--accent, var(--teal));
}

.bars__value {
    font-weight: 700;
    text-align: right;
}

/* Repliable d'information (« Confidentialité et origine des données »…) */
.disclosure {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--white);
    font-size: var(--text-md);
}

.disclosure > summary {
    padding: 12px 16px;
    font-weight: 600;
    color: var(--muted-strong);
    cursor: pointer;
}

.disclosure__body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 16px 14px;
    color: var(--muted-strong);
}

/* Liste dans un repliable (points signalés à l'import…) : des lignes séparées, sans puces. */
ul.disclosure__body {
    margin: 0;
    gap: 0;
    list-style: none;
}

ul.disclosure__body > li {
    padding: 8px 0;
    border-top: 1px solid var(--line-soft);
    line-height: 1.45;
}

.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 4px;
}

textarea.input,
.field textarea {
    height: auto;
    min-height: 88px;
    padding: 10px 14px;
    resize: vertical;
}

/* Liste déroulante : flèche maison, en retrait du bord comme le texte (la flèche du navigateur collait au bord). */
select.input:not([multiple]) {
    appearance: none;
    padding-right: 40px;
    background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23566d73' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E") no-repeat right 14px center / 16px 16px;
    text-overflow: ellipsis;
    cursor: pointer;
}

/* Envoi de fichier : bouton du navigateur habillé comme les boutons de l'intranet, dans le champ. */
input[type="file"].input {
    height: auto;
    min-height: 44px;
    padding: 6px 14px 6px 6px;
    color: var(--muted-strong);
    cursor: pointer;
}

input[type="file"].input::file-selector-button {
    height: 32px;
    margin-right: 12px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    color: var(--ink);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}

input[type="file"].input:hover::file-selector-button {
    border-color: var(--teal);
    background: var(--mint);
}

/* Champs à recherche (Symfony UX Autocomplete / Tom Select), alignés sur .input */
.ts-wrapper.input {
    height: auto;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.ts-wrapper .ts-control {
    min-height: 44px;
    padding: 10px 36px 10px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--white);
    box-shadow: none;
    font-size: var(--text-md);
    color: var(--ink);
}

.ts-wrapper.focus .ts-control {
    border-color: var(--aqua);
    box-shadow: var(--focus-ring);
}

.ts-wrapper .ts-control input {
    font-size: var(--text-md);
}

.ts-dropdown {
    margin-top: 4px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--elev);
    font-size: var(--text-md);
    color: var(--ink);
}

.ts-dropdown .option,
.ts-dropdown .create,
.ts-dropdown .no-results {
    padding: 9px 14px;
}

.ts-dropdown .active {
    background: var(--mint);
    color: var(--ink);
}

.ts-dropdown .create {
    color: var(--teal-dark);
}

.field--invalid .ts-control {
    border-color: var(--red);
}

/* Formulaires en modale : deux colonnes, les zones longues et les actions sur toute la largeur */
.modal .form-stack {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 18px;
}

.modal .form-stack > :is(.form-actions, ul),
.modal .form-stack > .field:has(textarea) {
    grid-column: 1 / -1;
}

@media (max-width: 640px) {
    .modal .form-stack {
        grid-template-columns: 1fr;
    }

    .modal__body {
        padding: 20px 18px 22px;
    }
}

/* Quand l'option « Créer… » est proposée, le message « Aucune entreprise trouvée » est superflu */
.ts-dropdown .create ~ .no-results {
    display: none;
}

/* Écran « Utilisateurs » : fiche du compte et encart d'état côte à côte, l'un sous l'autre sur un téléphone. */
.users-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

@media (max-width: 860px) {
    .users-layout {
        grid-template-columns: minmax(0, 1fr);
    }
}

.users-roles {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    border: 0;
}
