/* ==========================================================================
   JustPrint Web Edition - Modern Design System & Component Styles
   ========================================================================== */

:root {
  /* Color Palette - Dark Theme (Default) */
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(31, 41, 55, 0.85);
  --bg-surface: #1f2937;
  --bg-surface-elevated: #374151;
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.15);
  --border-active: #3b82f6;
  
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --primary-50: #eff6ff;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  --accent-emerald: #10b981;
  --accent-purple: #8b5cf6;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 25px rgba(59, 130, 246, 0.25);
  
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

body.theme-light {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: #f1f5f9;
  --bg-surface: #e2e8f0;
  --bg-surface-elevated: #cbd5e1;
  
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-medium: rgba(0, 0, 0, 0.15);
  --border-active: #2563eb;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 25px rgba(37, 99, 235, 0.15);
}

/* ==========================================================================
   Base & Reset
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  min-height: 100vh;
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: -0.02em;
}

button, input, select {
  font-family: inherit;
  outline: none;
  border: none;
}

button {
  cursor: pointer;
  user-select: none;
}

/* ==========================================================================
   Network Banner
   ========================================================================== */
.network-banner {
  background: linear-gradient(90deg, #f59e0b, #d97706);
  color: #ffffff;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-normal);
}

.network-banner.hidden {
  display: none;
}

/* ==========================================================================
   Header Navigation
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 24px;
  transition: background-color var(--transition-normal);
}

body.theme-light .app-header {
  background-color: rgba(248, 250, 252, 0.85);
}

.header-container {
  max-width: 1360px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.logo-icon-box {
  width: 42px;
  height: 42px;
  background: var(--primary-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: var(--shadow-glow);
  transition: transform var(--transition-bounce);
}

.brand-logo:hover .logo-icon-box {
  transform: scale(1.06) rotate(-4deg);
}

.brand-name {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  display: block;
}

.brand-tag {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--primary-500);
}

/* Stepper Bar */
.stepper-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(31, 41, 55, 0.5);
  padding: 4px 8px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

body.theme-light .stepper-nav {
  background: rgba(226, 232, 240, 0.6);
}

.step-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.step-btn:not([disabled]):hover {
  color: var(--text-primary);
  background: var(--bg-surface);
}

.step-btn.active {
  background: var(--primary-500);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.step-btn.completed {
  color: var(--accent-emerald);
}

.step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.step-btn.active .step-num {
  background: #ffffff;
  color: var(--primary-600);
}

.step-divider {
  width: 14px;
  height: 2px;
  background: var(--border-subtle);
  border-radius: 2px;
}

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

.icon-action-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
}

.icon-action-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-medium);
  background: var(--bg-surface-elevated);
}

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

.btn-secondary-sm {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.84rem;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
}

.btn-secondary-sm:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-medium);
}

/* ==========================================================================
   Main Application & Views Flow
   ========================================================================== */
.app-main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 32px 24px 120px 24px;
}

.screen-view {
  display: none;
  animation: fadeInView 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.screen-view.active {
  display: block;
}

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

/* Common View Headers */
.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.step-crumb {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--primary-500);
  display: block;
  margin-bottom: 4px;
}

.view-title {
  font-size: 1.85rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.view-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.header-action-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  font-size: 0.84rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.btn-chip:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

/* ==========================================================================
   Screen 1: Import & Home
   ========================================================================== */
.hero-section {
  text-align: center;
  max-width: 760px;
  margin: 16px auto 36px auto;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: rgba(59, 130, 246, 0.12);
  color: var(--primary-500);
  font-size: 0.84rem;
  font-weight: 700;
  margin-bottom: 16px;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.hero-title {
  font-size: 2.75rem;
  line-height: 1.15;
  margin-bottom: 14px;
}

.gradient-text {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  line-height: 1.6;
}

/* Dropzone */
.upload-container {
  max-width: 780px;
  margin: 0 auto 48px auto;
}

.upload-dropzone {
  background: var(--bg-card);
  border: 2px dashed rgba(59, 130, 246, 0.4);
  border-radius: var(--radius-xl);
  padding: 48px 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-md);
  position: relative;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
  border-color: var(--primary-500);
  background: rgba(59, 130, 246, 0.05);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.hidden-input {
  display: none;
}

.upload-icon-pulse {
  width: 72px;
  height: 72px;
  background: var(--primary-gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  margin: 0 auto 20px auto;
  box-shadow: var(--shadow-glow);
  transition: transform var(--transition-bounce);
}

.upload-dropzone:hover .upload-icon-pulse {
  transform: scale(1.12);
}

.upload-prompt {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.upload-browse-link {
  color: var(--primary-500);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.upload-hint {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 24px;
}

.upload-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.spec-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
}

.sample-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.btn-link {
  background: transparent;
  color: var(--primary-500);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color var(--transition-fast);
}

.btn-link:hover {
  text-decoration: underline;
  color: var(--primary-600);
}

/* My Files Section */
.my-files-section {
  margin-bottom: 48px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
}

.section-title-wrap h2 {
  font-size: 1.35rem;
  font-weight: 700;
}

.btn-text-sm {
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  transition: color var(--transition-fast);
}

.btn-text-sm:hover {
  color: var(--accent-rose);
}

.recent-files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.empty-files-placeholder {
  grid-column: 1 / -1;
  text-align: center;
  padding: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
}

.recent-file-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.recent-file-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-medium);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.file-card-left {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.file-thumb-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary-500);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.file-info-col {
  overflow: hidden;
}

.file-name {
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.file-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Feature Row */
.features-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition-fast);
}

.feature-card:hover {
  border-color: var(--border-medium);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.feature-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  margin-bottom: 16px;
}

.bg-blue { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.bg-emerald { background: linear-gradient(135deg, #10b981, #059669); }
.bg-purple { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }

.feature-card h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ==========================================================================
   Screen 2: Page Selection
   ========================================================================== */
.status-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.doc-meta-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-primary);
}

.selection-counter {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary-500);
  background: rgba(59, 130, 246, 0.12);
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

.pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
}

.page-tile-card {
  background: var(--bg-card);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.page-tile-card:hover {
  border-color: var(--border-medium);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.page-tile-card.selected {
  border-color: var(--primary-500);
  background: rgba(59, 130, 246, 0.08);
  box-shadow: var(--shadow-glow);
}

.page-tile-card.excluded {
  opacity: 0.45;
  filter: grayscale(0.8);
}

.page-canvas-wrapper {
  width: 100%;
  aspect-ratio: 1 / 1.414; /* Standard A4 aspect ratio */
  background: #ffffff;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.page-canvas-wrapper canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.page-card-footer {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding: 0 4px;
}

.page-number-tag {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.page-check-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 0.75rem;
  transition: all var(--transition-fast);
}

.page-tile-card.selected .page-check-circle {
  background: var(--primary-500);
  border-color: var(--primary-500);
}

/* ==========================================================================
   Screen 3: Rearrange & Rotate
   ========================================================================== */
.rearrange-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.rearrange-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  cursor: grab;
  user-select: none;
  transition: all var(--transition-fast);
}

.rearrange-card:active {
  cursor: grabbing;
}

.rearrange-card.dragging {
  opacity: 0.4;
  border: 2px dashed var(--primary-500);
  transform: scale(0.96);
}

.rearrange-card.drag-over {
  border-color: var(--accent-emerald);
  transform: scale(1.04);
}

.order-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  color: #ffffff;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 800;
  z-index: 5;
}

.card-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 10px;
  gap: 4px;
}

.icon-btn-micro {
  padding: 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.icon-btn-micro:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
}

.icon-btn-micro.danger:hover {
  background: rgba(244, 63, 94, 0.2);
  color: var(--accent-rose);
}

/* ==========================================================================
   Screen 4: Layout Grid Selection (N-Up)
   ========================================================================== */
.layout-paper-savings-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.88rem;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.layout-presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

/* Top Tabs: Standard vs Custom Layout */
.layout-main-tabs {
  display: flex;
  align-items: center;
  gap: 32px;
  border-bottom: 2px solid var(--border-subtle);
  margin-bottom: 24px;
}

.layout-tab-btn {
  background: transparent;
  padding: 12px 16px;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  position: relative;
  transition: all var(--transition-fast);
}

.layout-tab-btn:hover {
  color: var(--text-primary);
}

.layout-tab-btn.active {
  color: #ef4444; /* Signature App Red */
}

.layout-tab-btn .tab-indicator {
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  border-radius: 3px;
  transition: background var(--transition-fast);
}

.layout-tab-btn.active .tab-indicator {
  background: #ef4444;
}

.layout-tab-content.hidden {
  display: none;
}

/* Source Document Format Selector (Landscape vs Portrait) */
.source-format-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.format-option-card {
  background: #181b22;
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition-fast);
}

body.theme-light .format-option-card {
  background: #f1f5f9;
  border-color: rgba(0, 0, 0, 0.1);
}

.format-option-card:hover {
  border-color: rgba(239, 68, 68, 0.4);
  transform: translateY(-2px);
}

.format-option-card.active {
  border: 2px solid #ef4444;
  background: rgba(239, 68, 68, 0.08);
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
}

.format-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
  transition: color var(--transition-fast);
}

.format-option-card.active .format-title {
  color: #ef4444;
}

.format-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* App Presets Grid */
.app-presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
}

.app-presets-grid.hidden {
  display: none;
}

.app-layout-card {
  background: #181b22;
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
}

body.theme-light .app-layout-card {
  background: #f8fafc;
  border-color: rgba(0, 0, 0, 0.08);
}

.app-layout-card:hover {
  border-color: rgba(239, 68, 68, 0.5);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.app-layout-card.active {
  border: 2.5px solid #ef4444;
  background: rgba(239, 68, 68, 0.06);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.25);
}

.app-wireframe-box {
  width: 100%;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.app-mini-sheet {
  background: #252a34;
  border: 1.5px solid #3b4252;
  border-radius: 8px;
  padding: 5px;
  display: grid;
  gap: 4px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  overflow: hidden;
}

body.theme-light .app-mini-sheet {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.app-mini-sheet.landscape {
  width: 92px;
  height: 65px;
  padding: 5px;
  gap: 4px;
}

.app-mini-sheet.portrait {
  width: 65px;
  height: 92px;
  padding: 5px;
  gap: 4px;
}

.app-red-cell {
  background: #ef4444;
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: all var(--transition-fast);
  box-sizing: border-box;
}

/* Individual Cell Formats for Landscape & Portrait Sheets */
.cell-1-1-landscape { width: 78px; height: 51px; }
.cell-1-1-portrait { width: 51px; height: 78px; }
.cell-2-1-portrait { width: 51px; height: 36px; }
.cell-3-1-portrait { width: 51px; height: 23px; }

/* 2x2 Grid: Landscape Sheet (PPT/Slides) vs Portrait Sheet (Documents) */
.app-mini-sheet.landscape.grid-2x2-mini { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.app-mini-sheet.landscape.grid-2x2-mini .app-red-cell { width: 37px; height: 24px; }

.app-mini-sheet.portrait.grid-2x2-mini { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.app-mini-sheet.portrait.grid-2x2-mini .app-red-cell { width: 24px; height: 36px; }

/* Other Multi-Cell Grids */
.grid-3x2-mini { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr 1fr; }
.grid-3x2-mini .app-red-cell { width: 24px; height: 23px; }

.grid-4x2-mini { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr 1fr 1fr; }
.grid-4x2-mini .app-red-cell { width: 24px; height: 16px; }

.grid-1x2-mini { grid-template-columns: 1fr 1fr; }
.grid-1x2-mini .app-red-cell { width: 37px; height: 51px; }

.grid-1x3-mini { grid-template-columns: 1fr 1fr 1fr; }
.grid-1x3-mini .app-red-cell { width: 23px; height: 51px; }

.grid-2x3-mini { grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr 1fr; }
.grid-2x3-mini .app-red-cell { width: 23px; height: 24px; }

.grid-2x4-mini { grid-template-columns: 1fr 1fr 1fr 1fr; grid-template-rows: 1fr 1fr; }
.grid-2x4-mini .app-red-cell { width: 17px; height: 24px; }

.app-card-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 2px;
  transition: color var(--transition-fast);
}

.app-layout-card.active .app-card-title {
  color: #ef4444;
}

.app-card-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.app-card-check {
  margin-top: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: all var(--transition-fast);
}

.app-layout-card.active .app-card-check {
  color: #ef4444;
}

/* Custom Layout Stage */
.custom-layout-stage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 32px;
  align-items: center;
}

.custom-stage-left {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.custom-card-preview {
  width: 180px;
  height: 220px;
  background: var(--bg-surface);
  border: 2px solid var(--border-medium);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-md);
}

.custom-summary-text {
  font-weight: 700;
  font-size: 0.95rem;
  color: #ef4444;
}

.custom-stage-right {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ==========================================================================
   Screen 5: Page Setup (Mobile APK 2x2 Grid & Live Rendered Preview)
   ========================================================================== */
.page-setup-mobile-wrapper {
  max-width: 680px;
  margin: 0 auto;
}

.setup-preview-container {
  margin-bottom: 24px;
}

.setup-preview-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.setup-preview-card {
  background: #181b22;
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  padding: 24px 16px 16px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

body.theme-light .setup-preview-card {
  background: #f1f5f9;
  border-color: rgba(0, 0, 0, 0.1);
}

.sheet-preview-viewport {
  width: 100%;
  min-height: 280px;
  max-height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.virtual-sheet-real {
  background: #ffffff;
  border-radius: 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  display: grid;
  gap: 4px;
  padding: 8px;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.virtual-sheet-real.portrait {
  width: 200px;
  height: 282px;
}

.virtual-sheet-real.landscape {
  width: 282px;
  height: 200px;
}

.sheet-page-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  overflow: hidden;
  border-radius: 2px;
  height: 100%;
  width: 100%;
  transition: all var(--transition-fast);
}

.sheet-page-cell.has-border {
  border: 1.5px solid #000000;
}

.sheet-page-cell canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.virtual-sheet-real.inverted .sheet-page-cell canvas {
  filter: invert(1) hue-rotate(180deg);
}

.virtual-sheet-real.clear-bg .sheet-page-cell canvas {
  filter: contrast(135%) brightness(108%);
}

.sheet-page-num-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  background: rgba(0, 0, 0, 0.85);
  color: #ffffff;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 3px;
  z-index: 5;
  pointer-events: none;
}

.preview-gesture-hint {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-top: 14px;
  text-align: center;
  letter-spacing: 0.2px;
}

/* Page Options Section (2x2 Grid from APK) */
.page-options-container {
  margin-bottom: 20px;
}

.page-options-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.page-options-2x2-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.app-option-toggle-card {
  background: #181b22;
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all var(--transition-fast);
}

body.theme-light .app-option-toggle-card {
  background: #f8fafc;
  border-color: rgba(0, 0, 0, 0.08);
}

.app-option-toggle-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.app-option-toggle-card.active {
  border: 2px solid #ef4444;
  background: rgba(239, 68, 68, 0.06);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.2);
}

.option-card-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.option-icon {
  width: 24px;
  height: 24px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
}

.app-option-toggle-card.active .option-icon,
.option-icon.red-icon {
  color: #ef4444;
}

.option-text {
  display: flex;
  flex-direction: column;
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.25;
  color: var(--text-primary);
}

/* APK Switch Slider */
.apk-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}

.apk-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.apk-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #2e3440;
  transition: .25s;
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

body.theme-light .apk-slider {
  background-color: #cbd5e1;
}

.apk-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: .25s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.apk-switch input:checked + .apk-slider {
  background-color: #ef4444;
  border-color: #ef4444;
}

.apk-switch input:checked + .apk-slider:before {
  transform: translateX(20px);
}

/* Advanced Accordion (Paper Size, Margins, Orientation & Cut Guidelines) */
.setup-advanced-accordion {
  background: #181b22;
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-top: 18px;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

body.theme-light .setup-advanced-accordion {
  background: #f8fafc;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

.accordion-header {
  padding: 16px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  user-select: none;
  list-style: none;
  background: rgba(255, 255, 255, 0.02);
  transition: background var(--transition-fast);
}

.accordion-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

body.theme-light .accordion-header:hover {
  background: rgba(0, 0, 0, 0.03);
}

.accordion-header::-webkit-details-marker {
  display: none;
}

.accordion-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
}

.accordion-title-wrap i {
  color: #ef4444;
}

.accordion-arrow {
  color: var(--text-muted);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.setup-advanced-accordion[open] .accordion-arrow {
  transform: rotate(180deg);
}

.accordion-content {
  padding: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: #12151b;
}

body.theme-light .accordion-content {
  border-top-color: rgba(0, 0, 0, 0.06);
  background: #ffffff;
}

.adv-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 24px;
}

@media (max-width: 640px) {
  .adv-settings-grid {
    grid-template-columns: 1fr;
  }
}

.adv-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.adv-group label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Modern Segmented Toggle Pills */
.toggle-pills {
  display: flex;
  background: #1c202a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 4px;
  gap: 4px;
  width: 100%;
}

body.theme-light .toggle-pills {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.pill-btn {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-secondary);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
  white-space: nowrap;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pill-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

body.theme-light .pill-btn:hover:not(.active) {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-primary);
}

.pill-btn.active {
  background: #ef4444 !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

/* Small Toggle Switch for Cut Lines */
.toggle-switch-sm {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 6px 0;
  user-select: none;
}

.toggle-switch-sm input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-switch-sm .switch-slider {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  background-color: #2e3440;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

body.theme-light .toggle-switch-sm .switch-slider {
  background-color: #cbd5e1;
}

.toggle-switch-sm .switch-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: all var(--transition-fast);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.toggle-switch-sm input:checked + .switch-slider {
  background-color: #ef4444;
  border-color: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.35);
}

.toggle-switch-sm input:checked + .switch-slider:before {
  transform: translateX(18px);
}

.toggle-switch-sm .label-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Live Spec Badge in Setup Title */
.preview-spec-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 3px 8px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-full);
  color: #ef4444;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* Dashed Cut Lines indicator in live sheet preview */
.sheet-page-cell.has-cutlines {
  outline: 1px dashed rgba(239, 68, 68, 0.5);
  outline-offset: -2px;
}

/* ==========================================================================
   Screen 6: Color Mode & Ink Saver
   ========================================================================== */
.color-modes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 32px;
}

.color-mode-card {
  background: var(--bg-card);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 32px 24px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  transition: all var(--transition-normal);
}

.color-mode-card:hover {
  border-color: var(--border-medium);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.color-mode-card.active {
  border-color: var(--primary-500);
  background: rgba(59, 130, 246, 0.08);
  box-shadow: var(--shadow-glow);
}

.mode-icon-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  margin-bottom: 20px;
}

.bg-rainbow { background: linear-gradient(135deg, #ef4444, #f59e0b, #10b981, #3b82f6, #8b5cf6); }
.bg-gray { background: linear-gradient(135deg, #9ca3af, #4b5563); }
.bg-black { background: linear-gradient(135deg, #1e293b, #0f172a); border: 2px solid #64748b; }

.color-mode-card h3 {
  font-size: 1.25rem;
  margin-bottom: 8px;
}

.color-mode-card p {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.5;
  margin-bottom: 20px;
}

.mini-sample-preview {
  width: 100%;
  max-width: 180px;
  height: 120px;
  background: #ffffff;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
}

.mini-sample-preview canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.color-mode-card:hover .mini-sample-preview {
  transform: scale(1.04);
  box-shadow: var(--shadow-md);
}

/* Live Simulation Stage */
.color-simulation-stage {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 24px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-md);
}

.sim-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.sim-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sim-sparkle-icon {
  color: var(--primary-500);
  width: 28px;
  height: 28px;
}

.sim-title-group h3 {
  font-size: 1.2rem;
  margin-bottom: 2px;
}

.sim-title-group p {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.sim-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.sim-page-pager {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 4px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.sim-pager-btn {
  background: transparent;
  color: var(--text-secondary);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sim-pager-btn:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
}

.sim-mode-pill {
  background: #ef4444;
  color: #ffffff;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

.sim-body {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 28px;
  align-items: center;
}

@media (max-width: 860px) {
  .sim-body {
    grid-template-columns: 1fr;
  }
}

.sim-canvas-box {
  background: #181b22;
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  max-height: 420px;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.08);
}

body.theme-light .sim-canvas-box {
  background: #f1f5f9;
  border-color: rgba(0, 0, 0, 0.1);
}

.sim-canvas-box canvas {
  background: #ffffff;
  max-width: 100%;
  max-height: 380px;
  object-fit: contain;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  border-radius: 4px;
}

.sim-details-box {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sim-spec-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

.sim-spec-card h4 {
  font-size: 0.95rem;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.sim-spec-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sim-spec-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.sim-spec-list li i {
  color: var(--accent-emerald);
  width: 16px;
  height: 16px;
}

.sim-savings-meter {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

.meter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 0.9rem;
  font-weight: 600;
}

.meter-header strong {
  font-size: 1.15rem;
  color: var(--accent-emerald);
}

.meter-track {
  width: 100%;
  height: 10px;
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 8px;
}

.meter-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  border-radius: var(--radius-full);
  transition: width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.meter-note {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.ink-savings-summary-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.ink-savings-summary-box i {
  color: var(--primary-500);
  flex-shrink: 0;
  margin-top: 2px;
}

/* ==========================================================================
   Screen 7: Printable Screen / Final Live Stage
   ========================================================================== */
.printable-stage-container {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 28px;
  align-items: start;
}

.doc-stats-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.stats-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.stats-card h3 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 12px;
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 0.9rem;
}

.stat-label {
  color: var(--text-secondary);
}

.stat-val {
  font-weight: 700;
  color: var(--text-primary);
}

.stat-val.highlight {
  color: var(--primary-500);
  font-size: 1.1rem;
}

.stat-row.highlight-green {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.stat-row.highlight-green .stat-val {
  color: var(--accent-emerald);
  font-size: 1.25rem;
}

.quick-tips-box {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.quick-tips-box h4 {
  font-size: 0.92rem;
  color: var(--accent-amber);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.quick-tips-box p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Canvas Viewport */
.preview-stage-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
}

.preview-toolbar {
  background: var(--bg-surface);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.sheet-pagination {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
}

.nav-page-btn, .tool-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.nav-page-btn:hover, .tool-btn:hover {
  background: var(--primary-500);
  color: #ffffff;
}

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

.canvas-viewport {
  width: 100%;
  min-height: 520px;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  overflow: auto;
}

.canvas-stage {
  box-shadow: var(--shadow-lg);
  border-radius: 4px;
  background: #ffffff;
  transition: transform var(--transition-fast);
  transform-origin: center center;
}

#output-sheet-canvas {
  display: block;
  max-width: 100%;
  max-height: 70vh;
}

/* Buttons */
.btn-primary {
  background: var(--primary-gradient);
  color: #ffffff;
  padding: 10px 22px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-glow);
  transition: all var(--transition-fast);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-fast);
}

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

/* ==========================================================================
   Bottom Navigation Bar
   ========================================================================== */
.app-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  background-color: rgba(10, 14, 23, 0.9);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-subtle);
  padding: 16px 24px;
  transition: all var(--transition-normal);
}

body.theme-light .app-bottom-bar {
  background-color: rgba(248, 250, 252, 0.9);
}

.app-bottom-bar.hidden {
  transform: translateY(100%);
}

.bottom-bar-container {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-bar-back {
  background: var(--bg-surface);
  color: var(--text-secondary);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.92rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
}

.btn-bar-back:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
}

.bottom-bar-center-info {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

.btn-bar-next {
  background: var(--primary-gradient);
  color: #ffffff;
  padding: 10px 24px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-glow);
  transition: all var(--transition-fast);
}

.btn-bar-next:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

/* ==========================================================================
   Loading Modal Dialog
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity var(--transition-normal);
}

.modal-overlay.hidden {
  display: none;
  opacity: 0;
}

.loading-dialog-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  padding: 36px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.loader-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-subtle);
  border-top-color: var(--primary-500);
  border-radius: 50%;
  margin: 0 auto 18px auto;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-dialog-card h3 {
  font-size: 1.3rem;
  margin-bottom: 6px;
}

.loading-dialog-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background: var(--bg-surface);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary-gradient);
  border-radius: var(--radius-full);
  transition: width 0.2s ease-out;
}

.progress-percentage-text {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-500);
}

/* ==========================================================================
   Print Output Media Rules
   ========================================================================== */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .app-header,
  .app-bottom-bar,
  .preview-toolbar,
  .doc-stats-sidebar,
  .view-header,
  .modal-overlay,
  .network-banner {
    display: none !important;
  }

  .app-main {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
  }

  .screen-view {
    display: none !important;
  }

  #screen-printable {
    display: block !important;
  }

  .printable-stage-container {
    display: block !important;
  }

  .canvas-viewport {
    background: transparent !important;
    padding: 0 !important;
    min-height: auto !important;
  }

  .canvas-stage {
    box-shadow: none !important;
    border: none !important;
  }

  #output-sheet-canvas {
    max-height: none !important;
    max-width: 100% !important;
    width: 100% !important;
    page-break-after: always;
  }
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1024px) {
  .setup-grid-container {
    grid-template-columns: 1fr;
  }
  .printable-stage-container {
    grid-template-columns: 1fr;
  }
  .features-row, .color-modes-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .stepper-nav .step-label {
    display: none;
  }
  .hero-title {
    font-size: 2rem;
  }
}
