/* ==========================================
   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;
  padding: 0 20px;
  gap: 20px;
  flex-shrink: 0;
}

.toolbar-brand {
  display: flex;
  align-items: center;
}

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

/* Navigation Tabs */
.toolbar-nav {
  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-spacer {
  flex: 1;
}


/* 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;
}

.panel-content::-webkit-scrollbar {
  width: 6px;
}

.panel-content::-webkit-scrollbar-track {
  background: transparent;
}

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

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

/* ==========================================
   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: var(--bg-tertiary);
}

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

.section-hint {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 8px;
  flex: 1;
  text-transform: none;
  letter-spacing: 0;
}

.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.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;
  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: 20px;
  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;
}

/* ==========================================
   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;
}

/* ==========================================
   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);
}

.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;
}

.add-variation-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  margin-left: auto;
}

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

.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;
}
