/*
 * Barre supérieure (templates/header.html.twig, templates/languages.html.twig).
 * Fichier statique chargé après /build/css/app.css : aucune recompilation nécessaire.
 */

.topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    margin-bottom: 20px;
    padding: 0; /* app.css : header { padding-bottom: 15px } */
    background: #2b2f35;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 0 2px 12px rgba(0, 0, 0, .3);
    color: #fff;
}

.topbar__inner {
    display: flex;
    align-items: center;
    min-height: 64px;
}

/* --- Gauche : bouton menu (petits écrans) et logo --- */
.topbar__left {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.topbar__burger {
    width: 40px;
    height: 40px;
    margin-right: 12px;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 6px;
    background: transparent;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
}

.topbar__burger:hover,
.topbar__burger:focus {
    background: rgba(255, 255, 255, .1);
    outline: none;
}

.topbar__brand {
    display: flex;
    align-items: center;
}

.topbar__brand img {
    max-height: 44px;
    max-width: 210px;
}

/* --- Centre : titre de la page --- */
.topbar__title {
    flex: 1;
    min-width: 0;
    padding: 0 20px;
    overflow: hidden;
    font-size: 1.15rem;
    font-weight: 500;
    letter-spacing: .02em;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Droite : langue et compte --- */
.topbar__right {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.topbar__right > * + * {
    margin-left: 10px;
}

/* Menus déroulants natifs (<details>) */
.topbar__menu {
    position: relative;
}

.topbar__menu > summary {
    display: flex;
    align-items: center;
    height: 42px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

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

.topbar__menu > summary:hover,
.topbar__menu[open] > summary {
    border-color: rgba(255, 255, 255, .15);
    background: rgba(255, 255, 255, .08);
}

.topbar__menu > summary:focus {
    outline: none;
}

.topbar__menu > summary:focus-visible {
    box-shadow: 0 0 0 2px rgba(0, 123, 255, .6);
}

.topbar__caret {
    margin-left: 8px;
    font-size: .7rem;
    opacity: .7;
    transition: transform .15s ease;
}

.topbar__menu[open] .topbar__caret {
    transform: rotate(180deg);
}

.topbar__dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 1040;
    min-width: 250px;
    padding: 6px 0;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
    color: #363a41;
}

.topbar__dropdown--narrow {
    min-width: 180px;
}

.topbar__dropdown-header {
    display: flex;
    flex-direction: column;
    padding: 10px 16px 12px;
    margin-bottom: 6px;
    border-bottom: 1px solid #e9ecef;
}

.topbar__email {
    color: #6c757d;
    font-size: .85rem;
    word-break: break-all;
}

.topbar__role {
    align-self: flex-start;
    margin-top: 6px;
    font-weight: 500;
}

.topbar__dropdown .topbar__dropdown-item {
    display: flex;
    align-items: center;
    padding: 9px 16px;
    color: #363a41; /* app.css : a { color: #fff } */
    text-decoration: none;
}

.topbar__dropdown .topbar__dropdown-item:hover,
.topbar__dropdown .topbar__dropdown-item:focus {
    background: #f1f3f5;
    color: #363a41;
}

.topbar__dropdown-item i {
    width: 22px;
    margin-right: 6px;
    text-align: center;
}

.topbar__dropdown .topbar__dropdown-item--danger,
.topbar__dropdown .topbar__dropdown-item--danger:hover {
    color: #c82333;
}

.topbar__dropdown .topbar__dropdown-item.is-active {
    font-weight: 600;
}

.topbar__check {
    margin-left: auto;
    color: #28a745;
}

/* Langue */
.topbar__flag {
    width: 20px;
    height: auto;
    border-radius: 2px;
}

.topbar__dropdown-item .topbar__flag {
    margin-right: 10px;
}

.topbar__lang-code {
    margin-left: 8px;
    font-size: .85rem;
    font-weight: 600;
}

/* Compte */
.topbar__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 2px solid rgba(255, 255, 255, .85);
    border-radius: 50%;
    color: #fff;
    font-size: .8rem;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

.topbar__username {
    margin-left: 10px;
    font-weight: 500;
}

/* --- Petits écrans --- */
@media (max-width: 575.98px) {
    .topbar__title {
        display: none;
    }

    .topbar__inner {
        justify-content: space-between;
    }

    .topbar__brand img {
        max-width: 150px;
        max-height: 36px;
    }

    .topbar__dropdown {
        position: fixed;
        top: 70px;
        right: 10px;
        left: 10px;
        min-width: 0;
    }
}

.topbar__title-sep {
    margin: 0 6px;
    opacity: .5;
}

/*
 * Menu latéral (templates/menu.html.twig).
 */

.sidenav {
    margin-bottom: 20px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 10px;
    background: #2b2f35;
}

@media (min-width: 1200px) {
    /* Reste visible au défilement, avec son propre défilement si le menu est plus haut que l'écran */
    .sidenav {
        position: sticky;
        top: 84px;
        max-height: calc(100vh - 104px);
        overflow-y: auto;
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 255, 255, .2) transparent;
    }
}

.sidenav__list,
.sidenav__sublist {
    margin: 0;
    padding: 0;
    list-style: none;
}

.sidenav__list > li + li {
    margin-top: 2px;
}

/* Rubrique (ou lien direct) */
.sidenav__link {
    display: flex;
    align-items: center;
    padding: 9px 10px;
    border-radius: 7px;
    color: #e9ecef;
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.sidenav__link::-webkit-details-marker {
    display: none;
}

a.sidenav__link:hover,
summary.sidenav__link:hover {
    background: rgba(255, 255, 255, .07);
    color: #fff;
    text-decoration: none;
}

.sidenav__link:focus {
    outline: none;
}

.sidenav__link:focus-visible,
.sidenav__sublink:focus-visible {
    box-shadow: 0 0 0 2px rgba(0, 123, 255, .6);
}

.sidenav__icon {
    flex-shrink: 0;
    width: 22px;
    margin-right: 10px;
    color: #8f9aa7;
    text-align: center;
}

.sidenav__link > span {
    flex: 1;
    min-width: 0;
}

.sidenav__chevron {
    margin-left: 6px;
    font-size: .65rem;
    opacity: .55;
    transition: transform .15s ease;
}

.sidenav__section[open] > summary .sidenav__chevron {
    transform: rotate(90deg);
}

/* Rubrique contenant la page courante, et lien direct actif */
.sidenav__link.has-active,
.sidenav__link.has-active .sidenav__icon {
    color: #fff;
}

.sidenav__link.has-active .sidenav__icon,
a.sidenav__link.is-active .sidenav__icon {
    color: #4da3ff;
}

a.sidenav__link.is-active {
    background: rgba(0, 123, 255, .18);
    color: #fff;
}

/* Sous-pages */
.sidenav__sublist {
    margin: 2px 0 6px 21px;
    padding-left: 10px;
    border-left: 1px solid rgba(255, 255, 255, .12);
}

.sidenav__sublink {
    display: block;
    margin: 1px 0;
    padding: 6px 10px;
    border-radius: 6px;
    color: #b8c0c8;
    font-size: .86rem;
    line-height: 1.3;
}

.sidenav__sublink:hover {
    background: rgba(255, 255, 255, .06);
    color: #fff;
    text-decoration: none;
}

.sidenav__sublink.is-active {
    position: relative;
    background: rgba(0, 123, 255, .18);
    color: #fff;
    font-weight: 600;
}

.sidenav__sublink.is-active::before {
    content: "";
    position: absolute;
    top: 6px;
    bottom: 6px;
    left: -11px;
    width: 3px;
    border-radius: 2px;
    background: #4da3ff;
}

/* Petits écrans : le menu s'ouvre sous la barre supérieure */
@media (max-width: 1199.98px) {
    .sidenav.show {
        display: block;
    }
}

/* Grand écran : colonne du menu à largeur fixe, le contenu prend le reste */
@media (min-width: 1200px) {
    .layout-sidebar {
        flex: 0 0 280px;
        max-width: 280px;
    }

    .layout-content {
        flex: 1 1 0;
        min-width: 0;
        max-width: calc(100% - 280px);
    }
}

/* Tableaux plus larges que l'écran : défilement horizontal dans la zone de contenu, pas de toute la page */
.layout-content {
    overflow-x: auto;
}

/*
 * Accueil (templates/home.html.twig).
 */

.home-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 24px;
    padding: 22px 24px;
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 12px;
    background: linear-gradient(135deg, #2b2f35 0%, #23395a 100%);
    color: #fff;
}

.home-hero__avatar {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-right: 18px;
    border: 3px solid rgba(255, 255, 255, .85);
    border-radius: 50%;
    font-size: 1.2rem;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

.home-hero__text {
    flex: 1;
    min-width: 200px;
}

.home-hero__title {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 600;
}

.home-hero__subtitle {
    margin: 4px 0 0;
    color: #b8c0c8;
}

.home-hero__meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-left: 16px;
}

.home-hero__date {
    margin-bottom: 6px;
    color: #b8c0c8;
    font-size: .9rem;
}

.home-heading {
    margin: 0 0 12px;
    color: #6c757d;
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* Indicateurs (zone de contenu blanche : .page dans app.css) */
.home-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.page a.home-kpi {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 14px;
    padding: 16px 18px;
    border: 1px solid #e3e6ea;
    border-left: 4px solid var(--tone);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
    color: #363a41;
    transition: transform .12s ease, box-shadow .12s ease;
}

.page a.home-kpi:hover,
.page a.home-kpi:focus {
    box-shadow: 0 6px 16px rgba(0, 0, 0, .1);
    text-decoration: none;
    transform: translateY(-2px);
}

.home-kpi--blue { --tone: #007bff; }
.home-kpi--red { --tone: #dc3545; }
.home-kpi--amber { --tone: #e0a800; }
.home-kpi--green { --tone: #28a745; }
.home-kpi--grey { --tone: #adb5bd; }

.home-kpi__icon {
    display: flex;
    grid-row: 1 / 3;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #f1f3f5;
    color: var(--tone);
    font-size: 1.15rem;
}

.home-kpi__value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.1;
}

.home-kpi__label {
    color: #6c757d;
    font-size: .85rem;
}

/* Planning du jour */
.home-panel {
    margin-bottom: 24px;
    padding: 16px 18px;
    border: 1px solid #e3e6ea;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}

.home-panel__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.home-panel__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.home-panel__title i {
    margin-right: 6px;
    color: #e0a800;
}

.page a.home-panel__link {
    color: #007bff;
    font-size: .875rem;
}

.home-panel__empty,
.home-panel__more {
    margin: 0;
    color: #6c757d;
    font-size: .9rem;
}

.home-panel__more {
    margin-top: 8px;
}

.home-planning {
    margin: 0;
    padding: 0;
    list-style: none;
}

.home-planning__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 8px 0;
    border-top: 1px solid #eef0f2;
    font-size: .9rem;
}

.home-planning__row > * + * {
    margin-left: 12px;
}

.home-planning__time {
    min-width: 48px;
    color: #b38600;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.home-planning__name {
    flex: 1;
    min-width: 180px;
}

.home-planning__name small {
    margin-left: 6px;
    color: #6c757d;
}

.home-planning__qty,
.home-planning__machine {
    color: #495057;
    white-space: nowrap;
}

/* Accès rapides */
.home-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    align-items: start;
    gap: 14px;
    margin-bottom: 20px;
}

.home-tile {
    padding: 14px 16px;
    border: 1px solid #e3e6ea;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}

.home-tile__head {
    display: flex;
    align-items: center;
    color: #363a41;
    font-weight: 600;
}

.home-tile__icon {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    margin-right: 10px;
    border-radius: 8px;
    background: #e7f1ff;
    color: #007bff;
    line-height: 34px;
    text-align: center;
}

.home-tile__title {
    flex: 1;
    min-width: 0;
}

.home-tile__go {
    color: #adb5bd;
    font-size: .8rem;
}

.page a.home-tile--link {
    display: flex;
    align-items: center;
    transition: box-shadow .12s ease;
}

.home-tile--link .home-tile__head {
    flex: 1;
}

.page a.home-tile--link:hover,
.page a.home-tile--link:focus {
    box-shadow: 0 6px 16px rgba(0, 0, 0, .1);
    text-decoration: none;
}

.home-tile--link:hover .home-tile__go {
    color: #007bff;
}

.home-tile__links {
    margin: 10px 0 0 44px;
    padding: 0;
    list-style: none;
}

.page .home-tile__links a {
    display: block;
    padding: 3px 0;
    color: #495057;
    font-size: .875rem;
}

.page .home-tile__links a:hover,
.page .home-tile__links a:focus {
    color: #007bff;
}

@media (max-width: 575.98px) {
    .home-hero__meta {
        flex-direction: row;
        align-items: center;
        width: 100%;
        margin: 12px 0 0;
    }

    .home-hero__date {
        margin: 0 10px 0 0;
    }
}

/*
 * Liste des utilisateurs (templates/Users/index.html.twig).
 */

.users-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.users-head__title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.users-head__count {
    margin: 2px 0 0;
    color: #6c757d;
    font-size: .9rem;
}

.page a.users-head__add {
    margin: 8px 0;
    color: #fff;
}

.users-head__add i {
    margin-right: 6px;
}

.users-alert i {
    margin-right: 6px;
}

/* Onglets de statut et filtres */
.users-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.users-tabs {
    display: inline-flex;
    margin: 0 12px 10px 0;
    padding: 4px;
    border-radius: 10px;
    background: #f1f3f5;
}

.page a.users-tabs__tab {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 7px;
    color: #495057;
    font-size: .9rem;
    font-weight: 500;
    white-space: nowrap;
}

.page a.users-tabs__tab:hover {
    color: #212529;
    text-decoration: none;
}

.page a.users-tabs__tab.is-active {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
    color: #007bff;
}

.users-tabs__count {
    margin-left: 6px;
    padding: 0 7px;
    border-radius: 10px;
    background: rgba(0, 0, 0, .07);
    font-size: .75rem;
    line-height: 1.6;
}

.users-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 10px;
}

.users-filters > * {
    margin: 0 0 0 8px;
}

/* app.css : form label / table { margin… } ; les champs gardent leur largeur ici */
.users-filters__search {
    position: relative;
    margin-left: 0;
}

.users-filters__search i {
    position: absolute;
    top: 50%;
    left: 11px;
    color: #adb5bd;
    transform: translateY(-50%);
    pointer-events: none;
}

.users-filters__search .form-control {
    width: 260px;
    padding-left: 32px;
}

.users-filters__role.form-control {
    width: auto;
}

/* Tableau */
.users-table-wrap {
    border: 1px solid #e3e6ea;
    border-radius: 10px;
    overflow-x: auto;
}

.page table.users-table {
    width: 100%;
    margin: 0;
}

.page table.users-table thead th {
    border-top: 0;
    border-bottom: 1px solid #e3e6ea;
    background: #f8f9fa;
    color: #6c757d;
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* app.css : table { text-transform: uppercase }, cellules en 0.7rem, en-têtes gris foncé */
.page table.users-table,
.page table.users-table td {
    text-transform: none;
}

.page table.users-table td {
    vertical-align: middle;
    border-top: 1px solid #eef0f2;
    font-size: .9rem;
}

.users-table tbody tr:hover {
    background: #f8fafc;
}

.users-table tr.is-inactive td {
    background: #fafafa;
}

.users-table tr.is-inactive .users-name,
.users-table tr.is-inactive .users-email {
    color: #868e96;
}

.users-table tr.is-inactive .users-avatar {
    filter: grayscale(1);
    opacity: .55;
}

.page a.users-name {
    display: inline-flex;
    align-items: center;
    color: #212529;
}

.page a.users-name:hover .users-name__full {
    color: #007bff;
}

.users-avatar {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-right: 12px;
    border-radius: 50%;
    color: #fff;
    font-size: .8rem;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}

.users-name__full {
    display: block;
    font-weight: 600;
    line-height: 1.2;
}

.users-name__title {
    color: #868e96;
}

.users-name__email {
    display: block;
    color: #6c757d;
    word-break: break-all;
}

.users-me {
    margin-left: 8px;
    border: 1px solid #dee2e6;
}

.page a.users-email {
    color: #495057;
    word-break: break-all;
}

.page a.users-email:hover {
    color: #007bff;
}

.users-ip {
    margin-left: 6px;
    color: #adb5bd;
}

.users-role {
    padding: 5px 9px;
    font-weight: 500;
}

.users-status {
    display: inline-flex;
    align-items: center;
    font-size: .875rem;
    font-weight: 500;
    white-space: nowrap;
}

.users-status::before {
    content: "";
    width: 8px;
    height: 8px;
    margin-right: 7px;
    border-radius: 50%;
    background: currentColor;
}

.users-status--on { color: #28a745; }
.users-status--off { color: #868e96; }

.users-actions {
    text-align: right;
    white-space: nowrap;
}

.page a.users-action,
.users-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-left: 2px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: #6c757d;
    cursor: pointer;
}

.page a.users-action:hover,
.users-action:hover,
.users-action:focus {
    border-color: #dee2e6;
    background: #f1f3f5;
    color: #007bff;
    outline: none;
}

.users-action--danger:hover,
.users-action--danger:focus { color: #dc3545; }
.users-action--success:hover,
.users-action--success:focus { color: #28a745; }

.users-empty {
    padding: 40px 20px;
    border: 1px dashed #ced4da;
    border-radius: 10px;
    color: #6c757d;
    text-align: center;
}

.users-empty i {
    margin-bottom: 10px;
    font-size: 2rem;
    opacity: .5;
}

.users-color-name {
    font-weight: 600;
}

@media (max-width: 767.98px) {
    .users-filters {
        width: 100%;
    }

    .users-filters__search {
        flex: 1 1 100%;
        margin-bottom: 8px;
    }

    .users-filters__search .form-control {
        width: 100%;
    }

    .users-filters__role {
        margin-left: 0;
    }

    .users-tabs {
        max-width: 100%;
        overflow-x: auto;
    }
}

.users-color-picker {
    margin-top: 12px;
}

.users-color-picker .colorpicker {
    margin: 0 auto;
}

.users-color-dialog {
    max-width: 340px;
}
