/* Studio Machine — Gestion
   Interface sobre : la donnée doit ressortir, pas l'habillage. */

:root {
    --encre:      #14161a;
    --encre-2:    #3d434d;
    --encre-3:    #6b7280;
    --trait:      #e3e5e9;
    --fond:       #f6f7f9;
    --surface:    #ffffff;
    --accent:     #9a0f20;
    --accent-pale:#fdf2f3;
    --ok:         #0f7b4f;
    --alerte:     #b45309;
    --rayon:      10px;
    --ombre:      0 1px 2px rgba(20,22,26,.05), 0 4px 12px rgba(20,22,26,.04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--fond);
    color: var(--encre);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ---------- Charpente ---------- */

.app { display: flex; min-height: 100vh; }

.rail {
    width: 240px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--trait);
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.rail-marque {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 8px 22px;
}
.rail-logo {
    width: 30px; height: 30px;
    display: grid; place-items: center;
    background: var(--encre); color: #fff;
    border-radius: 8px;
    font-size: 12px; font-weight: 700; letter-spacing: .04em;
}
.rail-nom { font-weight: 600; letter-spacing: -.01em; }

.rail-nav { display: flex; flex-direction: column; gap: 2px; }
.rail-nav a {
    padding: 8px 10px;
    border-radius: 7px;
    color: var(--encre-2);
    font-size: 14px;
    transition: background .12s, color .12s;
}
.rail-nav a:hover { background: var(--fond); color: var(--encre); }
.rail-nav a.on { background: var(--accent-pale); color: var(--accent); font-weight: 600; }

.rail-sep {
    font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
    color: var(--encre-3); padding: 20px 10px 6px; font-weight: 600;
}

.rail-pied { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--trait); }
.rail-user { padding: 0 10px 10px; display: flex; flex-direction: column; }
.rail-user strong { font-size: 14px; }
.rail-user span  { font-size: 12px; color: var(--encre-3); }

.lien-discret {
    background: none; border: 0; cursor: pointer;
    color: var(--encre-3); font-size: 13px; padding: 4px 10px;
    font-family: inherit;
}
.lien-discret:hover { color: var(--accent); }

.vue { flex: 1; padding: 30px 36px 60px; max-width: 1400px; }

/* ---------- Titres et barres ---------- */

.tete {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 20px; margin-bottom: 24px; flex-wrap: wrap;
}
.tete h1 { font-size: 24px; font-weight: 650; letter-spacing: -.02em; }
.tete .sous { color: var(--encre-3); font-size: 14px; margin-top: 2px; }

.outils { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Cartes de chiffres ---------- */

.chiffres {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.chiffre {
    background: var(--surface);
    border: 1px solid var(--trait);
    border-radius: var(--rayon);
    padding: 16px 18px;
    box-shadow: var(--ombre);
}
.chiffre .etiquette {
    font-size: 12px; color: var(--encre-3);
    text-transform: uppercase; letter-spacing: .05em; font-weight: 600;
}
.chiffre .valeur {
    font-size: 30px; font-weight: 650; letter-spacing: -.03em;
    margin-top: 6px; font-variant-numeric: tabular-nums;
}
.chiffre .note { font-size: 12px; color: var(--encre-3); margin-top: 3px; }
.chiffre.fort .valeur { color: var(--accent); }

/* ---------- Panneaux ---------- */

.grille { display: grid; gap: 16px; }
.grille-2 { grid-template-columns: 2fr 1fr; }
@media (max-width: 1050px) { .grille-2 { grid-template-columns: 1fr; } }

.panneau {
    background: var(--surface);
    border: 1px solid var(--trait);
    border-radius: var(--rayon);
    box-shadow: var(--ombre);
    overflow: hidden;
}
.panneau > h2 {
    font-size: 14px; font-weight: 650;
    padding: 14px 18px;
    border-bottom: 1px solid var(--trait);
    display: flex; justify-content: space-between; align-items: center;
}
.panneau > h2 .aide { font-weight: 400; color: var(--encre-3); font-size: 12px; }
.panneau-corps { padding: 18px; }

/* ---------- Tableaux ---------- */

.tableau-cadre { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
    text-align: left; font-size: 11px; font-weight: 650;
    text-transform: uppercase; letter-spacing: .05em;
    color: var(--encre-3);
    padding: 10px 18px;
    border-bottom: 1px solid var(--trait);
    white-space: nowrap;
}
td {
    padding: 12px 18px;
    border-bottom: 1px solid var(--trait);
    vertical-align: middle;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--fond); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.vide { padding: 40px 18px; text-align: center; color: var(--encre-3); font-size: 14px; }

/* ---------- Éléments ---------- */

.pastille {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 12px; font-weight: 600;
    background: var(--fond); color: var(--encre-2);
    border: 1px solid var(--trait);
}
.pastille-nouveau  { background: var(--accent-pale); color: var(--accent); border-color: #f4d3d7; }
.pastille-contacte { background: #eef4ff; color: #1d4ed8; border-color: #d6e3ff; }
.pastille-qualifie { background: #fff7e6; color: var(--alerte); border-color: #fde8c3; }
.pastille-gagne    { background: #e9f7f0; color: var(--ok); border-color: #c9ecdb; }
.pastille-perdu    { background: var(--fond); color: var(--encre-3); }

.reseau { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.point { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.point-tiktok    { background: #14161a; }
.point-facebook  { background: #1877f2; }
.point-instagram { background: #d62976; }
.point-youtube   { background: #ff0000; }
.point-direct    { background: var(--encre-3); }

/* Barre de proportion dans un tableau */
.jauge { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.jauge-rail { flex: 1; height: 6px; background: var(--trait); border-radius: 3px; overflow: hidden; }
.jauge-part { height: 100%; background: var(--accent); border-radius: 3px; }

/* ---------- Graphique (barres CSS) ---------- */

.courbe {
    display: flex; align-items: flex-end; gap: 2px;
    height: 160px; padding: 0 2px;
}
.courbe-jour { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 1px; min-width: 3px; }
.courbe-visite { background: #d8dce3; border-radius: 2px 2px 0 0; min-height: 1px; }
.courbe-envoi  { background: var(--accent); border-radius: 2px 2px 0 0; min-height: 1px; }
.legende { display: flex; gap: 16px; font-size: 12px; color: var(--encre-3); margin-top: 12px; }
.legende span { display: inline-flex; align-items: center; gap: 6px; }
.carre { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* ---------- Formulaires ---------- */

label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.champ { margin-bottom: 16px; }
input[type=text], input[type=email], input[type=password], input[type=url],
input[type=search], select, textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--trait);
    border-radius: 7px;
    font-size: 14px;
    font-family: inherit;
    background: var(--surface);
    color: var(--encre);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-pale);
}
textarea { min-height: 90px; resize: vertical; }

.bouton {
    display: inline-block;
    padding: 9px 16px;
    background: var(--encre);
    color: #fff;
    border: 0; border-radius: 7px;
    font-size: 14px; font-weight: 600;
    cursor: pointer; font-family: inherit;
}
.bouton:hover { background: #000; }
.bouton-accent { background: var(--accent); }
.bouton-accent:hover { background: #7d0c1a; }
.bouton-fin {
    background: var(--surface); color: var(--encre-2);
    border: 1px solid var(--trait);
    padding: 8px 13px; font-size: 13px; font-weight: 500;
    border-radius: 7px; cursor: pointer; font-family: inherit;
}
.bouton-fin:hover { border-color: var(--encre-3); color: var(--encre); }
.bouton-fin.on { background: var(--encre); color: #fff; border-color: var(--encre); }

.erreur { color: var(--accent); font-size: 13px; margin-top: 5px; }

/* ---------- Avis ---------- */

.avis {
    padding: 11px 15px; border-radius: 8px;
    font-size: 14px; margin-bottom: 18px;
    border: 1px solid;
}
.avis-ok    { background: #e9f7f0; border-color: #c9ecdb; color: #0b5f3d; }
.avis-info  { background: #eef4ff; border-color: #d6e3ff; color: #1e40af; }
.avis-garde { background: #fff7e6; border-color: #fde8c3; color: #92400e; }

/* La clé API, affichée une seule fois */
.cle {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 13px;
    background: var(--encre); color: #7ee2b8;
    padding: 12px 14px; border-radius: 8px;
    word-break: break-all; margin-top: 8px;
}

/* ---------- Connexion ---------- */

.portail {
    min-height: 100vh;
    display: grid; place-items: center;
    padding: 24px;
    background: var(--fond);
}
.portail-boite {
    width: 100%; max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--trait);
    border-radius: 14px;
    box-shadow: var(--ombre);
    padding: 32px;
}
.portail-marque { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.portail h1 { font-size: 20px; font-weight: 650; letter-spacing: -.02em; }
.portail .sous { color: var(--encre-3); font-size: 14px; margin-bottom: 24px; }
.portail .bouton { width: 100%; text-align: center; padding: 11px; }

/* ---------- Pagination ---------- */

.pagination { display: flex; gap: 4px; margin-top: 18px; list-style: none; font-size: 14px; }
.pagination a, .pagination span {
    padding: 6px 11px; border-radius: 6px;
    border: 1px solid var(--trait); background: var(--surface);
    color: var(--encre-2);
}
.pagination .active span { background: var(--encre); color: #fff; border-color: var(--encre); }
.pagination svg { width: 14px; height: 14px; }

@media (max-width: 800px) {
    .app { flex-direction: column; }
    .rail {
        width: 100%; height: auto; position: static;
        flex-direction: row; align-items: center;
        overflow-x: auto; padding: 12px 14px;
    }
    .rail-marque { padding: 0 14px 0 4px; }
    .rail-nav { flex-direction: row; }
    .rail-sep { display: none; }
    .rail-pied { margin-top: 0; margin-left: auto; padding-top: 0; border: 0; display: flex; align-items: center; gap: 10px; }
    .rail-user { display: none; }
    .vue { padding: 20px 16px 50px; }
}

/* =====================================================================
   Publication : calendrier, éditeur, médiathèque
   ===================================================================== */

.pastille-brouillon  { background: var(--fond); color: var(--encre-3); }
.pastille-programmee { background: #eef4ff; color: #1d4ed8; border-color: #d6e3ff; }
.pastille-en_cours, .pastille-en_attente { background: #fff7e6; color: var(--alerte); border-color: #fde8c3; }
.pastille-publiee    { background: #e9f7f0; color: var(--ok); border-color: #c9ecdb; }
.pastille-partielle  { background: #fff7e6; color: var(--alerte); border-color: #fde8c3; }
.pastille-echec      { background: var(--accent-pale); color: var(--accent); border-color: #f4d3d7; }
.pastille-annulee    { background: var(--fond); color: var(--encre-3); text-decoration: line-through; }

/* ---------- Calendrier ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-entete {
    font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em;
    color: var(--encre-3); padding: 10px 10px; border-bottom: 1px solid var(--trait);
}
.cal-jour {
    min-height: 118px; padding: 6px 6px 8px;
    border-right: 1px solid var(--trait); border-bottom: 1px solid var(--trait);
    display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.cal-jour:nth-child(7n) { border-right: 0; }
.cal-jour.hors { background: var(--fond); }
.cal-jour.hors .cal-num { color: #b7bcc5; }
.cal-tete-jour { display: flex; justify-content: space-between; align-items: center; }
.cal-num { font-size: 13px; font-weight: 600; color: var(--encre-2); padding: 2px 4px; }
.cal-jour.auj .cal-num { background: var(--accent); color: #fff; border-radius: 6px; }
.cal-ajout {
    opacity: 0; font-size: 16px; line-height: 1; color: var(--encre-3);
    padding: 0 5px; border-radius: 5px;
}
.cal-jour:hover .cal-ajout { opacity: 1; }
.cal-ajout:hover { background: var(--fond); color: var(--accent); }
.cal-item {
    display: block; font-size: 12px; line-height: 1.3;
    background: var(--surface); border: 1px solid var(--trait);
    border-left: 3px solid var(--couleur, var(--encre-3));
    border-radius: 6px; padding: 4px 6px;
    overflow: hidden;
}
.cal-item:hover { border-color: var(--encre-3); border-left-color: var(--couleur, var(--encre-3)); }
.cal-item .h { font-weight: 650; font-variant-numeric: tabular-nums; }
.cal-item .t { color: var(--encre-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.cal-item .pts { display: inline-flex; gap: 3px; margin-left: 4px; vertical-align: middle; }
.cal-item.echec { background: var(--accent-pale); }
.cal-item.publiee { opacity: .75; }
@media (max-width: 900px) {
    .cal { grid-template-columns: 1fr; }
    .cal-entete { display: none; }
    .cal-jour { min-height: 0; border-right: 0; }
    .cal-jour.hors { display: none; }
}

/* ---------- Éditeur de publication ---------- */
.editeur { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .editeur { grid-template-columns: 1fr; } }
.editeur-apercu { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 14px; }
.rangee { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .rangee { grid-template-columns: 1fr; } }
input[type=date], input[type=time], input[type=color] {
    padding: 8px 10px; border: 1px solid var(--trait); border-radius: 7px;
    font: inherit; font-size: 14px; background: var(--surface); color: var(--encre); width: 100%;
}
input[type=color] { padding: 3px; height: 38px; }
.compteur { font-size: 12px; color: var(--encre-3); text-align: right; margin-top: 3px; font-variant-numeric: tabular-nums; }
.compteur.trop { color: var(--accent); font-weight: 600; }
.aide-champ { font-size: 12px; color: var(--encre-3); margin-top: 4px; }

.reseau-bloc { border: 1px solid var(--trait); border-radius: 8px; margin-bottom: 10px; }
.reseau-bloc > .reseau-tete {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer;
    font-size: 14px; font-weight: 600; margin: 0;
}
.reseau-tete input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
.reseau-tete .compte { font-weight: 400; color: var(--encre-3); font-size: 13px; margin-left: auto; }
.reseau-corps { padding: 4px 12px 12px 38px; display: none; }
.reseau-bloc.actif { border-color: var(--encre-3); }
.reseau-bloc.actif .reseau-corps { display: block; }
.reseau-bloc.inactif { opacity: .6; }
.coches { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 12px; }
.coches label { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 0; font-size: 14px; }
.coches input { accent-color: var(--accent); }
.coches label.grise { color: var(--encre-3); }

.choix-medias { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.vignette {
    position: relative; aspect-ratio: 1; border-radius: 7px; overflow: hidden;
    background: var(--fond); border: 2px solid transparent; cursor: pointer;
}
.vignette img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vignette .badge {
    position: absolute; left: 4px; bottom: 4px; background: rgba(20,22,26,.78); color: #fff;
    font-size: 10px; padding: 1px 5px; border-radius: 4px; font-variant-numeric: tabular-nums;
}
.vignette .ordre {
    position: absolute; right: 4px; top: 4px; width: 20px; height: 20px; border-radius: 50%;
    background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
    display: none; place-items: center;
}
.vignette.choisie { border-color: var(--accent); }
.vignette.choisie .ordre { display: grid; }
.vignette .sans { display: grid; place-items: center; height: 100%; font-size: 11px; color: var(--encre-3); }

.depot {
    border: 1.5px dashed var(--trait); border-radius: 8px; padding: 16px;
    text-align: center; color: var(--encre-3); font-size: 13px; cursor: pointer;
}
.depot.survol { border-color: var(--accent); background: var(--accent-pale); color: var(--accent); }
.envoi-ligne { font-size: 12px; margin-top: 8px; text-align: left; }
.envoi-ligne .jauge-rail { margin-top: 3px; }

.apercu {
    background: var(--surface); border: 1px solid var(--trait); border-radius: 12px;
    overflow: hidden; box-shadow: var(--ombre); font-size: 13px;
}
.apercu-tete { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-weight: 600; }
.apercu-media { background: #0d0e10; aspect-ratio: 4/5; display: grid; place-items: center; color: #6b7280; }
.apercu-media img { width: 100%; height: 100%; object-fit: cover; }
.apercu-media.vertical { aspect-ratio: 9/16; max-height: 420px; }
.apercu-texte { padding: 10px 12px 14px; white-space: pre-wrap; word-break: break-word; color: var(--encre-2); max-height: 160px; overflow: hidden; }
.onglets { display: flex; gap: 4px; flex-wrap: wrap; }

.barre-actions {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
    padding: 14px 18px; border-top: 1px solid var(--trait); background: var(--fond);
}
.barre-actions .espace { flex: 1; }

/* ---------- Médiathèque ---------- */
.galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.galerie-carte {
    background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon);
    overflow: hidden; box-shadow: var(--ombre); display: flex; flex-direction: column;
}
.galerie-carte .vignette { border-radius: 0; border: 0; cursor: default; }
.galerie-carte .infos { padding: 8px 10px; font-size: 12px; color: var(--encre-3); }
.galerie-carte .infos strong { display: block; color: var(--encre); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.galerie-carte form { padding: 0 10px 10px; }

.pastille-couleur { width: 10px; height: 10px; border-radius: 3px; display: inline-block; vertical-align: middle; margin-right: 6px; }
