/* SLERP : styles de l'application (squelette du lot 0). Icônes SVG uniquement, aucun émoji. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--ink); }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: clamp(28px, 5vw, 40px); font-weight: 800; }
h2 { font-size: 22px; font-weight: 800; }
h3 { font-size: 17px; font-weight: 700; }
p { margin: 0 0 .8em; }
a { color: inherit; }
.boot-msg { text-align: center; margin-top: 30vh; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--action); outline-offset: 2px; }
[data-theme="dark"] { color-scheme: dark; }

/* Mise en page */
.wrap { max-width: 1280px; margin: 0 auto; padding: 16px; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--card); position: sticky; top: 0; z-index: 5; border-bottom: 1px solid rgba(128,128,128,.2); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; text-decoration: none; min-width: 0; }
.brand img { max-height: 36px; max-width: 140px; object-fit: contain; }
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; gap: 6px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav a { padding: 8px 16px; border-radius: var(--radius-pill); text-decoration: none; font-weight: 600; white-space: nowrap; }
.nav a[aria-current="page"] { background: var(--action); color: var(--card); }
.spacer { flex: 1; }
@media (max-width: 700px) { .topbar { flex-wrap: wrap; } .nav { order: 3; flex-basis: 100%; } .userbox { margin-left: auto; } }
.userbox { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); }
.userbox .who { display: none; }
@media (min-width: 900px) { .userbox .who { display: inline; } }

/* Cartes, boutons, champs */
.card { background: var(--card); border-radius: var(--radius); padding: 22px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.card > h2 + p.help { margin-top: -.3em; }
.help { color: var(--muted); font-size: 14px; }
.btn { appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 700; padding: 11px 22px; min-height: 44px; border-radius: var(--radius-pill); background: var(--action); color: var(--card); display: inline-flex; gap: 8px; align-items: center; justify-content: center; text-decoration: none; }
.btn:hover:not(:disabled) { filter: brightness(1.12); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px currentColor; }
.btn.accent { background: var(--accent); color: #111; }
.btn.small { min-height: 36px; padding: 6px 14px; font-size: 14px; }
.btn.danger { background: var(--bad); color: #fff; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.grid2 { display: grid; gap: 12px 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } }
label.f { display: block; font-weight: 600; font-size: 14px; }
label.f > span { display: block; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--card); border: 2px solid rgba(128,128,128,.45); border-radius: 14px; padding: 10px 12px; min-height: 44px; }
textarea { min-height: 84px; resize: vertical; }
input[type=color] { width: 56px; height: 44px; padding: 2px; border-radius: 12px; border: 2px solid rgba(128,128,128,.45); background: var(--card); }
input:focus, select:focus, textarea:focus { border-color: var(--action); outline: none; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.check input { width: 22px; height: 22px; }

/* Messages */
.msg { padding: 12px 16px; border-radius: 14px; margin: 10px 0; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; }
.msg svg { flex: none; margin-top: 2px; }
.msg.ok { background: color-mix(in srgb, var(--ok) 16%, var(--card)); }
.msg.warn { background: color-mix(in srgb, var(--warn) 20%, var(--card)); }
.msg.err { background: color-mix(in srgb, var(--bad) 16%, var(--card)); }
.msg.info { background: color-mix(in srgb, var(--muted) 18%, var(--card)); }
.msg ul { margin: 0; padding-left: 18px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: var(--radius-pill); background: var(--accent); color: #111; font-weight: 700; font-size: 12px; }

/* Connexion */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth .card { width: min(440px, 100%); padding: 28px; }
.auth .logo { display: block; max-width: 220px; max-height: 80px; margin: 0 0 18px; object-fit: contain; }
.secret { font: 600 20px/1.4 ui-monospace, Menlo, monospace; letter-spacing: .08em; word-break: normal; overflow-wrap: normal; background: color-mix(in srgb, var(--muted) 15%, var(--card)); padding: 12px 14px; border-radius: 14px; user-select: all; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font: 600 15px ui-monospace, Menlo, monospace; background: color-mix(in srgb, var(--muted) 15%, var(--card)); padding: 14px; border-radius: 14px; list-style: none; margin: 10px 0; }
.strength { height: 8px; border-radius: 6px; background: color-mix(in srgb, var(--muted) 30%, var(--card)); overflow: hidden; margin-top: 6px; }
.strength > i { display: block; height: 100%; width: 0; background: var(--bad); transition: width .2s, background .2s; }

/* Charte */
.brand-grid > * { min-width: 0; }
.preview-frame { max-width: 100%; }
.brand-grid { display: grid; gap: 16px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 1000px) { .brand-grid { grid-template-columns: minmax(0, 1fr) minmax(360px, 480px); } .sticky { position: sticky; top: 76px; } }
.asset { border-top: 1px solid rgba(128,128,128,.25); padding: 14px 0; }
.asset:first-of-type { border-top: 0; }
.asset .thumb { width: 96px; height: 56px; border-radius: 10px; background: repeating-conic-gradient(#d8d8d8 0 25%, #fff 0 50%) 0 0 / 14px 14px; display: grid; place-items: center; overflow: hidden; flex: none; }
.asset .thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.asset .meta { flex: 1; min-width: 160px; }
.asset .meta strong { display: block; }
.dropzone { display: grid; justify-items: center; gap: 6px; border: 3px dashed rgba(128,128,128,.55); border-radius: var(--radius); padding: 22px; text-align: center; cursor: pointer; }
.dropzone.over { border-color: var(--action); background: color-mix(in srgb, var(--accent) 25%, var(--card)); }
.preview-frame { background: color-mix(in srgb, var(--muted) 25%, var(--bg)); border-radius: 18px; padding: 10px; overflow: hidden; }
.preview-scale { transform-origin: top left; }

/* Document type (aperçu fidèle : dimensions en mm comme l'impression) */
.doc-page { position: relative; width: 210mm; height: 297mm; background: #fff; color: #111; overflow: hidden; box-shadow: 0 2px 14px rgba(0,0,0,.25); font-size: 10pt; }
.doc-logo { position: absolute; display: block; }
.doc-logo-empty { position: absolute; display: grid; place-items: center; border: 1.5px dashed #999; color: #777; font-size: 9pt; }
.doc-ident { position: absolute; top: 15mm; max-width: 62mm; font-size: 8.5pt; line-height: 1.35; color: #333; }
.doc-ident.is-right { right: 15mm; text-align: right; }
.doc-ident.is-left { left: 15mm; }
.doc-body { position: absolute; left: 15mm; right: 15mm; }
.doc-body h2 { color: var(--doc-primary); font-size: 17pt; margin: 6mm 0 1mm; }
.doc-sample { color: #888; font-size: 8pt; margin-bottom: 5mm; }
.doc-table { width: 100%; border-collapse: collapse; margin: 4mm 0; }
.doc-table th { background: var(--doc-primary); color: #fff; text-align: left; padding: 2mm 3mm; font-size: 9pt; }
.doc-table td { border-bottom: .3mm solid #ccc; padding: 2.5mm 3mm; font-size: 9pt; height: 7mm; }
.doc-foot { position: absolute; left: 15mm; right: 15mm; bottom: 10mm; border-top: .4mm solid var(--doc-primary); padding-top: 2mm; font-size: 7.5pt; color: #444; text-align: center; line-height: 1.4; }
.doc-watermark { position: absolute; inset: 0; display: grid; place-items: center; font-size: 60pt; font-weight: 800; color: rgba(0,0,0,.07); transform: rotate(-30deg); pointer-events: none; }

table.simple { width: 100%; border-collapse: collapse; font-size: 14px; }
table.simple td, table.simple th { text-align: left; padding: 8px 6px; border-bottom: 1px solid rgba(128,128,128,.25); }
.tabs-scroll { overflow-x: auto; }

/* Comptes */
.tb { margin-bottom: 12px; }
.tb input[type=text] { flex: 1 1 220px; min-width: 0; width: auto; }
.tb select { width: auto; flex: 0 1 220px; }
.ucard { padding: 6px 22px; }
.urow { display: grid; gap: 6px 14px; padding: 14px 0; border-top: 1px solid rgba(128,128,128,.22); grid-template-columns: minmax(0, 1fr); }
.urow:first-child { border-top: 0; }
@media (min-width: 900px) { .urow { grid-template-columns: minmax(200px, 1.2fr) minmax(180px, 1.4fr) minmax(150px, .8fr); } .urow .uact { grid-column: 1 / -1; } }
.umain { display: grid; min-width: 0; } .umain .help { overflow-wrap: anywhere; }
.umeta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: color-mix(in srgb, var(--muted) 22%, var(--card)); }
.tag.st-active { background: color-mix(in srgb, var(--ok) 22%, var(--card)); }
.tag.st-invited { background: color-mix(in srgb, var(--warn) 25%, var(--card)); }
.tag.st-frozen, .tag.st-archived { background: color-mix(in srgb, var(--bad) 18%, var(--card)); }
.ulast { align-self: center; }
.uact { gap: 6px; }
tr.bad td { background: color-mix(in srgb, var(--bad) 12%, var(--card)); }
dialog.dlg { border: 0; border-radius: var(--radius); padding: 22px; width: min(720px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto; background: var(--card); color: var(--ink); }
dialog.dlg::backdrop { background: rgba(0,0,0,.5); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.dlg-head h2 { margin: 0; }

@media (max-width: 700px) { .hide-sm { display: none; } }

.impbar { position: sticky; top: 0; z-index: 20; display: flex; gap: 10px; align-items: center; padding: 10px 16px; background: var(--warn); color: #111; font-size: 14px; flex-wrap: wrap; }
.impbar span { flex: 1 1 260px; }
.impbar .btn { background: #111; color: #fff; }
.topbar { top: 0; }
