/* =====================================================================
   Les Z'Acrau du RCT — Back-office (admin)
   ===================================================================== */

:root {
    --rouge:   #e2001a;
    --rouge-f: #b30015;
    --noir:    #0d0d0f;
    --sidebar: #131318;
    --sidebar-2: #1c1c22;
    --bg:      #f3f4f7;
    --carte:   #ffffff;
    --texte:   #1c1c22;
    --muted:   #7a7a86;
    --bord:    #e6e6ec;
    --ok:      #16a34a;
    --warn:    #d97706;
    --font:    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --radius:  14px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--texte); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* Icônes Material (SVG inline) */
.mi { width: 1.2em; height: 1.2em; fill: currentColor; vertical-align: -0.24em; flex: 0 0 auto; }
.sidebar nav a .mi { width: 20px; height: 20px; vertical-align: middle; }

.admin { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar { background: var(--sidebar); color: #cfcfd8; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { display: flex; align-items: center; gap: 12px; padding: 22px 22px; border-bottom: 1px solid #26262e; }
.sidebar .brand img { height: 40px; }
.sidebar .brand b { color: #fff; font-size: .98rem; line-height: 1.1; }
.sidebar .brand span { color: var(--rouge); font-size: .68rem; letter-spacing: 1.5px; text-transform: uppercase; }
.sidebar nav { padding: 16px 12px; flex: 1; }
.sidebar nav a {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px;
    font-weight: 600; font-size: .95rem; margin-bottom: 4px; color: #b6b6c2;
}
.sidebar nav a .ico { width: 22px; text-align: center; }
.sidebar nav a:hover { background: var(--sidebar-2); color: #fff; }
.sidebar nav a.actif { background: var(--rouge); color: #fff; }
.sidebar .bas { padding: 16px; border-top: 1px solid #26262e; font-size: .85rem; }
.sidebar .bas a { color: #9a9aa6; }
.sidebar .bas a:hover { color: #fff; }

/* ---------- Contenu ---------- */
.contenu { padding: 0; }
.topbar {
    background: #fff; border-bottom: 1px solid var(--bord);
    display: flex; align-items: center; gap: 16px; padding: 16px 28px; position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 1.25rem; margin: 0; font-weight: 800; }
.topbar .user { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: .9rem; color: var(--muted); }
.topbar .avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--noir); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; }
.zone { padding: 28px; }

/* ---------- Boutons ---------- */
.b { display: inline-flex; align-items: center; gap: 7px; padding: 10px 18px; border: 0; border-radius: 9px; font-weight: 700; font-size: .92rem; cursor: pointer; font-family: inherit; }
.b-rouge { background: var(--rouge); color: #fff; } .b-rouge:hover { background: var(--rouge-f); }
.b-noir  { background: var(--noir); color: #fff; }
.b-clair { background: #fff; border: 1.5px solid var(--bord); color: var(--texte); } .b-clair:hover { border-color: var(--noir); }
.b-danger { background: #fdeaec; color: #a1121f; } .b-danger:hover { background: #f8d3d7; }
.b-sm { padding: 6px 12px; font-size: .82rem; }

/* ---------- Cartes KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 26px; }
.kpi { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--radius); padding: 20px; }
.kpi .lab { color: var(--muted); font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.kpi .val { font-size: 2rem; font-weight: 900; margin-top: 6px; letter-spacing: -1px; }
.kpi .sub { font-size: .82rem; color: var(--muted); margin-top: 2px; }
.kpi.rouge { border-left: 4px solid var(--rouge); }
.kpi .val.warn { color: var(--warn); }

/* ---------- Panneaux / tableaux ---------- */
.grid-2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 22px; }
.panneau { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--radius); overflow: hidden; }
.panneau .tete { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--bord); }
.panneau .tete h2 { font-size: 1.05rem; margin: 0; font-weight: 800; }
.panneau .corps { padding: 6px 0; }

table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 12px 20px; border-bottom: 1px solid var(--bord); }
table.t td { padding: 14px 20px; border-bottom: 1px solid #f1f1f5; font-size: .93rem; vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr:hover td { background: #fafafc; }
.miniimg { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; background: #ececed; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-weight: 700; }
.b-star { border: 0; background: none; cursor: pointer; width: 34px; height: 34px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.b-star:hover { background: var(--bg); }
.b-star.on { color: var(--rouge); }
.b-star .mi { width: 20px; height: 20px; }

/* ---------- Badges statut ---------- */
.badge { display: inline-flex; align-items: center; padding: 4px 11px; border-radius: 999px; font-size: .76rem; font-weight: 800; }
.badge.nouvelle  { background: #eef2ff; color: #3149a8; }
.badge.confirmee { background: #e0f2fe; color: #075985; }
.badge.payee     { background: #dcfce7; color: #15803d; }
.badge.expediee  { background: #ffedd5; color: #c2410c; }
.badge.remise    { background: #f3e8ff; color: #7e22ce; }
.badge.annulee   { background: #fee2e2; color: #b91c1c; }
.badge.on  { background: #dcfce7; color: #15803d; }
.badge.off { background: #f1f1f5; color: #7a7a86; }
.badge.stock-bas { background: #fef3c7; color: #92400e; }
.badge.actu-badge { color: #fff; }
.badge.actu-badge.deplacement { background: #2563eb; }
.badge.actu-badge.soiree      { background: #7c3aed; }
.badge.actu-badge.match       { background: var(--rouge); }
.badge.actu-badge.info        { background: #0f766e; }

/* ---------- Formulaires ---------- */
.form-carte { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--radius); padding: 26px; max-width: 720px; }
.fg { margin-bottom: 18px; }
.fg label { display: block; font-weight: 700; margin-bottom: 7px; font-size: .9rem; }
.fg .req { color: var(--rouge); }
.fg input, .fg select, .fg textarea { width: 100%; padding: 11px 13px; border: 1.5px solid var(--bord); border-radius: 9px; font-size: .98rem; font-family: inherit; }
.fg input:focus, .fg select:focus, .fg textarea:focus { outline: none; border-color: var(--rouge); }
.fg textarea { min-height: 90px; resize: vertical; }
.fg-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.option-ligne { display: grid; grid-template-columns: 1fr 120px auto; gap: 10px; align-items: center; margin-bottom: 8px; }
.variante-ligne { display: grid; grid-template-columns: 90px 1fr 90px auto; gap: 10px; align-items: center; margin-bottom: 8px; }
.hint { color: var(--muted); font-size: .82rem; margin-top: 5px; }

/* Éditeur de texte riche */
.editeur-wrap { border: 1.5px solid var(--bord); border-radius: 9px; overflow: hidden; }
.editeur-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 8px 10px; background: #f7f7fa; border-bottom: 1.5px solid var(--bord); }
/* toutes les commandes : même hauteur, alignées, taille fixe (ne s'étirent pas) */
.editeur-toolbar > * { flex: 0 0 auto; }
.editeur-toolbar .et-btn { width: 34px; height: 34px; padding: 0; border: 1px solid var(--bord); background: #fff; border-radius: 7px; cursor: pointer; font-size: .95rem; display: inline-flex; align-items: center; justify-content: center; color: var(--texte); box-sizing: border-box; }
.editeur-toolbar .et-btn:hover { background: #fff; border-color: var(--noir); }
.editeur-toolbar .et-btn .mi { width: 18px; height: 18px; }
.et-b { font-weight: 900; } .et-i { font-style: italic; font-family: Georgia, serif; } .et-u { text-decoration: underline; }
.editeur-toolbar .et-select { width: auto; min-width: 118px; height: 34px; border: 1px solid var(--bord); border-radius: 7px; padding: 0 26px 0 10px; background: #fff; font-size: .88rem; line-height: 34px; cursor: pointer; color: var(--texte); box-sizing: border-box; }
.editeur-toolbar .et-color { position: relative; width: 34px; height: 34px; border: 1px solid var(--bord); border-radius: 7px; background: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-weight: 800; box-sizing: border-box; }
.et-color-a { border-bottom: 3px solid #e2001a; line-height: .8; font-size: 1rem; }
.editeur-toolbar .et-color input[type=color] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; padding: 0; border: 0; }
.et-sep { width: 1px; height: 24px; background: var(--bord); margin: 0 3px; }
.editeur { min-height: 200px; padding: 14px 16px; font-size: 1rem; line-height: 1.6; outline: none; background: #fff; }
.editeur:empty:before { content: attr(data-placeholder); color: var(--muted); }
.editeur a { color: var(--rouge); }
.editeur ul, .editeur ol { padding-left: 1.4em; }

/* Blocs couleur (produit-edit) */
.couleur-bloc { border: 1.5px solid var(--bord); border-radius: 12px; padding: 16px; margin-bottom: 14px; background: #fbfbfd; }
.couleur-tete { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.couleur-tete .pastille { width: 24px; height: 24px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); flex: 0 0 auto; }
.couleur-tete .c-nom { flex: 1; min-width: 120px; }
.couleur-tete .c-hex { width: 48px; height: 42px; padding: 3px; border: 1.5px solid var(--bord); border-radius: 9px; background: #fff; cursor: pointer; flex: 0 0 auto; }
.couleur-tete .suppr-couleur { flex: 0 0 auto; }
.couleur-corps { display: grid; grid-template-columns: 130px 1fr; gap: 16px; align-items: start; }
.c-image img { width: 130px; height: 130px; object-fit: cover; border-radius: 10px; background: #ececed; margin-bottom: 8px; }
.c-image input[type=file] { font-size: .78rem; width: 130px; }
.c-tailles-liste { margin-bottom: 6px; }
@media (max-width: 560px) {
    .couleur-corps { grid-template-columns: 1fr; }
    .couleur-tete { flex-wrap: wrap; }
}

/* ---------- Alertes ---------- */
.msg { padding: 13px 16px; border-radius: 10px; margin-bottom: 20px; font-weight: 600; }
.msg-ok  { background: #dcfce7; color: #15803d; }
.msg-err { background: #fee2e2; color: #b91c1c; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(900px 500px at 70% -10%, rgba(226,0,26,.25), transparent 60%), #0d0d0f; padding: 20px; }
.login-box { background: #fff; border-radius: 18px; padding: 38px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.login-box .logo { text-align: center; margin-bottom: 22px; }
.login-box .logo img { height: 64px; margin: 0 auto 10px; }
.login-box h1 { text-align: center; font-size: 1.3rem; margin: 0 0 4px; }
.login-box p.sous { text-align: center; color: var(--muted); font-size: .9rem; margin: 0 0 24px; }
.login-box .demo { margin-top: 18px; text-align: center; font-size: .8rem; color: var(--muted); background: #f7f7fa; padding: 10px; border-radius: 8px; }

.chart-wrap { padding: 10px 20px 20px; }

/* Galerie admin */
.galerie-admin { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.ga-tile { position: relative; aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden; background: #17171b; border: 3px solid transparent; }
.ga-tile.vedette { border-color: var(--rouge); }
.ga-tile img { width: 100%; height: 100%; object-fit: cover; }
.ga-star { position: absolute; top: 8px; left: 8px; background: var(--rouge); color: #fff; font-size: .7rem; font-weight: 800; padding: 4px 9px; border-radius: 999px; display: inline-flex; align-items: center; gap: 4px; }
.ga-star .mi { width: 14px; height: 14px; }
.ga-actions { position: absolute; bottom: 8px; right: 8px; display: flex; gap: 6px; }
.ga-actions form { margin: 0; }
.ga-btn { width: 36px; height: 36px; border: 0; border-radius: 9px; background: rgba(255,255,255,.92); color: var(--texte); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.ga-btn:hover { background: #fff; }
.ga-btn .mi { width: 20px; height: 20px; }
.ga-tile.vedette .ga-btn .mi { color: var(--rouge); }
.ga-suppr:hover { background: #fdeaec; color: #b91c1c; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .admin { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
    .sidebar nav { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px; }
    .sidebar nav a { margin: 0; padding: 8px 12px; }
    .sidebar .brand { border: 0; }
    .sidebar .bas { border: 0; }
    .kpis { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .kpis { grid-template-columns: 1fr; }
    .fg-row { grid-template-columns: 1fr; }
    .zone { padding: 16px; }
    table.t th:nth-child(3), table.t td:nth-child(3) { display: none; }
}

/* ---------- Paramètres : tuiles + fenêtres ---------- */
.param-tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; max-width: 960px; }
.param-tuile { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left; padding: 22px; background: var(--carte); border: 1.5px solid var(--bord); border-radius: var(--radius); cursor: pointer; font-family: inherit; color: var(--texte); transition: border-color .15s, box-shadow .15s, transform .15s; }
.param-tuile:hover { border-color: var(--rouge); box-shadow: 0 8px 24px rgba(0,0,0,.08); transform: translateY(-2px); }
.param-tuile .pt-icone { width: 46px; height: 46px; border-radius: 12px; background: #fdeaec; color: var(--rouge); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.param-tuile .pt-icone .mi { width: 26px; height: 26px; }
.param-tuile .pt-titre { font-weight: 800; font-size: 1.05rem; }
.param-tuile .pt-resume { color: var(--muted); font-size: .86rem; line-height: 1.45; }

dialog.modal { padding: 0; border: 0; border-radius: var(--radius); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: 0 24px 60px rgba(0,0,0,.3); color: var(--texte); }
dialog.modal::backdrop { background: rgba(13,13,15,.6); backdrop-filter: blur(2px); }
dialog.modal > form { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.modal-tete { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--bord); }
.modal-tete h2 { margin: 0; font-size: 1.1rem; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.modal-tete h2 .mi { color: var(--rouge); }
.modal-fermer { border: 0; background: none; cursor: pointer; width: 36px; height: 36px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.modal-fermer:hover { background: var(--bg); color: var(--texte); }
.modal-corps { padding: 20px 22px 4px; overflow-y: auto; }
.modal-pied { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--bord); background: #fafafc; }

/* ---------- Administrateurs : droits ---------- */
.droits { display: grid; gap: 8px; }
.fg label.droit { display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 10px 12px; border: 1.5px solid var(--bord); border-radius: 9px; cursor: pointer; font-weight: 400; }
.fg label.droit:has(input:checked) { border-color: var(--rouge); background: #fff7f7; }
.fg label.droit input { width: auto; margin: 3px 0 0; accent-color: var(--rouge); flex: none; }
.droit span { display: flex; flex-direction: column; gap: 2px; }
.droit small { color: var(--muted); font-size: .8rem; }
.puce-droit { display: inline-block; margin: 2px 4px 2px 0; padding: 3px 9px; border-radius: 999px; background: #f1f1f5; font-size: .76rem; font-weight: 700; white-space: nowrap; }
.puce-droit.tous { background: var(--noir); color: #fff; }
.avance { border: 1.5px solid var(--bord); border-radius: 9px; padding: 10px 14px; margin-bottom: 14px; }
.avance summary { cursor: pointer; font-weight: 700; font-size: .9rem; }
.modal-pied { flex-wrap: wrap; }

/* ---------- Commande : accusé de réception ---------- */
.case-ar { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1.5px solid var(--bord); border-radius: 9px; cursor: pointer; }
.case-ar:has(input:checked) { border-color: var(--rouge); background: #fff7f7; }
.case-ar input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--rouge); flex: none; }
.case-ar span { display: flex; flex-direction: column; gap: 3px; }
.case-ar small { color: var(--muted); font-size: .82rem; line-height: 1.4; }

/* ---------- Produit : tailles avec mesures H / L / l ---------- */
.variante-ligne { grid-template-columns: 80px 62px 62px 62px 80px 40px; }
.variante-entete { display: grid; grid-template-columns: 80px 62px 62px 62px 80px 40px; gap: 10px; margin-bottom: 6px; font-size: .78rem; font-weight: 700; color: var(--muted); }
@media (max-width: 620px) { .variante-ligne, .variante-entete { grid-template-columns: 64px 1fr 1fr 1fr 64px 40px; gap: 6px; } }
