/*
THESIS: un bureau éditorial dense, pas un tableau de bord à cartes.
OWN-WORLD: bleu nuit mat, papier froid, cyan fonctionnel, filets francs et mégaphone blanc.
STORY: retrouver un contenu, vérifier son état, agir, puis passer au canal suivant.
FIRST VIEWPORT: rail de travail à gauche, titre et état en haut, liste éditoriale immédiatement visible.
FORM: poste de rédaction compact, pensé pour une seule personne et ses tâches récurrentes.
*/
:root {
    --admin-night: #061827;
    --admin-night-2: #0b2538;
    --admin-cyan: #009ee0;
    --admin-cyan-soft: #dff5ff;
    --admin-paper: #eef2f3;
    --admin-white: #fff;
    --admin-ink: #071b2b;
    --admin-muted: #536977;
    --admin-line: #c8d4d9;
    --admin-danger: #9d2434;
    --admin-focus: #ffd34f;
    --admin-ease: cubic-bezier(.22,1,.36,1);
}

.admin-shell {
    margin: 0;
    background: var(--admin-paper);
    color: var(--admin-ink);
    font-family: "DM Sans", sans-serif;
    --sm-font-body: "DM Sans", sans-serif;
    --sm-font-heading: "DM Sans", sans-serif;
    font-size: 17px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
.admin-shell :focus-visible { outline: 3px solid var(--admin-focus); outline-offset: 3px; }
.admin-layout { min-height: 100vh; display: grid; grid-template-columns: 232px minmax(0,1fr); background: var(--admin-paper); }

.admin-sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    width: 232px;
    height: 100vh;
    overflow-y: auto;
    padding: 0 0 22px;
    border-right: 1px solid rgba(255,255,255,.12);
    background: var(--admin-night);
    color: #fff;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.25) transparent;
}
.admin-sidebar-brand { padding: 30px 20px 24px; margin-bottom: 6px; }
.admin-sidebar-brand a { display: flex; align-items: center; gap: 12px; color: #fff; font-size: 1rem; font-weight: 700; text-decoration: none; }
.admin-sidebar-brand img { width: 18px; height: 25px; object-fit: contain; filter: brightness(0) invert(1); transform: rotate(-4deg); }
.admin-sidebar-brand small { display: block; margin: 8px 0 0 30px; color: #a9bfca; font-size: .8rem; font-weight: 600; letter-spacing: .04em; }

.admin-nav { padding: 0 12px; list-style: none; }
.admin-nav li { margin: 0; }
.admin-nav .admin-nav-label { margin: 23px 10px 8px; color: #91a9b6; font-size: .75rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.admin-nav .admin-nav-label:first-child { margin-top: 8px; }
.admin-nav .admin-nav-label-account { padding-top: 18px; border-top: 1px solid rgba(255,255,255,.1); }
.admin-nav a {
    position: relative;
    min-height: 46px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 10px;
    border: 1px solid transparent;
    color: #b9ccd6;
    font-size: .94rem;
    font-weight: 650;
    line-height: 1.15;
    text-decoration: none;
    transition: color .18s ease,background-color .18s ease,border-color .18s ease,transform .2s var(--admin-ease);
}
.admin-nav a::before { position: absolute; inset: 8px auto 8px -12px; width: 3px; background: var(--admin-cyan); content: ""; opacity: 0; transform: scaleY(.25); transition: opacity .18s ease,transform .24s var(--admin-ease); }
.admin-nav a svg { width: 16px; height: 16px; flex: 0 0 auto; stroke-width: 1.7; }
.admin-nav a:hover { color: #fff; background: rgba(255,255,255,.055); transform: translateX(2px); }
.admin-nav a.active { border-color: rgba(0,158,224,.28); background: rgba(0,158,224,.12); color: #fff; }
.admin-nav a.active::before { opacity: 1; transform: scaleY(1); }
.admin-nav a.active svg { color: var(--admin-cyan); }

.admin-main {
    min-width: 0;
    max-width: 1480px;
    width: 100%;
    padding: 34px clamp(28px,4.6vw,72px) 70px;
    background: var(--admin-paper);
}
.admin-main::before { position: fixed; inset: 0 0 auto 232px; z-index: 0; height: 4px; background: linear-gradient(90deg,var(--admin-cyan) 0 96px,var(--admin-night) 96px 100%); content: ""; pointer-events: none; }
.admin-main > * { position: relative; z-index: 1; }
.admin-mobile-bar,.admin-sidebar-backdrop { display: none; }

.admin-header {
    min-height: 108px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
    margin: 0 0 24px;
    padding: 18px 0 22px;
    border-bottom: 2px solid var(--admin-ink);
}
.appointments-admin-actions { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.appointments-admin-actions form { margin:0; }
.admin-kicker { display: block; margin-bottom: 6px; color: #087aa8; font-size: .8rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.admin-title { margin: 0; color: var(--admin-ink); font-family: "DM Sans",sans-serif; font-size: clamp(2.15rem,3.6vw,3.5rem); font-weight: 700; line-height: 1; letter-spacing: -.04em; }
.admin-summary { margin: 12px 0 0; color: var(--admin-muted); font-size: 1rem; font-weight: 500; }

.admin-shell .btn,.admin-shell .btn-blue,.admin-shell .btn-outline,.admin-shell button.btn-delete {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 15px;
    border: 1px solid var(--admin-night);
    border-radius: 0;
    background: var(--admin-night);
    color: #fff;
    font: 700 .92rem/1 "DM Sans",sans-serif;
    text-decoration: none;
    cursor: pointer;
    transform-origin: center;
    transition: transform .22s var(--admin-ease),box-shadow .22s var(--admin-ease),background-color .18s ease,color .18s ease,border-color .18s ease;
}
.admin-shell .btn > *,.admin-shell .btn-blue > * { transition: transform .22s var(--admin-ease); }
.admin-shell .btn:hover,.admin-shell .btn-blue:hover { background: var(--admin-cyan); border-color: var(--admin-cyan); color: var(--admin-night); transform: translateY(-2px) scale(1.025); box-shadow: 8px 8px 0 rgba(7,27,43,.12); }
.admin-shell .btn:hover > *,.admin-shell .btn-blue:hover > * { transform: scale(1.04); }
.admin-shell .btn-outline { background: transparent; color: var(--admin-night); }
.admin-shell .btn-outline:hover { background: var(--admin-night); color: #fff; transform: translateY(-2px); }
.admin-shell .btn-sm { min-height: 38px; padding-inline: 12px; font-size: .88rem; }
.admin-shell button.btn-delete { min-height: 38px; padding-inline: 11px; background: transparent; border-color: #d4aab0; color: var(--admin-danger); font-size: .86rem; }
.admin-shell button.btn-delete:hover { background: var(--admin-danger); border-color: var(--admin-danger); color: #fff; transform: translateY(-1px); }
.admin-shell button:active,.admin-shell .btn:active { transform: scale(.975); }

.admin-table { width: 100%; overflow: visible; border: 0; border-top: 1px solid var(--admin-ink); border-bottom: 1px solid var(--admin-ink); border-radius: 0 !important; border-collapse: collapse; background: rgba(255,255,255,.7); box-shadow: none; }
.admin-table thead { background: transparent; color: var(--admin-muted); }
.admin-table th { padding: 13px 14px 11px; border-bottom: 1px solid var(--admin-line); color: var(--admin-muted); font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
.admin-table td { padding: 18px 14px; border-top: 1px solid var(--admin-line); color: var(--admin-ink); font-size: .95rem; vertical-align: middle; }
.admin-table td:first-child { width: 36%; }
.admin-table td strong { font-size: 1rem; font-weight: 700; }
.admin-table tbody tr { transition: background-color .18s ease; }
.admin-table tbody tr:hover { background: var(--admin-white); box-shadow: inset 4px 0 0 var(--admin-cyan); }
.admin-slug { color: #607681; font-size: .82rem; }
.admin-muted { color: #82949d; }
.admin-inline-form { display: inline; }
.admin-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.admin-actions a { position: relative; min-height: 38px; display: inline-flex; align-items: center; padding: 0 9px; border-bottom: 1px solid var(--admin-line); color: var(--admin-ink); font-size: .88rem; font-weight: 700; transition: color .16s ease,border-color .16s ease,transform .2s var(--admin-ease); }
.admin-actions a:hover { border-color: var(--admin-cyan); color: #006f9f; transform: translateY(-1px); }

.editor-panel,.newsletter-send-card,.stat-card,.soc-slot-card,.soc-draft,.soc-queue,.studio-panel { border: 1px solid var(--admin-line); border-radius: 0; background: rgba(255,255,255,.86); box-shadow: none; }
.editor-panel { padding: 22px; }
.editor-panel h3 { color: var(--admin-muted); font-size: .82rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.admin-stats { display: flex; gap: 0; margin: -4px 0 24px; border-top: 1px solid var(--admin-line); border-bottom: 1px solid var(--admin-line); }
.stat-card { min-width: 148px; padding: 12px 18px 13px; border: 0; border-right: 1px solid var(--admin-line); background: transparent; text-align: left; }
.stat-card::before { display: none; }
.stat-card .stat-number { color: var(--admin-ink); font-size: 1.45rem; font-weight: 780; letter-spacing: -.045em; }
.stat-card .stat-label { color: var(--admin-muted); font-size: .78rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.form-group label,.weekly-field label,.studio-field > label { color: var(--admin-ink); font-size: .9rem; font-weight: 700; }
.form-group input[type="text"],.form-group input[type="email"],.form-group select,.form-group textarea,.weekly-field input,.weekly-field textarea,.studio-field input:not([type="range"]),.studio-field select { border: 1px solid var(--admin-line); border-radius: 0; background: #fff; color: var(--admin-ink); box-shadow: none; }
.form-group input:focus,.form-group select:focus,.form-group textarea:focus,.weekly-field input:focus,.weekly-field textarea:focus { border-color: var(--admin-cyan); box-shadow: 0 0 0 3px rgba(0,158,224,.14); }
.form-group textarea { min-height: 340px; }
.status-badge { min-height: 28px; display: inline-flex; align-items: center; padding: 0 9px; border-radius: 0; font-size: .82rem; font-weight: 700; }
.status-published { background: #d9f4e6; color: #17673e; }
.status-draft { background: #fff0c9; color: #785512; }
.status-pending_review,.status-held { background:#fff0c9; color:#785512; }
.status-email_pending { background:#e5edf1; color:#506977; }
.status-email_failed { background:#f6e4e7; color:#8a2634; }
.status-confirmed,.status-booked { background:#d9f4e6; color:#17673e; }
.status-declined,.status-cancelled { background:#f6e4e7; color:#8a2634; }
.status-available { background:#dff5ff; color:#06658d; }
.alert { border: 1px solid currentColor; border-radius: 0; font-size: .95rem; }
.empty-state { border: 1px dashed var(--admin-line); background: rgba(255,255,255,.62); }
.empty-state h2 { font-family: "DM Sans",sans-serif; }
.soc-note,.soc-col,.soc-col-item,.soc-media img,.soc-text,.soc-btn,.soc-modal,.soc-modal select,.soc-modal input { border-radius: 0 !important; }
.soc-note { border: 1px solid #8ec9e1; box-shadow: none; }
.soc-col { border: 1px solid var(--admin-line) !important; box-shadow: none !important; }
.soc-pill { border-radius: 999px; }
.weekly-head h1 { font-family: "DM Sans",sans-serif; font-weight: 780; letter-spacing: -.04em; }

.appointments-admin-section { margin-top:38px; border-top:1px solid var(--admin-ink); }
.appointments-admin-heading { display:flex; justify-content:space-between; gap:28px; align-items:end; padding:20px 0; border-bottom:1px solid var(--admin-line); }
.appointments-admin-heading h2 { margin:0; font:700 1.7rem/1.1 "DM Sans",sans-serif; letter-spacing:-.03em; }
.appointments-admin-heading p { max-width:440px; margin:0; color:var(--admin-muted); font-size:.95rem; line-height:1.55; }
.appointments-slot-form { display:flex; gap:14px; align-items:end; padding:22px 0; }
.appointments-slot-form .form-group { min-width:min(100%,340px); margin:0; }
.appointments-slot-form input[type="datetime-local"] { box-sizing:border-box; width:100%; min-height:42px; padding:8px 10px; border:1px solid var(--admin-line); border-radius:0; background:#fff; }
.appointments-admin-list { border-bottom:1px solid var(--admin-ink); }
.appointment-admin-item { display:grid; grid-template-columns:minmax(180px,.28fr) minmax(260px,.72fr); gap:34px; padding:28px 0; border-top:1px solid var(--admin-line); }
.appointment-admin-item>header { display:flex; align-items:flex-start; flex-direction:column; gap:7px; }
.appointment-admin-item>header>div { display:flex; gap:10px; align-items:center; margin-bottom:8px; }
.appointment-admin-item time { color:var(--admin-muted); font-size:.86rem; font-weight:600; }
.appointment-admin-item>header strong { font-size:1rem; }
.appointment-admin-item>header a { color:#0879a9; font-size:.88rem; }
.appointment-admin-copy h3 { margin:0 0 10px; font-size:1rem; }
.appointment-admin-copy p { margin:0; color:#425b69; font-size:.95rem; line-height:1.65; white-space:normal; }
.appointment-admin-decision { grid-column:2; padding-top:18px; border-top:1px solid var(--admin-line); }
.appointment-admin-decision label { display:block; margin-bottom:7px; font-size:.88rem; font-weight:700; }
.appointment-admin-decision textarea { box-sizing:border-box; width:100%; padding:10px; border:1px solid var(--admin-line); border-radius:0; resize:vertical; }
.appointment-admin-decision>div { display:flex; gap:10px; margin-top:10px; }
.appointments-slots-list>div { min-height:58px; display:grid; grid-template-columns:minmax(170px,1fr) 140px auto; gap:18px; align-items:center; border-bottom:1px solid var(--admin-line); font-size:.94rem; }
.appointments-slots-list form { margin:0; }

/* Plancher de lisibilité commun : les modules historiques ne redescendent plus sous 14 px. */
.admin-shell .admin-main :where(h1,h2,h3,h4,h5,h6,p,a,button,input,select,textarea,label,li,td,th,small,strong,em,summary,legend) { font-family: "DM Sans",sans-serif; }
.admin-shell .admin-main :where(p,li,td,label,small) { line-height: 1.55; }
.admin-shell .admin-main :where(p,li,td,label) { font-size: max(.9rem,14px); }
.admin-shell .admin-main small { font-size: max(.82rem,13px); }
.admin-shell .admin-main :where(a,button,legend,summary) { font-size: max(.85rem,13.5px); }
.admin-shell .admin-main :where(input,select,textarea) { font-family: "DM Sans",sans-serif; font-size: max(1rem,16px); line-height: 1.45; }
.admin-shell .admin-main :where(button,.btn,.btn-blue,.btn-outline) { font-family: "DM Sans",sans-serif; }
@media(max-width:760px){.appointments-admin-heading,.appointments-slot-form{align-items:stretch;flex-direction:column}.appointments-admin-actions,.appointments-admin-actions form,.appointments-admin-actions .btn,.appointments-admin-actions .btn-outline{width:100%}.appointments-admin-actions .btn,.appointments-admin-actions .btn-outline{justify-content:center}.appointment-admin-item{grid-template-columns:1fr;gap:18px}.appointment-admin-decision{grid-column:1}.appointment-admin-decision>div{align-items:stretch;flex-direction:column}.appointments-slots-list>div{grid-template-columns:1fr auto;padding:12px 0}.appointments-slots-list form{grid-column:1/-1}}

@media (max-width: 1100px) {
    .admin-main { padding-inline: 28px; }
    .editor-layout { grid-template-columns: 1fr; }
    .admin-table td:first-child { width: auto; }
}
@media (max-width: 860px) {
    .admin-layout { display: block; }
    .admin-shell .admin-sidebar { display: block; position: fixed; inset: 0 auto 0 0; width: min(300px,86vw); transform: translateX(-104%); transition: transform .3s var(--admin-ease); }
    .admin-nav-open { overflow: hidden; }
    .admin-nav-open .admin-sidebar { display: block; transform: translateX(0); }
    .admin-sidebar-backdrop { position: fixed; inset: 0; z-index: 35; border: 0; background: rgba(4,19,31,.64); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
    .admin-nav-open .admin-sidebar-backdrop { display: block; opacity: 1; pointer-events: auto; }
    .admin-main { max-width: none; padding: 0 18px 46px; background-size: 54px 54px; }
    .admin-main::before { display: none; }
    .admin-mobile-bar { position: sticky; top: 0; z-index: 30; min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 -18px 18px; padding: 0 18px; border-top: 1px solid var(--admin-cyan); background: rgba(6,24,39,.98); color: #fff; }
    .admin-mobile-bar > a { display: inline-flex; align-items: center; gap: 10px; color: #fff; font-size: .95rem; font-weight: 700; text-decoration: none; }
    .admin-mobile-bar img { width: 14px; height: 20px; object-fit: contain; filter: brightness(0) invert(1); }
    .admin-mobile-bar button { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content:center; gap: 8px; padding: 0 12px; border: 1px solid rgba(255,255,255,.3); border-radius: 0; background: transparent; color: #fff; font: 700 .9rem "DM Sans",sans-serif; }
    .admin-mobile-bar svg { width: 16px; height: 16px; }
    .admin-header { min-height: 94px; margin-bottom: 18px; padding-top: 8px; }
    .admin-table { display: block; overflow-x: auto; white-space: nowrap; }
    .admin-table td { min-width: 120px; white-space: normal; }
}
@media (max-width: 560px) {
    .admin-header { align-items: flex-start; flex-direction: column; gap: 16px; }
    .admin-header > .btn,.admin-header > .admin-actions { width: 100%; }
    .admin-header > .btn { justify-content: center; }
    .admin-title { font-size: 2.5rem; }
    .admin-stats { overflow-x: auto; }
    .stat-card { min-width: 124px; }
    .editor-panel { padding: 16px; }
    .newsletter-send-card { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) {
    .admin-shell *, .admin-shell *::before, .admin-shell *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
    .admin-shell .btn:hover,.admin-shell .btn-blue:hover,.admin-shell .btn-outline:hover,.admin-nav a:hover,.admin-actions a:hover { transform: none; }
}
