/* Espace admin A&D Coiffure : compact, lisible, sans défilement inutile */
:root {
    --g-50: #f2f8f2;
    --g-100: #e1f0e1;
    --g-200: #bfe0bf;
    --g-500: #058805;
    --g-600: #047204;
    --g-700: #035c03;
    --gold: #c9a227;
    --ink: #1d2327;
    --ink-2: #4b555c;
    --ink-3: #7c868d;
    --line: #e6e9eb;
    --bg: #f5f6f4;
    --card: #ffffff;
    --danger: #c0392b;
    --danger-bg: #fdecea;
    --warn: #a86b00;
    --warn-bg: #fff4dc;
    --radius: 12px;
    --side-w: 236px;
    --shadow: 0 1px 2px rgba(16, 24, 16, 0.05), 0 2px 8px rgba(16, 24, 16, 0.04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.adm, body.auth {
    font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 14.5px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
}
a { color: var(--g-600); text-decoration: none; }
a:hover { color: var(--g-700); }
h1, h2, h3 { font-family: "Roboto Slab", Georgia, serif; color: var(--ink); margin: 0; line-height: 1.25; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
img { max-width: 100%; }
[data-lucide] { width: 18px; height: 18px; stroke-width: 1.9; flex-shrink: 0; }

/* ---------- Structure ---------- */
.adm-side {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--side-w);
    background: #fff;
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    padding: 14px 12px;
    z-index: 40;
    overflow-y: auto;
    transition: transform 0.2s ease;
}
.adm-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; border-bottom: 1px solid var(--line); margin-bottom: 10px; color: var(--ink); }
.adm-brand img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--g-50); }
.adm-brand span { font-family: "Roboto Slab", serif; font-size: 1.05rem; }
.adm-side nav, .adm-side-foot { display: flex; flex-direction: column; gap: 2px; }
.adm-side-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.adm-side a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 10px;
    border-radius: 8px;
    color: var(--ink-2);
    font-weight: 500;
}
.adm-side a:hover { background: var(--g-50); color: var(--ink); }
.adm-side a.active { background: var(--g-100); color: var(--g-700); font-weight: 600; }
.adm-side a.active [data-lucide] { color: var(--g-600); }

.adm-main { margin-left: var(--side-w); min-height: 100vh; display: flex; flex-direction: column; }
.adm-top {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 28px;
    background: rgba(245, 246, 244, 0.92);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--line);
}
.adm-top-title { flex: 1; min-width: 0; }
.adm-top h1 { font-size: 1.35rem; }
.adm-top p { margin: 2px 0 0; color: var(--ink-3); font-size: 0.9rem; }
.adm-top-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.adm-burger { display: none; }
.adm-content { padding: 22px 28px 40px; max-width: 1400px; width: 100%; }
.adm-backdrop { display: none; }

@media (max-width: 980px) {
    .adm-side { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0, 0, 0, 0.15); }
    body.adm-nav-open .adm-side { transform: none; }
    body.adm-nav-open .adm-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.3); z-index: 35; }
    .adm-main { margin-left: 0; }
    .adm-burger {
        display: inline-flex; align-items: center; justify-content: center;
        width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line);
        background: #fff; cursor: pointer; color: var(--ink);
    }
    .adm-top { padding: 10px 16px; }
    .adm-content { padding: 16px 16px 32px; }
    .adm-top h1 { font-size: 1.15rem; }
}

/* ---------- Messages ---------- */
.adm-flash { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.adm-flash-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-radius: 10px;
    background: var(--g-50); border: 1px solid var(--g-200); color: var(--g-700);
    transition: opacity 0.4s ease, max-height 0.4s ease, padding 0.4s ease, margin 0.4s ease;
    max-height: 80px; overflow: hidden;
}
.adm-flash-item.error { background: var(--danger-bg); border-color: #f3c5bf; color: var(--danger); }
.adm-flash-item.info { background: #eef4fb; border-color: #cfe0f3; color: #24548a; }
.adm-flash-item.fade { opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; border-width: 0; }

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    height: 38px; padding: 0 15px; border-radius: 9px;
    border: 1px solid var(--line); background: #fff; color: var(--ink);
    font: 600 0.88rem Inter, system-ui, sans-serif; cursor: pointer; white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn:hover { border-color: #cfd4d7; background: #fafbfa; color: var(--ink); }
.btn [data-lucide] { width: 16px; height: 16px; }
.btn.primary { background: var(--g-500); border-color: var(--g-500); color: #fff; }
.btn.primary:hover { background: var(--g-600); border-color: var(--g-600); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-bg); border-color: #f3c5bf; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--g-50); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 0.8rem; border-radius: 8px; }
.btn.icon { width: 34px; padding: 0; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.btn-row form { margin: 0; display: inline-flex; }

/* ---------- Cartes ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.card-head p { margin: 2px 0 0; color: var(--ink-3); font-size: 0.85rem; }
.card-body { padding: 16px 20px 20px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 720px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }
.stack { display: flex; flex-direction: column; gap: 16px; }
.muted { color: var(--ink-3); }
.small { font-size: 0.85rem; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { padding: 15px 18px; }
.kpi-label { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-weight: 500; font-size: 0.85rem; }
.kpi-label [data-lucide] { width: 16px; height: 16px; color: var(--g-600); }
.kpi-value { font: 700 1.9rem/1.15 Inter, system-ui, sans-serif; margin: 6px 0 2px; letter-spacing: -0.02em; }
.kpi-foot { font-size: 0.8rem; color: var(--ink-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; padding: 1px 7px; border-radius: 999px; font-size: 0.75rem; }
.delta [data-lucide] { width: 13px; height: 13px; }
.delta.up { background: var(--g-100); color: var(--g-700); }
.delta.down { background: var(--danger-bg); color: var(--danger); }
.delta.flat { background: #eef0f1; color: var(--ink-2); }
.mini-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 720px) { .mini-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mini-kpi { padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.mini-kpi b { display: block; font: 700 1.25rem Inter, sans-serif; }
.mini-kpi span { color: var(--ink-3); font-size: 0.8rem; }

/* ---------- Graphiques ---------- */
.chart-box { position: relative; height: 260px; }
.chart-box.short { height: 210px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.82rem; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; padding: 3px; background: #fff; }
.segmented button { border: 0; background: transparent; height: 28px; padding: 0 11px; border-radius: 6px; font: 600 0.8rem Inter, sans-serif; color: var(--ink-2); cursor: pointer; }
.segmented button.on { background: var(--g-100); color: var(--g-700); }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 140px) 1fr 44px; align-items: center; gap: 10px; font-size: 0.86rem; }
.bar-row .track { height: 10px; background: #f0f2f0; border-radius: 4px; overflow: hidden; }
.bar-row .fill { height: 100%; background: var(--g-500); border-radius: 4px; }
.bar-row b { text-align: right; font-variant-numeric: tabular-nums; }
.bar-row .name { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: capitalize; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.tbl th { text-align: left; font-weight: 600; color: var(--ink-3); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fafbfa; white-space: nowrap; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: #fbfcfb; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.person { display: flex; align-items: center; gap: 11px; min-width: 180px; }
.avatar {
    width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--g-100); color: var(--g-700); font-weight: 700; font-size: 0.85rem; text-transform: uppercase;
}
.avatar.gold { background: #f6ecd0; color: #7a5d00; }
.person b { display: block; }
.person span { color: var(--ink-3); font-size: 0.82rem; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; background: #eef0f1; color: var(--ink-2); white-space: nowrap; }
.badge [data-lucide] { width: 13px; height: 13px; }
.badge.green { background: var(--g-100); color: var(--g-700); }
.badge.gold { background: #f6ecd0; color: #7a5d00; }
.badge.red { background: var(--danger-bg); color: var(--danger); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.search-input { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.search-input [data-lucide] { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); width: 16px; height: 16px; }
.search-input input { padding-left: 36px !important; }
.empty { text-align: center; padding: 40px 20px; color: var(--ink-3); }
.empty [data-lucide] { width: 34px; height: 34px; color: var(--g-200); margin-bottom: 8px; }

/* ---------- Formulaires ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field label { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 6px; color: var(--ink); }
.field .hint { font-weight: 400; color: var(--ink-3); font-size: 0.8rem; margin-top: 5px; }
.field label .opt { font-weight: 400; color: var(--ink-3); }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="number"],
input[type="date"], input[type="tel"], input[type="search"], select, textarea {
    width: 100%; height: 40px; padding: 0 12px;
    border: 1px solid #d9dee1; border-radius: 9px; background: #fff;
    font: 400 0.92rem Inter, system-ui, sans-serif; color: var(--ink);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--g-500); box-shadow: 0 0 0 3px rgba(5, 136, 5, 0.12); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 720px) { .row-2, .row-3 { grid-template-columns: 1fr; } }
.input-group { display: flex; gap: 8px; }
.input-group input { flex: 1; }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.switch input { width: 40px; height: 22px; appearance: none; background: #d5dadd; border-radius: 999px; position: relative; cursor: pointer; transition: background 0.15s ease; margin: 0; flex-shrink: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.15s ease; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }
.switch input:checked { background: var(--g-500); }
.switch input:checked::after { transform: translateX(18px); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { height: 30px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font: 600 0.8rem Inter, sans-serif; color: var(--ink-2); cursor: pointer; }
.chips button:hover { border-color: var(--g-500); color: var(--g-700); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 4px; flex-wrap: wrap; }

.dropzone {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
    border: 2px dashed var(--g-200); background: var(--g-50); border-radius: var(--radius);
    padding: 26px 16px; cursor: pointer; color: var(--ink-2); transition: background 0.15s ease, border-color 0.15s ease;
}
.dropzone:hover, .dropzone.drag { background: var(--g-100); border-color: var(--g-500); }
.dropzone [data-lucide] { width: 28px; height: 28px; color: var(--g-600); }
.dropzone strong { color: var(--g-700); }
.dropzone input { display: none; }
.dropzone img.preview { max-height: 150px; border-radius: 8px; margin-top: 6px; }
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 6px; }
.previews img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }

/* ---------- Grilles de photos / services ---------- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.media-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.media-card .thumb { position: relative; aspect-ratio: 1; background: #f0f2f0; }
.media-card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-card .thumb .badge { position: absolute; top: 8px; left: 8px; }
.media-card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.media-card .body input, .media-card .body select { height: 34px; font-size: 0.82rem; }
.media-card .meta { font-size: 0.78rem; color: var(--ink-3); }
.media-card .title { font-weight: 600; }
.media-card .actions { display: flex; gap: 6px; margin-top: auto; }
.media-card .actions .btn, .media-card .actions form { flex: 1; }
.media-card .actions form .btn { width: 100%; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 22px 0 12px; }
.section-title:first-child { margin-top: 0; }

/* ---------- Aperçu promotion ---------- */
.promo-preview {
    border-radius: 12px; overflow: hidden; color: #fff;
    background: linear-gradient(100deg, #035c03, #058805 55%, #2e9e2e);
    padding: 14px 18px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.promo-preview .tag { background: var(--gold); color: #1d1500; font-weight: 800; padding: 5px 12px; border-radius: 999px; letter-spacing: 0.02em; }
.promo-preview .txt b { display: block; font-size: 1rem; }
.promo-preview .txt span { opacity: 0.85; font-size: 0.85rem; }
.promo-card .thumb { aspect-ratio: 16 / 9; }

.howto { background: #fafbfa; border-left: 4px solid var(--g-500); padding: 12px 16px; border-radius: 0 10px 10px 0; color: var(--ink-2); }
.howto ol { margin: 6px 0 0; padding-left: 18px; }
code { background: #f0f2f0; padding: 1px 6px; border-radius: 5px; font-size: 0.85em; }

/* Ancien contenu (guide admin) */
.legacy h1, .legacy h2, .legacy h3 { margin: 18px 0 8px; }
.legacy p, .legacy li { color: var(--ink-2); }

@media (max-width: 720px) {
    .adm-top { flex-wrap: wrap; row-gap: 8px; }
    .adm-top-title p { display: none; }
    .adm-top-actions { width: 100%; }
    .adm-top-actions .btn { flex: 1; }
    .kpi-value { font-size: 1.55rem; }
    .card-head { flex-wrap: wrap; }
}
.segmented a { display: inline-flex; align-items: center; height: 28px; padding: 0 11px; border-radius: 6px; font: 600 0.8rem Inter, sans-serif; color: var(--ink-2); }
.segmented a.on { background: var(--g-100); color: var(--g-700); }
.check-row { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; cursor: pointer; }
.check-row input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--g-500); flex-shrink: 0; }
.check-row small { display: block; color: var(--ink-3); font-weight: 400; }

/* ---------- Envoi d'e-mails ---------- */
.mail-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .mail-layout { grid-template-columns: minmax(0, 1fr); } }
.mail-preview { position: sticky; top: 76px; }
@media (max-width: 1100px) { .mail-preview { position: static; } }
.mail-preview iframe { width: 100%; height: 470px; border: 0; display: block; background: #f2f4f1; }
.step-title { display: flex; gap: 12px; align-items: flex-start; }
.step-num {
    width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; margin-top: 1px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--g-500); color: #fff; font-weight: 700; font-size: 0.9rem;
}
.mail-tools { display: flex; flex-direction: column; gap: 10px; }
.client-pick { max-height: 300px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.pick-row { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.pick-row:last-of-type { border-bottom: 0; }
.pick-row:hover { background: #fafbfa; }
.pick-row input { width: 18px; height: 18px; accent-color: var(--g-500); flex-shrink: 0; margin: 0; }
.pick-row:has(input:checked) { background: var(--g-50); }
.pick-row.is-out { opacity: 0.6; cursor: not-allowed; }
.pick-row .avatar { width: 32px; height: 32px; font-size: 0.78rem; }
.pick-info { flex: 1; min-width: 0; }
.pick-info b, .pick-info span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-info span { color: var(--ink-3); font-size: 0.82rem; }
.warn { color: var(--warn); background: var(--warn-bg); padding: 8px 10px; border-radius: 8px; margin: 0 0 10px; }
.confirm-dialog { border: 0; border-radius: 16px; padding: 22px 24px; width: min(440px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25); }
.confirm-dialog::backdrop { background: rgba(10, 20, 10, 0.45); }
.confirm-dialog h2 { margin-bottom: 6px; }
.confirm-dialog ul { max-height: 200px; overflow-y: auto; margin: 0 0 14px; padding-left: 18px; color: var(--ink-2); }
.mail-status { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; margin-bottom: 16px; border: 1px solid; flex-wrap: wrap; }
.mail-status > [data-lucide], .mail-status > svg { width: 22px; height: 22px; flex-shrink: 0; margin-top: 1px; }
.mail-status.ok { background: var(--g-50); border-color: var(--g-200); color: var(--g-700); align-items: center; }
.mail-status.bad { background: var(--danger-bg); border-color: #f3c5bf; color: #7d2318; }
.mail-status p { margin: 4px 0 8px; }
.mail-status details summary { cursor: pointer; font-weight: 600; }
.mail-status ol { margin: 8px 0 0; padding-left: 20px; line-height: 1.7; }
.mail-status a { color: inherit; text-decoration: underline; }
