:root{
  --bg:#fafafa;--surface:#fff;--surface-2:#f4f4f5;--sidebar:#fff;
  --border:#e4e4e7;--border-soft:#efeff1;
  --text:#09090b;--muted:#71717a;--faint:#a1a1aa;
  --accent:#6366f1;--accent-soft:#eef0ff;--accent-text:#fff;
  --ok:#16a34a;--ok-soft:#e8f7ee;--warn:#d97706;--warn-soft:#fdf3e3;--err:#dc2626;--err-soft:#fdeceb;--info:#2563eb;--info-soft:#e8f0fe;
  --shadow:0 1px 2px rgba(0,0,0,.04),0 1px 1px rgba(0,0,0,.02);
  --radius:16px;--radius-sm:10px;
  --font:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  --mono:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
}
:root[data-theme=dark]{
  --bg:#0a0a0a;--surface:#111112;--surface-2:#18181b;--sidebar:#0d0d0e;
  --border:#232326;--border-soft:#1b1b1e;
  --text:#fafafa;--muted:#a1a1aa;--faint:#71717a;
  --accent:#6366f1;--accent-soft:#1c1d3a;
  --ok:#4ade80;--ok-soft:#0f2418;--warn:#fbbf24;--warn-soft:#2a1f0a;--err:#f87171;--err-soft:#2b1212;--info:#60a5fa;--info-soft:#10213f;
  --shadow:none;
  color-scheme:dark;
}
*{box-sizing:border-box;margin:0}
html{-webkit-text-size-adjust:100%}
body{font-family:var(--font);background:var(--bg);color:var(--text);font-size:14px;line-height:1.5;-webkit-font-smoothing:antialiased;min-height:100vh}
a{color:inherit;text-decoration:none}
button,input,select{font:inherit;color:inherit}
button{cursor:pointer}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
svg.i{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;flex:none}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}

/* shell */
.shell{display:flex;min-height:100vh}
.sidebar{width:256px;flex:none;background:var(--sidebar);border-right:1px solid var(--border-soft);display:flex;flex-direction:column;position:sticky;top:0;height:100vh;padding:18px 12px 12px}
.brand{display:flex;align-items:center;gap:10px;padding:0 10px 16px;font-weight:600;font-size:15px}
.brand .logo{width:26px;height:26px;border-radius:8px;background:var(--accent);color:#fff;display:grid;place-items:center}
.brand .logo svg{width:15px;height:15px}
.brand small{font-weight:400;color:var(--muted)}
.org{display:flex;align-items:center;gap:10px;background:var(--surface-2);border-radius:14px;padding:10px 12px;margin-bottom:18px;font-weight:600}
.org .av{width:26px;height:26px;border-radius:8px;background:var(--accent);color:#fff;display:grid;place-items:center;font-size:13px}
.org .i{margin-left:auto;color:var(--muted);width:16px}
.nav{flex:1;overflow:auto}
.nav h6{font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:var(--faint);font-weight:600;padding:10px 12px 6px}
.nav a{display:flex;align-items:center;gap:12px;padding:9px 12px;border-radius:10px;color:var(--muted);font-weight:500;margin-bottom:2px}
.nav a:hover{background:var(--surface-2);color:var(--text)}
.nav a.on{background:var(--surface-2);color:var(--text)}
.nav hr{border:0;border-top:1px solid var(--border-soft);margin:10px 4px}
.side-foot{border-top:1px solid var(--border-soft);padding-top:12px}
.user{display:flex;align-items:center;gap:10px;padding:6px 8px}
.user .pic{width:34px;height:34px;border-radius:50%;background:linear-gradient(135deg,#6366f1,#a855f7);color:#fff;display:grid;place-items:center;font-weight:600;font-size:13px}
.user b{display:block;font-size:13px;line-height:1.2}.user span{font-size:12px;color:var(--muted)}
.theme{display:inline-flex;background:var(--surface-2);border-radius:10px;padding:3px;margin:10px 0 0 6px}
.theme button{border:0;background:none;width:28px;height:26px;border-radius:7px;color:var(--muted);display:grid;place-items:center}
.theme button svg{width:15px;height:15px}
.theme button.on{background:var(--surface);color:var(--text);box-shadow:var(--shadow)}

.main{flex:1;min-width:0}
.topbar{display:none}
.wrap{max-width:1180px;margin:0 auto;padding:36px 32px 60px}
.head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;flex-wrap:wrap;margin-bottom:26px}
.head h1{font-size:28px;letter-spacing:-.02em;line-height:1.2}
.head p{color:var(--muted);margin-top:4px}
.actions{display:flex;gap:8px;flex-wrap:wrap}

/* components */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;height:38px;padding:0 14px;border-radius:10px;border:1px solid var(--border);background:var(--surface);font-weight:500;box-shadow:var(--shadow);white-space:nowrap}
.btn:hover{background:var(--surface-2)}
.btn.primary{background:var(--accent);border-color:var(--accent);color:var(--accent-text)}
.btn.primary:hover{filter:brightness(1.08)}
.btn.danger{color:var(--err)}
.btn.sm{height:32px;padding:0 10px;font-size:13px}
.btn.block{width:100%}
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow)}
.card.pad{padding:22px}
.card h3{font-size:16px;font-weight:600}
.card .sub{color:var(--muted);font-size:13px;margin-top:2px}
.grid{display:grid;gap:16px}
.stats{grid-template-columns:repeat(5,1fr);margin-bottom:20px}
.stat{padding:18px 20px}
.stat .l{display:flex;align-items:center;gap:10px;color:var(--muted);font-size:13px}
.stat .l .i{color:var(--muted)}
.stat .v{font-size:24px;font-weight:700;letter-spacing:-.02em;margin-top:14px}
.two{grid-template-columns:1.6fr 1fr}
.two-eq{grid-template-columns:1fr 1fr}
.empty{border:1px dashed var(--border);border-radius:12px;display:grid;place-items:center;text-align:center;color:var(--muted);padding:30px;min-height:140px}
.badge{display:inline-flex;align-items:center;gap:6px;font-size:12px;font-weight:600;padding:3px 9px;border-radius:99px;white-space:nowrap}
.badge.ok{background:var(--ok-soft);color:var(--ok)}.badge.warn{background:var(--warn-soft);color:var(--warn)}
.badge.err{background:var(--err-soft);color:var(--err)}.badge.info{background:var(--info-soft);color:var(--info)}.badge.mute{background:var(--surface-2);color:var(--muted)}
.chip{font-family:var(--mono);font-size:12px;background:var(--surface-2);padding:2px 8px;border-radius:7px;color:var(--muted)}
.tabs{display:inline-flex;background:var(--surface-2);border-radius:10px;padding:3px}
.tabs button{border:0;background:none;padding:5px 12px;border-radius:7px;color:var(--muted);font-weight:500;font-size:13px}
.tabs button.on{background:var(--surface);color:var(--text);box-shadow:var(--shadow)}
.row{display:flex;align-items:center;gap:12px}
.between{justify-content:space-between}
.muted{color:var(--muted)}.mono{font-family:var(--mono)}
.field{display:flex;flex-direction:column;gap:6px;margin-bottom:14px}
.field label{font-size:13px;font-weight:500}
.input{height:40px;border:1px solid var(--border);background:var(--surface);border-radius:10px;padding:0 12px;width:100%}
.input:focus{outline:2px solid var(--accent);outline-offset:-1px}
.search{position:relative;flex:1;min-width:200px}
.search .i{position:absolute;left:12px;top:11px;color:var(--muted);width:16px}
.search .input{padding-left:36px}

/* list / table */
.tbl{width:100%;border-collapse:collapse}
.tbl th{text-align:left;font-size:12px;text-transform:uppercase;letter-spacing:.05em;color:var(--faint);font-weight:600;padding:10px 16px;border-bottom:1px solid var(--border-soft)}
.tbl td{padding:14px 16px;border-bottom:1px solid var(--border-soft);vertical-align:middle}
.tbl tr:last-child td{border-bottom:0}
.tbl tbody tr{cursor:pointer}.tbl tbody tr:hover{background:var(--surface-2)}
.doc-cell{display:flex;align-items:center;gap:12px}
.ico{width:36px;height:36px;border-radius:10px;background:var(--surface-2);display:grid;place-items:center;color:var(--muted);flex:none}
.ico.ok{background:var(--ok-soft);color:var(--ok)}.ico.warn{background:var(--warn-soft);color:var(--warn)}.ico.err{background:var(--err-soft);color:var(--err)}.ico.info{background:var(--info-soft);color:var(--info)}.ico.acc{background:var(--accent-soft);color:var(--accent)}
.cards-m{display:none}
.item{display:flex;align-items:center;gap:12px;padding:14px 16px;border-bottom:1px solid var(--border-soft)}
.item:last-child{border-bottom:0}
.item .grow{flex:1;min-width:0}
.item .grow b{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.item .grow small{color:var(--muted)}
.kv{display:grid;grid-template-columns:150px 1fr;gap:10px 16px;padding:6px 0}
.kv dt{color:var(--muted)}.kv dd{margin:0;word-break:break-all}
.timeline{list-style:none;padding:0}
.timeline li{display:flex;gap:14px;padding:10px 0;position:relative}
.timeline li:not(:last-child)::after{content:"";position:absolute;left:17px;top:46px;bottom:-4px;width:1px;background:var(--border)}

/* drop zone / steps */
.drop{display:block;position:relative;border:1.5px dashed var(--border);border-radius:var(--radius);padding:44px 20px;text-align:center;background:var(--surface);cursor:pointer;transition:.15s}
.drop:hover,.drop.over{border-color:var(--accent);background:var(--accent-soft)}
.drop .ico{margin:0 auto 14px;width:52px;height:52px;border-radius:16px}
.drop h3{font-size:17px}
.steps{list-style:none;padding:0;margin:0}
.steps li{display:flex;align-items:center;gap:12px;padding:10px 0;color:var(--faint)}
.steps li.done{color:var(--text)}.steps li.done .i{color:var(--ok)}
.steps li.run .i{color:var(--accent);animation:spin 1s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.bar{height:6px;background:var(--surface-2);border-radius:9px;overflow:hidden}.bar i{display:block;height:100%;background:var(--accent);width:0;transition:width .3s}
.qr{width:150px;height:150px;border-radius:12px;background:#fff;padding:10px;border:1px solid var(--border)}

/* verification result */
.result{padding:26px;text-align:center}
.result .big{width:64px;height:64px;border-radius:50%;display:grid;place-items:center;margin:0 auto 14px}
.result .big svg{width:32px;height:32px}
.result h2{font-size:22px;letter-spacing:-.01em}
.result.ok .big{background:var(--ok-soft);color:var(--ok)}.result.warn .big{background:var(--warn-soft);color:var(--warn)}
.result.err .big{background:var(--err-soft);color:var(--err)}.result.info .big{background:var(--info-soft);color:var(--info)}
details.tech{margin-top:16px;text-align:left}
details.tech summary{cursor:pointer;color:var(--accent);font-weight:500;list-style:none;text-align:center}
.pub{max-width:640px;margin:0 auto;padding:28px 18px 60px}
.pub .brand{justify-content:center;padding-bottom:26px}
.auth{min-height:100vh;display:grid;place-items:center;padding:20px}
.auth .card{width:100%;max-width:400px;padding:28px}
.toast{position:fixed;left:50%;bottom:90px;transform:translateX(-50%);background:var(--text);color:var(--bg);padding:10px 16px;border-radius:12px;font-weight:500;z-index:60;box-shadow:0 8px 30px rgba(0,0,0,.25)}
.skel{background:linear-gradient(90deg,var(--surface-2),var(--border-soft),var(--surface-2));background-size:200% 100%;animation:sh 1.2s infinite;border-radius:8px}
@keyframes sh{to{background-position:-200% 0}}

/* mobile */
.tabbar{display:none}
@media(max-width:900px){
  .sidebar{position:fixed;left:0;top:0;z-index:50;transform:translateX(-100%);transition:.2s;width:280px}
  body.menu .sidebar{transform:none;box-shadow:0 0 0 100vmax rgba(0,0,0,.45)}
  .topbar{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;position:sticky;top:0;background:color-mix(in srgb,var(--bg) 88%,transparent);backdrop-filter:blur(10px);z-index:20;border-bottom:1px solid var(--border-soft)}
  .topbar .brand{padding:0}
  .icon-btn{width:38px;height:38px;border-radius:10px;border:1px solid var(--border);background:var(--surface);display:grid;place-items:center}
  .wrap{padding:20px 16px 110px}
  .head h1{font-size:23px}
  .stats{grid-template-columns:1fr 1fr}.stats .stat:last-child{grid-column:span 2}
  .two,.two-eq{grid-template-columns:1fr}
  .tbl-d{display:none}.cards-m{display:block}
  .kv{grid-template-columns:1fr;gap:2px 0;padding:8px 0;border-bottom:1px solid var(--border-soft)}
  .tabbar{display:flex;position:fixed;bottom:0;left:0;right:0;z-index:30;background:color-mix(in srgb,var(--surface) 92%,transparent);backdrop-filter:blur(12px);border-top:1px solid var(--border);padding:6px 6px calc(6px + env(safe-area-inset-bottom))}
  .tabbar a{flex:1;display:flex;flex-direction:column;align-items:center;gap:2px;font-size:11px;color:var(--muted);padding:6px 0;border-radius:10px;font-weight:500}
  .tabbar a.on{color:var(--accent)}
  .tabbar a.cta .ico{background:var(--accent);color:#fff;width:42px;height:42px;border-radius:14px;margin-top:-18px;box-shadow:0 6px 18px rgba(99,102,241,.45)}
  .actions .btn{flex:1}
  .toast{bottom:100px}
}

/* ===== menu réductible (rail d'icônes) ===== */
.sidebar{transition:width .18s ease}
.side-toggle{position:absolute;right:-16px;bottom:118px;width:32px;height:32px;border-radius:50%;border:1px solid var(--border);background:var(--sidebar);color:var(--muted);display:grid;place-items:center;z-index:5;box-shadow:var(--shadow)}
.side-toggle:hover{color:var(--text);background:var(--surface-2)}
.side-toggle svg{width:15px;height:15px;transition:transform .18s}
.theme-one{display:none}
.sidebar{overflow:visible}
@media(min-width:901px){
  html[data-side=mini] .sidebar{width:112px;padding:18px 10px 12px}
  html[data-side=mini] .side-toggle svg{transform:rotate(180deg)}
  html[data-side=mini] .brand{justify-content:center;padding:0 0 16px}
  html[data-side=mini] .brand>span:not(.logo),html[data-side=mini] .org .name,html[data-side=mini] .org>.i,html[data-side=mini] .nav h6,html[data-side=mini] .user>span:nth-child(2),html[data-side=mini] .theme{display:none}
  html[data-side=mini] .org{justify-content:center;padding:10px;margin-bottom:12px}
  html[data-side=mini] .nav{overflow-x:hidden}
  html[data-side=mini] .nav a{flex-direction:column;gap:5px;padding:10px 4px;font-size:11.5px;text-align:center;align-items:center;line-height:1.15}
  html[data-side=mini] .nav a span{display:block;max-width:92px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  html[data-side=mini] .nav hr{margin:8px 6px}
  html[data-side=mini] .side-foot{display:flex;flex-direction:column;align-items:center;gap:10px}
  html[data-side=mini] .theme-one{display:grid}
  html[data-side=mini] .user{padding:0}
}
.theme-one{width:44px;height:44px;border-radius:12px;border:0;background:var(--surface-2);color:var(--text);place-items:center}
.nav a span.lbl{flex:1}
@media(max-width:900px){.side-toggle{display:none}}

/* ===== formulaires / dialogues / divers ===== */
.drop{display:block;cursor:pointer}
dialog{border:1px solid var(--border);border-radius:var(--radius);background:var(--surface);color:var(--text);padding:0;width:min(460px,calc(100vw - 32px));box-shadow:0 20px 60px rgba(0,0,0,.35)}
dialog::backdrop{background:rgba(0,0,0,.55);backdrop-filter:blur(2px)}
dialog form{padding:22px}
dialog h3{font-size:18px;margin-bottom:16px}
.dlg-actions{display:flex;gap:8px;justify-content:flex-end;margin-top:8px}
textarea.input{height:auto;min-height:84px;padding:10px 12px;resize:vertical}
.form-err{color:var(--err);font-size:13px;min-height:18px;margin:2px 0 6px}
.switch{display:flex;align-items:center;gap:10px}
.btn[disabled]{opacity:.55;pointer-events:none}
.item .btn{flex:none}
.kv dd.break{word-break:break-all}
.chain{display:inline-flex;gap:6px;align-items:center}
.row.wrap-m{flex-wrap:wrap}
.bar.thick{height:8px}
.small{font-size:12px}
.note{background:var(--surface-2);border-radius:12px;padding:12px 14px;color:var(--muted);font-size:13px}
.note.warn{background:var(--warn-soft);color:var(--warn)}
@media(max-width:900px){dialog{margin:auto 16px 16px;width:calc(100vw - 32px)}}

.wm{font-weight:600;letter-spacing:-.01em}.wm b{color:var(--accent);margin-left:1px}
.brand .wm{display:inline}
.corner{position:fixed;top:14px;right:14px;z-index:40}
.corner .theme{margin:0;background:var(--surface);border:1px solid var(--border);box-shadow:var(--shadow)}
.corner .theme button.on{background:var(--surface-2)}

/* ===== pied de menu : profil + menu déroulant ===== */
.side-foot{display:flex;flex-direction:column;gap:10px}
.user-wrap{position:relative}
.user{display:flex;align-items:center;gap:10px;width:100%;border:0;background:var(--surface-2);border-radius:14px;padding:8px 10px;text-align:left;cursor:pointer}
.user:hover{filter:brightness(.97)}
.user .pic{width:32px;height:32px;border-radius:50%;background:linear-gradient(135deg,#6366f1,#a855f7);color:#fff;display:grid;place-items:center;font-weight:600;font-size:12px;flex:none}
.user .u-t{min-width:0;flex:1}
.user .u-t b{display:block;font-size:13px;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.user .u-t span{display:block;font-size:12px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.user .chev{color:var(--muted);display:grid}
.user .chev svg{width:16px;height:16px}
.pop{position:absolute;left:0;right:0;bottom:calc(100% + 8px);background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:6px;box-shadow:0 12px 40px rgba(0,0,0,.28);z-index:60;min-width:230px}
:root[data-theme=dark] .pop{background:#18181b}
.pop[hidden]{display:none}
.pop-head{padding:10px 12px 10px;border-bottom:1px solid var(--border-soft);margin-bottom:6px}
.pop-head b{display:block;font-size:14px}.pop-head span{font-size:12px;color:var(--muted)}
.pop a,.pop button{display:flex;align-items:center;gap:12px;width:100%;padding:9px 12px;border:0;background:none;border-radius:9px;font-weight:500;color:var(--text);text-align:left;cursor:pointer}
.pop a:hover,.pop button:hover{background:var(--surface-2)}
.pop svg{width:17px;height:17px;color:var(--muted)}
.pop hr{border:0;border-top:1px solid var(--border-soft);margin:6px 2px}
.pop .out,.pop .out svg{color:var(--err)}
.theme{margin:0}
/* bouton de réduction : au milieu quand le menu est ouvert */
.side-toggle{top:50%;bottom:auto;transform:translateY(-50%)}
@media(min-width:901px){
  html[data-side=mini] .side-toggle{top:auto;bottom:122px;transform:none}
  html[data-side=mini] .brand{padding-bottom:14px}
  html[data-side=mini] .org{display:none}
  html[data-side=mini] .side-foot{align-items:center;gap:8px}
  html[data-side=mini] .user-wrap{width:auto}
  html[data-side=mini] .user{width:auto;background:none;padding:2px}
  html[data-side=mini] .user .u-t,html[data-side=mini] .user .chev{display:none}
  html[data-side=mini] .user .pic{width:34px;height:34px}
  html[data-side=mini] .theme-one{width:34px;height:34px;border-radius:10px}
  html[data-side=mini] .theme-one svg{width:16px;height:16px}
  html[data-side=mini] .pop{left:calc(100% + 14px);right:auto;bottom:0;width:240px}
}
@media(max-width:900px){.side-toggle{display:none}}
.user{color:var(--text)}
@media(min-width:901px){html[data-side=mini] .theme-one{order:1}html[data-side=mini] .user-wrap{order:2}}
.side-foot .theme{align-self:flex-start;margin-left:2px}
.user .u-t{color:var(--text)}
.user .u-t b{color:var(--text)}
/* menu réduit : plus compact */
@media(min-width:901px){
  html[data-side=mini] .sidebar{width:88px;padding:16px 8px 12px}
  html[data-side=mini] .nav a{padding:7px 2px;gap:3px;font-size:11px;border-radius:9px;margin-bottom:1px}
  html[data-side=mini] .nav a svg{width:17px;height:17px}
  html[data-side=mini] .nav a span{max-width:72px}
  html[data-side=mini] .nav hr{margin:6px 8px}
  html[data-side=mini] .brand .logo{width:24px;height:24px}
  html[data-side=mini] .user .pic{width:30px;height:30px}
  html[data-side=mini] .theme-one{width:30px;height:30px}
  html[data-side=mini] .theme-one svg{width:15px;height:15px}
  html[data-side=mini] .side-toggle{bottom:112px}
}

/* alerte qui descend du haut */
.alert-top{position:fixed;top:14px;left:50%;transform:translateX(-50%);z-index:100;width:min(560px,calc(100vw - 24px));display:flex;gap:14px;align-items:flex-start;background:var(--surface);color:var(--text);border:1px solid var(--border);border-left:4px solid var(--err);border-radius:14px;padding:14px 14px 14px 16px;box-shadow:0 18px 50px rgba(0,0,0,.28);animation:atin .28s cubic-bezier(.2,.9,.3,1)}
.alert-top.out{animation:atout .2s ease forwards}
.alert-top.warn{border-left-color:var(--warn)}.alert-top.info{border-left-color:var(--info)}.alert-top.ok{border-left-color:var(--ok)}
.alert-top .at-ico{margin-top:1px;color:var(--err)}.alert-top.warn .at-ico{color:var(--warn)}.alert-top.info .at-ico{color:var(--info)}.alert-top.ok .at-ico{color:var(--ok)}
.alert-top .at-ico svg{width:22px;height:22px}
.at-body{flex:1;min-width:0}.at-body b{display:block;font-size:15px}
.at-body p{color:var(--muted);margin-top:3px;line-height:1.45}
.at-body .btn{margin-top:10px}
.at-x{border:0;background:none;color:var(--muted);width:28px;height:28px;border-radius:8px;display:grid;place-items:center;flex:none}
.at-x:hover{background:var(--surface-2);color:var(--text)}
@keyframes atin{from{transform:translate(-50%,-130%);opacity:0}to{transform:translate(-50%,0);opacity:1}}
@keyframes atout{to{transform:translate(-50%,-130%);opacity:0}}
/* le menu latéral (et son menu profil) passe au-dessus du contenu */
.sidebar{z-index:30}
@media(min-width:901px){
  html[data-side=mini] .side-foot,html[data-side=mini] .user-wrap{position:static}
  html[data-side=mini] .pop{left:10px;right:auto;bottom:58px;width:244px}
}
.pop{overflow:hidden}
.pop-head{padding:12px 14px}

/* interrupteur cliquable (remplace les cases à cocher) */
.opt{position:relative;display:flex;align-items:center;gap:14px;padding:14px 16px;border:1px solid var(--border);border-radius:12px;background:var(--surface);cursor:pointer;transition:background .15s,border-color .15s;user-select:none}
.opt:hover{background:var(--surface-2)}
.opt input{position:absolute;opacity:0;width:0;height:0}
.opt .o-t{flex:1;min-width:0}.opt .o-t b{display:block;font-weight:600}
.opt .o-t span{display:block;color:var(--muted);font-size:13px;margin-top:2px;line-height:1.4}
.sw{flex:none;width:42px;height:24px;border-radius:99px;background:var(--border);position:relative;transition:background .18s}
.sw::after{content:"";position:absolute;left:3px;top:3px;width:18px;height:18px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.3);transition:transform .18s}
.opt input:checked~.sw{background:var(--accent)}
.opt input:checked~.sw::after{transform:translateX(18px)}
.opt:has(input:checked){border-color:color-mix(in srgb,var(--accent) 45%,var(--border))}
.opt:has(input:focus-visible){outline:2px solid var(--accent);outline-offset:2px}
/* filtres de l'audit */
.filters .tabs button{padding:6px 14px}
.input.dt{width:auto;height:36px;padding:0 10px;color-scheme:light dark}
.pager{display:flex;align-items:center;justify-content:center;gap:14px;margin-top:16px}
@media(max-width:900px){.filters .row{align-items:stretch}.input.dt{flex:1}}
/* flèche du bouton de menu : ‹ pour réduire, › pour agrandir */
.side-toggle svg{transform:rotate(180deg)}
html[data-side=mini] .side-toggle svg{transform:none}
.kv dd:not(.mono):not(.break){word-break:normal;overflow-wrap:break-word}
/* mobile : le tiroir passe au-dessus de la barre d'onglets et tient dans l'écran visible */
@media(max-width:900px){
  .sidebar{z-index:70;height:100vh;height:100dvh;padding-bottom:calc(14px + env(safe-area-inset-bottom));overflow:visible}
  .sidebar .nav{min-height:0}
  .tabbar{z-index:20}
  body.menu .tabbar{visibility:hidden}
  .topbar{z-index:20}
}

/* filtres de l'audit */
.filters .frow{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.filters .frow.top{margin-bottom:12px}
.filters .frow:not(.top){justify-content:space-between}
.filters .dates{display:flex;gap:10px;align-items:center}
.filters .dfield{display:flex;align-items:center;gap:8px}
.filters .dfield label{color:var(--muted);font-size:13px}
.ar .when{white-space:nowrap}
@media(max-width:900px){
  .filters{padding:14px}
  .filters .frow,.filters .frow.top{flex-direction:column;align-items:stretch;gap:10px}
  .filters .frow.top{margin-bottom:10px}
  .filters .search{min-width:0}
  .filters #ac{width:100%!important}
  .filters .tabs.lv{display:grid;grid-template-columns:repeat(4,1fr);width:100%}
  .filters .tabs.lv button{padding:8px 2px;font-size:13px;text-align:center}
  .filters .dates{display:grid;grid-template-columns:1fr 1fr;gap:10px}
  .filters .dfield{flex-direction:column;align-items:stretch;gap:4px}
  .filters .input.dt{width:100%;min-width:0}
  .filters #ar{width:100%;height:38px}
  .item.ar{flex-wrap:wrap;row-gap:4px}
  .item.ar .grow{flex:1 1 calc(100% - 64px)}
  .item.ar .when{order:3;flex:0 0 100%;padding-left:48px}
  .item.ar .grow small{display:block;word-break:break-word;white-space:normal}
}
[hidden]{display:none!important}
@media(max-width:900px){
  .filters .dates{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
  .filters .dfield{min-width:0}
  .filters .input.dt{max-width:100%;padding:0 8px}
}

/* menus déroulants : flèche propre et cohérente */
select.input{-webkit-appearance:none;appearance:none;padding-right:40px;cursor:pointer;background-repeat:no-repeat;background-position:right 14px center;background-size:16px;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")}
select.input:hover{border-color:color-mix(in srgb,var(--accent) 35%,var(--border))}
select.input option{background:var(--surface);color:var(--text)}
/* sélecteur de date */
.dp{position:relative;min-width:0}
.dp .input{padding-right:42px;width:150px}
.dp .input[aria-invalid=true]{border-color:var(--err);outline-color:var(--err)}
.dp-b{position:absolute;right:5px;top:50%;transform:translateY(-50%);border:0;background:none;color:var(--muted);width:30px;height:30px;border-radius:8px;display:grid;place-items:center}
.dp-b:hover{background:var(--surface-2);color:var(--text)}.dp-b svg{width:16px;height:16px}
.dp-pop{position:absolute;top:calc(100% + 8px);left:0;z-index:55;width:288px;background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:12px;box-shadow:0 16px 48px rgba(0,0,0,.3)}
:root[data-theme=dark] .dp-pop{background:#18181b}
.dp.right .dp-pop{left:auto;right:0}
.dp-h{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}
.dp-h b{text-transform:capitalize;font-size:14px}
.dp-h button{width:30px;height:30px;border:0;border-radius:8px;background:none;color:var(--muted);display:grid;place-items:center}
.dp-h button:hover{background:var(--surface-2);color:var(--text)}
.dp-g{display:grid;grid-template-columns:repeat(7,1fr);gap:2px;text-align:center}
.dp-g i{font-style:normal;font-size:11px;color:var(--faint);text-transform:uppercase;padding:4px 0}
.dp-g button{height:34px;border:0;border-radius:9px;background:none;font-size:13px;color:var(--text)}
.dp-g button:hover{background:var(--surface-2)}
.dp-g button.now{box-shadow:inset 0 0 0 1px var(--accent)}
.dp-g button.sel{background:var(--accent);color:#fff;font-weight:600}
.dp-f{display:flex;justify-content:space-between;margin-top:8px;padding-top:8px;border-top:1px solid var(--border-soft)}
.dp-f button{border:0;background:none;color:var(--accent);font-weight:500;padding:4px 8px;border-radius:8px}.dp-f button:hover{background:var(--surface-2)}
@media(max-width:900px){.dp .input{width:100%}.dp-pop{width:min(288px,calc(100vw - 32px))}}

/* fenêtres modales : centrées et plus soignées (ordinateur uniquement ; le mobile ne change pas) */
.dlg-x{display:none}
@keyframes dlgin{from{opacity:0;transform:translateY(10px) scale(.98)}to{opacity:1;transform:none}}
@media(min-width:901px){
  dialog{margin:auto;width:min(440px,calc(100vw - 48px));border-radius:20px;box-shadow:0 28px 90px rgba(0,0,0,.5);animation:dlgin .18s ease}
  dialog[open]::backdrop{animation:dlgfade .18s ease}
  dialog form{position:static;padding:24px 24px 20px}
  dialog h3{font-size:18px;letter-spacing:-.01em;margin:0 36px 18px 0}
  .dlg-x{display:grid;position:absolute;top:18px;right:18px;width:32px;height:32px;border:0;border-radius:9px;background:none;color:var(--muted);place-items:center}
  .dlg-x:hover{background:var(--surface-2);color:var(--text)}
  dialog .field{margin-bottom:12px}
  dialog textarea.input{min-height:68px}
  .dlg-actions{margin-top:16px}
  .dlg-actions .btn{height:40px;padding:0 18px}
}
@keyframes dlgfade{from{opacity:0}to{opacity:1}}

@media(min-width:901px){dialog .form-err:empty{display:none}dialog .form-err{margin:0 0 8px}}

/* verify : logo cliquable + retour discret */
a.brand{text-decoration:none;color:inherit}
.back{position:fixed;top:14px;left:14px;z-index:40;width:38px;height:38px;border-radius:50%;display:grid;place-items:center;background:var(--surface);border:1px solid var(--border);box-shadow:var(--shadow);color:var(--muted);transition:color .15s,background .15s,transform .15s}
.back svg{width:18px;height:18px}
.back:hover{color:var(--text);background:var(--surface-2)}
.back:hover svg{transform:translateX(-1px)}
.back:active{transform:scale(.94)}
.back:focus-visible{outline:2px solid var(--accent);outline-offset:2px}

/* historique d'un document */
.hist-h{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:6px}
.hist-h h3{margin:0}.hist-h p{margin-top:2px}
.hist .timeline{margin-top:6px}
.hist .timeline li{gap:12px;padding:9px 0}
.hist .timeline li:not(:last-child)::after{top:44px}
.hist .ico{width:34px;height:34px;border-radius:10px}.hist .ico svg{width:16px;height:16px}
.hist .hi{flex:1;min-width:0}.hist .hi b{font-weight:600;font-size:14px}
.hist .hi .small{line-height:1.45}
.hist .timeline.short li:nth-child(n+4){display:none}
.hist .timeline.short li:nth-child(3)::after{display:none}
.hist-h .btn{flex:none;white-space:nowrap}
@media(max-width:520px){.hist-h{flex-direction:column;align-items:stretch}.hist-h .btn{align-self:flex-start}}

/* page document, mobile uniquement : QR+lien · Informations · Versions · Historique · Détails techniques */
@media(max-width:900px){
  .doc-cols>div{display:contents}
  .doc-qr{order:1}.doc-info{order:2}.doc-ver{order:3}.doc-hist{order:4}.doc-tech{order:5}
}

/* liste déroulante premium */
.dd{position:relative;min-width:230px}
.dd-btn{display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;text-align:left;cursor:pointer;font:inherit;color:var(--text)}
.dd-btn:hover,.dd.open .dd-btn{border-color:color-mix(in srgb,var(--accent) 35%,var(--border))}
.dd-btn>svg{width:16px;height:16px;color:var(--muted);flex:none;transition:transform .2s}
.dd.open .dd-btn>svg{transform:rotate(180deg)}
.dd-list{position:absolute;z-index:60;top:calc(100% + 6px);left:0;right:0;min-width:100%;margin:0;padding:0;list-style:none;overflow:hidden;
  background:var(--surface);border:1px solid var(--border);border-radius:16px;box-shadow:0 18px 44px -10px rgba(0,0,0,.22),0 4px 12px rgba(0,0,0,.06);animation:ddin .14s ease-out;transform-origin:top}
.dd-list li{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:13px 18px;cursor:pointer;color:var(--text);font-weight:500;border-top:1px solid var(--border-soft)}
.dd-list li:first-child{border-top:0}
.dd-list li svg{width:16px;height:16px;color:var(--accent);opacity:0;flex:none}
.dd-list li.hi{background:var(--surface-2)}
.dd-list li[aria-selected=true]{font-weight:600}
.dd-list li[aria-selected=true] svg{opacity:1}
@keyframes ddin{from{opacity:0;transform:translateY(-4px) scale(.98)}to{opacity:1;transform:none}}
@media(max-width:900px){.dd{min-width:0;width:100%}.dd-list li{padding:14px 18px}}
@media(prefers-reduced-motion:reduce){.dd-list{animation:none}}
.dd-list{left:auto;right:0;width:max-content;min-width:100%}
.dd-list li span{white-space:nowrap}
@media(max-width:900px){.dd-list{left:0;width:auto}}
/* menu réduit : respiration verticale entre les sections */
@media(min-width:901px){html[data-side=mini] .nav hr{margin:14px 10px}}

/* fenêtre « document déjà enregistré » */
dialog.dup{text-align:center;padding:30px 26px 24px}
dialog.dup h3{font-size:19px;margin:0 0 6px;letter-spacing:-.01em}
.dup-ic{width:64px;height:64px;margin:2px auto 16px;border-radius:20px;display:grid;place-items:center;color:var(--warn);
  background:linear-gradient(145deg,var(--warn-soft),color-mix(in srgb,var(--warn-soft) 55%,var(--surface)));
  box-shadow:0 0 0 7px color-mix(in srgb,var(--warn) 10%,transparent),0 10px 24px -8px color-mix(in srgb,var(--warn) 45%,transparent)}
.dup-ic svg{width:30px;height:30px}
.dup-lead{margin:0 0 18px}
.dup-ref{display:flex;align-items:center;gap:12px;text-align:left;padding:12px 14px;border:1px solid var(--border);border-radius:14px;background:var(--surface-2);color:inherit;text-decoration:none;transition:border-color .15s,background .15s}
.dup-ref:hover{border-color:color-mix(in srgb,var(--accent) 40%,var(--border))}
.dup-ref>svg{width:16px;height:16px;color:var(--muted);flex:none;margin-left:auto}
.dup-t{display:flex;flex-direction:column;min-width:0}.dup-t b{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dup-t .mono{font-size:12px;color:var(--muted)}
.dup-note{margin:14px 4px 0;line-height:1.5}
.dup-actions{display:flex;flex-direction:column;gap:8px;margin-top:20px}
.dup-actions .btn{width:100%;justify-content:center;height:42px}
