* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f4f5f7;
    color: #1f2933;
    font-family: Arial, sans-serif;
}

.topbar {
    align-items: center;
    background: #24313f;
    color: #fff;
    display: flex;
    gap: 20px;
    justify-content: space-between;
    padding: 10px 18px;
}

.topbar h1 {
    font-size: 20px;
    margin: 0;
}

.toolbar,
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

button {
    background: #fff;
    border: 1px solid #aab4c0;
    border-radius: 4px;
    cursor: pointer;
    font: inherit;
    padding: 7px 10px;
}

button:hover,
button.active,
.tab.active {
    background: #dbeafe;
    border-color: #3b82f6;
}

.tabs {
    background: #fff;
    border-bottom: 1px solid #d5dae1;
    padding: 10px;
}

.tab-content {
    display: none;
    padding: 18px;
}

.tab-content.active {
    display: block;
}

table {
    background: #fff;
    border-collapse: collapse;
}

th,
td {
    border: 1px solid #c4cbd3;
    padding: 6px 8px;
    text-align: left;
    vertical-align: middle;
}

th {
    background: #e7ebf0;
    font-weight: 700;
}

.right {
    text-align: right;
}

#ecran-sv-container {
    display: flex;
    justify-content: center;
    overflow-x: auto;
    width: 100%;
}

.ecran-sv-table {
    max-width: 95vw;
    table-layout: auto;
    width: auto;
}

.ecran-sv-table th,
.ecran-sv-table td {
    font-size: 12px;
    padding: 4px 6px;
    white-space: nowrap;
}

.ecran-sv-table th.right,
.ecran-sv-table td.right {
    min-width: 44px;
}

.ecran-sv-table .label-cell {
    max-width: 360px;
    min-width: 230px;
}

.group-row td {
    background: #7f7f7f;
    border-color: #242424;
    color: #111;
    font-weight: 700;
    text-transform: uppercase;
}

.article-row td {
    background: #fff;
}

.action-cell {
    cursor: pointer;
}

.action-cell:hover {
    background: #eef6ff;
}

.label-cell {
    background: #fff300 !important;
    font-weight: 700;
}

.reference-cell {
    cursor: pointer;
}

.reference-cell:hover {
    outline: 2px solid #4f7db8;
    outline-offset: -2px;
}

.metric-cell {
    border-color: #242424;
    font-weight: 700;
}

.col-afaire {
    background: #005ca8 !important;
    color: #ffe54f;
}

.col-produit {
    background: #00a884 !important;
    color: #fff;
}

.col-vendu {
    background: #ffe66b !important;
    color: #111;
}

.col-stock {
    background: #b9d9a6 !important;
    color: #111;
}

.col-cteur {
    background: #f3d58a !important;
    color: #111;
}

.sortable-header {
    padding: 0;
}

.sort-button {
    background: transparent;
    border: 0;
    border-radius: 0;
    display: block;
    font-weight: 700;
    height: 100%;
    padding: 5px 7px;
    text-align: inherit;
    width: 100%;
}

.sort-button:hover {
    background: #dbeafe;
}

.slot-ok {
    background: #bbf7d0 !important;
}

.slot-partial {
    background: #fed7aa !important;
}

.debug-table {
    min-width: 100%;
}

.debug-table th,
.debug-table td {
    font-size: 12px;
    white-space: nowrap;
}

#modal-overlay {
    align-items: center;
    background: rgba(20, 30, 45, .45);
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 20px;
    position: fixed;
}

#modal {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 20px 45px rgba(15, 23, 42, .22);
    max-width: 520px;
    padding: 18px;
    width: 100%;
}

#modal:has(.details-modal) {
    max-width: 900px;
}

.hidden {
    display: none !important;
}

.production-form {
    display: grid;
    gap: 12px;
}

.production-form h2 {
    font-size: 18px;
    margin: 0;
}

.production-form label {
    display: grid;
    font-size: 13px;
    gap: 4px;
}

.production-form input,
.production-form select {
    border: 1px solid #b8c0cc;
    border-radius: 4px;
    font: inherit;
    padding: 8px;
    width: 100%;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.details-modal {
    display: grid;
    gap: 14px;
}

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

.details-header h2 {
    font-size: 18px;
    margin: 0;
}

.details-table-wrap {
    max-height: 70vh;
    overflow: auto;
}

.details-table {
    min-width: 760px;
    width: 100%;
}

.details-table th,
.details-table td {
    font-size: 12px;
}

.client-colors-form {
    display: grid;
    gap: 14px;
}

.color-list {
    display: grid;
    gap: 8px;
    max-height: 65vh;
    overflow: auto;
}

.color-row {
    align-items: center;
    border: 1px solid #d5dae1;
    border-radius: 4px;
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr 56px;
    padding: 8px;
}

.legend-button {
    background: transparent;
    border: 0;
    display: flex;
    justify-content: space-between;
    padding: 0;
    text-align: left;
}

.legend-button span {
    color: #64748b;
    font-size: 12px;
}

.color-row input {
    border: 0;
    height: 30px;
    padding: 0;
    width: 50px;
}

.legend-references-form {
    display: grid;
    gap: 14px;
}

.legend-reference-list {
    display: grid;
    gap: 6px;
    max-height: 68vh;
    overflow: auto;
}

.legend-reference-row {
    align-items: center;
    border: 1px solid #d5dae1;
    border-radius: 4px;
    display: grid;
    gap: 4px 10px;
    grid-template-columns: 18px 1fr;
    padding: 7px;
}

.legend-reference-row input {
    grid-row: span 2;
}

.legend-reference-row small {
    color: #64748b;
    grid-column: 2;
}

.app-error {
    background: #fff1f2;
    border: 1px solid #fb7185;
    border-radius: 6px;
    color: #9f1239;
    max-width: 760px;
    padding: 14px;
}
