/* Variables de charte : injectées par ThemeService (--primary, --sidebar, --accent, --success, --error, --font, --radius, --density, --bg, --surface, --text, --muted, --border) */
:root { --primary:#1F5FBF; --sidebar:#0F2A4A; --accent:#E8A33D; --success:#1E7B4F; --error:#B3261E; --radius:8px; --density:1; --bg:#F4F6FA; --surface:#fff; --text:#14213D; --muted:#5B6B82; --border:#DDE3EC; --font:Inter,system-ui,sans-serif; }
* { box-sizing: border-box; }
body { margin:0; font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
a { color: var(--primary); font-weight: 600; text-decoration: none; } a:hover { text-decoration: underline; }
h1 { margin:0; font-size:24px; font-weight:700; } h2 { margin:0; font-size:16px; font-weight:600; }
p { margin: 4px 0 12px; } .muted { color: var(--muted); } .nowrap { white-space: nowrap; } .num { text-align:right; } .grow { flex:1; } .grow2 { flex: 2 1 320px; }
.shell { display:flex; min-height:100vh; }
.sidebar { flex:0 0 240px; background: var(--sidebar); color:#fff; display:flex; flex-direction:column; padding-bottom: 8px; position:sticky; top:0; height:100vh; overflow-y:auto; }
.logo-zone { margin:24px 24px 8px; min-height:56px; display:flex; align-items:center; justify-content:flex-start; }
.logo-zone img { max-width:160px; max-height:56px; object-fit:contain; } .logo-fallback { font-size:18px; font-weight:700; }
.tagline { padding:0 24px 8px; font-size:12px; color:#A9BAD3; }
.nav-group { padding:16px 24px 6px; font-size:11px; letter-spacing:.08em; color:#A9BAD3; font-weight:600; }
.nav-link { display:block; margin:2px 8px; padding: calc(12px * var(--density)) 16px; border-radius: var(--radius); color:#fff; font-weight:500; text-decoration:none; }
.nav-link:hover { background: rgba(255,255,255,.08); text-decoration:none; } .nav-link.active { background: rgba(255,255,255,.16); font-weight:600; }
.user-box { padding:16px 24px; border-top:1px solid rgba(255,255,255,.16); } .user-name { font-weight:600; } .user-role { font-size:12px; color:#A9BAD3; margin:2px 0 8px; }
.btn-link { background:none; border:0; color:#fff; padding:0; font:600 13px var(--font); cursor:pointer; text-decoration:underline; }
.content { flex:1; min-width:0; padding:32px 40px; }
.banner { display:block; width:100%; max-height:160px; object-fit:cover; border-radius: var(--radius); margin-bottom:24px; }
.page-head { display:flex; flex-wrap:wrap; gap:16px; align-items:center; justify-content:space-between; margin-bottom:24px; }
.card { background: var(--surface); border:1px solid var(--border); border-radius: var(--radius); padding: calc(24px * var(--density)); margin-bottom:24px; }
.card.flush { padding:0; overflow:hidden; } .card-head { padding:24px 24px 0; } .pad { padding:24px; } .empty { padding:24px; color: var(--muted); margin:0; }
.grid-3 { display:grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap:16px; margin-bottom:24px; } .grid-3 .card { margin-bottom:0; }
.grid-2 { display:grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap:24px; }
.btn { display:inline-flex; align-items:center; justify-content:center; min-height:44px; padding:0 24px; border-radius: var(--radius); font:600 14px var(--font); cursor:pointer; border:1px solid transparent; text-decoration:none; }
.btn:hover { text-decoration:none; filter:brightness(.96); } .btn:disabled { opacity:.5; cursor:not-allowed; }
.btn-primary { background: var(--primary); color:#fff; border-color: var(--primary); } .btn-secondary { background: var(--surface); color: var(--text); border-color:#B8C3D4; }
.btn-danger { background: var(--surface); color: var(--error); border-color: var(--error); } .btn-ok { background: var(--success); color:#fff; border-color: var(--success); } .full { width:100%; }
.actions { display:flex; flex-wrap:wrap; gap:12px; margin-top:16px; }
.field { display:block; font-size:13px; font-weight:600; flex:1 1 220px; min-width:0; } .field > span { display:block; margin-bottom:6px; }
.input { display:block; width:100%; height:44px; padding:0 12px; border:1px solid #B8C3D4; border-radius: var(--radius); font:400 14px var(--font); color: var(--text); background: var(--surface); }
textarea.input { height:auto; padding:12px; line-height:1.5; } .input:focus-visible, .btn:focus-visible, a:focus-visible { outline:3px solid #8FB4F0; outline-offset:2px; }
.check { display:flex; align-items:center; gap:10px; font-weight:500; min-height:44px; } .check input { width:20px; height:20px; }
.form-row { display:flex; flex-wrap:wrap; gap:16px; margin-bottom:16px; } .filters { display:flex; flex-wrap:wrap; gap:16px; margin-bottom:16px; align-items:flex-end; }
.hint { font-size:12px; color: var(--muted); font-weight:400; margin-top:4px; }
.table-wrap { overflow-x:auto; } .table { border-collapse:collapse; width:100%; min-width:720px; }
.table th { text-align:left; padding:12px 16px; font-size:12px; font-weight:600; color: var(--muted); border-bottom:1px solid var(--border); white-space:nowrap; }
.table td { padding: calc(12px * var(--density)) 16px; border-bottom:1px solid #EAEEF4; vertical-align:middle; } .table tr:nth-child(even) td { background: color-mix(in srgb, var(--bg) 40%, var(--surface)); }
.badge { display:inline-block; padding:4px 12px; border-radius:999px; font-size:12px; font-weight:600; line-height:16px; white-space:nowrap; }
.badge-info { background:#E6EFFC; color:#174A94; } .badge-ok { background:#E3F4EB; color:#14603C; } .badge-warn { background:#FFF1D6; color:#7A4500; }
.badge-err { background:#FDECEA; color:#8F1D17; } .badge-mute { background:#EDF0F5; color:#42526B; }
.alert { border-radius: var(--radius); padding:16px 24px; margin-bottom:24px; border:1px solid; } .alert ul { margin:0; padding-left:20px; }
.alert-error { background:#FDECEA; border-color:#E5A29D; color:#8F1D17; } .alert-warn { background:#FFF1D6; border-color:#E8C47A; color:#5C3600; } .alert-ok { background:#E3F4EB; border-color:#9AD2B3; color:#14603C; }
.row-between { display:flex; flex-wrap:wrap; gap:16px; align-items:center; justify-content:space-between; }
.kv { display:grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap:16px; } .kv .k { font-size:12px; color: var(--muted); font-weight:500; } .kv .v { margin-top:4px; }
.steps { list-style:none; margin:0; padding:0; } .steps li { display:flex; gap:16px; align-items:flex-start; padding:12px 0; border-bottom:1px solid #EAEEF4; } .steps li:last-child { border:0; }
.step-no { flex:0 0 28px; height:28px; border-radius:50%; background:#EDF0F5; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:13px; } .step-active .step-no { background: var(--primary); color:#fff; }
.swatch { display:inline-block; width:44px; height:44px; border-radius: var(--radius); border:1px solid var(--border); vertical-align:middle; }
.drop { border:2px dashed #9DB3D3; border-radius: var(--radius); background: var(--bg); padding:24px; text-align:center; margin-bottom:12px; } .preview-img { max-width:100%; max-height:120px; display:block; margin-bottom:12px; }
.login-shell { min-height:100vh; display:flex; align-items:center; justify-content:center; padding:24px; }
.login-card { width:100%; max-width:440px; background: var(--surface); border:1px solid var(--border); border-radius: var(--radius); padding:32px; }
.login-card .field { margin-bottom:16px; } .login-card form .btn { margin-top:8px; } .login-card h1 { margin-top:0; }

/* ---- Finitions (bureau) ---- */
.nav-link { position:relative; transition: background .15s; }
.nav-link.active::before { content:""; position:absolute; left:-8px; top:10px; bottom:10px; width:4px; border-radius:0 4px 4px 0; background: var(--accent); }
.table tbody tr:hover td { background: color-mix(in srgb, var(--primary) 6%, var(--surface)); }
.btn { transition: filter .15s, background .15s; }
.card-head h2, .card h2 { line-height:1.3; }
.topbar, .nav-overlay { display:none; } .nav-toggle { position:absolute; opacity:0; pointer-events:none; }
:where(.content) img { max-width:100%; }

/* ---- Tablette et mobile ---- */
@media (max-width: 900px) {
  .shell { display:block; }
  .topbar { display:flex; align-items:center; gap:12px; position:sticky; top:0; z-index:30; height:56px; padding:0 12px; background: var(--sidebar); color:#fff; }
  .topbar-title { color:#fff; font-weight:700; font-size:16px; text-decoration:none; display:flex; align-items:center; min-width:0; } .topbar-title:hover { text-decoration:none; }
  .topbar-title img { max-height:32px; max-width:160px; object-fit:contain; }
  .burger { flex:0 0 44px; height:44px; border-radius: var(--radius); display:flex; align-items:center; justify-content:center; cursor:pointer; }
  .burger:hover { background: rgba(255,255,255,.1); }
  .burger span, .burger span::before, .burger span::after { display:block; width:22px; height:2px; background:#fff; border-radius:2px; position:relative; transition: transform .2s, background .2s; }
  .burger span::before, .burger span::after { content:""; position:absolute; left:0; } .burger span::before { top:-7px; } .burger span::after { top:7px; }
  .nav-toggle:checked ~ .topbar .burger span { background:transparent; }
  .nav-toggle:checked ~ .topbar .burger span::before { transform: translateY(7px) rotate(45deg); }
  .nav-toggle:checked ~ .topbar .burger span::after { transform: translateY(-7px) rotate(-45deg); }
  .nav-toggle:focus-visible ~ .topbar .burger, .burger:focus-visible { outline:3px solid #8FB4F0; outline-offset:2px; }
  .sidebar { position:fixed; top:0; bottom:0; left:0; z-index:50; height:auto; width:min(84vw, 300px); transform: translateX(-100%); visibility:hidden; transition: transform .22s ease, visibility .22s; box-shadow: none; }
  .nav-toggle:checked ~ .sidebar { transform:none; visibility:visible; box-shadow: 8px 0 24px rgba(0,0,0,.25); }
  .nav-overlay { display:block; position:fixed; inset:0; z-index:40; background: rgba(10,20,40,.5); opacity:0; pointer-events:none; transition: opacity .2s; }
  .nav-toggle:checked ~ .nav-overlay { opacity:1; pointer-events:auto; }
  .sidebar { height:100dvh; } .tagline { display:none; } .logo-zone { margin:16px 24px 4px; min-height:40px; } .nav-group { padding:12px 24px 4px; }
  .nav-link { padding: 11px 16px; }
  .content { padding:20px 16px 32px; }
  h1 { font-size:21px; }
  .card { padding:16px; margin-bottom:16px; } .card-head { padding:16px 16px 0; } .pad, .empty { padding:16px; }
  .banner { max-height:96px; margin-bottom:16px; }
  .page-head { margin-bottom:16px; gap:12px; }
  .alert { padding:12px 16px; margin-bottom:16px; }
  .grid-2 { gap:16px; }
}

@media (max-width: 640px) {
  .input, select.input, textarea.input { font-size:16px; } /* évite le zoom automatique sur iOS */
  .field { flex-basis:100%; }
  .form-row, .filters { gap:12px; }
  .actions { flex-direction:column-reverse; } .actions .btn { width:100%; }
  .page-head .btn, .row-between > .btn { width:100%; }
  .kv { grid-template-columns: 1fr 1fr; gap:12px; }
  .steps li { gap:12px; }
  .login-shell { align-items:flex-start; padding:16px; } .login-card { padding:24px 20px; margin-top:8vh; }

  /* Tableaux : une « carte » par ligne, chaque cellule précédée de son intitulé */
  .table-wrap { overflow:visible; }
  .table { min-width:0; display:block; }
  .table thead { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); }
  .table tbody { display:block; }
  .table tr { display:block; padding:12px 16px; border-bottom:8px solid var(--bg); background: var(--surface); }
  .table tr:last-child { border-bottom:0; }
  .table tr:nth-child(even) td, .table tbody tr:hover td { background:transparent; }
  .table td { display:flex; justify-content:space-between; align-items:center; gap:16px; padding:8px 0; border:0; text-align:right; }
  .table td::before { content: attr(data-label); flex:0 0 38%; text-align:left; font-size:12px; font-weight:600; color: var(--muted); }
  .table td[data-label=""] { justify-content:flex-end; } .table td[data-label=""]::before { display:none; }
  .table td[data-label=""] .btn { width:100%; }
  .table td.num { text-align:right; }
  .table td[colspan] { display:block; text-align:left; } .table td[colspan]::before { display:none; }
  .nowrap { white-space:normal; }
}
