body.ms1-login {
    --sidebar-w: 0px;
}

body.ms1-login .ms1-main {
    margin-left: 0;
}

.ms1-login-wrap {
    min-height: calc(100vh - 6rem);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ms1-login-carte {
    width: 22rem;
    padding: 1.6rem 1.5rem 1.4rem;
}

.ms1-login-carte .ms1-mark {
    margin-bottom: 0.9rem;
}

.ms1-login-carte h2 {
    margin: 0 0 0.4rem;
    font-size: 1.45rem;
    letter-spacing: -0.03em;
}

.ms1-login-carte label {
    display: block;
    margin: 0.85rem 0 0.3rem;
    font-size: 0.82rem;
    font-weight: 700;
}

.ms1-login-carte input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 0.55rem;
    padding: 0.55rem 0.7rem;
    font: inherit;
    background: #fff;
    color: var(--text);
}

.ms1-login-carte .ms1-btn {
    margin-top: 1.1rem;
    width: 100%;
    justify-content: center;
}

.ms1-login-erreur {
    margin: 0.6rem 0 0;
    color: var(--red-deep);
    font-weight: 700;
    font-size: 0.88rem;
}

.ms1-choix-vide {
    margin: 0;
    color: var(--muted);
}

.ms1-choix-liste {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: 0.8rem;
}

.ms1-choix-course {
    display: block;
    padding: 1rem 1.1rem;
}

.ms1-choix-course h3 {
    margin: 0;
}

.ms1-creer-course {
    display: flex;
    align-items: flex-end;
    gap: 0.7rem;
    margin: 0 0 1.4rem;
    max-width: 32rem;
}

.ms1-creer-course .ms1-field {
    flex: 1;
}

.ms1-sub a.is-active {
    color: #fff;
    background: var(--red);
}

.ms1-tri-lien.is-actif { color: var(--red-deep); }

.ms1-equipe-ligne td {
    background: #f3ecdf;
    font-weight: 700;
    border-top: 2px solid #cfc6b8;
}

/* Le bouton était en dernière colonne : la carte coupait le débordement
   et le lien sortait de l'écran. Il reste collé à gauche. */
.ms1-classement-carte { overflow: visible; }

.ms1-classement-carte .ms1-tableau {
    max-width: 100%;
    overflow-x: auto;
}

.ms1-classement .ms1-col-modif {
    position: sticky;
    left: 0;
    z-index: 1;
    width: 1%;
    background: var(--card);
    box-shadow: 1px 0 0 var(--line);
    white-space: nowrap;
}

.ms1-classement thead .ms1-col-modif { z-index: 2; }

.ms1-classement .ms1-equipe-ligne .ms1-col-modif { background: #f3ecdf; }

.ms1-modif {
    color: var(--red-deep);
    font-weight: 800;
    text-decoration: underline;
}

.ms1-config {
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
    max-width: 58rem;
}

.ms1-config-bloc {
    background: #fff;
    border: 1px solid #cfc6b8;
    border-radius: 0.85rem;
    overflow: hidden;
    box-shadow: 0 8px 18px rgba(40, 32, 22, 0.06);
}

.ms1-config-bloc > h3 {
    margin: 0;
    padding: 0.72rem 1.15rem;
    background: #2a241e;
    color: #fff;
    font-size: 1rem;
    letter-spacing: -0.01em;
}

.ms1-config-etiquette {
    margin-right: 0.55rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #c8bfb4;
}

.ms1-config-corps { padding: 1.05rem 1.15rem 1.15rem; }

.ms1-config-grille {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    gap: 0.75rem 0.85rem;
}

.ms1-config .ms1-field span {
    display: block;
    margin-bottom: 0.28rem;
    font-size: 0.78rem;
    font-weight: 700;
}

.ms1-config .ms1-field input,
.ms1-config .ms1-field select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 0.55rem;
    padding: 0.5rem 0.65rem;
    font: inherit;
    background: #fff;
    color: var(--text);
}

.ms1-config-fixe {
    margin: 0;
    padding: 0.5rem 0.65rem;
    border: 1px dashed #cfc6b8;
    border-radius: 0.55rem;
    background: #f6f1e8;
    color: var(--text);
    font-weight: 700;
}

.ms1-config-boitiers {
    margin-top: 1rem;
    padding: 0.85rem 0.9rem 0.95rem;
    background: #f6f1e8;
    border: 1px solid #e4d9c8;
    border-radius: 0.7rem;
}

.ms1-config-boitiers h4 {
    margin: 0 0 0.7rem;
    font-size: 0.82rem;
    color: var(--muted);
}

.ms1-config-boitiers .ms1-config-grille + .ms1-config-grille { margin-top: 0.7rem; }

.ms1-field-alarme { grid-column: 1 / -1; }

.ms1-alarme-ligne {
    display: flex;
    gap: 0.45rem;
    align-items: center;
}

.ms1-alarme-ligne input { flex: 1; min-width: 0; }

.ms1-alarme-ligne select { flex: none; width: 7.2rem; }

.ms1-alarme-ligne .ms1-btn {
    flex: none;
    white-space: nowrap;
    padding: 0.5rem 0.75rem;
}

.ms1-config-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 1rem 0 0.2rem;
}

.ms1-temps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    max-width: 76rem;
}

.ms1-temps-bloc {
    background: #1e3a5f;
    color: #fff;
    border-radius: 0.85rem;
    padding: 1rem 1.1rem 1.15rem;
    min-height: 8.5rem;
}

.ms1-temps-bloc h3 {
    margin: 0 0 0.8rem;
    font-size: 0.95rem;
    font-weight: 700;
}

.ms1-temps-traitement h3 { margin-bottom: 0.35rem; }

.ms1-temps-chiffres {
    margin: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    line-height: 1;
}

.ms1-temps-jour {
    margin: 0.55rem 0 0;
    color: #d6e4f5;
    font-size: 0.85rem;
}

.ms1-trait-voyant {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0 0 0.45rem;
}
.ms1-log-btn {
    border: 0;
    background: transparent;
    color: #d6e4f5;
    height: 1.7rem;
    border-radius: 0.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    cursor: pointer;
    padding: 0 0.35rem;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 800;
}
.ms1-log-btn svg { width: 1rem; height: 1rem; }
.ms1-log-btn:hover { background: rgba(255, 255, 255, 0.14); }
.ms1-log {
    border: 0;
    padding: 0;
    background: transparent;
    max-width: calc(100vw - 2rem);
}
.ms1-log::backdrop { background: rgba(18, 20, 26, 0.45); }
.ms1-log-carte {
    width: min(32rem, calc(100vw - 2rem));
    background: #fff;
    color: var(--text);
    border-radius: 0.9rem;
    padding: 0.9rem 1rem 1rem;
    box-shadow: 0 18px 40px rgba(18, 20, 26, 0.22);
}
.ms1-log-entete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}
.ms1-log-entete h3 { margin: 0; font-size: 1.05rem; }
.ms1-log-fermer {
    border: 0;
    background: var(--paper);
    color: var(--text);
    border-radius: 0.45rem;
    padding: 0.3rem 0.6rem;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}
.ms1-log-liste {
    max-height: 60vh;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.ms1-log-ligne {
    border: 1px solid var(--line);
    border-radius: 0.65rem;
    padding: 0.55rem 0.7rem;
}
.ms1-log-ligne strong { display: block; }
.ms1-log-ligne p {
    margin: 0.12rem 0 0;
    font-size: 0.86rem;
    font-variant-numeric: tabular-nums;
}
.ms1-log-vide { margin: 0; color: var(--muted); }
.ms1-voyant {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    color: #f0c7c4;
    font-size: 0.92rem;
    font-weight: 800;
}

.ms1-voyant::before {
    content: "";
    width: 0.72rem;
    height: 0.72rem;
    border-radius: 50%;
    background: #d45b54;
    flex: 0 0 auto;
}
.ms1-voyant.is-on { color: #b7e4c7; }
.ms1-voyant.is-on::before { background: #3ddc97; }
.ms1-trait-raison { margin: 0 0 0.45rem; color: #f0c7c4; font-size: 0.85rem; }
.ms1-trait-repartir { margin: 0 0 0.5rem; }
.ms1-trait-repartir button {
    border: 0;
    border-radius: 0.45rem;
    padding: 0.35rem 0.6rem;
    background: #fff;
    color: #1e3a5f;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
}

.ms1-trait-ligne {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin: 0.2rem 0 0;
    font-size: 0.84rem;
    line-height: 1.3;
}

.ms1-trait-ligne span { color: #d6e4f5; }
.ms1-trait-ligne strong { font-weight: 800; text-align: right; }

@media (max-width: 1100px) {
    .ms1-temps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 800px) {
    .ms1-temps { grid-template-columns: 1fr; }
}

.ms1-ctrl { max-width: 76rem; margin-top: 1.4rem; }
.ms1-ctrl > h3 { margin: 0 0 0.8rem; font-size: 1.05rem; }
.ms1-ctrl-grille {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
}
.ms1-ctrl-carte {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 0.85rem;
    padding: 0.9rem 1rem 1rem;
}
.ms1-ctrl-nom { margin: 0 0 0.7rem; font-weight: 800; font-size: 1.15rem; }
.ms1-ctrl-machine + .ms1-ctrl-machine {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--line);
}
.ms1-ctrl-numero {
    margin: 0 0 0.35rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: var(--text);
    font-weight: 700;
}
.ms1-ctrl-role {
    font-family: inherit;
    font-weight: 700;
    color: var(--muted);
}
.ms1-ctrl-lien {
    margin-left: 0.35rem;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #9a3412;
}
.ms1-ctrl-lien.is-on { color: #166534; }
.ms1-ctrl-noms { margin: 0 0 0.6rem; padding-left: 1.1rem; color: var(--text); }
.ms1-ctrl-compte { margin: 0.2rem 0; font-size: 1.15rem; font-weight: 800; }
.ms1-ctrl-ligne { margin: 0.15rem 0; }
.ms1-ctrl-btn {
    margin-top: 0.7rem;
    border: 0;
    border-radius: 0.55rem;
    padding: 0.45rem 0.75rem;
    background: var(--red);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.ms1-ctrl-liste { margin: 0.7rem 0 0; padding-left: 1.2rem; }
.ms1-ctrl-liste li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1.25rem;
    margin: 0.2rem 0;
}
.ms1-ctrl-heure { font-variant-numeric: tabular-nums; }
.ms1-ctrl-puce {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.ms1-sub form { margin: 0; }
.ms1-sub form button { width: 100%; font: inherit; font-size: 0.82rem; }
.ms1-zero-note { max-width: 58rem; margin: 0.8rem 0 0; }
.ms1-config-lisible {
    max-width: 58rem;
    margin-top: 1.2rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 0.85rem;
    padding: 0.8rem 1rem 1rem;
}
.ms1-config-lisible summary { cursor: pointer; font-weight: 800; }
.ms1-config-lisible p, .ms1-config-lisible li { line-height: 1.45; }
.ms1-config-lisible h4 { margin: 1rem 0 0.3rem; }
@media (max-width: 800px) {
    .ms1-ctrl-grille { grid-template-columns: 1fr; }
}

/* Carte ratissée : 1, puis 2, puis 3 de large selon la place. Jamais plus de 3. */
.ms1-ctrl-v2 {
    max-width: none;
    container-type: inline-size;
}
.ms1-ctrl-v2 .ms1-ctrl-grille {
    grid-template-columns: 1fr;
    gap: 0.65rem;
}
@container (min-width: 40rem) {
    .ms1-ctrl-v2 .ms1-ctrl-grille { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container (min-width: 60rem) {
    .ms1-ctrl-v2 .ms1-ctrl-grille { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.ms1-ctrl-v2 .ms1-ctrl-carte {
    border: 1px solid #e6e8ee;
    border-radius: 0.85rem;
    box-shadow: 0 8px 22px rgba(24, 24, 27, 0.06);
    padding: 0.55rem 0.6rem 0.35rem;
    background: #f7f8fb;
    min-width: 0;
}
.ms1-ctrl-v2 .ms1-ctrl-nom {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin: 0 0.15rem 0.55rem;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}
.ms1-ctrl-montagne {
    width: 1.55rem;
    height: 1.55rem;
    color: #3a8715;
    flex: 0 0 auto;
}
.ms1-ctrl-filet {
    width: 2px;
    height: 1.35rem;
    background: #c5c9d2;
    flex: 0 0 auto;
}
.ms1-ctrl-v2 .ms1-ctrl-machine {
    border-left: 5px solid #ea8819;
    padding: 0.42rem 0.15rem 0.48rem 0.7rem;
}
.ms1-ctrl-v2 .ms1-ctrl-machine.is-on { border-left-color: #53b00c; }
.ms1-ctrl-v2 .ms1-ctrl-machine + .ms1-ctrl-machine {
    margin-top: 0.15rem;
    padding-top: 0.5rem;
    border-top: 1px solid #dee1e8;
}
.ms1-ctrl-haut,
.ms1-ctrl-bas {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}
.ms1-ctrl-haut { flex-wrap: wrap; }
.ms1-ctrl-bas { margin-top: 0.32rem; color: #57534e; flex-wrap: wrap; row-gap: 0.25rem; }
.ms1-ctrl-v2 .ms1-ctrl-numero {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 800;
    color: #1c1917;
    white-space: nowrap;
}
.ms1-ctrl-v2 .ms1-ctrl-role {
    font-size: 0.78rem;
    font-weight: 700;
    color: #555962;
    background: #e0e3e8;
    border: 0;
    border-radius: 0.4rem;
    padding: 0.12rem 0.45rem;
}
.ms1-ctrl-v2 .ms1-ctrl-lien {
    margin: 0 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    background: #c65c00;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.ms1-ctrl-v2 .ms1-ctrl-lien.is-on { background: #3a8715; color: #fff; }
.ms1-ctrl-point {
    width: 0.42rem;
    height: 0.42rem;
    border-radius: 50%;
    background: #fff;
    flex: 0 0 auto;
}
.ms1-ctrl-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    font-size: 0.74rem;
    color: #44403c;
    white-space: nowrap;
}
.ms1-ctrl-ico {
    width: 0.95rem;
    height: 0.95rem;
    color: #6d727c;
    flex: 0 0 auto;
}
.ms1-ctrl-sep {
    width: 1px;
    height: 1rem;
    background: #c5c9d2;
    flex: 0 0 auto;
}
.ms1-ctrl-v2 .ms1-ctrl-btn {
    margin: 0 0 0 auto;
    width: 1.7rem;
    height: 1.7rem;
    padding: 0;
    border-radius: 999px;
    background: #fff;
    color: #78716c;
    border: 1px solid #e7e5e4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.ms1-ctrl-v2 .ms1-ctrl-btn .ms1-ctrl-ico { width: 1.05rem; height: 1.05rem; }
.ms1-ctrl-v2 .ms1-ctrl-btn[aria-expanded="true"] {
    background: #f5f5f4;
    color: #1c1917;
}
.ms1-ctrl-v2 .ms1-ctrl-liste { margin: 0.45rem 0 0.2rem 0.2rem; }

.ms1-correction-choix { max-width: 24rem; margin-bottom: 1rem; }
.ms1-correction-choix select,
.ms1-correction-ligne select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 0.55rem;
    padding: 0.5rem 0.65rem;
    font: inherit;
    background: #fff;
}
.ms1-correction-table { display: flex; flex-direction: column; gap: 0.45rem; max-width: 58rem; margin-bottom: 1rem; }
.ms1-correction-ligne {
    display: grid;
    grid-template-columns: 6rem 6rem 5rem minmax(6rem, 1fr) auto auto;
    gap: 0.45rem;
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 0.7rem;
    padding: 0.55rem 0.7rem;
}
.ms1-correction-bloc { max-width: 58rem; margin-bottom: 1rem; }
.ms1-import-bloc { max-width: 58rem; margin-bottom: 1rem; }
.ms1-import select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 0.55rem;
    padding: 0.5rem 0.65rem;
    font: inherit;
    background: #fff;
}
@media (max-width: 800px) {
    .ms1-correction-ligne { grid-template-columns: 1fr 1fr; }
}

.ms1-puces-cartes {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.ms1-puces-carte {
    background: #1e3a5f;
    color: #fff;
    border-radius: 0.85rem;
    padding: 1rem 1.1rem 1.15rem;
    min-width: 14rem;
}

.ms1-puces-carte span {
    display: block;
    margin-bottom: 0.45rem;
    font-size: 0.92rem;
}

.ms1-puces-carte strong {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: 0.03em;
}

.ms1-puces-carte p {
    margin: 0.45rem 0 0;
    min-height: 1.2rem;
    color: #d6e4f5;
    font-size: 0.92rem;
}

.ms1-puces-barre,
.ms1-puces-bbk {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.ms1-puces-barre[hidden],
.ms1-puces-bbk[hidden] { display: none !important; }

.ms1-puces-barre input {
    width: min(100%, 18rem);
    border: 1px solid var(--line);
    border-radius: 0.55rem;
    padding: 0.55rem 0.7rem;
    font: inherit;
    font-size: 1.05rem;
    background: #fff;
}

.ms1-puces-bbk { margin-top: 0.8rem; }

.ms1-puces-bbk p {
    margin: 0 0.4rem 0 0;
    font-weight: 700;
}

.ms1-puces-log {
    margin-top: 1rem;
    max-width: 42rem;
    min-height: 8rem;
    max-height: 16rem;
    overflow: auto;
    background: #e7f3fb;
    border: 1px solid #c5d9ea;
    border-radius: 0.75rem;
    padding: 0.6rem 0.8rem;
}

.ms1-puces-log p {
    margin: 0.15rem 0;
    font-size: 0.92rem;
}

.ms1-puces-rapport { margin-bottom: 1rem; }

.ms1-puces-serie { max-width: 42rem; }

.ms1-puces-liste { max-width: 42rem; margin-top: 1.2rem; }

.ms1-puces-liste h3 { margin: 0 0 0.6rem; }

.ms1-puces-serie textarea {
    width: 100%;
    min-height: 9rem;
    border: 1px solid var(--line);
    border-radius: 0.55rem;
    padding: 0.75rem 0.85rem;
    font: inherit;
    font-size: 1.05rem;
    line-height: 1.45;
    resize: vertical;
    background: #fff;
}

.ms1-puces-creee {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    max-width: 42rem;
    margin: 0 0 0.4rem;
    padding: 0.45rem 0.7rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 0.65rem;
}

.ms1-puces-creee strong {
    font-variant-numeric: tabular-nums;
}

.ms1-puces-bande td { background: #f4e2b0; }

.ms1-validation-choix { max-width: 36rem; }

.ms1-validation { font-variant-numeric: tabular-nums; }

.ms1-validation th,
.ms1-validation td {
    padding: 0.4rem 0.65rem;
    white-space: nowrap;
}

.ms1-validation td:nth-child(6),
.ms1-validation td:nth-child(7) { white-space: normal; }

.ms1-validation tbody td { background: var(--fond, #fff); }

.ms1-validation tr.is-rejet td { background: #ff4d4d; }

.ms1-validation tr.is-ajout td { background: #e69900; }

.ms1-validation tr.is-lecture td { background: #FFF8DC; }
