:root {
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --border-color: #e2e8f0;
  --border-strong: #cbd5e1;

  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;

  --accent-green: #059669;
  --accent-green-bg: #ecfdf5;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --warning: #d97706;
  --warning-bg: #fffbeb;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.16);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.45;
}

/* Header */
.app-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.brand h1 {
  font-size: 1.1rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.version-tag {
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
}

.subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Simple / Advanced Mode Switch */
.mode-switch {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px 4px;
}

.mode-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding-left: 4px;
}

.mode-segments {
  grid-template-columns: 1fr 1fr;
  padding: 0;
  border: none;
  background: transparent;
  gap: 2px;
}

.mode-segments .seg-btn {
  padding: 0.28rem 0.55rem;
  font-size: 0.72rem;
}

.btn-guide {
  border-color: #cbd5e1;
  background: #ffffff;
  font-size: 0.76rem;
}

.btn-guide:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--accent-green-bg);
  color: var(--accent-green);
  border: 1px solid #a7f3d0;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.2);
}

/* Calibration Bar */
.calibration-bar {
  background: #1e293b;
  color: #ffffff;
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 53px;
  z-index: 35;
  box-shadow: var(--shadow-md);
  border-bottom: 2px solid var(--primary);
}

.calib-content {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
}

.calib-step-indicator {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.calib-actions {
  display: flex;
  gap: 0.4rem;
}

.calib-actions .btn {
  color: #fff;
  border-color: #475569;
}

.calib-actions .btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Calibration Trigger in Card 0 */
.calib-trigger-box {
  background: var(--bg-subtle);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.micro-help {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Main Workspace (Mobile First: Column by default) */
.workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0.75rem;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
}

/* Desktop Grid Layout (Screens > 960px) */
@media (min-width: 960px) {
  .workspace {
    display: grid;
    grid-template-columns: 1fr 400px; /* Canvas on left, controls on right */
    padding: 1rem 1.25rem;
    align-items: start;
  }

  .stage-area {
    position: sticky;
    top: 70px;
    max-height: calc(100vh - 90px);
  }
}

/* Controls Panel */
.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.control-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-header h2 {
  font-size: 0.92rem;
  font-weight: 650;
  flex: 1;
}

.step-badge {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-help {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.card-divider {
  border: 0;
  border-top: 1px dashed var(--border-color);
  margin: 0.3rem 0;
}

/* Field Groups */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.field-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.val-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 0.08rem 0.4rem;
  border-radius: 4px;
}

.text-input,
.select-input {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-main);
  background: var(--bg-surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.text-input:focus,
.select-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.slider {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
}

.sliders-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

/* Segmented Controls */
.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--bg-app);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.seg-btn {
  border: none;
  background: transparent;
  padding: 0.35rem 0.3rem;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.seg-btn:hover {
  color: var(--text-main);
}

.seg-btn.active {
  background: var(--bg-surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Side Tabs for Presets */
.side-tabs {
  display: inline-flex;
  background: var(--bg-app);
  border-radius: 5px;
  padding: 2px;
}

.tab-btn {
  border: none;
  background: transparent;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.18rem 0.48rem;
  border-radius: 4px;
  color: var(--text-secondary);
  cursor: pointer;
}

.tab-btn.active {
  background: var(--bg-surface);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.38rem;
}

.chip-btn {
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle);
  color: var(--text-main);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chip-btn:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.chip-btn.active {
  background: #eff6ff;
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 650;
  box-shadow: 0 0 0 1px var(--primary);
}

.chip-btn.active .chip-label::before {
  content: "✓ ";
  font-weight: bold;
}

.chip-info {
  font-size: 0.7rem;
  opacity: 0.65;
  padding: 2px 4px;
  border-radius: 4px;
}

.chip-info:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.08);
}

/* Watermark Quick Tags */
.quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.tag-btn {
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.22rem 0.48rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
}

.tag-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

/* Color Swatches */
.color-options {
  display: flex;
  gap: 0.55rem;
  align-items: center;
}

.color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--swatch);
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}

.color-swatch.active {
  transform: scale(1.15);
  box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 4px var(--primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
  user-select: none;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-lg {
  padding: 0.7rem 1.25rem;
  font-size: 0.92rem;
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-main);
  border-color: var(--border-strong);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-subtle);
}

.btn-outline-accent {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: #bfdbfe;
  width: 100%;
}

.btn-outline-accent:hover:not(:disabled) {
  background: #dbeafe;
}

.btn-accent-highlight {
  background: #1e40af;
  color: #ffffff;
  border: 1px solid #1d4ed8;
  font-weight: 650;
  box-shadow: 0 2px 6px rgba(30, 64, 175, 0.25);
}

.btn-accent-highlight:hover:not(:disabled) {
  background: #1e3a8a;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.btn-sm {
  padding: 0.32rem 0.55rem;
  font-size: 0.74rem;
}

.btn-icon {
  padding: 0.32rem 0.45rem;
}

.btn-full {
  width: 100%;
}

.file-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.demo-row {
  display: flex;
  gap: 0.4rem;
}

.demo-row .btn-sm {
  flex: 1;
}

.box-subactions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd5e1;
  transition: 0.2s;
  border-radius: 999px;
}

.toggle-slider::before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(16px);
}

.checkbox-row {
  display: flex;
  align-items: center;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.76rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input {
  accent-color: var(--primary);
  width: 14px;
  height: 14px;
}

/* Stage Area (Canvas & Toolbar) */
.stage-area {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  min-height: 480px;
}

.stage-toolbar {
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.toolbar-hint {
  font-size: 0.76rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
}

.stage-quick-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Canvas Viewport */
.canvas-viewport {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background-color: #cbd5e1;
  background-image: radial-gradient(#94a3b8 1px, transparent 1px);
  background-size: 16px 16px;
  overflow: auto;
  min-height: 340px;
}

.canvas-viewport.drag-over {
  background-color: #dbeafe;
  outline: 2px dashed var(--primary);
  outline-offset: -8px;
}

.canvas-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
  box-shadow: var(--shadow-lg);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

#dni-canvas {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 230px);
  width: auto;
  height: auto;
  cursor: crosshair;
  touch-action: none;
}

/* Empty State & Demo Thumbnails */
.empty-state {
  max-width: 520px;
  width: 100%;
}

.empty-card {
  background: var(--bg-surface);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.25rem;
  text-align: center;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.empty-icon {
  font-size: 2.2rem;
}

.empty-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.empty-card p {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.demo-select-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.demo-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.demo-cards-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.demo-thumb-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.4rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s;
}

.demo-thumb-btn:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
  transform: translateY(-1px);
}

.thumb-img {
  width: 100%;
  height: 65px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.demo-thumb-btn span {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-main);
}

.security-checklist {
  list-style: none;
  text-align: left;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.85rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* Export Bar */
.export-bar {
  padding: 0.65rem 0.85rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.export-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.exif-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-green);
  background: var(--accent-green-bg);
  padding: 0.2rem 0.5rem;
  border-radius: 5px;
}

.meta-text {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.export-buttons {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.format-select-wrap select {
  padding: 0.4rem 0.5rem;
  font-size: 0.78rem;
  width: auto;
}

/* Modal Overlay & Drawer (Mobile First) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: flex-end; /* Mobile: slides from bottom drawer */
  justify-content: center;
  animation: fadeIn 0.2s ease-out;
}

@media (min-width: 640px) {
  .modal-overlay {
    align-items: center; /* Desktop/Tablet: centered dialog */
    padding: 1.5rem;
  }
}

.modal-container {
  background: var(--bg-surface);
  width: 100%;
  max-width: 680px;
  max-height: 88vh;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: slideUp 0.25s ease-out;
}

@media (min-width: 640px) {
  .modal-container {
    border-radius: var(--radius-lg);
    max-height: 82vh;
  }
}

.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.modal-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.modal-badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.modal-header h2 {
  font-size: 1.05rem;
  font-weight: 750;
  line-height: 1.3;
}

.btn-close-modal {
  background: transparent;
  border: none;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
}

.btn-close-modal:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.guide-intro-card {
  background: var(--warning-bg);
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  font-size: 0.82rem;
  color: #78350f;
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
}

.warning-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.guide-sections {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.guide-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.guide-item.highlighted {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.guide-item-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.guide-item-header h3 {
  font-size: 0.88rem;
  font-weight: 700;
}

.risk-pill {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  flex-shrink: 0;
}

.risk-pill.high {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecaca;
}

.risk-pill.med {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid #fde68a;
}

.risk-pill.low {
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid #bfdbfe;
}

.guide-where {
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.guide-desc {
  font-size: 0.78rem;
  color: var(--text-main);
}

.guide-why {
  background: #f8fafc;
  border-left: 3px solid var(--danger);
  padding: 0.5rem 0.65rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.76rem;
  color: #1e293b;
}

.guide-item.med-risk .guide-why {
  border-left-color: var(--warning);
}

.guide-item.low-risk .guide-why {
  border-left-color: var(--primary);
}

.modal-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-subtle);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.hidden {
  display: none !important;
}

@media (max-width: 600px) {
  .app-header {
    padding: 0.5rem 0.75rem;
  }
  .brand h1 {
    font-size: 1rem;
  }
  .subtitle {
    display: none;
  }
  .pill-text {
    display: none;
  }
  .mode-label {
    display: none;
  }
}

/* --- CROP BAR & CROP TOOLS --- */
.crop-bar {
  background: #0f172a;
  color: #ffffff;
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 53px;
  z-index: 36;
  box-shadow: var(--shadow-md);
  border-bottom: 2px solid var(--primary);
  flex-wrap: wrap;
}

.crop-bar-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.crop-badge {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.crop-instruction {
  font-size: 0.82rem;
  color: #e2e8f0;
}

.crop-ratio-group {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px;
  border-radius: var(--radius-sm);
  gap: 2px;
}

.btn-crop-ratio {
  background: transparent;
  border: none;
  color: #cbd5e1;
  padding: 0.22rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-crop-ratio:hover {
  color: #fff;
}

.btn-crop-ratio.active {
  background: var(--primary);
  color: #fff;
}

.crop-bar-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.crop-bar-actions .btn-ghost {
  color: #e2e8f0;
  border-color: #475569;
}

.crop-bar-actions .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Document Framing Tools in Section 0 */
.doc-tools-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.doc-tools-row {
  display: flex;
  gap: 0.4rem;
}

.straighten-group {
  margin-top: 0.15rem;
}

.val-reset-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-micro-reset {
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  font-size: 0.65rem;
  padding: 0.05rem 0.35rem;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 600;
}

.btn-micro-reset:hover {
  background: var(--bg-surface);
  color: var(--text-main);
  border-color: var(--primary);
}

.animation-cta-wrap {
  margin: 0.25rem 0;
}

/* --- INTERACTIVE ANIMATION MODAL --- */
.anim-modal-container {
  max-width: 820px;
}

.anim-badge {
  background: #fdf2f8;
  color: #db2777;
  border-color: #fbcfe8;
}

.anim-modal-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem 1.25rem;
}

/* Timeline Chips */
.anim-timeline-nav {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding-bottom: 4px;
}

.anim-step-chip {
  flex-shrink: 0;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.anim-step-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.anim-step-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.28);
}

/* Stage Card */
.anim-stage-card {
  background: #0f172a;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  position: relative;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
}

.anim-card-canvas-wrap {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 250px;
  perspective: 900px;
}

/* Simulated DNI Card */
.anim-dni-card {
  width: 100%;
  max-width: 440px;
  aspect-ratio: 85.6 / 53.98;
  background: linear-gradient(135deg, #fff7ed 0%, #fef3c7 40%, #e0f2fe 100%);
  border-radius: 12px;
  border: 1.5px solid #cbd5e1;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.15);
  position: relative;
  padding: 0.75rem 0.9rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), filter 0.4s ease;
  user-select: none;
}

.anim-dni-card.rotated {
  transform: rotate(-3deg) scale(0.98);
}

.anim-dni-card.grayscale-mode {
  filter: grayscale(100%) contrast(125%) brightness(98%);
}

.anim-dni-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border-bottom: 1.5px solid rgba(15, 23, 42, 0.15);
  padding-bottom: 0.25rem;
}

.anim-flag {
  font-size: 1rem;
}

.anim-dni-title {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #1e3a8a;
}

.anim-dni-body {
  display: grid;
  grid-template-columns: 85px 1fr;
  grid-template-rows: auto auto;
  gap: 0.45rem 0.65rem;
  margin-top: 0.3rem;
  position: relative;
}

.anim-photo-box {
  width: 85px;
  height: 105px;
  background: #e2e8f0;
  border: 1.5px solid #94a3b8;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  grid-row: span 2;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08);
}

.anim-avatar {
  font-size: 2.2rem;
  line-height: 1;
}

.anim-photo-label {
  font-size: 0.52rem;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.02em;
}

.anim-data-fields {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.anim-field {
  display: flex;
  gap: 0.35rem;
  font-size: 0.68rem;
  line-height: 1.25;
}

.anim-label {
  font-weight: 700;
  color: #475569;
  font-size: 0.58rem;
}

.anim-value {
  font-weight: 800;
  color: #0f172a;
}

/* Sensitive Target Zones */
.anim-target-zone {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  font-size: 0.64rem;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.anim-alert-badge {
  font-size: 0.58rem;
  font-weight: 800;
  padding: 0.05rem 0.3rem;
  border-radius: 999px;
  background: #dc2626;
  color: #ffffff;
  display: none;
  animation: pulseAlert 1.5s infinite;
}

@keyframes pulseAlert {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

/* Zone Danger State (Step 1) */
.anim-target-zone.danger-pulse {
  background: rgba(239, 68, 68, 0.18);
  border: 1.5px dashed #dc2626;
}

.anim-target-zone.danger-pulse .anim-alert-badge {
  display: inline-block;
}

/* Zone Censored State (Step 4+) */
.anim-target-zone.censored {
  background: #0f172a !important;
  color: transparent !important;
  border: 1px solid #1e293b !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.anim-target-zone.censored * {
  visibility: hidden;
}

.anim-target-zone.censored::after {
  content: "CENSURADO";
  visibility: visible;
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.54rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  background-image: repeating-linear-gradient(45deg, #1e293b 0, #1e293b 4px, #0f172a 4px, #0f172a 8px);
}

#anim-zone-soporte {
  grid-column: 2;
  margin-top: 2px;
}

#anim-zone-firma {
  grid-column: 2;
  font-style: italic;
  min-height: 22px;
}

.anim-sig-font {
  font-family: 'Brush Script MT', cursive, sans-serif;
  font-size: 0.95rem;
  color: #1e3a8a;
}

#anim-zone-can {
  grid-column: 2;
}

/* Animated Crop Overlay (Step 3) */
.anim-crop-frame {
  position: absolute;
  inset: 6px;
  border: 2px solid #3b82f6;
  border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.45);
  pointer-events: none;
  animation: cropPulse 2s infinite ease-in-out;
}

@keyframes cropPulse {
  0%, 100% { border-color: #3b82f6; }
  50% { border-color: #60a5fa; }
}

.anim-crop-bracket {
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: #fff;
  border-style: solid;
}
.anim-crop-bracket.tl { top: -2px; left: -2px; border-width: 3px 0 0 3px; }
.anim-crop-bracket.tr { top: -2px; right: -2px; border-width: 3px 3px 0 0; }
.anim-crop-bracket.br { bottom: -2px; right: -2px; border-width: 0 3px 3px 0; }
.anim-crop-bracket.bl { bottom: -2px; left: -2px; border-width: 0 0 3px 3px; }

.anim-crop-tag {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: #1e40af;
  color: #ffffff;
  font-size: 0.58rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

/* Watermark Layer (Step 6) */
.anim-watermark-layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transform: rotate(-24deg);
}

.anim-wm-stamp {
  border: 3px solid #dc2626;
  color: #dc2626;
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  padding: 0.35rem 0.8rem;
  text-align: center;
  border-radius: 6px;
  background: rgba(254, 242, 242, 0.45);
  opacity: 0.72;
  box-shadow: 0 0 10px rgba(220, 38, 38, 0.2);
  animation: stampIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes stampIn {
  0% { transform: scale(1.6); opacity: 0; }
  100% { transform: scale(1); opacity: 0.72; }
}

/* Success Shield (Step 7) */
.anim-success-shield {
  position: absolute;
  inset: 0;
  background: rgba(5, 150, 105, 0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  color: #fff;
  animation: fadeIn 0.35s ease;
}

.anim-shield-icon {
  font-size: 3rem;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.anim-shield-text {
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Narrative Box */
.anim-narrative-box {
  width: 100%;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.anim-step-badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: #93c5fd;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.anim-step-title {
  font-size: 0.95rem;
  font-weight: 750;
  color: #f8fafc;
}

.anim-step-desc {
  font-size: 0.82rem;
  color: #cbd5e1;
  line-height: 1.45;
}

.anim-step-desc strong {
  color: #ffffff;
}

/* Player Bar */
.anim-player-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.85rem;
}

.anim-controls-left {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.anim-btn-ctrl {
  min-width: 95px;
}

.anim-progress-track {
  flex: 1;
  height: 6px;
  background: var(--bg-subtle);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.anim-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.anim-controls-right {
  display: flex;
  align-items: center;
}

.anim-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* --- DUAL-SIDE & MERGE STYLES --- */
.stage-toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  flex: 1;
}

.face-switcher-bar {
  display: inline-flex;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  padding: 2px;
  border-radius: var(--radius-sm);
  gap: 2px;
}

.face-tab-btn {
  border: none;
  background: transparent;
  padding: 0.28rem 0.6rem;
  font-size: 0.74rem;
  font-weight: 650;
  color: var(--text-secondary);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  user-select: none;
}

.face-tab-btn:hover {
  color: var(--text-main);
}

.face-tab-btn.active {
  background: var(--bg-surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.target-side-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid #bfdbfe;
}

.sides-slots-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.15rem;
}

.side-slot-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.side-slot-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
  background: #f8faff;
}

.slot-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem;
}

.slot-badge-title {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.76rem;
  color: var(--text-main);
}

.slot-status-tag {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: var(--bg-subtle);
  color: var(--text-muted);
}

.slot-status-tag.has-img {
  background: var(--accent-green-bg);
  color: var(--accent-green);
  border: 1px solid #a7f3d0;
}

.slot-actions {
  display: flex;
  gap: 0.3rem;
}

.slot-actions .btn {
  flex: 1;
  padding: 0.25rem 0.45rem;
  font-size: 0.72rem;
}

.merge-options-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.merge-layout-pills {
  display: inline-flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 2px;
  border-radius: 4px;
  gap: 2px;
}

.merge-layout-pills .btn {
  padding: 0.2rem 0.45rem;
  font-size: 0.7rem;
  border: none;
  border-radius: 3px;
}

.merge-layout-pills .btn.active {
  background: var(--bg-surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.empty-subtext {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.demo-thumb-featured {
  border-color: #3b82f6 !important;
  background: #eff6ff !important;
}

.dual-thumb-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 38px;
  justify-content: center;
}

.thumb-mini {
  width: 26px;
  height: 38px;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid #cbd5e1;
}

@media (max-width: 600px) {
  .sides-slots-grid {
    grid-template-columns: 1fr;
  }
}

