/* =========================================================================
   ABELLION — Design system back-office (Phase 28)
   Port fidèle de mockup/v2/abellion.css (mêmes noms de classes, mêmes
   valeurs) : vient en complément de Tailwind CDN déjà chargé par
   base_admin.html (garde les utilitaires de mise en page — grilles,
   espacements, flex) plutôt que de le remplacer, cf. CLAUDE.md §2.
   ========================================================================= */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Manrope:wght@600;700;800&display=swap");

:root {
  --font-body: "Inter", system-ui, sans-serif;
  --font-display: "Manrope", "Inter", system-ui, sans-serif;

  --bg: #f3ede0;
  --bg-soft: #f8f4ea;
  --surface: #fffdf8;
  --surface-2: #fbf6ea;
  --surface-hover: #f4ecd8;
  --border: #e7ddc4;
  --border-soft: #efe7d4;
  --text: #201c14;
  --text-muted: #6f6754;
  --text-faint: #9a927c;

  --gold-50: #fdf6e4;
  --gold-200: #f2d998;
  --gold-400: #e3ab3c;
  --gold-500: #d29a24;
  --gold-600: #b4801a;
  --gold-700: #8f6414;
  --gold-grad: linear-gradient(135deg, #f0c355, #d59a24);

  --ink-900: #1b1710;
  --navy-900: #0c1524;

  --success: #1c8a4b;
  --success-bg: #e7f5eb;
  --success-border: #b9e2c6;
  --danger: #c23b3b;
  --danger-bg: #fbeaea;
  --danger-border: #f0c3c3;
  --info: #2f6fb0;
  --info-bg: #e8f1fb;

  --shadow-sm: 0 1px 2px rgba(32, 28, 20, 0.06);
  --shadow-md: 0 6px 20px rgba(32, 28, 20, 0.08);
  --shadow-lg: 0 20px 60px rgba(32, 28, 20, 0.16);
  --shadow-gold: 0 10px 24px rgba(210, 154, 36, 0.28);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  --compass-watermark: url("/static/img/logo-abellion.png");
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0a0f1b;
  --bg-soft: #0d1424;
  --surface: #111a2c;
  --surface-2: #0e1626;
  --surface-hover: #16223a;
  --border: #22304a;
  --border-soft: #1a2740;
  --text: #f2eee0;
  --text-muted: #98a3bc;
  --text-faint: #6b7690;

  --gold-50: #241d0f;
  --gold-200: #4a3a17;
  --gold-400: #eec46b;
  --gold-500: #f2c766;
  --gold-600: #e8b84b;
  --gold-700: #c99a35;
  --gold-grad: linear-gradient(135deg, #f2c766, #d9a53a);

  --success: #34d399;
  --success-bg: #0f2a20;
  --success-border: #1d4635;
  --danger: #f87171;
  --danger-bg: #34151a;
  --danger-border: #5a2530;
  --info: #7cb2f0;
  --info-bg: #122238;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.55);
  --shadow-gold: 0 10px 26px rgba(242, 199, 102, 0.18);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg: #0a0f1b; --bg-soft: #0d1424; --surface: #111a2c; --surface-2: #0e1626; --surface-hover: #16223a;
    --border: #22304a; --border-soft: #1a2740; --text: #f2eee0; --text-muted: #98a3bc; --text-faint: #6b7690;
    --gold-50: #241d0f; --gold-200: #4a3a17; --gold-400: #eec46b; --gold-500: #f2c766; --gold-600: #e8b84b; --gold-700: #c99a35;
    --gold-grad: linear-gradient(135deg, #f2c766, #d9a53a);
    --success: #34d399; --success-bg: #0f2a20; --success-border: #1d4635;
    --danger: #f87171; --danger-bg: #34151a; --danger-border: #5a2530;
    --info: #7cb2f0; --info-bg: #122238;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3); --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.55); --shadow-gold: 0 10px 26px rgba(242, 199, 102, 0.18);
    color-scheme: dark;
  }
}

[hidden] { display: none !important; }
svg { width: 20px; height: 20px; flex-shrink: 0; }

body.abellion {
  margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-body); -webkit-font-smoothing: antialiased; min-height: 100vh;
  background-image:
    radial-gradient(1200px 500px at 10% -10%, color-mix(in srgb, var(--gold-400) 8%, transparent), transparent),
    radial-gradient(900px 500px at 100% 0%, color-mix(in srgb, var(--gold-400) 6%, transparent), transparent);
  background-attachment: fixed;
}
body.abellion h1, body.abellion h2, body.abellion h3, body.abellion h4 {
  font-family: var(--font-display); letter-spacing: -0.01em;
}
body.abellion button { font-family: inherit; }
body.abellion ::selection { background: var(--gold-400); color: var(--ink-900); }

.eyebrow {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--gold-600);
}
:root[data-theme="dark"] .eyebrow { color: var(--gold-500); }

/* ---- Logo / wordmark ---- */
.brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; }
.brand img { width: 34px; height: 34px; }
.brand .brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand .brand-text strong {
  font-family: var(--font-display); font-weight: 800; font-size: 1.05rem;
  letter-spacing: .14em; text-transform: uppercase; color: var(--text);
}
.brand .brand-text span { font-size: .68rem; color: var(--text-muted); letter-spacing: .01em; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border-radius: var(--radius-sm); font-weight: 600; font-size: .9rem;
  padding: .68rem 1.15rem; border: 1px solid transparent; cursor: pointer;
  transition: transform .08s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
  white-space: nowrap; text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--gold-grad); color: var(--ink-900); box-shadow: var(--shadow-gold); }
.btn-primary:hover { filter: brightness(1.04); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-hover); }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.btn-danger:hover { filter: brightness(1.05); }
.btn-sm { padding: .42rem .8rem; font-size: .8rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-icon { width: 2.25rem; height: 2.25rem; padding: 0; border-radius: var(--radius-pill); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }

/* ---- Surfaces ---- */
.card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.card-pad { padding: 1.5rem; }
.panel { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--radius-md); }

/* ---- Inputs ---- */
.field { display: flex; flex-direction: column; gap: .4rem; }
.field label { font-size: .82rem; font-weight: 600; color: var(--text-muted); }
.field .hint { font-size: .74rem; color: var(--text-faint); }
.input, select.input, textarea.input {
  width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: .68rem .85rem; font-size: .92rem; color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease; font-family: inherit;
}
.input::placeholder { color: var(--text-faint); }
.input:focus, select.input:focus, textarea.input:focus {
  outline: none; border-color: var(--gold-500);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold-500) 22%, transparent);
}
.input-icon-wrap { position: relative; }
.input-icon-wrap .input { padding-right: 2.6rem; }
.input-icon-wrap .icon-btn {
  position: absolute; right: .5rem; top: 50%; transform: translateY(-50%);
  color: var(--text-faint); background: none; border: none; cursor: pointer; padding: .3rem;
}

/* ---- Switch ---- */
.switch { position: relative; display: inline-flex; align-items: center; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: var(--border); border-radius: var(--radius-pill); transition: background .15s ease; cursor: pointer; }
.switch .track::before {
  content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px;
  background: var(--surface); border-radius: 50%; transition: transform .15s ease; box-shadow: var(--shadow-sm);
}
.switch input:checked + .track { background: var(--gold-500); }
.switch input:checked + .track::before { transform: translateX(18px); }

/* ---- Ligne d'activation dans les modals de création/édition (thème actif,
   question active…) — même composant .switch que dans les tableaux. ---- */
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.toggle-row .toggle-label { font-size: .85rem; font-weight: 600; color: var(--text); }
.toggle-row .toggle-sub { font-size: .74rem; color: var(--text-faint); font-weight: 400; display: block; margin-top: .1rem; }

/* ---- Badges / tags ---- */
.badge {
  display: inline-flex; align-items: center; gap: .35rem; font-size: .74rem; font-weight: 700;
  padding: .28rem .6rem; border-radius: var(--radius-pill); border: 1px solid transparent;
}
.badge-gold { background: var(--gold-50); color: var(--gold-700); border-color: var(--gold-200); }
:root[data-theme="dark"] .badge-gold { color: var(--gold-500); }
.badge-success { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.badge-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }
.dot { width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; display: inline-block; flex-shrink: 0; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--border-soft); }
table.data { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.data thead th {
  text-align: left; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-faint); background: var(--surface-2); padding: .8rem 1rem; border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}
table.data thead th[data-sort] { cursor: pointer; user-select: none; }
table.data thead th[data-sort]:hover { color: var(--text); }
table.data tbody td { padding: .85rem 1rem; border-bottom: 1px solid var(--border-soft); vertical-align: middle; color: var(--text); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr { background: var(--surface); transition: background .12s ease; }
table.data tbody tr:hover { background: var(--surface-hover); }

/* ---- Progress ---- */
.progress { height: 8px; border-radius: var(--radius-pill); background: var(--border-soft); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--gold-grad); border-radius: var(--radius-pill); }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

/* ---- Theme toggle ---- */
[data-theme-switch] .icon-sun { display: none; }
[data-theme-switch] .icon-moon { display: inline-flex; }
:root[data-theme="dark"] [data-theme-switch] .icon-sun { display: inline-flex; }
:root[data-theme="dark"] [data-theme-switch] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) [data-theme-switch] .icon-sun { display: inline-flex; }
  :root:not([data-theme="light"]):not([data-theme="dark"]) [data-theme-switch] .icon-moon { display: none; }
}
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; border-radius: var(--radius-pill);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted); cursor: pointer;
}
.theme-toggle:hover { color: var(--gold-600); border-color: var(--gold-400); }
.theme-toggle svg { width: 18px; height: 18px; }
.side-theme-toggle, .sidebar-collapse-btn { background: none; border: none; cursor: pointer; width: 100%; text-align: left; font: inherit; }
.side-theme-toggle svg { width: 18px; height: 18px; }

/* ============================= ADMIN SHELL ============================= */
.admin-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border-soft);
  display: flex; flex-direction: column; padding: 1.3rem 1rem; gap: 1.1rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden;
  transition: width .15s ease;
}
.sidebar .brand { padding: 0 .4rem; }
.side-nav { display: flex; flex-direction: column; gap: .2rem; }
.side-section-label {
  font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-faint); padding: .8rem .6rem .2rem; white-space: nowrap;
}
.side-link {
  display: flex; align-items: center; gap: .7rem; padding: .62rem .7rem; border-radius: 10px;
  color: var(--text-muted); font-size: .88rem; font-weight: 600; transition: background .12s ease, color .12s ease;
  white-space: nowrap; text-decoration: none;
}
.side-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.side-link:hover { background: var(--surface-hover); color: var(--text); }
.side-link.active { background: var(--gold-50); color: var(--gold-700); }
:root[data-theme="dark"] .side-link.active { color: var(--gold-500); }
.side-dot { margin-left: auto; width: 6px; height: 6px; border-radius: 50%; background: var(--gold-500); opacity: 0; flex-shrink: 0; }
.side-link.active .side-dot { opacity: 1; }
.sidebar-footer { margin-top: auto; padding-top: .7rem; border-top: 1px solid var(--border-soft); display: flex; flex-direction: column; gap: .2rem; }
.sidebar-collapse-btn { margin-bottom: .2rem; }

.sidebar.collapsed { width: 84px; padding-left: .6rem; padding-right: .6rem; }
.sidebar.collapsed .side-label,
.sidebar.collapsed .side-section-label,
.sidebar.collapsed .side-dot { display: none !important; }
.sidebar.collapsed .brand { justify-content: center; }
.sidebar.collapsed .side-link,
.sidebar.collapsed .side-theme-toggle,
.sidebar.collapsed .sidebar-collapse-btn { justify-content: center; gap: 0; padding: .62rem; }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.1rem 1.75rem; border-bottom: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--bg) 60%, transparent); backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 1.25rem; font-weight: 800; margin: 0; color: var(--text); }
.topbar .topbar-sub { font-size: .82rem; color: var(--text-muted); margin: .15rem 0 0; }
.topbar-actions { display: flex; align-items: center; gap: .6rem; }
.admin-content { padding: 1.75rem; flex: 1; }

/* Stat tiles */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; }
.stat-tile { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-md); padding: 1.1rem; display: flex; flex-direction: column; gap: .5rem; }
.stat-tile .stat-icon { width: 2.1rem; height: 2.1rem; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--gold-50); color: var(--gold-600); }
:root[data-theme="dark"] .stat-tile .stat-icon { color: var(--gold-500); }
.stat-tile .stat-icon svg { width: 18px; height: 18px; }
.stat-tile .stat-value { font-size: 1.6rem; font-weight: 800; font-family: var(--font-display); color: var(--text); }
.stat-tile .stat-label { font-size: .78rem; color: var(--text-muted); }

/* ---- Modal (Phase 17 : classes `admin-modal-*` posées par app/static/js/admin-modal.js
   et déjà présentes dans le balisage des templates — non renommées pour ne pas casser
   les gabarits existants, mais dimensionnées/colorées à l'identique de la maquette
   `mockup/v2/` (`.modal-box`/`.modal-header`/`.modal-body`/`.modal-footer`). ---- */
.admin-modal-backdrop { background: rgba(10, 8, 4, .55); backdrop-filter: blur(2px); }
:root[data-theme="dark"] .admin-modal-backdrop { background: rgba(3, 6, 14, .68); }
.admin-modal-box {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); color: var(--text); max-width: 560px; max-height: 88vh;
}
.admin-modal-box--sm { max-width: 440px; }
.admin-modal-box--full {
  max-width: 100% !important; width: 100% !important; height: 100% !important;
  max-height: 100% !important; margin: 0 !important; border-radius: 0 !important;
}
.admin-modal-box--full .admin-modal-body,
.admin-modal-box--full .admin-modal-footer { max-width: 880px; margin-left: auto; margin-right: auto; width: 100%; }
.admin-modal-header {
  padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--border-soft); background: var(--surface);
}
.admin-modal-header h2 { font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; color: var(--text); }
.admin-modal-body { padding: 1.4rem; display: flex; flex-direction: column; gap: 1rem; }
.admin-modal-footer {
  padding: .7rem 1.4rem; border-top: 1px solid var(--border-soft); background: var(--surface);
  display: flex; justify-content: flex-end; gap: .6rem; position: sticky; bottom: 0;
}
.admin-modal-footer .btn { padding-top: .55rem; padding-bottom: .55rem; }
.admin-modal-icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem;
  border-radius: 8px; color: var(--text-muted); background: none; border: none; cursor: pointer;
}
.admin-modal-icon-btn svg { width: 16px; height: 16px; }
.admin-modal-icon-btn:hover { background: var(--surface-hover); color: var(--text); }

/* ---- Barre d'outils / pagination de tableau (app/static/js/admin-table.js) ----
   Un seul niveau flex (pas d'imbrication) : évite un bug classique où un
   conteneur flex wrap imbriqué se voit attribuer sa taille min-content plutôt
   que max-content par son parent, et se met à passer à la ligne prématurément
   même quand il reste largement la place. */
.table-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: .9rem; }
.table-count { font-size: .82rem; color: var(--text-faint); white-space: nowrap; margin-left: auto; }
.table-footer {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem;
  padding: .8rem 1rem; margin-top: .9rem; border: 1px solid var(--border-soft); border-radius: var(--radius-md);
  background: var(--surface-2);
}
.table-footer label { display: flex; align-items: center; gap: .5rem; font-size: .82rem; color: var(--text-muted); }
.table-footer select.input { padding: .35rem .55rem; width: auto; }
.pagination { display: flex; align-items: center; gap: .7rem; }
.pagination .page-info { font-size: .82rem; color: var(--text-muted); white-space: nowrap; }
.pagination button { display: inline-flex; align-items: center; gap: .3rem; color: var(--text-muted); background: none; border: none; border-radius: 8px; padding: .3rem .5rem; cursor: pointer; }
.pagination button:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }
.pagination button:disabled { opacity: .3; cursor: not-allowed; }

/* ---- Menu d'action à trois points ---- */
.row-menu { position: relative; display: inline-block; }
.row-menu-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem;
  border-radius: 8px; border: 1px solid var(--border-soft); background: var(--surface); color: var(--text-muted); cursor: pointer;
}
.row-menu-btn svg { width: 16px; height: 16px; }
.row-menu-btn:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border); }
.row-menu-list {
  position: fixed; min-width: 200px; background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: .35rem; z-index: 200;
  display: flex; flex-direction: column; gap: .1rem;
}
.row-menu-item {
  display: flex; align-items: center; gap: .65rem; padding: .55rem .65rem; border-radius: 8px; border: none;
  background: none; font-size: .84rem; font-weight: 600; text-align: left; cursor: pointer; width: 100%; color: var(--text);
}
.row-menu-item svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--text-faint); }
.row-menu-item:hover { background: var(--surface-hover); }
.row-menu-item.tone-danger { color: var(--danger); }
.row-menu-item.tone-danger svg { color: var(--danger); }
.row-menu-item.tone-danger:hover { background: var(--danger-bg); }
.row-menu-item.tone-success { color: var(--success); }
.row-menu-item.tone-success svg { color: var(--success); }
.row-menu-item.tone-success:hover { background: var(--success-bg); }
.row-menu-item.tone-warning { color: var(--gold-700); }
.row-menu-item.tone-warning svg { color: var(--gold-600); }
:root[data-theme="dark"] .row-menu-item.tone-warning,
:root[data-theme="dark"] .row-menu-item.tone-warning svg { color: var(--gold-500); }
.row-menu-item.tone-warning:hover { background: var(--gold-50); }
.row-menu-item.tone-info { color: var(--info); }
.row-menu-item.tone-info svg { color: var(--info); }
.row-menu-item.tone-info:hover { background: var(--info-bg); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---- Utilitaires (login, coquilles simples) ---- */
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.gap-1 { gap: .4rem; } .gap-2 { gap: .7rem; } .gap-3 { gap: 1rem; }
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }
.section-title { font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; color: var(--text); }
.divider { height: 1px; background: var(--border-soft); border: none; margin: 1.25rem 0; }
.center-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }

.compass-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; border-radius: inherit; }
.compass-bg::before {
  content: ""; position: absolute; width: 480px; height: 480px; right: -160px; bottom: -180px;
  background-image: var(--compass-watermark); background-size: contain; background-repeat: no-repeat;
  opacity: .06; filter: grayscale(1);
}
:root[data-theme="dark"] .compass-bg::before { opacity: .1; }

@media (max-width: 900px) {
  .sidebar { position: fixed; z-index: 40; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .admin-content { padding: 1.1rem; }
  .topbar { padding: 1rem; }
}

/* =========================================================================
   PLAYER SHELL (Phase 30) — port fidèle du bloc « PLAYER SHELL » de
   mockup/v2/abellion.css (mêmes noms de classes, mêmes valeurs). Partagé avec
   le back-office (mêmes tokens `abellion.css`, cf. CLAUDE.md §1) : les
   utilitaires de mise en page (`.mt-*`/`.mb-*`/`.flex-1`/`.text-sm`/`.text-xs`)
   restent Tailwind CDN, déjà chargé — seuls les composants réellement
   spécifiques au joueur sont ajoutés ici.
   ========================================================================= */
.player-page {
  max-width: 460px; margin: 0 auto; min-height: 100vh;
  display: flex; flex-direction: column; padding: 1.1rem 1.1rem 1.6rem;
}
.player-header {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .3rem 0 1.1rem;
}
.player-header .brand .brand-text strong { font-size: .92rem; }
.player-back {
  width: 2.25rem; height: 2.25rem; border-radius: var(--radius-pill); display: inline-flex; align-items: center;
  justify-content: center; background: var(--surface); border: 1px solid var(--border-soft); color: var(--text-muted);
  text-decoration: none;
}
.player-topline { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .9rem; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem; background: var(--surface); border: 1px solid var(--border-soft);
  padding: .45rem .8rem; border-radius: var(--radius-pill); font-size: .8rem; font-weight: 700; color: var(--text-muted);
}
.chip .badge-count {
  background: var(--gold-500); color: var(--ink-900); border-radius: 999px; font-size: .68rem; font-weight: 800;
  padding: .05rem .4rem;
}
.step-progress { display: flex; flex-direction: column; align-items: flex-end; gap: .35rem; min-width: 96px; }
.step-progress .label { font-size: .78rem; font-weight: 600; color: var(--text-muted); }
.step-progress .progress { width: 96px; }

.media-card {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); padding: 1.1rem; margin-bottom: 1.1rem;
}
.media-card .media-figure {
  border-radius: var(--radius-md); overflow: hidden; margin-bottom: 1rem; position: relative;
  aspect-ratio: 16/10; background: var(--surface-2);
}
.media-card .media-figure img { width: 100%; height: 100%; object-fit: cover; }
.media-card .media-compass {
  position: absolute; bottom: .6rem; left: 50%; transform: translateX(-50%); width: 30px; height: 30px; opacity: .92;
}
.media-card h2 { font-size: 1.25rem; font-weight: 800; margin-bottom: .5rem; }
.media-card p.desc { color: var(--text-muted); font-size: .9rem; line-height: 1.55; margin-bottom: .9rem; }
.riddle-pill {
  display: flex; align-items: center; gap: .6rem; background: var(--gold-50); border: 1px solid var(--gold-200);
  border-radius: var(--radius-md); padding: .8rem 1rem; font-weight: 700; font-size: .92rem; color: var(--ink-900);
}
:root[data-theme="dark"] .riddle-pill { color: var(--text); }
.riddle-pill .qmark {
  width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--gold-500); color: var(--ink-900);
  display: flex; align-items: center; justify-content: center; font-size: .82rem; flex-shrink: 0;
}
.hint-line { display: flex; align-items: flex-start; gap: .5rem; margin-top: .7rem; font-size: .84rem; color: var(--text-muted); }
.hint-line svg { flex-shrink: 0; margin-top: .1rem; color: var(--gold-500); width: 16px; height: 16px; }

.audio-player {
  display: flex; align-items: center; gap: 1rem; background: var(--surface-2); border: 1px solid var(--border-soft);
  border-radius: var(--radius-md); padding: 1.1rem;
}
.audio-play-btn {
  width: 3rem; height: 3rem; border-radius: 50%; background: var(--gold-grad); color: var(--ink-900);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: var(--shadow-gold); border: none; cursor: pointer;
}
.audio-wave { flex: 1; display: flex; align-items: center; gap: 3px; height: 34px; }
.audio-wave span { width: 3px; border-radius: 2px; background: var(--gold-400); opacity: .8; }
.audio-time { font-size: .76rem; color: var(--text-faint); text-align: center; margin-top: .5rem; }

.answer-form { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1rem; }
.answer-form label.section-label { font-size: .76rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); }
.answer-input-row { position: relative; }
.answer-input-row .input { padding-right: 3rem; font-size: 1rem; }
.answer-input-row .unit { position: absolute; right: 1rem; top: 50%; transform: translateY(-50%); color: var(--text-faint); font-size: .85rem; }

.option-list { display: flex; flex-direction: column; gap: .65rem; margin-bottom: 1rem; }
.option-btn {
  display: flex; align-items: center; gap: .8rem; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-md);
  padding: .9rem 1rem; font-size: .92rem; font-weight: 600; color: var(--text); cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.option-btn:hover:not(:disabled) { border-color: var(--gold-400); }
.option-btn:disabled { cursor: not-allowed; }
.option-btn .letter {
  width: 1.7rem; height: 1.7rem; border-radius: 50%; border: 1px solid var(--border); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 700; color: var(--text-muted);
}
.option-btn.is-correct { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.option-btn.is-correct .letter { background: var(--success); border-color: var(--success); color: #fff; }
.option-btn.is-wrong { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.option-btn.is-wrong .letter { background: var(--danger); border-color: var(--danger); color: #fff; }
.option-btn .result-icon { margin-left: auto; width: 1.4rem; height: 1.4rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0; }
.option-btn.is-correct .result-icon { background: var(--success); }
.option-btn.is-wrong .result-icon { background: var(--danger); }
.option-btn.is-correct::after { content: "✅"; margin-left: auto; }
.option-btn.is-wrong::after { content: "❌"; margin-left: auto; }

/* ---- Retour visuel bonne/mauvaise réponse sur la carte cachette (app.html) ---- */
.media-card.is-correct { border-color: var(--success-border); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 25%, transparent); }
.media-card.is-wrong { border-color: var(--danger-border); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 25%, transparent); }

/* ---- Confettis (écran final, app.html) ---- */
.confetti {
  position: fixed; top: -10px; width: 8px; height: 14px; z-index: 50; border-radius: 2px;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall { to { transform: translateY(110vh) rotate(540deg); opacity: .2; } }
@media (prefers-reduced-motion: reduce) {
  .confetti { animation: none !important; display: none; }
}

.feedback-banner {
  display: flex; align-items: center; gap: .9rem; border-radius: var(--radius-md); border: 1px solid;
  padding: 1rem; margin-bottom: 1rem;
}
.feedback-banner.success { background: var(--success-bg); border-color: var(--success-border); }
.feedback-banner.error { background: var(--danger-bg); border-color: var(--danger-border); }
.feedback-banner .fb-icon {
  width: 2.5rem; height: 2.5rem; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 1.2rem; color: #fff;
}
.feedback-banner.success .fb-icon { background: var(--success); }
.feedback-banner.error .fb-icon { background: var(--danger); }
.feedback-banner h3 { font-size: .95rem; margin-bottom: .2rem; color: var(--text); }
.feedback-banner.success h3 { color: var(--success); }
.feedback-banner.error h3 { color: var(--danger); }
.feedback-banner p { font-size: .83rem; color: var(--text-muted); line-height: 1.5; }
.feedback-banner .fb-deco { margin-left: auto; font-size: 1.6rem; flex-shrink: 0; }

.info-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; margin-bottom: 1.1rem; }
.info-tile {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-md);
  padding: .85rem .7rem; text-align: left;
}
.info-tile .tile-icon { color: var(--gold-500); margin-bottom: .4rem; }
.info-tile .tile-label { font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-faint); }
.info-tile .tile-value { font-size: .88rem; font-weight: 700; margin: .15rem 0 .1rem; color: var(--text); }
.info-tile .tile-sub { font-size: .72rem; color: var(--text-muted); }

/* ---- Détail du score (écran final, app.html) : icône + libellé sur une ligne,
   valeur centrée et plus grande en dessous — variante de .info-tile. ---- */
#final-detail .info-tile { text-align: center; }
#final-detail .info-tile .tile-icon { margin-bottom: 0; }
#final-detail .info-tile .tile-value { font-size: 1.15rem; margin-top: .35rem; }

.lock-banner {
  display: flex; align-items: center; gap: .6rem; background: var(--surface-2); border: 1px dashed var(--border);
  color: var(--text-muted); font-size: .82rem; font-weight: 600; border-radius: var(--radius-md); padding: .7rem 1rem; margin-bottom: 1rem;
}

.bottom-nav {
  position: sticky; bottom: 0; margin-top: auto; padding-top: 1.2rem;
}
.bottom-nav .btn svg { width: 18px; height: 18px; }

/* ---- Trophy hero (écran final) ---- */
.trophy-hero {
  border-radius: var(--radius-lg); border: 1px solid var(--gold-200); padding: 1.6rem;
  background: linear-gradient(135deg, var(--gold-50), var(--surface));
  display: flex; align-items: center; gap: 1.2rem; margin-bottom: 1.1rem; position: relative; overflow: hidden;
}
:root[data-theme="dark"] .trophy-hero {
  background: linear-gradient(135deg, #1c1710, var(--surface)); border-color: var(--gold-200);
}
.trophy-hero .trophy-icon {
  width: 4rem; height: 4rem; border-radius: 18px; background: var(--gold-grad); color: var(--ink-900);
  display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-gold); flex-shrink: 0;
  font-size: 1.8rem;
}
.trophy-hero h2 { font-size: 1.15rem; margin-bottom: .25rem; color: var(--text); }
.trophy-hero p { font-size: .85rem; color: var(--text-muted); }

.rank-row {
  display: flex; align-items: center; gap: .8rem; padding: .85rem 1rem; border-radius: var(--radius-md);
}
.rank-row .rank-num {
  width: 1.8rem; height: 1.8rem; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .8rem; background: var(--surface-2); color: var(--text-muted); flex-shrink: 0;
}
.rank-row.gold .rank-num { background: #f2c766; color: #4a3a17; }
.rank-row.silver .rank-num { background: #d9dde3; color: #4a4f57; }
.rank-row.bronze .rank-num { background: #d8a06a; color: #4a2e13; }
.rank-row .avatar {
  width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: center; font-size: .85rem; font-weight: 700; color: var(--text-muted); flex-shrink: 0;
}
.rank-row .name { font-weight: 700; font-size: .88rem; color: var(--text); }
.rank-row .subtitle { font-size: .74rem; color: var(--text-muted); }
.rank-row .score { margin-left: auto; font-weight: 800; font-family: var(--font-display); color: var(--gold-600); white-space: nowrap; }
:root[data-theme="dark"] .rank-row .score { color: var(--gold-500); }
.rank-row.me { background: var(--gold-50); border: 1px solid var(--gold-200); }

@media (max-width: 480px) {
  .info-tiles { grid-template-columns: repeat(2, 1fr); }
}
