@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');



/**
 * Global Styles - Business Card Studio 3D
 */

/* ========== CSS Variables ========== */
:root {
  --bg-main: #f0f2f5;
  --bg-workspace: #1a1a2e;
  --bg-gradient-start: #f8fafc;
  --bg-gradient-mid: #f0f2f5;
  --bg-gradient-end: #e9edf3;
  --sidebar-bg: #ffffff;
  --panel-bg: #f8f9fa;
  --sidebar-border: #e2e8f0;
  --tab-bg: #f8fafc;
  --tab-border: #e2e8f0;
  --text-primary: #1a1a1a;
  --text-secondary: #64748b;
  --accent-color: #f5aa5f;
  --accent-glow: rgba(245, 170, 95, 0.4);
  --input-bg: #ffffff;
  --input-border: #cbd5e1;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
  --header-height: 70px;
  --primary: #0284c7;
  --surface: #ffffff;
  --bg: #f8fafc;
  --border: #e2e8f0;
  --text: #1a1a1a;
  --text-muted: #64748b;
  --color-text-muted: var(--text-muted);

  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  font-weight: 400;

  color-scheme: light;
  color: var(--text-primary);
  background-color: var(--bg-main);

  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.dark,
[data-theme="dark"],
:root[data-theme="dark"] {
  --bg-main: #0b1120;
  --bg-workspace: #070a12;
  --bg-gradient-start: #0b1120;
  --bg-gradient-mid: #0f172a;
  --bg-gradient-end: #070a12;
  --sidebar-bg: #0f172a;
  --panel-bg: #1e293b;
  --sidebar-border: #1e293b;
  --tab-bg: #172033;
  --tab-border: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --input-bg: #0b1120;
  --input-border: #334155;
  --surface: #1e293b;
  --bg: #0f172a;
  --border: #334155;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --color-text-muted: var(--text-muted);
  --primary: #38bdf8;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6);

  color-scheme: dark;
  color: var(--text-primary);
  background-color: var(--bg-main);
}

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

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ========== Header ========== */
.header {
  height: var(--header-height);
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--sidebar-border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  height: 100%;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-width: 0;
}

.btn-back {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-back:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-back-icon {
  font-size: 1.1rem;
  line-height: 1;
  transition: transform 0.2s ease;
}

.btn-back:hover .btn-back-icon {
  transform: translateX(-3px);
}

.product-identity {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.product-isotype {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: linear-gradient(135deg, rgba(245, 170, 95, 0.18), rgba(2, 132, 199, 0.18));
  border: 1px solid rgba(245, 170, 95, 0.4);
  color: var(--accent-color);
  flex-shrink: 0;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.product-isotype:hover {
  transform: translateY(-1px) scale(1.04);
  border-color: var(--accent-color);
  box-shadow: 0 4px 12px var(--accent-glow);
}

.bcs-isotype-icon {
  width: 22px;
  height: 22px;
}

.product-title-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.product-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.product-badge-pro {
  font-size: 0.625rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  background: linear-gradient(135deg, #f5aa5f, #ff7a00);
  color: #070a12;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
}

.product-subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-primary);
  font-size: 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: var(--accent-color);
  color: #0f172a;
  border-color: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Global Form Controls & Buttons */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="number"],
select,
textarea {
  background-color: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

select option {
  background-color: var(--panel-bg);
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
}

.btn-outline-danger {
  background: transparent;
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.5);
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-outline-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #f87171;
}

/* ========== Canonical Button System (SPIKE-16.8) ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
  white-space: nowrap;
  box-sizing: border-box;
}

.btn:focus-visible,
button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn:disabled,
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Button Variants */
.btn--primary,
.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn--primary:hover:not(:disabled),
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.25);
}

.btn--primary:active:not(:disabled),
.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn--secondary,
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn--secondary:hover:not(:disabled),
.btn-secondary:hover:not(:disabled) {
  background: var(--panel-bg);
  border-color: var(--text-muted);
  color: var(--text);
}

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

.btn--ghost:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text);
}

body.dark .btn--ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.btn--danger,
.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

.btn--danger:hover:not(:disabled),
.btn-danger:hover:not(:disabled) {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
}

/* Button Sizes */
.btn--sm {
  height: 28px;
  padding: 0 8px;
  font-size: 0.75rem;
}

.btn--md {
  height: 36px;
  padding: 0 14px;
  font-size: 0.8125rem;
}

.btn--full {
  width: 100%;
}

/* ========== SVG Icon System (SPIKE-16.8) ========== */
.bcs-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  stroke: currentColor;
}

/* ========== Global Toast System (SPIKE-16.8) ========== */
.bcs-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
  pointer-events: none;
}

.bcs-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.25), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.35;
  pointer-events: auto;
  transform: translateY(0);
  opacity: 1;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
  animation: bcsToastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes bcsToastSlideIn {
  from {
    transform: translateY(12px) scale(0.96);
    opacity: 0;
  }

  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.bcs-toast--leaving {
  transform: translateY(8px) scale(0.96);
  opacity: 0;
}

.bcs-toast__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bcs-toast__message {
  flex: 1;
  word-break: break-word;
}

.bcs-toast__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.bcs-toast__close:hover {
  background: rgba(0, 0, 0, 0.08);
  color: var(--text);
}

body.dark .bcs-toast__close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

/* Toast Variants */
.bcs-toast--success {
  border-left: 4px solid #10b981;
}

.bcs-toast--success .bcs-toast__icon {
  color: #10b981;
}

.bcs-toast--info {
  border-left: 4px solid var(--primary);
}

.bcs-toast--info .bcs-toast__icon {
  color: var(--primary);
}

.bcs-toast--warning {
  border-left: 4px solid #f59e0b;
}

.bcs-toast--warning .bcs-toast__icon {
  color: #f59e0b;
}

.bcs-toast--error {
  border-left: 4px solid #ef4444;
}

.bcs-toast--error .bcs-toast__icon {
  color: #ef4444;
}

/* ========== Accessible Micro-Tooltips (SPIKE-16.8) ========== */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #0f172a;
  color: #f8fafc;
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 1000;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark [data-tooltip]::before {
  background: #1e293b;
  color: #ffffff;
  border-color: #334155;
}

[data-tooltip]:hover::before,
[data-tooltip]:focus-visible::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  transition-delay: 0.2s;
}

/* Tooltip placements */
[data-tooltip-pos="bottom"]::before {
  bottom: auto;
  top: calc(100% + 6px);
  transform: translateX(-50%) translateY(-4px);
}

[data-tooltip-pos="bottom"]:hover::before,
[data-tooltip-pos="bottom"]:focus-visible::before {
  transform: translateX(-50%) translateY(0);
}


/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

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

/* ========== Workspace 3-Column Studio Layout ========== */
.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 280px 1fr 340px;
  height: calc(100vh - var(--header-height));
  max-height: calc(100vh - var(--header-height));
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  background: var(--bg-workspace);
}

/* ========== Columna 1 (Izquierda): Estructura & Capas ========== */
.workspace__left {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
  z-index: 5;
}

/* LayerPanel 2.0 Component Styles */
.layer-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0.75rem;
  box-sizing: border-box;
  gap: 0.75rem;
}

.layer-panel__header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border-bottom: 1px solid var(--sidebar-border);
  padding-bottom: 0.5rem;
}

.layer-panel__title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.layer-panel__title-row h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.layer-panel__history {
  display: flex;
  gap: 4px;
}

.layer-panel__history .btn--sm {
  padding: 3px 8px;
  font-size: 0.8125rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  line-height: 1.2;
}

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

.layer-panel__sides {
  display: flex;
  gap: 6px;
}

.layer-panel__sides .btn {
  flex: 1;
  padding: 6px 8px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 6px;
  text-align: center;
}

.layer-panel__add {
  display: flex;
  gap: 6px;
}

.layer-panel__add .btn {
  flex: 1;
  padding: 6px 8px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
}

.layer-panel__add .btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--panel-bg);
}

.layer-panel__zorder {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.layer-panel__zorder .btn {
  padding: 4px 1px;
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  line-height: 1.2;
  transition: all 0.15s ease;
}

.layer-panel__zorder .btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

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

.layer-panel__list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  position: relative;
  padding-right: 2px;
}

.layer-panel__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 0.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8125rem;
  gap: 4px;
}

.layer-item {
  flex-shrink: 0;
  min-height: 38px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  box-sizing: border-box;
}

.layer-item:hover {
  background: var(--panel-bg);
  border-color: var(--text-muted);
}

.layer-item--selected {
  background: rgba(56, 189, 248, 0.12) !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 1px var(--primary);
}

.layer-item--locked {
  opacity: 0.75;
}

.layer-item--hidden {
  opacity: 0.45;
}

.layer-item__main {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
  min-height: 36px;
}

.layer-item__badge {
  font-size: 0.85rem;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.layer-item__badge--text {
  color: #38bdf8;
}

.layer-item__badge--shape {
  color: #f5aa5f;
}

.layer-item__badge--image {
  color: #10b981;
}

.layer-item__info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.layer-item__title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.layer-item__preview {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.layer-item__rename-input {
  font-size: 0.8125rem;
  padding: 2px 4px;
  border: 1px solid var(--primary);
  border-radius: 4px;
  background: var(--input-bg);
  color: var(--text);
  width: 100%;
}

.layer-item__actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

/* Secondary action buttons hidden by default to prioritize layer name legibility */
.layer-btn--secondary {
  display: none !important;
}

/* Secondary action buttons reveal on hover or row selection */
.layer-item:hover .layer-btn--secondary,
.layer-item--selected .layer-btn--secondary,
.layer-item:focus-within .layer-btn--secondary {
  display: inline-flex !important;
}

.layer-btn {
  background: transparent;
  border: none;
  padding: 3px 5px;
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.layer-btn:hover {
  background: var(--border);
  color: var(--text);
}

.layer-btn--active {
  color: var(--primary);
}

.layer-btn--locked {
  color: #ef4444;
}

.layer-btn--danger:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* Context Menu */
.layer-context-menu {
  position: absolute;
  top: 100%;
  right: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: 4px;
  z-index: 50;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.context-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  background: transparent;
  border: none;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.context-item:hover {
  background: var(--panel-bg);
  color: var(--primary);
}

.context-item--danger:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

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

.layer-context-menu__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  background: transparent;
  border: none;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.layer-context-menu__item:hover {
  background: var(--panel-bg);
  color: var(--primary);
}

.layer-context-menu__item--danger:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* ========== Columna 2 (Centro): Viewport & Canvas ========== */
.workspace__center {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  position: relative;
  background: var(--bg-workspace);
  min-width: 0;
}

/* Viewport Toolbar */
.workspace-viewport-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 1rem;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--sidebar-border);
  gap: 0.75rem;
  flex-shrink: 0;
  flex-wrap: wrap;
  /* Stacking context ABOVE the canvas guide overlays (guides-svg z10,
     layer-context-menu z50): the studio menu drops down over the stage. */
  position: relative;
  z-index: 60;
}

.view-modes-group {
  display: inline-flex;
  background: var(--panel-bg);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border);
  gap: 2px;
}

.btn-mode {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

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

.btn-mode.active {
  background: var(--surface);
  color: var(--primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.viewport-quick-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Export picker — consolidated Mockup/GIF/Video dropdown (same pattern
   as .scene-picker): keeps the toolbar inside its bounds on any width. */
.export-picker {
  position: relative;
  display: inline-flex;
}

.export-picker__menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 218px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  box-shadow: var(--shadow-sm);
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.export-picker__menu[hidden] {
  display: none;
}

.export-picker__item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 7px 10px;
  border-radius: 5px;
  font-size: 0.75rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}

.export-picker__item:hover:not(:disabled) {
  background: var(--panel-bg);
  color: var(--primary);
}

.export-picker__item:disabled {
  opacity: 0.55;
  cursor: wait;
}

.export-picker__text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.export-picker__text strong {
  font-weight: 600;
}

.export-picker__text small {
  color: var(--text-muted);
  font-size: 0.6875rem;
}

.btn-viewport-action {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.btn-viewport-action:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Scene Picker (SPIKE 41.4) */
.scene-picker {
  position: relative;
  display: inline-flex;
}

.scene-picker__menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 148px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  box-shadow: var(--shadow-sm);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.scene-picker__menu[hidden] {
  display: none;
}

.scene-picker__item {
  background: transparent;
  border: none;
  color: var(--text);
  padding: 6px 10px;
  border-radius: 5px;
  font-size: 0.75rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}

.scene-picker__item:hover {
  background: var(--panel-bg);
}

.scene-picker__item.active {
  color: var(--primary);
  font-weight: 600;
  background: var(--panel-bg);
}

/* ============ Presentation Ribbon (FASE 1 — office-style tabs) ============ */
/* In-flow panel under the toolbar: the stage reflows (renderer re-fits via
   ResizeObserver) — never overlays nor deforms the 3D viewport. */
.pres-ribbon {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  width: 100%;
}

.pres-ribbon[hidden] {
  display: none;
}

/* Tab bar — wraps, never scrolls */
.rib__tabbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
}

.rib__tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted, #64748b);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 8px 12px 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.rib__tab:hover {
  color: var(--text);
}

.rib__tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.rib__reset {
  margin-left: auto;
  font-size: 0.64rem;
  font-weight: 600;
  color: var(--text-muted, #64748b);
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 3px 9px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.12s ease, border-color 0.12s ease;
}

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

/* Panels — groups wrap to fit, no horizontal scroll */
.rib__panel {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  row-gap: 4px;
  padding: 6px 12px;
  overflow: visible;
}

.rib__panel[hidden] {
  display: none;
}

.rib__group {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  padding-right: 10px;
  margin-right: 10px;
  min-width: 0;
}

.rib__group:last-child {
  border-right: none;
  padding-right: 0;
  margin-right: 0;
}

.rib__group-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
  flex: 1;
}

.rib__group-body--row {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
}

.rib__group-label {
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted, #64748b);
  text-align: center;
  padding-top: 4px;
}

/* Segmented controls — buttons shrink and wrap to fit */
.rib__seg {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 2px;
  max-width: 100%;
}

.rib__seg-btn {
  flex: 0 1 auto;
  padding: 4px 8px;
  font-size: 0.66rem;
  font-weight: 500;
  color: var(--text-muted, #64748b);
  background: transparent;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease;
}

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

.rib__seg-btn.active {
  background: var(--surface);
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* Buttons */
.rib__btn {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text);
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.12s ease, color 0.12s ease;
}

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

.rib__btn--accent {
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

.rib__btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.rib__btn[disabled]:hover {
  border-color: var(--border);
  color: var(--text);
}

/* Selects */
.rib__select {
  font-size: 0.7rem;
  padding: 4px 8px;
  min-width: 150px;
  max-width: 210px;
  background: var(--panel-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.rib__select[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Color pickers */
.rib__colors {
  display: flex;
  gap: 12px;
}

.rib__color {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.66rem;
  color: var(--text);
}

.rib__color input[type="color"] {
  width: 32px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
}

/* Sliders with live value badge */
.rib__slider {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 140px;
}

.rib__slider input[type="range"] {
  flex: 1;
  height: 3px;
  accent-color: var(--primary);
}

.rib__slider-val {
  min-width: 34px;
  text-align: right;
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.rib__note {
  font-size: 0.6rem;
  color: var(--text-muted, #64748b);
  font-style: italic;
  max-width: 180px;
}

.rib__note--error {
  color: #b91c1c;
  font-style: normal;
}

/* ============ Material Studio (FASE 2) ============ */
.matgrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  max-width: 380px;
}

.matcard {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 5px 4px 4px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

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

.matcard.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary) inset;
}

.matcard__swatch {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background-position: center;
}

.matcard__swatch--default {
  background: repeating-linear-gradient(45deg, var(--surface) 0 6px, var(--panel-bg) 6px 12px);
}

.matcard__label {
  font-size: 0.58rem;
  color: var(--text);
  max-width: 74px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.matcard__del {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 0.7rem;
  line-height: 1;
  color: var(--text-muted, #64748b);
}

.matcard__del:hover {
  color: #b91c1c;
}

.matcard__tag {
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 1px 4px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  color: var(--primary);
}

/* ---- Photo → material generator (FASE 3) ---- */
.photogen__row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.photogen__thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

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

.photogen__opts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.photogen__opt {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.66rem;
  color: var(--text);
  cursor: pointer;
}

.photogen__sliders {
  display: flex;
  gap: 14px;
}

.photogen__slider {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.62rem;
  color: var(--text-muted, #64748b);
  flex: 1;
}

.photogen__slider input[type="range"] {
  width: 100%;
}

.rib__seg-btn--accent {
  color: var(--primary);
  font-weight: 600;
}

.matimport {
  margin-top: 6px;
}

.matimport__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  max-width: 380px;
}

.matimport__name {
  min-width: 0;
  width: 100%;
}

.matimport__maps {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.matimport__map {
  font-size: 0.6rem;
  padding: 2px 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
}

.matimport__actions {
  display: flex;
  gap: 6px;
}

@media (max-width: 720px) {
  .matgrid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-width: 100%;
  }
}

/* Mobile — tabs compress, groups stack, ribbon caps height over the viewport */
@media (max-width: 720px) {
  .pres-ribbon {
    max-height: 70vh;
    overflow-y: auto;
  }

  .rib__tab {
    padding: 7px 9px 5px;
    font-size: 0.66rem;
  }

  .rib__group {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 0 0 6px;
    margin-right: 0;
    width: 100%;
  }
}

/* Viewport Stage */
.workspace-stage {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
  min-height: 0;
  width: 100%;
  background: radial-gradient(circle at center, rgba(56, 189, 248, 0.04) 0%, transparent 70%), var(--bg-workspace);
}

.stage-pane {
  height: 100%;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

/* Mode 2D */
.workspace-stage.mode--2d .stage-pane--2d {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.workspace-stage.mode--2d .stage-pane--3d {
  display: none !important;
}

/* Mode 3D */
.workspace-stage.mode--3d .stage-pane--3d {
  flex: 1;
  display: block !important;
  width: 100%;
  height: 100%;
}

.workspace-stage.mode--3d .stage-pane--2d {
  display: none !important;
}

/* Mode Split */
.workspace-stage.mode--split .stage-pane--2d {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--sidebar-border);
}

.workspace-stage.mode--split .stage-pane--3d {
  flex: 1;
  display: block !important;
}

/* Canvas Container in 3D */
.canvas-container {
  background: transparent;
  overflow: hidden;
  position: relative;
  width: 100%;
  height: 100%;
}

.canvas-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* Status Bar */
.workspace-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  background: var(--sidebar-bg);
  border-top: 1px solid var(--sidebar-border);
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
  height: 28px;
}

.status-bar__left,
.status-bar__center,
.status-bar__right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-indicator {
  color: #10b981;
  font-weight: 600;
}

.status-badge {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  padding: 1px 8px;
  border-radius: 10px;
  font-weight: 600;
  color: var(--text);
}

/* ========== Columna 3 (Derecha): Inspector & Herramientas ========== */
.workspace__right {
  background: var(--sidebar-bg);
  border-left: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  box-sizing: border-box;
  z-index: 5;
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--sidebar-border);
  background: var(--tab-bg);
  flex-shrink: 0;
}

.sidebar-tab {
  flex: 1;
  padding: 0.65rem 0.5rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
}

.sidebar-tab:hover {
  color: var(--text);
}

.sidebar-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--sidebar-bg);
}

.sidebar-tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.75rem;
  box-sizing: border-box;
}

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

/* Contextual Inspector Component Styles */
.contextual-inspector {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

.inspector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--sidebar-border);
  padding-bottom: 0.5rem;
}

.inspector-title-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.inspector-layer-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.inspector-layer-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inspector-quick-actions {
  display: flex;
  gap: 4px;
}

.btn-lock-toggle {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text-muted);
}

.btn-lock-toggle.active {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #ef4444;
}

.inspector-locked-notice {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 170, 95, 0.12);
  border: 1px solid rgba(245, 170, 95, 0.4);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.75rem;
  color: var(--text-primary);
}

.inspector-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
}

.inspector-empty__icon {
  font-size: 2rem;
  color: var(--primary);
  opacity: 0.6;
  margin-bottom: 0.5rem;
}

.inspector-empty__title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.inspector-empty__desc {
  font-size: 0.8rem;
  line-height: 1.4;
  margin-bottom: 1.25rem;
  max-width: 240px;
}

.inspector-empty__info-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
}

.info-label {
  color: var(--text-muted);
}

.info-val {
  color: var(--text-primary);
  font-weight: 600;
}

/* Inspector Sections */
.inspector-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.inspector-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.75rem;
  background: var(--panel-bg);
  cursor: pointer;
  user-select: none;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid transparent;
}

.inspector-section__header:hover {
  color: var(--primary);
}

.inspector-header__main {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.inspector-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary, #3b82f6);
  flex-shrink: 0;
}

.inspector-badge--text {
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
}

.inspector-badge--shape {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
}

.inspector-badge--image,
.inspector-badge--logo {
  background: rgba(168, 85, 247, 0.15);
  color: #9333ea;
}

.inspector-badge--qr {
  background: rgba(20, 184, 166, 0.15);
  color: #0d9488;
}

.inspector-header__info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.inspector-header__title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inspector-header__type {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-family: monospace;
}

.inspector-section__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: var(--panel-bg);
  border: none;
  cursor: pointer;
  user-select: none;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  border-bottom: 1px solid transparent;
  transition: all 0.15s ease;
}

.inspector-section--open .inspector-section__toggle {
  border-bottom-color: var(--border);
}

.inspector-section__toggle:hover {
  color: var(--primary);
}

.inspector-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.inspector-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.inspector-field--full {
  grid-column: 1 / -1;
}

.field-label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
}

.inspector-field input[type="number"],
.inspector-field input[type="text"],
.inspector-input,
.inspector-select,
.inspector-textarea {
  width: 100%;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.8rem;
  box-sizing: border-box;
  font-family: inherit;
  transition: border-color 0.15s ease;
}

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

.inspector-field input:disabled,
.inspector-select:disabled,
.inspector-textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--panel-bg);
}

.inspector-field input[type="color"] {
  width: 100%;
  height: 32px;
  padding: 1px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--input-bg);
  cursor: pointer;
  box-sizing: border-box;
}

.inspector-textarea {
  resize: vertical;
  min-height: 48px;
  line-height: 1.35;
}

.inspector-binding-note {
  font-size: 0.7rem;
  color: var(--primary);
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 4px;
  padding: 0.3rem 0.5rem;
  margin-top: 0.2rem;
}

.field-hint {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.text-align-group {
  display: flex;
  gap: 4px;
  width: 100%;
}

.btn-align-text {
  flex: 1;
  padding: 5px 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel-bg);
  color: var(--text-muted);
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-align-text:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-align-text.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.range-with-val {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.range-with-val input[type="range"] {
  flex: 1;
  accent-color: var(--primary);
}

.range-val {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  min-width: 36px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.inspector-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--text);
  cursor: pointer;
}

.inspector-zorder-actions {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding-top: 0.25rem;
}

.zorder-label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
}

.zorder-btn-group {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.zorder-btn-group .btn {
  padding: 4px 2px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.inspector-danger-zone {
  padding-top: 0.4rem;
  border-top: 1px solid var(--border);
  margin-top: 0.2rem;
}

.btn-outline-danger {
  width: 100%;
  padding: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #ef4444;
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-outline-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
}

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

.inspector-section__body {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.field-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.field-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
}

.align-btn-group {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 3px;
}

.btn-align {
  padding: 5px 2px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-align:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.align-row-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.btn-action-sm {
  padding: 4px 6px;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel-bg);
  color: var(--text);
  cursor: pointer;
  text-align: center;
}

.btn-action-sm:hover {
  background: var(--surface);
  border-color: var(--primary);
  color: var(--primary);
}

.tools-accordion {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card-form-details {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem;
  background: var(--surface);
}

.card-form-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--text);
  padding: 0.25rem 0.5rem;
}

/* ========== Controls Panel ========== */
.controls-panel {
  background: var(--sidebar-bg);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: var(--shadow-md);
  overflow-y: auto;
  overflow-x: hidden;
  max-height: calc(100vh - var(--header-height) - 2rem);
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
}

.controls-panel h2 {
  font-size: 1.25rem;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
}

/* Formulario Principal de Datos */
#card-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
}

.form-group {
  margin-bottom: 1rem;
  width: 100%;
  box-sizing: border-box;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.875rem;
}

.form-group input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.75rem;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ========== Footer ========== */
.footer {
  padding: 1rem;
  text-align: center;
  background: var(--sidebar-bg);
  border-top: 1px solid var(--sidebar-border);
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* ========== Responsive ========== */
@media (max-width: 1024px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .controls-panel {
    max-height: none;
  }
}

@media (max-width: 768px) {
  .header-content {
    padding: 0 1rem;
  }

  .header h1 {
    font-size: 1.15rem;
  }

  .workspace {
    padding: 0.5rem;
  }

  .canvas-container {
    min-height: 300px;
  }
}

@media (max-width: 640px) {
  .header-left {
    gap: 0.5rem;
  }

  .btn-back {
    padding: 6px 10px;
    font-size: 0.8rem;
  }

  .btn-back-text {
    display: none;
  }
}

/* ========== Utilities ========== */
.transition {
  transition: all 0.3s ease;
}

.shadow-sm {
  box-shadow: var(--shadow-sm);
}

.shadow-md {
  box-shadow: var(--shadow-md);
}

.shadow-lg {
  box-shadow: var(--shadow-lg);
}


/* ============================================
   PHASE 3 COMPONENTS STYLES
   ============================================ */

/* Color Picker Component */
.color-picker {
  padding: 16px;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

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

.color-picker-label {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.color-picker-preview {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--border);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.color-picker {
  padding: 1rem;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 1rem;
  box-sizing: border-box;
  max-width: 100%;
}

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

.color-picker-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  width: 100%;
  align-items: center;
}

.color-picker-input {
  width: 50px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  box-sizing: border-box;
  padding: 2px;
  background: var(--bg);
}

.color-picker-text {
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-family: 'Courier New', monospace;
  font-size: 14px;
}

.color-picker-text:focus {
  outline: none;
  border-color: var(--primary);
}

.color-picker-presets {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  width: 100%;
}

.color-preset {
  width: 100%;
  min-width: 0;
  aspect-ratio: 1;
  border: 2px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.color-preset:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.color-preset:active {
  transform: scale(0.95);
}

/* Font Selector Component */
.font-selector {
  padding: 1rem;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 1rem;
  box-sizing: border-box;
  max-width: 100%;
  overflow: hidden;
}

.font-selector-header {
  margin-bottom: 10px;
}

.font-selector-label {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  display: block;
}

.font-selector-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
  width: 100%;
}

.font-selector-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  min-width: 0;
}

.font-selector-sublabel {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.font-selector-select,
.font-weight-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.font-selector-select:focus,
.font-weight-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.15);
}

.font-selector-preview {
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-align: center;
  font-size: 16px;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  box-sizing: border-box;
  word-break: break-word;
  overflow-wrap: anywhere;
  overflow: hidden;
}

/* Template Gallery Component */
.template-gallery {
  padding: 16px;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.template-gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.template-gallery-title {
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
  margin: 0;
}

.template-gallery-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.template-filter-btn {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.template-filter-btn:hover {
  background: var(--surface);
  border-color: var(--primary);
}

.template-filter-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.template-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
  padding: 4px;
}

.template-card {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
}

.template-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.template-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
}

.template-card-preview {
  width: 100%;
  aspect-ratio: 1.586;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  position: relative;
}

.template-card-preview-content {
  text-align: center;
  width: 100%;
  overflow: hidden;
}

.template-card-info {
  padding: 8px 12px;
  background: var(--surface);
}

.template-card-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.template-card-category {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.template-gallery-empty {
  grid-column: 1 / -1;
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* Scrollbar styling for template grid */
.template-gallery-grid::-webkit-scrollbar {
  width: 6px;
}

.template-gallery-grid::-webkit-scrollbar-track {
  background: var(--surface);
  border-radius: 3px;
}

.template-gallery-grid::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.template-gallery-grid::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .template-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    max-height: 300px;
  }

  .color-picker-presets {
    grid-template-columns: repeat(4, 1fr);
  }

  .template-categories {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }
}


/* QR Panel Component */
.qr-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 16px;
  overflow: hidden;
}

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

.qr-panel-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.qr-panel-collapse {
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px;
  color: var(--text-muted);
  transition: color 0.2s;
}

.qr-panel-collapse:hover {
  color: var(--text);
}

.qr-panel-content {
  padding: 16px;
}

.qr-type-selector {
  margin-bottom: 16px;
}

.qr-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.qr-select,
.qr-input,
.qr-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.qr-select:focus,
.qr-input:focus,
.qr-textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.qr-textarea {
  resize: vertical;
  min-height: 60px;
}

.qr-form {
  margin-bottom: 16px;
}

.qr-field {
  margin-bottom: 12px;
}

.qr-info {
  padding: 12px;
  background: rgba(0, 123, 255, 0.1);
  border-left: 3px solid var(--primary);
  border-radius: 4px;
  margin-bottom: 16px;
}

.qr-info p {
  margin: 0;
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}

.qr-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.qr-option {
  display: flex;
  flex-direction: column;
}

.qr-color-input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
}

.qr-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.btn {
  padding: 10px 16px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  flex: 1;
}

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

.btn-primary:hover {
  background: #0056b3;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

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

.qr-preview {
  text-align: center;
  padding: 16px;
  background: var(--bg);
  border-radius: 4px;
  border: 2px dashed var(--border);
}

.qr-preview img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

/* Responsive */
@media (max-width: 768px) {
  .qr-options {
    grid-template-columns: 1fr;
  }

  .qr-actions {
    flex-direction: column;
  }
}

/* Template application decision */
.template-apply-dialog {
  width: min(92vw, 520px);
  margin: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--sidebar-bg);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
}

.template-apply-dialog::backdrop {
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(3px);
}

.template-apply-dialog__content {
  display: grid;
  gap: 1rem;
  padding: 1.5rem;
}

.template-apply-dialog__content h2 {
  font-size: 1.25rem;
}

.template-apply-dialog__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.template-apply-dialog__actions .btn:last-child {
  grid-column: 1 / -1;
}

@media (max-width: 520px) {
  .template-apply-dialog__actions {
    grid-template-columns: 1fr;
  }

  .template-apply-dialog__actions .btn:last-child {
    grid-column: auto;
  }
}

.asset-panel {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.asset-panel h3 {
  font-size: 1rem;
}

.asset-panel__field {
  display: grid;
  gap: 0.35rem;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 600;
}

.asset-panel__field input {
  width: 100%;
  color: var(--text-muted);
}

.asset-panel__status {
  min-height: 1.25rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.export-panel {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.export-panel label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.export-panel select {
  width: 100%;
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--text);
}

.export-panel__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  width: 100%;
}

.export-panel__actions [data-export="publish"] {
  grid-column: 1 / -1;
}

.export-panel [data-status] {
  min-height: 1.25rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.layer-panel {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-sizing: border-box;
  max-width: 100%;
}

.layer-panel__header {
  display: flex;
  gap: 0.5rem;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.layer-panel__header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.layer-panel__history {
  display: flex;
  gap: 0.35rem;
}

.layer-panel__history .btn {
  font-size: 0.72rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.layer-panel__sides {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  width: 100%;
}

.layer-panel__sides .btn {
  font-size: 0.82rem;
  padding: 0.5rem;
  font-weight: 600;
  text-align: center;
}

.layer-panel__zorder {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
  width: 100%;
}

.layer-panel__zorder .btn {
  font-size: 0.72rem;
  padding: 0.35rem 0.2rem;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.layer-panel__list {
  display: grid;
  gap: 0.5rem;
  max-height: 420px;
  overflow-y: auto;
  overflow-x: hidden;
  width: 100%;
  padding-right: 2px;
}

.layer-panel__empty {
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  border: 1px dashed var(--border);
  border-radius: 6px;
}

.layer-item {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  box-sizing: border-box;
  transition: border-color 0.15s ease, background 0.15s ease;
  overflow: hidden;
}

.layer-item:hover {
  border-color: var(--primary, #3b82f6);
}

.layer-item--selected {
  border-color: var(--primary, #3b82f6) !important;
  background: rgba(59, 130, 246, 0.08);
  box-shadow: 0 0 0 1px var(--primary, #3b82f6);
}

.layer-item--hidden {
  opacity: 0.55;
}

.layer-item--locked {
  border-left: 3px solid #f59e0b;
}

.layer-item__main {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  min-width: 0;
  cursor: pointer;
}

.layer-item__badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 5px;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.layer-item__badge--text {
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
}

.layer-item__badge--shape {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
}

.layer-item__badge--image,
.layer-item__badge--logo {
  background: rgba(168, 85, 247, 0.15);
  color: #9333ea;
}

.layer-item__badge--qr {
  background: rgba(20, 184, 166, 0.15);
  color: #0d9488;
}

.layer-item__info {
  display: grid;
  gap: 0.1rem;
  flex: 1 1 auto;
  min-width: 0;
}

.layer-item__title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
}

.layer-item__rename-input {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text, #111827);
  background: var(--bg-surface, #ffffff);
  border: 1px solid var(--primary, #3b82f6);
  border-radius: 4px;
  padding: 1px 5px;
  outline: none;
  width: 100%;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
  box-sizing: border-box;
}

.layer-item__preview {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.layer-item__actions {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
}

.layer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.layer-btn:hover {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.layer-btn--active {
  color: var(--primary, #3b82f6);
}

.layer-btn--danger:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

.layer-item__details {
  border-top: 1px solid var(--border);
  padding: 0.6rem 0.65rem;
  background: var(--surface);
  display: grid;
  gap: 0.5rem;
}

.layer-panel__add {
  display: flex;
  gap: 0.4rem;
  width: 100%;
}

.layer-panel__add .btn {
  flex: 1 1 0;
  font-size: 0.76rem;
  padding: 0.4rem 0.5rem;
}

.layer-field-full {
  grid-column: 1 / -1;
  display: grid;
  gap: 0.2rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
}

.layer-field-full input[type="text"] {
  width: 100%;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.82rem;
  box-sizing: border-box;
}

.layer-details-grid input[type="color"] {
  width: 100%;
  height: 28px;
  padding: 1px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--input-bg);
  cursor: pointer;
  box-sizing: border-box;
}

.layer-details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
}

.layer-details-grid label {
  display: grid;
  gap: 0.2rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
}

.layer-details-grid input[type="number"] {
  width: 100%;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.8rem;
  box-sizing: border-box;
}

.layer-align-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
  padding-top: 0.2rem;
}

.layer-align-actions span {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
}

.layer-align-actions button {
  font-size: 0.7rem;
  padding: 0.2rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--input-bg);
  color: var(--text);
  cursor: pointer;
}

.layer-align-actions button:hover {
  background: var(--border);
}

.material-panel,
.print-panel {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-sizing: border-box;
  max-width: 100%;
}

.material-panel select,
.print-panel select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--text);
}

.material-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.material-panel__header h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.material-panel__badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary, #3b82f6);
  border: 1px solid rgba(59, 130, 246, 0.25);
  white-space: nowrap;
}

.material-panel__hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.35;
}

.material-info-card {
  padding: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: grid;
  gap: 0.35rem;
}

.material-info-card__cat {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary, #3b82f6);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.material-info-card__desc {
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.4;
  margin: 0;
}

.material-sliders {
  display: grid;
  gap: 0.75rem;
  padding-top: 0.25rem;
}

.material-slider-row {
  display: grid;
  gap: 0.3rem;
}

.material-slider-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.material-slider-val {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text);
}

.material-sliders input[type="range"] {
  width: 100%;
  accent-color: var(--primary, #3b82f6);
  cursor: pointer;
}

.material-reset-btn {
  justify-self: start;
  font-size: 0.75rem;
  padding: 0.4rem 0.75rem;
  margin-top: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--input-bg);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease;
}

.material-reset-btn:hover {
  background: var(--border);
}

.print-panel label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--text);
}

.print-panel__header h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.print-panel__checkbox-label {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem !important;
  cursor: pointer;
}

.print-panel__checkbox-label input[type="checkbox"] {
  width: auto;
  accent-color: var(--primary, #3b82f6);
  cursor: pointer;
}

.print-panel__custom-controls {
  display: grid;
  gap: 0.5rem;
  padding: 0.6rem;
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: var(--bg);
}

.print-panel__custom-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.print-panel__custom-row input[type="number"] {
  width: 100%;
  box-sizing: border-box;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.85rem;
}

.print-panel__specs {
  display: grid;
  gap: 0.35rem;
  padding: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.78rem;
}

.print-panel__spec-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.print-panel__spec-label {
  color: var(--text-muted);
  font-weight: 500;
}

.print-panel__spec-val {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.print-panel [data-status] {
  min-height: 1.2rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 0;
}

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

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

  .workspace__left {
    height: 300px;
    border-right: none;
    border-bottom: 1px solid var(--sidebar-border);
  }

  .workspace__center {
    height: 480px;
  }

  .workspace__right {
    height: auto;
    border-left: none;
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

.canvas-editor {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background: transparent;
  padding: 0;
  margin: 0;
  border: none;
  overflow: hidden;
}

.canvas-editor__header {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.85rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  gap: 0.75rem;
  z-index: 10;
  flex-shrink: 0;
}

.canvas-editor__title-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.canvas-editor__title-group h3 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.canvas-editor__guides-toggles {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: var(--bg);
  padding: 2px 4px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.btn-guide-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.22rem 0.48rem;
  font-size: 0.72rem;
  font-weight: 500;
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-guide-toggle:hover {
  background: var(--surface);
  color: var(--text);
}

.btn-guide-toggle.active {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
  font-weight: 600;
}

.btn-guide-toggle--master.active {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.3);
  color: var(--primary, #3b82f6);
}

.canvas-editor__zoom-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.canvas-editor__zoom-label input[type="range"] {
  width: 70px;
  accent-color: var(--primary, #3b82f6);
  cursor: pointer;
}

.canvas-editor__sides {
  display: none !important;
}

.canvas-editor__help {
  display: none !important;
}

.canvas-editor__viewport {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: transparent;
  overflow: auto;
  min-height: 0;
}

.canvas-editor__canvas-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 90%;
  max-height: 85%;
}

.canvas-editor canvas,
.canvas-editor__canvas-wrapper canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  height: auto;
  background: #ffffff;
  border-radius: 4px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(0, 0, 0, 0.08);
  cursor: default;
  touch-action: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

body.dark .canvas-editor canvas,
body.dark .canvas-editor__canvas-wrapper canvas {
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.canvas-editor canvas:focus-visible,
.canvas-editor__canvas-wrapper canvas:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 4px;
}

.canvas-editor__guides-svg {
  position: absolute;
  pointer-events: none;
  overflow: visible;
  z-index: 10;
}

.print-panel__guides-section {
  display: grid;
  gap: 0.4rem;
  padding: 0.65rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.print-panel__group-title {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.15rem;
}

.print-panel__guides-suboptions {
  display: grid;
  gap: 0.35rem;
  padding-left: 1.25rem;
  border-left: 2px solid var(--border);
  margin-top: 0.25rem;
}

/* Print Preview & Sheet Imposition Modal Dialog */
.print-preview-dialog {
  width: min(96vw, 1100px);
  max-height: 92vh;
  margin: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--sidebar-bg);
  color: var(--text-primary);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
  padding: 0;
  overflow: hidden;
}

.print-preview-dialog::backdrop {
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
}

.print-preview-dialog__container {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 92vh;
}

.print-preview-dialog__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.print-preview-dialog__title-group h2 {
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.print-preview-dialog__subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.print-preview-dialog__body {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.5rem;
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.print-preview-dialog__visualizer {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}

.print-preview-dialog__side-tabs {
  display: flex;
  gap: 0.5rem;
}

.print-preview-dialog__side-tabs .btn-active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.print-preview-dialog__svg-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 380px;
  max-height: 520px;
  background: #e2e8f0;
  border-radius: 6px;
  padding: 1rem;
  overflow: hidden;
}

.print-preview-svg {
  width: 100%;
  height: 100%;
  max-height: 480px;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.print-preview-dialog__sheet-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
}

.print-preview-dialog__controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.print-preview-dialog__group {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.print-preview-dialog__group legend {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0 0.35rem;
}

.print-preview-dialog__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.paper-badge {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.65rem;
  font-size: 0.8rem;
}

.paper-badge__top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.paper-badge__desc {
  margin: 0.25rem 0;
  color: var(--text-primary);
}

.paper-badge__notes {
  margin: 0.25rem 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.paper-warning {
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: #b45309;
  background: #fef3c7;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
}

.paper-badge__meta-notice {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.print-preview-dialog__prepress {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  background: var(--bg);
}

.prepress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.prepress-title {
  font-size: 0.85rem;
  font-weight: 600;
}

.prepress-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
}

.prepress-badge--pass {
  background: #dcfce7;
  color: #15803d;
}

.prepress-badge--warning {
  background: #fef3c7;
  color: #b45309;
}

.prepress-badge--error {
  background: #fee2e2;
  color: #b91c1c;
}

.prepress-checks-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 160px;
  overflow-y: auto;
}

.prepress-check-item {
  display: flex;
  gap: 0.5rem;
  font-size: 0.76rem;
  padding: 0.3rem 0.4rem;
  border-radius: 4px;
  background: var(--sidebar-bg);
}

.prepress-check-item__icon {
  font-weight: bold;
}

.check-item--pass .prepress-check-item__icon {
  color: #16a34a;
}

.check-item--warning .prepress-check-item__icon {
  color: #d97706;
}

.check-item--error .prepress-check-item__icon {
  color: #dc2626;
}

.prepress-check-item__info {
  display: flex;
  flex-direction: column;
}

.prepress-check-item__label {
  font-weight: 600;
}

.prepress-check-item__msg {
  color: var(--text-muted);
}

.prepress-check-item__detail {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-style: italic;
}

.print-preview-dialog__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: auto;
}

.print-preview-dialog__status {
  font-size: 0.75rem;
  color: var(--text-muted);
  min-height: 1rem;
}

@media (max-width: 860px) {
  .print-preview-dialog__body {
    grid-template-columns: 1fr;
  }
}/**
 * Local Font Declarations
 */

/* Batman Forever */
@font-face {
  font-family: 'Batman Forever';
  src: url('/fonts/batman-forever-font-betterstudio.com/batmfo__.woff2') format('woff2'), url('/fonts/batman-forever-font-betterstudio.com/batmfo__.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* Great Vibes */
@font-face {
  font-family: 'Great Vibes';
  src: url('/fonts/great_vibes/greatvibes-regular.woff2') format('woff2'), url('/fonts/great_vibes/greatvibes-regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* Rufina - Regular */
@font-face {
  font-family: 'Rufina';
  src: url('/fonts/rufina/rufina-regular.woff2') format('woff2'), url('/recursos/plantillas/business-card-studio-v3/fonts/rufina/rufina-regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* Rufina - Bold */
@font-face {
  font-family: 'Rufina';
  src: url('/fonts/rufina/rufina-bold.woff2') format('woff2'), url('/recursos/plantillas/business-card-studio-v3/fonts/rufina/rufina-bold.ttf') format('truetype');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}