:root {
  --navy: #12304a;
  --navy-dark: #0b2236;
  --blue: #1d638c;
  --gold: #d7a63c;
  --surface: #ffffff;
  --background: #f3f6f8;
  --border: #d9e1e7;
  --text: #17232d;
  --muted: #5d6a74;
  --danger: #a12626;
  --success: #216e45;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; color: var(--text); background: var(--background); }
body { line-height: 1.5; }
a { color: var(--blue); }
button, input, select, textarea { font: inherit; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 100; background: white; padding: .75rem; }
.skip-link:focus { top: 1rem; }
.sr-only { position: absolute; left: 0; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.topbar { min-height: 70px; display: flex; align-items: center; gap: 1rem; padding: .7rem 1.25rem; background: var(--navy); color: white; }
.brand { color: white; text-decoration: none; display: flex; flex-direction: column; min-width: 0; }
.brand strong { letter-spacing: .08em; }
.brand span { color: #dbe7ef; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-summary { margin-left: auto; text-align: right; }
.sidebar-toggle { display: none; border: 1px solid #6f8798; color: white; background: transparent; border-radius: .35rem; padding: .45rem .65rem; }
.app-shell { display: grid; grid-template-columns: 245px minmax(0, 1fr); min-height: calc(100vh - 116px); }
.sidebar { background: var(--navy-dark); padding: 1rem .75rem; }
.sidebar a, .nav-button { display: block; width: 100%; padding: .7rem .8rem; margin-bottom: .25rem; border: 0; border-radius: .35rem; background: transparent; color: #edf5fa; text-decoration: none; text-align: left; cursor: pointer; }
.sidebar a:hover, .sidebar a:focus-visible, .nav-button:hover, .nav-button:focus-visible { background: #193f5d; outline: 2px solid var(--gold); }
.nav-section { border-block: 1px solid rgb(255 255 255 / 12%); margin-block: .45rem; padding-block: .35rem; }
.sidebar .nav-subitem { padding-left: 1.55rem; color: #cddde8; font-size: .92rem; }
.content { min-width: 0; width: 100%; max-width: 1500px; padding: clamp(1rem, 3vw, 2.5rem); }
footer { min-height: 46px; padding: .8rem 1.25rem; color: var(--muted); background: white; border-top: 1px solid var(--border); text-align: center; }
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { margin: .15rem 0; font-size: clamp(1.65rem, 4vw, 2.35rem); }
.eyebrow { margin: 0; color: var(--blue); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: .78rem; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.card, .panel { background: var(--surface); border: 1px solid var(--border); border-radius: .65rem; box-shadow: 0 4px 16px rgb(20 48 70 / 7%); padding: 1.25rem; }
.card strong { display: block; margin: .35rem 0; font-size: 1.2rem; }
.card-label { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
.placeholder { border-style: dashed; }
.work-section { margin-top: 1rem; }
.badge-urgent { background: #f8e8e8; color: var(--danger); }
.muted, .help-text { color: var(--muted); }
.help-text { margin-top: .3rem; font-size: .88rem; }
.narrow { max-width: 720px; }
.split-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.form-row { margin-bottom: 1rem; }
.form-row label { display: block; margin-bottom: .35rem; font-weight: 650; }
.form-row input, .form-row textarea { width: 100%; border: 1px solid #aebbc5; border-radius: .35rem; padding: .65rem .75rem; background: white; }
.form-row select { width: 100%; border: 1px solid #aebbc5; border-radius: .35rem; padding: .65rem .75rem; background: white; }
.form-row ul { list-style: none; margin: .4rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.form-row li label { display: flex; gap: .4rem; align-items: center; padding: .45rem .6rem; border: 1px solid var(--border); border-radius: .35rem; font-weight: 500; }
.form-row li input { width: auto; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { outline: 3px solid rgb(29 99 140 / 25%); border-color: var(--blue); }
.password-control { display: flex; gap: .5rem; }
.password-control button { border: 1px solid var(--border); border-radius: .35rem; background: #edf2f5; padding: .5rem .75rem; }
.button { display: inline-block; border: 1px solid var(--navy); border-radius: .4rem; padding: .6rem .9rem; background: white; color: var(--navy); text-decoration: none; cursor: pointer; }
.button-primary { background: var(--navy); color: white; }
.button-danger { background: var(--danger); border-color: var(--danger); color: white; }
.button-small { padding: .35rem .55rem; font-size: .9rem; }
.full-width { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: .65rem; }
.alert { padding: .8rem 1rem; margin-bottom: 1rem; border-radius: .4rem; background: #e9f1f6; border-left: 4px solid var(--blue); }
.alert-error { color: var(--danger); background: #fff0f0; border-color: var(--danger); }
.alert-success { color: var(--success); background: #edf8f1; border-color: var(--success); }
.field-error { color: var(--danger); display: block; margin-top: .25rem; }
.account-status { display: grid; grid-template-columns: 130px 1fr; margin-top: 0; }
.account-status dt, .account-status dd { padding: .4rem 0; margin: 0; border-bottom: 1px solid var(--border); }
.badges { display: flex; flex-wrap: wrap; gap: .4rem; margin: .6rem 0; }
.badge { display: inline-flex; padding: .25rem .55rem; border-radius: 999px; background: #e4eef4; color: var(--navy); font-size: .82rem; font-weight: 650; }
.status { display: inline-flex; padding: .2rem .5rem; border-radius: 999px; font-size: .82rem; font-weight: 700; }
.status-active { background: #e4f5eb; color: var(--success); }
.status-inactive { background: #f8e8e8; color: var(--danger); }
.status-BROUILLON { background: #e7edf2; color: #354c5e; }
.status-SOUMISE { background: #e3eff8; color: #165a82; }
.status-RECUE { background: #e4f5eb; color: var(--success); }
.status-ACCEPTEE, .status-VALIDEE, .status-DIFFUSEE { background: #e4f5eb; color: var(--success); }
.status-EN_COURS { background: #fff3d6; color: #76530b; }
.status-RESULTATS_DISPONIBLES { background: #eee8ff; color: #563a91; }
.status-ARCHIVEE { background: #e7edf2; color: #354c5e; }
.status-ANNULEE { background: #f8e8e8; color: var(--danger); }
.status-A_RECEPTIONNER { background: #fff3d6; color: #76530b; }
.status-ACCEPTE, .status-ACCEPTE_AVEC_RESERVE, .status-DISPONIBLE_ANALYSE { background: #e4f5eb; color: var(--success); }
.status-REFUSE, .decision-REFUSE { background: #f8e8e8; color: var(--danger); }
.decision-A_EVALUER { background: #e7edf2; color: #354c5e; }
.decision-ACCEPTE { background: #e4f5eb; color: var(--success); }
.decision-ACCEPTE_AVEC_RESERVE { background: #fff3d6; color: #76530b; }
.filters { display: grid; grid-template-columns: minmax(180px, 2fr) minmax(130px, 1fr) minmax(180px, 1fr) auto; gap: .75rem; align-items: end; margin-bottom: 1rem; }
.filters .form-row { margin: 0; }
.table-wrapper { width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: .55rem; background: white; }
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th, td { padding: .75rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { background: #eaf0f4; color: var(--navy); font-size: .88rem; }
.pagination { display: flex; justify-content: center; gap: 1rem; padding: 1rem; }
.form-panel { max-width: 900px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.full-span { grid-column: 1 / -1; }
.danger-zone { max-width: 900px; margin-top: 1rem; border-left: 4px solid var(--danger); }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.detail-grid .panel-wide { grid-column: 1 / -1; }
.definition-list { display: grid; grid-template-columns: minmax(130px, .45fr) 1fr; margin: 0; }
.definition-list dt, .definition-list dd { margin: 0; padding: .45rem 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.definition-list dt { color: var(--muted); font-weight: 650; }
.empty-state { padding: 1rem; color: var(--muted); background: #f7f9fa; border-radius: .4rem; }
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.profile-card h2 { margin-bottom: 0; }
.profile-card ul { padding-left: 1.25rem; }
.error-page { max-width: 650px; text-align: center; margin: 8vh auto; }
.error-code { margin: 0; color: var(--blue); font-size: clamp(4rem, 16vw, 8rem); font-weight: 800; line-height: 1; }
.login-page { display: grid; min-height: 100vh; place-items: center; padding: 1rem; background: linear-gradient(140deg, var(--navy-dark), var(--navy) 55%, #1b5f7e); }
.login-card { width: min(100%, 430px); background: white; border-radius: .75rem; padding: clamp(1.4rem, 5vw, 2.4rem); box-shadow: 0 20px 55px rgb(0 0 0 / 25%); }
.login-heading { border-left: 5px solid var(--gold); padding-left: 1rem; margin-bottom: 1.5rem; }
.login-heading h1 { margin: .25rem 0; font-size: clamp(1.35rem, 6vw, 1.8rem); line-height: 1.2; }
.form-panel fieldset { margin: 0 0 1.25rem; border: 1px solid var(--border); border-radius: .5rem; padding: 1rem; }
.form-panel legend { padding-inline: .5rem; color: var(--navy); font-weight: 750; }
.sample-qr { width: 180px; max-width: 100%; height: auto; }
.timeline { border-left: 3px solid var(--blue); margin-left: .5rem; padding-left: 1.5rem; }
.timeline li { margin-bottom: 1rem; padding-left: .25rem; }
.sample-label { width: 100mm; min-height: 50mm; margin: 1rem auto; border: 1px solid #111; padding: 5mm; background: white; color: #111; }
.sample-label h1 { margin: 2mm 0; font-size: 16pt; }
.sample-label p { margin: 1mm 0; font-size: 9pt; }
.label-brand { font-size: 13pt; }
.label-layout { display: grid; grid-template-columns: 1fr 28mm; gap: 3mm; align-items: center; }
.label-layout .sample-qr { width: 28mm; }

@media (max-width: 800px) {
  .sidebar-toggle { display: inline-block; }
  .user-summary { display: none; }
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .sidebar.is-open { display: block; }
  .cards { grid-template-columns: 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
  .filters, .form-grid, .detail-grid { grid-template-columns: 1fr; }
  .detail-grid .panel-wide { grid-column: auto; }
  .full-span { grid-column: auto; }
  .split-header { align-items: flex-start; flex-direction: column; }
  .content { padding: 1rem; }
}

@media print {
  .topbar, .sidebar, footer, .label-actions { display: none !important; }
  .app-shell, .content { display: block; padding: 0; }
  .sample-label { margin: 0; box-shadow: none; page-break-inside: avoid; }
}

@media (max-width: 420px) {
  .topbar { padding-inline: .7rem; }
  .brand span { max-width: 235px; }
  .password-control { align-items: stretch; flex-direction: column; }
  .account-status { grid-template-columns: 1fr; }
  .account-status dt { border-bottom: 0; padding-bottom: 0; }
}
