/*
 * ALTA - Application Styles
 * CSS vanilla avec variables, pas de SCSS
 */

/* ===== Variables CSS ===== */
:root {
  /* Layout */
  --alta-header-h: 3rem;

  /* Fond & surfaces */
  --alta-body-bg: #101014;
  --alta-header-bg: #212529;
  --alta-panel-bg: #343a40;
  --alta-light-panel: #fafafa;
  --alta-summary-bg: #f1f3f5;

  /* Texte */
  --alta-text: #dee2e6;
  --alta-text-secondary: #adb5bd;
  --alta-text-muted: #868e96;
  --alta-text-dark: #343a40;
  --alta-text-hover: #fff;

  /* Accent */
  --alta-accent: #6c5ce7;

  /* Types d'éléments */
  --alta-character: #8a40af;
  --alta-props: #3ea3ab;
  --alta-bg: #4878c0;
  --alta-fx: #fa5f50;
  --alta-unknown: #c92a2a;

  /* Types alpha 20% */
  --alta-character-alpha: rgba(138,64,175,0.2);
  --alta-props-alpha: rgba(62,163,171,0.2);
  --alta-bg-alpha: rgba(72,120,192,0.2);
  --alta-fx-alpha: rgba(250,95,80,0.2);

  /* Natures */
  --alta-creation-bg: #800;
  --alta-creation-fg: #fff;
  --alta-declinaison-bg: orange;
  --alta-declinaison-fg: #111;
  --alta-reutilisation-bg: green;
  --alta-reutilisation-fg: #fff;

  /* BG INT/EXT */
  --alta-bg-int: #3bc9db;
  --alta-bg-ext: #38d9a9;

  /* Ambiances */
  --alta-amb-day-bg: #9cf;
  --alta-amb-day-fg: #222;
  --alta-amb-night-bg: #235;
  --alta-amb-night-fg: #aaa;
  --alta-amb-sunrise-bg: #ffc078;
  --alta-amb-sunrise-fg: #555;
  --alta-amb-fog-bg: #334;
  --alta-amb-fog-fg: #aaa;
  --alta-amb-rain-bg: #25a;
  --alta-amb-rain-fg: #aae;
  --alta-amb-snow-bg: #eee;
  --alta-amb-snow-fg: #888;
  --alta-amb-sunset-bg: #5f3f3f;
  --alta-amb-sunset-fg: #ffc;

  /* Nœuds scénario */
  --alta-node-perso: #6741a5;
  --alta-node-descr: #343a40;
  --alta-node-dial: #1862ab;
  --alta-node-real: #fa5252;
  --alta-node-prod: #12b886;
  --alta-node-fx: orange;
  --alta-node-unknown: #c92a2a;

  /* Accents */
  --alta-active: #4dadf7;
  --alta-hover-nav: orange;

  /* Transitions */
  --alta-transition: .15s ease-in-out;

  /* Z-index layers (board 3D) */
  --z-annotation: 3;
  --z-frame:      5;
  --z-hints:      10;
  --z-anno-bar:   12;
  --z-panel:      50;
  --z-menu:       100;
  --z-toast:      200;
}

/* ===== Base ===== */
html {
  font-size: 15px;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: "Segoe UI", Tahoma, "Trebuchet MS", "Droid Sans", Arial, sans-serif;
  font-feature-settings: "liga" 1, "kern" 1;
  -webkit-font-smoothing: antialiased;
  background: var(--alta-body-bg);
  color: var(--alta-text);
  user-select: none;
  margin: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

code, pre, .font-mono {
  font-family: Consolas, "Droid Sans Mono", "Bitstream Vera Sans Mono", "Courier New", mono;
}

::placeholder { color: var(--alta-text-muted) !important; opacity: 0.6 !important; }

a { color: var(--alta-active); text-decoration: none; transition: color var(--alta-transition); }
a:hover { color: var(--alta-text-hover); }

/* Permettre la sélection dans les zones de contenu */
.scenario-contents,
.tiptap-editor,
.user-select-text,
input, textarea, select,
[contenteditable] {
  user-select: text;
}

.icon-empty-state { width: 3rem; height: 3rem; }

/* ===== Header / Navigation ===== */
.alta-header {
  background: var(--alta-header-bg);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  height: var(--alta-header-h);
  flex-shrink: 0;
  border-bottom: 1px solid rgba(180,180,180,0.1);
}

.alta-header .alta-logo {
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--alta-text);
  margin-right: 2rem;
}
.alta-header .alta-logo:hover { color: var(--alta-text-hover); }

.alta-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--alta-text-secondary);
  font-size: 1.1rem;
  flex: 1;
}

.alta-breadcrumb a { color: var(--alta-text-secondary); }
.alta-breadcrumb a:hover { color: var(--alta-text-hover); }
.alta-breadcrumb .sep { color: var(--alta-text-muted); font-size: 0.9em; }

.alta-nav-tabs {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0;
  margin-left: auto;
}

.alta-nav-tab {
  padding: 0.6rem 1rem;
  color: var(--alta-text-secondary);
  font-size: 1.1rem;
  white-space: nowrap;
  transition: all var(--alta-transition);
  border-bottom: 2px solid transparent;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  cursor: pointer;
}
.alta-nav-tab .bi { display: inline-block; margin-right: 0.5em; font-size: 0.85em; }

.alta-nav-tab:hover { color: var(--alta-hover-nav); }
.alta-nav-tab.active {
  background: var(--alta-panel-bg);
  color: var(--alta-text-hover);
  border-bottom-color: var(--alta-active);
}

/* ===== Main content ===== */
.alta-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.alta-content {
  flex: 1;
  overflow: auto;
  padding: 1rem;
}

/* ===== Flash messages ===== */
.alta-flash {
  margin: 0.5rem 1rem;
}

/* ===== Badges type d'élément ===== */
.badge-character { background: var(--alta-character); color: #fff; }
.badge-props { background: var(--alta-props); color: #fff; }
.badge-bg-type { background: var(--alta-bg); color: #fff; }
.badge-fx { background: var(--alta-fx); color: #fff; }
.badge-unknown { background: var(--alta-unknown); color: #fff; }

/* ===== Badges nature C/D/R ===== */
.nature-badge {
  display: inline-block;
  width: 0.9em;
  height: 1em;
  border-radius: 2px;
  text-align: center;
  line-height: 1em;
  font-size: 75%;
  font-weight: 700;
  vertical-align: middle;
}

.nature-badge-creation {
  background: var(--alta-creation-bg);
  color: var(--alta-creation-fg);
}

.nature-badge-variant {
  background: var(--alta-declinaison-bg);
  color: var(--alta-declinaison-fg);
}

.nature-badge-reuse {
  background: var(--alta-reutilisation-bg);
  color: var(--alta-reutilisation-fg);
}

/* ===== Badges INT/EXT ===== */
.badge-bg-int {
  display: inline-block;
  background: var(--alta-bg-int);
  color: #111;
  border-radius: 2px;
  padding: .1em .25em;
  text-transform: uppercase;
  font-size: 80%;
  font-weight: 700;
}

.badge-bg-ext {
  display: inline-block;
  background: var(--alta-bg-ext);
  color: #111;
  border-radius: 2px;
  padding: .1em .25em;
  text-transform: uppercase;
  font-size: 80%;
  font-weight: 700;
}

/* ===== Badges ambiance ===== */
.badge-amb {
  display: inline-block;
  border-radius: 2px;
  padding: .1em .4em;
  font-size: 85%;
  font-weight: 600;
}

.badge-amb-day { background: var(--alta-amb-day-bg); color: var(--alta-amb-day-fg); }
.badge-amb-night { background: var(--alta-amb-night-bg); color: var(--alta-amb-night-fg); }
.badge-amb-sunrise { background: var(--alta-amb-sunrise-bg); color: var(--alta-amb-sunrise-fg); }
.badge-amb-fog { background: var(--alta-amb-fog-bg); color: var(--alta-amb-fog-fg); }
.badge-amb-rain { background: var(--alta-amb-rain-bg); color: var(--alta-amb-rain-fg); }
.badge-amb-snow { background: var(--alta-amb-snow-bg); color: var(--alta-amb-snow-fg); }
.badge-amb-sunset { background: var(--alta-amb-sunset-bg); color: var(--alta-amb-sunset-fg); }

/* ===== Onboarding Checklist ===== */
.onboarding-checklist {
  margin: 1rem;
  padding: 1rem 1.25rem;
  background: var(--alta-surface);
  border: 1px solid var(--alta-border);
  border-radius: 8px;
}
.onboarding-checklist-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.onboarding-checklist-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--alta-text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
}
.onboarding-checklist-progress {
  margin-top: 0.5rem;
  height: 4px;
  background: var(--alta-border);
  border-radius: 2px;
}
.onboarding-checklist-bar {
  height: 100%;
  background: var(--alta-accent);
  border-radius: 2px;
  transition: width 0.3s;
}
.onboarding-checklist-steps {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.onboarding-checklist-steps li {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.9rem;
}
.onboarding-checklist-steps li.done {
  color: var(--alta-text-secondary);
  text-decoration: line-through;
}
.onboarding-checklist-steps li .bi-check-circle-fill {
  color: var(--bs-success, #198754);
}
.onboarding-checklist-steps li small {
  margin-left: 0.25rem;
}

/* ===== Home : Productions / Épisodes ===== */
.home-layout {
  display: flex;
  gap: 0;
  height: 100%;
}

.home-productions {
  width: 280px;
  flex-shrink: 0;
  border-right: 1px solid var(--alta-header-bg);
  overflow-y: auto;
  padding: 0.5rem 0;
}

.home-prod-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 1.2rem;
  color: var(--alta-text);
  transition: all var(--alta-transition);
  cursor: pointer;
}

.home-prod-item:hover { color: #9cf; }
.home-prod-item.active { background: #444e5a; color: var(--alta-text-hover); }

.home-prod-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.home-episodes {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.home-episodes table {
  width: 100%;
  border-collapse: collapse;
}

.home-episodes th {
  border-bottom: 2px solid var(--alta-header-bg);
  padding: 0.5rem;
  text-align: left;
  color: var(--alta-text-secondary);
  font-weight: 600;
}

.home-episodes td {
  padding: 0.5rem;
  border-bottom: 1px solid var(--alta-header-bg);
  transition: background var(--alta-transition);
}

.home-episodes tr:hover td { background: var(--alta-header-bg); }

/* ===== Scénario : Layout 3 colonnes (CSS Grid) ===== */
.scenario-layout {
  display: grid;
  grid-template-columns: 284px 1fr 300px;
  height: calc(100vh - 3rem);
  overflow: hidden;
  position: relative;
}

/* Colonne gauche : Episode Summary */
.scenario-sidebar {
  background: var(--alta-summary-bg);
  color: var(--alta-text-dark);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.scenario-sidebar-header {
  background: var(--alta-panel-bg);
  color: var(--alta-text);
  padding: 0.6rem 0.8rem;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.scenario-sidebar-counters {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 0.8rem;
  flex-wrap: wrap;
  border-bottom: 1px solid #ced4da;
  flex-shrink: 0;
}

.scenario-sidebar-counter {
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.scenario-sidebar-counter .count {
  font-weight: 700;
}

.scenario-seq-list {
  flex: 1;
  overflow-y: auto;
}

.scenario-seq-item {
  display: block;
  padding: 0.3rem 0.8rem;
  color: var(--alta-text-dark);
  font-size: 0.85rem;
  transition: all var(--alta-transition);
  border-bottom: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scenario-seq-item:nth-child(odd) { background: #e9ecef; }
.scenario-seq-item:nth-child(even) { background: #ced4da; }
.scenario-seq-item:hover { background: #adb5bd; color: #000; }
.scenario-seq-item.active {
  background: var(--alta-panel-bg);
  color: var(--alta-active);
  font-weight: 600;
}

.scenario-seq-item--ghost {
  opacity: 0.4;
  background: var(--alta-active) !important;
}

.scenario-seq-list form:has(.scenario-seq-add-btn) { display: contents; }

.scenario-seq-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  width: 100%;
  padding: 0.5rem 0.8rem;
  border: none;
  background: transparent;
  color: var(--alta-text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--alta-transition);
}
.scenario-seq-add-btn:hover {
  background: var(--alta-active);
  color: #fff;
}

.scenario-seq-num {
  font-weight: 700;
  margin-right: 0.3rem;
  color: var(--alta-text-muted);
}

/* Actions contextuelles dans le header */
.alta-header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
  margin-right: 1rem;
}
.alta-header-actions form,
.alta-header-actions .dropdown-menu form {
  display: contents;
}

/* Colonne centre : wrapper éditeur + toolbar */
.scenario-editor-column {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.scenario-toolbar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.6rem;
  background: var(--alta-summary-bg);
  border-bottom: 1px solid #ced4da;
  flex-shrink: 0;
}
.scenario-toolbar form { display: contents; }
.scenario-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
}
.scenario-toolbar-right form { display: contents; }
.scenario-toolbar .alta-btn-outline {
  color: var(--alta-text-dark);
  border-color: #adb5bd;
}
.scenario-toolbar .alta-btn-outline:hover {
  color: #000;
  border-color: #495057;
}

.scenario-editor {
  background: var(--alta-light-panel);
  color: var(--alta-text-dark);
  overflow-y: auto;
  padding: 1rem;
  flex: 1;
  min-height: 0;
}

/* Override boutons outline dans les zones à fond clair */
.seq-card-header .alta-btn-outline,
.tiptap-toolbar .alta-btn-outline {
  color: var(--alta-text-dark);
  border-color: #adb5bd;
}
.seq-card-header .alta-btn-outline:hover,
.tiptap-toolbar .alta-btn-outline:hover {
  color: #000;
  border-color: #495057;
}

/* Colonne droite : Sequence details */
.scenario-details {
  background: var(--alta-body-bg);
  color: var(--alta-text);
  overflow-y: auto;
  border-left: 1px solid rgba(255,255,255,0.06);
}

.scenario-details-header {
  background: var(--alta-panel-bg);
  padding: 0.6rem 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* BG zone dans les détails */
.scenario-bg-zone {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* Inventaire par type */
.scenario-inv-section {
  padding: 0.4rem 0.8rem;
}

.scenario-inv-type-header {
  font-weight: 700;
  font-size: 1rem;
  padding: 0.3rem 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: color var(--alta-transition);
}

.scenario-inv-type-header:hover { color: var(--alta-text-hover); }

.scenario-inv-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0;
  font-size: 1rem;
  transition: all var(--alta-transition);
}

.scenario-inv-item:hover .scenario-inv-actions { opacity: 1; }

.scenario-inv-actions {
  opacity: 0;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.2rem;
  transition: opacity var(--alta-transition);
}

.scenario-inv-actions form {
  display: contents;
}

/* Indentation par depth */
.depth-0 { margin-left: 0; }
.depth-1 { margin-left: calc(1 * (1.2em + 4px)); }
.depth-2 { margin-left: calc(2 * (1.2em + 4px)); }
.depth-3 { margin-left: calc(3 * (1.2em + 4px)); }

/* ===== Nœuds scénario (contenu séquences) ===== */
.scenario-contents {
  user-select: text;
}

.scenario-contents .scenario-node {
  display: flex;
  align-items: start;
  gap: 0.4rem;
  line-height: 1.6;
  position: relative;
}
.scenario-contents .scenario-node .node-text {
  flex: 1;
  min-height: 1.6em;
  cursor: text;
}

.node-actions {
  position: absolute;
  right: 0;
  top: -0.4rem;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 0;
  opacity: 0;
  pointer-events: none;
  background: rgba(var(--bs-body-bg-rgb, 248, 249, 250), 0.95);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
}
.scenario-node:hover .node-actions { opacity: 1; pointer-events: auto; }

.node-action-btn {
  border: none;
  background: transparent;
  color: #adb5bd;
  cursor: pointer;
  padding: 0.1rem 0.2rem;
  font-size: 0.8rem;
  border-radius: 3px;
  line-height: 1;
}
.node-action-btn:hover { color: var(--alta-active); background: rgba(0,0,0,0.05); }
.node-action-btn--danger:hover { color: #dc3545; background: rgba(220,53,69,0.08); }

.scenario-contents .node-icon {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  margin-top: 0.35em;
  opacity: 0.6;
}

.scenario-contents .node-type-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.5em;
  height: 1.5em;
  margin-top: 0.15em;
  border-radius: 3px;
  cursor: pointer;
  opacity: 0.7;
  transition: all var(--alta-transition);
}

.scenario-contents .node-type-btn:hover {
  opacity: 1;
  background: rgba(0,0,0,0.12);
}

.scenario-contents .node-perso {
  color: var(--alta-node-perso);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 1em;
  margin-top: 0.8rem;
}

.scenario-contents .node-dial {
  color: var(--alta-node-dial);
  padding-left: 2.5rem;
  font-style: italic;
}

.scenario-contents .dial-index {
  font-style: normal;
  font-size: 0.75em;
  opacity: 0.5;
  margin-right: 0.3rem;
}

.scenario-contents .node-descr {
  color: var(--alta-node-descr);
  font-size: 1em;
}

.scenario-contents .node-note {
  font-size: 0.95em;
  border-left: 3px solid;
  padding-left: 0.6rem;
  margin: 0.3rem 0;
}

.scenario-contents .node-prod {
  border-color: var(--alta-node-prod);
  color: var(--alta-node-prod);
}

.scenario-contents .node-real {
  border-color: var(--alta-node-real);
  color: var(--alta-node-real);
}

.scenario-contents .node-fx {
  border-color: var(--alta-node-fx);
  color: var(--alta-node-fx);
}

.scenario-contents .node-label {
  font-weight: 700;
  font-size: 0.9em;
  letter-spacing: 0.05em;
}

/* Node image */
.scenario-contents .node-image {
  flex-wrap: wrap;
}
.node-image .node-type-icon {
  opacity: 0.5;
  margin-right: 0.25rem;
}
.node-image .node-image-body {
  flex: 1;
  min-width: 0;
}
.node-image .node-image-thumb {
  max-width: 100%;
  max-height: 200px;
  border-radius: 4px;
  cursor: pointer;
  object-fit: contain;
  display: block;
  transition: opacity 0.15s;
}
.node-image .node-image-thumb:hover {
  opacity: 0.85;
}
.node-image .node-image-upload {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 2px dashed rgba(255,255,255,0.12);
  border-radius: 6px;
  cursor: pointer;
  color: var(--alta-text-muted);
  font-size: 0.9em;
  flex: 1;
}
.node-image .node-image-upload:hover {
  border-color: var(--alta-accent);
  color: var(--alta-accent);
}

/* Modale annotation image */
.image-annotate-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 0;
  background: #111;
}
.image-annotate-img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  display: block;
}
.image-annotate-overlay {
  position: absolute;
  pointer-events: none;
}

/* Linked assets dans le contenu */
.scenario-contents .linked-asset,
.tiptap-editor .linked-asset {
  background: var(--alta-character-alpha);
  color: var(--alta-text-dark);
  border-radius: 2px;
  padding: 0 0.2em;
  cursor: pointer;
}

.scenario-contents .linked-asset:hover,
.tiptap-editor .linked-asset:hover {
  background: var(--alta-character);
  color: #fff;
}

.scenario-contents .linked-asset[data-type-element-id="1"],
.tiptap-editor .linked-asset[data-type-element-id="1"] { background: var(--alta-character-alpha); }
.scenario-contents .linked-asset[data-type-element-id="5"],
.tiptap-editor .linked-asset[data-type-element-id="5"] { background: var(--alta-bg-alpha); }
.scenario-contents .linked-asset[data-type-element-id="8"],
.tiptap-editor .linked-asset[data-type-element-id="8"] { background: var(--alta-props-alpha); }
.scenario-contents .linked-asset[data-type-element-id="9"],
.tiptap-editor .linked-asset[data-type-element-id="9"] { background: var(--alta-fx-alpha); }

.linked-asset[data-unconfirmed="true"] {
  background: rgba(255,193,7,0.3);
  border-bottom: 2px dashed orange;
}

.scenario-contents .linked-asset[data-type-element-id="1"]:hover,
.tiptap-editor .linked-asset[data-type-element-id="1"]:hover { background: var(--alta-character); color: #fff; }
.scenario-contents .linked-asset[data-type-element-id="5"]:hover,
.tiptap-editor .linked-asset[data-type-element-id="5"]:hover { background: var(--alta-bg); color: #fff; }
.scenario-contents .linked-asset[data-type-element-id="8"]:hover,
.tiptap-editor .linked-asset[data-type-element-id="8"]:hover { background: var(--alta-props); color: #fff; }
.scenario-contents .linked-asset[data-type-element-id="9"]:hover,
.tiptap-editor .linked-asset[data-type-element-id="9"]:hover { background: var(--alta-fx); color: #fff; }

.linked-asset.locate-highlight {
  outline: 2px solid #ffc107;
  outline-offset: 1px;
  animation: locate-pulse 1.5s ease-in-out 3;
}

@keyframes locate-pulse {
  0%, 100% { outline-color: #ffc107; }
  50% { outline-color: transparent; }
}

/* ===== Sequence card dans l'éditeur ===== */
.seq-card {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.seq-card-header {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.8rem;
  background: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
  border-radius: 4px 4px 0 0;
}

.seq-card-header .seq-num {
  display: inline-block;
  background: var(--alta-bg);
  color: #fff;
  border-radius: 2px;
  padding: 0 0.4em;
  font-weight: 700;
  font-size: 0.95rem;
  margin-right: 0.4rem;
}

.seq-card-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.seq-card-header-actions form { display: contents; }

.seq-delete-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  border: none;
  background: var(--alta-danger, #dc3545);
  color: #fff;
  cursor: pointer;
  padding: 0.15rem 0.4rem;
  font-size: 0.8rem;
  border-radius: 3px;
  transition: all var(--alta-transition);
}
.seq-delete-btn:hover {
  background: #bb2d3b;
  color: #fff;
}
.seq-card-header:hover .seq-delete-btn {
  opacity: 1;
  pointer-events: auto;
}

.seq-card--active {
  border-color: var(--alta-active);
  box-shadow: 0 0 0 2px var(--alta-active);
}

/* ─── Confirmation suppression nœud (double-Backspace) ─── */
.node-pending-delete {
  animation: node-flash-delete 0.4s ease-in-out 2;
  background: rgba(220, 53, 69, 0.08);
  border-radius: 4px;
}
@keyframes node-flash-delete {
  0%, 100% { background: rgba(220, 53, 69, 0.08); }
  50% { background: rgba(220, 53, 69, 0.25); }
}

/* ─── Indicateur draft (non sauvegardé) ─── */
.draft-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  font-size: 0.8rem;
  color: #ffc107;
  background: rgba(255, 193, 7, 0.1);
  border-radius: 4px;
}
.draft-badge .bi-circle-fill {
  font-size: 0.5rem;
}

/* ─── Diff de versions ─── */
.diff-entry {
  border: 1px solid var(--alta-text);
  border-radius: 6px;
  overflow: hidden;
}
.diff-entry-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.8rem;
  background: var(--alta-summary-bg);
  border-bottom: 1px solid var(--alta-text);
}
.diff-entry-body {
  padding: 0.8rem;
}
.diff-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.1rem 0.5rem;
  border-radius: 3px;
  font-size: 0.8rem;
  font-weight: 600;
}
.diff-badge--added { background: #d3f9d8; color: #2b8a3e; }
.diff-badge--removed { background: #ffc9c9; color: #c92a2a; }
.diff-badge--changed { background: #fff3bf; color: #e67700; }
.diff-field {
  margin-bottom: 0.3rem;
}
.diff-field-label {
  font-weight: 600;
  margin-right: 0.3rem;
}
.diff-contents del,
.diff-contents .del {
  background: #ffc9c9;
  text-decoration: line-through;
  color: #c92a2a;
}
.diff-contents ins,
.diff-contents .ins {
  background: #d3f9d8;
  text-decoration: none;
  color: #2b8a3e;
}

.seq-card-body {
  padding: 0.8rem;
}

/* ===== Grille Assets × Séquences ===== */
.alta-grid-container {
  overflow: auto;
  max-height: calc(100vh - 6rem);
}

.alta-grid {
  display: grid;
  border-collapse: collapse;
}

.alta-grid-corner {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 3;
  background: var(--alta-body-bg);
}

/* Labels colonnes à -60° */
.alta-grid-col-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--alta-body-bg);
  height: 12em;
  padding: 0;
  overflow: hidden;
}

.alta-grid-col-label {
  transform: rotate(-60deg);
  transform-origin: bottom left;
  white-space: nowrap;
  position: absolute;
  bottom: 0.5em;
  left: 0.5em;
  font-size: 0.9rem;
  color: var(--alta-text-secondary);
}

/* Sidebar éléments dans la grille */
.alta-grid-row-header {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--alta-body-bg);
  padding: 0 0.5rem;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  border-bottom: 1px solid #333;
}

.alta-grid-row-header:nth-child(odd) {
  background: #1a1a20;
}

/* Cellules */
.alta-grid-cell {
  width: 2em;
  height: 2em;
  border: 1px solid #333;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.alta-grid-cell:nth-child(odd) {
  background: rgba(255,255,255,0.02);
}

.alta-grid-cell-active {
  cursor: pointer;
}

.alta-grid-cell-active.type-character { background: var(--alta-character-alpha); }
.alta-grid-cell-active.type-bg { background: var(--alta-bg-alpha); }
.alta-grid-cell-active.type-props { background: var(--alta-props-alpha); }
.alta-grid-cell-active.type-fx { background: var(--alta-fx-alpha); }

/* Grille assets × séquences (transposée : lignes = éléments, colonnes = séquences) */
.grid-table {
  font-size: 0.9rem;
}

.grid-table thead th {
  background: var(--alta-body-bg);
  border-color: #333;
}

.grid-table td, .grid-table th {
  border-color: #333;
  vertical-align: top;
}

/* Colonne nom d'élément sticky à gauche */
.grid-name-header {
  min-width: 180px;
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--alta-body-bg);
}

.grid-count-header {
  min-width: 40px;
  text-align: center;
}

.grid-element-cell {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--alta-body-bg);
  white-space: nowrap;
  font-size: 0.9rem;
  cursor: pointer;
}

.grid-element-cell:hover .grid-element-label {
  text-decoration: underline;
}

.grid-table tbody tr:not(.grid-type-separator):not(.grid-family-separator):hover td {
  background: rgba(255,255,255,0.06);
}
.grid-table tbody tr:not(.grid-type-separator):not(.grid-family-separator):hover .grid-element-cell {
  background: rgba(255,255,255,0.06);
}

.grid-count-cell {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--alta-text-secondary);
}

/* Headers de séquence en colonnes (écriture verticale) */
.grid-seq-col-header {
  min-width: 2em;
  height: 3em;
  font-weight: 500;
  font-size: 0.85rem;
}

.grid-seq-col-label {
  white-space: nowrap;
}

.grid-seq-duration {
  font-size: 0.7rem;
  color: var(--alta-text-muted);
  font-weight: 400;
}

.grid-char-duration {
  font-size: 0.75rem;
  color: var(--alta-text-muted);
  margin-left: 0.3rem;
}

.grid-cell-duration {
  font-size: 0.65rem;
  color: var(--alta-text-muted);
}

/* Séparateurs entre groupes de types */
.grid-type-separator td {
  padding: 0.4rem 0.5rem !important;
  border-bottom: 2px solid #555;
  border-top: 4px solid transparent;
}

.grid-family-separator td {
  padding: 0.2rem 0.5rem 0.2rem 1.5rem !important;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  border-top: 2px solid rgba(255,255,255,0.04);
  background: rgba(255,255,255,0.025);
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.7;
}

.grid-cell {
  padding: 2px !important;
}

.grid-cell-active {
  background: rgba(255,255,255,0.05);
}

/* Type colors dans la grille */
.grid-dot-character { color: var(--alta-character); }
.grid-dot-bg { color: var(--alta-bg); }
.grid-dot-props { color: var(--alta-props); }
.grid-dot-fx { color: var(--alta-fx); }

/* Zebra dans la grille */
.grid-table tbody tr:nth-child(odd):not(.grid-type-separator) td {
  background: rgba(255,255,255,0.02);
}
.grid-table tbody tr:nth-child(odd):not(.grid-type-separator) .grid-element-cell {
  background: #1a1a20;
}

/* ===== Popup grille plein écran ===== */
.grid-popup {
  background: var(--alta-light-panel);
  color: var(--alta-text-dark);
}

.grid-popup-header {
  background: #333;
  color: #fff;
  padding: 0.5rem 1rem;
}

/* ===== Éléments : table ===== */
.elements-table {
  width: 100%;
  border-collapse: collapse;
}

.elements-table th {
  border-bottom: 2px solid var(--alta-header-bg);
  padding: 0.5rem;
  color: var(--alta-text-secondary);
  font-weight: 600;
}

.elements-table td {
  padding: 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  transition: background var(--alta-transition);
}

.elements-table tr:hover td {
  background: rgba(255,255,255,0.04);
}

/* ===== Nav tabs type filtres éléments ===== */
.alta-type-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--alta-panel-bg);
  margin-bottom: 1rem;
}

.alta-type-tab {
  padding: 0.5rem 1rem;
  color: var(--alta-text-secondary);
  transition: all var(--alta-transition);
  border-bottom: 2px solid transparent;
  font-size: 1.05rem;
}

.alta-type-tab:hover { color: var(--alta-hover-nav); }
.alta-type-tab.active {
  color: var(--alta-text-hover);
  border-bottom-color: var(--alta-active);
}

.alta-type-tab .tab-count {
  font-size: 0.85em;
  color: var(--alta-text-muted);
  margin-left: 0.3rem;
}

/* ===== Cards legacy-style ===== */
.alta-card {
  background: var(--alta-panel-bg);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 4px;
  margin-bottom: 1rem;
}

.alta-card-header {
  padding: 0.5rem 0.8rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.alta-card-body {
  padding: 0.8rem;
}

.alta-card-list-item {
  padding: 0.4rem 0.8rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background var(--alta-transition);
}

.alta-card-list-item:hover { background: rgba(255,255,255,0.04); }
.alta-card-list-item:last-child { border-bottom: none; }

/* ===== Boutons ===== */
.alta-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.7rem;
  border-radius: 3px;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--alta-transition);
  border: 1px solid transparent;
}

.alta-btn-primary {
  background: var(--alta-active);
  color: #111;
  border-color: var(--alta-active);
}
.alta-btn-primary:hover { background: #6dc1f9; color: #000; }

.alta-btn-outline {
  background: transparent;
  color: var(--alta-text-secondary);
  border-color: var(--alta-text-muted);
}
.alta-btn-outline:hover { color: var(--alta-text-hover); border-color: var(--alta-text); }

/* ===== Tiptap editor ===== */
.tiptap-editor {
  border: 1px solid #dee2e6;
  border-radius: 4px;
  min-height: 200px;
  padding: 0.75rem;
  background: #fff;
  color: var(--alta-text-dark);
}

.tiptap-editor:focus-within {
  border-color: var(--alta-active);
  box-shadow: 0 0 0 0.2rem rgba(77,173,247,0.25);
}

.tiptap-editor .ProseMirror {
  outline: none;
  min-height: 150px;
}

.tiptap-editor .ProseMirror p {
  margin-bottom: 0.3rem;
}

.tiptap-toolbar {
  border-bottom: 1px solid #dee2e6;
  padding: 0.25rem 0.5rem;
  margin: -0.75rem -0.75rem 0.5rem;
  background: #f8f9fa;
  border-radius: 4px 4px 0 0;
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.tiptap-toolbar button {
  padding: 0.2rem 0.4rem;
  border: none;
  background: transparent;
  color: var(--alta-text-dark);
  border-radius: 3px;
  font-size: 0.9rem;
  cursor: pointer;
}

.tiptap-toolbar button:hover {
  background: #e9ecef;
}

.tiptap-toolbar button.is-active {
  background: var(--alta-active);
  color: white;
}

/* ===== Block editor (per-bloc inline Tiptap) ===== */
.block-editor {
  flex: 1;
  min-width: 0;
}
.block-editor .ProseMirror {
  outline: none;
  padding: 0;
  line-height: inherit;
  font: inherit;
  color: inherit;
  font-style: inherit;
}
.block-editor .ProseMirror:focus {
  outline: 1px solid var(--alta-active);
  outline-offset: 2px;
  border-radius: 2px;
}
.block-editor .ProseMirror p {
  margin: 0;
  line-height: inherit;
}

/* ===== Analyse IA badges ===== */
.analyze-badge-character { background: var(--alta-character); color: #fff; }
.analyze-badge-props { background: var(--alta-props); color: #fff; }
.analyze-badge-bg { background: var(--alta-bg); color: #fff; }
.analyze-badge-fx { background: var(--alta-fx); color: #fff; }

/* ===== Utilitaires ===== */
.text-character { color: var(--alta-character); }
.text-props { color: var(--alta-props); }
.text-bg-elem { color: var(--alta-bg); }
.text-fx { color: var(--alta-fx); }
.text-unknown { color: var(--alta-unknown); }

.text-muted { color: var(--alta-text-muted) !important; }
.text-secondary { color: var(--alta-text-secondary) !important; }

/* Override Bootstrap dark theme to match altapalette */
[data-bs-theme="dark"] {
  --bs-body-bg: var(--alta-body-bg);
  --bs-body-color: var(--alta-text);
  --bs-secondary-bg: var(--alta-panel-bg);
  --bs-tertiary-bg: var(--alta-header-bg);
  --bs-border-color: rgba(255,255,255,0.06);
}

/* ===== Search input ===== */
.alta-search {
  background: var(--alta-header-bg);
  border: 1px solid var(--alta-panel-bg);
  color: var(--alta-text);
  padding: 0.3rem 0.6rem;
  border-radius: 3px;
  font-size: 1rem;
}

.alta-search::placeholder { color: var(--alta-text-muted); }
.alta-search:focus {
  outline: none;
  border-color: var(--alta-active);
}

/* ===== Annotation widget (sélection → lier) ===== */
.annotation-widget {
  position: fixed;
  z-index: 1050;
  background: var(--alta-panel-bg);
  color: var(--alta-text);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  min-width: 280px;
  max-width: 400px;
}

.annotation-result:hover {
  background: rgba(255,255,255,0.08);
}

/* ===== Empty state ===== */
.alta-empty {
  text-align: center;
  color: var(--alta-text-muted);
  padding: 3rem 1rem;
}

.alta-empty .icon-empty-state {
  opacity: 0.5;
}

/* ===== Element tree ===== */
.element-tree {
  list-style: none;
  padding: 0;
  margin: 0;
}

.element-tree ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tree-node-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background var(--alta-transition);
}

.tree-node-row:hover {
  background: rgba(255,255,255,0.04);
}

/* Bordure gauche colorée par type */
.tree-node-row.tree-type-character { border-left: 3px solid var(--alta-character); }
.tree-node-row.tree-type-bg { border-left: 3px solid var(--alta-bg); }
.tree-node-row.tree-type-props { border-left: 3px solid var(--alta-props); }
.tree-node-row.tree-type-fx { border-left: 3px solid var(--alta-fx); }
.tree-node-row.tree-type-unknown { border-left: 3px solid var(--alta-unknown); }

.tree-toggle {
  background: none;
  border: none;
  color: var(--alta-text-secondary);
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  width: 1.2em;
  flex-shrink: 0;
  transition: color var(--alta-transition);
}

.tree-toggle:hover { color: var(--alta-text-hover); }

.tree-toggle-icon {
  transition: transform var(--alta-transition);
}

.tree-toggle-spacer {
  display: inline-block;
  width: 1.2em;
  flex-shrink: 0;
}

.tree-children {
  /* visible by default, toggled via JS */
}

/* ===== D3 Graph tree ===== */
.d3-tree-layout {
  display: flex;
  height: calc(100vh - 3rem);
  overflow: hidden;
}

.d3-tree-sidebar {
  width: 200px;
  flex-shrink: 0;
  background: var(--alta-header-bg);
  border-right: 1px solid rgba(255,255,255,0.06);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.d3-tree-sidebar-header {
  padding: 0.5rem 0.8rem;
  font-weight: 700;
  font-size: 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.d3-tree-sidebar-item {
  padding: 0.35rem 0.8rem;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all var(--alta-transition);
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.d3-tree-sidebar-item:hover {
  background: rgba(255,255,255,0.06);
  color: var(--alta-text-hover);
}

.d3-tree-sidebar-item.active {
  background: var(--alta-panel-bg);
  color: var(--alta-active);
  font-weight: 600;
}

.d3-tree-svg {
  flex: 1;
  background: var(--alta-body-bg);
  cursor: default;
}

/* Nodes */
.d3-tree-svg .node { cursor: pointer; }
.d3-tree-svg .node .nodeCircle { stroke-width: 2px; }
.d3-tree-svg .node text { font: 11px "Segoe UI", sans-serif; fill: #999; }
.d3-tree-svg .node:hover text { fill: #4dadf7; }

/* Links */
.d3-tree-svg .link {
  fill: none;
  stroke: #555;
  stroke-opacity: 0.4;
  stroke-width: 1px;
}

/* Temp link for DnD */
.d3-tree-svg .templink {
  fill: none;
  stroke: red;
  stroke-width: 3px;
}

/* Ghost circles */
.d3-tree-svg .ghostCircle {
  fill: red;
}

/* Hint bottom-right */
.d3-tree-hint {
  position: absolute;
  bottom: 0.5rem;
  right: 1rem;
  font-size: 0.8rem;
  color: var(--alta-text-muted);
  pointer-events: none;
}

.d3-tree-hint kbd {
  background: var(--alta-panel-bg);
  border: 1px solid var(--alta-text-muted);
  border-radius: 3px;
  padding: 0 0.3em;
  font-size: 0.9em;
}

/* Context menu */
.d3-tree-context-menu {
  position: fixed;
  z-index: 1100;
  background: var(--alta-panel-bg);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  min-width: 200px;
}

.d3-tree-context-menu-header {
  padding: 0.4rem 0.8rem;
  font-weight: 700;
  font-size: 0.95rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  color: var(--alta-text-hover);
}

.d3-tree-context-menu-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.8rem;
  color: var(--alta-text);
  cursor: pointer;
  transition: background var(--alta-transition);
  font-size: 0.9rem;
}

.d3-tree-context-menu-item:hover {
  background: rgba(255,255,255,0.08);
  color: var(--alta-text-hover);
}

.d3-tree-context-menu-item-danger:hover {
  background: #b00;
  color: #fff;
}

/* ===== Element tooltip ===== */
.element-tooltip {
  position: fixed;
  z-index: 1060;
  background: var(--alta-panel-bg);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  padding: 0.5rem 0.7rem;
  max-width: 320px;
  pointer-events: none;
  font-size: 0.85rem;
}

/* ===== Split Panel Gutters ===== */
.split-gutter {
  position: absolute;
  top: 0;
  width: 6px;
  cursor: col-resize;
  z-index: var(--z-anno-bar);
  background: transparent;
  transition: background 0.15s;
}
.split-gutter:hover,
.split-gutter.active {
  background: var(--alta-active);
}
.split-gutter::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 30px;
  background: rgba(255,255,255,0.15);
  border-radius: 1px;
  transition: background 0.15s;
}
.split-gutter:hover::after,
.split-gutter.active::after {
  background: rgba(255,255,255,0.5);
}
.split-gutter.collapsed::after {
  width: 0;
  height: 0;
  border: 5px solid transparent;
  border-left-color: rgba(255,255,255,0.3);
  background: none;
  border-radius: 0;
}
.split-gutter.collapsed-left::after {
  border-left-color: transparent;
  border-right-color: rgba(255,255,255,0.3);
}
body.split-dragging {
  cursor: col-resize !important;
  user-select: none !important;
}
body.split-dragging * {
  cursor: col-resize !important;
}

/* ===== Board 3D ===== */
.board-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0;
  height: calc(100vh - var(--alta-header-h));
  position: relative;
}
.board-main { grid-column: 1; grid-row: 1; min-height: 0; }
.board-sidebar { grid-column: 2; grid-row: 1; min-height: 0; overflow-y: auto; }
.board-sequencer { grid-column: 1 / -1; grid-row: 2; }

.board-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  position: relative;
  min-height: 0;
  clip-path: inset(0);  /* clip le box-shadow 9999px du frame overlay */
}

.board-toolbar {
  padding: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}
.board-toolbar-sep {
  width: 1px;
  height: 1.2rem;
  background: rgba(255,255,255,0.15);
  margin: 0 0.15rem;
  flex-shrink: 0;
}

.board-canvas {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
}

.board-preview {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  width: 240px;
  aspect-ratio: var(--board-aspect-ratio, 1.6);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  pointer-events: none;
}

.board-sidebar {
  background: var(--alta-panel-bg);
  border-left: 1px solid rgba(255,255,255,0.06);
}

.board-sidebar-header {
  padding: 0.75rem 1rem;
  font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.board-sidebar-header-collapsible { cursor: pointer; }
.board-sidebar-header-collapsible:hover { background: rgba(255,255,255,0.04); }
.board-collapse-chevron { transition: transform 0.15s; }
.board-collapse-chevron.collapsed { transform: rotate(-90deg); }

.board-plan-list {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.plan-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
}

.plan-card:hover {
  background: rgba(255,255,255,0.04);
}

.plan-card-active {
  background: rgba(255,255,255,0.08);
  border-left: 3px solid var(--alta-bg);
}

.plan-card-thumb {
  width: 64px;
  height: 36px;
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  justify-content: center;
}

.plan-card-capture {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.plan-card-no-capture {
  color: var(--alta-text-muted);
  font-size: 0.8rem;
}

.plan-card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
}

.plan-card-actions {
  flex-shrink: 0;
}

.plan-card-actions form {
  display: contents;
}

/* ===== Model Viewer (inline 3D preview) ===== */

.model-viewer-container {
  position: relative;
  width: 100%;
  height: 300px;
  background: #2a2a2e;
  border-radius: 0;
}

.model-viewer-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ===== Element Edit Split-View ===== */

.element-edit-split {
  display: flex;
  gap: 1rem;
}

.element-edit-form {
  flex: 1;
  min-width: 0;
}

.element-edit-sidebar {
  flex: 0 0 380px;
  min-width: 0;
}

.model-viewer-container-sm {
  position: relative;
  width: 120px;
  height: 80px;
  background: #2a2a2e;
  border-radius: 4px;
}

.model-viewer-pose-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  border-top: 1px solid var(--alta-border);
}

.model-viewer-pose-bar .alta-btn {
  font-size: 0.8rem;
  padding: 0.15rem 0.4rem;
}

.model-viewer-joint-editor {
  border-top: 1px solid var(--alta-border);
}

/* ===== Board Inventory (sequence assets sidebar) ===== */

.board-sidebar-section {
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.inventory-section {
  max-height: 300px;
  overflow-y: auto;
}

.inventory-group-header {
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--alta-text-muted);
  background: rgba(255, 255, 255, 0.03);
}

.inventory-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.inventory-item.no-model .inventory-item-name { opacity: 0.45; }

.inventory-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-item-clickable {
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}
.inventory-item-clickable:hover {
  text-decoration: underline;
  color: inherit;
  opacity: 1;
}

.inventory-item-btn {
  flex-shrink: 0;
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  margin-left: 0.5rem;
}

/* Floating indicator in inventory */
.inventory-floating-indicator {
  flex-shrink: 0;
  color: var(--alta-active);
  font-size: 0.85rem;
  margin-left: 0.25rem;
}

/* Select icon (crosshair) in inventory */
.inventory-select-wrapper { flex-shrink: 0; margin-left: 0.25rem; }
.inventory-select-btn {
  background: none; border: none; color: var(--alta-active);
  cursor: pointer; padding: 0.1rem 0.3rem; font-size: 0.85rem; opacity: 0.7;
}
.inventory-select-btn:hover { opacity: 1; }

/* Import-target mode: crosshair cursor when placing an object */
.board-canvas.import-target-mode { cursor: crosshair; outline: 2px dashed var(--alta-active); outline-offset: -2px; }

/* Scene actions on inventory items (when asset is placed in the scene) */
.inventory-item-in-scene { border-left: 2px solid transparent; }
.inventory-item-selected { background: rgba(77,171,247,0.12); border-left-color: var(--alta-active); }
.inventory-item-hidden .inventory-item-name { text-decoration: line-through; opacity: 0.5; }

.inventory-scene-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.placed-object-btn {
  background: none;
  border: none;
  color: var(--alta-text-muted);
  cursor: pointer;
  padding: 0.1rem 0.25rem;
  font-size: 0.8rem;
  border-radius: 3px;
  opacity: 0;
  transition: all var(--alta-transition);
}
/* Show buttons on hover or selection */
.inventory-item:hover .placed-object-btn,
.inventory-item-selected .placed-object-btn,
.inventory-instance-row:hover .placed-object-btn,
.inventory-instance-row.active .placed-object-btn { opacity: 1; }
.placed-object-btn:hover { color: var(--alta-text-hover); background: rgba(255,255,255,0.08); }
/* Floating flag always visible when active */
.placed-object-btn.toggled-on { color: var(--alta-active); opacity: 1; }
.placed-object-btn.toggled-off { color: var(--alta-text-muted); }
.inventory-item:hover .placed-object-btn.toggled-off,
.inventory-item-selected .placed-object-btn.toggled-off,
.inventory-instance-row:hover .placed-object-btn.toggled-off,
.inventory-instance-row.active .placed-object-btn.toggled-off { opacity: 0.5; }
.placed-object-btn-danger:hover { color: #f66; background: rgba(255,0,0,0.1); }
/* Delete confirmation state */
.placed-object-btn.confirm-delete { color: #f66; opacity: 1; }
.placed-object-btn.confirm-delete:hover { background: rgba(255,0,0,0.15); }
/* Float choice buttons (snap/keep) — always visible */
.float-choice-btn { opacity: 1 !important; color: var(--alta-active); }

/* Multi-instance sub-rows (when same element appears multiple times in scene) */
.inventory-instance-row {
  display: flex;
  align-items: center;
  padding: 0.15rem 0.5rem 0.15rem 1.8rem;
  font-size: 0.78rem;
  border-left: 2px solid transparent;
}
.inventory-instance-row.active {
  background: rgba(77,171,247,0.12);
  border-left-color: var(--alta-active);
}
.inventory-instance-row.inventory-item-hidden .inventory-instance-label { text-decoration: line-through; opacity: 0.5; }
.inventory-instance-label {
  color: var(--alta-text-secondary);
  cursor: pointer;
  margin-right: auto;
  font-weight: 500;
}
.inventory-instance-label:hover { color: var(--alta-text-hover); }

/* Add element search (inline in inventory) */
.inventory-add-section {
  border-top: 1px solid rgba(255,255,255,0.06);
}
.inventory-add-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  padding: 0.4rem 0.75rem;
  background: none;
  border: none;
  color: var(--alta-text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--alta-transition);
}
.inventory-add-btn:hover {
  color: var(--alta-active);
  background: rgba(77,171,247,0.08);
}
.inventory-search-header {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.5rem;
}
.inventory-search-input {
  flex: 1;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  color: var(--alta-text);
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  outline: none;
}
.inventory-search-input:focus {
  border-color: var(--alta-active);
}
.inventory-search-close {
  background: none;
  border: none;
  color: var(--alta-text-muted);
  cursor: pointer;
  padding: 0.15rem 0.25rem;
  font-size: 0.8rem;
}
.inventory-search-close:hover { color: var(--alta-text-hover); }
.inventory-search-results {
  max-height: 200px;
  overflow-y: auto;
}
.inventory-search-empty {
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
  color: var(--alta-text-muted);
}
.inventory-search-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.inventory-search-item:hover {
  background: rgba(77,171,247,0.1);
}
.inventory-search-item.already-added {
  opacity: 0.45;
  cursor: default;
}
.inventory-search-item.already-added:hover {
  background: none;
}
.inventory-search-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inventory-search-item-type {
  flex-shrink: 0;
  font-size: 0.7rem;
  color: var(--alta-text-muted);
  text-transform: uppercase;
}
.inventory-search-item-check {
  flex-shrink: 0;
  color: var(--alta-active);
  font-size: 0.8rem;
}

/* Element picker (browse-first, shared) */
.element-picker-type-header {
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.35rem 0.5rem 0.15rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: color var(--alta-transition);
  user-select: none;
}
.element-picker-type-header:hover { color: var(--alta-text-hover); }
.element-picker-type-header.collapsed { opacity: 0.6; }
.element-picker-count { font-weight: 400; font-size: 0.8rem; color: var(--alta-text-muted); }
.element-picker-section { }
.element-picker-section.collapsed { display: none; }
.element-picker-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.5rem 0.25rem 1.2rem;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background var(--alta-transition);
}
.element-picker-item:hover { background: rgba(77,171,247,0.08); }
.element-picker-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.element-picker-ep { flex-shrink: 0; font-size: 0.72rem; color: var(--alta-text-muted); }
.element-picker-tagged { opacity: 0.45; cursor: default; pointer-events: none; }
.element-picker-tagged:hover { background: none; }
.element-picker-check { color: var(--alta-active); margin-left: auto; font-size: 0.9rem; }
.element-picker-empty { padding: 0.5rem; color: var(--alta-text-muted); font-size: 0.85rem; }

/* Element picker — filter bar */
.element-picker-filters { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.4rem; }
.element-picker-filter-btn {
  border: 1px solid rgba(255,255,255,0.15); border-radius: 1rem;
  padding: 0.15rem 0.6rem; font-size: 0.78rem; cursor: pointer;
  background: transparent; color: var(--alta-text-secondary);
  transition: all var(--alta-transition);
}
.element-picker-filter-btn:hover { color: var(--alta-text-hover); border-color: rgba(255,255,255,0.3); }
.element-picker-filter-btn.active { background: rgba(77,171,247,0.15); color: var(--alta-active); border-color: var(--alta-active); }

/* Camera settings section (sidebar) */
.board-cam-section {
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 0.78rem;
}
.board-cam-content {
  padding: 0 0.35rem 0.35rem;
}
.board-cam-clip-section {
  margin-top: 0.25rem;
}

/* Lens preset toggle */
.board-cam-lens-toggle {
  display: flex; align-items: center; gap: 0.35rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.72rem; font-weight: 600;
  color: var(--alta-text-muted);
  cursor: pointer;
  transition: color var(--alta-transition);
}
.board-cam-lens-toggle:hover { color: var(--alta-text-hover); }
.board-cam-lens-toggle .board-collapse-chevron { margin-left: auto; }

/* Lens preset grid */
.board-cam-lens-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 3px; padding: 0 0.35rem 0.35rem;
}
.board-cam-lens-card {
  cursor: pointer; border-radius: 3px; overflow: hidden;
  border: 2px solid transparent; transition: border-color 0.15s;
  background: rgba(255,255,255,0.04);
}
.board-cam-lens-card img { display: block; width: 100%; height: auto; }
.board-cam-lens-card:hover { border-color: rgba(255,255,255,0.3); }
.board-cam-lens-card.active { border-color: var(--alta-active); }
.board-cam-lens-info {
  padding: 0.3rem 0.4rem; display: flex; justify-content: space-between;
  font-size: 0.72rem; line-height: 1.4;
}
.board-cam-lens-info .focal { font-weight: 600; }
.board-cam-lens-info .deg { color: var(--alta-text-muted); }

/* FOV row */
.board-cam-panel-row {
  display: flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0.5rem;
}
.board-cam-label { font-size: 0.72rem; color: var(--alta-text-muted); flex-shrink: 0; width: 2rem; }
.board-cam-fov-range { flex: 1; height: 1rem; background: transparent; }
.board-cam-fov-range::-webkit-slider-runnable-track { background: rgba(255,255,255,0.15); border-radius: 3px; height: 4px; }
.board-cam-fov-range::-moz-range-track { background: rgba(255,255,255,0.15); border-radius: 3px; height: 4px; }
.board-cam-fov-val { font-size: 0.72rem; width: 2.5rem; text-align: right; flex-shrink: 0; }

/* Auto-clip button */
.board-cam-autoclip-btn {
  background: none; border: 1px solid var(--alta-text-muted);
  color: var(--alta-text-muted); border-radius: 3px;
  font-size: 0.65rem; padding: 0 0.35rem;
  cursor: pointer; transition: all var(--alta-transition);
}
.board-cam-autoclip-btn:hover {
  border-color: var(--alta-active); color: var(--alta-active);
}
.board-cam-autoclip-btn.active {
  background: var(--alta-active); color: #111;
  border-color: var(--alta-active);
}

/* Dual-range clipping slider */
.board-cam-clip-labels {
  display: flex; justify-content: space-between;
  padding: 0 0.5rem; font-size: 0.7rem; color: var(--alta-text-muted);
}
.board-cam-dual-range {
  position: relative; height: 1.5rem; margin: 0 0.5rem 0.4rem;
}
.board-cam-dual-range input[type="range"] {
  position: absolute; width: 100%; top: 0; left: 0;
  pointer-events: none; -webkit-appearance: none; appearance: none;
  background: transparent; height: 1.5rem; margin: 0;
}
.board-cam-dual-range input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 12px; height: 12px; border-radius: 50%;
  pointer-events: auto; cursor: pointer;
  border: 2px solid var(--alta-active); background: var(--alta-body-bg);
}
.board-cam-dual-range input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%;
  pointer-events: auto; cursor: pointer;
  border: 2px solid var(--alta-active); background: var(--alta-body-bg);
}
.board-cam-dual-range input[type="range"]::-webkit-slider-runnable-track {
  height: 3px; background: rgba(255,255,255,0.15); border-radius: 2px;
}
.board-cam-dual-range input[type="range"]::-moz-range-track {
  height: 3px; background: rgba(255,255,255,0.15); border-radius: 2px;
}

/* Sequencer (filmstrip) */
.board-sequencer {
  background: var(--alta-panel-bg);
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: flex-end;
  overflow-x: auto;
  padding: 0.35rem 0.5rem;
  gap: 0.5rem;
  min-height: 90px;
  position: relative;
}
.sequencer-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding-bottom: 4px;
}
.sequencer-group:nth-of-type(odd) { background: rgba(255,255,255,0.03); }
.sequencer-group:nth-of-type(even) { background: transparent; }
.sequencer-label {
  font-size: 0.65rem;
  color: var(--alta-text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 2px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
}
.sequencer-label .badge-amb,
.sequencer-label .badge-bg-int,
.sequencer-label .badge-bg-ext {
  font-size: 0.55rem;
  padding: 1px 4px;
  text-transform: none;
  letter-spacing: normal;
}
.sequencer-thumbs {
  display: flex;
  gap: 3px;
  align-items: flex-end;
}
.sequencer-thumb {
  width: 96px; height: 54px;
  border-radius: 3px; overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  flex-shrink: 0;
  position: relative;
}
.sequencer-thumb:hover { border-color: rgba(255,255,255,0.3); }
.sequencer-thumb-active { border-color: var(--alta-active); }
.sequencer-thumb-img { width: 100%; height: 100%; object-fit: cover; }
.sequencer-thumb-empty {
  width: 100%; height: 100%;
  background: rgba(255,255,255,0.04);
  display: flex; align-items: center; justify-content: center;
  color: var(--alta-text-muted); font-size: 1rem;
}
.sequencer-thumb-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.6);
  font-size: 0.6rem; padding: 1px 4px;
  text-align: center; color: #eee;
}

/* Sequencer takes */
.sequencer-take {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sequencer-take-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.6rem;
  color: var(--alta-text-muted);
  padding: 1px 4px;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: color var(--alta-transition);
}
.sequencer-take-label:hover { color: var(--alta-text-hover); }
.sequencer-take.active .sequencer-take-label { color: var(--alta-active); font-weight: 600; }
.sequencer-take-radio {
  font-size: 0.5rem;
  line-height: 1;
}
.sequencer-take.active {
  border-left: 2px solid var(--alta-active);
  padding-left: 2px;
}
.sequencer-take:not(.active) {
  border-left: 2px solid transparent;
  padding-left: 2px;
  opacity: 0.7;
}
.sequencer-take:not(.active):hover { opacity: 1; }
.sequencer-take-add {
  background: transparent;
  border: none;
  color: var(--alta-text-muted);
  cursor: pointer;
  font-size: 0.6rem;
  padding: 0 2px;
  line-height: 1;
  transition: color var(--alta-transition);
}
.sequencer-take-add:hover { color: var(--alta-active); }
.sequencer-take-delete {
  background: transparent;
  border: none;
  color: var(--alta-text-muted);
  cursor: pointer;
  font-size: 0.65rem;
  padding: 0 2px;
  margin-left: auto;
  line-height: 1;
  opacity: 0;
  transition: opacity var(--alta-transition), color var(--alta-transition);
}
.sequencer-take-label:hover .sequencer-take-delete { opacity: 1; }
.sequencer-take-delete:hover { color: #f66; }
.sequencer-take-collapse {
  font-size: 0.55rem;
  cursor: pointer;
  transition: transform var(--alta-transition);
}
.sequencer-take.collapsed .sequencer-take-collapse {
  transform: rotate(-90deg);
}
.sequencer-take-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sequencer-take.collapsed .sequencer-thumbs {
  display: none;
}

/* Multi-take group spacing */
.sequencer-group.multi-take {
  gap: 4px;
}

/* Sequencer drag-and-drop */
.sequencer-thumb.dragging { opacity: 0.4; }
.sequencer-thumb.drag-over-left { border-left: 3px solid var(--alta-active); }
.sequencer-thumb.drag-over-right { border-right: 3px solid var(--alta-active); }
.sequencer-group.drag-over-group { background: rgba(77,171,247,0.08); }

/* Réut cam section */
.board-cam-reut-toggle {
  display: flex; align-items: center; gap: 0.35rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.72rem; font-weight: 600;
  color: var(--alta-text-muted);
  cursor: pointer;
  transition: color var(--alta-transition);
}
.board-cam-reut-toggle:hover { color: var(--alta-text-hover); }
.board-cam-reut-toggle .board-collapse-chevron { margin-left: auto; }
.board-cam-reut-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 3px; padding: 0 0.35rem 0.35rem;
  max-height: 40vh; overflow-y: auto;
}
.board-cam-reut-thumb {
  cursor: pointer; border-radius: 3px; overflow: hidden;
  border: 2px solid transparent; transition: border-color 0.15s;
  position: relative;
}
.board-cam-reut-thumb:hover { border-color: rgba(255,255,255,0.3); }
.board-cam-reut-img { width: 100%; height: auto; display: block; }
.board-cam-reut-count {
  position: absolute; top: 2px; right: 2px;
  background: rgba(0,0,0,0.7); color: #fff;
  font-size: 0.55rem; font-weight: 700; line-height: 1;
  padding: 1px 4px; border-radius: 3px;
}
.board-cam-reut-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.6);
  font-size: 0.6rem; padding: 1px 4px;
  text-align: center; color: #eee;
}

/* Board context menu (shared) */
.board-context-menu {
  position: fixed; z-index: var(--z-menu);
  min-width: 180px;
  background: var(--alta-panel-bg);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  padding: 0.25rem 0;
}
.board-context-menu-item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.35rem 0.8rem;
  color: var(--alta-text); text-decoration: none;
  font-size: 0.82rem; cursor: pointer;
  transition: background var(--alta-transition);
}
.board-context-menu-item:hover {
  background: rgba(255,255,255,0.08);
  color: var(--alta-text-hover);
}
.board-context-menu-item.active {
  background: rgba(255,255,255,0.1);
  font-weight: 600;
}
.board-context-menu-item-danger:hover {
  background: #b00; color: #fff;
}
.board-context-menu-item-confirm {
  background: #b00; color: #fff; font-weight: 600;
}
.board-context-menu-kbd {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--alta-text-muted);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 3px;
  padding: 0 0.3em;
  font-weight: 400;
}
.board-context-menu-separator {
  height: 1px;
  background: rgba(255,255,255,0.1);
  margin: 0.25rem 0;
}
.board-context-menu-sub {
  position: relative;
}
.board-context-menu-submenu {
  display: none;
  position: absolute;
  left: 100%;
  bottom: 0;
}
.board-context-menu-sub:hover > .board-context-menu-submenu {
  display: block;
}
.board-context-menu-chevron {
  margin-left: auto;
  font-size: 0.65rem;
  opacity: 0.5;
}

/* Panel flottant plans réut cam */
/* Toast de progression */
.alta-toast {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--alta-panel-bg);
  color: var(--alta-text);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  padding: 0.5rem 1.2rem;
  font-size: 0.85rem;
  z-index: var(--z-toast);
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

/* Main Pack inventory */
.inventory-group-header-mainpack {
  border-top: 1px solid rgba(212, 160, 23, 0.3);
  color: var(--alta-warning, #d4a017);
}
.inventory-group-header-mainpack i { margin-right: 0.25rem; }
.badge-mainpack {
  color: var(--alta-warning, #d4a017);
  font-size: 0.65rem;
}
.inventory-item-mainpack {
  background: rgba(212, 160, 23, 0.04);
}
.icon-mainpack { color: var(--alta-warning, #d4a017); }
.badge-mainpack-title { font-size: 0.5em; vertical-align: middle; }

/* Mannequin inventory item */
.inventory-item.mannequin .inventory-item-name {
  color: var(--alta-active);
  opacity: 0.85;
}
.inventory-item.mannequin .inventory-item-name i {
  margin-right: 0.25rem;
}

/* Pose presets (shared between sidebar and floating panel) */
.board-pose-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.25rem;
  margin-bottom: 0.35rem;
}
.board-pose-preset-card {
  cursor: pointer;
  border-radius: 3px;
  overflow: hidden;
  border: 2px solid transparent;
  transition: border-color 0.15s;
  background: rgba(255,255,255,0.04);
  position: relative;
}
.board-pose-preset-card img {
  display: block;
  width: 100%;
  height: auto;
}
.board-pose-preset-card:hover {
  border-color: var(--alta-active);
}
.board-pose-preset-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 50px;
  font-size: 1.2rem;
  color: var(--alta-text-muted);
}
.board-pose-preset-card-label {
  padding: 0.2rem 0.3rem;
  font-size: 0.65rem;
  text-align: center;
  color: var(--alta-text-secondary);
  line-height: 1.3;
}
.board-pose-preset-card-delete {
  position: absolute;
  top: 1px;
  right: 1px;
  background: rgba(0,0,0,0.7);
  border: none;
  color: var(--alta-text-muted);
  font-size: 0.7rem;
  border-radius: 3px;
  cursor: pointer;
  padding: 0 3px;
  line-height: 1.2;
  opacity: 0;
  transition: opacity var(--alta-transition);
}
.board-pose-preset-card:hover .board-pose-preset-card-delete { opacity: 1; }
.board-pose-preset-card-delete:hover { color: #f66; }

/* Save pose inline form */
.board-pose-save {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.35rem;
  align-items: center;
}
.board-pose-save input {
  flex: 1;
  min-width: 0;
}
.board-pose-save .btn {
  flex-shrink: 0;
  white-space: nowrap;
  font-size: 0.7rem;
}
.board-pose-params {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.25rem 0.5rem;
  margin-top: 0.25rem;
}
.board-pose-params .form-control {
  max-width: 80px;
}
.board-pose-params .form-range {
  min-width: 60px;
}
.board-pose-joint-info {
  margin-top: 0.25rem;
  min-height: 1.2em;
}

/* Pose floating panel */
.board-pose-panel {
  position: absolute;
  z-index: var(--z-panel);
  width: 260px;
  background: rgba(52, 58, 64, 0.95);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  font-size: 0.78rem;
  color: var(--alta-text);
  pointer-events: auto;
}
.board-pose-panel.dragging {
  opacity: 0.85;
  cursor: grabbing;
}
.board-pose-panel-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.6rem;
  background: rgba(255,255,255,0.06);
  border-radius: 6px 6px 0 0;
  cursor: grab;
  user-select: none;
}
.board-pose-panel-header .bi { font-size: 0.85rem; color: var(--alta-active); }
.board-pose-panel-title {
  flex: 1;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.board-pose-panel-badge {
  font-size: 0.65rem;
  color: var(--alta-active);
  background: rgba(77,173,247,0.15);
  padding: 0.05rem 0.35rem;
  border-radius: 3px;
  font-weight: 600;
}
.board-pose-panel-close {
  background: none;
  border: none;
  color: var(--alta-text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0 0.2rem;
  line-height: 1;
}
.board-pose-panel-close:hover { color: var(--alta-text-hover); }
.board-pose-panel-body {
  padding: 0.4rem 0.5rem;
  max-height: 60vh;
  overflow-y: auto;
}
.board-pose-panel-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--alta-text-muted);
  margin-top: 0.4rem;
  margin-bottom: 0.2rem;
}
.board-pose-panel-section-label:first-child { margin-top: 0; }


/* Joint diagram (3D projection with clickable dots) */
.board-pose-joint-diagram {
  position: relative;
  width: 100%;
  margin-bottom: 0.25rem;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(0,0,0,0.2);
  cursor: grab;
  user-select: none;
}
.board-pose-joint-diagram-img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}
.board-pose-joint-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  margin-top: -7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.35);
  cursor: pointer;
  transition: background var(--alta-transition), border-color var(--alta-transition), transform var(--alta-transition), box-shadow var(--alta-transition);
  z-index: 1;
}
.board-pose-joint-dot:hover {
  background: rgba(77,173,247,0.4);
  border-color: var(--alta-active);
  transform: scale(1.3);
}
.board-pose-joint-dot.active {
  background: var(--alta-active);
  border-color: #fff;
  box-shadow: 0 0 6px rgba(77,173,247,0.6);
  transform: scale(1.3);
}

/* Mannequin params in panel */
.board-pose-params-panel {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.15rem 0.4rem;
}
.board-pose-params-panel label {
  font-size: 0.7rem;
  color: var(--alta-text-muted);
  white-space: nowrap;
}
.board-pose-params-panel input[type="number"] {
  max-width: 70px;
}
.board-pose-params-panel .pose-param-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* Modifier key indicator */
.board-modifier-indicator {
  position: absolute;
  bottom: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.75);
  color: #eee;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.78rem;
  z-index: var(--z-hints);
  pointer-events: none;
  white-space: nowrap;
}
.board-modifier-indicator kbd {
  background: rgba(255,255,255,0.15);
  color: var(--alta-active);
  padding: 0.05rem 0.25rem;
  border-radius: 3px;
  font-size: 0.72rem;
  margin-right: 0.15rem;
  border: 1px solid rgba(255,255,255,0.25);
}
.board-modifier-sep {
  margin: 0 0.4rem;
  color: var(--alta-text-muted);
}

/* History dropdown (undo/redo) */
.board-history-dropdown {
  position: absolute; z-index: var(--z-menu);
  min-width: 240px; max-height: 60vh;
  overflow-y: auto;
  background: var(--alta-panel-bg);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  padding: 0.25rem 0;
}
.board-history-item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.35rem 0.8rem;
  font-size: 0.85rem; cursor: pointer;
  color: var(--alta-text);
}
.board-history-item:hover { background: rgba(255,255,255,0.08); }
.board-history-item.redo { opacity: 0.5; }
.board-history-item.current {
  background: rgba(77,171,247,0.15);
  font-weight: 600; cursor: default;
  border-left: 3px solid var(--alta-active);
}
.board-history-item.current:hover { background: rgba(77,171,247,0.15); }
.board-history-preview {
  width: 52px; height: 30px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.1);
}
.board-history-label {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}
.board-history-time {
  flex-shrink: 0;
  font-size: 0.7rem;
  color: var(--alta-text-muted);
  white-space: nowrap;
}
.board-history-empty {
  padding: 0.5rem 0.8rem;
  font-size: 0.8rem; color: var(--alta-text-muted);
}

/* Canvas pose-mode cursor */
.board-canvas.pose-mode { cursor: crosshair; }

/* Mode expanded : séquenceur prend la moitié de la hauteur */
.board-layout.sequencer-expanded {
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
}
.board-sequencer.expanded {
  overflow-y: auto;
  overflow-x: hidden;
  flex-direction: column;
  align-items: stretch;
}
.board-sequencer.expanded .sequencer-group {
  flex-shrink: 1;
}
.board-sequencer.expanded .sequencer-thumbs {
  flex-wrap: wrap;
}

/* Bouton expand séquenceur */
.sequencer-expand-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 3px;
  color: var(--alta-text-muted);
  cursor: pointer;
  padding: 2px 6px;
  flex-shrink: 0;
  align-self: center;
}
.sequencer-expand-btn:hover { color: var(--alta-active); border-color: var(--alta-active); }

/* Sequencer "+" button */
.sequencer-add {
  width: 96px; height: 54px;
  border: 2px dashed rgba(255,255,255,0.2);
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  color: var(--alta-text-muted); font-size: 1.2rem;
  cursor: pointer; flex-shrink: 0;
  transition: border-color var(--alta-transition), color var(--alta-transition);
}
.sequencer-add:hover {
  border-color: var(--alta-active); color: var(--alta-active);
}

/* Sequencer "+" dropdown button */
.sequencer-add-btn {
  background: transparent;
  border: none;
  color: inherit;
  font-size: inherit;
  cursor: pointer;
  padding: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Frame overlay (safe zones) */
.board-frame-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: var(--z-frame);
  overflow: hidden;
  /* clip-path set dynamically by JS to exclude toolbar */
}
.frame-shooting-area {
  position: absolute;
  border: 1px solid rgba(255,255,255,0.4);
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.5);
}
.frame-zone {
  position: absolute;
  border: 1px solid var(--frame-zone-color);
  box-sizing: border-box;
}
.frame-zone-tv    { --frame-zone-color: #10d410; inset: 3.5%; border-style: dotted; }
.frame-zone-title { --frame-zone-color: #ff3d38; inset: 5%; border-style: dashed; }
.frame-zone-caption { --frame-zone-color: orange; inset: 5% 16.25%; border-style: dotted; border-width: 2px; }
.frame-zone-label {
  position: absolute;
  top: 1px;
  right: 2px;
  font-size: 7px;
  line-height: 1;
  text-transform: uppercase;
  color: var(--frame-zone-color);
  background: rgba(0,0,0,0.6);
  border: 1px solid var(--frame-zone-color);
  padding: 1px 3px;
  border-radius: 2px;
}

/* Annotation 2D overlay (SVG) */
.board-annotation-overlay {
  position: absolute;
  z-index: var(--z-annotation);
  pointer-events: none;
}
/* Annotation vertical toolbar */
.annotation-toolbar-v {
  position: absolute;
  top: 3.2rem; left: 0.5rem;
  z-index: var(--z-anno-bar);
  background: rgba(0,0,0,0.85);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  padding: 0.3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.anno-tool-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none;
  color: var(--alta-text-secondary);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--alta-transition);
  padding: 0;
}
.anno-tool-btn:hover { background: rgba(255,255,255,0.12); color: var(--alta-text-hover); }
.anno-tool-btn.active { background: var(--alta-active); color: #111; }
.anno-tool-btn-danger:hover { background: rgba(255,80,60,0.3); color: #f66; }
.anno-tool-sep {
  width: 24px; height: 1px;
  background: rgba(255,255,255,0.15);
  margin: 2px 0;
}
.anno-color-input {
  width: 28px; height: 28px;
  padding: 2px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  cursor: pointer;
  background: none;
}
.anno-width-range {
  width: 28px;
  writing-mode: vertical-lr;
  direction: rtl;
  height: 60px;
}

/* Keyboard & mouse hints overlay */
.board-hints {
  position: absolute; bottom: 0.5rem; left: 0.5rem;
  background: rgba(0,0,0,0.88); color: #eee;
  padding: 0.6rem 0.85rem; border-radius: 6px;
  font-size: 0.85rem; z-index: var(--z-hints); line-height: 1.7;
}
.board-hints kbd {
  background: rgba(255,255,255,0.15); color: #fff; padding: 0.1rem 0.3rem;
  border-radius: 3px; font-size: 0.78rem; margin-right: 0.15rem;
  border: 1px solid rgba(255,255,255,0.25);
}
.board-hints-columns {
  display: flex; gap: 1.5rem;
}
.board-hints-col {
  min-width: 0;
}
.board-hints-title {
  font-weight: 700; margin-bottom: 0.3rem; font-size: 0.9rem;
  display: flex; align-items: center; gap: 0.35rem;
}
.board-hints-subsection {
  font-weight: 600; margin-top: 0.35rem; margin-bottom: 0.1rem;
  font-size: 0.8rem; color: var(--alta-text-secondary);
}
.board-hints-icon {
  opacity: 0.55; margin-right: 0.2rem; font-size: 0.8rem;
}

/* ===== Icon Picker ===== */
.icon-picker { position: relative; }
.icon-picker-dropdown {
  position: absolute; top: 100%; left: 0; z-index: 1050;
  background: var(--alta-panel-bg); border: 1px solid var(--alta-border);
  border-radius: 0.375rem; padding: 0.4rem;
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  width: max-content;
}
.icon-picker-option {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border: none; border-radius: 0.25rem;
  background: transparent; color: var(--alta-text); cursor: pointer;
  font-size: 1rem;
}
.icon-picker-option:hover { background: var(--alta-border); }
.icon-picker-option.active { background: var(--alta-accent); color: #fff; }

/* Documentation viewer → docs.css */

.alta-header-link {
  color: var(--alta-text-secondary);
  text-decoration: none;
  padding: 0.6rem 0.5rem;
  font-size: 0.85rem;
  white-space: nowrap;
}
.alta-header-link:hover { color: var(--alta-text-hover); }
.alta-header-link .bi { margin-right: 0.3em; font-size: 1rem; vertical-align: -0.1em; }
.alta-header-link-doc { margin: 0 2em; }

/* ===== User menu (header) ===== */

.alta-user-menu {
  display: flex;
  align-items: center;
  gap: 0;
  margin-left: auto;
}

/* button_to generates a <form> — prevent it from breaking flex/dropdown */
.alta-user-menu form { display: contents; }
.alta-user-menu .dropdown-menu form { display: block; }
.alta-user-menu .dropdown-toggle { border: none; background: none; }
.alta-user-menu .dropdown-toggle::after { font-size: 0.65em; vertical-align: 0.15em; }

/* ===== Billing ===== */

.billing-container {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.billing-plans {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}

.billing-plan-card {
  position: relative;
  background: var(--alta-panel-bg);
  border: 2px solid transparent;
  border-radius: 0.5rem;
  padding: 1.5rem 1rem;
  text-align: center;
}
.billing-plan-card.active { border-color: var(--bs-primary); }
.billing-plan-card.highlighted { border-color: var(--alta-accent); box-shadow: 0 0 0 1px var(--alta-accent); }
.billing-plan-card h3 { margin-bottom: 0.5rem; font-size: 1.1rem; }
.billing-plan-price { font-size: 1.5rem; font-weight: 700; margin-bottom: 1rem; }

.billing-popular-badge {
  position: absolute;
  top: -0.7rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--alta-accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.6rem;
  border-radius: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Tableau comparatif */
.billing-comparison {
  margin-top: 2rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.5rem;
  overflow: hidden;
}
.billing-comparison table { margin: 0; }
.billing-comparison th,
.billing-comparison td { vertical-align: middle; }
.billing-comparison .active-col { background: rgba(var(--bs-primary-rgb), 0.06); }

/* Jauges consommation (onglet studio + billing) */
.billing-usage-table { margin-top: 1rem; }
.billing-usage-row {
  display: grid;
  grid-template-columns: 120px 90px 1fr;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  font-size: 0.88rem;
}
.billing-usage-label { color: var(--alta-text-secondary); }
.billing-usage-value { text-align: right; font-variant-numeric: tabular-nums; }
.billing-usage-bar {
  height: 8px;
  background: var(--bs-border-color);
  border-radius: 4px;
  overflow: hidden;
}
.billing-usage-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--bs-primary);
  transition: width 0.3s ease;
}
.billing-usage-fill.level-warning { background: var(--bs-warning); }
.billing-usage-fill.level-danger { background: var(--bs-danger); }
.billing-usage-fill.billing-usage-unlimited { background: var(--bs-border-color); opacity: 0.4; }

/* ===== Studio settings ===== */

.studio-dashboard {
  width: 1100px;
  max-width: 100%;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.studio-tab-content { min-height: 300px; }

.studio-settings {
  max-width: 700px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.studio-members-table {
  width: 100%;
  margin-top: 1rem;
}
.studio-members-table td { padding: 0.5rem 0; vertical-align: middle; }

/* ===== Legal pages ===== */

.legal-container {
  max-width: 700px;
  margin: 2rem auto;
  padding: 0 1rem;
}
.legal-container h1 { margin-bottom: 0.5rem; }
.legal-container h2 { font-size: 1.1rem; margin-top: 1.5rem; color: var(--alta-text); }
.legal-container p, .legal-container li { color: var(--alta-text-secondary); font-size: 0.9rem; }
.legal-container table { font-size: 0.85rem; }

/* ===== Admin dashboard ===== */

.alta-main:has(.admin-dashboard),
.alta-main:has(.studio-dashboard),
.alta-main:has(.studio-settings) {
  overflow-y: auto;
}

.admin-dashboard {
  width: 1100px;
  max-width: 100%;
  margin: 0 auto;
  padding: 2rem 1rem;
}
.admin-dashboard td:last-child { white-space: nowrap; }
.admin-dashboard .table { font-size: 0.875rem; }
.admin-dashboard .table th { font-weight: 600; color: var(--alta-text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; border-bottom-width: 2px; }
.admin-dashboard .table td { vertical-align: middle; }
.admin-dashboard .table-hover tbody tr:hover { background: rgba(255,255,255,0.03); }

.admin-section {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 0.5rem;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.admin-section .table { --bs-table-bg: transparent; --bs-table-striped-bg: transparent; }
.admin-section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.admin-section-header h4,
.admin-section-header h5 { margin: 0; font-size: 1rem; font-weight: 600; }
.admin-section-header .badge { font-size: 0.7rem; }

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.admin-stat-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 0.5rem;
  padding: 1.2rem;
  text-align: center;
}
.admin-stat-value { font-size: 2rem; font-weight: 700; color: var(--alta-text); }
.admin-stat-label { font-size: 0.8rem; color: var(--alta-text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.admin-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.25rem 2rem; font-size: 0.875rem; }
.admin-detail-grid dt { color: var(--alta-text-muted); font-weight: 500; }
.admin-detail-grid dd { margin-bottom: 0.25rem; }

.admin-actions { display: flex; gap: 0.25rem; }
.admin-actions .btn { padding: 0.2rem 0.4rem; }
.admin-actions form { display: contents; }

