/* Cloud : tableau de bord technique, sombre, à l'accent de la marque (--brand, marque blanche). */

:root {
  --brand: #6d7cff;
  --bg: #090d1a;
  --bg-2: #0d1326;
  --panel: rgba(19, 27, 51, 0.72);
  --panel-solid: #121a31;
  --panel-2: #18223f;
  --border: rgba(148, 163, 209, 0.14);
  --border-strong: rgba(148, 163, 209, 0.24);
  --text: #e9edff;
  --muted: #8a94b8;
  --faint: #5d6789;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --brand-soft: color-mix(in srgb, var(--brand) 16%, transparent);
  --brand-glow: color-mix(in srgb, var(--brand) 38%, transparent);
  --radius: 18px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(900px 500px at 12% -10%, var(--brand-glow), transparent 60%),
    radial-gradient(700px 500px at 110% 10%, color-mix(in srgb, var(--brand) 14%, transparent), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }
.i { width: 18px; height: 18px; flex: none; }

/* ---- Structure ------------------------------------------------------------------------ */

.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 22px 14px;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px; text-decoration: none; }
.brand-logo { width: 38px; height: 38px; border-radius: 11px; object-fit: contain; background: var(--panel-2); }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 45%, #fff));
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 24px var(--brand-glow);
}
.brand-name { font-weight: 700; letter-spacing: -0.01em; }
.brand-tagline { color: var(--muted); font-size: 0.78rem; }
.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-label { margin: 10px 12px 4px; color: var(--faint); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 12px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.nav-item:hover { background: rgba(148, 163, 209, 0.07); color: var(--text); }
.nav-item.is-active { background: var(--brand-soft); color: var(--text); }
.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--brand);
  box-shadow: 0 0 14px var(--brand);
}
.nav-item.is-active .i { color: var(--brand); }
.sidebar-foot { display: flex; flex-direction: column; gap: 6px; padding-top: 14px; border-top: 1px solid var(--border); }
.user { display: flex; align-items: center; gap: 10px; padding: 6px 10px; }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--panel-2); color: var(--brand); font-weight: 700; }

.main { min-width: 0; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 28px 36px 8px; }
.topbar h1 { font-size: 1.7rem; font-weight: 750; letter-spacing: -0.02em; }
.topbar .subtitle { margin-top: 4px; color: var(--muted); }
.content { display: flex; flex-direction: column; gap: 22px; padding: 20px 36px 56px; }

/* ---- Panneaux ------------------------------------------------------------------------- */

.panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(10px);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-title { font-size: 0.95rem; font-weight: 700; }
.panel-sub { color: var(--muted); font-size: 0.82rem; }
.grid { display: grid; gap: 18px; }
.grid > * { min-width: 0; }
.grid-kpi { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.grid-2 { grid-template-columns: 2fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
@media (max-width: 1200px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---- Indicateurs ---------------------------------------------------------------------- */

.kpi { position: relative; overflow: hidden; gap: 6px; }
.kpi::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(var(--brand-glow), transparent 70%);
  opacity: 0.5;
}
.kpi-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.kpi-label .i { color: var(--brand); }
.kpi-value { font-size: 2.1rem; font-weight: 780; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi-value small { margin-left: 4px; color: var(--muted); font-size: 1rem; font-weight: 600; }
.kpi-foot { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.82rem; }
.trend { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 0.76rem; font-weight: 700; }
.trend--up { background: color-mix(in srgb, var(--success) 16%, transparent); color: var(--success); }
.trend--down { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.meter { height: 6px; border-radius: 999px; background: rgba(148, 163, 209, 0.12); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 50%, var(--success))); }

.chart { position: relative; height: 280px; }
.chart--tall { height: 320px; }
.chart--small { height: 220px; }
.empty-chart { display: grid; place-items: center; height: 100%; color: var(--faint); font-size: 0.9rem; }

/* ---- Pastilles, notes, boutons -------------------------------------------------------- */

.pill { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; padding: 4px 10px; border-radius: 999px; font-size: 0.76rem; font-weight: 700; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.pill--ok { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); }
.pill--warn { background: color-mix(in srgb, var(--warning) 14%, transparent); color: var(--warning); }
.pill--error { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.pill--off { background: rgba(148, 163, 209, 0.1); color: var(--faint); }
.pill--off::before { box-shadow: none; }

.note { padding: 12px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--brand-soft); }
.note--success { border-color: color-mix(in srgb, var(--success) 30%, transparent); background: color-mix(in srgb, var(--success) 10%, transparent); color: var(--success); }
.note--error { border-color: color-mix(in srgb, var(--danger) 30%, transparent); background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); }
.note--warning { border-color: color-mix(in srgb, var(--warning) 30%, transparent); background: color-mix(in srgb, var(--warning) 10%, transparent); color: var(--warning); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: rgba(148, 163, 209, 0.06);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 100ms, background 120ms, box-shadow 120ms;
}
.btn:hover { background: rgba(148, 163, 209, 0.12); }
.btn:active { transform: translateY(1px); }
.btn--primary { border-color: transparent; background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 70%, #fff)); color: #fff; box-shadow: 0 8px 22px var(--brand-glow); }
.btn--primary:hover { background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 90%, #fff), var(--brand)); }
.btn--danger { border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
.btn--sm { min-height: 34px; padding: 0 12px; font-size: 0.84rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.import-form { display: contents; }
.import-form label.btn { cursor: pointer; }

/* ---- Formulaires ---------------------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: 7px; color: var(--muted); font-size: 0.84rem; font-weight: 600; }
.field input:not([type="checkbox"]):not([type="radio"]):not([type="color"]), .field select, .field textarea, select {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: var(--bg-2);
  color: var(--text);
  font: inherit;
  font-weight: 500;
}
.field textarea { min-height: 120px; padding: 10px 12px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.field input[type="color"] { width: 64px; height: 42px; padding: 3px; border: 1px solid var(--border-strong); border-radius: 11px; background: var(--bg-2); }
.field ul { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0; padding: 0; list-style: none; color: var(--text); font-weight: 500; }
.field ul label { display: flex; align-items: center; gap: 8px; }
.field--check { flex-direction: row; align-items: center; color: var(--text); }
.error { color: var(--danger); font-weight: 600; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.form-grid .btn-row { grid-column: 1 / -1; justify-content: flex-end; }
.code-input { width: 10ch; text-transform: uppercase; letter-spacing: 0.12em; }

/* ---- Bornes ----------------------------------------------------------------------------- */

.kiosk-head { display: flex; justify-content: space-between; gap: 12px; }
.kiosk-name { font-size: 1.05rem; font-weight: 700; }
.kiosk--revoked { opacity: 0.55; }
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { padding: 10px 12px; border-radius: 12px; background: rgba(148, 163, 209, 0.06); }
.stat-value { font-weight: 750; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 0.74rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 0.9rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }

.event-card { text-decoration: none; transition: border-color 120ms, transform 120ms; }
.event-card:hover { border-color: var(--brand); transform: translateY(-2px); }
.event-card h2 { font-size: 1.05rem; }

/* ---- Connexion publique ------------------------------------------------------------- */

.login { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.login-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px;
  overflow: hidden;
  background:
    radial-gradient(600px 400px at 20% 30%, var(--brand-glow), transparent 65%),
    radial-gradient(500px 500px at 90% 90%, color-mix(in srgb, var(--brand) 25%, transparent), transparent 60%),
    var(--bg-2);
  border-right: 1px solid var(--border);
}
.login-hero h1 { max-width: 14ch; font-size: clamp(2.2rem, 4vw, 3.4rem); font-weight: 800; line-height: 1.05; letter-spacing: -0.03em; }
.login-hero .lead { max-width: 42ch; margin-top: 16px; color: var(--muted); font-size: 1.05rem; }
.hero-grid { position: absolute; inset: 0; background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px); background-size: 48px 48px; mask-image: radial-gradient(circle at 30% 40%, #000, transparent 70%); pointer-events: none; }
.hero-content { position: relative; }
.login-side { display: grid; place-items: center; padding: 32px; }
.login-card { width: min(400px, 100%); gap: 18px; padding: 32px; }
.login-card h2 { font-size: 1.4rem; }
.login-card .btn { width: 100%; min-height: 46px; }
@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login-hero { min-height: 260px; padding: 32px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav-label { display: none; }
}

/* ---- Organisateurs ---------------------------------------------------------------------- */

.org-card { border-top: 3px solid var(--org); }
.org-card.is-archived { opacity: 0.55; }
.org-head { display: flex; align-items: center; gap: 14px; }
.org-head > div { flex: 1; min-width: 0; }
.org-logo { width: 48px; height: 48px; border-radius: 12px; object-fit: contain; background: #fff; padding: 4px; }
.org-mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: var(--org); color: #fff; font-size: 1.3rem; font-weight: 800; box-shadow: 0 8px 22px color-mix(in srgb, var(--org) 45%, transparent); }
.org-logo--lg, .org-mark--lg { width: 84px; height: 84px; border-radius: 20px; font-size: 2rem; }
.org-hero { border-top: 3px solid var(--org); background: linear-gradient(120deg, color-mix(in srgb, var(--org) 14%, transparent), var(--panel) 45%); }
.org-hero .org-head { flex-wrap: wrap; align-items: flex-start; }
.org-hero-body { flex: 1; min-width: 260px; }
.org-stats { min-width: 300px; }
.venue-list, .access-list { display: flex; flex-direction: column; gap: 10px; }
.venue { display: flex; align-items: center; gap: 14px; padding: 10px; border: 1px solid var(--border); border-radius: 14px; text-decoration: none; transition: border-color 120ms, background 120ms; }
.venue:hover { border-color: var(--brand); background: var(--brand-soft); }
.venue-photo { width: 64px; height: 48px; border-radius: 10px; object-fit: cover; flex: none; }
.venue-photo--logo { object-fit: contain; background: #fff; padding: 4px; }
.venue-photo--empty { display: grid; place-items: center; background: rgba(148, 163, 209, 0.08); color: var(--faint); }
.venue-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.venue-body .muted { display: flex; align-items: center; gap: 4px; font-size: 0.84rem; }
.i--sm { width: 14px; height: 14px; }
.access { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: rgba(148, 163, 209, 0.05); }
.access-body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.access-body .muted { font-size: 0.82rem; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; min-height: 34px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--bg-2); color: var(--text); }
.field--wide { grid-column: 1 / -1; }
.field input[type="file"] { padding: 8px; }

/* ---- Événement : onglets, galerie, e-mails ------------------------------------------------ */

.tabs { display: flex; align-items: center; gap: 4px; padding: 5px; border: 1px solid var(--border); border-radius: 14px; background: var(--panel); align-self: flex-start; flex-wrap: wrap; }
.tab, .tabs-back { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 14px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: 0.9rem; text-decoration: none; transition: background 120ms, color 120ms; }
.tabs-back { padding: 0 10px; }
.tab:hover, .tabs-back:hover { background: rgba(148, 163, 209, 0.08); color: var(--text); }
.tab.is-active { background: var(--brand-soft); color: var(--text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 40%, transparent); }
.tab.is-active .i { color: var(--brand); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: 999px; color: var(--muted); font-size: 0.86rem; font-weight: 600; text-decoration: none; }
.chip span { padding: 1px 7px; border-radius: 999px; background: rgba(148, 163, 209, 0.12); font-size: 0.74rem; }
.chip:hover { color: var(--text); border-color: var(--brand); }
.chip.is-active { border-color: transparent; background: var(--brand); color: #fff; }
.chip.is-active span { background: rgba(255, 255, 255, 0.22); }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.photo { position: relative; display: block; aspect-ratio: 2 / 3; padding: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-2); color: var(--text); font: inherit; cursor: zoom-in; transition: transform 140ms, border-color 140ms, box-shadow 140ms; }
.photo img { width: 100%; height: 100%; object-fit: contain; }
.photo:hover { transform: translateY(-3px); border-color: var(--brand); box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35), 0 0 0 1px var(--brand); }
.photo-meta { position: absolute; inset: auto 0 0 0; display: flex; justify-content: space-between; padding: 22px 10px 8px; background: linear-gradient(transparent, rgba(5, 8, 18, 0.85)); font-size: 0.78rem; font-weight: 600; opacity: 0; transition: opacity 140ms; }
.photo:hover .photo-meta, .photo:focus-visible .photo-meta { opacity: 1; }
.photo-badges { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; padding: 4px 6px; border-radius: 8px; background: rgba(5, 8, 18, 0.7); color: var(--brand); }
.photo--empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 12px; color: var(--muted); font-size: 0.82rem; text-align: center; cursor: default; border-style: dashed; }
.photo--empty:hover { transform: none; box-shadow: none; border-color: var(--border); }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; }

.lightbox { max-width: min(92vw, 1100px); max-height: 94vh; padding: 0; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--panel-solid); color: var(--text); overflow: hidden; }
.modal { position: relative; width: min(92vw, 440px); padding: 22px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--panel-solid); color: var(--text); }
.modal:not([open]) { display: none; } /* .panel l'afficherait même fermée */
.modal[open] { display: block; }
.modal::backdrop { background: rgba(3, 5, 12, 0.72); backdrop-filter: blur(4px); }
.modal-close { position: absolute; top: 14px; right: 14px; }
.modal-form { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.modal-form .btn-row { justify-content: flex-end; }
.lightbox::backdrop { background: rgba(3, 5, 12, 0.82); backdrop-filter: blur(6px); }
.lightbox img { display: block; max-width: 100%; max-height: calc(94vh - 70px); margin: 0 auto; object-fit: contain; }
.lightbox-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.lightbox-caption { color: var(--muted); font-size: 0.88rem; }
.lightbox [hidden] { display: none; }

.search { display: flex; align-items: center; gap: 8px; min-width: min(360px, 100%); padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 11px; background: var(--bg-2); color: var(--muted); }
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.search input { flex: 1; min-height: 40px; border: 0; background: transparent; color: var(--text); font: inherit; outline: none; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th { padding: 10px 12px; border-bottom: 1px solid var(--border-strong); color: var(--muted); font-size: 0.76rem; font-weight: 700; text-align: left; text-transform: uppercase; letter-spacing: 0.06em; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:hover td { background: rgba(148, 163, 209, 0.04); }
.thumb-link img { display: block; width: 40px; height: 52px; border-radius: 8px; object-fit: cover; background: var(--bg-2); }

.settings-sections { display: flex; flex-direction: column; gap: 18px; }
.btn-row--end { justify-content: flex-end; }

/* Choix multiples (Django rend <div><div><label><input> texte</label></div>…</div>) : puces à bascule. */
.field > div:has(input[type="checkbox"]) { display: flex; flex-wrap: wrap; gap: 8px; }
.field > div:has(input[type="checkbox"]) label { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: 999px; color: var(--muted); font-weight: 600; cursor: pointer; transition: background 120ms, border-color 120ms, color 120ms; }
.field > div:has(input[type="checkbox"]) label:hover { border-color: var(--brand); color: var(--text); }
.field > div:has(input[type="checkbox"]) label:has(input:checked) { border-color: color-mix(in srgb, var(--brand) 60%, transparent); background: var(--brand-soft); color: var(--text); }
.field > div:has(input[type="checkbox"]) input { accent-color: var(--brand); margin: 0; }

/* ---- Flotte ------------------------------------------------------------------------------ */

.fleet-group { display: flex; flex-direction: column; gap: 14px; }
.group-head { display: flex; align-items: baseline; gap: 12px; }
.group-head h2 { font-size: 1.05rem; }
summary.group-head { cursor: pointer; list-style: none; }
summary.group-head::-webkit-details-marker { display: none; }
summary.group-head h2::before { content: "▸ "; color: var(--faint); }
details[open] > summary.group-head h2::before { content: "▾ "; }
.kiosk-card { gap: 12px; }
.kiosk--alert { border-color: color-mix(in srgb, var(--warning) 45%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--warning) 20%, transparent), 0 10px 30px color-mix(in srgb, var(--warning) 8%, transparent); }
.kiosk-title { display: flex; align-items: center; gap: 12px; min-width: 0; text-decoration: none; }
.kiosk-title > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.kiosk-title:hover .kiosk-name { color: var(--brand); }
.kiosk-title .faint { font-size: 0.78rem; }
.kiosk-icon { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px; background: rgba(148, 163, 209, 0.08); color: var(--faint); }
.kiosk-icon.is-online { background: var(--brand-soft); color: var(--brand); box-shadow: 0 0 18px var(--brand-glow); }
.kiosk-event { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; background: var(--brand-soft); font-weight: 650; font-size: 0.9rem; text-decoration: none; }
.kiosk-event .i { color: var(--brand); }
.kiosk-event:hover { box-shadow: inset 0 0 0 1px var(--brand); }
.stat--warn { background: color-mix(in srgb, var(--warning) 12%, transparent); }
.stat--warn .stat-value, .stat--warn .stat-label { color: var(--warning); }
.kpi--alert { border-color: color-mix(in srgb, var(--warning) 45%, transparent); }
.kpi--alert .kpi-label .i, .kpi--alert .kpi-value { color: var(--warning); }
.kpi-value--text { font-size: 1.35rem; padding: 6px 0; }
.assign-form { display: flex; gap: 8px; }
.assign-form select { flex: 1; width: 100%; min-width: 0; text-overflow: ellipsis; }
.access a { text-decoration: none; }
.access a:hover strong { color: var(--brand); }

/* ---- Effets ------------------------------------------------------------------------------ */

.style-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.style-card { padding: 0; gap: 0; overflow: hidden; text-decoration: none; transition: border-color 140ms, transform 140ms, box-shadow 140ms; }
.style-card:hover { border-color: var(--brand); transform: translateY(-3px); box-shadow: 0 16px 34px rgba(0, 0, 0, 0.35); }
.style-card.is-archived { opacity: 0.55; }
.style-visual { position: relative; aspect-ratio: 16 / 10; background: radial-gradient(circle at 30% 20%, var(--brand-glow), transparent 60%), var(--bg-2); }
.style-visual img { width: 100%; height: 100%; object-fit: cover; }
.style-placeholder { display: grid; place-items: center; width: 100%; height: 100%; color: var(--brand); }
.style-placeholder .i { width: 44px; height: 44px; filter: drop-shadow(0 0 14px var(--brand-glow)); }
.style-placeholder--lg { aspect-ratio: 2 / 3; }
.style-version { position: absolute; top: 10px; right: 10px; padding: 3px 8px; border-radius: 8px; background: rgba(5, 8, 18, 0.7); font-size: 0.74rem; }
.style-body { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px 18px; }
.style-body h3 { font-size: 1.05rem; }
.prompt-excerpt { color: var(--muted); font-size: 0.84rem; line-height: 1.45; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.style-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 8px; background: rgba(148, 163, 209, 0.08); color: var(--muted); font-size: 0.76rem; font-weight: 600; }
.tag--brand { background: var(--brand-soft); color: var(--text); }
.example-photo { flex-direction: row; align-items: center; gap: 20px; padding: 16px; }
.example-photo > img, .example-photo > .style-placeholder { width: 120px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 10px; flex: none; }
.example-photo-body { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.example-photo-body .btn-row { align-items: flex-end; flex-wrap: wrap; }
.local-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.local-effect { flex-direction: row; align-items: center; gap: 12px; padding: 14px 16px; }
.local-swatch { width: 40px; height: 40px; flex: none; border-radius: 12px; background: linear-gradient(135deg, var(--brand), #22d3ee); }
.local-swatch--bw { background: linear-gradient(135deg, #f5f5f5, #1f1f1f); }
.local-swatch--sepia { background: linear-gradient(135deg, #e9d3a8, #6b4a2b); }
.local-swatch--vintage { background: linear-gradient(135deg, #f3c58a, #7a5c7d); }
.local-swatch--pencil { background: repeating-linear-gradient(45deg, #f2f2f2 0 3px, #9a9a9a 3px 4px); }
.local-swatch--watercolor { background: radial-gradient(circle at 30% 30%, #8fd3fe, transparent 60%), radial-gradient(circle at 70% 70%, #f9a8d4, transparent 60%), #fff7ed; }
.local-swatch--cartoon { background: linear-gradient(135deg, #facc15 0 50%, #ef4444 50%); }
.style-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.style-layout > aside { position: sticky; top: 20px; }
.style-preview { padding: 0; overflow: hidden; }
.style-preview img { display: block; width: 100%; }
.field textarea.prompt-input { min-height: 220px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.86rem; line-height: 1.55; }
@media (max-width: 1100px) { .style-layout { grid-template-columns: 1fr; } .style-layout > aside { position: static; } }
.field input[type="file"]::file-selector-button { margin-right: 12px; padding: 7px 12px; border: 1px solid var(--border-strong); border-radius: 9px; background: rgba(148, 163, 209, 0.1); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }

/* ---- Gabarits ---------------------------------------------------------------------------- */

.fp-box { position: relative; container-type: inline-size; overflow: hidden; border-radius: 4px; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.06); }
.fp-slot { position: absolute; overflow: hidden; }
.fp-photo { position: absolute; inset: 0; background: linear-gradient(150deg, #e6e3de, #c9c4bc); }
.fp-photo::after { content: ""; position: absolute; left: 50%; top: 50%; width: 22%; aspect-ratio: 1; max-width: 64px; transform: translate(-50%, -50%); background: #8f887d; opacity: 0.55; -webkit-mask: var(--camera-icon) center / contain no-repeat; mask: var(--camera-icon) center / contain no-repeat; }
:root { --camera-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h3l2-3h6l2 3h3a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1z'/%3E%3Ccircle cx='12' cy='13' r='4'/%3E%3C/svg%3E"); }
.fp-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.fp-text { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; line-height: 1; font-weight: 600; }
.frame-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.frame-grid--sm { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.frame-card { padding: 16px; gap: 14px; text-decoration: none; transition: border-color 140ms, transform 140ms; }
.frame-card:not(.frame-card--static):hover { border-color: var(--brand); transform: translateY(-3px); }
.frame-card.is-archived { opacity: 0.55; }
.frame-stage-sm { display: grid; place-items: center; height: 230px; padding: 8px; border-radius: 12px; background: radial-gradient(circle at 50% 40%, var(--brand-soft), transparent 70%), var(--bg-2); }
.frame-stage-sm .fp-box { max-height: 100%; max-width: 100%; height: 100%; }
.frame-stage-sm .fp-box[style*="1800 / 1200"] { height: auto; width: 100%; }
.frame-card-body { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.frame-stage { display: grid; place-items: center; min-height: 420px; padding: 18px; border-radius: 14px; background: radial-gradient(circle at 50% 40%, var(--brand-soft), transparent 70%), var(--bg-2); }
.frame-stage .fp-box { width: 100%; max-height: 62vh; }
.frame-stage .fp-box[style*="1200 / 1800"] { width: auto; height: 62vh; max-height: 62vh; }
.style-layout--frame { grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); }
.form-grid--dense { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.field--error input, .field--error select { border-color: var(--danger) !important; }

/* ---- Éditeur de gabarit ------------------------------------------------------------------ */

.editor { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 18px; align-items: start; }
.editor-stage { position: sticky; top: 16px; }
.editor-side { display: flex; flex-direction: column; gap: 18px; }
.editor-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.editor-toolbar .btn-row { align-items: center; }
.preset { gap: 4px; min-width: 46px; }
.frame-stage--editor { min-height: 0; height: calc(100vh - 230px); padding: 24px; }
.frame-stage--editor .fp-box { width: auto; height: 100%; max-width: 100%; max-height: 100%; }
.frame-stage--editor .fp-box[style*="1800 / 1200"] { width: 100%; height: auto; }
.fp-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; user-select: none; }
.fe-item { cursor: move; touch-action: none; user-select: none; }
.fp-slot.fe-item { outline: 1px dashed rgba(255, 255, 255, 0.55); outline-offset: -1px; }
.fp-text.fe-item:hover, .fp-slot.fe-item:hover { outline: 1px dashed var(--brand); }
.fe-item.is-selected { outline: 2px solid var(--brand) !important; outline-offset: 2px; z-index: 5; }
/* Pas de z-index entre calques : l'ordre du document est celui de l'impression (fond,
   décor « derrière », photos, surimpression, décor « devant », QR codes, textes). */
.fe-badge { position: absolute; top: 6px; left: 6px; padding: 2px 7px; border-radius: 6px; background: rgba(5, 8, 18, 0.72); color: #fff; font: 600 11px/1.4 var(--font); pointer-events: none; z-index: 4; }
.fe-handle { position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; border: 2px solid #fff; border-radius: 4px; background: var(--brand); cursor: nwse-resize; z-index: 6; display: none; }
.fp-slot.is-selected { overflow: visible; }
.fp-slot.is-selected .fe-handle { display: block; }
.fp-slot.is-selected .fp-photo { overflow: hidden; }
.inspector, .inspector-body { display: flex; flex-direction: column; gap: 14px; }
.form-grid--quad { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.form-grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.form-grid--two { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 10px; }
.form-grid--text { grid-template-columns: minmax(0, 1.6fr) minmax(0, 0.8fr) auto; gap: 10px; }
.field input[type="range"] { accent-color: var(--brand); min-height: 42px; }
.toggle-row { display: flex; gap: 8px; flex-wrap: wrap; }
.toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: 10px; color: var(--muted); cursor: pointer; }
.toggle input { accent-color: var(--brand); margin: 0; }
.toggle:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--text); }
@media (max-width: 1200px) { .editor { grid-template-columns: 1fr; } .editor-stage { position: static; } .frame-stage--editor { height: 70vh; } }

.fp-item { position: absolute; box-sizing: border-box; }
.fp-item-img { display: block; width: 100%; height: 100%; object-fit: fill; pointer-events: none; user-select: none; }
.fp-missing { outline: 2px dashed var(--danger); }
.fp-qr > svg { display: block; width: 100%; height: 100%; }
.fp-item.is-selected { overflow: visible; }
.fp-item.is-selected .fe-handle, .fp-slot.is-selected .fe-handle { display: block; }
.frame-stage--editor { position: relative; }
.library-panel { position: absolute; top: 16px; right: 16px; width: min(340px, 90%); max-height: calc(100% - 32px); overflow: auto; background: var(--panel-solid); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5); z-index: 20; }
.library { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.library--inline { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.library-item { aspect-ratio: 1; padding: 6px; border: 1px solid var(--border-strong); border-radius: 10px; background: repeating-conic-gradient(#2a3150 0 25%, #222842 0 50%) 50% / 14px 14px; cursor: pointer; }
.library-item:hover { border-color: var(--brand); }
.library-item img { width: 100%; height: 100%; object-fit: contain; }
.library-upload { cursor: pointer; align-self: flex-start; }
.color-row { display: flex; align-items: center; gap: 8px; }
.toggle--sm { min-height: 32px; padding: 0 10px; font-size: 0.8rem; }
[hidden] { display: none !important; }
.color-row input[type="color"] { flex: none; width: 56px; }
.color-row .toggle { flex: 1; min-width: 0; }

/* Caméra en direct d'une borne */
.live-frame { display: grid; place-items: center; min-height: 240px; border-radius: 14px; background: var(--bg-2); overflow: hidden; }
.live-frame img { display: block; max-width: 100%; max-height: 60vh; }
.remote-health { margin-top: 16px; }
