/* ═══════════════════════════════════════════════════════
   DATASLATE PATCHSMITH — Main Stylesheet
   Extracted from templates/index.html (Iteration 1)
═══════════════════════════════════════════════════════ */

:root {
  --bg-void: #050507;
  --surface-0: #0d0d14;
  --surface-1: #111119;
  --surface-2: #17171f;
  --surface-3: #1e1e28;
  --surface-4: #252532;

  --border-subtle: rgba(255, 255, 255, 0.055);
  --border-dim: rgba(255, 255, 255, 0.09);
  --border-vis: rgba(255, 255, 255, 0.14);
  --border-amber: rgba(249, 115, 22, 0.45);

  --amber: #f97316;
  --amber-br: #fb923c;
  --amber-dk: #c2410c;
  --amber-glow: rgba(249, 115, 22, 0.10);
  --amber-glow-md: rgba(249, 115, 22, 0.20);
  --amber-glow-lg: rgba(249, 115, 22, 0.32);

  --text-0: #ffffff;
  --text-1: #d1d1e0;
  --text-2: #8d8d9f;

  --ok: #22c55e;
  --ok-glow: rgba(34, 197, 94, 0.10);
  --err: #ef4444;
  --err-glow: rgba(239, 68, 68, 0.10);
  --gold: #d97706;

  --r-sm: 5px;
  --r-md: 9px;
  --r-pill: 999px;

  --sidebar-w: 320px;
  --header-h: 52px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  background: var(--bg-void);
  color: var(--text-1);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* Background */
.bg-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 70% 50% at 70% 0%, rgba(249, 115, 22, 0.07) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 0% 90%, rgba(34, 211, 238, 0.04) 0%, transparent 55%);
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(ellipse 100% 100% at center, black 30%, transparent 80%);
  mask-image: radial-gradient(ellipse 100% 100% at center, black 30%, transparent 80%);
}

/* ── APP SHELL ── */
#app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── TOP BAR ── */
#topbar {
  flex-shrink: 0;
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 16px 0 18px;
  gap: 0;
  background: rgba(5, 5, 7, 0.90);
  border-bottom: 1px solid var(--border-subtle);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  position: relative;
  z-index: 50;
}

#topbar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(249, 115, 22, 0.5) 30%, rgba(249, 115, 22, 0.15) 65%, transparent);
  opacity: 0.35;
}

.tb-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.tb-badge {
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: var(--r-sm);
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--amber-br), var(--amber), var(--amber-dk));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 9px;
  color: #050507;
  box-shadow: 0 0 16px var(--amber-glow-md), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
}

.tb-badge::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, transparent 60%);
}

.tb-name {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.3px;
  line-height: 1;
}

.tb-name em {
  color: var(--amber);
  font-style: normal;
}

.tb-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 8px;
  letter-spacing: 2px;
  color: var(--text-2);
  text-transform: uppercase;
  margin-top: 2px;
}

.tb-spacer {
  flex: 1;
}

.tb-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-2);
}

/* Tactical deployment status */
.deployment-status {
  display: flex;
  align-items: center;
  gap: 6px;
}

.radar-container {
  position: relative;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pulse-dot {
  position: relative;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.8);
  flex-shrink: 0;
  z-index: 2;
}

.pulse-dot::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  background: #4ade80;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(1);
  opacity: 0;
  animation: sonar 2s cubic-bezier(0.1, 0.8, 0.3, 1) infinite;
}

@keyframes sonar {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.75;
  }
  100% {
    transform: translate(-50%, -50%) scale(4);
    opacity: 0;
  }
}

.target-blip {
  position: absolute;
  width: 3.5px;
  height: 3.5px;
  border-radius: 50%;
  background: #4ade80;
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}

.blip-1 {
  top: 4px;
  right: 4px;
  animation: blip-sweep-1 2s infinite;
}

.blip-2 {
  bottom: 5px;
  left: 5px;
  animation: blip-sweep-2 2s infinite;
}

@keyframes blip-sweep-1 {
  0%, 25% { opacity: 0; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1.2); box-shadow: 0 0 6px rgba(74, 222, 128, 1); }
  35% { opacity: 0.8; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.8); }
}

@keyframes blip-sweep-2 {
  0%, 45% { opacity: 0; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); box-shadow: 0 0 6px rgba(74, 222, 128, 1); }
  55% { opacity: 0.8; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.8); }
}

.status-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--text-1);
  text-transform: uppercase;
}

/* ── WORKSPACE ── */
#workspace {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* ── SIDEBAR ── */
#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-subtle);
  background: rgba(8, 8, 13, 0.78);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  overflow: hidden;
}

#sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

#sidebar-scroll::-webkit-scrollbar { width: 5px; }
#sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
#sidebar-scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--amber-br), var(--amber));
  border-radius: 3px;
}
#sidebar-scroll::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--amber-br), var(--amber-dk));
}

/* Scrollbar para el panel principal y sus vistas */
#canvas-content::-webkit-scrollbar,
.cview::-webkit-scrollbar,
.img-wrap::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
#canvas-content::-webkit-scrollbar-track,
.cview::-webkit-scrollbar-track,
.img-wrap::-webkit-scrollbar-track {
  background: var(--surface-0);
}
#canvas-content::-webkit-scrollbar-thumb,
.cview::-webkit-scrollbar-thumb,
.img-wrap::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--amber-br), var(--amber));
  border-radius: 3px;
}
#canvas-content::-webkit-scrollbar-thumb:hover,
.cview::-webkit-scrollbar-thumb:hover,
.img-wrap::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--amber-br), var(--amber-dk));
}

/* ── SECTION ACCORDION ── */
.sb-sec {
  border-bottom: 1px solid var(--border-subtle);
}

.sb-sec-hd {
  padding: 9px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  transition: background 200ms ease;
  position: relative;
}

.sb-sec-hd:hover {
  background: rgba(255, 255, 255, 0.02);
}

.sb-sec-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: var(--surface-3);
  border: 1px solid var(--border-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--amber);
  flex-shrink: 0;
}

.sb-sec-title {
  font-family: 'Outfit', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-1);
  flex: 1;
}

/* Summary — visible only when collapsed */
.sb-sec-summary {
  display: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.3px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

.sb-sec-summary .hi { color: var(--amber); }
.sb-sec-summary .ok { color: var(--ok); }

.sb-sec.collapsed .sb-sec-summary { display: block; }

.sb-sec-chev {
  color: var(--text-2);
  transition: transform 250ms ease;
  flex-shrink: 0;
}

.sb-sec.collapsed .sb-sec-chev { transform: rotate(-90deg); }

.sb-sec-body {
  padding: 11px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sb-sec.collapsed .sb-sec-body { display: none; }

/* ── SIDEBAR FOOTER ── */
#sidebar-footer {
  flex-shrink: 0;
  padding: 16px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(5, 5, 7, 0.65);
  display: flex;
  flex-direction: column;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 500px;
  overflow: hidden;
  opacity: 1;
  gap: 8px;
  position: relative;
}

/* ── CANVAS ── */
#canvas {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-void);
}

#canvas-tabs {
  flex-shrink: 0;
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(8, 8, 13, 0.6);
  padding: 0 8px;
}

.ctab {
  padding: 0 18px;
  height: 38px;
  display: flex;
  align-items: center;
  border: none;
  background: transparent;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  transition: color 200ms ease;
}

.ctab:hover { color: var(--text-1); }
.ctab.active { color: var(--text-0); }

.ctab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 12px;
  right: 12px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--amber), transparent);
  border-radius: var(--r-pill);
}

#canvas-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cview { display: none; }

.cview.active {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeIn 200ms ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px) }
  to   { opacity: 1; transform: translateY(0) }
}

/* ── INSPECTION VIEW ── */
#view-inspection {
  padding: 24px 28px;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.calib-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.calib-bar-info h3 {
  font-size: 14px;
  font-weight: 600;
}

.calib-bar-info p {
  font-size: 11px;
  color: var(--text-1);
  margin-top: 1px;
}

.calib-ctrls {
  display: flex;
  align-items: center;
  background: var(--surface-1);
  border: 1px solid var(--border-dim);
  border-radius: var(--r-md);
  padding: 3px;
  gap: 2px;
}

.calib-pg {
  width: 38px;
  background: transparent;
  border: none;
  color: var(--text-0);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  text-align: center;
  outline: none;
  padding: 4px;
  -moz-appearance: textfield;
  appearance: textfield;
}

.calib-pg::-webkit-outer-spin-button,
.calib-pg::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.calib-sep {
  width: 1px;
  height: 16px;
  background: var(--border-dim);
  margin: 0 2px;
}

.img-wrap {
  position: relative;
  border: 1px solid var(--border-dim);
  border-radius: var(--r-md);
  overflow: auto;
  background: var(--surface-0);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  flex: 1;
  min-height: 0;
}

.img-wrap::-webkit-scrollbar { width: 6px; height: 6px; }
.img-wrap::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.15); }
.img-wrap::-webkit-scrollbar-thumb { background: var(--border-vis); border-radius: 3px; }
.img-wrap::-webkit-scrollbar-thumb:hover { background: var(--amber); }

.img-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 100%;
  min-height: 100%;
  position: relative;
  padding: 10px;
}

.img-container img {
  max-width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  transition: width 120ms ease, height 120ms ease;
}

.img-loader {
  position: absolute;
  inset: 0;
  background: rgba(8, 8, 13, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
  z-index: 10;
  overflow: hidden;
}

.img-loader.on {
  opacity: 1;
  pointer-events: auto;
}

.calib-hint {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-2);
  text-align: center;
  flex-shrink: 0;
}

/* ── BACKS VIEW ── */
#view-backs {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  align-items: center;
  justify-content: center;
  gap: 48px;
  padding: 40px 32px;
  flex-wrap: wrap;
}

.back-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.back-slot-lbl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--text-2);
  text-transform: uppercase;
}

.card-frame {
  position: relative;
  border-radius: 9px;
  overflow: hidden;
  background: var(--surface-1);
  border: 1px solid var(--border-dim);
  box-shadow: 0 0 40px rgba(249, 115, 22, 0.15), 0 28px 56px rgba(0, 0, 0, 0.75), 0 10px 20px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.025);
  animation: cardFloat 5s ease-in-out infinite;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card-frame:hover {
  transform: scale(1.02);
}

.card-frame.vert  { width: 260px; height: 445px; }
.card-frame.horiz { width: 445px; height: 260px; animation-delay: -2.5s; }

@media (max-width: 900px) {
  .card-frame.vert  { width: 200px; height: 342px; }
  .card-frame.horiz { width: 300px; height: 175px; animation-delay: -2.5s; }
}

@keyframes cardFloat {
  0%, 100% { transform: translateY(0) rotate(0deg) }
  33%       { transform: translateY(-8px) rotate(0.8deg) }
  66%       { transform: translateY(-4px) rotate(-0.5deg) }
}

.card-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-frame.scanning::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 26%;
  background: linear-gradient(180deg, transparent, rgba(249, 115, 22, 0.18), transparent);
  animation: scanDown 550ms ease forwards;
}

@keyframes scanDown {
  from { transform: translateY(-100%); }
  to   { transform: translateY(400%); }
}

/* ── INFO VIEW ── */
#view-info {
  padding: 24px 28px;
  flex-direction: column;
  gap: 20px;
}

#view-info.active { display: flex; }

#view-info h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 4px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  max-width: 100%;
}

@media (min-width: 600px) {
  .info-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1100px) {
  .info-grid { grid-template-columns: 1fr 1fr 1.5fr; }
}

.info-card {
  background: rgba(13, 13, 20, 0.65);
  border: 1px solid var(--border-dim);
  border-radius: var(--r-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  position: relative;
}

.info-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1.5px;
  background: linear-gradient(90deg, var(--amber), transparent);
  opacity: 0.6;
}

.info-card-ttl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 1.2px;
  color: var(--text-1);
  text-transform: uppercase;
}

.rgrid { display: grid; gap: 4px; }
.rgrid.g2 { grid-template-columns: 1fr 1fr; }

.rcell {
  border: 1px solid var(--border-dim);
  background: rgba(23, 23, 31, 0.8);
  height: 32px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  transition: all 200ms ease;
}

.rcell.on.rcell-a { color: #ef4444; border-color: rgba(239,68,68,0.4); background: rgba(239,68,68,0.08); box-shadow: 0 0 8px rgba(239,68,68,0.08); }
.rcell.on.rcell-b { color: #22c55e; border-color: rgba(34,197,94,0.4);  background: rgba(34,197,94,0.08);  box-shadow: 0 0 8px rgba(34,197,94,0.08); }
.rcell.on.rcell-c { color: #3b82f6; border-color: rgba(59,130,246,0.4); background: rgba(59,130,246,0.08); box-shadow: 0 0 8px rgba(59,130,246,0.08); }
.rcell.on.rcell-d { color: #f59e0b; border-color: rgba(245,158,11,0.4); background: rgba(245,158,11,0.08); box-shadow: 0 0 8px rgba(245,158,11,0.08); }

.info-blk {
  background: rgba(13, 13, 20, 0.65);
  border: 1px solid var(--border-dim);
  border-radius: var(--r-md);
  padding: 20px;
  max-width: 500px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  position: relative;
}

.info-blk::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 2.5px;
  background: var(--amber);
  opacity: 0.85;
  border-radius: var(--r-sm) 0 0 var(--r-sm);
}

.info-blk h4 {
  color: var(--amber);
  font-size: 11px;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 10px;
}

.info-blk ul {
  padding-left: 15px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.info-blk li {
  font-size: 12px;
  color: var(--text-1);
  line-height: 1.6;
}

/* ════════════════════════════════════════════
   SIDEBAR FORM COMPONENTS
 ════════════════════════════════════════════ */

/* Dropzone */
.dz {
  position: relative;
  border-radius: var(--r-md);
  background: var(--surface-0);
  cursor: pointer;
  border: 1px dashed var(--border-light);
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: border-color 150ms ease, background 150ms ease;
}

.dz.scanning::after {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 30%;
  background: linear-gradient(180deg, transparent, rgba(249, 115, 22, 0.15) 80%, var(--amber) 100%);
  box-shadow: 0 4px 10px rgba(249, 115, 22, 0.3);
  animation: scanDownLoop 1.5s linear infinite;
  pointer-events: none;
  z-index: 5;
}

@keyframes scanDownLoop {
  from { transform: translateY(-100%); }
  to   { transform: translateY(400%); }
}

.dz::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--r-md);
  border: 1.5px dashed var(--border-dim);
  transition: border-color 250ms ease, border-style 200ms ease;
  pointer-events: none;
}

.dz:hover::before,
.dz.drag-over::before { border-color: var(--amber); border-style: solid; }

.dz:hover { background: rgba(249, 115, 22, 0.025); }
.dz.drag-over { background: rgba(249, 115, 22, 0.04); box-shadow: 0 0 22px var(--amber-glow); }

.dz input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
  width: 100%;
  height: 100%;
}

.dz-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  padding: 10px;
  text-align: center;
}

.dz-ico {
  width: 42px;
  height: 42px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  flex-shrink: 0;
  transition: all 250ms ease;
}

.dz:hover .dz-ico {
  border-color: var(--border-amber);
  color: var(--amber);
  background: var(--amber-glow);
}

.dz.has-file::before { border-color: var(--ok); border-style: solid; opacity: 0.45; }
.dz.has-file { background: rgba(34, 197, 94, 0.02); }
.dz.has-file .dz-ico { border-color: rgba(34,197,94,0.3); color: var(--ok); background: rgba(34,197,94,0.07); }

.dz-txt-main { font-size: 12px; color: var(--text-1); line-height: 1.4; }
.dz-txt-main strong { color: var(--amber); }

.dz-txt-hint {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.5px;
  color: var(--text-2);
  margin-top: 2px;
}

.dz-filename {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ok);
  display: none;
  padding: 16px;
  word-break: break-all;
  text-align: center;
  line-height: 1.5;
}

.dz.has-file .dz-inner {
  display: none;
}

.dz.has-file .dz-filename {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.dz-file-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dz-file-name-text {
  font-weight: 600;
  color: var(--ok);
  font-size: 12px;
}

.dz-file-change {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--text-2);
  margin-top: 4px;
  transition: color 150ms ease;
}

.dz:hover .dz-file-change {
  color: var(--amber);
}

/* Form elements */
.fg { display: flex; flex-direction: column; gap: 6px; }

.fl {
  font-family: 'Outfit', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.fl-hint {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--text-2);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

.inp {
  background: var(--surface-2);
  border: 1px solid var(--border-dim);
  border-radius: var(--r-md);
  color: var(--text-0);
  padding: 8px 11px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  transition: border-color 200ms ease, background 200ms ease, box-shadow 200ms ease;
  width: 100%;
  appearance: none;
}

.inp:focus {
  outline: none;
  border-color: var(--amber);
  background: var(--surface-1);
  box-shadow: 0 0 0 2px var(--amber-glow);
}

textarea.inp { min-height: 58px; resize: vertical; line-height: 1.5; }
.inp::placeholder { color: var(--text-2); }

/* Syntax Highlighter */
.syntax-container {
  position: relative;
  width: 100%;
}
.syntax-textarea {
  position: relative;
  z-index: 2;
  color: transparent !important;
  background: transparent !important;
  caret-color: var(--amber) !important;
}
.syntax-textarea::placeholder {
  color: transparent !important;
}
#cards-highlighter {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  padding: 8px 11px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-0);
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow: hidden;
}
/* Focus sync */
.syntax-textarea:focus + #cards-highlighter {
  background: var(--surface-1);
}
/* Tokens */
.hl-card-a { color: #f87171; text-shadow: 0 0 8px rgba(239,68,68,0.4); font-weight: 600; }
.hl-card-b { color: #4ade80; text-shadow: 0 0 8px rgba(34,197,94,0.4); font-weight: 600; }
.hl-card-c { color: #60a5fa; text-shadow: 0 0 8px rgba(59,130,246,0.4); font-weight: 600; }
.hl-card-d { color: #facc15; text-shadow: 0 0 8px rgba(234,179,8,0.4); font-weight: 600; }
.hl-all {
  color: #e5e7eb;
  text-shadow: 0 0 8px rgba(229,231,235,0.4);
  font-weight: 600;
}
.hl-placeholder {
  color: var(--text-2);
}

/* Toggle */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.toggle-lbl { font-size: 12px; color: var(--text-1); flex: 1; line-height: 1.3; }
.toggle-lbl strong { color: var(--text-0); font-weight: 500; display: block; }

.ts { position: relative; width: 34px; height: 19px; flex-shrink: 0; }
.ts input { opacity: 0; width: 0; height: 0; position: absolute; }

.ts-track {
  position: absolute;
  inset: 0;
  border-radius: var(--r-pill);
  background: var(--surface-4);
  border: 1px solid var(--border-dim);
  transition: all 280ms cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
}

.ts-thumb {
  position: absolute;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--text-1), var(--text-2));
  transition: all 280ms cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.ts input:checked~.ts-track { background: var(--amber-glow-md); border-color: var(--border-amber); }
.ts input:checked~.ts-track .ts-thumb {
  left: calc(100% - 14px);
  background: linear-gradient(135deg, var(--amber-br), var(--amber));
  box-shadow: 0 0 7px var(--amber-glow-lg), 0 1px 3px rgba(0,0,0,0.3);
}

/* Segmented control */
.seg {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  background: var(--surface-0);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  padding: 2px;
  gap: 2px;
}

.spill {
  padding: 4px 2px;
  border-radius: calc(var(--r-md) - 2px);
  font-size: 8px;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-2);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 220ms ease;
  text-align: center;
  line-height: 1.2;
}

.spill:hover:not(.on) { color: var(--text-1); background: var(--surface-2); }

.spill.on {
  background: var(--surface-3);
  color: var(--text-1);
  border: 1px solid var(--border-amber);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.04);
}

/* Custom dropdown */
.cdd { position: relative; }

.cdd-trigger {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border-dim);
  border-radius: var(--r-md);
  color: var(--text-0);
  padding: 8px 11px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  transition: all 220ms ease;
  text-align: left;
}

.cdd-trigger:hover { border-color: var(--border-vis); background: var(--surface-3); }
.cdd-trigger.open  { border-color: var(--amber); background: var(--surface-1); box-shadow: 0 0 0 2px var(--amber-glow); }

.cdd-arrow { color: var(--text-2); transition: transform 220ms ease; flex-shrink: 0; }
.cdd-trigger.open .cdd-arrow { transform: rotate(180deg); color: var(--amber); }

.cdd-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--surface-2);
  border: 1px solid var(--border-dim);
  border-radius: var(--r-md);
  overflow: hidden;
  z-index: 100;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  transform-origin: top center;
  transition: opacity 180ms ease, transform 180ms ease;
}

.cdd-panel[data-s="closed"] { opacity: 0; transform: scale(0.96) translateY(-4px); pointer-events: none; }
.cdd-panel[data-s="open"]   { opacity: 1; transform: scale(1) translateY(0); }

.cdd-opt {
  padding: 9px 11px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-1);
  transition: all 130ms ease;
  border-left: 2px solid transparent;
}

.cdd-opt:hover { background: var(--surface-3); color: var(--text-0); }
.cdd-opt.sel   { color: var(--amber); border-left-color: var(--amber); background: var(--amber-glow); }

.hidden-native { display: none; }

/* Slider */
.sl-wrap { display: flex; flex-direction: column; gap: 5px; }

.sl-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sl {
  width: 100%;
  height: 3px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.sl::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--amber-br), var(--amber));
  cursor: pointer;
  box-shadow: 0 0 0 2px var(--amber-glow-md), 0 2px 4px rgba(0,0,0,0.3);
  transition: box-shadow 180ms ease, transform 180ms ease;
}

.sl::-webkit-slider-thumb:hover {
  box-shadow: 0 0 0 4px var(--amber-glow), 0 2px 4px rgba(0,0,0,0.3);
  transform: scale(1.15);
}

.sl::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--amber-br), var(--amber));
  box-shadow: 0 0 0 2px var(--amber-glow-md);
  border: none;
  cursor: pointer;
}

.rval {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  color: var(--amber);
  min-width: 30px;
  text-align: right;
}

/* ── DORSO GRID: two fully independent columns ── */
.dorso-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  align-items: stretch;
}

.dorso-col {
  background: var(--surface-2);
  border: 1px solid var(--border-dim);
  border-radius: var(--r-md);
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: inset 0 2px 4px rgba(255,255,255,0.02);
  transition: border-color 200ms ease;
}

.dorso-col.mode-off { opacity: 0.5; }

.dorso-col-lbl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 8px;
  letter-spacing: 1.8px;
  color: var(--text-2);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 5px;
}

.dorso-col-lbl::before {
  content: '';
  width: 2px;
  height: 8px;
  border-radius: 1px;
  background: var(--amber);
  opacity: 0.4;
}

/* Custom image section inside each column */
.col-custom {
  display: none;
  flex-direction: column;
  gap: 8px;
  animation: slideD 220ms ease;
}

.col-custom.vis { display: flex; }

@keyframes slideD {
  from { opacity: 0; transform: translateY(-5px) }
  to   { opacity: 1; transform: translateY(0) }
}

/* Mini dropzone inside dorso col */
.mdz {
  position: relative;
  background: var(--surface-1);
  border: 1px dashed var(--border-dim);
  border-radius: var(--r-sm);
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  transition: all 220ms ease;
  overflow: hidden;
}

.mdz:hover { border-color: var(--amber); background: var(--amber-glow); }

.mdz input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.mdz-ico { color: var(--text-2); flex-shrink: 0; }
.mdz > div:not(.mdz-ico) { min-width: 0; width: 100%; }
.mdz-txt { font-size: 10px; color: var(--text-2); line-height: 1.3; }
.mdz-fn  { font-family: 'JetBrains Mono', monospace; font-size: 9px; color: var(--ok); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

/* Generate button */
.btn-gen {
  position: relative;
  width: 100%;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--r-md);
  border: none;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition: all 280ms ease;
  color: #050507;
  background: linear-gradient(135deg, var(--amber-br) 0%, var(--amber) 55%, var(--amber-dk) 100%);
  box-shadow: 0 4px 18px rgba(249, 115, 22, 0.28), inset 0 1px 0 rgba(255,255,255,0.12);
}

.btn-gen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 20%, rgba(255,255,255,0.13) 42%, transparent 60%);
  transform: translateX(-100%);
  animation: shim 3s ease-in-out infinite;
}

@keyframes shim {
  0%       { transform: translateX(-100%) }
  28%, 100% { transform: translateX(220%) }
}

.btn-gen:hover  { transform: translateY(-2px); box-shadow: 0 0 20px rgba(249,115,22,0.5), 0 0 40px rgba(249,115,22,0.2), inset 0 1px 0 rgba(255,255,255,0.18); }
.btn-gen:active { transform: translateY(0) scale(0.98); box-shadow: 0 0 10px rgba(249,115,22,0.3); }
.btn-gen:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-gen:disabled::before { display: none; }
.btn-gen.loading { opacity: 0.85 !important; cursor: wait !important; box-shadow: 0 0 20px rgba(249,115,22,0.4), 0 0 40px rgba(249,115,22,0.1); }

/* Utility button */
.btn-sm {
  padding: 5px 9px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-dim);
  background: var(--surface-2);
  color: var(--text-1);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  cursor: pointer;
  transition: all 180ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.btn-sm:hover  { border-color: var(--border-vis); color: var(--text-0); background: var(--surface-3); }
.btn-sm:active { transform: scale(0.97); }

/* Status / warnings */
.status-banner {
  display: none;
  position: absolute;
  top: 11px;
  left: 14px;
  right: 14px;
  height: 40px;
  border-radius: var(--r-md);
  font-size: 12px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  font-weight: 600;
  z-index: 10;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  animation: slideUpBanner 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes slideUpBanner {
  0% { transform: translateY(15px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.status-banner.fade-out {
  opacity: 0 !important;
  transform: translateY(-15px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  pointer-events: none;
}

.status-banner.loading { background: var(--amber-glow); border-color: rgba(249,115,22,0.2); color: var(--amber); display: flex; }
.status-banner.success { background: var(--ok-glow);   border-color: rgba(34,197,94,0.2);  color: var(--ok);   display: flex; }
.status-banner.error   { background: var(--err-glow);  border-color: rgba(239,68,68,0.2);  color: var(--err);  display: flex; }

.spinner {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  border: 2px solid rgba(249, 115, 22, 0.18);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-inline {
  display: inline-block !important;
  vertical-align: middle;
  margin-right: 8px;
}

.btn-gen.loading .spinner {
  border-color: rgba(5, 5, 7, 0.2);
  border-top-color: #050507;
}

@keyframes spin { to { transform: rotate(360deg) } }

.warn-panel {
  background: rgba(217, 119, 6, 0.04);
  border: 1px solid rgba(217, 119, 6, 0.2);
  border-radius: var(--r-md);
  padding: 11px;
  display: none;
}

.warn-panel.vis { display: block; animation: slideD 220ms ease; }

.warn-ttl {
  font-size: 12px;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-weight: 600;
}

.warn-list {
  font-size: 11px;
  color: var(--text-1);
  padding-left: 13px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* ── Language selector chips ── */
.lang-selector {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 2px;
}

.lang-opt {
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-2);
  padding: 2px 5px;
  border-radius: 3px;
  border: 1px solid transparent;
  transition: all 160ms ease;
  white-space: nowrap;
  line-height: 1.6;
  -webkit-user-select: none;
  user-select: none;
}

.lang-opt:hover  { color: var(--text-1) !important; border-color: var(--border-dim); background: var(--surface-2); }
.lang-opt.active { color: var(--amber) !important; font-weight: 700; background: var(--amber-glow); border-color: var(--border-amber); }
.lang-sep { display: none; }

/* ══════════════════════════════════════════════════════════
   SISTEMA I18N — CJK TYPOGRAPHY & EXPANSIVE LANGUAGE RULES
   Grimdark Terminal Aesthetic Preservation
════════════════════════════════════════════════════════════ */

:lang(zh),
:lang(ja),
:lang(ko) {
  font-family:
    "Noto Sans SC", "Noto Sans TC", "Noto Sans JP", "Noto Sans KR",
    "PingFang SC", "PingFang TC",
    "Hiragino Sans GB", "Hiragino Kaku Gothic ProN", "Hiragino Kaku Gothic Pro",
    "Yu Gothic UI", "Yu Gothic",
    "MS Gothic", "MS PGothic",
    "Microsoft YaHei", "Microsoft JhengHei",
    "Malgun Gothic", "Apple SD Gothic Neo",
    "Source Han Sans CN", "Source Han Sans TW", "Source Han Sans JP", "Source Han Sans KR",
    -apple-system, BlinkMacSystemFont,
    sans-serif;
  line-height: 1.65;
  letter-spacing: 0.02em;
  word-break: break-word;
  overflow-wrap: break-word;
}

:lang(zh) .tb-name,
:lang(ja) .tb-name,
:lang(ko) .tb-name {
  font-family: 'Outfit', "Yu Gothic UI", "Malgun Gothic", sans-serif;
  letter-spacing: -0.3px;
  line-height: 1.1;
}

:lang(zh) .sb-sec-title,
:lang(ja) .sb-sec-title,
:lang(ko) .sb-sec-title {
  font-family: 'Outfit', "Noto Sans SC", "Noto Sans JP", "Noto Sans KR", "Yu Gothic UI", "Malgun Gothic", sans-serif;
  letter-spacing: 0.8px !important;
  line-height: 1.3;
}

:lang(zh) .btn-gen,
:lang(ja) .btn-gen,
:lang(ko) .btn-gen {
  font-family: 'Outfit', "Noto Sans SC", "Noto Sans JP", "Noto Sans KR", "Yu Gothic UI", "Malgun Gothic", sans-serif;
  letter-spacing: 0.5px !important;
  line-height: 1.35;
}

:lang(zh) .tb-sub,
:lang(ja) .tb-sub,
:lang(ko) .tb-sub,
:lang(zh) .rval,
:lang(ja) .rval,
:lang(ko) .rval,
:lang(zh) .calib-pg,
:lang(ja) .calib-pg,
:lang(ko) .calib-pg,
:lang(zh) .fl-hint,
:lang(ja) .fl-hint,
:lang(ko) .fl-hint {
  font-family: "JetBrains Mono", "Courier New", monospace;
  letter-spacing: 0.5px !important;
}

:lang(zh) .info-blk li,
:lang(ja) .info-blk li,
:lang(ko) .info-blk li,
:lang(zh) #lbl-help-start-body p,
:lang(ja) #lbl-help-start-body p,
:lang(ko) #lbl-help-start-body p {
  line-height: 1.8;
  letter-spacing: 0.03em;
}

:lang(zh) .footer-col,
:lang(ja) .footer-col,
:lang(ko) .footer-col {
  font-size: 9px;
  line-height: 1.7;
  letter-spacing: 0.02em;
}

/* ── Idiomas EXPANSIVOS (FR, IT, DE) ── */
:lang(fr) .sb-sec-title,
:lang(it) .sb-sec-title,
:lang(de) .sb-sec-title {
  font-size: 9px !important;
  letter-spacing: 0.8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

:lang(fr) .btn-gen,
:lang(it) .btn-gen,
:lang(de) .btn-gen {
  font-size: 11px !important;
  letter-spacing: 0.5px !important;
  padding: 11px 10px;
}

:lang(fr) .fl,
:lang(it) .fl,
:lang(de) .fl {
  font-size: 9px;
  letter-spacing: 0.2px;
}

:lang(fr) .dorso-col-lbl,
:lang(it) .dorso-col-lbl,
:lang(de) .dorso-col-lbl {
  font-size: 7px !important;
  letter-spacing: 0.8px;
}

:lang(fr) .ctab,
:lang(it) .ctab,
:lang(de) .ctab {
  font-size: 11px;
  padding: 0 13px;
}

:lang(fr) .dz-txt-main,
:lang(it) .dz-txt-main,
:lang(de) .dz-txt-main {
  font-size: 11px;
  hyphens: auto;
}

:lang(fr) .calib-hint,
:lang(it) .calib-hint,
:lang(de) .calib-hint {
  font-size: 9px;
  white-space: normal;
  word-break: break-word;
  hyphens: auto;
}

/* ── Layout container anti-overflow global ── */
.tb-brand {
  flex-wrap: wrap;
  max-width: calc(100% - 250px);
}

.lang-selector {
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 240px;
  gap: 4px 6px !important;
}

.sb-sec-title,
.btn-gen,
.toggle-lbl,
.fl {
  overflow-wrap: break-word;
  min-width: 0;
}

/* ── FOOTER DISCLAIMER ── */
.app-footer {
  flex-shrink: 0;
  background: rgba(5, 5, 7, 0.95);
  border-top: 1px solid var(--border-subtle);
  padding: 12px 18px;
  font-size: 10px;
  color: var(--text-2);
  line-height: 1.4;
  z-index: 10;
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-footer.collapsed { padding: 10px 18px; }
.app-footer.collapsed .footer-grid { max-height: 0; opacity: 0; margin-top: 0; }

.footer-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: var(--amber);
  margin-bottom: 6px;
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: 0.8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  -webkit-user-select: none;
  user-select: none;
}

.app-footer.collapsed .footer-title { margin-bottom: 0; }

.footer-title::after {
  content: '▼';
  font-size: 8px;
  color: var(--text-1);
  transition: transform 0.3s ease;
}

.app-footer:not(.collapsed) .footer-title::after {
  transform: rotate(180deg);
  color: var(--amber);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  max-height: 600px;
  opacity: 1;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, margin-top 0.4s ease;
}

.footer-col { font-size: 9.5px; color: var(--text-1); }
.footer-col strong { color: var(--text-0); font-weight: 600; }
.footer-col a { color: var(--amber); text-decoration: none; font-weight: 500; }
.footer-col a:hover { text-decoration: underline; }

@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr; gap: 12px; }
}

/* ── CONFIGURATION VIEW ── */
#view-print-config {
  padding: 24px 28px;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}

#view-print-config.active { display: flex; }

.config-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  max-width: 800px;
}

@media (min-width: 600px) {
  .config-grid { grid-template-columns: 1fr 1fr; }
}

.config-card {
  background: rgba(13, 13, 20, 0.65);
  border: 1px solid var(--border-dim);
  border-radius: var(--r-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  position: relative;
  transition: all 0.2s ease;
}

.config-card.disabled { opacity: 0.35; pointer-events: none; }

.config-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1.5px;
  background: linear-gradient(90deg, var(--amber), transparent);
  opacity: 0.6;
}

.config-card-ttl {
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--amber);
  text-transform: uppercase;
}

.radio-group { display: flex; gap: 8px; }
.radio-btn { flex: 1; position: relative; }
.radio-btn input { position: absolute; opacity: 0; width: 0; height: 0; }

.radio-btn-lbl {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid var(--border-dim);
  background: rgba(23, 23, 31, 0.8);
  border-radius: var(--r-md);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: var(--text-1);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.radio-btn input:checked + .radio-btn-lbl {
  border-color: var(--amber);
  background: var(--amber-glow);
  color: var(--text-0);
  box-shadow: 0 0 12px rgba(249,115,22,0.3), 0 0 24px rgba(249,115,22,0.1);
}

.color-btn-lbl { display: flex; align-items: center; gap: 8px; }

.color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.color-dot.red   { background: #ff4444; }
.color-dot.black { background: #000000; }
.color-dot.white { background: #ffffff; }

/* ── HELP VIEW STYLING ── */
#view-help {
  padding: 24px 28px;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}

#view-help.active { display: flex; }

/* --- ESTRATEGIA MÓVIL (STACK LAYOUT) --- */
@media (max-width: 900px) {
  #mobile-warning {
    display: none !important;
  }
  
  body {
    overflow: auto;
  }

  .app-container {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }

  #sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-light);
    height: auto;
    max-height: 50vh;
  }

  .canvas {
    flex: 1 1 auto;
    height: 50vh;
  }

  .nav-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  
  .nav-tabs::-webkit-scrollbar {
    display: none;
  }
  
  .config-grid {
    grid-template-columns: 1fr;
  }
}

#view-help h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--amber);
}

#view-help h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-0);
  margin-top: 10px;
}

#view-help p  { font-size: 12px; line-height: 1.6; color: var(--text-1); }

#view-help ul {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#view-help li { font-size: 12px; line-height: 1.6; color: var(--text-1); }

#view-help blockquote {
  border-left: 3px solid var(--amber);
  background: var(--surface-1);
  padding: 10px 14px;
  border-radius: 0 var(--r-md) var(--r-md) 0;
  margin: 8px 0;
}

/* ─── MITIGACIÓN RESPONSIVA ─────────────────────────────────────────────── */
#mobile-warning {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  text-align: center;
  padding: 32px;
  background: var(--bg-1);
  color: var(--text-0);
  z-index: 9999;
}

#mobile-warning svg {
  width: 64px;
  height: 64px;
  margin-bottom: 24px;
  color: var(--amber);
}

#mobile-warning h2 {
  font-family: 'Inter', sans-serif;
  font-size: 24px;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

#mobile-warning p {
  font-size: 14px;
  color: var(--text-1);
  max-width: 400px;
  line-height: 1.5;
}

@media (max-width: 900px) {
  #app {
    display: flex !important;
    flex-direction: column;
  }
  #workspace {
    flex-direction: column;
  }
  #sidebar {
    width: 100%;
    max-height: 50vh;
    border-right: none;
    border-bottom: 1px solid var(--border-dim);
  }
  #canvas {
    height: 50vh;
  }
  #mobile-warning {
    display: none !important;
  }
}
/* --- UI PUNCH: Nav Tabs Indicator --- */
.nav-tabs {
  position: relative;
}
.nav-indicator {
  position: absolute;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--amber);
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), width 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  pointer-events: none;
}

/* --- UI PUNCH: Backs Row --- */
.backs-row {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 48px;
  padding: 40px 32px;
  flex-wrap: nowrap;
}

/* --- UI PUNCH: Help Diagrams --- */
.help-diagram {
  background: rgba(13, 13, 20, 0.4);
  border: 1px solid var(--border-dim);
  border-radius: var(--r-md);
  padding: 24px;
  margin: 16px 0 32px 0;
}
.abcd-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 12px;
  max-width: 250px;
  margin: 0 auto;
}
.abcd-box {
  background: var(--surface-1);
  border: 1px dashed var(--border-light);
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', sans-serif;
  color: var(--text-0);
  font-size: 24px;
  border-radius: 4px;
}
.duplex-panel-wrap {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}
.duplex-panel {
  background: var(--surface-1);
  border: 1px solid var(--border-dim);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  width: 200px;
}
.duplex-panel svg {
  color: var(--amber);
  margin-bottom: 12px;
}


/* --- CSS AÑADIDO PARA MEJORAS UX/UI --- */

/* Ouroboros Spinner */
.ouroboros-spinner {
  animation: spin 1.5s linear infinite;
  color: var(--amber);
}
@keyframes spin {
  100% { transform: rotate(360deg); }
}

/* Success Overlay (Bottom-Up) */
.btn-success-overlay {
  position: absolute;
  bottom: -100%;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--surface-2);
  color: var(--amber);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  font-family: 'Outfit', sans-serif;
  transition: bottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 10;
  border: 1px solid var(--amber);
  border-radius: var(--r-md);
}
.btn-success-overlay.show {
  bottom: 0;
}

/* Help Section Restructure */
.help-steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.help-step-card {
  background: rgba(13, 13, 20, 0.65);
  border: 1px solid var(--border-dim);
  border-radius: var(--r-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.step-num {
  position: absolute;
  top: -10px;
  right: -5px;
  font-size: 64px;
  font-weight: 900;
  opacity: 0.05;
  color: var(--amber);
  pointer-events: none;
}
.help-step-card h5 {
  color: var(--amber);
  margin-bottom: 8px;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
}
.help-step-card p {
  font-size: 12px;
  color: var(--text-1);
}

/* ABCD Visualizer */
.abcd-visualizer-row {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 24px;
}
.abcd-visualizer-card {
  background: rgba(13, 13, 20, 0.4);
  padding: 16px;
  border-radius: var(--r-md);
  border: 1px dashed var(--border-dim);
}
.abcd-grid.grid-1x4 {
  grid-template-columns: repeat(4, 1fr);
  width: auto;
  gap: 4px;
}


/* Laser Sweep for PDF Load */
.laser-sweep {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 20%;
  background: linear-gradient(to bottom, transparent, rgba(251, 146, 60, 0.4) 50%, var(--amber) 100%);
  animation: laserScan 2s linear infinite;
  pointer-events: none;
  z-index: 5;
  opacity: 0.7;
}
@keyframes laserScan {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(500%); }
}

/* Config Layout "Premium" overrides */
.config-card:hover {
  border-color: rgba(251, 146, 60, 0.4);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 0 16px rgba(251, 146, 60, 0.05);
  transform: translateY(-2px);
}

/* Backs Previews */
.backs-row .back-slot {
  flex: 0 1 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 450px;
}
.card-frame {
  box-shadow: 0 0 20px rgba(251, 146, 60, 0.15), 0 0 40px rgba(0, 0, 0, 0.6);
  transition: box-shadow 0.3s ease;
  animation: floatBack 6s ease-in-out infinite;
}
.card-frame:hover {
  box-shadow: 0 0 30px rgba(251, 146, 60, 0.3), 0 0 50px rgba(0, 0, 0, 0.8);
}
.card-frame.horiz {
  animation-delay: -3s; /* Desincronizar la animación */
}
@keyframes floatBack {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Dropzone Change text visibility override */
.dz.has-file .dz-file-change {
  display: flex !important;
  align-items: center;
  gap: 6px;
  color: var(--amber);
  font-size: 11px;
  margin-top: 12px;
  cursor: pointer;
  padding: 6px 12px;
  border: 1px dashed var(--amber);
  border-radius: var(--r-md);
  transition: all 0.2s ease;
}
.dz.has-file .dz-file-change:hover {
  background: var(--amber-glow);
  color: var(--text-0);
}

/* Disclaimer Smooth Transition Override */
.app-footer {
  transition: all 0.5s ease-in-out !important;
}

/* Progressive Disclosure */
.progressive-step:not(.revealed) {
  display: none !important;
}
.progressive-step.revealed {
  animation: revealStep 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes revealStep {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Hidden Utility */
.is-hidden { display: none !important; }
. f g . d i s a b l e d   {   o p a c i t y :   0 . 3 5 ;   p o i n t e r - e v e n t s :   n o n e ;   t r a n s i t i o n :   o p a c i t y   0 . 2 s   e a s e ;   } 
 
 
 / *   S i d e b a r   C o n f i g   R e f i n e m e n t s   * / 
 # s e c - c o n f i g   . f g   {   m a r g i n - b o t t o m :   1 2 p x ;   } 
 # s e c - c o n f i g   . f l   {   f o n t - s i z e :   1 1 p x ;   c o l o r :   v a r ( - - t e x t - 2 ) ;   m a r g i n - b o t t o m :   4 p x ;   } 
 # s e c - c o n f i g   . i n p   {   p a d d i n g :   4 p x   8 p x ;   m i n - h e i g h t :   3 0 p x ;   f o n t - s i z e :   1 2 p x ;   } 
 # s e c - c o n f i g   . r a d i o - g r o u p   {   g a p :   6 p x   ! i m p o r t a n t ;   } 
 # s e c - c o n f i g   . r a d i o - b t n - l b l   {   p a d d i n g :   6 p x   1 0 p x ;   f o n t - s i z e :   1 1 p x ;   j u s t i f y - c o n t e n t :   f l e x - s t a r t ;   } 
 # s e c - c o n f i g   . c o l o r - b t n - l b l   {   j u s t i f y - c o n t e n t :   f l e x - s t a r t ;   } 
 
 
 /* --- BUTTON SUCCESS STATE --- */
.btn-gen.success-state {
  background: var(--ok-glow) !important;
  border-color: rgba(34,197,94,0.3) !important;
  color: var(--ok) !important;
  box-shadow: 0 0 20px rgba(34,197,94,0.4), 0 0 40px rgba(34,197,94,0.1) !important;
  transform: translateY(0) !important;
}

/* --- ALERT CARDS (HELP SECTION) --- */
.alert-card {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  margin-bottom: 16px;
  background: var(--surface-2);
  border-left: 4px solid transparent;
  align-items: flex-start;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-1);
}
.alert-icon { font-size: 16px; margin-top: -2px; }
.alert-body strong { color: var(--text-0); }
.warning-card { border-left-color: var(--amber); background: rgba(217, 119, 6, 0.05); }
.critical-card { border-left-color: var(--err); background: rgba(239, 68, 68, 0.05); }

/* --- DISABLED INPUT STATE --- */
#cards-input:disabled,
#cards-input.opacity-dimmed-slight,
.sl:disabled {
  opacity: 0.3 !important;
  background: rgba(0, 0, 0, 0.6) !important;
  cursor: not-allowed !important;
  border-color: rgba(255, 255, 255, 0.05) !important;
  color: rgba(255, 255, 255, 0.3) !important;
}

/* --- SIDEBAR CONFIG REFINEMENTS --- */
#sec-config .radio-btn-lbl {
  padding: 5px 8px;
  font-size: 11px;
}
#sec-config .color-btn-lbl {
  padding: 4px 8px;
  justify-content: flex-start;
}
#sec-config .radio-group {
  gap: 6px;
}
#sec-config .color-dot {
  width: 10px; height: 10px;
}
#sec-config .toggle-row {
  margin-top: -4px;
}
/* --- CARD-BASED ARCHITECTURE (CONFIG) --- */
.config-card {
  background: var(--surface-2);
  border: 1px solid var(--border-dim);
  border-radius: var(--r-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.config-card .fg { margin-bottom: 0; }

.cfg-lbl {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 4px;
}

/* --- SEGMENTED CONTROLS --- */
.segmented-control {
  display: flex;
  gap: 4px;
  width: 100%;
}
.segmented-control .radio-btn {
  flex: 1;
  width: auto;
}
.segmented-control .radio-btn-lbl {
  justify-content: center;
  padding: 6px 4px;
  font-size: 11px;
  border-radius: var(--r-sm);
}
.segmented-control .color-btn-lbl {
  padding: 8px 4px;
}
/* --- INTERACTIVE SIMULATOR (HELP) --- */
.sim-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 32px;
  background: var(--surface-2);
  padding: 32px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-dim);
}

.pdf-page-sim {
  position: relative;
  width: 280px;
  height: 175px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 12px;
  padding: 24px;
}

.sim-page-label {
  position: absolute;
  top: -24px;
  left: 0;
  width: 100%;
  text-align: center;
  font-size: 11px;
  color: var(--text-2);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sim-card {
  background: rgba(15, 20, 25, 0.9);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-1);
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.sim-card.active {
  color: var(--ok);
  border-color: var(--ok);
  background: rgba(15, 20, 25, 1);
  box-shadow: 0 0 16px var(--ok-glow);
  transform: scale(1.05);
  z-index: 2;
}


.sim-anim-a {
  50%, 95% { opacity: 0.3; filter: grayscale(100%); }
  100% { opacity: 1; filter: grayscale(0%); }
}

.mock-toggle-track {
  animation: mock-toggle-bg 6s infinite ease-in-out;
}
.mock-toggle-dot {
  animation: mock-toggle-slide 6s infinite ease-in-out;
}
.mock-input-content {
  animation: mock-input-text 6s infinite ease-in-out;
}

/* --- ZOOM (Detalle Completo) --- */
.zoom-fit {
  max-width: 100% !important;
  max-height: 100% !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
}
.zoom-fill {
  max-width: none !important;
  max-height: none !important;
  width: 150% !important;
  height: auto !important;
  object-fit: contain !important;
}
/* --- STATIC INFOGRAPHIC ANIMATION --- */
@keyframes highlight-card-a {
  0%, 100% {
    color: var(--text-1);
    border-color: transparent;
    background: rgba(15, 20, 25, 0.9);
    box-shadow: none;
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    color: #f87171; /* Red */
    border-color: #f87171;
    background: rgba(15, 20, 25, 1);
    box-shadow: 0 0 16px rgba(248, 113, 113, 0.4);
    transform: scale(1.05);
    opacity: 1;
  }
}

@keyframes highlight-card-d {
  0%, 100% {
    color: var(--text-1);
    border-color: transparent;
    background: rgba(15, 20, 25, 0.9);
    box-shadow: none;
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    color: #facc15; /* Yellow */
    border-color: #facc15;
    background: rgba(15, 20, 25, 1);
    box-shadow: 0 0 16px rgba(250, 204, 21, 0.4);
    transform: scale(1.05);
    opacity: 1;
  }
}

.sim-anim-a {
  animation: highlight-card-a 3s infinite ease-in-out;
}

.sim-anim-d {
  animation: highlight-card-d 3s infinite ease-in-out;
  animation-delay: 1.5s;
}

/* --- STATIC INFOGRAPHIC ANIMATION v2 --- */
@keyframes mock-toggle-slide {
  0%, 45% { left: 3px; background: var(--text-2); }
  50%, 95% { left: 23px; background: var(--text-0); }
  100% { left: 3px; background: var(--text-2); }
}

@keyframes mock-toggle-bg {
  0%, 45% { background: rgba(255,255,255,0.1); }
  50%, 95% { background: #ea580c; }
  100% { background: rgba(255,255,255,0.1); }
}

@keyframes mock-input-text {
  0%, 45% { opacity: 1; filter: grayscale(0%); }
  50%, 95% { opacity: 0.3; filter: grayscale(100%); }
  100% { opacity: 1; filter: grayscale(0%); }
}

.mock-toggle-track {
  animation: mock-toggle-bg 6s infinite ease-in-out;
}
.mock-toggle-dot {
  animation: mock-toggle-slide 6s infinite ease-in-out;
}
.mock-input-content {
  animation: mock-input-text 6s infinite ease-in-out;
}

/* --- ZOOM (Detalle Completo) --- */
.img-container.zoom-fit {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.img-inner.zoom-fit {
  max-width: 100% !important;
  max-height: 100% !important;
}
.img-inner.zoom-fit img {
  max-width: 100% !important;
  max-height: 100% !important;
  width: auto !important;
  height: auto !important;
}

.img-container.zoom-fill {
  display: flex !important;
  justify-content: center !important;
  align-items: flex-start !important; /* so it scrolls from top */
}
.img-inner.zoom-fill {
  max-width: none !important;
  max-height: none !important;
  height: 130vh !important;
  width: auto !important;
}
.img-inner.zoom-fill img {
  height: 100% !important;
  width: auto !important;
  max-width: none !important;
  max-height: none !important;
}

.help-hover-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.4) !important;
  border-color: rgba(251, 146, 60, 0.3) !important;
  transform: translateY(-2px);
}

/* --- TARGET LOCK REDESIGN --- */
.target-lock-container {
  position: relative;
  display: inline-block;
  max-width: 100%;
}
.target-lock-container img {
  display: block;
  max-width: 100%;
  height: auto;
}
.target-lock-overlay {
  position: absolute;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 100%; height: 100%;
  z-index: 10;
  pointer-events: none;
}

.target-lock-zone {
  pointer-events: auto;
  border: 2px dashed rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.target-lock-zone:hover {
  background: rgba(251, 146, 60, 0.15);
  border-color: rgba(251, 146, 60, 0.5);
}
.target-lock-zone.active {
  background: rgba(251, 146, 60, 0.3);
  border: 2px solid var(--amber);
  box-shadow: inset 0 0 30px rgba(251, 146, 60, 0.3);
}
.target-lock-label {
  position: absolute;
  right: 100%;
  margin-right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 24px;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.target-lock-zone.active .target-lock-label {
  color: var(--amber);
}
.zoom-fit .target-lock-label {
  font-size: 32px;
}
.zoom-fill .target-lock-label {
  font-size: 64px;
}
.target-lock-zone.zone-right .target-lock-label {
  right: auto;
  margin-right: 0;
  left: 100%;
  margin-left: 16px;
}


/* Timeline Sidebar */
.timeline-step {
  display: flex;
  flex-direction: column;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-dim);
  position: relative;
  transition: padding 0.3s ease;
}
.timeline-step.collapsed {
  padding: 8px 24px;
}
.timeline-step {
  opacity: 0.5;
  transition: opacity 0.3s;
}
.timeline-step.active, .timeline-step.completed {
  opacity: 1;
}
.timeline-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 12px;
  row-gap: 2px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.2s;
  padding: 8px;
  margin-left: -8px;
  margin-right: -8px;
  border-radius: 6px;
}
.timeline-header:hover {
  background: rgba(255, 255, 255, 0.03);
}
.timeline-step.locked .timeline-header,
.timeline-step:not(.collapsed) .timeline-header {
  cursor: default;
}
.timeline-step.locked .timeline-header:hover,
.timeline-step:not(.collapsed) .timeline-header:hover {
  background: transparent;
}
.timeline-summary {
  flex-basis: 100%;
  padding-left: 36px;
  margin-left: 0;
  margin-top: 2px;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: var(--text-1);
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.3s ease 0.1s, max-height 0.4s ease;
  pointer-events: none;
}
.timeline-step.completed.collapsed .timeline-summary {
  opacity: 1;
  max-height: 20px;
}
.timeline-summary .hi { color: var(--amber); font-weight: 600; }
.timeline-summary .ok { color: var(--ok); font-weight: 600; }
.timeline-num {
  flex-shrink: 0;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--text-2);
  color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Outfit', sans-serif; font-size: 12px; font-weight: bold;
}
.timeline-step.active .timeline-num {
  background: var(--amber) !important; border-color: var(--amber) !important; color: #000; box-shadow: 0 0 8px rgba(251, 146, 60, 0.4) !important;
}
.timeline-step.completed .timeline-num {
  background: var(--ok); border-color: var(--ok); color: #000; box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}
.timeline-step.locked {
  opacity: 0.35;
  pointer-events: none;
  filter: grayscale(100%);
}
.timeline-step .sb-sec-body {
  max-height: 1500px;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, margin 0.3s ease, padding 0.3s ease;
  opacity: 1;
}
.timeline-step.collapsed .sb-sec-body {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  pointer-events: none;
}
#sidebar-footer.locked {
  opacity: 0;
  pointer-events: none;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin: 0;
  border: none;
}
.timeline-title {
  font-family: 'Outfit', sans-serif; font-size: 14px; font-weight: 700; color: var(--text-2); text-transform: uppercase;
  transition: color 0.3s ease, text-shadow 0.3s ease;
}
.timeline-step.active .timeline-title {
  color: #ffffff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

/* Data Lens Tooltip */
.data-lens-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: rgba(96, 165, 250, 0.2); color: #60a5fa;
  font-size: 10px; cursor: help; margin-left: 6px;
  vertical-align: middle; position: relative;
}
.data-lens-icon:hover::before {
  content: attr(data-tooltip);
  position: absolute;
  top: 150%; left: 50%; transform: translateX(-50%);
  width: 200px; padding: 10px;
  background: rgba(13, 13, 20, 0.95);
  border: 1px solid #60a5fa; border-radius: 4px;
  color: #fff; font-size: 11px; font-family: 'Inter', sans-serif;
  text-align: left; box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  z-index: 100; pointer-events: none;
}
.data-lens-icon:hover::after {
  content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 5px solid transparent; border-bottom-color: #60a5fa; pointer-events: none;
}

/* ── GLOBAL OVERLAY ── */
.global-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 7, 0.85);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.global-overlay.active {
  opacity: 1;
  pointer-events: all;
}
.overlay-spinner {
  width: 64px;
  height: 64px;
  border: 4px solid var(--surface-2);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 24px;
}
.overlay-text {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-0);
  letter-spacing: 2px;
  animation: pulse-glow 2s infinite;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

/* ── PRINT PREVIEW TAB ── */
.print-preview-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 40px;
  box-sizing: border-box;
}

.pp-board {
  position: relative;
  width: auto;
  height: auto;
  padding: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #ffffff;
  background-image: repeating-linear-gradient(45deg, transparent, transparent 15px, rgba(0,0,0,0.03) 15px, rgba(0,0,0,0.04) 16px);
  border: 1px solid var(--border-dim);
  border-radius: var(--r-lg);
  box-shadow: inset 0 0 30px rgba(0,0,0,0.1);
}

.pp-card {
  position: relative;
  /* Defaults overridden by JS */
  --card-w: 210px;
  --card-h: 360px;
  --bleed-size: 9px;
  --cm-len: 20px;
  --cm-color: rgba(255, 255, 255, 0.4);
  
  width: calc(var(--card-w) + (var(--bleed-size) * 2));
  height: calc(var(--card-h) + (var(--bleed-size) * 2));
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Crop Marks */
.pp-crop-mark {
  position: absolute;
  width: calc(var(--cm-len) * 2);
  height: calc(var(--cm-len) * 2);
  background: linear-gradient(var(--cm-color) 0 0) center/100% 1px no-repeat,
              linear-gradient(var(--cm-color) 0 0) center/1px 100% no-repeat;
  transition: opacity 0.4s ease;
  z-index: 6;
}
.pp-crop-mark.off { opacity: 0; }
.cm-tl { top: calc(var(--bleed-size) - var(--cm-len)); left: calc(var(--bleed-size) - var(--cm-len)); }
.cm-tr { top: calc(var(--bleed-size) - var(--cm-len)); right: calc(var(--bleed-size) - var(--cm-len)); }
.cm-bl { bottom: calc(var(--bleed-size) - var(--cm-len)); left: calc(var(--bleed-size) - var(--cm-len)); }
.cm-br { bottom: calc(var(--bleed-size) - var(--cm-len)); right: calc(var(--bleed-size) - var(--cm-len)); }

/* Bleed Zone */
.pp-bleed-zone {
  position: absolute;
  inset: 0;
  border: var(--bleed-size) solid rgba(239, 68, 68, 0.15); /* translucent red */
  background: transparent;
  transition: border-width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 5;
}
.pp-bleed-zone::before {
  display: none !important;
}

/* Safe Zone */
.pp-safe-zone {
  position: absolute;
  width: var(--card-w);
  height: var(--card-h);
  background: transparent;
  border: 1px solid rgba(251, 146, 60, 0.35); /* Soft amber guide line for trim boundary */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.pp-tech-grid {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(251, 146, 60, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(251, 146, 60, 0.1) 1px, transparent 1px);
  background-size: 20px 20px;
  background-position: center center;
  opacity: 0.5;
}

.pp-labels {
  position: relative;
  z-index: 3;
  text-align: center;
  font-family: 'Outfit', sans-serif;
  color: var(--amber);
  text-transform: uppercase;
  background: rgba(13, 13, 20, 0.85);
  border: 1px solid var(--amber);
  box-shadow: 0 0 12px rgba(249, 115, 22, 0.25);
  padding: 6px 12px;
  border-radius: 6px;
  margin-top: 20px;
}

.pp-lbl-geom {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 2px;
  text-shadow: 0 0 10px rgba(251, 146, 60, 0.5);
}

.pp-lbl-dims {
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  opacity: 0.8;
  margin-top: 4px;
}

/* Floating labels */
.pp-float-lbl {
  position: absolute;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--amber);
  background: rgba(13, 13, 20, 0.85);
  padding: 4px 8px;
  border-radius: 4px;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  border: 1px solid rgba(249, 115, 22, 0.3);
}
.bleed-lbl {
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.1);
  transition: opacity 0.3s;
}
.bleed-lbl.off { opacity: 0; }
.dpi-lbl {
  bottom: calc(100% + 12px);
  right: 0;
  border: 1px solid rgba(249, 115, 22, 0.3);
  background: rgba(249, 115, 22, 0.15);
}@keyframes pulse-glow {
  0%, 100% { opacity: 0.8; text-shadow: 0 0 10px rgba(251, 146, 60, 0.4); }
  50% { opacity: 1; text-shadow: 0 0 20px rgba(251, 146, 60, 0.8); }
}

h1, h2, h3, h4, h5, h6, strong, b {
  color: var(--text-0);
}
