* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #f5f0e8;
  --surface: #ffffff;
  --surface2: #f0ebe3;
  --text: #2d2b28;
  --text-dim: #8b8580;
  --accent: #c96442;
  --accent-hover: #b85636;
  --accent-light: #f4e8e2;
  --danger: #c44;
  --success: #3a8;
  --border: #e0dbd3;
  --border-strong: #ccc5bb;
}

body {
  font-family: 'Söhne', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ═══════════ Top Navigation ═══════════ */
#main-nav {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 16px;
  background: var(--text);
  color: white;
  flex-shrink: 0;
  height: 44px;
}

.nav-brand {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.3px;
  padding-right: 24px;
  color: rgba(255,255,255,.9);
}

.nav-tabs {
  display: flex;
  gap: 0;
  height: 100%;
}

.nav-tab {
  background: none;
  border: none;
  color: rgba(255,255,255,.55);
  padding: 0 18px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  height: 100%;
  display: flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  transition: all .15s;
  font-family: inherit;
}
.nav-tab:hover { color: rgba(255,255,255,.85); }
.nav-tab.active {
  color: white;
  border-bottom-color: var(--accent);
}

.nav-right {
  margin-left: auto;
  display: flex;
  gap: 6px;
}
.nav-right button {
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.8);
  border: 1px solid rgba(255,255,255,.15);
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all .15s;
  font-family: inherit;
}
.nav-right button:hover {
  background: rgba(255,255,255,.2);
  color: white;
}

/* ═══════════ Objectives View ═══════════ */
#obj-toolbar {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  gap: 12px;
}

.obj-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
}

.obj-toolbar-right {
  margin-left: auto;
}

#obj-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  padding: 3px 10px;
  border-radius: 8px;
}

#obj-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.obj-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.obj-card {
  display: flex;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  transition: box-shadow .15s;
}
.obj-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
}

.obj-card-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 2px;
}

.obj-card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.obj-card-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.obj-card-title-input {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 6px 2px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  font-family: inherit;
  transition: border-color .15s;
}
.obj-card-title-input:focus {
  outline: none;
  border-bottom-color: var(--accent);
}
.obj-card-title-input::placeholder {
  color: var(--text-dim);
  font-weight: 400;
}

.obj-card-desc-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
  resize: vertical;
  transition: border-color .15s;
  line-height: 1.4;
}
.obj-card-desc-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201,100,66,.12);
}
.obj-card-desc-input::placeholder {
  color: var(--text-dim);
}

.obj-card-delete {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 16px;
  padding: 4px 6px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity .15s, color .15s, background .15s;
  flex-shrink: 0;
}
.obj-card:hover .obj-card-delete { opacity: 1; }
.obj-card-delete:hover { color: var(--danger); background: rgba(204,68,68,.08); }

.obj-card-score-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.obj-card-score-label {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
}

.obj-score-stars {
  display: flex;
  gap: 2px;
}

.obj-star {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  padding: 0 2px;
  color: var(--border-strong);
  transition: color .1s, transform .1s;
  line-height: 1;
}
.obj-star.active {
  color: #e8a838;
}
.obj-star:hover {
  transform: scale(1.2);
  color: #e8a838;
}

.obj-card-score-val {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  background: var(--surface2);
  padding: 2px 8px;
  border-radius: 6px;
}

.obj-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px;
  border: 2px dashed var(--border-strong);
  border-radius: 12px;
  background: none;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.obj-add-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.obj-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-dim);
  gap: 8px;
}
.obj-empty-icon {
  font-size: 40px;
  opacity: .4;
}
.obj-empty-text {
  font-size: 14px;
  font-weight: 500;
}
.obj-empty-hint {
  font-size: 12px;
  opacity: .7;
}

/* ═══════════ Views ═══════════ */
.view {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}
.view.active {
  display: flex;
}

/* ═══════════ Analysis Toolbar ═══════════ */
#toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.toolbar-group {
  display: flex;
  gap: 4px;
  padding-right: 12px;
  border-right: 1px solid var(--border);
}
.toolbar-group:last-child { border-right: none; }
.toolbar-group.right { margin-left: auto; }

#toolbar button {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all .15s;
  white-space: nowrap;
}
#toolbar button:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}
#toolbar button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* ═══════════ Workspace (Analysis) ═══════════ */
#workspace {
  flex: 1;
  position: relative;
  overflow: hidden;
  touch-action: none;
}

#canvas {
  width: 100%;
  height: 100%;
  cursor: default;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* SVG elements */
.box-group { cursor: grab; }
.box-group.selected rect {
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-dasharray: 6 3;
}
.box-group rect {
  rx: 10; ry: 10;
  stroke: rgba(0,0,0,.12);
  stroke-width: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.1));
}
.box-group text {
  fill: white;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Söhne', 'Segoe UI', system-ui, sans-serif;
  pointer-events: none;
  user-select: none;
}

.arrow-group { cursor: pointer; }
.arrow-group line, .arrow-group path {
  stroke-linecap: round;
  transition: stroke .15s;
}
.arrow-group.selected line,
.arrow-group.selected path {
  stroke: var(--accent) !important;
  stroke-dasharray: 8 4;
}
.arrow-group .arrow-hit { stroke: transparent; stroke-width: 14; fill: none; }
.arrow-label-group {
  pointer-events: none;
}
.arrow-label-bg {
  fill: rgba(255, 255, 255, 0.92);
  stroke: var(--border);
  stroke-width: 0.5;
}
.arrow-label {
  fill: var(--text);
  font-size: 10.5px;
  font-weight: 500;
  font-family: 'Söhne', 'Segoe UI', system-ui, sans-serif;
  pointer-events: none;
}
.arrow-group.selected .arrow-label {
  fill: var(--accent);
}
.arrow-group.selected .arrow-label-bg {
  fill: var(--accent-light);
  stroke: var(--accent);
}

/* Selection rectangle */
#select-rect {
  fill: rgba(201, 100, 66, 0.08);
  stroke: var(--accent);
  stroke-width: 1;
  stroke-dasharray: 4 2;
}

/* Map panel */
#map-panel {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 460px;
  height: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 30px rgba(0,0,0,.12);
  z-index: 100;
  resize: both;
  overflow: hidden;
}
#map-panel.hidden { display: none; }

#map-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}
#map-header button {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 16px;
  border-radius: 4px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#map-header button:hover { color: var(--danger); background: rgba(204,68,68,.08); }

#map-canvas {
  flex: 1;
  width: 100%;
}

/* ═══════════ Dialogs ═══════════ */
.dialog {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(2px);
}
.dialog.hidden { display: none; }
.dialog-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  min-width: 340px;
  max-width: 420px;
  box-shadow: 0 12px 40px rgba(0,0,0,.15);
}
.dialog-content h3 {
  margin-bottom: 16px;
  font-size: 16px;
  font-weight: 600;
}
.dialog-content label {
  display: block;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
}
.dialog-content input[type="text"],
.dialog-content textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  transition: border-color .15s;
}
.dialog-content input[type="text"]:focus,
.dialog-content textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201,100,66,.12);
}
.dialog-content input[type="color"] {
  margin-top: 4px;
  height: 32px;
  width: 64px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  padding: 2px;
}
.dialog-content input[type="range"] {
  margin-top: 4px;
  width: calc(100% - 30px);
  vertical-align: middle;
  accent-color: var(--accent);
}
.dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}
.dialog-actions button {
  padding: 8px 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  background: var(--surface);
  color: var(--text);
  transition: all .15s;
}
.dialog-actions button:first-child {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.dialog-actions button:first-child:hover { background: var(--accent-hover); }
.dialog-actions button:last-child:hover { background: var(--surface2); }

/* ═══════════ Show More Button ═══════════ */
.mat-combo-show-more {
  text-align: center;
  padding: 6px 0;
}
.mat-combo-more-btn {
  padding: 6px 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all .15s;
}
.mat-combo-more-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* ═══════════ Filter Panel ═══════════ */
.filter-btn {
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all .15s;
  position: relative;
}
.filter-btn:hover { background: var(--surface2); }
.filter-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.filter-panel {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 220px;
  max-width: 320px;
  max-height: 400px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: 100;
}
.filter-panel.hidden { display: none; }
.filter-panel-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  margin-top: 8px;
}
.filter-panel-title:first-child { margin-top: 0; }
.filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
  cursor: pointer;
}
.filter-item:hover { opacity: 0.8; }
.filter-item input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  cursor: pointer;
}
.filter-item-dot {
  width: 10px;
  height: 10px;
  min-width: 10px;
  border-radius: 3px;
}
.filter-item-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.filter-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.filter-actions button {
  flex: 1;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 11px;
  transition: all .15s;
}
.filter-actions button:hover { background: var(--surface2); }
.mat-toolbar-right, #mat-toolbar .mat-toolbar-right, #mats-toolbar .mat-toolbar-right, #synth-toolbar .mat-toolbar-right {
  position: relative;
}

/* ═══════════ Recent Colors ═══════════ */
.recent-colors {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.recent-colors-label {
  font-size: 11px;
  color: var(--text-dim);
  width: 100%;
  margin-bottom: 2px;
}
.recent-color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: border-color .15s, transform .1s;
}
.recent-color-swatch:hover {
  border-color: var(--accent);
  transform: scale(1.15);
}

/* ═══════════ Legend Panel ═══════════ */
.legend-panel {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  min-width: 180px;
  max-width: 260px;
  max-height: calc(100% - 24px);
  overflow-y: auto;
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  z-index: 50;
}
.legend-panel.hidden { display: none; }
.legend-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-weight: 600;
  font-size: 13px;
}
.legend-header button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-dim);
  padding: 2px 6px;
  border-radius: 4px;
}
.legend-header button:hover { background: var(--surface2); }
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.legend-item-dot {
  width: 18px;
  height: 18px;
  min-width: 18px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,.1);
}
.legend-item-input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  color: var(--text);
  font-family: inherit;
  transition: border-color .15s;
}
.legend-item-input:focus {
  outline: none;
  border-color: var(--accent);
}
.legend-item-input::placeholder {
  color: var(--text-dim);
  opacity: 0.6;
}

/* ═══════════ Toast ═══════════ */
#toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--surface);
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  z-index: 300;
  transition: opacity .3s;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
}
#toast.hidden { opacity: 0; pointer-events: none; }

/* ═══════════ Dev View ═══════════ */
#dev-toolbar {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.dev-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
}

.dev-toolbar-right {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

.dev-hidden-toggle {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all .15s;
  font-family: inherit;
}
.dev-hidden-toggle:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}
.dev-hidden-toggle.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

#dev-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Two-column layout */
.dev-columns {
  display: flex;
  gap: 20px;
  flex: 1;
  min-height: 0;
}

.dev-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dev-column-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px 12px 0 0;
  border-bottom: 2px solid #4a7fb5;
}
.dev-column-header.strategy {
  border-bottom-color: var(--accent);
}

.dev-column-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #e8f0fa;
  color: #4a7fb5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.dev-column-header.strategy .dev-column-icon {
  background: var(--accent-light);
  color: var(--accent);
}

.dev-column-title {
  font-weight: 700;
  font-size: 14px;
}
.dev-column-hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 1px;
}

.dev-column-count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  background: var(--surface2);
  padding: 2px 8px;
  border-radius: 10px;
}

.dev-column-cards {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 0;
  align-content: flex-start;
}

.dev-column-empty {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  padding: 24px;
  font-style: italic;
}

.dev-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  width: 280px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  overflow: hidden;
  transition: box-shadow .15s;
}
.dev-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
}

.dev-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.dev-card-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dev-card-title {
  font-weight: 600;
  font-size: 14px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dev-card-drag {
  color: var(--text-dim);
  font-size: 14px;
  cursor: grab;
  opacity: 0.3;
  transition: opacity .15s;
  flex-shrink: 0;
  user-select: none;
  letter-spacing: -2px;
}
.dev-card-header:hover .dev-card-drag { opacity: 0.7; }
.dev-card-drag:active { cursor: grabbing; }

.dev-card-dragging {
  opacity: 0.4;
}

.dev-card-drop-before {
  border-top: 2px solid var(--accent) !important;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.dev-card-drop-after {
  border-bottom: 2px solid var(--accent) !important;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.dev-card-move,
.dev-card-hide {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity .15s, color .15s;
  flex-shrink: 0;
}
.dev-card-header:hover .dev-card-move,
.dev-card-header:hover .dev-card-hide { opacity: 1; }
.dev-card-move:hover { color: #4a7fb5; }
.dev-card-hide:hover { color: var(--accent); }

.dev-card-badges {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.dev-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface2);
  color: var(--text-dim);
  font-weight: 600;
  white-space: nowrap;
}

.dev-card-desc {
  padding: 10px 16px 6px;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.4;
}

.dev-card-body {
  padding: 10px 16px 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dev-alt {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface2);
  border-radius: 8px;
  border: 1px solid var(--border);
  position: relative;
}

.dev-alt-number {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-light);
  border-radius: 4px;
  padding: 2px 6px;
  flex-shrink: 0;
  margin-top: 2px;
}

.dev-alt-text {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: normal;
}

.dev-alt-text[contenteditable="true"]:focus {
  outline: none;
}

.dev-alt-text:empty::before {
  content: 'Décrivez une alternative...';
  color: var(--text-dim);
  font-style: italic;
}

.dev-alt-delete {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  padding: 0 2px;
  line-height: 1;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity .15s, color .15s;
}
.dev-alt:hover .dev-alt-delete { opacity: 1; }
.dev-alt-delete:hover { color: var(--danger); }

.dev-add-alt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  background: none;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.dev-add-alt:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

/* Hidden panel */
.dev-hidden-panel {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.dev-hidden-empty {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  padding: 8px;
}

.dev-hidden-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface2);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.dev-hidden-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
}

.dev-hidden-restore {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  transition: all .15s;
  font-family: inherit;
}
.dev-hidden-restore:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

.dev-hidden-restore-all {
  align-self: flex-end;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 6px;
  transition: all .15s;
  font-family: inherit;
  margin-top: 4px;
}
.dev-hidden-restore-all:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

/* ═══════════ Materiality View ═══════════ */
#mat-toolbar,
#mats-toolbar,
#synth-toolbar {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  gap: 12px;
  flex-wrap: wrap;
}

.mat-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
}

.mat-toolbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

#mat-progress,
#mats-progress,
#synth-progress {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  padding: 3px 10px;
  border-radius: 8px;
}

.mat-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
}
.mat-legend-item {
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 10px;
}
.mat-legend-item.neg { background: rgba(204,68,68,.2); color: #c44; }
.mat-legend-item.zero { background: var(--surface2); color: var(--text-dim); }
.mat-legend-item.pos { background: rgba(58,170,136,.2); color: #3a8; }
.mat-legend-sep { color: var(--border-strong); }
.mat-legend-keys { font-size: 11px; }

#mat-container,
#mats-container,
#synth-container {
  flex: 1;
  overflow: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  outline: none;
}

.mat-table-wrapper {
  overflow: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  flex-shrink: 0;
}

.mat-table {
  border-collapse: collapse;
  font-size: 12px;
  min-width: max-content;
}

.mat-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
}

.mat-col-header {
  padding: 8px 6px;
  min-width: 60px;
  max-width: 90px;
  vertical-align: bottom;
  border-bottom: 2px solid var(--border);
  text-align: center;
}

.mat-row-header {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  padding: 6px 10px;
  min-width: 120px;
  max-width: 180px;
  border-right: 2px solid var(--border);
  text-align: left;
}

.mat-header-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
  margin-bottom: 4px;
}

.mat-header-label {
  overflow: hidden;
}

.mat-header-box {
  font-size: 10px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mat-header-alt {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80px;
}

.mat-cell {
  width: 52px;
  height: 36px;
  text-align: center;
  vertical-align: middle;
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
  transition: all .1s;
}

.mat-active {
  cursor: pointer;
}
.mat-active:hover {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  z-index: 1;
  position: relative;
}

.mat-selected {
  outline: 3px solid var(--accent) !important;
  outline-offset: -3px;
  z-index: 2 !important;
  position: relative;
  box-shadow: 0 0 0 1px var(--accent), 0 0 12px rgba(201,100,66,.25);
}

.mat-diagonal {
  background: var(--surface2);
  color: var(--border-strong);
  cursor: default;
  font-size: 16px;
}

.mat-same-box {
  background: var(--surface2);
  color: var(--border-strong);
  cursor: default;
  font-size: 11px;
}

.mat-mirror {
  cursor: default;
}

/* Selected pair info panel */
.mat-info {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  flex-shrink: 0;
}

.mat-info-pair {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.mat-info-alt {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 6px 12px;
  background: var(--surface2);
  border-radius: 8px;
  border: 1px solid var(--border);
  flex: 1;
  min-width: 200px;
}

.mat-info-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mat-info-vs {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dim);
}

.mat-info-score {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.mat-info-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
}

.mat-score-bar {
  display: flex;
  gap: 4px;
}

.mat-score-btn {
  width: 40px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all .15s;
  font-family: inherit;
}
.mat-score-btn:hover {
  border-color: var(--accent);
  transform: scale(1.05);
}
.mat-score-btn.active {
  border-color: transparent;
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.mat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-dim);
  gap: 8px;
}
.mat-empty-icon {
  font-size: 40px;
  opacity: .4;
}
.mat-empty-text {
  font-size: 14px;
  font-weight: 500;
}
.mat-empty-hint {
  font-size: 12px;
  opacity: .7;
}

/* Best combinations panel */
.mat-combos {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  flex-shrink: 0;
}

.mat-combos-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

.mat-combos-title {
  font-weight: 700;
  font-size: 14px;
}

.mat-combos-count {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
  background: var(--surface);
  padding: 2px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.mat-combos-warn {
  padding: 16px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}

.mat-combos-list {
  display: flex;
  flex-direction: column;
}

.mat-combo-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  transition: background .15s, border-color .15s;
  border-left: 3px solid transparent;
}
.mat-combo-row:last-child { border-bottom: none; }
.mat-combo-row:hover { background: var(--surface2); }
.mat-combo-row.top { }
.mat-combo-row.bottom { opacity: 0.6; }
.mat-combo-row.synthesis {
  background: rgba(58, 170, 136, 0.06);
  border-left-color: #3aaa88;
}
.mat-combo-row.synthesis:hover {
  background: rgba(58, 170, 136, 0.1);
}

/* Checkbox for synthesis selection */
.mat-combo-select {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  cursor: pointer;
}
.mat-combo-check {
  width: 16px;
  height: 16px;
  accent-color: #3aaa88;
  cursor: pointer;
}

/* Combo body: wraps name + alts */
.mat-combo-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Name input for combo */
.mat-combo-name {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  background: transparent;
  transition: all .15s;
}
.mat-combo-name::placeholder {
  color: var(--text-dim);
  font-weight: 400;
  opacity: 0.5;
  font-style: italic;
}
.mat-combo-name:hover {
  border-color: var(--border);
  background: var(--surface);
}
.mat-combo-name:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 2px rgba(201,100,66,.12);
}

.mat-combo-rank {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  min-width: 28px;
  text-align: center;
  flex-shrink: 0;
}
.mat-combo-row.top:first-child .mat-combo-rank {
  color: var(--accent);
  font-size: 14px;
}

.mat-combo-alts {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

.mat-combo-alt {
  display: inline-flex;
  flex-direction: column;
  padding: 4px 8px;
  background: var(--surface2);
  border-radius: 6px;
  font-size: 11px;
  max-width: 160px;
  overflow: hidden;
}

.mat-combo-box {
  font-weight: 700;
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mat-combo-text {
  font-size: 11px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mat-combo-score-area {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  min-width: 140px;
}

.mat-combo-bar-bg {
  width: 80px;
  height: 8px;
  background: var(--surface2);
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}

.mat-combo-bar {
  height: 100%;
  border-radius: 4px;
  transition: width .3s;
}
.mat-combo-bar.positive { background: rgba(58, 170, 136, 0.7); }
.mat-combo-bar.negative { background: rgba(204, 68, 68, 0.7); }
.mat-combo-bar.neutral { background: var(--border-strong); }

.mat-combo-total {
  font-weight: 700;
  font-size: 14px;
  min-width: 36px;
  text-align: right;
}
.mat-combo-total.positive { color: #2a9d6e; }
.mat-combo-total.negative { color: #c44; }
.mat-combo-total.neutral { color: var(--text-dim); }

.mat-combo-coverage {
  font-size: 10px;
  color: #c96442;
  white-space: nowrap;
  flex-shrink: 0;
}

.mat-combo-separator {
  text-align: center;
  padding: 6px 16px;
  font-size: 11px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  font-style: italic;
}

.dev-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-dim);
  gap: 8px;
}
.dev-empty-icon {
  font-size: 40px;
  opacity: .4;
}
.dev-empty-text {
  font-size: 14px;
  font-weight: 500;
}
.dev-empty-hint {
  font-size: 12px;
  opacity: .7;
}

/* ═══════════ Synthesis View ═══════════ */
.synth-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-dim);
  gap: 8px;
}

.synth-table-wrapper {
  overflow: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  flex-shrink: 0;
}

.synth-table {
  border-collapse: collapse;
  font-size: 12px;
  min-width: max-content;
}

.synth-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--surface);
}

.synth-corner {
  position: sticky;
  left: 0;
  z-index: 4;
  background: var(--surface);
  min-width: 180px;
  border-right: 2px solid var(--border);
  border-bottom: 2px solid var(--border);
}

.synth-group-header {
  padding: 8px 6px 4px;
  text-align: center;
  font-weight: 700;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
  border-left: 2px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.synth-group-header.scenario {
  background: rgba(122, 108, 168, 0.06);
  border-top: 3px solid #7c6ca8;
}
.synth-group-header.objective {
  background: rgba(201, 100, 66, 0.06);
  border-top: 3px solid var(--accent);
}

.synth-group-icon {
  font-size: 11px;
  opacity: 0.6;
}

.synth-group-name {
  max-width: 140px;
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.synth-weight {
  font-size: 9px;
  color: var(--accent);
  letter-spacing: -1px;
  opacity: 0.7;
}

.synth-tf-header {
  padding: 4px 2px 6px;
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  border-bottom: 2px solid var(--border);
  min-width: 38px;
  letter-spacing: 0.5px;
}
.synth-tf-header:nth-child(3n+1) {
  border-left: 2px solid var(--border);
}

.synth-total-header {
  position: sticky;
  right: 0;
  z-index: 4;
  background: var(--surface2);
  border-left: 2px solid var(--border);
  border-bottom: 2px solid var(--border);
  padding: 8px 12px;
  font-weight: 700;
  font-size: 12px;
  text-align: center;
  min-width: 70px;
}

.synth-row-header {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface);
  padding: 8px 12px;
  min-width: 180px;
  max-width: 220px;
  border-right: 2px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.synth-row-name {
  font-weight: 600;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.synth-cell {
  width: 38px;
  height: 34px;
  text-align: center;
  vertical-align: middle;
  border: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: all .1s;
}
.synth-cell:hover {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  z-index: 1;
  position: relative;
}
.synth-cell.synth-group-start {
  border-left: 2px solid var(--border);
}

.synth-selected {
  outline: 3px solid var(--accent) !important;
  outline-offset: -3px;
  z-index: 2 !important;
  position: relative;
  box-shadow: 0 0 0 1px var(--accent), 0 0 12px rgba(201,100,66,.25);
}

.synth-total-cell {
  position: sticky;
  right: 0;
  z-index: 1;
  background: var(--surface2);
  border-left: 2px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 4px 10px;
  text-align: center;
  min-width: 70px;
}

.synth-total-val {
  font-weight: 700;
  font-size: 14px;
}
.synth-total-val.positive { color: #2a9d6e; }
.synth-total-val.negative { color: #c44; }
.synth-total-val.neutral { color: var(--text-dim); }

/* Selected cell info panel */
.synth-info {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  flex-shrink: 0;
}

.synth-info-pair {
  display: flex;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.synth-info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  padding: 6px 12px;
  background: var(--surface2);
  border-radius: 8px;
  border: 1px solid var(--border);
  flex: 1;
  min-width: 160px;
}
.synth-info-item.strat {
  border-left: 3px solid #c96442;
}
.synth-info-item.scenario {
  border-left: 3px solid #7c6ca8;
}
.synth-info-item.objective {
  border-left: 3px solid #c96442;
}

.synth-info-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
}

.synth-info-vs {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* Detail blocks inside info panel */
.synth-detail-alts {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.synth-detail-alt {
  display: inline-flex;
  flex-direction: column;
  padding: 3px 7px;
  background: var(--surface);
  border-radius: 5px;
  font-size: 10px;
  max-width: 160px;
  overflow: hidden;
}

.synth-detail-box {
  font-weight: 700;
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.synth-detail-text {
  font-size: 10px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.synth-detail-obj {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.synth-detail-stars {
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--accent);
}

.synth-detail-desc {
  font-size: 11px;
  color: var(--text-dim);
  font-style: italic;
  line-height: 1.3;
}

.synth-info-tf {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.synth-tf-btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-dim);
  cursor: pointer;
  transition: all .15s;
}
.synth-tf-btn:hover {
  border-color: var(--accent);
}
.synth-tf-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.synth-info-score {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.synth-info-score-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
}

/* Ranking panel */
.synth-ranking {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  flex-shrink: 0;
}

.synth-ranking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

.synth-ranking-title {
  font-weight: 700;
  font-size: 14px;
}

.synth-ranking-hint {
  font-size: 11px;
  color: var(--text-dim);
  font-style: italic;
}

.synth-ranking-list {
  display: flex;
  flex-direction: column;
}

.synth-ranking-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.synth-ranking-row:last-child { border-bottom: none; }
.synth-ranking-row:hover { background: var(--surface2); }
.synth-ranking-row.first {
  background: rgba(58, 170, 136, 0.05);
}

.synth-ranking-medal {
  font-size: 18px;
  min-width: 32px;
  text-align: center;
  flex-shrink: 0;
}

.synth-ranking-name {
  font-weight: 600;
  font-size: 13px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.synth-ranking-bar-area {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  min-width: 180px;
}

.synth-ranking-coverage {
  font-size: 10px;
  color: #c96442;
  white-space: nowrap;
  flex-shrink: 0;
}

.synth-ranking-bar-bg {
  width: 100px;
  height: 10px;
  background: var(--surface2);
  border-radius: 5px;
  overflow: hidden;
  flex-shrink: 0;
}

.synth-ranking-bar {
  height: 100%;
  border-radius: 5px;
  transition: width .3s;
}
.synth-ranking-bar.positive { background: rgba(58, 170, 136, 0.7); }
.synth-ranking-bar.negative { background: rgba(204, 68, 68, 0.7); }
.synth-ranking-bar.neutral { background: var(--border-strong); }

.synth-ranking-total {
  font-weight: 700;
  font-size: 16px;
  min-width: 45px;
  text-align: right;
}
.synth-ranking-total.positive { color: #2a9d6e; }
.synth-ranking-total.negative { color: #c44; }
.synth-ranking-total.neutral { color: var(--text-dim); }

/* ═══════════ Evolution Chart ═══════════ */
.synth-chart {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-top: 16px;
}

.synth-chart-header {
  margin-bottom: 12px;
}

.synth-chart-svg {
  width: 100%;
  max-width: 650px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.synth-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.synth-chart-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.synth-chart-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ═══════════ Language Toggle ═══════════ */
.btn-lang {
  background: transparent;
  border: 1px solid rgba(255,255,255,.25);
  color: rgba(255,255,255,.85);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.btn-lang:hover {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.4);
}

/* ═══════════ Collaboration ═══════════ */

/* Nav button */
#btn-collab {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid rgba(255,255,255,.25);
  color: rgba(255,255,255,.85);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s;
}
#btn-collab:hover {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.4);
}
#btn-collab.collab-active {
  background: rgba(58, 170, 136, 0.25);
  border-color: rgba(58, 170, 136, 0.6);
  color: #6ee7b7;
}

.collab-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.collab-indicator.off { background: rgba(255,255,255,.3); }
.collab-indicator.ok { background: #3a8; animation: collab-pulse 2s infinite; }
.collab-indicator.error { background: #c44; }

@keyframes collab-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}

/* Users avatars in nav */
.collab-users {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-right: 4px;
}
.collab-user { display: flex; }
.collab-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.3);
  cursor: default;
}

/* Dialog overrides */
.collab-dialog-content {
  min-width: 340px;
  max-width: 400px;
}
.collab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.collab-header h3 { margin: 0; }
.collab-close-btn {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-dim);
  padding: 0 4px;
  line-height: 1;
}
.collab-close-btn:hover { color: var(--text); }

.collab-join-section label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 14px;
}
.collab-join-section label input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
}
.collab-join-section label input:focus {
  outline: none;
  border-color: var(--accent);
}

.collab-actions-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.collab-or {
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
}
.collab-join-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.collab-join-row input {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}
.collab-join-row input:focus {
  outline: none;
  border-color: var(--accent);
}

.collab-btn-primary {
  background: var(--accent);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s;
}
.collab-btn-primary:hover { background: var(--accent-hover); }

.collab-btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
}
.collab-btn-secondary:hover {
  background: var(--border);
}

.collab-btn-danger {
  background: rgba(204, 68, 68, 0.1);
  color: #c44;
  border: 1px solid rgba(204, 68, 68, 0.3);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
}
.collab-btn-danger:hover {
  background: rgba(204, 68, 68, 0.2);
}

/* Connected section */
.collab-connected-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.collab-room-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface2);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.collab-room-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
}
.collab-room-code {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 2px;
  font-family: 'Courier New', monospace;
  color: var(--accent);
  user-select: all;
}

.collab-status {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 8px;
  min-height: 16px;
}

/* Remote cursors */
.collab-cursor {
  position: fixed;
  z-index: 99999;
  pointer-events: none;
  transition: left 80ms linear, top 80ms linear, opacity .4s;
  opacity: 1;
}
.collab-cursor-fading {
  opacity: 0.25;
}
.collab-cursor-pointer {
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.25));
}
.collab-cursor-label {
  position: absolute;
  left: 14px;
  top: 14px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  font-family: inherit;
  color: white;
  white-space: nowrap;
  line-height: 1.4;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}

/* Remote cell selection highlights */
.collab-cell-highlight {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 4px;
  z-index: 5;
  animation: collab-cell-pop .25s ease-out;
}
@keyframes collab-cell-pop {
  0% { opacity: 0; transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1); }
}
.collab-cell-label {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  color: white;
  white-space: nowrap;
  line-height: 1.3;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  pointer-events: none;
  z-index: 6;
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE — Mobile (<600px)
   ═══════════════════════════════════════════════════════ */
@media (max-width: 600px) {

  /* ── Nav ── */
  #main-nav {
    flex-wrap: wrap;
    height: auto;
    padding: 6px 8px;
    gap: 4px;
  }
  .nav-brand {
    font-size: 13px;
    padding-right: 8px;
  }
  .nav-tabs {
    order: 3;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 0;
    padding-bottom: 2px;
  }
  .nav-tabs::-webkit-scrollbar { display: none; }
  .nav-tab {
    padding: 6px 10px;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .nav-right {
    gap: 4px;
    margin-left: auto;
  }
  .nav-right button {
    padding: 4px 6px;
    font-size: 11px;
  }
  /* Hide text labels in nav-right, keep icons */
  .nav-right button span[data-i18n] { display: none; }
  .btn-lang { font-size: 11px !important; padding: 4px 6px !important; }

  /* ── Toolbars ── */
  #toolbar {
    flex-wrap: wrap;
    padding: 6px 8px;
    gap: 4px;
  }
  .toolbar-group {
    gap: 3px;
    padding-right: 6px;
  }
  #toolbar button {
    padding: 5px 8px;
    font-size: 11px;
  }

  /* ── Objectives ── */
  #obj-toolbar {
    flex-wrap: wrap;
    padding: 8px 12px;
    gap: 8px;
  }
  #obj-container {
    padding: 12px;
  }
  .obj-card {
    padding: 14px;
  }

  /* ── Dev columns → stack vertically ── */
  .dev-columns {
    flex-direction: column;
    gap: 12px;
  }
  .dev-column-header {
    padding: 10px 12px;
  }
  .dev-column-title { font-size: 13px; }
  .dev-alt-text { font-size: 12px; }
  #dev-toolbar {
    flex-wrap: wrap;
    padding: 8px 12px;
    gap: 6px;
  }

  /* ── Materiality / Synthesis toolbars ── */
  #mat-toolbar, #mats-toolbar, #synth-toolbar, .mat-toolbar-shared {
    flex-wrap: wrap;
    padding: 8px 10px;
    gap: 6px;
  }
  .mat-subtitle {
    font-size: 11px;
    width: 100%;
  }
  .mat-toolbar-right {
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
  }
  .mat-legend { font-size: 10px; }
  .mat-legend-keys { display: none; }

  /* ── Mat/Synth tables — scroll with compact cells ── */
  .mat-table-wrapper, .synth-table-wrapper {
    border-radius: 8px;
    margin: 0 4px;
  }
  .mat-table, .synth-table { font-size: 11px; }
  .mat-cell, .synth-cell { min-width: 32px; padding: 4px; }
  .mat-row-header, .mat-col-header { padding: 4px 6px; }
  .mat-header-box { font-size: 9px; }
  .mat-header-alt { font-size: 10px; max-width: 70px; }

  .synth-row-header { min-width: 100px; max-width: 120px; }
  .synth-col-header { min-width: 50px; }
  .synth-row-name, .synth-col-name { font-size: 10px; }

  /* ── Combo rows ── */
  .mat-combos { padding: 10px; }
  .mat-combo-row { padding: 8px; }
  .mat-combo-alt { font-size: 10px; padding: 3px 6px; }
  .mat-combo-box { font-size: 8px; }
  .mat-combo-text { font-size: 10px; }
  .mat-combo-name { font-size: 11px; }
  .mat-combo-check-label { font-size: 10px; }

  /* ── Dialogs — full width on mobile ── */
  .dialog-content, .collab-dialog-content {
    min-width: 0;
    max-width: calc(100vw - 32px);
    width: calc(100vw - 32px);
    padding: 16px;
    border-radius: 12px;
  }
  .dialog-content h3 { font-size: 15px; }

  /* ── Legend panel ── */
  .legend-panel {
    min-width: 150px;
    max-width: 200px;
    padding: 8px 10px;
  }
  .legend-item-input { font-size: 11px; padding: 3px 6px; }

  /* ── Filter panel ── */
  .filter-panel {
    min-width: 180px;
    max-width: calc(100vw - 40px);
    right: -8px;
  }
  .filter-item { font-size: 12px; }

  /* ── Synth chart ── */
  .synth-chart { padding: 10px; }
  .synth-chart-legend { flex-wrap: wrap; gap: 6px; }
  .synth-chart-legend-item { font-size: 10px; }

  /* ── Toast ── */
  #toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
    transform: none;
    text-align: center;
  }

  /* ── Map panel ── */
  #map-panel {
    width: 100% !important;
    max-width: 100%;
    right: 0;
    border-radius: 0;
  }

  /* ── Collab ── */
  .collab-join-section label { font-size: 12px; }
  .collab-room-code { font-size: 14px; }
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE — Tablet (600px–900px)
   ═══════════════════════════════════════════════════════ */
@media (min-width: 601px) and (max-width: 900px) {

  #main-nav {
    flex-wrap: wrap;
    height: auto;
    padding: 6px 12px;
  }
  .nav-tabs {
    order: 3;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .nav-tabs::-webkit-scrollbar { display: none; }
  .nav-tab {
    padding: 8px 12px;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .nav-right button span[data-i18n] { display: none; }

  #toolbar {
    flex-wrap: wrap;
    gap: 4px;
  }

  #mat-toolbar, #mats-toolbar, #synth-toolbar, .mat-toolbar-shared {
    flex-wrap: wrap;
  }
  .mat-legend-keys { display: none; }
}
