/* ==========================================================================
   CARPETS STUDIO — DESIGN SYSTEM & STYLES
   ========================================================================== */

:root {
  /* Color Palette - Dark Theme (Default) */
  --bg-app: #0a0d14;
  --bg-panel: #111622;
  --bg-panel-header: #151c2c;
  --bg-card: #161e30;
  --bg-card-hover: #1c263c;
  --bg-input: #0c1018;
  --bg-input-focus: #121824;

  --border-subtle: #202b3f;
  --border-medium: #2e3d5a;
  --border-strong: #435882;

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-primary: #3b82f6;
  --accent-primary-hover: #2563eb;
  --accent-secondary: #06b6d4;
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-purple: #8b5cf6;

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);

  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Checkerboard colors for transparent previews */
  --chk-light: #222938;
  --chk-dark: #161b26;
}

body.light-theme {
  --bg-app: #f1f5f9;
  --bg-panel: #ffffff;
  --bg-panel-header: #f8fafc;
  --bg-card: #f8fafc;
  --bg-card-hover: #f1f5f9;
  --bg-input: #ffffff;
  --bg-input-focus: #f8fafc;

  --border-subtle: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-strong: #94a3b8;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;

  --accent-primary: #2563eb;
  --accent-primary-hover: #1d4ed8;

  --chk-light: #ffffff;
  --chk-dark: #e2e8f0;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   HEADER & VIEW TABS
   ========================================================================== */
.app-header {
  height: 54px;
  background-color: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 20;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.brand-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-main);
  line-height: 1.2;
}

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

/* View Mode Tabs */
.view-mode-tabs {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  gap: 4px;
}

.view-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-xs);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.view-tab-btn:hover {
  color: var(--text-main);
  background: var(--bg-card-hover);
}

.view-tab-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(59, 130, 246, 0.4);
}

.deck-count-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  background: rgba(255, 255, 255, 0.2);
  padding: 1px 5px;
  border-radius: var(--radius-full);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sample-loader {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-input);
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

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

.header-divider {
  width: 1px;
  height: 20px;
  background-color: var(--border-subtle);
}

.theme-toggle-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.theme-toggle-btn:hover {
  color: var(--text-main);
  border-color: var(--border-medium);
}

.sun-icon { display: none; }
.moon-icon { display: block; }
body.light-theme .sun-icon { display: block; }
body.light-theme .moon-icon { display: none; }

/* ==========================================================================
   MULTI-CARPET DECK SHELF (TOP DRAWER)
   ========================================================================== */
.deck-shelf-container {
  background-color: var(--bg-panel-header);
  border-bottom: 1px solid var(--border-subtle);
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 15;
}

.deck-shelf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.deck-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-main);
  letter-spacing: -0.2px;
}

.deck-slots-counter {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--accent-secondary);
  background: rgba(6, 182, 212, 0.12);
  padding: 1px 6px;
  border-radius: var(--radius-xs);
}

.global-height-badge-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.global-height-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent-warning);
}

.global-height-input {
  width: 48px;
  height: 20px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--accent-warning);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  outline: none;
}

.global-height-unit {
  font-size: 10px;
  color: var(--text-dim);
}

.deck-card.spacer-card {
  border-style: dashed;
  border-color: rgba(6, 182, 212, 0.4);
  background-color: rgba(6, 182, 212, 0.04);
}

.deck-card.spacer-card .deck-card-index {
  background: var(--accent-secondary);
}

.deck-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Horizontal Deck Track */
.deck-track {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  min-height: 80px;
}

.deck-track::-webkit-scrollbar {
  height: 4px;
}
.deck-track::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 2px;
}

.empty-deck-notice {
  width: 100%;
  padding: 14px;
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(12, 16, 24, 0.5);
}

.empty-deck-notice strong {
  color: var(--accent-primary);
}

/* Individual Deck Card */
.deck-card {
  flex: 0 0 auto;
  width: 180px;
  height: 72px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  transition: all 0.15s;
  user-select: none;
}

.deck-card:hover {
  border-color: var(--accent-primary);
  background-color: var(--bg-card-hover);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.deck-card.active-card {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 1px var(--accent-primary);
}

.deck-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.deck-card-index {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  background: var(--accent-primary);
  color: white;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.deck-card-meta {
  font-size: 9px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.deck-card-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.deck-card-btn {
  width: 18px;
  height: 18px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  padding: 0;
}

.deck-card-btn:hover {
  background: var(--border-medium);
  color: var(--text-main);
}

.deck-card-btn.delete-btn:hover {
  background: #ef4444;
  color: white;
}

.deck-card-thumb {
  width: 100%;
  height: 28px;
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.deck-card-thumb canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ==========================================================================
   WORKSPACE LAYOUT
   ========================================================================== */
.app-workspace {
  display: grid;
  grid-template-columns: 350px 1fr 370px;
  height: calc(100vh - 54px - 110px);
  overflow: hidden;
}

/* PANELS */
.panel {
  background-color: var(--bg-panel);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

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

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

.panel-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background-color: var(--bg-panel-header);
}

.panel-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title-wrap h2 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--text-main);
  text-transform: uppercase;
}

.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: white;
  font-size: 10px;
  font-weight: 700;
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

/* ==========================================================================
   CARDS & CONTROLS
   ========================================================================== */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.1px;
}

.info-tag {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
}

.dimension-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--accent-secondary);
  background: rgba(6, 182, 212, 0.12);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 11px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-sm {
  height: 26px;
  padding: 0 10px;
  font-size: 11px;
}

.btn-xs {
  height: 22px;
  padding: 0 8px;
  font-size: 10px;
}

.btn-lg {
  height: 38px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 700;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), #2563eb);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.btn-secondary {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border: 1px solid var(--border-medium);
}

.btn-secondary:hover {
  background: var(--border-medium);
}

.btn-accent {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
}

.btn-accent:hover {
  background: #059669;
}

.btn-outline {
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

.btn-outline:hover, .btn-outline.active {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: var(--bg-input);
  color: var(--text-main);
}

.btn-icon {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-icon:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--border-medium);
}

.w-100 { width: 100%; }

/* ==========================================================================
   LEFT PANEL: DROPZONE & SOURCE VIEWPORT
   ========================================================================== */
.dropzone {
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  text-align: center;
  background-color: var(--bg-input);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent-primary);
  background-color: rgba(59, 130, 246, 0.05);
}

.file-input-hidden {
  display: none;
}

.dropzone-icon {
  color: var(--accent-primary);
  margin-bottom: 4px;
}

.dropzone-primary-text {
  font-size: 11px;
  color: var(--text-main);
}

.browse-link {
  color: var(--accent-primary);
  text-decoration: underline;
  cursor: pointer;
}

.dropzone-subtext {
  font-size: 9px;
  color: var(--text-dim);
  margin-top: 2px;
}

.dropzone-subtext kbd {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 1px 4px;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
}

/* Source Canvas with Interactive Crop Box */
.source-viewport-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.viewport-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.viewport-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
}

.viewport-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.source-canvas-wrapper {
  position: relative;
  width: 100%;
  height: 170px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

#source-canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

/* Crop Overlay & Handles */
.crop-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.crop-box {
  position: absolute;
  border: 2px solid var(--accent-primary);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55), 0 0 8px rgba(59, 130, 246, 0.6);
  pointer-events: auto;
  cursor: move;
  box-sizing: border-box;
}

.crop-center-guide {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  margin-left: -4px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  pointer-events: none;
}

.crop-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background-color: #ffffff;
  border: 2px solid var(--accent-primary);
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.handle-nw { top: -5px; left: -5px; cursor: nwse-resize; }
.handle-ne { top: -5px; right: -5px; cursor: nesw-resize; }
.handle-sw { bottom: -5px; left: -5px; cursor: nesw-resize; }
.handle-se { bottom: -5px; right: -5px; cursor: nwse-resize; }
.handle-n  { top: -5px; left: calc(50% - 5px); cursor: ns-resize; }
.handle-s  { bottom: -5px; left: calc(50% - 5px); cursor: ns-resize; }
.handle-w  { top: calc(50% - 5px); left: -5px; cursor: ew-resize; }
.handle-e  { top: calc(50% - 5px); right: -5px; cursor: ew-resize; }

.crop-size-badge {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(15, 23, 42, 0.85);
  color: white;
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
  pointer-events: none;
  border: 1px solid var(--border-subtle);
}

/* Loupe Magnifier */
.loupe-container {
  position: absolute;
  pointer-events: none;
  z-index: 50;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  background: #000;
  transform: translate(-50%, -50%);
}

#loupe-canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.loupe-crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  margin-top: -5px;
  margin-left: -5px;
  border: 1px solid red;
  pointer-events: none;
}

.loupe-color-info {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
}

/* Extracted Logo Preview */
.checkerboard-bg {
  background-color: var(--chk-light);
  background-image: linear-gradient(45deg, var(--chk-dark) 25%, transparent 25%),
                    linear-gradient(-45deg, var(--chk-dark) 25%, transparent 25%),
                    linear-gradient(45deg, transparent 75%, var(--chk-dark) 75%),
                    linear-gradient(-45deg, transparent 75%, var(--chk-dark) 75%);
  background-size: 14px 14px;
  background-position: 0 0, 0 7px, 7px -7px, -7px 0px;
}

.extracted-preview-wrapper {
  width: 100%;
  height: 75px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#extracted-canvas {
  max-width: 90%;
  max-height: 65px;
  object-fit: contain;
}

/* Form Controls & Switches */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.switch-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
}

.custom-switch {
  appearance: none;
  width: 34px;
  height: 18px;
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-full);
  position: relative;
  cursor: pointer;
  outline: none;
  transition: all 0.2s;
}

.custom-switch::before {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  background: var(--text-muted);
  transition: all 0.2s;
}

.custom-switch:checked {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.custom-switch:checked::before {
  left: 18px;
  background: #ffffff;
}

.conditional-settings {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  margin-top: 6px;
}

.slider-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
}

.slider-val {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-primary);
}

.custom-range {
  appearance: none;
  width: 100%;
  height: 5px;
  background: var(--border-medium);
  border-radius: var(--radius-full);
  outline: none;
}

.custom-range::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  border: 2px solid #ffffff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.btn-group-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

/* ==========================================================================
   CENTER PANEL: LIVE CARPET STUDIO & SHEET VIEWPORT
   ========================================================================== */
.panel-center {
  background-color: var(--bg-app);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.studio-toolbar {
  height: 40px;
  background-color: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  z-index: 10;
}

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

.live-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-success);
  box-shadow: 0 0 6px var(--accent-success);
}

.shade-status-badge {
  font-size: 9px;
  font-weight: 600;
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent-primary);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 3px;
  background: var(--bg-input);
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.zoom-level {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-main);
  min-width: 40px;
  text-align: center;
}

/* Studio Viewport Area */
.studio-viewport-area {
  flex: 1;
  position: relative;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  background-color: #06080e;
}

.studio-canvas-container {
  position: relative;
  display: inline-block;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--border-subtle);
  border-radius: var(--radius-xs);
  user-select: none;
}

#carpet-studio-canvas {
  display: block;
  border-radius: var(--radius-xs);
  cursor: grab;
}

#carpet-studio-canvas:active {
  cursor: grabbing;
}

#sheet-1920-canvas, #long-strip-canvas {
  display: block;
  border-radius: var(--radius-xs);
}

/* Sheet & Strip Overlay Info */
.sheet-info-overlay, .strip-info-overlay {
  position: absolute;
  top: -26px;
  left: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sheet-title-badge, .strip-title-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-secondary);
  background: rgba(15, 23, 42, 0.9);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(6, 182, 212, 0.4);
}

.sheet-slices-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  color: var(--accent-warning);
  background: rgba(15, 23, 42, 0.9);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
}

/* Dimension Overlays */
.dimension-overlay-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.dim-badge {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
  background: rgba(15, 23, 42, 0.85);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.dim-total {
  bottom: -26px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--accent-secondary);
  border-color: rgba(6, 182, 212, 0.4);
}

.dim-shade-left {
  top: -24px;
  left: 0;
  color: var(--accent-warning);
}

.dim-carpet {
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--accent-primary);
}

.dim-shade-right {
  top: -24px;
  right: 0;
  color: var(--accent-warning);
}

/* Studio Footer Strip */
.studio-footer-strip {
  height: 34px;
  background-color: var(--bg-panel);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  font-size: 10px;
  color: var(--text-muted);
}

.footer-tip {
  display: flex;
  align-items: center;
  gap: 6px;
}

.footer-transparency-note {
  display: flex;
  align-items: center;
  gap: 6px;
}

.color-swatch-sm {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  border: 1px solid var(--border-medium);
  display: inline-block;
}

/* ==========================================================================
   RIGHT PANEL: SETTINGS & EXPORT
   ========================================================================== */
.section-card {
  gap: 8px;
}

/* 1920x1080 Slicer Stats Card */
.sheet-config-card {
  border-color: rgba(6, 182, 212, 0.35);
  background: linear-gradient(180deg, var(--bg-card) 0%, rgba(6, 182, 212, 0.04) 100%);
}

.sheet-calc-stats-box {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-line {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
}

.stat-line strong {
  font-family: var(--font-mono);
  color: var(--accent-secondary);
}

/* Carpet Type Selector (Shades) */
.carpet-type-selector {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.carpet-type-btn {
  display: flex;
  flex-direction: column;
  padding: 8px 4px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}

.carpet-type-btn input {
  display: none;
}

.type-btn-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.type-icon {
  font-size: 12px;
}

.type-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-main);
}

.type-desc {
  font-size: 8px;
  color: var(--text-dim);
}

.carpet-type-btn:hover {
  border-color: var(--border-medium);
  background: var(--bg-card-hover);
}

.carpet-type-btn.active {
  border-color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.1);
}

.carpet-type-btn.active .type-title {
  color: var(--accent-primary);
}

.shade-info-box {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 9px;
  color: var(--text-dim);
  background: var(--bg-input);
  padding: 5px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
}

/* Presets & Inputs */
.presets-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.preset-chip {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 2px 8px;
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.preset-chip:hover {
  border-color: var(--border-medium);
  color: var(--text-main);
}

.preset-chip.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
}

.inputs-inline-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(75px, 1fr));
  gap: 6px;
}

.input-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.input-field label {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.input-field input {
  height: 28px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 0 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  outline: none;
  transition: border-color 0.15s;
}

.input-field input:focus {
  border-color: var(--accent-primary);
  background: var(--bg-input-focus);
}

/* Color Picker */
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-preview-box {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-medium);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.color-picker-input {
  position: absolute;
  top: -10px;
  left: -10px;
  width: 60px;
  height: 60px;
  opacity: 0;
  cursor: pointer;
}

.color-inputs-wrap {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 6px;
}

.hex-input {
  width: 80px;
  height: 28px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: center;
  outline: none;
}

.hex-input:focus {
  border-color: var(--accent-primary);
}

.color-buttons-group {
  display: flex;
  gap: 4px;
  flex: 1;
}

.color-buttons-group .btn {
  flex: 1;
  height: 28px;
  padding: 0 4px;
}

/* Brand Palette Swatches */
.palette-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg-input);
  padding: 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.palette-header {
  font-size: 9px;
  color: var(--text-muted);
}

.palette-swatches {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.swatch-btn {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: transform 0.15s;
}

.swatch-btn:hover {
  transform: scale(1.15);
}

/* Alignment Grid (3 items per row) */
.alignment-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.alignment-grid .btn {
  padding: 0 4px;
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Export Card */
.export-card {
  border-color: rgba(59, 130, 246, 0.4);
  background: linear-gradient(180deg, var(--bg-card) 0%, rgba(30, 41, 59, 0.6) 100%);
}

.badge-pill {
  font-size: 9px;
  font-weight: 700;
  color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.15);
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.export-actions-grid-v2 {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
  color: var(--text-main);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  font-size: 11px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  animation: slideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

.toast.success { border-color: var(--accent-success); }
.toast.info { border-color: var(--accent-primary); }
.toast.warning { border-color: var(--accent-warning); }

@keyframes slideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ==========================================================================
   RESPONSIVE ADJUSTMENTS
   ========================================================================== */
@media (max-width: 1250px) {
  .app-workspace {
    grid-template-columns: 310px 1fr 330px;
  }
}
