:root {
  --bg: #f3f4f6; --surface: #fff; --text: #111827; --muted: #6b7280; --border: #e5e7eb;
  --primary: #4f46e5; --primary-dark: #4338ca; --danger: #b91c1c; --success: #15803d;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 15px; background: var(--bg); color: var(--text); }
a { color: var(--primary); }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
.container { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem; }

.topbar { display: flex; align-items: center; gap: 2rem; padding: 0 1.5rem; height: 56px; background: #1f2937; color: #f9fafb; }
.topbar .brand { color: #fff; text-decoration: none; font-weight: 600; }
.topbar .brand span { color: #9ca3af; font-weight: 400; }
.topbar nav { display: flex; gap: .25rem; flex: 1; }
.topbar nav a { color: #d1d5db; text-decoration: none; padding: .4rem .75rem; border-radius: 6px; }
.topbar nav a:hover, .topbar nav a.active { background: #374151; color: #fff; }
.topbar .me { display: flex; align-items: center; gap: .75rem; font-size: .9rem; }
.badge { font-size: .75rem; background: #374151; color: #e5e7eb; padding: .15rem .5rem; border-radius: 999px; }
.badge-admin { background: #fef3c7; color: #92400e; }
.badge-user { background: #e5e7eb; color: #374151; }
.badge-off { background: #fee2e2; color: #991b1b; }

.btn { display: inline-block; padding: .5rem 1rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); text-decoration: none; cursor: pointer; font: inherit; }
.btn:hover { background: #f9fafb; }
.btn-sm { padding: .25rem .6rem; font-size: .85rem; }
.btn[hidden] { display: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { color: var(--danger); }
.topbar .btn { background: transparent; color: #d1d5db; border-color: #4b5563; }
.topbar .btn:hover { background: #374151; color: #fff; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1.5rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }

table.list { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
table.list th, table.list td { text-align: left; padding: .65rem .9rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.list th { background: #f9fafb; font-weight: 600; font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
table.list tr:last-child td { border-bottom: 0; }
table.list td.actions { text-align: right; white-space: nowrap; }
table.list td.actions form { display: inline; }
.muted { color: var(--muted); }

.flash { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.flash-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.flash-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

form div { margin-bottom: 1rem; }
form label { display: block; font-weight: 500; margin-bottom: .3rem; }
form input[type=text], form input[type=email], form input[type=password], form select {
  width: 100%; padding: .55rem .7rem; border: 1px solid #d1d5db; border-radius: 6px; font: inherit; background: #fff;
}
form input:focus, form select:focus { outline: 2px solid #c7d2fe; border-color: var(--primary); }
form .help-text, form .form-help { display: block; font-size: .85rem; color: var(--muted); margin-top: .3rem; }
form ul { margin: .3rem 0 0; padding-left: 1.2rem; color: var(--danger); font-size: .9rem; }
form .checkbox { display: flex; align-items: center; gap: .5rem; }
form .checkbox label { margin: 0; font-weight: 400; }
form .form-actions { display: flex; gap: .75rem; align-items: center; margin-top: 1.5rem; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-card { width: 100%; max-width: 380px; }
.login-card .login-logo { display: block; text-align: center; margin-bottom: 1rem; }
.login-card .login-logo img { max-width: 160px; height: auto; }
.login-card h1 { text-align: center; }
.login-card .sub { text-align: center; color: var(--muted); margin: -.5rem 0 1.5rem; }
.login-card .btn { width: 100%; }
.alert { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }


/* ---- Compléments Design ---- */
.retour { margin: 0 0 .75rem; }
.petit { font-size: .9rem; }
.table-wrap { overflow-x: auto; }
form.inline { display: inline; }
form.inline div { margin-bottom: 0; }
.badge-ok { background: #dcfce7; color: #166534; }
.vide { text-align: center; color: var(--muted); padding: 3rem 1rem; }
.form-etroit { max-width: 640px; }
.form-etroit form div { margin-bottom: 1rem; }
form input[type=url] { width: 100%; padding: .55rem .7rem; border: 1px solid #d1d5db; border-radius: 6px; font: inherit; background: #fff; }
.page-head { align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.actions-tete { display: flex; gap: .5rem; flex-wrap: wrap; }
.actions-tete form div { margin: 0; }

.onglets { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.onglets a { padding: .5rem .9rem; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.onglets a.active, .onglets a:hover { color: var(--text); border-bottom-color: var(--primary); }
td.origine { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.grille-maquette { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
@media (max-width: 900px) { .grille-maquette { grid-template-columns: 1fr; } }
.apercu { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.apercu-barre { display: flex; justify-content: space-between; align-items: center; padding: .5rem .9rem; border-bottom: 1px solid var(--border); font-size: .9rem; color: var(--muted); }
.apercu-barre .tailles { display: flex; gap: .25rem; }
.apercu-barre .tailles .active { background: var(--primary); color: #fff; border-color: var(--primary); }
.apercu-cadre { background: #e5e7eb; padding: .5rem; text-align: center; }
.apercu-cadre iframe { width: 100%; max-width: 100%; height: 75vh; min-height: 480px; border: 0; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.15); transition: width .2s; }
.panneau { display: flex; flex-direction: column; gap: 1rem; }
.panneau .card { padding: 1rem 1.25rem; }
.panneau h2 { font-size: 1rem; margin: 0 0 .6rem; }
.panneau form div { margin-bottom: .6rem; }
.panneau form label { font-size: .85rem; }
.copie-lien { display: flex; gap: .4rem; margin-bottom: .6rem; }
.copie-lien input { flex: 1; min-width: 0; padding: .4rem .5rem; border: 1px solid #d1d5db; border-radius: 6px; font: inherit; font-size: .85rem; }
.liste-partages { list-style: none; margin: 0 0 .75rem; padding: 0; }
.liste-partages li { display: flex; justify-content: space-between; align-items: center; padding: .35rem 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.liste-partages li:last-child { border-bottom: 0; }

/* Liens vers d'autres maquettes (fiche) */
.liste-liens li { gap: .5rem; }
.liste-liens .lien-desc { display: flex; flex-direction: column; min-width: 0; }
.liste-liens .lien-texte { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.liste-liens .lien-actions { display: flex; gap: .25rem; flex-shrink: 0; }
.dialog { border: 0; border-radius: 12px; padding: 1.5rem 1.75rem; width: min(480px, calc(100% - 2rem)); box-shadow: 0 20px 50px rgba(0,0,0,.3); color: var(--text); }
.dialog::backdrop { background: rgba(17,24,39,.55); }
.dialog h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
.dialog .lien-cite { margin: 0 0 .75rem; word-break: break-all; }
.dialog label { display: block; font-size: .85rem; margin-bottom: .3rem; }
.dialog select { width: 100%; padding: .45rem .5rem; border: 1px solid #d1d5db; border-radius: 6px; font: inherit; }
.dialog-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1.25rem; flex-wrap: wrap; }
