/* ==========================================
   AD STUDIO - Jet Black Interface
   ========================================== */

:root {
  /*
   * Surface Hierarchy - Jet Black
   * Clear luminance steps for visual separation
   * L0 → L5 → L9 → L14 → L18
   */
  --bg-base: #000000;
  --bg-secondary: #0d0d0d;
  --bg-tertiary: #171717;
  --bg-elevated: #242424;

  /* Neomorphic surfaces */
  --surface-raised: #1c1c1c;
  --surface-inset: #030303;

  /*
   * Borders - Edge definition on black
   * Slightly stronger for visibility
   */
  --border: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.12);
  --border-subtle: rgba(255, 255, 255, 0.05);

  /*
   * Text Hierarchy - WCAG AA compliant
   * All meet 4.5:1 on dark surfaces except muted (decorative only)
   */
  --text-primary: #f5f5f5;
  --text-secondary: #a3a3a3;
  --text-tertiary: #737373;
  --text-muted: #525252;

  /* Accent - brand blue */
  --accent: #0033ff;
  --accent-muted: rgba(0, 51, 255, 0.20);
  --accent-subtle: rgba(0, 51, 255, 0.10);

  /* Status */
  --success: #22c55e;
  --error: #ef4444;

  /* Layout */
  --panel-width: 280px;
  --toolbar-height: 52px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Transitions */
  --transition-fast: 0.1s ease;
  --transition-base: 0.15s ease;
  --transition-slow: 0.2s ease-out;

  /*
   * Shadows - Enhanced for jet black
   * Stronger top highlights since shadows vanish into black
   */
  --shadow-raised:
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 2px 4px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --shadow-inset:
    inset 0 2px 4px rgba(0, 0, 0, 0.7),
    inset 0 0 0 1px rgba(0, 0, 0, 0.4);
  --shadow-button:
    0 1px 2px rgba(0, 0, 0, 0.6),
    0 3px 6px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --shadow-button-active:
    inset 0 2px 4px rgba(0, 0, 0, 0.5);
  --shadow-knob:
    0 2px 4px rgba(0, 0, 0, 0.5),
    0 4px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 1px rgba(255, 255, 255, 0.25),
    inset 0 -1px 1px rgba(0, 0, 0, 0.2);
  --shadow-knob-active:
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 2px 4px rgba(0, 0, 0, 0.3),
    inset 0 1px 1px rgba(255, 255, 255, 0.15),
    inset 0 -1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg:
    0 4px 16px rgba(0, 0, 0, 0.6),
    0 12px 32px rgba(0, 0, 0, 0.5);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================
   TOOLBAR
   ========================================== */
.toolbar {
  height: var(--toolbar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  position: relative;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toolbar-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Demo Mode Badge */
.demo-badge {
  padding: 4px 10px;
  background: var(--accent-subtle);
  border: 1px solid var(--accent-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-base);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
}

.demo-badge:hover {
  background: var(--accent-muted);
  border-color: var(--accent);
}

.demo-badge.hidden {
  display: none;
}

/* Navigation Tabs - absolutely centered */
.toolbar-nav {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--surface-inset);
  padding: 3px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-inset);
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  padding: 6px 14px;
  border-radius: calc(var(--radius-sm) - 2px);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.nav-btn:hover {
  color: var(--text-secondary);
}

.nav-btn.active {
  background: var(--surface-raised);
  color: var(--text-primary);
  box-shadow: var(--shadow-button);
}



/* Toolbar Buttons */
.toolbar-btn {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-button);
}

.toolbar-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--border-light);
  color: var(--text-primary);
}

.toolbar-btn:active {
  box-shadow: var(--shadow-button-active);
  transform: translateY(1px);
}

.toolbar-btn.primary {
  background: var(--accent);
  border-color: transparent;
  color: white;
  font-weight: 600;
}

.toolbar-btn.primary:hover {
  filter: brightness(1.15);
}

.toolbar-btn.primary:active {
  filter: brightness(0.85);
}

/* ==========================================
   LAYOUT
   ========================================== */
.main-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.tab-content {
  display: none;
  flex: 1;
  overflow: hidden;
}

.tab-content.active {
  display: flex;
  flex-direction: column;
}

/* ==========================================
   PANELS
   ========================================== */
.panel {
  width: var(--panel-width);
  min-width: var(--panel-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel.right {
  border-right: none;
  border-left: 1px solid var(--border-subtle);
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* Scrollbar overlays content instead of taking space */
.panel-content {
  scrollbar-width: none; /* Firefox */
}

.panel-content::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

/* Flex variant for left panel - style section grows to fill space */
.panel-content-flex {
  display: flex;
  flex-direction: column;
}

.section-flex {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.section-body-flex {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.style-prompt-flex {
  flex: 1;
  min-height: 120px;
  resize: none;
}

/* ==========================================
   SECTIONS
   ========================================== */
.section {
  border-bottom: 1px solid var(--border-subtle);
}

.section:last-child {
  border-bottom: none;
}

.section-header {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-fast);
}

.section-header:hover {
  background: rgba(255, 255, 255, 0.02);
}

.section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.section-hint {
  font-size: 9px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  background: var(--surface-inset);
  border-radius: 3px;
  margin-left: 8px;
}

.section-toggle {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: transform var(--transition-base);
  margin-left: auto;
}

.section.collapsed .section-toggle {
  transform: rotate(-90deg);
}

.section-body {
  padding: 8px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-note {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0;
  font-style: italic;
}

.section.collapsed .section-body {
  display: none;
}

/* Growable sections for textareas */
.section.grow {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.section.grow .section-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.section.grow textarea {
  flex: 1;
  min-height: 100px;
}

/* ==========================================
   INPUTS
   ========================================== */
input[type="text"],
input[type="number"],
select,
textarea {
  background: var(--surface-inset);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  width: 100%;
  box-shadow: var(--shadow-inset);
}

input[type="text"]:hover,
input[type="number"]:hover,
select:hover,
textarea:hover {
  border-color: var(--border);
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-inset), 0 0 0 2px var(--accent-muted);
}

input[type="number"] {
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%23737373' d='M2 3.5L5 7L8 3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.text-input {
  font-size: 13px;
  padding: 10px 12px;
}

/* Property Rows */
.prop-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.prop-label {
  font-size: 11px;
  color: var(--text-tertiary);
  min-width: 70px;
  flex-shrink: 0;
}

.prop-value {
  flex: 1;
  min-width: 0;
}

.prop-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* ==========================================
   SIZE PRESETS
   ========================================== */
.size-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.size-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-inset);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
  text-align: left;
  box-shadow: var(--shadow-inset);
}

.size-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--border);
}

.size-btn.active {
  background: var(--surface-raised);
  border-color: var(--accent-muted);
  box-shadow: var(--shadow-button), 0 0 0 1px var(--accent-subtle);
}

.size-preview {
  width: 28px;
  height: 20px;
  background: var(--text-muted);
  border-radius: 2px;
  flex-shrink: 0;
  opacity: 0.4;
}

.size-btn:hover .size-preview,
.size-btn.active .size-preview {
  opacity: 0.7;
  background: var(--accent);
}

.size-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.size-dims {
  font-size: 11px;
  font-weight: 600;
  font-family: 'SF Mono', 'Fira Code', Monaco, monospace;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
}

.size-btn.active .size-dims {
  color: var(--text-primary);
}

.size-label {
  font-size: 10px;
  color: var(--text-muted);
}

.size-btn:hover .size-label {
  color: var(--text-tertiary);
}

.size-btn.active .size-label {
  color: var(--text-tertiary);
}

.size-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.size-input-x {
  color: var(--text-muted);
  font-size: 12px;
  flex-shrink: 0;
}

.size-input-row input {
  flex: 1;
  text-align: center;
  padding: 8px 10px;
  font-size: 11px;
  font-family: 'SF Mono', 'Fira Code', Monaco, monospace;
}

/* ==========================================
   COLOR INPUTS
   ========================================== */
.color-input {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 0;
  background: none;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 2px;
}

input[type="color"]::-webkit-color-swatch {
  border: 2px solid var(--bg-secondary);
  border-radius: 5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

input[type="color"]:hover::-webkit-color-swatch {
  border-color: var(--accent-muted);
}

input[type="color"]:focus::-webkit-color-swatch {
  border-color: var(--accent);
}

.color-input input[type="text"] {
  width: 80px;
  font-family: 'SF Mono', 'Fira Code', Monaco, monospace;
  font-size: 11px;
  text-transform: uppercase;
}

/* ==========================================
   SLIDERS
   ========================================== */
.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 6px;
  background: var(--surface-inset);
  border-radius: 3px;
  cursor: pointer;
  box-shadow: var(--shadow-inset);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  transition: filter var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: var(--shadow-knob);
  border: none;
}

input[type="range"]::-webkit-slider-thumb:hover {
  filter: brightness(1.15);
}

input[type="range"]::-webkit-slider-thumb:active {
  filter: brightness(0.85);
  transform: translateY(1px);
  box-shadow: var(--shadow-knob-active);
}

input[type="range"]:focus {
  outline: none;
}

.slider-value {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'SF Mono', 'Fira Code', Monaco, monospace;
  min-width: 40px;
  text-align: right;
  background: var(--surface-inset);
  padding: 4px 6px;
  border-radius: 4px;
  box-shadow: var(--shadow-inset);
}

/* ==========================================
   BUTTONS
   ========================================== */
.reset-btn {
  width: 100%;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 11px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-button);
}

.reset-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--border-light);
  color: var(--text-primary);
}

.reset-btn:active {
  box-shadow: var(--shadow-button-active);
  transform: translateY(1px);
}

.reset-btn svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* ==========================================
   CANVAS AREA
   ========================================== */
.canvas-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  position: relative;
  overflow: hidden;
}

/* Subtle dot grid */
.canvas-area::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
}

.canvas-container {
  position: relative;
  z-index: 1;
  max-width: calc(100vw - var(--panel-width) * 2 - 80px);
  max-height: calc(100vh - 120px);
  display: flex;
  align-items: center;
  justify-content: center;
}

canvas {
  display: block;
  border-radius: 4px;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.3),
    0 8px 32px rgba(0, 0, 0, 0.4);
}

.canvas-container canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.canvas-info {
  position: absolute;
  bottom: 68px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-secondary);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'SF Mono', 'Fira Code', Monaco, monospace;
  box-shadow: var(--shadow-raised);
  letter-spacing: 0.02em;
  z-index: 3;
  transition: bottom var(--transition-fast);
}

/* Canvas info stays above version strip (which is always visible now) */

/* ==========================================
   STYLE HISTORY
   ========================================== */
.style-history {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 10px;
  padding: 16px 24px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

/* Hide when truly empty (no save button and no thumbs) */
.style-history:empty {
  display: none;
}

.style-history::-webkit-scrollbar {
  display: none;
}

.style-thumb {
  flex-shrink: 0;
  width: 64px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 2px solid var(--border-subtle);
  transition:
    border-color var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    opacity var(--transition-fast);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.4),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  position: relative;
  opacity: 0.85;
}

.style-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: calc(var(--radius-sm) - 2px);
}

.style-thumb:hover {
  border-color: var(--border-light);
  transform: translateY(-3px) scale(1.05);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  opacity: 1;
  z-index: 1;
}

.style-thumb.active {
  border-color: var(--accent);
  opacity: 1;
  box-shadow:
    0 0 0 1px var(--accent),
    0 4px 12px rgba(0, 51, 255, 0.3),
    inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

/* Template Secondary Actions (Export/Delete row) */
.template-secondary-actions {
  display: flex;
  gap: 8px;
}

.template-secondary-actions .reset-btn {
  flex: 1;
}

/* Disabled state for reset-btn */
.reset-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Danger variant for reset-btn */
.reset-btn.danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--error);
  color: var(--error);
}

/* Version Save Button (+ in thumbnail strip) */
.version-save-btn {
  flex-shrink: 0;
  width: 64px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 2px dashed var(--border-light);
  background: transparent;
  transition:
    border-color var(--transition-fast),
    background var(--transition-fast),
    color var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.version-save-btn:hover {
  border-color: var(--accent);
  border-style: solid;
  background: var(--accent-subtle);
  color: var(--accent);
}

.version-save-btn:active {
  transform: scale(0.96);
}

.version-save-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* ==========================================
   CONFIG CODE
   ========================================== */
.config-code {
  background: var(--surface-inset);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-family: 'SF Mono', 'Fira Code', Monaco, monospace;
  font-size: 10px;
  line-height: 1.6;
  color: var(--text-secondary);
  overflow-x: auto;
  margin: 0 0 8px 0;
  white-space: pre;
  max-height: 240px;
  overflow-y: auto;
  box-shadow: var(--shadow-inset);
}

.config-code:empty::before {
  content: 'No changes';
  color: var(--text-muted);
  font-style: italic;
}

.config-actions {
  display: flex;
  gap: 8px;
}

.config-actions .reset-btn {
  flex: 1;
}

/* ==========================================
   AI STYLE
   ========================================== */
.style-prompt {
  width: 100%;
  min-height: 100px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
  resize: vertical;
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  box-shadow: var(--shadow-inset);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.style-prompt:hover:not(:focus) {
  border-color: var(--border-light);
}

.style-prompt:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-inset), 0 0 0 2px var(--accent-muted);
}

.style-prompt::placeholder {
  color: var(--text-muted);
  line-height: 1.6;
}

.style-checkbox {
  display: flex;
  align-items: center;
  margin-top: 4px;
}

.style-checkbox .checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  transition: color var(--transition-fast);
}

.style-checkbox .checkbox-label:hover {
  color: var(--text-primary);
}

.style-checkbox .checkbox-label:has(input:disabled) {
  color: var(--text-muted);
  cursor: not-allowed;
}

/* Custom neomorphic checkbox */
.style-checkbox input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  margin: 0;
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  box-shadow: var(--shadow-inset);
  transition: all var(--transition-fast);
  position: relative;
  flex-shrink: 0;
}

.style-checkbox input[type="checkbox"]:hover:not(:disabled) {
  border-color: var(--border-light);
  background: var(--bg-tertiary);
}

.style-checkbox input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow:
    var(--shadow-inset),
    0 0 8px rgba(0, 51, 255, 0.3);
}

.style-checkbox input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.style-checkbox input[type="checkbox"]:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.style-checkbox input[type="checkbox"]:focus {
  outline: none;
  box-shadow:
    var(--shadow-inset),
    0 0 0 2px var(--accent-muted);
}

.style-actions {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.style-actions .reset-btn {
  flex: 1;
}

/* ==========================================
   DATA TAB
   ========================================== */

/* Data Area (center column in Data tab) */
.data-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
  overflow: hidden;
  min-width: 0;
}

.spreadsheet-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* AI Prompt Input */
.ai-prompt-input {
  width: 100%;
  min-height: 120px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
  resize: vertical;
  background: var(--surface-inset);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  box-shadow: var(--shadow-inset);
  font-family: inherit;
  margin-bottom: 8px;
}

.ai-prompt-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-inset), 0 0 0 2px var(--accent-muted);
}

.ai-prompt-input::placeholder {
  color: var(--text-muted);
}

/* System Prompt Input */
.system-prompt-input {
  width: 100%;
  min-height: 200px;
  padding: 10px 12px;
  font-size: 11px;
  line-height: 1.5;
  resize: vertical;
  background: var(--surface-inset);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  box-shadow: var(--shadow-inset);
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
  margin-bottom: 8px;
}

.system-prompt-input.modified {
  color: var(--text-primary);
}

.system-prompt-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-inset), 0 0 0 2px var(--accent-muted);
}

.system-prompt-input::placeholder {
  color: var(--text-muted);
}

.full-width {
  width: 100%;
  justify-content: center;
}

/* API Key Button */
.ai-key-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-tertiary);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.ai-key-status:hover {
  background: var(--surface-raised);
  border-color: var(--border-light);
  color: var(--text-secondary);
}

.ai-key-status.active {
  color: var(--success);
  border-color: rgba(34, 197, 94, 0.3);
}


.spreadsheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-subtle);
}

.spreadsheet-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.spreadsheet-count {
  font-size: 11px;
  color: var(--text-muted);
}

.spreadsheet-count span {
  color: var(--text-secondary);
  font-weight: 600;
}

.spreadsheet-footer {
  padding: 8px 16px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 8px;
}

.spreadsheet-footer-spacer {
  flex: 1;
}

.add-row-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  width: 100%;
  justify-content: center;
}

.add-row-btn:hover {
  background: var(--surface-raised);
  border-color: var(--border-light);
  border-style: solid;
  color: var(--text-secondary);
}

/* Data Table */
.data-table-container {
  flex: 1;
  overflow: auto;
  position: relative;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
}

/* All cells: same base padding */
.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-subtle);
}

/* Header row */
.data-table th {
  background: var(--bg-base);
  color: var(--text-tertiary);
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
  z-index: 1;
}

/* Data rows */
.data-table tbody tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: var(--bg-tertiary);
}

/* Column widths */
.data-table .col-num { width: 40px; text-align: center; }
.data-table .col-check { width: 40px; text-align: center; padding-left: 0; padding-right: 0; }
.data-table .col-intro { width: 12%; }
.data-table .col-headline { width: 20%; }
.data-table .col-offer { width: 14%; }
.data-table .col-legend { width: 14%; }
.data-table .col-actions { width: 40px; text-align: center; padding-left: 0; padding-right: 0; }

/* Text inputs in cells - remove padding, let cell handle it */
.data-table td input[type="text"] {
  width: 100%;
  background: transparent;
  border: none;
  padding: 0;
  margin: -10px -12px;
  padding: 10px 12px;
  width: calc(100% + 24px);
  font-size: 12px;
  color: var(--text-primary);
  box-sizing: border-box;
}

.data-table td input[type="text"]:hover {
  background: var(--surface-inset);
}

.data-table td input[type="text"]:focus {
  background: var(--surface-inset);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Checkbox inputs */
.data-table input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
  margin: 0;
}

/* Row number */
.row-num {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'SF Mono', monospace;
}

/* Delete button */
.row-delete {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  opacity: 0;
  transition: opacity var(--transition-fast), color var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.data-table tbody tr:hover .row-delete {
  opacity: 1;
}

.row-delete:hover {
  color: var(--error);
}

.row-delete svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* Empty State */
.data-empty {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  pointer-events: none;
}

.data-empty-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.data-empty-icon svg {
  width: 100%;
  height: 100%;
}

.data-empty p {
  font-size: 13px;
  margin-bottom: 4px;
}

.data-empty span {
  font-size: 11px;
  opacity: 0.7;
}

.data-table:has(tbody tr) + .data-empty {
  display: none;
}

/* Primary Reset Button */
.reset-btn.primary {
  background: var(--accent);
  border-color: transparent;
  color: white;
}

.reset-btn.primary:hover {
  filter: brightness(1.15);
}

.reset-btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

.reset-btn.loading::after {
  content: '';
  width: 10px;
  height: 10px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 6px;
}

/* Variations Section */
.variations-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-bottom: none;
}

.variations-section .section-header {
  cursor: default;
}

.variations-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 200px;
}

.variations-list::-webkit-scrollbar {
  width: 6px;
}

.variations-list::-webkit-scrollbar-track {
  background: transparent;
}

.variations-list::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}

.variations-list::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.variations-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
}

.variations-empty p {
  font-size: 12px;
  margin-bottom: 4px;
}

.variations-empty span {
  font-size: 11px;
  opacity: 0.7;
}

/* Variation Card */
.variation-card {
  background: var(--surface-inset);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-inset);
  position: relative;
}

.variation-card:hover {
  background: var(--bg-tertiary);
  border-color: var(--border);
}

.variation-card.active {
  background: var(--surface-raised);
  border-color: var(--accent-muted);
  box-shadow: var(--shadow-button), 0 0 0 1px var(--accent-subtle);
}

.variation-card-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.variation-card-header input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 1px;
}

.variation-card-intro {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.variation-card-delete {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  opacity: 0;
  transition: opacity var(--transition-fast), color var(--transition-fast);
}

.variation-card:hover .variation-card-delete {
  opacity: 1;
}

.variation-card-delete:hover {
  color: var(--error);
}

.variation-card-delete svg {
  width: 12px;
  height: 12px;
}

.variation-card-headline {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.variation-card-offer {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.variation-card-legend {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Export Size List */
.export-size-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.export-size-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-inset);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-inset);
}

.export-size-item:hover {
  background: var(--bg-tertiary);
  border-color: var(--border);
}

.export-size-item.selected {
  background: var(--surface-raised);
  border-color: var(--accent-muted);
  box-shadow: var(--shadow-button), 0 0 0 1px var(--accent-subtle);
}

.export-size-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.export-size-item .size-preview {
  width: 24px;
  height: 16px;
}

.export-size-item .size-info {
  flex: 1;
}

.export-size-item .size-dims {
  font-size: 10px;
}

.export-size-item .size-label {
  font-size: 9px;
}

/* Export Summary */
.export-summary {
  background: var(--surface-inset);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
  margin-bottom: 10px;
  box-shadow: var(--shadow-inset);
}

.export-calc {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.export-calc span {
  color: var(--text-secondary);
  font-weight: 600;
}

.export-x {
  color: var(--text-muted);
  margin: 0 4px;
}

.export-total {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.export-total span {
  color: var(--accent);
}

.select-all-row {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.select-all-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-tertiary);
  cursor: pointer;
}

.select-all-label input {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
}

.select-all-label:hover {
  color: var(--text-secondary);
}

/* ==========================================
   MODAL
   ========================================== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
}

.modal-description {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 18px;
  line-height: 1.6;
}

.input-group {
  margin-bottom: 12px;
}

.input-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.modal-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 12px;
}

.modal-hint a {
  color: var(--accent);
  text-decoration: none;
}

.modal-hint a:hover {
  text-decoration: underline;
}

.api-key-input {
  width: 100%;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
  font-size: 13px;
  padding: 12px 14px;
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  box-shadow: var(--shadow-inset);
}

.api-key-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-inset), 0 0 0 2px var(--accent-muted);
}

.api-key-input::placeholder {
  color: var(--text-muted);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ==========================================
   ICONS
   ========================================== */
.icon {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 1.75;
  fill: none;
}

.icon-sm {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* ==========================================
   LOADING STATE
   ========================================== */
.toolbar-btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

.toolbar-btn.loading::after {
  content: '';
  width: 12px;
  height: 12px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 6px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================
   FOCUS & SELECTION
   ========================================== */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
}

::selection {
  background: var(--accent);
  color: white;
}

/* ==========================================
   ELEMENTS (Right Panel)
   ==========================================

   Design Philosophy:
   - Elements are sections, not cards
   - Follow same flat pattern as left panel
   - Inputs are the focus, not containers
   - Settings expand inline like section bodies
   - Subordinate to canvas - functional, not decorative
*/

/* Element group - section-like, flat */
.element-card {
  border-bottom: 1px solid var(--border-subtle);
}

.element-card:last-child {
  border-bottom: none;
}

/* Element Header - matches section-header pattern */
.element-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: default;
}

.element-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex: 1;
}

/* Override indicator - hidden by default, blue dot when active, X on hover */
.override-indicator {
  width: 12px;
  height: 12px;
  border: none;
  padding: 0;
  margin: 0;
  flex-shrink: 0;
  background: none;
  background-color: transparent;
  pointer-events: none;
  display: none;
  align-items: center;
  justify-content: center;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
}

.override-indicator svg {
  display: none;
}

/* Only show when has overrides */
.override-indicator.active {
  display: flex;
  pointer-events: auto;
  cursor: pointer;
}

/* Blue dot via pseudo-element */
.override-indicator.active::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.override-indicator.active:hover::before {
  display: none;
}

.override-indicator.active:hover svg {
  display: block;
  width: 10px;
  height: 10px;
  color: var(--text-muted);
}

/* Settings toggle - subtle, right-aligned */
.element-settings-btn {
  background: none;
  border: none;
  padding: 4px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.element-settings-btn svg {
  transition: transform var(--transition-base);
}

.element-settings-btn:hover {
  color: var(--text-secondary);
}

.element-settings-btn.active {
  color: var(--text-primary);
}

.element-settings-btn.active svg {
  transform: rotate(180deg);
}

/* Element Content - input area */
.element-content {
  padding: 0 14px 12px;
}

.element-content .text-input {
  background: var(--surface-inset);
  border: 1px solid transparent;
  box-shadow: var(--shadow-inset);
}

.element-content .text-input:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-inset), 0 0 0 2px var(--accent-muted);
}

.element-content .text-input + .text-input {
  margin-top: 6px;
}

/* Element Settings - expandable, subtle inset treatment */
.element-settings {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.2s ease-out;
}

.element-settings-inner {
  overflow: hidden;
}

.element-settings:not(.collapsed) {
  grid-template-rows: 1fr;
}

.element-settings:not(.collapsed) .element-settings-inner {
  padding: 12px 14px;
  margin: 0 8px 8px;
  background: var(--surface-inset);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-inset);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Compact slider rows for settings */
.element-settings .slider-row {
  display: grid;
  grid-template-columns: 44px 1fr 38px;
  align-items: center;
  gap: 8px;
}

.element-settings .slider-row .prop-label {
  font-size: 10px;
  color: var(--text-tertiary);
  min-width: 0;
}

.element-settings .slider-row .slider-value {
  font-size: 9px;
  min-width: 0;
  text-align: right;
}

/* ==========================================
   CLEARABLE COLOR INPUT
   ==========================================

   Design Philosophy:
   - Empty/cleared = inherit from global
   - Click swatch to pick color
   - Click X to clear back to inherit
   - Visual "empty" state with diagonal line
*/
.color-input-clearable {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.color-swatch-wrap {
  position: relative;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.color-swatch-wrap input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: none;
}

.color-swatch-wrap input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.color-swatch-wrap input[type="color"]::-webkit-color-swatch {
  border: 2px solid var(--bg-tertiary);
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.color-swatch-wrap input[type="color"]:hover::-webkit-color-swatch {
  border-color: var(--border-light);
}

/* Empty state - diagonal line through swatch */
.color-swatch-wrap.empty::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  background:
    linear-gradient(
      135deg,
      transparent 45%,
      var(--text-muted) 45%,
      var(--text-muted) 55%,
      transparent 55%
    );
  border-radius: 3px;
  pointer-events: none;
}

.color-swatch-wrap.empty input[type="color"]::-webkit-color-swatch {
  background: var(--surface-inset) !important;
}

.color-input-clearable .color-hex {
  flex: 1;
  min-width: 0;
  font-size: 10px;
  font-family: 'SF Mono', 'Fira Code', Monaco, monospace;
  padding: 6px 8px;
}

.color-input-clearable .color-hex::placeholder {
  font-family: inherit;
  font-size: 11px;
}

.color-clear-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
  opacity: 0;
}

.color-input-clearable:hover .color-clear-btn,
.color-input-clearable:focus-within .color-clear-btn {
  opacity: 1;
}

.color-clear-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text-secondary);
}

.color-clear-btn svg {
  width: 12px;
  height: 12px;
}

/* Hide clear button when already empty */
.color-swatch-wrap.empty + .color-hex + .color-clear-btn {
  display: none;
}

/* Slider clear button (for tracking/spacing) */
.slider-clear-btn {
  width: 20px;
  height: 20px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 4px;
  transition: all var(--transition-fast);
  opacity: 0;
}

.slider-row:hover .slider-clear-btn,
.slider-row:focus-within .slider-clear-btn {
  opacity: 1;
}

.slider-clear-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text-secondary);
}

.slider-clear-btn svg {
  width: 10px;
  height: 10px;
}

.hidden {
  display: none !important;
}

/* ==========================================
   RIGHT PANEL REFINEMENTS
   ========================================== */
.panel.right .panel-content {
  padding: 0;
}

/* Elements use their own structure, not sections */
.panel.right .section {
  border-bottom: none;
}

.panel.right .section-body {
  padding: 8px 14px 14px;
}

/* Panel header for context */
.panel-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-header-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.panel-header-hint {
  font-size: 9px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  background: var(--surface-inset);
  border-radius: 3px;
  margin-left: auto;
}

/* ==========================================
   LEFT PANEL REFINEMENTS
   ========================================== */

/* AI-powered section hints - subtle accent treatment */
.section-hint {
  transition: background var(--transition-fast), color var(--transition-fast);
}

/* AI-powered sections get accent hint styling */
.section:has(.style-prompt) .section-hint,
.section:has(#aiLanguage) .section-hint {
  background: var(--accent-subtle);
  color: var(--accent);
}

/* Layers card AI hint - same treatment as section-hint */
.layers-card .element-hint {
  font-size: 9px;
  font-weight: 500;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--accent-subtle);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 3px;
}

/* AI panel header hints */
.panel-header-hint.ai-hint {
  background: var(--accent-subtle);
  color: var(--accent);
}

/* ==========================================
   LAYERS CARD (Right Panel)
   ==========================================

   Design Philosophy:
   - Simple opacity-only controls
   - Opacity 0 = layer disabled
   - No checkboxes or blend modes
   - Compact horizontal layout
*/
.layers-card {
  border-bottom: none;
}

.layers-card .element-header {
  border-bottom: 1px solid var(--border-subtle);
}

.layers-content {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.layer-row {
  display: grid;
  grid-template-columns: 70px 1fr 44px;
  align-items: center;
  gap: 10px;
}

.layer-label {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* Dim the layer label when opacity is 0 (class toggled via JS) */
.layer-row.layer-disabled .layer-label {
  color: var(--text-muted);
}
