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

/* Theme tokens — the Vector brand red, status colors and the gray ramp used
   across the UI. Theming/rebranding means editing these, not a find-replace.
   Note on the text ramp: the smallest text in this UI is 11px, so even the
   most muted text color must keep a >=4.5:1 contrast ratio (WCAG AA) against
   both the white page and the --bg-panel cards — that is why --text-muted is
   #666 and nothing lighter. */
:root {
  --brand: #CC003D;
  --brand-hover: #e00044;
  --brand-bg-soft: #fde8e8;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --success: #16a34a;
  --warning: #f59e0b;
  --warning-hover: #d97706;
  --text: #333333;
  --text-strong: #444444;
  --text-soft: #555555;
  --text-muted: #666666;
  --bg-page: #ffffff;
  --bg-panel: #f5f5f5;
  --bg-control: #e8e8e8;
  --bg-control-hover: #d0d0d0;
  --border: #e0e0e0;
  --border-soft: #eeeeee;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #ffffff;
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

.app {
  max-width: none;
  margin: 0;
  padding: 12px 16px;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 4px 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
  flex: 0 0 auto;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  height: 28px;
  width: auto;
}

header h1 {
  font-size: 20px;
  color: #000000;
  font-weight: 700;
}

.main-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(300px, 34%) 1fr;
  gap: 14px;
}

/* Left column: car widget on top, API log filling the space below it. */
.visual-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  min-width: 0;
}

/* Vehicle Panel — its own widget. The aspect-ratio matches the artwork so the
   car fills it with no empty space; the JS ResizeObserver sets the scale. */
.vehicle-panel {
  position: relative;
  overflow: hidden;
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 1080 / 654;
  max-height: 50vh;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  min-width: 0;
  background: #fafafa;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
}

.vehicle-container {
  position: relative;
  width: 1080px;
  height: 654px;
  flex: 0 0 auto;
  transform-origin: center center;
  transform: scale(var(--vehicle-scale, 0.5));
}

.base-image {
  width: 1080px;
  height: 654px;
  display: block;
}

.sprite-overlay {
  position: absolute;
  overflow: hidden;
  pointer-events: none;
}

.sprite-inner {
  will-change: transform;
  backface-visibility: hidden;
}

/* Light Left: 390x3696, 12 vertical frames, frame=390x308 */
.light-left {
  left: 295px;
  top: 232px;
  width: 390px;
  height: 308px;
}

.light-left .sprite-inner {
  width: 390px;
  height: 3696px;
  background: url('images/front_light_left_11states.png') no-repeat;
  background-size: 390px 3696px;
}

/* Light Right: 252x3696, 12 vertical frames, frame=252x308 */
.light-right {
  left: 685px;
  top: 232px;
  width: 252px;
  height: 308px;
}

.light-right .sprite-inner {
  width: 252px;
  height: 3696px;
  background: url('images/front_light_right_11states.png') no-repeat;
  background-size: 252px 3696px;
}

/* Window Left: individual frame images, 72x103 each */
.window-left {
  left: 283px;
  top: 153px;
  width: 72px;
  height: 103px;
}

/* Wiper: 432x3672, 27 vertical frames, frame=432x136 */
.wiper {
  left: 363px;
  top: 160px;
  width: 432px;
  height: 136px;
}

.wiper .sprite-inner {
  width: 432px;
  height: 3672px;
  background: url('images/front_wiper_26states.png') no-repeat;
  background-size: 432px 3672px;
}

/* Splash overlay: 413x160, single image */
.splash {
  left: 373px;
  top: 150px;
  width: 413px;
  height: 160px;
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
}

.splash.active {
  opacity: 1;
}

/* Control Panel — responsive multi-column dashboard grid. Sections flow into
   as many columns as fit; the panel scrolls internally if content exceeds the
   viewport so the car and header stay put. */
.control-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  min-height: 0;
  padding-right: 4px;
  align-content: start;
}

/* Views: only the active group is shown. Redundant in-panel group titles are
   hidden because the sidebar item already names the view. */
.panel-group {
  display: none;
}

.panel-group.active {
  display: block;
}

.panel-group-title {
  display: none;
}

/* The card grid inside each group. `auto-fit` (not `auto-fill`) collapses
   unused tracks so a lone card grows into the free desktop width instead of
   sitting in one narrow track. Small cards are capped below so a lone form
   doesn't stretch across the whole view; wide (1/-1) cards deliberately do.
   `align-items: start` keeps each card at its natural height. */
.panel-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  grid-auto-flow: row dense;
  align-items: start;
  column-gap: 10px;
  row-gap: 10px;
}

.panel-group-grid > .control-section:not(.wide-section) {
  max-width: 560px;
}

.control-section {
  background: var(--bg-panel);
  border-radius: 8px;
  padding: 16px;
  border: 1px solid var(--border);
  min-width: 0; /* grid item: never let a wide child stretch the card */
}

/* One dropdown look across every panel. Individual widgets keep only their
   layout rules (flex / width / min-width); the visual treatment — border,
   radius, padding, colours, size — lives here so all selects match. */
.control-section select {
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  font-size: 13px;
}

/* Content-heavy widgets (multi-row inputs, long release notes, log tables)
   take the full grid row. Every `wide` panel shares its view only with other
   wide panels, so 1/-1 never steals space from a small neighbour — and it
   degrades to the single track on narrow screens without a media query. */
.wide-section {
  grid-column: 1 / -1;
}

.control-section h2 {
  font-size: var(--font-lg);
  color: var(--brand);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  /* Narrow cards can't always fit title + clause badge + (i) on one line.
     Wrapping drops the badge/(i) to a second row; without it the flex line
     overflows the card border. */
  flex-wrap: wrap;
  row-gap: 4px;
  justify-content: space-between;
  align-items: center;
}

.hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-style: italic;
}

.lock-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* .lock-controls select: visual styling comes from the shared
   `.control-section select` rule; no layout overrides needed. */

/* Buttons */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Toggle Controls — auto-fit so toggle+label always fit on one line: two-up in
   a wide card, stacked in a narrow one, never overflowing. */
.light-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(125px, 1fr));
  gap: 8px;
}

.toggle-control {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #ffffff;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
  border: 1px solid var(--border);
}

.toggle-control:hover {
  background: #fafafa;
}

.toggle-control input[type="checkbox"] {
  appearance: none;
  width: 36px;
  height: 20px;
  background: #cccccc;
  border-radius: 10px;
  position: relative;
  cursor: pointer;
  transition: background 0.3s;
  flex-shrink: 0;
}

.toggle-control input[type="checkbox"]::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: #ffffff;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: all 0.3s;
}

.toggle-control input[type="checkbox"]:checked {
  background: var(--brand);
}

.toggle-control input[type="checkbox"]:checked::after {
  background: #ffffff;
  left: 18px;
}

.toggle-label {
  font-size: 13px;
  color: var(--text);
}

/* Window Controls */
.window-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.window-position {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin-top: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 3px;
  transition: width 0.1s linear;
  width: 0%;
}

/* Wiper & Washer */
.wiper-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wiper-speed-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wiper-speed-row label {
  font-size: 12px;
  font-weight: 600;
  min-width: 45px;
}

.wiper-speed-row select {
  flex: 1;
}

.washer-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.washer-row label {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.splash-duration-input {
  width: 60px;
  padding: 3px 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 11px;
  text-align: right;
}

.update-progress-container {
  margin-top: 4px;
}

.update-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.update-controls select {
  flex: 1;
  min-width: 0;
}

.update-info {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
  white-space: pre-line;
  line-height: 1.4;
}

.update-phase {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.update-step {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.update-progress-bar {
  height: 10px;
  border-radius: 5px;
}

.update-percent {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  margin-top: 2px;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.fault-env {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.fault-controls {
  display: block;
}

/* Fault injection controls */
.fault-inject-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.fault-dtc-input {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--bg-control-hover);
  border-radius: 6px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 13px;
}

.fault-ff-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-soft);
  white-space: nowrap;
}

/* API fault-injection numeric inputs share the row width evenly. */
.afi-num-input {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--bg-control-hover);
  border-radius: 6px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 13px;
}

/* Lock & execution behavior knobs: stacked toggles + labelled number inputs. */
.lx-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-soft);
  margin-bottom: 8px;
  cursor: pointer;
}
.lx-toggle input[type="checkbox"] {
  flex: 0 0 auto;
}
.lx-toggle em {
  color: var(--text-muted);
  font-style: italic;
}
.lx-num-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
  font-size: 11px;
  color: var(--text-muted);
}

/* Scenario snapshot: preset buttons wrap into a chip row. */
.scenario-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.scenario-preset-btn {
  flex: 0 0 auto;
  padding: 6px 12px;
  border: 1px solid #c9c9c9;
  border-radius: 14px;
  background: #f6f6f6;
  font-size: 12px;
  cursor: pointer;
}
.scenario-preset-btn:hover {
  background: #eaeaea;
  border-color: #b0b0b0;
}

/* A disabled injection rule is dimmed but still listed. */
.fault-entry.afi-disabled {
  opacity: 0.55;
  background: #f6f6f6;
  border-color: #ddd;
}

/* Active-fault list */
.fault-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.fault-entry {
  padding: 8px 10px;
  background: #fff7f7;
  border: 1px solid #f0caca;
  border-radius: 6px;
}

.fault-entry-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fault-entry-dtc {
  font-family: 'Consolas', 'Courier New', monospace;
  font-weight: 600;
  color: var(--danger-hover);
}

.fault-entry-comp {
  font-size: 11px;
  color: var(--text-muted);
  flex: 1;
}

.fault-entry-clear {
  padding: 2px 10px;
  font-size: 12px;
}

.fault-entry-name {
  font-size: 12px;
  color: var(--text-strong);
  margin-top: 2px;
}

/* Identification Data */
.ident-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ident-controls select {
  width: 100%;
}

.ident-input {
  flex: 1;
  min-width: 0;
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 6px;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  font-size: 13px;
}

.ident-textarea {
  min-height: 32px;
  max-height: 120px;
  resize: vertical;
  line-height: 1.4;
}

.ident-input:read-only {
  background: var(--bg-panel);
  color: var(--text-muted);
}

.ident-input:focus {
  outline: none;
  border-color: var(--brand);
}

/* API Log — fills the space beneath the car widget in the visual column. */
.log-section {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.api-log {
  flex: 1;
  background: #ffffff;
  border-radius: 6px;
  padding: 8px;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  font-size: 11px;
  overflow-y: auto;
  min-height: 80px;
  line-height: 1.5;
  border: 1px solid var(--border);
}

.log-entry {
  padding: 2px 0;
  border-bottom: 1px solid #f0f0f0;
}

.log-method {
  font-weight: 700;
  margin-right: 4px;
}

.log-method.GET { color: var(--success); }
.log-method.POST { color: #2563eb; }
.log-method.PUT { color: var(--warning-hover); }
.log-method.DELETE { color: var(--danger); }

.log-status { color: var(--text-muted); }
.log-status.ok { color: var(--success); }
.log-status.error { color: var(--danger); }

.log-time { color: var(--text-muted); }

/* Responsive layout reflow. The car's scale is handled by JS (ResizeObserver),
   so these breakpoints only change how the cells are arranged. */

/* Narrower desktops: give the car a bit less width. */
@media (max-width: 1100px) {
  .main-layout {
    grid-template-columns: minmax(280px, 34%) 1fr;
  }
}

/* Tablet / small windows: stack car on top, controls below, allow page scroll. */
@media (max-width: 860px) {
  body {
    height: auto;
    overflow: auto;
  }
  .app {
    height: auto;
    min-height: 100vh;
  }
  .main-layout {
    grid-template-columns: 1fr;
    grid-auto-rows: min-content;
  }
  .vehicle-panel {
    max-height: none; /* let the aspect-ratio fill the full width */
  }
  .control-panel {
    overflow: visible;
  }
}

/* API endpoints panel */
.api-endpoints-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Two-line entries: label on top, URL + copy button below so the label costs
   no horizontal space. Long URLs are ellipsized; the title attribute shows
   the full URL on hover. */
.api-endpoint-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 10px;
  padding: 5px 0;
}

.api-endpoint-label {
  grid-column: 1 / -1;
  font-size: 13px;
  color: var(--text-muted);
}

.api-endpoint-url {
  min-width: 0;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  font-size: 12.5px;
  color: var(--brand);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.api-endpoint-url:hover {
  text-decoration: underline;
}

.api-endpoint-copy {
  padding: 2px 10px;
  font-size: 11px;
}

/* Security Level */
.security-level-buttons {
  display: flex;
  gap: 6px;
}

.sl-btn {
  flex: 1;
  min-width: 0;
  padding-left: 4px;
  padding-right: 4px;
  background: var(--bg-panel);
  color: var(--brand);
  border: 1px solid var(--brand);
}

.sl-btn:hover:not(:disabled) {
  background: var(--brand-bg-soft);
}

.sl-btn.active {
  background: var(--brand);
  color: #ffffff;
}

.sl-btn.active:hover:not(:disabled) {
  background: var(--brand);
}

/* Logs viewer */
.logs-controls { display: flex; gap: 6px; margin-bottom: 8px; }
.logs-controls select { flex: 1; min-width: 0; }
.sovdlog-list {
  max-height: 320px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 4px;
}
.sovdlog-entry { display: flex; gap: 8px; padding: 3px 6px; border-bottom: 1px solid #f3f3f3; align-items: baseline; }
.sovdlog-sev { text-transform: uppercase; font-weight: 700; min-width: 44px; }
.sovdlog-ctx { color: var(--text-muted); min-width: 88px; }
.sovdlog-ts { color: var(--text-muted); }
.sovdlog-msg { flex: 1; }
.sovdlog-warn .sovdlog-sev { color: #b8860b; }
.sovdlog-error .sovdlog-sev, .sovdlog-fatal .sovdlog-sev { color: var(--brand); }
.sovdlog-info .sovdlog-sev { color: #2e7d32; }
.sovdlog-debug .sovdlog-sev { color: var(--text-muted); }

/* Communication logs (bus tracing) */
/* An (i) info trigger inside the panel heading opens an explainer modal, keeping
   the long help text out of the panel. It sits at the right edge of the heading
   — mirroring the API-log "Clear" button. */
.control-section h2 .info-icon {
  margin-left: auto;
}
.info-icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--brand);
  background: transparent;
  color: var(--brand);
  font-size: 11px;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, 'Times New Roman', serif;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, color 0.15s;
}
.info-icon:hover,
.info-icon:focus-visible {
  background: var(--brand);
  color: #fff;
}

/* Visible keyboard-focus indicators (WCAG 2.4.7). :focus-visible keeps the
   outlines away from mouse clicks while making keyboard focus unmistakable. */
.info-icon:focus-visible,
.toggle-control input[type="checkbox"]:focus-visible,
.btn:focus-visible,
.help-close:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.comlog-controls { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; align-items: center; }
.comlog-controls select { flex: 0 0 auto; min-width: 0; }
.comlog-channels-input {
  flex: 1 1 140px;
  min-width: 0;
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  font-size: 13px;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
}
.comlog-channels-input:focus {
  outline: none;
  border-color: var(--brand);
}
.comlog-stream-label { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.comlog-list {
  max-height: 320px;
  overflow-y: auto;
  font-size: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 4px;
}
.comlog-empty { padding: 8px; color: var(--text-muted); font-style: italic; }
.comlog-entry {
  display: flex;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid #f3f3f3;
  align-items: center;
}
.comlog-status-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; background: #bbb; }
.comlog-status-dot.active { background: #2e7d32; box-shadow: 0 0 4px #2e7d32; }
.comlog-status-dot.inactive { background: #bbb; }
.comlog-id { font-family: monospace; color: var(--text); flex: 0 0 auto; }
.comlog-badges { color: var(--text-muted); flex: 1 1 auto; }
.comlog-actions { display: flex; gap: 4px; flex: 0 0 auto; }
.comlog-actions .btn { padding: 3px 8px; font-size: 11px; }

/* Live stream viewer */
.comlog-viewer { margin-top: 8px; border: 1px solid #ddd; border-radius: 4px; overflow: hidden; }
.comlog-viewer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 8px; background: #f6f6f6; border-bottom: 1px solid var(--border-soft);
  font-size: 12px; color: var(--text);
}
.comlog-viewer-head .btn { padding: 3px 8px; font-size: 11px; }
.comlog-viewer-body {
  margin: 0; padding: 8px 10px;
  /* Fixed height (not max-height): the space is reserved up front so streaming
     frames scroll inside the box instead of growing the widget. */
  height: 200px; overflow: auto; overscroll-behavior: contain;
  font-family: 'Cascadia Code', 'Fira Code', monospace; font-size: 11.5px;
  line-height: 1.65; color: #cfd8cf; background: #0c0c0c;
}
.comlog-line {
  white-space: pre;               /* keep the trace columns aligned */
  padding: 1px 0;
}
.comlog-line:nth-child(even) { background: rgba(255, 255, 255, 0.035); }
/* The trailing "; signal=value" comment is the human-readable part — brighten it
   and mute the raw CAN bytes so the eye lands on what the frame means. */
.comlog-line-note { color: #7ee787; font-weight: 600; }
.comlog-line.system { color: #f0a35e; font-style: italic; }

/* Login badge (header, login mode only) */
.login-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-right: var(--space-2);
  font-size: 0.9rem;
}

/* Header action buttons (reset + help) */
.header-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Global "Reset demo" button (header) */
.btn-reset-demo {
  flex: 0 0 auto;
  background: var(--bg-panel);
  color: var(--brand);
  border: 1px solid var(--brand);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-reset-demo:hover:not(:disabled) {
  background: var(--brand-bg-soft);
}

.btn-reset-icon {
  font-size: 15px;
  line-height: 1;
}

/* Confirmation modal: intro + itemized "what gets deleted" list + actions */
.confirm-lead {
  font-size: 14px;
  color: var(--text-strong);
  line-height: 1.6;
  margin-bottom: 12px;
}

.confirm-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 16px;
  padding: 14px 16px;
  background: #fdf2f4;
  border: 1px solid #f3c9d3;
  border-radius: 8px;
}

.confirm-list li {
  position: relative;
  padding-left: 20px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}

.confirm-list li::before {
  content: "×";
  position: absolute;
  left: 0;
  top: -1px;
  color: var(--danger);
  font-weight: 700;
}

.confirm-note {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* How-it-works help button (header) */
.btn-help {
  flex: 0 0 auto;
  background: var(--brand);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-help:hover {
  background: var(--brand-hover);
}

.btn-help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  font-weight: 700;
  font-size: 12px;
  line-height: 1;
}

/* How-it-works manual overlay */
.help-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.5);
}

.help-overlay[hidden] {
  display: none;
}

.help-modal {
  background: #ffffff;
  border-radius: 12px;
  max-width: 720px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.help-modal-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-soft);
}

.help-modal-header h2 {
  font-size: 18px;
  color: #000000;
  font-weight: 700;
}

.help-close {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.2s;
}

.help-close:hover {
  color: var(--brand);
}

.help-modal-body {
  overflow-y: auto;
  padding: 20px 24px 24px;
}

.help-intro {
  font-size: 14px;
  color: var(--text-strong);
  line-height: 1.6;
  margin-bottom: 18px;
}

.help-steps {
  list-style: none;
  counter-reset: help-step;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 22px;
}

.help-steps li {
  counter-increment: help-step;
  position: relative;
  padding-left: 44px;
}

.help-steps li::before {
  content: counter(help-step);
  position: absolute;
  left: 0;
  top: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand);
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.help-steps h3 {
  font-size: 14px;
  color: #000000;
  font-weight: 700;
  margin-bottom: 4px;
  padding-top: 5px;
}

.help-steps p {
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.6;
}

.help-modal-body code {
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  font-size: 12px;
  background: var(--bg-panel);
  color: var(--brand);
  padding: 1px 5px;
  border-radius: 4px;
}

.help-explorer {
  background: #fafafa;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 16px 18px;
}

.help-explorer h3 {
  font-size: 14px;
  color: var(--brand);
  font-weight: 700;
  margin-bottom: 6px;
}

.help-explorer p {
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.6;
}

.help-explorer-link {
  display: inline-block;
  margin: 12px 0 4px;
  padding: 8px 16px;
  background: var(--brand);
  color: #ffffff;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s;
}

.help-explorer-link:hover {
  background: var(--brand-hover);
}

.help-explorer-hint {
  margin-top: 8px;
  font-size: 12px !important;
  color: var(--text-muted) !important;
  font-style: italic;
}
