/* =========================================================================
   PanoTour — design « tableau de bord » (studio + espace agence)
   Chargé APRÈS studio.css : redéfinit les couleurs (thème clair) et la disposition générale.
   Inspirations : refs/compte.png (structure), photoMiseEnAvantDeLaVisite.png (cartes),
   listeVisites.png (grilles), bullesStats.png (bulles de statistiques).
   ========================================================================= */
:root {
  --bg: #f4f6fa;          /* champs, fonds secondaires */
  --panel: #ffffff;
  --panel-2: #f6f7fa;
  --panel-3: #eef1f5;
  --line: #e5e8ee;
  --text: #15171c;
  --muted: #6b7280;
  --accent: #ff5b2e;      /* orange vif (bulles, éléments actifs) */
  --accent-ink: #ffffff;
  --ink: #17181c;         /* menu, boutons principaux, bulles */
  --ink-2: #23252b;
  --danger: #e5484d;
  --ok: #17a34a;
  --p-lav: #e9e4fb;
  --p-mint: #dcf2e4;
  --p-cream: #faf1d4;
  --p-sky: #dce9fb;
  --p-rose: #fbe3dc;
  --r: 18px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 24px rgba(16, 24, 40, .06);
  color-scheme: light;
  font-family: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
}
html, body { background: var(--ink); }
body.is-gate { background: radial-gradient(1200px 600px at 20% 0%, #e3ebf8, #eef2f8 60%); }

/* ---------- Boutons ---------- */
.btn { border-radius: 999px; padding: 9px 16px; border-color: var(--line); background: var(--panel-3); color: var(--text); font-weight: 600; }
.btn:hover { background: #e5e9f0; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #2c2f36; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--panel-3); }
.btn.danger { color: var(--danger); border-color: rgba(229, 72, 77, .35); }
.btn.small { padding: 6px 12px; }
.btn.pill { padding: 10px 18px; background: var(--panel-3); border-color: transparent; }
.btn.pill:hover { background: #e3e7ee; }
.icon-btn { border-radius: 50%; }
input[type=text], input[type=password], input[type=email], input[type=search], input[type=number], input[type=date], select, textarea {
  background: var(--bg) !important; border-color: var(--line) !important; color: var(--text) !important; border-radius: 12px !important;
}
input:focus, select:focus, textarea:focus { border-color: var(--ink) !important; outline: none; }
:focus-visible { outline-color: var(--accent); }
.badge { background: var(--panel-3); color: var(--muted); }
.badge.live { background: #dcf5e4; color: #157a3a; }
.badge.priv { background: #fff0e0; color: #b45309; }
code { background: var(--panel-3); }

/* ---------- Structure : menu à gauche + panneau principal ---------- */
.shell { display: flex; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; width: 96px; flex: none;
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 10px; background: var(--ink); color: #fff;
}
.side-logo { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: #f6efd9; color: var(--ink); margin-bottom: 18px; overflow: hidden; text-decoration: none; font-weight: 800; font-size: 20px; }
.side-logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; padding: 6px; }
.side-logo svg { width: 26px; height: 26px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.side-nav a, .side-out button {
  position: relative; display: grid; justify-items: center; gap: 4px; padding: 10px 4px; border-radius: 14px; border: 0; width: 100%;
  color: #9aa0ab; text-decoration: none; font-size: 10.5px; font-weight: 600; letter-spacing: .01em; background: transparent; cursor: pointer;
}
.side-nav a svg, .side-out svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.side-nav a:hover, .side-out button:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.side-nav a.on { color: #fff; background: rgba(255, 255, 255, .1); }
.side-nav a.on::before { content: ""; position: absolute; left: -10px; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.side-out { margin-top: auto; width: 100%; }
.side-out form { margin: 0; }

.page { flex: 1; min-width: 0; margin: 12px 12px 12px 0; background: var(--panel); border-radius: 28px; display: flex; flex-direction: column; min-height: calc(100vh - 24px); }
.topbar { position: sticky; top: 0; z-index: 30; height: auto; display: flex; align-items: center; gap: 12px; padding: 22px 32px 14px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px); border: 0; border-radius: 28px 28px 0 0; }
.page-title { margin: 0; font-size: 28px; font-weight: 750; letter-spacing: -.01em; }
.burger { display: none; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); place-items: center; color: var(--text); }
.burger svg, .round svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.round { position: relative; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; color: var(--text); text-decoration: none; cursor: pointer; flex: none; }
.round:hover { background: var(--panel-3); }
.round .nav-badge { position: absolute; top: -4px; right: -4px; margin: 0; background: var(--accent); color: #fff; }

/* Compte en haut à droite */
.account { position: relative; }
.account > button { display: flex; align-items: center; gap: 10px; padding: 5px 12px 5px 5px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; font-weight: 650; cursor: pointer; }
.account > button:hover { background: var(--panel-2); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #ffb199, #ff5b2e); color: #fff; font-size: 13px; font-weight: 800; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.account > button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.account-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; padding: 8px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 16px 40px rgba(16, 24, 40, .14); z-index: 60; }
.account-menu a, .account-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 10px; border: 0; background: transparent; color: var(--text); text-decoration: none; font: inherit; text-align: left; cursor: pointer; }
.account-menu a:hover, .account-menu button:hover { background: var(--panel-3); }
.account-menu small { display: block; padding: 6px 12px 8px; color: var(--muted); }
.account-menu form { margin: 0; }

.dash { padding: 8px 32px 48px; max-width: 1400px; width: 100%; margin: 0; }
.dash-head { margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.dash-head h1 { font-size: 20px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 0 14px; flex-wrap: wrap; }
.sec-head h2, .sec-title { margin: 0; font-size: 19px; font-weight: 750; }

/* ---------- Tuiles pastel (vue d'ensemble) ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.tile { position: relative; border-radius: 22px; padding: 18px 18px 16px; min-height: 132px; display: flex; flex-direction: column; gap: 4px; background: var(--p-sky); text-decoration: none; color: var(--text); }
.tile b { font-size: 26px; font-weight: 750; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.tile span { font-size: 13px; color: #4b5563; }
.tile small { margin-top: auto; font-size: 12.5px; color: #4b5563; }
.tile .tile-ic { position: absolute; right: 14px; top: 14px; width: 40px; height: 40px; border-radius: 12px; background: #fff; display: grid; place-items: center; }
.tile .tile-ic svg { width: 20px; height: 20px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.t-lav { background: var(--p-lav); } .t-mint { background: var(--p-mint); } .t-cream { background: var(--p-cream); } .t-sky { background: var(--p-sky); } .t-rose { background: var(--p-rose); }

/* Carte sombre de raccourcis */
.overview { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 16px; align-items: stretch; }
.shortcuts { position: relative; overflow: hidden; border-radius: 22px; padding: 22px; background: var(--ink); color: #fff; display: flex; flex-direction: column; gap: 12px; }
.shortcuts::after { content: ""; position: absolute; right: -40px; bottom: -50px; width: 180px; height: 180px; border: 2px solid rgba(255, 255, 255, .12); border-radius: 28px; transform: rotate(18deg); }
.shortcuts h2 { margin: 0; font-size: 21px; line-height: 1.25; }
.shortcuts h2 em { font-style: normal; padding: 0 8px; border: 1.5px solid #fff; border-radius: 999px; }
.shortcuts p { margin: 0; color: #b7bcc6; font-size: 13.5px; }
.shortcuts .btn.primary { background: #dbe9fb; color: var(--ink); border-color: #dbe9fb; align-self: flex-start; }
.shortcut-list { display: flex; flex-wrap: wrap; gap: 8px; position: relative; z-index: 1; }
.shortcut-list a, .shortcut-list button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .18); color: #fff; background: rgba(255, 255, 255, .06); text-decoration: none; font: inherit; font-size: 13px; cursor: pointer; }
.shortcut-list a:hover, .shortcut-list button:hover { background: rgba(255, 255, 255, .14); }
.shortcut-list svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }

/* ---------- Cartes de visite (photo mise en avant) ---------- */
.grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.card { border: 1px solid var(--line); border-radius: 26px; background: var(--panel); padding: 10px; box-shadow: var(--shadow); overflow: visible; }
.card:hover { border-color: #d6dbe3; }
.vc-photo { position: relative; }
.card-thumb { border-radius: 20px; aspect-ratio: 4 / 3; background-color: var(--panel-3); }
.vc-tools { position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; opacity: 0; transition: opacity .15s; }
.card:hover .vc-tools, .card:focus-within .vc-tools { opacity: 1; }
@media (hover: none) { .vc-tools { opacity: 1; } }
.vc-tools .round { width: 36px; height: 36px; background: rgba(255, 255, 255, .92); border-color: transparent; }
.vc-tools .round svg { width: 17px; height: 17px; }
.vc-tools .round.danger { color: var(--danger); }
.card-body { padding: 14px 8px 4px; }
.card-title { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 6px; white-space: normal; }
.verified { width: 18px; height: 18px; flex: none; }
.vc-sub { margin: 4px 0 8px; color: var(--muted); font-size: 13.5px; line-height: 1.4; }
.card-meta { flex-wrap: wrap; }
.card-client { margin: 6px 0 0; }
.vc-foot { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.vc-stat { display: inline-flex; align-items: center; gap: 5px; font-weight: 650; font-size: 14px; font-variant-numeric: tabular-nums; }
.vc-stat svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.vc-foot .spacer { flex: 1; }
.card-actions { display: none; } /* remplacé par les boutons ronds sur la photo */

/* Clients en cartes (style « liste ») */
.client-grid { gap: 20px; }
.client-card { border-radius: 24px; padding: 8px; box-shadow: var(--shadow); }
.client-card .client-logo { margin: 6px; border-radius: 18px; height: 84px; background: var(--panel-2); }
.client-card .card-actions { display: flex; padding: 8px 12px 10px; }
.client-logo { background: var(--panel-2); }

/* ---------- Bulles de statistiques (fond sombre, chiffres forts) ---------- */
.kpis { gap: 14px; }
.kpi { border-radius: 22px; border: 0; background: var(--panel-2); padding: 16px 18px; }
.kpis.bubbles .kpi { background: var(--ink); color: #fff; min-height: 128px; position: relative; overflow: hidden; }
.kpis.bubbles .kpi span, .kpis.bubbles .kpi small { color: #9aa0ab; }
.kpis.bubbles .kpi b { font-size: 30px; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 34px; margin-top: 10px; }
.spark i { flex: 1; min-width: 2px; max-width: 8px; border-radius: 3px 3px 0 0; background: var(--accent); opacity: .9; }
.spark i.dim { background: #3a3d45; }
.chart .bar path { fill: var(--accent); }
.chart .bar.on path { fill: #ff7a52; }
.bl-track i { background: var(--accent); }
.slots-bar i { background: var(--accent) !important; }

.set-card { border-radius: 22px; border-color: var(--line); background: var(--panel); box-shadow: var(--shadow); }
.table-wrap { border-radius: 18px; box-shadow: none; }
.st-table th { background: var(--panel-2); }
.empty-state { border-radius: 22px; background: var(--panel-2); border-color: var(--line); }
.media-item { border-radius: 20px; padding: 6px; box-shadow: var(--shadow); }
.media-thumb { border-radius: 16px; overflow: hidden; }
.modal { border-radius: 24px; background: var(--panel); box-shadow: 0 24px 60px rgba(16, 24, 40, .2); }
.modal-back { background: rgba(23, 24, 28, .45); }
.toast { background: var(--ink); color: #fff; border-color: var(--ink); border-radius: 14px; }
.toast.err { background: #fff; color: var(--danger); border-color: var(--danger); }
.notif, .req-card { border-radius: 20px; }
.req-card { background: #fff6ee; border-color: #ffd7bd; }
.req-banner { background: #fff6ee; border: 1px solid #ffd7bd; border-radius: 16px; margin: 0 32px 4px; color: var(--text); }
.req-banner b { color: #c2410c; }
.gate { border-radius: 26px; background: var(--panel); border-color: transparent; box-shadow: 0 20px 60px rgba(16, 24, 40, .12); }
.gate .btn.primary { width: 100%; }

/* ---------- Éditeur (thème clair) ---------- */
.editor { background: var(--panel); }
.ed-top, .ed-left, .ed-right { background: var(--panel); }
.ed-top { border-bottom-color: var(--line); }
.seg { border-radius: 999px; }
.seg button.on { background: var(--ink); color: #fff; }
.vis-seg button.on[data-v="draft"] { background: var(--ink); color: #fff; }
.scene.active, .hs-item.active { background: var(--panel-3); border-color: var(--line); }
.banner { background: rgba(255, 255, 255, .95); color: var(--text); border-color: var(--accent); }
.tabs { background: var(--panel); }
.tabs button.on { background: var(--ink); color: #fff; }
.view-box { background: var(--panel-2); }
.toast-zone { z-index: 200; }

/* ---------- Mobile : menu hamburger en haut ---------- */
@media (max-width: 900px) {
  html, body { background: var(--panel); }
  .shell { display: block; }
  .page { margin: 0; border-radius: 0; min-height: 100vh; }
  .topbar { border-radius: 0; padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .page-title { font-size: 20px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .burger { display: grid; }
  .account > button .acc-name { display: none; }
  .account > button { padding: 4px; }
  .side { position: fixed; z-index: 50; top: 67px; left: 0; right: 0; height: auto; width: auto; flex-direction: column; align-items: stretch; padding: 12px 16px 16px;
    border-radius: 0 0 22px 22px; box-shadow: 0 18px 40px rgba(0, 0, 0, .25); transform: translateY(-120%); transition: transform .22s ease; }
  body.menu-open .side { transform: none; }
  .side-logo { display: none; }
  .side-nav { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .side-nav a, .side-out button { grid-auto-flow: column; justify-content: start; align-items: center; gap: 10px; padding: 12px 14px; font-size: 14px; }
  .side-nav a.on::before { display: none; }
  .side-out { margin-top: 8px; }
  .dash { padding: 16px 16px 40px; }
  .overview { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .tile { min-height: 112px; padding: 14px; }
  .tile b { font-size: 21px; }
  .tile .tile-ic { width: 34px; height: 34px; }
  .grid { grid-template-columns: 1fr; }
  .req-banner { margin: 8px 16px 0; }
}
@media (max-width: 420px) { .side-nav { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }
/* Vue d'ensemble : tuiles en 2 × 2 à côté de la carte de raccourcis */
.overview .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.overview .tile { min-height: 116px; }
.tile b { font-size: clamp(20px, 2.1vw, 26px); overflow-wrap: anywhere; padding-right: 48px; }
@media (max-width: 1100px) { .overview { grid-template-columns: 1fr; } .overview .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 900px) { .overview .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tile b { padding-right: 40px; } }
.account-menu svg, .tile-ic svg, .vc-stat svg, .dash-filter svg, .sec-head svg, .btn.pill svg { flex: none; }
.account-menu svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); }
.btn.pill svg, .btn svg { width: 16px; height: 16px; }
@media (max-width: 900px) {
  .side { transform: translateY(calc(-100% - 90px)); visibility: hidden; transition: transform .22s ease, visibility 0s linear .22s; }
  body.menu-open .side { visibility: visible; transition: transform .22s ease; }
  .topbar > .spacer { display: none; }
  .page-title { font-size: 19px; }
}

/* Légende au survol des petites stats des cartes (aussi au clavier / au toucher via :focus) */
.vc-stat[data-tip] { position: relative; cursor: help; border-radius: 6px; }
.vc-stat[data-tip]::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 10px); transform: translate(-50%, 4px);
  width: max-content; max-width: 220px; padding: 7px 10px; border-radius: 10px; background: var(--ink); color: #fff;
  font-size: 12px; font-weight: 600; line-height: 1.35; text-align: center; white-space: normal;
  opacity: 0; pointer-events: none; transition: opacity .12s ease, transform .12s ease; z-index: 20;
}
.vc-stat[data-tip]::before {
  content: ""; position: absolute; left: 50%; bottom: calc(100% + 4px); transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--ink); border-bottom: 0; opacity: 0; transition: opacity .12s ease; z-index: 20;
}
.vc-stat[data-tip]:hover::after, .vc-stat[data-tip]:focus-visible::after, .vc-stat[data-tip]:focus::after { opacity: 1; transform: translate(-50%, 0); }
.vc-stat[data-tip]:hover::before, .vc-stat[data-tip]:focus-visible::before, .vc-stat[data-tip]:focus::before { opacity: 1; }
.vc-stat[data-tip]:first-child::after { left: 0; transform: translate(-8px, 4px); }
.vc-stat[data-tip]:first-child:hover::after, .vc-stat[data-tip]:first-child:focus::after { transform: translate(-8px, 0); }
@media (prefers-reduced-motion: reduce) { .vc-stat[data-tip]::after, .vc-stat[data-tip]::before { transition: none; } }

/* Version en ligne (vue d'ensemble) */
.app-version { position: fixed; right: 14px; bottom: 10px; z-index: 5; font-size: 11px; color: var(--muted, #8a8f98); background: rgba(255, 255, 255, .78); padding: 3px 9px; border-radius: 999px; pointer-events: auto; font-variant-numeric: tabular-nums; }
