/* Back-office — reprend les tokens du site public + mise en page tableau de bord */
:root {
  --sidebar-w: 250px;
}
body.admin-body { background: var(--bg); }

.admin-shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.admin-sidebar { background: var(--navy-950); color: rgba(255,255,255,.8); padding: 22px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.admin-brand { display: flex; align-items: center; gap: 10px; color: var(--white); font-family: var(--font-display); font-weight: 700; padding: 6px 10px 26px; }
.admin-brand svg { width: 30px; height: 30px; }
.admin-nav-group { margin-bottom: 18px; }
.admin-nav-group .label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.35); padding: 0 10px; margin-bottom: 8px; display: block; }
.admin-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; font-size: .9rem; color: rgba(255,255,255,.75); margin-bottom: 2px; }
.admin-nav a:hover { background: rgba(255,255,255,.06); color: var(--white); }
.admin-nav a.active { background: var(--teal-600); color: var(--white); }
.admin-nav .badge-count { margin-left: auto; background: var(--orange-500); color: #fff; font-size: .7rem; padding: 1px 7px; border-radius: 999px; }

.admin-main { min-width: 0; }
.admin-topbar { height: 68px; background: var(--white); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 26px; position: sticky; top: 0; z-index: 20; }
.admin-topbar h1 { font-size: 1.15rem; margin: 0; }
.admin-user { display: flex; align-items: center; gap: 10px; font-size: .87rem; }
.admin-user .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--teal-100); color: var(--teal-600); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.admin-content { padding: 26px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 26px; }
@media (max-width: 1100px) { .stat-grid { grid-template-columns: 1fr 1fr; } }
.stat-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 20px; }
.stat-card .top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.stat-card .icon { width: 38px; height: 38px; border-radius: 9px; display: flex; align-items: center; justify-content: center; }
.stat-card .value { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; color: var(--navy-900); }
.stat-card .label { font-size: .82rem; color: var(--ink-soft); }
.stat-card .delta { font-size: .78rem; font-weight: 600; }
.delta.up { color: var(--success); }
.delta.down { color: var(--danger); }

.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 22px; margin-bottom: 22px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.panel-head h2 { font-size: 1.05rem; margin: 0; }

table.admin-table { width: 100%; border-collapse: collapse; font-size: .89rem; }
table.admin-table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.admin-table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.admin-table tr:hover td { background: var(--bg); }
.table-actions { display: flex; gap: 6px; }
.icon-btn { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; border: 1px solid var(--line); background: var(--white); cursor: pointer; color: var(--ink-soft); }
.icon-btn:hover { border-color: var(--teal-500); color: var(--teal-600); }
.icon-btn.danger:hover { border-color: var(--danger); color: var(--danger); }

.status-pill { font-size: .74rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; display: inline-block; }
.status-pill.green { background: #E9F8EF; color: var(--success); }
.status-pill.red { background: #FCEAEA; color: var(--danger); }
.status-pill.orange { background: var(--orange-100); color: var(--orange-600); }
.status-pill.gray { background: #EEF1F3; color: var(--ink-soft); }
.status-pill.teal { background: var(--teal-100); color: var(--teal-600); }

.toggle-switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--line); border-radius: 999px; transition: .2s; }
.toggle-slider::before { content: ""; position: absolute; height: 16px; width: 16px; left: 3px; top: 3px; background: white; border-radius: 50%; transition: .2s; }
.toggle-switch input:checked + .toggle-slider { background: var(--success); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tabs a { padding: 10px 16px; font-size: .9rem; font-weight: 500; color: var(--ink-soft); border-bottom: 2px solid transparent; white-space: nowrap; flex-shrink: 0; }
.tabs a.active { color: var(--teal-600); border-color: var(--teal-500); }

.modal-overlay { position: fixed; inset: 0; background: rgba(10,27,51,.55); display: none; align-items: center; justify-content: center; z-index: 200; padding: 20px; }
.modal-overlay.show { display: flex; }
.modal-box { background: var(--white); border-radius: var(--radius-lg); padding: 28px; max-width: 520px; width: 100%; max-height: 90vh; overflow-y: auto; }

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 300; transform: translateX(-100%); transition: transform .2s ease; width: 260px; }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-nav-toggle { display: block !important; }
  .admin-topbar { padding: 0 16px; }
  .admin-user span { display: none; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .admin-content { padding: 16px; }
  .admin-topbar { height: 60px; }
  .admin-topbar h1 { font-size: 1rem; }
  .stat-grid { grid-template-columns: 1fr; }
  .panel { padding: 16px; }
}

/* Tableaux back-office : défilement horizontal plutôt que débordement de page */
.panel:has(table.admin-table) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.admin-table { min-width: 640px; }

/* Un clic en dehors du menu mobile (back-office) le referme */
.admin-sidebar-overlay { display: none; }
@media (max-width: 900px) {
  .admin-sidebar-overlay.show { display: block; position: fixed; inset: 0; background: rgba(10,27,51,.4); z-index: 250; }
}
