:root {
    --green: #16a34a;
    --orange: #f59e0b;
    --red: #dc2626;
    --bg: #f1f5f9;
    --card: #ffffff;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--ink);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Topbar ---------- */
.topbar {
    background: #0f172a;
    color: #e2e8f0;
}
.topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 58px;
}
.brand { color: #fff; font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 12px; }
.brand:hover { text-decoration: none; }
.brand .logo { height: 30px; width: auto; display: block; }
.brand-text { color: #fff; font-weight: 700; }
.topnav { display: flex; align-items: center; gap: 18px; }
.topnav a { color: #cbd5e1; }
.topnav a:hover { color: #fff; text-decoration: none; }
.user-menu { position: relative; }
.user-chip {
    color: #e2e8f0; font-size: 14px; background: #1e293b; border: none;
    padding: 7px 12px; border-radius: 6px; cursor: pointer; font-family: inherit;
}
.user-chip:hover { background: #334155; }
.user-chip small { color: #94a3b8; }
.user-chip .caret { color: #94a3b8; margin-left: 2px; }
.user-dropdown {
    position: absolute; right: 0; top: calc(100% + 8px);
    background: #fff; border: 1px solid var(--line); border-radius: 10px;
    box-shadow: 0 12px 30px rgba(15,23,42,.18); min-width: 210px; padding: 6px; z-index: 900;
}
.user-dropdown[hidden] { display: none; }
.user-dropdown a { display: block; padding: 9px 12px; border-radius: 7px; color: var(--ink); font-size: 14px; }
.user-dropdown a:hover { background: #f1f5f9; text-decoration: none; }
.user-dropdown hr { border: none; border-top: 1px solid var(--line); margin: 6px 4px; }
/* Menu déroulant générique (ex. Config admin), aligné à gauche */
.menu { position: relative; }
.menu-chip {
    color: #cbd5e1; font-size: 14px; background: transparent; border: none;
    padding: 7px 10px; border-radius: 6px; cursor: pointer; font-family: inherit;
}
.menu-chip:hover { background: #1e293b; color: #fff; }
.menu-chip .caret { color: #94a3b8; margin-left: 2px; }
.menu-dropdown {
    position: absolute; left: 0; top: calc(100% + 8px);
    background: #fff; border: 1px solid var(--line); border-radius: 10px;
    box-shadow: 0 12px 30px rgba(15,23,42,.18); min-width: 200px; padding: 6px; z-index: 900;
}
.menu-dropdown[hidden] { display: none; }
.menu-dropdown a { display: block; padding: 9px 12px; border-radius: 7px; color: var(--ink); font-size: 14px; }
.menu-dropdown a:hover { background: #f1f5f9; text-decoration: none; }

/* Radios en pilules (ex. fréquence des BS) */
.pill-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.pill { position: relative; display: inline-flex; }
.pill input { position: absolute; opacity: 0; width: 0; height: 0; }
.pill span {
    display: inline-block; padding: 6px 14px; border: 1px solid var(--line);
    border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted);
    background: #fff; cursor: pointer; user-select: none; white-space: nowrap;
}
.pill span:hover { border-color: var(--primary); color: var(--primary); }
.pill input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.pill input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn-logout { background: #1e293b; padding: 6px 12px; border-radius: 6px; }
.notif { position: relative; }
.notif-dot {
    position: absolute; top: -6px; right: -10px;
    background: var(--red); color: #fff; font-size: 11px;
    border-radius: 10px; padding: 1px 6px; line-height: 1.4;
}

/* ---------- Layout ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 24px 20px; }
.footer { color: var(--muted); font-size: 13px; padding: 20px 0; text-align: center; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 22px 0 12px; }
.subtitle { color: var(--muted); margin: 0 0 20px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; }
.breadcrumb { color: var(--muted); font-size: 13px; margin-bottom: 8px; }

/* ---------- Flash ---------- */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.flash-success { background: #dcfce7; color: #166534; }
.flash-error   { background: #fee2e2; color: #991b1b; }
.flash-info    { background: #dbeafe; color: #1e40af; }

/* ---------- Badges (macarons) ---------- */
.badge {
    display: inline-block; width: 16px; height: 16px; border-radius: 50%;
    vertical-align: middle; border: 1px solid rgba(0,0,0,.12);
}
.badge-green { background: var(--green); }
.badge-orange { background: var(--orange); }
.badge-red { background: var(--red); }
.badge-none { background: #cbd5e1; }
.badge-lg { width: 26px; height: 26px; }

/* Score client (4 niveaux de satisfaction) */
.cs-content { background: var(--green); }
.cs-ok      { background: #84cc16; }
.cs-improve { background: var(--orange); }
.cs-changes { background: var(--red); }
.cs-none    { background: #cbd5e1; }

/* ---------- Graphiques ---------- */
.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.chart-card { display: flex; flex-direction: column; }
.chart-card canvas { max-height: 240px; }
@media (max-width: 820px) { .charts-row { grid-template-columns: 1fr; } }

/* ---------- Dashboard tuiles ---------- */
.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}
.tile {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
    display: block;
    color: inherit;
    transition: box-shadow .15s, transform .15s;
    border-top: 4px solid #cbd5e1;
}
.tile:hover { text-decoration: none; box-shadow: 0 6px 20px rgba(15,23,42,.08); transform: translateY(-2px); }
.tile.top-green { border-top-color: var(--green); }
.tile.top-orange { border-top-color: var(--orange); }
.tile.top-red { border-top-color: var(--red); }
.tile.top-content { border-top-color: var(--green); }
.tile.top-ok { border-top-color: #84cc16; }
.tile.top-to_improve { border-top-color: var(--orange); }
.tile.top-changes { border-top-color: var(--red); }
.tile-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tile-name { font-weight: 600; font-size: 16px; }
.tile-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 10px; }
.tile-row b { color: var(--ink); font-weight: 600; }
.vote-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin-top: 12px; background: #e2e8f0; }
.vote-bar span { display: block; height: 100%; }
.vote-green { background: var(--green); }
.vote-orange { background: var(--orange); }
.vote-red { background: var(--red); }
.vote-legend { display: flex; gap: 12px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.tile-badge { display: flex; align-items: center; gap: 6px; }

/* ---------- Tables ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0; overflow: hidden; }
.card.pad { padding: 20px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { background: #f8fafc; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

/* ---------- Status pills ---------- */
.status { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.status-draft { background: #e2e8f0; color: #475569; }
.status-published { background: #dbeafe; color: #1e40af; }
.status-no_meeting { background: #fef3c7; color: #92400e; }
.status-held { background: #dcfce7; color: #166534; }
.status-closed { background: #f1f5f9; color: #64748b; border: 1px solid #cbd5e1; }

/* ---------- Forms ---------- */
.form { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 24px; max-width: 920px; }
.form.narrow { max-width: 420px; margin: 8px auto; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.field input[type=text], .field input[type=email], .field input[type=password],
.field input[type=date], .field select, .field textarea {
    width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 8px;
    font: inherit; background: #fff;
}
.field textarea { min-height: 80px; resize: vertical; }
.hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.btn {
    display: inline-block; cursor: pointer; border: none; border-radius: 8px;
    padding: 10px 18px; font: inherit; font-weight: 600; background: var(--primary); color: #fff;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid #cbd5e1; }
.btn-ghost:hover { background: #f8fafc; }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #b91c1c; }
.btn-green { background: var(--green); }
.btn-green:hover { background: #15803d; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Score selector ---------- */
.score-grid { display: grid; gap: 0; }
.score-row { display: grid; grid-template-columns: 1.4fr auto 2fr; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.score-row:last-child { border-bottom: none; }
.score-topic { font-weight: 600; font-size: 14px; }
.score-opts { display: flex; gap: 6px; }
.score-opts label {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 50%; cursor: pointer; border: 2px solid transparent;
}
.score-opts input { position: absolute; opacity: 0; }
.dot-green { background: var(--green); }
.dot-orange { background: var(--orange); }
.dot-red { background: var(--red); }
.dot-content { background: var(--green); }
.dot-ok { background: #84cc16; }
.dot-improve { background: var(--orange); }
.dot-changes { background: var(--red); }
.score-opts label.dot-wide { width: auto; border-radius: 16px; padding: 0 12px; color: #fff; font-size: 12px; font-weight: 600; }
.score-opts label.sel { border-color: #0f172a; box-shadow: 0 0 0 2px #fff inset; }
.score-row textarea { min-height: 40px; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; }

/* ---------- Meeting detail ---------- */
.grid2 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.meta-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
@media (max-width: 640px) { .meta-cols { grid-template-columns: 1fr; } }
@media (max-width: 820px) { .grid2 { grid-template-columns: 1fr; } .row2 { grid-template-columns: 1fr; } .row3 { grid-template-columns: 1fr; } }

/* ---------- Sélecteur smiley (score client) ---------- */
.smiley-opts { flex-wrap: wrap; gap: 8px; }
.smiley-opts label.smiley {
    width: auto; height: auto; border-radius: 10px;
    flex-direction: column; gap: 3px; padding: 8px 10px; min-width: 60px;
    border: 2px solid var(--line); background: #fff; transition: border-color .12s, background .12s;
}
.smiley-opts label.smiley .emoji { font-size: 24px; line-height: 1; }
.smiley-opts label.smiley .smiley-label { font-size: 11px; color: var(--muted); font-weight: 600; text-align: center; }
.smiley-opts label.smiley:hover { border-color: #cbd5e1; background: #f8fafc; }
.smiley-opts label.smiley.sel { border-color: var(--primary); background: #eff6ff; box-shadow: none; }
.smiley-opts label.smiley.sel .smiley-label { color: var(--ink); }
.smiley-opts label.smiley-none .emoji { color: var(--muted); }

/* Variante compacte (sous-scores en 3 colonnes) : emoji seul, libellé en infobulle. */
.smiley-opts.compact { gap: 5px; flex-wrap: nowrap; }
.smiley-opts.compact label.smiley { min-width: 0; padding: 6px; gap: 0; }
.smiley-opts.compact label.smiley .smiley-label { display: none; }
.smiley-opts.compact label.smiley .emoji { font-size: 21px; }
.meta-list { list-style: none; margin: 0; padding: 0; }
.meta-list li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.meta-list li:last-child { border-bottom: none; }
.meta-list .label { color: var(--muted); }
.key-msg { color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); padding: 24px; text-align: center; }
.tag { display:inline-block; background:#eef2ff; color:#3730a3; border-radius:6px; padding:2px 8px; font-size:12px; margin:2px 2px 2px 0; }

/* ---------- Modal de confirmation ---------- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(15,23,42,.5);
    display: flex; align-items: center; justify-content: center; z-index: 1000;
    padding: 16px;
}
.modal-overlay[hidden] { display: none; }
.modal {
    background: #fff; border-radius: 12px; padding: 24px;
    max-width: 420px; width: 100%; box-shadow: 0 20px 50px rgba(15,23,42,.3);
    animation: modal-in .15s ease-out;
}
@keyframes modal-in { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h3 { margin: 0 0 10px; font-size: 18px; }
.modal p { margin: 0 0 20px; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Toggle switch ---------- */
.field label.switch, .switch {
    display: inline-flex; align-items: center; gap: 12px;
    position: relative; cursor: pointer; user-select: none; margin-bottom: 0;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; margin: 0; }
.switch .slider {
    position: relative; flex: 0 0 auto; width: 46px; height: 26px;
    background: var(--red); border-radius: 999px; transition: background .15s ease;
}
.switch .slider::before {
    content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
    background: #fff; border-radius: 50%; transition: transform .15s ease;
    box-shadow: 0 1px 3px rgba(15,23,42,.3);
}
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider::before { transform: translateX(20px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--green); outline-offset: 2px; }
.switch .switch-label { font-weight: 600; }

/* ---------- Login ---------- */
.login-wrap { min-height: 70vh; display: flex; align-items: center; justify-content: center; }
.demo-creds { font-size: 12px; color: var(--muted); margin-top: 16px; line-height: 1.7; }
.demo-creds code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; }

/* ---------- Réduction des tailles sur petits écrans ---------- */
@media (max-width: 768px) {
    body { font-size: 13px; }
    h1 { font-size: 19px; }
    h2 { font-size: 15px; }
    .container { padding: 16px 14px; }
    .brand { font-size: 15px; }
    .brand .logo { height: 26px; }
    .topnav { gap: 12px; }
    th, td { padding: 9px 12px; font-size: 13px; }
    th { font-size: 11px; }
    .tile-name { font-size: 14px; }
    .tile-row, .meta-list li, .key-msg, .breadcrumb { font-size: 12px; }
    .btn { padding: 8px 14px; }
}
