:root {
    color-scheme: light;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #19282a;
    background: #f4f6f3;
    --ink: #19282a;
    --muted: #526365;
    --border: #dce4df;
    --sidebar: #172225;
    --accent: #f6be63;
    --teal: #236858;
    --radius: 12px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 300px; }
a { color: inherit; }
button, input, select { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #529a86; outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.8rem, 3.8vw, 2.6rem); line-height: 1.13; letter-spacing: -.045em; }
h2 { font-size: 1.12rem; line-height: 1.35; letter-spacing: -.02em; }

.layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100vh; }
.sidebar { display: flex; flex-direction: column; align-self: start; position: sticky; top: 0; min-height: 100vh; padding: 29px 16px 20px; color: #f5f7f5; background: var(--sidebar); }
.brand { display: grid; justify-items: start; gap: 9px; padding: 0 8px 30px; font-weight: 760; font-size: 1.24rem; text-decoration: none; }
.sidebar nav { display: grid; gap: 5px; }
.sidebar nav a { border-radius: 7px; padding: 11px 10px; font-size: .88rem; line-height: 1.45; text-decoration: none; color: #d7e0dd; }
.sidebar nav a:hover { background: #243537; }
.sidebar nav a[aria-current] { color: #fff; background: #293a3b; box-shadow: inset 3px 0 var(--accent); }
.account { display: grid; gap: 8px; margin-top: auto; border-top: 1px solid #374548; padding: 16px 8px 0; font-size: .78rem; color: #c7d6d3; overflow-wrap: anywhere; }
.logout { color: #edf5f2; border: none; background: none; padding: 0; text-decoration: underline; font-size: .82rem; }
.content { width: 100%; max-width: 1440px; padding: clamp(20px, 4vw, 55px); }
.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 23px; }
.page-header p { margin-top: 8px; color: var(--muted); }
.back { display: inline-block; margin-bottom: 18px; color: var(--teal); text-decoration: none; font-size: .9rem; font-weight: 650; }
.back:hover { text-decoration: underline; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid #bfcbc5; min-height: 41px; padding: 8px 13px; border-radius: 7px; background: #fff; color: var(--ink); text-decoration: none; font-weight: 700; font-size: .86rem; white-space: nowrap; }
.button:hover { border-color: #5e7b72; background: #edf3ee; }
.button.primary { background: var(--accent); border-color: var(--accent); color: #30200e; }
.button.primary:hover { background: #f2ae48; border-color: #f2ae48; }
.text-button { color: var(--teal); background: none; border: 0; padding: 0; font-size: .84rem; font-weight: 650; text-decoration: underline; text-underline-offset: 2px; }
.text-button:disabled { opacity: .55; cursor: wait; }
.refresh { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; color: var(--muted); margin: 0 0 14px; font-size: .81rem; }

.panel { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 18px; }
.padded { padding: clamp(15px, 3vw, 24px); }
.padded > h2 { margin-bottom: 18px; }
.form-panel { max-width: 560px; }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 13px; padding: 16px; }
.filters label { flex: 1 1 130px; }
.filters > a { align-self: center; margin: 14px 0 0; }
label { display: grid; gap: 6px; min-width: 0; color: #33474a; font-size: .82rem; font-weight: 670; }
input, select { width: 100%; min-height: 41px; background: #fff; color: var(--ink); border: 1px solid #bfcbc5; border-radius: 7px; padding: 7px 10px; }
input[type="hidden"] { display: none; }
.stack { display: grid; gap: 14px; }
.inline-form { display: flex; gap: 9px; align-items: end; }
.inline-form label { flex: 1; }
.site-readonly { display: grid; gap: 5px; font-size: .9rem; }

.stage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(99px, 1fr)); gap: 10px; margin: 0 0 22px; }
.stage-card { display: grid; gap: 5px; align-content: start; padding: 13px 11px; min-height: 105px; background: #fff; border: 1px solid var(--border); border-radius: 9px; text-decoration: none; color: var(--muted); font-size: .77rem; }
.stage-card strong { color: var(--ink); font-size: 1.55rem; line-height: 1.1; letter-spacing: -.04em; }
.stage-card:hover, .stage-card[aria-current] { border-color: var(--teal); background: #e9f2ec; }
.stage-dot { width: 8px; height: 8px; display: inline-block; border-radius: 50%; background: currentColor; }
.dot-demande, .status-demande { color: #4b5c6b; --badge: #ecf0f3; }
.dot-imbrication, .status-imbrication { color: #634387; --badge: #f2eafa; }
.dot-decoupe, .status-decoupe { color: #254f9c; --badge: #e9effd; }
.dot-pliage, .status-pliage { color: #8b5018; --badge: #fbf0df; }
.dot-pliage_en_cours, .status-pliage_en_cours { color: #385582; --badge: #e5eefc; }
.dot-a_expedier, .status-a_expedier { color: #6d5820; --badge: #f7f1d8; }
.dot-expedie, .status-expedie { color: #20675e; --badge: #e5f4f1; }
.dot-recu, .status-recu { color: #2c632e; --badge: #e8f3e5; }
.status { display: inline-flex; align-items: center; gap: 7px; border-radius: 20px; padding: 4px 9px; background: var(--badge); white-space: nowrap; font-size: .78rem; font-weight: 650; }

.list-title { display: flex; justify-content: space-between; align-items: center; padding: 17px 20px; gap: 10px; }
.list-title span, .empty { color: var(--muted); font-size: .86rem; }
.empty { border-top: 1px solid var(--border); padding: 30px 20px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-spacing: 0; border-collapse: collapse; text-align: left; font-size: .87rem; }
thead { background: #f0f4f1; font-size: .78rem; color: #455b55; }
th, td { padding: 12px clamp(12px, 2vw, 20px); border-top: 1px solid var(--border); }
tbody tr:hover { background: #f9faf8; }
.reference { font-weight: 750; color: var(--teal); text-underline-offset: 3px; white-space: nowrap; }
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; padding: 16px; border-top: 1px solid var(--border); font-size: .86rem; }

.progress { display: flex; flex-wrap: wrap; gap: 10px 20px; list-style: none; margin: 0 0 22px; padding: 0; }
.progress li { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .86rem; }
.step-marker { display: grid; place-items: center; width: 23px; height: 23px; border-radius: 50%; border: 1px solid var(--border); }
.complete .step-marker { color: var(--teal); background: #e5f2ec; border-color: #e5f2ec; }
.progress .current { color: var(--ink); font-weight: 750; }
.current .step-marker { border: 7px solid var(--accent); }
.notice { border: 1px solid #badacc; background: #e9f5ed; padding: 11px 14px; border-radius: 7px; margin-bottom: 15px; color: #235c44; }
.notice.warning { border-color: #f1d192; color: #7e4c16; background: #fff4df; }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.account-actions form { margin-bottom: 5px; }
.account-actions details { min-width: 160px; }
.account-actions summary { font-size: .82rem; color: var(--teal); cursor: pointer; }
.account-actions details form { margin-top: 10px; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(410px, 100%); padding: clamp(22px, 5vw, 35px); }
.login-brand { display: grid; justify-items: center; gap: 18px; margin-bottom: 24px; }

@media (max-width: 850px) {
    .layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
    .sidebar { display: grid; align-items: center; grid-template-columns: 1fr auto; gap: 10px; position: static; min-height: auto; padding: 12px 18px; }
    .brand { padding: 0; }
    .sidebar nav { display: flex; flex-wrap: wrap; grid-column: 1 / -1; grid-row: 2; }
    .sidebar nav a { padding: 7px 10px; }
    .account { max-width: 44vw; margin: 0; border: 0; padding: 0; text-align: right; }
}
@media (max-width: 630px) {
    .admin-grid { grid-template-columns: 1fr; gap: 0; }
    .stage-grid { grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); }
    .filters > a { margin: 0; }
    .content { padding: 17px; }
}

.week-cell { white-space: nowrap; }
.overdue { display: inline-block; padding: 3px 7px; border-radius: 5px; color: #922c22; background: #fbece8; font-size: .74rem; font-weight: 700; }
.week-cell .overdue { display: table; margin-top: 4px; }
.cutting-label { display: block; margin-top: 5px; color: var(--muted); }
.order-meta { display: flex; flex-wrap: wrap; gap: 12px 25px; margin: 0 0 20px; }
.order-meta dt, .field-help { color: var(--muted); font-size: .82rem; }
.order-meta dd { margin: 4px 0 0; font-weight: 650; }
.stage-action { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; }
.stage-action label { flex: 0 1 240px; }
.stage-action .button { white-space: normal; text-align: left; }
.planning-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 12px; max-width: 500px; }
.stage-card { overflow-wrap: anywhere; }

.brand-mark { display: block; position: relative; overflow: hidden; width: min(100%, 182px); aspect-ratio: 360 / 94; border-radius: 6px; background: #fcfcfc; }
.brand-mark img { position: absolute; width: 155.28%; max-width: none; height: auto; top: -111.7%; left: -22.78%; }
.login-brand .brand-mark { width: min(100%, 260px); }
.login-code { letter-spacing: .14em; }
.access-code { display: grid; gap: 7px; }
.access-code code { color: var(--ink); font-size: 1.35rem; font-weight: 750; letter-spacing: .08em; }
.access-code p { font-size: .85rem; }

.login-install { display: grid; gap: 10px; border-top: 1px solid var(--border); margin-top: 20px; padding-top: 14px; }
.login-install summary { color: var(--teal); font-size: .83rem; cursor: pointer; }
.login-install ol { display: grid; gap: 9px; margin: 10px 0 0; padding-left: 1.3rem; color: var(--muted); font-size: .82rem; line-height: 1.5; }

.press-brake-form { border-top: 1px solid var(--border); margin-top: 18px; padding-top: 16px; }
