:root {
  --bg: #0f1115;
  --card: #161920;
  --card-elev: #1d212b;
  --border: #2a2f3a;
  --text: #f3f4f6;
  --muted: #9ca3af;
  --primary: #00ae42;
  --primary-hover: #00c44b;
  --primary-fg: #ffffff;
  --danger: #ef4444;
  --stage-bg: #0b0e14;
  --radius: 12px;
  --font: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f1f5f9;
  --card: #ffffff;
  --card-elev: #f1f5f9;
  --border: #cbd5e1;
  --text: #0f172a;
  --muted: #475569;
  --primary: #009e3c;
  --primary-hover: #008732;
  --primary-fg: #ffffff;
  --danger: #dc2626;
  --stage-bg: #f8fafc;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  max-width: 1360px;
  margin: 0 auto;
  padding: 20px;
}

/* Top bar */
.topbar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 18px;
}

.topbar-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.theme-switcher {
  flex-shrink: 0;
  align-self: flex-start;
}

.theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  font-size: 0.74rem;
}

.theme-btn svg {
  flex-shrink: 0;
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(2, 12px);
  grid-template-rows: repeat(2, 12px);
  gap: 3px;
  padding: 7px;
  background: rgba(0, 174, 66, 0.14);
  border: 1px solid rgba(0, 174, 66, 0.4);
  border-radius: 9px;
  flex-shrink: 0;
}

.brand-mark span {
  border: 2px solid var(--primary);
  border-radius: 3px;
}

.topbar h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.brand-byline {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
}

.topbar p {
  margin: 2px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.support-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
}

.support-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.support-label svg {
  color: #fb7185;
  flex-shrink: 0;
}

.support-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
  background: var(--card-elev);
  border: 1px solid var(--border);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.08s;
}

.support-pill:active {
  transform: translateY(1px);
}

.support-revolut svg {
  color: #38bdf8;
}

.support-revolut:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.5);
  color: #e0f2fe;
}

.support-paypal svg {
  color: #60a5fa;
}

.support-paypal:hover {
  background: rgba(96, 165, 250, 0.12);
  border-color: rgba(96, 165, 250, 0.5);
  color: #dbeafe;
}

.topbar-actions,
.header-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 15px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, transform 0.08s;
}

.btn:active {
  transform: translateY(1px);
}

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

.btn-primary {
  background: var(--primary);
  color: var(--primary-fg);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-outline {
  background: var(--card-elev);
  color: var(--text);
  border-color: var(--border);
}

.btn-outline:hover:not(:disabled) {
  border-color: #4b5563;
  background: #252a36;
}

.btn-mini {
  background: var(--card-elev);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
}

.btn-mini:hover {
  border-color: #4b5563;
}

/* Workspace layout */
.workspace {
  display: grid;
  grid-template-columns: 368px 1fr;
  gap: 18px;
  align-items: start;
}

@media (max-width: 960px) {
  .workspace {
    grid-template-columns: 1fr;
  }
}

.controls-col,
.results-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.card-header h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.card-title-icon {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.section-icon {
  color: #4ade80;
  flex-shrink: 0;
}

.inline-opt-icon {
  flex-shrink: 0;
}

.subhead {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

/* Form controls */
.segmented {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 2px;
}

.segmented-full {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: 100%;
}

.rim-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.seg-btn.rim-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 7px;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 7px;
  transition: border-color 0.15s, background 0.15s;
}

.seg-btn.rim-card:hover {
  border-color: #3f4756;
}

.seg-btn.rim-card.active {
  background: rgba(0, 174, 66, 0.1);
  border-color: var(--primary);
}

.rim-card-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.rim-card-text strong {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
}

.rim-card-text small {
  font-size: 0.66rem;
  font-weight: 400;
  color: var(--muted);
  margin-top: 2px;
}

.opt-diagram {
  flex-shrink: 0;
  display: block;
  pointer-events: none;
}

.align-btn,
.nozzle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.align-icon,
.nozzle-icon {
  flex-shrink: 0;
  pointer-events: none;
}

.opt-explain-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.opt-explain-row .field-compact {
  flex: 1;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text);
  font-weight: 600;
}

.opt-explain-row .field-compact input {
  width: 76px;
  padding: 5px 8px;
  text-align: center;
  flex-shrink: 0;
}

.style-body {
  flex: 1;
  min-width: 0;
}

.more-options {
  margin-top: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.more-options summary {
  list-style: none;
  padding: 8px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.more-options summary::-webkit-details-marker {
  display: none;
}

.more-options summary::after {
  content: '+';
  font-weight: 700;
  color: var(--muted);
}

.more-options[open] summary::after {
  content: '−';
}

.more-options[open] summary {
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.more-options-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toggle-compact {
  padding: 8px 10px;
  align-items: center;
}

.toggle-compact input {
  margin-top: 0;
}

.printer-sub-group {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nozzle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.nozzle-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}

.pack-toggle {
  background: var(--card);
}

.batch-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.batch-bar-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.batch-label {
  font-size: 0.82rem;
  color: var(--text);
}

.batch-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.batch-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 10px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.76rem;
  color: var(--text);
  cursor: pointer;
}

.batch-chip:hover {
  border-color: var(--primary);
}

.batch-chip .chip-del {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 0 2px;
  font-size: 0.88rem;
  line-height: 1;
}

.batch-chip .chip-del:hover {
  color: #f87171;
}

.batch-bar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 0.78rem;
}

.rim-fill-group {
  padding: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.rim-fill-group + .rim-fill-group {
  margin-top: 10px;
}

.align-grid {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 7px 8px;
  align-items: center;
}

.align-axis {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

.custom-bed-row {
  margin-top: 10px;
  margin-bottom: 0;
}

/* Accessible hover/focus tooltips */
.label-with-tip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.style-title-row {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  padding: 0;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  font-family: inherit;
  line-height: 1;
  color: var(--muted);
  background: var(--card-elev);
  border: 1px solid var(--border);
  cursor: help;
  flex-shrink: 0;
  outline: none;
}

.tip:hover,
.tip:focus-visible {
  color: var(--text);
  border-color: var(--primary);
}

.floating-tip {
  position: fixed;
  max-width: 260px;
  padding: 9px 11px;
  border-radius: 8px;
  background: #111622;
  border: 1px solid #4b5563;
  color: #f3f4f6;
  font-size: 0.76rem;
  font-weight: 400;
  line-height: 1.45;
  white-space: pre-line;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.72);
  pointer-events: none;
  z-index: 9999;
}

.rim-fill-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.seg-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 3px 9px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 5px;
  cursor: pointer;
}

.seg-btn.active {
  background: var(--card-elev);
  color: var(--text);
}

.field-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.field-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 0.9fr;
  gap: 8px;
  margin-bottom: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--muted);
}

.field input,
.field select {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 9px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.field input:focus,
.field select:focus {
  border-color: var(--primary);
}

.field-row-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.field-compact {
  width: 100%;
}

.hint-inline,
.hint-text {
  font-size: 0.77rem;
  color: var(--muted);
  margin: 6px 0 0;
}

.toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.toggle-row input {
  margin-top: 3px;
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.toggle-row strong {
  display: block;
  font-size: 0.83rem;
}

.toggle-row small {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}

.badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0, 174, 66, 0.14);
  color: #4ade80;
  border: 1px solid rgba(0, 174, 66, 0.3);
}

.style-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.style-option {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.style-option:has(input:checked) {
  border-color: var(--primary);
  background: rgba(0, 174, 66, 0.06);
}

.style-option input {
  margin-top: 0;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.style-option strong {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
}

.style-option small {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 2px;
}

.pill-rec {
  display: inline-block;
  margin-left: 0;
  padding: 1px 5px;
  font-size: 0.6rem;
  font-weight: 600;
  border-radius: 999px;
  background: rgba(0, 174, 66, 0.2);
  color: #4ade80;
}

/* Error Banner */
.error-banner {
  padding: 12px 16px;
  border-radius: var(--radius);
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fecaca;
  font-size: 0.88rem;
}

/* Compact Layout Summary Bar */
.kpi-summary-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  background: rgba(255, 255, 255, 0.015);
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  line-height: 1.3;
}

.summary-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 6px;
  white-space: nowrap;
}

.summary-chip strong {
  color: var(--text);
  font-weight: 600;
}

.summary-sub,
.summary-muted {
  font-size: 0.73rem;
  color: var(--muted);
}

.summary-sep {
  display: none;
}

/* Preview Card */
.preview-card {
  padding: 0;
  overflow: hidden;
}

.preview-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.view-tabs {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.tab-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 5px 11px;
  border-radius: 7px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-fg);
}

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

.camera-controls {
  display: flex;
  gap: 6px;
}

.btn-mini.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-fg);
  font-weight: 700;
}

.bin-palette {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.bin-palette-label {
  font-size: 0.77rem;
  font-weight: 600;
  color: var(--muted);
}

.bin-size-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  flex: 1;
}

.view-stage {
  position: relative;
  background: var(--stage-bg);
}

.layout-svg {
  display: block;
  width: 100%;
  height: 410px;
  user-select: none;
}

.gl-canvas {
  display: block;
  width: 100%;
  height: 410px;
  touch-action: none;
  cursor: grab;
}

@media (max-width: 640px) {
  .app-shell {
    padding: 10px;
  }

  .topbar {
    padding: 13px 14px;
    gap: 12px;
  }

  .topbar-main {
    flex-direction: column;
    gap: 8px;
  }

  .theme-switcher {
    order: -1;
    align-self: flex-end;
  }

  .theme-btn {
    padding: 3px 7px;
    font-size: 0.7rem;
    gap: 4px;
  }

  .brand {
    align-items: flex-start;
  }

  .topbar h1 {
    font-size: 1.12rem;
  }

  .topbar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .topbar-actions #download3mfBtn {
    grid-column: 1 / -1;
  }

  .topbar-actions .btn:not(#download3mfBtn) {
    padding: 7px 6px;
    font-size: 0.75rem;
    gap: 4px;
  }

  .card {
    padding: 14px;
  }

  .card-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .header-btn-group {
    width: 100%;
  }

  .header-btn-group .btn {
    flex: 1;
    padding: 8px 10px;
    font-size: 0.8rem;
  }

  .kpi-summary-bar {
    padding: 9px 12px;
    gap: 4px 8px;
    font-size: 0.75rem;
  }

  .preview-toolbar {
    padding: 8px 10px;
    gap: 6px;
  }

  .view-tabs {
    gap: 4px;
  }

  .tab-btn {
    padding: 5px 8px;
    font-size: 0.73rem;
  }

  .layout-svg,
  .gl-canvas {
    height: 310px;
  }

  .model-actions {
    width: 100%;
  }

  .model-actions .btn {
    flex: 1;
  }
}

.gl-canvas:active {
  cursor: grabbing;
}

.stage-caption {
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  background: var(--card);
  font-size: 0.77rem;
  color: var(--muted);
}

/* Models List */
.models-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.model-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  transition: border-color 0.15s;
}

.model-row.selected {
  border-color: var(--primary);
  background: rgba(0, 174, 66, 0.06);
}

.model-main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.model-swatch {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  color: #091015;
  flex-shrink: 0;
}

.model-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
}

.qty-pill {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  background: var(--card-elev);
  border: 1px solid var(--border);
  color: var(--text);
}

.rot-pill {
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #7dd3fc;
}

.model-meta {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 3px;
}

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

/* IKEA Drawer Preset Search Picker */
.ikea-picker {
  margin-bottom: 12px;
}

.ikea-picker-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 5px;
}

.ikea-count-hint {
  font-size: 0.72rem;
  color: var(--muted);
}

.ikea-search-anchor {
  position: relative;
}

.ikea-search-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 6px 0 9px;
  transition: border-color 0.15s;
}

.ikea-search-wrap:focus-within {
  border-color: var(--primary);
}

.ikea-search-icon {
  color: var(--muted);
  flex-shrink: 0;
}

.ikea-search-wrap input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 8px 4px;
  outline: none;
}

.ikea-search-wrap input::placeholder {
  color: #6b7280;
}

.ikea-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}

.ikea-icon-btn:hover {
  background: var(--card-elev);
  color: var(--text);
}

.ikea-dropdown {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  max-height: 270px;
  overflow-y: auto;
  background: #111622;
  border: 1px solid #3b4252;
  border-radius: 9px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.72);
  padding: 4px;
  z-index: 80;
}

.ikea-dropdown::-webkit-scrollbar {
  width: 7px;
}

.ikea-dropdown::-webkit-scrollbar-thumb {
  background: #333a4a;
  border-radius: 999px;
}

.ikea-option {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 7px 9px;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}

.ikea-option:hover,
.ikea-option.highlighted {
  background: var(--card-elev);
  border-color: #3a4254;
}

.ikea-option.selected {
  background: rgba(0, 174, 66, 0.12);
  border-color: rgba(0, 174, 66, 0.45);
}

.ikea-option-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ikea-option-name {
  font-size: 0.81rem;
  font-weight: 600;
  color: var(--text);
}

.ikea-option-dims {
  font-size: 0.74rem;
  font-weight: 700;
  color: #4ade80;
  white-space: nowrap;
}

.ikea-option-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.71rem;
  color: var(--muted);
}

.ikea-series-tag {
  display: inline-block;
  padding: 0px 5px;
  border-radius: 4px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(56, 189, 248, 0.13);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.25);
  flex-shrink: 0;
}

.ikea-empty {
  padding: 12px 10px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
}

.ikea-selected-banner {
  margin-top: 7px;
  padding: 7px 9px;
  border-radius: 8px;
  background: rgba(0, 174, 66, 0.08);
  border: 1px solid rgba(0, 174, 66, 0.32);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ikea-selected-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.77rem;
  font-weight: 600;
  color: #86efac;
}

.ikea-selected-note {
  font-size: 0.71rem;
  color: var(--muted);
  line-height: 1.35;
}

.ikea-banner-clear {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 0 3px;
  font-size: 0.9rem;
  line-height: 1;
}

.ikea-banner-clear:hover {
  color: var(--text);
}

.app-footer {
  margin-top: 20px;
  padding: 12px 4px 4px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.76rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}

.footer-stats {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 3px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.72rem;
  color: var(--muted);
}

.footer-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}

.footer-stat svg {
  opacity: 0.75;
  flex-shrink: 0;
}

.footer-stat strong {
  color: var(--text);
  font-weight: 600;
}

.footer-stats-sep {
  opacity: 0.45;
}

/* Light Theme Refinements */
:root[data-theme="light"] .card,
:root[data-theme="light"] .topbar,
:root[data-theme="light"] .batch-bar {
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

:root[data-theme="light"] .btn-outline:hover:not(:disabled),
:root[data-theme="light"] .btn-mini:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

:root[data-theme="light"] .seg-btn.active {
  background: var(--card);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

:root[data-theme="light"] .seg-btn.rim-card:hover {
  border-color: #94a3b8;
}

:root[data-theme="light"] .support-revolut svg {
  color: #0284c7;
}

:root[data-theme="light"] .support-revolut:hover {
  background: rgba(2, 132, 199, 0.1);
  border-color: rgba(2, 132, 199, 0.45);
  color: #0369a1;
}

:root[data-theme="light"] .support-paypal svg {
  color: #2563eb;
}

:root[data-theme="light"] .support-paypal:hover {
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.45);
  color: #1d4ed8;
}

:root[data-theme="light"] .section-icon {
  color: #16a34a;
}

:root[data-theme="light"] .badge,
:root[data-theme="light"] .pill-rec {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
  border-color: rgba(22, 163, 74, 0.3);
}

:root[data-theme="light"] .kpi-summary-bar {
  background: #f8fafc;
}

:root[data-theme="light"] .summary-chip {
  background: #ffffff;
}

:root[data-theme="light"] .rot-pill,
:root[data-theme="light"] .ikea-series-tag {
  background: rgba(2, 132, 199, 0.1);
  border-color: rgba(2, 132, 199, 0.3);
  color: #0369a1;
}

:root[data-theme="light"] .ikea-dropdown {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.15);
}

:root[data-theme="light"] .ikea-dropdown::-webkit-scrollbar-thumb {
  background: #cbd5e1;
}

:root[data-theme="light"] .ikea-option:hover,
:root[data-theme="light"] .ikea-option.highlighted {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

:root[data-theme="light"] .ikea-option-dims,
:root[data-theme="light"] .ikea-selected-top {
  color: #15803d;
}

:root[data-theme="light"] .error-banner {
  background: rgba(239, 68, 68, 0.1);
  color: #991b1b;
}

:root[data-theme="light"] .footer-stats {
  background: #ffffff;
}

:root[data-theme="light"] .opt-diagram {
  background: #0f172a;
  border-radius: 5px;
}

.hidden {
  display: none !important;
}
