/* ==========================================================================
   Caastream Régie : thème sombre type console de régie.
   Variables globales, composants (cartes, badges, panneau, toasts, modale).
   ========================================================================== */

:root {
  --bg: #0a0d13;
  --bg-soft: #0e1219;
  --panel: #121722;
  --panel-2: #1a2130;
  --border: #242c3d;
  --border-soft: #1c2333;
  --text: #e7ebf4;
  --muted: #8b93a7;
  --accent: #4f7cff;
  --accent-soft: rgba(79, 124, 255, 0.14);
  --ok: #2fbf71;
  --warn: #f5a623;
  --serious: #f97316;
  --bad: #ef4444;
  --live: #ff3b30;
  --violet: #8b5cf6;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  --radius: 10px;
  --radius-sm: 7px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(79, 124, 255, 0.07), transparent 60%),
    radial-gradient(900px 420px at -10% 110%, rgba(139, 92, 246, 0.05), transparent 60%),
    var(--bg);
}

.hidden { display: none !important; }

/* L'attribut hidden doit gagner sur tout display explicite des composants. */
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

code.uid {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  padding: 1px 5px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --------------------------------------------------------------------------
   Boutons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.btn:hover:not(:disabled) { background: #202940; border-color: #32405c; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #416cf0; border-color: #416cf0; }

.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc3535; border-color: #dc3535; }

.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  padding: 0;
  font: inherit;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.icon-btn:hover { color: var(--text); background: var(--panel-2); }

/* Indicateur d'attente sur les boutons de commande */
.spinner {
  width: 13px; height: 13px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   Barre du haut
   -------------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 56px;
  padding: 0 18px;
  background: rgba(14, 18, 26, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}

.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { display: inline-flex; color: var(--accent); }
.topbar-title { font-weight: 700; font-size: 15px; letter-spacing: 0.2px; white-space: nowrap; }

.topbar-apps {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.topbar-apps::-webkit-scrollbar { display: none; }

.app-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}
.app-chip strong { color: var(--text); font-family: var(--mono); }

.topbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }

.ws-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.ws-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.ws-open .ws-dot { background: var(--ok); box-shadow: 0 0 6px rgba(47, 191, 113, 0.7); }
.ws-open { color: var(--ok); }
.ws-connecting .ws-dot, .ws-reconnecting .ws-dot { background: var(--warn); }
.ws-connecting, .ws-reconnecting { color: var(--warn); }
.ws-closed .ws-dot { background: var(--bad); }

.topbar-profile { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar-profile-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }

/* Bandeau de reconnexion */
.reconnect-banner {
  position: sticky;
  top: 56px;
  z-index: 39;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: #ffd9a0;
  background: rgba(245, 166, 35, 0.14);
  border-bottom: 1px solid rgba(245, 166, 35, 0.35);
  padding: 7px 16px;
}

/* --------------------------------------------------------------------------
   Avatars : image ou initiales colorées (teinte stable par nom)
   -------------------------------------------------------------------------- */

.avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 38px; height: 38px;
  border-radius: 50%;
  overflow: hidden;
  background: hsl(var(--avatar-hue, 215), 45%, 26%);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.avatar-sm { width: 28px; height: 28px; }
.avatar-lg { width: 48px; height: 48px; }

.avatar-initials {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: hsl(var(--avatar-hue, 215), 70%, 78%);
  user-select: none;
}
.avatar-sm .avatar-initials { font-size: 10.5px; }
.avatar-lg .avatar-initials { font-size: 16px; }

.avatar img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}

/* --------------------------------------------------------------------------
   Badges, chips, indicateurs
   -------------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}

.role-super { color: #c4a8ff; background: rgba(139, 92, 246, 0.16); border: 1px solid rgba(139, 92, 246, 0.4); }
.role-standard { color: var(--muted); background: var(--panel-2); border: 1px solid var(--border); }

.badge-on { color: var(--ok); background: rgba(47, 191, 113, 0.12); border: 1px solid rgba(47, 191, 113, 0.4); }
.badge-onair { color: #fff; background: var(--live); border: 1px solid var(--live); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 9px;
  white-space: nowrap;
}
.chip-phase { color: var(--accent); border-color: rgba(79, 124, 255, 0.45); background: var(--accent-soft); }

/* État du stream */
.stream-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}
.stream-idle { color: var(--muted); background: var(--panel-2); border: 1px solid var(--border); }
.stream-connecting { color: var(--warn); background: rgba(245, 166, 35, 0.12); border: 1px solid rgba(245, 166, 35, 0.45); }
.stream-publishing { color: #fff; background: rgba(255, 59, 48, 0.18); border: 1px solid var(--live); }
.stream-stopped { color: var(--muted); background: var(--panel-2); border: 1px solid var(--border); }
.stream-error { color: var(--bad); background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.55); }
.stream-unknown { color: var(--muted); background: var(--panel-2); border: 1px solid var(--border); }

.live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 8px rgba(255, 59, 48, 0.9);
  animation: pulse 1.2s ease-in-out infinite;
  flex: none;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.72); opacity: 0.55; }
}

/* Couleurs de qualité / vitaux (le SVG hérite via currentColor) */
.vital {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.q-good { color: var(--ok); }
.q-degraded { color: var(--warn); }
.q-serious { color: var(--serious); }
.q-bad { color: var(--bad); }
.q-unknown { color: var(--muted); }

.qual-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

/* --------------------------------------------------------------------------
   Écran de connexion
   -------------------------------------------------------------------------- */

.login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: min(400px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 30px 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.login-brand { text-align: center; margin-bottom: 14px; }
.login-brand h1 { font-size: 20px; margin: 8px 0 2px; }
.login-brand p { margin: 0; font-size: 13px; }
.logo-lg { color: var(--accent); }

.login-step { display: flex; flex-direction: column; gap: 8px; }

.login-hint {
  margin: 0 0 2px;
  font-size: 13px;
  color: var(--muted);
  background: var(--accent-soft);
  border: 1px solid rgba(79, 124, 255, 0.35);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
}

/* Bouton SSO : lien stylé bouton, navigation pleine page */
.login-sso { display: block; text-align: center; text-decoration: none; }

.login-note { margin: 4px 0 0; font-size: 12.5px; text-align: center; }

.login-error {
  margin: 6px 0 0;
  font-size: 13px;
  color: #ffb4b4;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
}

.login-card .btn-primary { margin-top: 14px; padding: 11px 14px; }

/* --------------------------------------------------------------------------
   Vue régie : grille des appareils
   -------------------------------------------------------------------------- */

.board-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
  align-items: start;
}

body.detail-open .board-view { grid-template-columns: minmax(0, 1fr) minmax(360px, 430px); }

.board-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.board-head h2 {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
}
.count-badge {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(79, 124, 255, 0.4);
  border-radius: 999px;
  padding: 1px 9px;
}

.device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(295px, 1fr));
  gap: 14px;
}

.device-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.1s ease, background 0.15s ease;
}
.device-card:hover { border-color: #35415e; background: #151b28; }
.device-card.is-selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.card-top { display: flex; align-items: center; gap: 10px; }
.card-id { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; align-items: flex-start; }
.card-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.card-top .stream-badge { align-self: flex-start; }

.card-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  min-width: 0;
}
.card-line .muted { font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; flex: none; }
.card-line-value { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.card-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.card-vitals {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}

.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  color: var(--muted);
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 56px 24px;
}
.empty-icon { color: #3a4560; }
.empty-title { margin: 8px 0 0; font-size: 15px; font-weight: 700; color: var(--text); }
.empty-state p { margin: 0; }

/* --------------------------------------------------------------------------
   Panneau de détail
   -------------------------------------------------------------------------- */

.detail-panel {
  position: sticky;
  top: 68px;
  max-height: calc(100vh - 84px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-head { display: flex; align-items: flex-start; gap: 10px; }
.detail-user { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.detail-user-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.detail-name { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.detail-sub { font-size: 12px; }

.offline-banner {
  font-size: 12.5px;
  font-weight: 600;
  color: #ffd9a0;
  background: rgba(245, 166, 35, 0.12);
  border: 1px solid rgba(245, 166, 35, 0.4);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
}

.detail-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.detail-body { display: flex; flex-direction: column; gap: 12px; }

.pane {
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 12px;
}
.pane-title {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--muted);
}

/* Aperçu vidéo 9:16 letterboxé sur fond noir */
.preview {
  position: relative;
  aspect-ratio: 9 / 16;
  height: min(44vh, 430px);
  margin: 0 auto;
  background: #000;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* letterbox : jamais de crop */
  display: block;
}
.preview-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #55607a;
}
.preview-meta { margin: 8px 0 0; text-align: center; font-size: 11.5px; }

/* Section live : lignes d'URL masquées */
.live-title { margin: 0 0 10px; font-weight: 700; font-size: 14px; overflow-wrap: anywhere; }

.url-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid var(--border-soft);
  min-width: 0;
}
.url-row:first-of-type { border-top: 0; }
.url-label {
  flex: none;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--muted);
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.url-value {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.restreams-title { margin: 12px 0 2px; font-size: 11px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--muted); }

.pane .btn-ghost { margin-top: 10px; }

/* Contrôles start/stop */
.stream-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.stream-actions .btn { flex: 1; min-width: 150px; padding: 10px 14px; }

/* Listes sélectionnables : micros, caméras, sources programme */
.select-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }

.select-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.select-item:hover:not(:disabled) { border-color: #35415e; }
.select-item:disabled { cursor: default; }
.select-item:disabled:not(.is-active) { opacity: 0.55; }
.select-item.is-active { border-color: rgba(47, 191, 113, 0.5); background: rgba(47, 191, 113, 0.07); }
.select-item.is-onair { border-color: var(--live); background: rgba(255, 59, 48, 0.08); }

.select-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.select-sub { flex: none; font-size: 11.5px; color: var(--muted); }

/* Métriques */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.metric-label { font-size: 10.5px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--muted); }
.metric-value { font-family: var(--mono); font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.metric-value .unit { font-size: 10.5px; font-weight: 600; color: var(--muted); margin-left: 2px; }

.spark {
  display: block;
  width: 100%;
  height: 64px;
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
}

.intercam { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.intercam-title { font-size: 11px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--muted); margin: 0 0 2px; }
.intercam-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
}
.intercam-row .intercam-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --------------------------------------------------------------------------
   Toasts
   -------------------------------------------------------------------------- */

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--muted);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 10px 12px;
  animation: toast-in 0.18s ease;
}
.toast-success { border-left-color: var(--ok); }
.toast-error { border-left-color: var(--bad); }
.toast-info { border-left-color: var(--accent); }

.toast-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.toast-title { font-size: 13px; }
.toast-message { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.toast-close { flex: none; width: 24px; height: 24px; }
.toast-out { opacity: 0; transform: translateY(6px); transition: opacity 0.18s ease, transform 0.18s ease; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   Modale de confirmation
   -------------------------------------------------------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 10, 0.66);
  backdrop-filter: blur(3px);
  padding: 20px;
}

.modal {
  width: min(430px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 20px;
}
.modal-title { margin: 0 0 8px; font-size: 16px; }
.modal-message { margin: 0 0 6px; color: var(--muted); font-size: 13.5px; }
.modal-detail {
  margin: 10px 0 0;
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  overflow-wrap: anywhere;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* --------------------------------------------------------------------------
   Responsive : le détail devient un volet plein écran sur écrans étroits
   -------------------------------------------------------------------------- */

@media (max-width: 1100px) {
  body.detail-open .board-view { grid-template-columns: minmax(0, 1fr); }
  .detail-panel {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    z-index: 60;
    width: min(480px, 100%);
    max-height: none;
    border-radius: 0;
    border-top: 0; border-right: 0; border-bottom: 0;
    box-shadow: -18px 0 40px rgba(0, 0, 0, 0.55);
  }
}

@media (max-width: 640px) {
  .topbar { padding: 0 12px; gap: 10px; }
  .topbar-apps { display: none; }
  .topbar-profile-name { display: none; }
  .board-view { padding: 12px; }
  .device-grid { grid-template-columns: 1fr; }
}

/* Respect des préférences de mouvement réduit */
@media (prefers-reduced-motion: reduce) {
  .live-dot { animation: none; }
  .toast { animation: none; }
  * { transition: none !important; }
}
