/* ========================================================
   Custom Guest Book Generator - Main Stylesheet
   ======================================================== */

:root {
  --bg-app: #121417;
  --bg-workspace: #0f1115;
  --bg-sidebar: #1a1d23;
  --bg-sidebar-elevated: #232730;
  --bg-sidebar-input: #15181c;
  --border-color: #2e3440;
  --border-focus: #4f80e1;
  --text-main: #e2e8f0;
  --text-primary: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #4f80e1;
  --primary-hover: #3b6cd0;
  --accent-gold: #c5a059;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.25);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.35);
  --shadow-sheet: 0 14px 40px rgba(0,0,0,0.4), 0 2px 10px rgba(0,0,0,0.25);
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background-color: var(--bg-app);
  color: var(--text-main);
}

body {
  font-family: var(--font-ui);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  -webkit-font-smoothing: antialiased;
}

/* ========================================================
   App Layout
   ======================================================== */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Header */
.app-header {
  position: relative;
  z-index: 1500;
  height: 56px;
  background: rgba(17, 21, 28, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
  gap: 12px;
}

.header-left-zone {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 0 1 auto;
  overflow: hidden;
}

.header-center-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-width: 0;
}

.header-right-zone {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.2s ease;
  flex-shrink: 0;
}

.header-brand:hover {
  opacity: 0.88;
}

.brand-icon {
  font-size: 20px;
  color: var(--accent-gold);
}

.brand-text h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: #fff;
  line-height: 1.1;
}

.version-tag {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.2px;
}

.header-brand-divider {
  width: 1px;
  height: 20px;
  background-color: var(--border-color);
  opacity: 0.6;
  display: inline-block;
}

/* ========================================================
   App Header Stepper & Dynamic View Actions
   ======================================================== */
.app-flow-stepper {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 3px 8px;
  border-radius: 20px;
  flex-shrink: 0;
}

.stepper-step {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  cursor: default;
  pointer-events: none;
  padding: 3px 8px;
  border-radius: 12px;
  transition: var(--transition);
  user-select: none;
}

.stepper-num {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9.5px;
  font-weight: 700;
  color: #94a3b8;
  transition: var(--transition);
}

.stepper-step.active {
  color: #fff;
  font-weight: 600;
  background: rgba(79, 128, 225, 0.18);
}

.stepper-step.active .stepper-num {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 6px rgba(79, 128, 225, 0.5);
}

.stepper-step.completed {
  color: #94a3b8;
}

.stepper-step.completed .stepper-num {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.35);
  color: #4ade80;
}

.stepper-divider {
  font-size: 7px;
  color: #475569;
}

.header-view-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

#headerEditorActions {
  flex: 1;
  justify-content: flex-end;
}

.wizard-header-counter {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent-gold);
  background: rgba(197, 160, 89, 0.12);
  border: 1px solid rgba(197, 160, 89, 0.25);
  padding: 4px 10px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Common Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  outline: none;
  font-family: inherit;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 11.5px;
}

.full-width {
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, #4f80e1, #3b6cd0);
  color: #fff;
  box-shadow: 0 2px 6px rgba(79, 128, 225, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #5b8cf0, #4274de);
  transform: translateY(-1px);
}

.btn-outline {
  background-color: var(--bg-sidebar-elevated);
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background-color: #2b303b;
  border-color: #404856;
}

.btn-subtle {
  background: transparent;
  color: var(--text-muted);
  padding: 7px 10px;
}


/* Disabled Button Styles */
.btn:disabled,
.btn[disabled],
.btn.is-disabled,
.btn[aria-disabled="true"] {
  opacity: 0.42 !important;
  cursor: not-allowed !important;
  filter: grayscale(50%) !important;
  background: #252e3e !important;
  border-color: #3b465a !important;
  color: #94a3b8 !important;
  box-shadow: none !important;
  transform: none !important;
}

.btn:disabled:hover,
.btn[disabled]:hover,
.btn.is-disabled:hover,
.btn[aria-disabled="true"]:hover {
  background: #252e3e !important;
  border-color: #3b465a !important;
  color: #94a3b8 !important;
  box-shadow: none !important;
  transform: none !important;
  cursor: not-allowed !important;
}

.btn-subtle:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

/* ========================================================
   Main Workspace: Split Panes
   ======================================================== */
.workspace {
  display: flex;
  flex: 1;
  height: calc(100vh - 56px);
  overflow: hidden;
}

/* ========================================================
   Left Sidebar Controls
   ======================================================== */
.sidebar {
  width: 390px;
  min-width: 340px;
  max-width: 450px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: 40px;
  flex-shrink: 0;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
  background: #2e3440;
  border-radius: 3px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background: #3e4657;
}

/* Presets Bar */
.preset-selector-section {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(to bottom, #1d2128, var(--bg-sidebar));
}

.preset-selector-section .section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.preset-selector-section .section-header h3 {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent-gold);
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.preset-header-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn-randomize-presets {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.18s ease;
}

.btn-randomize-presets:hover {
  background: rgba(56, 189, 248, 0.22);
  border-color: #38bdf8;
  color: #fff;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
  transform: translateY(-1px);
}

.btn-true-randomize {
  background: rgba(236, 72, 153, 0.12);
  border: 1px solid rgba(236, 72, 153, 0.35);
  color: #f472b6;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.18s ease;
}

.btn-true-randomize:hover {
  background: rgba(236, 72, 153, 0.22);
  border-color: #ec4899;
  color: #fff;
  box-shadow: 0 0 10px rgba(236, 72, 153, 0.4);
  transform: translateY(-1px);
}

.preset-chip-random {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.18) 0%, rgba(168, 85, 247, 0.22) 100%) !important;
  border-color: rgba(56, 189, 248, 0.45) !important;
  color: #7dd3fc !important;
  font-weight: 600 !important;
}

.preset-chip-random:hover {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.3) 0%, rgba(168, 85, 247, 0.35) 100%) !important;
  border-color: #38bdf8 !important;
  color: #fff !important;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.35) !important;
  transform: translateY(-1px);
}

.preset-chip-random.active {
  background: linear-gradient(135deg, #0284c7 0%, #7c3aed 100%) !important;
  border-color: #38bdf8 !important;
  color: #ffffff !important;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.5) !important;
}

.preset-chip-chaos {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.18) 0%, rgba(249, 115, 22, 0.22) 100%) !important;
  border-color: rgba(236, 72, 153, 0.45) !important;
  color: #f472b6 !important;
  font-weight: 600 !important;
}

.preset-chip-chaos:hover {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.3) 0%, rgba(249, 115, 22, 0.35) 100%) !important;
  border-color: #ec4899 !important;
  color: #fff !important;
  box-shadow: 0 0 12px rgba(236, 72, 153, 0.4) !important;
  transform: translateY(-1px);
}

.preset-chip-chaos.active {
  background: linear-gradient(135deg, #db2777 0%, #ea580c 100%) !important;
  border-color: #ec4899 !important;
  color: #ffffff !important;
  box-shadow: 0 0 14px rgba(236, 72, 153, 0.5) !important;
}

.preset-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preset-chip {
  background: var(--bg-sidebar-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 20px;
  padding: 5px 11px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

.preset-chip:hover {
  color: #fff;
  border-color: #4b5568;
  background: #2c323f;
}

.preset-chip.active {
  background: #2b3952;
  border-color: var(--primary);
  color: #8bb2ff;
}

.preset-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* Sidebar Search Bar */
.sidebar-search-box {
  padding: 10px 16px;
  background-color: #14171d;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 10;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 11px;
  color: #64748b;
  font-size: 13px;
  pointer-events: none;
}

.options-search-input {
  width: 100%;
  background-color: var(--bg-sidebar-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 7px 30px 7px 32px;
  color: var(--text-main);
  font-size: 12px;
  transition: all 0.2s ease;
  outline: none;
}

.options-search-input:focus {
  border-color: var(--primary);
  background-color: #1e222b;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.15);
}

.search-clear-btn {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.15s ease;
}

.search-clear-btn:hover {
  color: #fff;
}

.search-results-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 11px;
  color: #38bdf8;
  font-weight: 500;
  padding: 0 2px;
}

.search-action-btn {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 10.5px;
  text-decoration: underline;
  padding: 0;
}

.search-action-btn:hover {
  color: #e2e8f0;
}

/* Search Highlighting */
.form-group.search-match,
.form-row.search-match,
.form-check-group.search-match,
.preset-chip.search-match {
  position: relative;
  background-color: rgba(56, 189, 248, 0.08);
  border-radius: 6px;
  padding: 4px 6px;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.3);
  transition: background-color 0.2s ease;
}

.form-group.search-dimmed,
.form-row.search-dimmed,
.form-check-group.search-dimmed,
.preset-chip.search-dimmed {
  display: none !important;
}

.accordion-item.search-hidden {
  display: none !important;
}

.accordion-item.search-has-match .accordion-summary {
  background-color: rgba(56, 189, 248, 0.05);
}

.accordion-item.search-has-match .summary-title {
  color: #38bdf8;
}

/* Sidebar Accordion */
.sidebar-accordion {
  display: flex;
  flex-direction: column;
}

.accordion-item {
  border-bottom: 1px solid var(--border-color);
}

.accordion-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
  background-color: var(--bg-sidebar);
  transition: background-color 0.15s ease;
}

.accordion-summary::-webkit-details-marker {
  display: none;
}

.accordion-summary:hover {
  background-color: var(--bg-sidebar-elevated);
}

.summary-title {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #cbd5e1;
}

.summary-title i {
  color: var(--primary);
  width: 16px;
  text-align: center;
  font-size: 13px;
}

.arrow-icon {
  font-size: 11px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.accordion-item[open] .arrow-icon {
  transform: rotate(180deg);
}

.accordion-content {
  padding: 14px 18px 18px;
  background-color: #17191e;
  border-top: 1px solid rgba(255,255,255,0.03);
  display: flex;
  flex-direction: column;
  gap: 13px;
}

/* Forms & Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-group label:has(i) {
  justify-content: flex-start;
  gap: 8px;
}

.form-group label i {
  flex-shrink: 0;
}

.form-row {
  display: flex;
  gap: 10px;
}

.form-row .col {
  flex: 1;
}

.form-row .col-unit {
  width: 72px;
  flex-shrink: 0;
}

.size-action-row {
  margin-top: 2px;
}

.size-info-pill {
  background-color: #121418;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 11.5px;
  color: var(--accent-gold);
  display: flex;
  align-items: center;
  gap: 8px;
}

.mode-info-alert {
  background-color: rgba(79, 128, 225, 0.12);
  border: 1px solid rgba(79, 128, 225, 0.3);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12px;
  color: #93b7ff;
  line-height: 1.4;
}

.input-control {
  background-color: var(--bg-sidebar-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 7px 10px;
  font-size: 12.5px;
  font-family: inherit;
  width: 100%;
  transition: var(--transition);
  outline: none;
}

.textarea-control {
  resize: vertical;
  min-height: 60px;
  line-height: 1.4;
}

.input-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(79, 128, 225, 0.2);
}

select.input-control {
  cursor: pointer;
  padding-right: 24px;
}

.font-select {
  font-size: 13px;
}

/* Range Sliders */
.range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: #2a303c;
  outline: none;
  margin: 6px 0;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
  transition: transform 0.1s ease;
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Color Controls */
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.color-picker {
  -webkit-appearance: none;
  border: 1px solid var(--border-color);
  width: 34px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: transparent;
  padding: 0;
}

.color-picker::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.color-picker::-webkit-color-swatch {
  border-radius: 4px;
  border: none;
}

.hex-input {
  width: 86px;
  text-transform: uppercase;
  font-family: monospace;
  font-size: 12px;
}

.color-swatches {
  display: flex;
  gap: 5px;
  margin-left: auto;
}

.swatch {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.2);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.swatch:hover {
  transform: scale(1.25);
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.opacity-picker-wrapper {
  width: 100%;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Checkboxes */
.form-check-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  display: none;
}

.custom-checkbox {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-sidebar-input);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked + .custom-checkbox {
  background-color: var(--primary);
  border-color: var(--primary);
}

.checkbox-label input[type="checkbox"]:checked + .custom-checkbox::after {
  content: "✓";
  font-size: 11px;
  color: #fff;
  font-weight: 700;
}

.checkbox-label:hover span:last-child {
  color: #fff;
}

/* ========================================================
   Right Main Area: Preview Area
   ======================================================== */
.preview-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #0d0f12;
  overflow: hidden;
  position: relative;
}

/* Preview Toolbar */
.preview-toolbar {
  height: 48px;
  background-color: #16191f;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 10;
  flex-shrink: 0;
}

.toolbar-left, .toolbar-center, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.view-mode-buttons {
  display: flex;
  background-color: #1e222b;
  border-radius: var(--radius-sm);
  padding: 2px;
  border: 1px solid var(--border-color);
}

.toolbar-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  font-family: inherit;
}

.toolbar-btn:hover {
  color: #fff;
  background: rgba(255,255,255,0.06);
}

.toolbar-btn.active {
  background-color: var(--primary);
  color: #fff;
  font-weight: 500;
}

.toolbar-btn.icon-only {
  padding: 6px 8px;
}

.toolbar-btn:disabled,
.toolbar-btn.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.photo-editor-btn-icon:disabled,
.photo-editor-btn-icon.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.page-indicator {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
}

.spread-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.spread-counter {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-main);
  min-width: 80px;
  text-align: center;
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.zoom-slider {
  width: 90px;
  height: 4px;
  background: #2a303c;
  border-radius: 2px;
  -webkit-appearance: none;
  cursor: pointer;
}

.zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #cbd5e1;
}

.zoom-value {
  font-size: 11.5px;
  color: var(--text-muted);
  min-width: 38px;
  font-family: monospace;
}

/* Viewport Canvas */
.booklet-viewport {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px;
  background: radial-gradient(circle at center, #181c24 0%, #0d0f12 100%);
}

.booklet-viewport::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
.booklet-viewport::-webkit-scrollbar-thumb {
  background: #2e3440;
  border-radius: 5px;
}
.booklet-viewport::-webkit-scrollbar-track {
  background: #111418;
}

.booklet-canvas-wrapper {
  transform-origin: top center;
  display: flex;
  justify-content: center;
}

/* ========================================================
   Booklet Pages Container Modes
   ======================================================== */
.booklet-container {
  display: flex;
  position: relative;
}

/* Mode: Vertical Scroll */
.booklet-container.mode-scroll {
  flex-direction: column;
  gap: 40px;
  align-items: center;
}

/* Mode: Book Spread */
.booklet-container.mode-spread {
  flex-direction: row;
  align-items: stretch;
  background: #090b0d;
  padding: 18px;
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
}

.booklet-container.mode-spread .spread-page-left {
  box-shadow: -8px 8px 24px rgba(0,0,0,0.35);
  border-top-right-radius: 2px;
  border-bottom-right-radius: 2px;
}

.booklet-container.mode-spread .spread-page-right {
  box-shadow: 8px 8px 24px rgba(0,0,0,0.35);
  border-top-left-radius: 2px;
  border-bottom-left-radius: 2px;
}

.booklet-container.mode-spread .book-spine-divider {
  width: 22px;
  background: linear-gradient(to right, rgba(0,0,0,0.4), rgba(0,0,0,0.06) 45%, rgba(0,0,0,0.06) 55%, rgba(0,0,0,0.4));
  position: relative;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.6);
  z-index: 5;
}

/* Mode: Grid Overview */
.booklet-container.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 10px 10px 60px 10px;
  box-sizing: border-box;
  align-items: start;
  justify-items: center;
}

.grid-overview-card {
  display: flex;
  flex-direction: column;
  background: #141822;
  border: 1px solid #283144;
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease, box-shadow 0.2s ease;
  user-select: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  box-sizing: border-box;
  width: fit-content;
}

.grid-overview-card:hover {
  transform: translateY(-4px);
  border-color: #38bdf8;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(56, 189, 248, 0.4);
}

.grid-card-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 0 2px;
  font-size: 12px;
  color: #94a3b8;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

.grid-card-num {
  color: #38bdf8;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
}

.grid-card-label {
  color: #e2e8f0;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
  font-size: 12px;
}

.grid-card-jump-btn {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 11px;
  cursor: pointer;
  transition: color 0.15s ease;
  padding: 2px 4px;
}

.grid-overview-card:hover .grid-card-jump-btn {
  color: #38bdf8;
}

.grid-thumb-stage {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  background-color: #fbf9f5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.grid-thumb-stage .book-page {
  pointer-events: none;
}

/* ========================================================
   Individual Booklet Page Styling (The Printable Page)
   ======================================================== */
.book-page {
  position: relative;
  background-color: #fbf9f5;
  color: #2a2421;
  box-shadow: var(--shadow-sheet);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: text;
  transition: background-color 0.2s ease, color 0.2s ease;
  box-sizing: border-box;
  flex-shrink: 0;
}

/* Paper Texture Overlays */
.book-page.texture-grain::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(0,0,0,0.03) 1px, transparent 1px);
  background-size: 8px 8px;
  opacity: 0.7;
  z-index: 2;
}

.book-page.texture-linen::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(0deg, rgba(0,0,0,0.015), rgba(0,0,0,0.015) 1px, transparent 1px, transparent 4px),
                    repeating-linear-gradient(90deg, rgba(0,0,0,0.015), rgba(0,0,0,0.015) 1px, transparent 1px, transparent 4px);
  opacity: 0.8;
  z-index: 2;
}

.book-page.texture-parchment::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(120,80,20,0.04) 2px, transparent 2px), radial-gradient(rgba(0,0,0,0.02) 1px, transparent 1px);
  background-size: 14px 14px, 7px 7px;
  opacity: 0.9;
  z-index: 2;
}

.book-page.texture-watercolor::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.05), transparent 60%),
              radial-gradient(circle at 70% 80%, rgba(0,0,0,0.03), transparent 70%);
  filter: contrast(110%);
  opacity: 0.6;
  z-index: 2;
}

.book-page.texture-smooth::before {
  display: none !important;
}

/* Inner Page Border Frame */
.page-inner-frame {
  position: absolute;
  border-color: var(--accent-gold);
  pointer-events: none;
  z-index: 3;
  opacity: 0.65;
}

.page-inner-frame.frame-double {
  border: 3px double currentColor;
}

.page-inner-frame.frame-double::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px dashed currentColor;
  opacity: 0.4;
}

.page-inner-frame.frame-single {
  border: 1px solid currentColor;
}

.page-inner-frame.frame-dashed {
  border: 1.5px dashed currentColor;
}

.page-inner-frame.frame-dotted {
  border: 1.5px dotted currentColor;
}

.page-inner-frame.frame-none {
  display: none !important;
}

/* Page Inner Content Container */
.page-content-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  z-index: 4;
  width: 100%;
  min-height: 0;
  min-width: 0;
  box-sizing: border-box;
}

/* Header Section */
.page-header {
  padding-bottom: 8px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  position: relative;
  flex-shrink: 0;
}

.page-header.align-center {
  text-align: center;
  align-items: center;
}

.page-header.align-left {
  text-align: left;
  align-items: flex-start;
}

.page-month-title {
  font-family: 'Great Vibes', cursive;
  font-size: 48px;
  line-height: 1.15;
  margin: 0;
  letter-spacing: 2px;
  transition: all 0.2s ease;
}

.page-subtitle {
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-top: 2px;
  opacity: 0.8;
}

.page-header-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 60%;
  margin: 6px 0 0;
  opacity: 0.6;
}

.page-header.align-center .page-header-divider {
  justify-content: center;
}

.page-header.align-left .page-header-divider {
  justify-content: flex-start;
  width: 40%;
}

.header-line {
  flex: 1;
  height: 1px;
  background-color: currentColor;
}

.header-ornament {
  font-size: 10px;
}

/* ========================================================
   3x3 Grid Layout
   ======================================================== */
.grid-3x3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
}

/* Individual Date Cell */
.date-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 8px 10px;
  border-style: solid;
  border-width: 1px;
  border-radius: 6px;
  background-color: rgba(255, 255, 255, 0.85);
  box-sizing: border-box;
  overflow: hidden;
  min-height: 0;
  min-width: 0;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.date-cell.border-dashed {
  border-style: dashed;
}

.date-cell.border-dotted {
  border-style: dotted;
}

.date-cell.border-double {
  border-style: double;
}

.date-cell.border-groove {
  border-style: groove;
}

.date-cell.border-shadow {
  border: none !important;
  box-shadow: 0 3px 8px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
}

.date-cell.border-none {
  border: none !important;
}

/* Cell Header (Date number & Day) */
.cell-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 4px;
  flex-shrink: 0;
}

.cell-header.pos-top-left {
  flex-direction: row;
}

.cell-header.pos-top-right {
  flex-direction: row-reverse;
}

.cell-header.pos-top-center {
  justify-content: center;
  gap: 8px;
}

.cell-header.pos-center-big {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 4px 0 6px;
  gap: 2px;
}

.cell-header.pos-center-big .date-number {
  font-size: 26px;
}

.date-number {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.date-day-name {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.65;
}

/* Modern Badge Corner style */
.date-cell.badge-corner .cell-header {
  position: absolute;
  top: 0;
  left: 0;
  background-color: currentColor;
  padding: 4px 10px;
  border-bottom-right-radius: 8px;
  margin-bottom: 0;
}

.date-cell.badge-corner .date-number {
  color: #fff;
  font-size: 15px;
}

.date-cell.badge-corner .date-day-name {
  color: rgba(255,255,255,0.85);
  font-size: 9px;
  margin-left: 5px;
}

.date-cell.badge-corner .cell-body {
  margin-top: 24px;
}

/* Cell Body (Writing area / Lines / Prompt) */
.cell-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  width: 100%;
  min-height: 0;
}

.cell-lines {
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  flex: 1;
  width: 100%;
  margin: 3px 0;
  overflow: hidden;
}

.ruled-line {
  width: 100%;
  height: 1px;
  background-color: currentColor;
}

.ruled-line.dotted {
  background: none;
  border-bottom: 1px dotted currentColor;
}

.ruled-line.dashed {
  background: none;
  border-bottom: 1px dashed currentColor;
}

/* Dot Matrix Grid style */
.dots-grid-pattern {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(currentColor 0.8px, transparent 0.8px);
  background-size: 11px 11px;
  pointer-events: none;
}

/* Square Graph Grid style */
.graph-grid-pattern {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(to right, currentColor 1px, transparent 1px),
                    linear-gradient(to bottom, currentColor 1px, transparent 1px);
  background-size: 14px 14px;
  pointer-events: none;
}

.cell-prompt {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  opacity: 0.45;
  margin-top: auto;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-prompt.pos-bottom-right {
  text-align: right;
}

.cell-prompt.pos-bottom-left {
  text-align: left;
}

.cell-prompt.pos-bottom-center {
  text-align: center;
}

/* Special Note/Blank Cell (For extra spaces in 3x3 grid) */
.date-cell.is-note-cell {
  background-color: rgba(255, 255, 255, 0.5);
}

.date-cell.is-note-cell.style-photo-frame {
  border: 1.5px dashed currentColor !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background-color: rgba(255, 255, 255, 0.35);
}

.date-cell.is-note-cell.style-invisible {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none;
}

/* Slot without any cell (empty slot when evening notes cells are turned off) */
.date-cell.is-empty-slot {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  pointer-events: none;
  visibility: hidden !important;
  opacity: 0 !important;
}

.date-cell.is-note-cell .date-number {
  font-size: 13px;
  font-weight: 600;
  font-style: italic;
  letter-spacing: 0.5px;
}

/* ========================================================
   Cover & Back Pages
   ======================================================== */
.book-page.page-cover {
  justify-content: center;
  align-items: center;
  text-align: center;
}

.cover-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  border: 2px solid var(--accent-gold);
  border-radius: 12px;
  width: 100%;
  height: 100%;
  flex: 1;
  box-sizing: border-box;
  position: relative;
  background-color: rgba(255,255,255,0.2);
}

.cover-crest {
  font-size: 38px;
  color: var(--accent-gold);
  margin-bottom: 18px;
}

.cover-title {
  font-family: 'Great Vibes', cursive;
  font-size: 58px;
  margin-bottom: 8px;
  line-height: 1.1;
}

.cover-names {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 2px;
  margin-bottom: 12px;
}

.cover-subtitle {
  font-size: 14px;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 22px;
  opacity: 0.85;
}

.cover-date {
  font-size: 15px;
  letter-spacing: 2px;
  font-weight: 600;
  margin-top: 6px;
}

.cover-ornament {
  margin-top: 24px;
  font-size: 18px;
  color: var(--accent-gold);
}

/* Back Cover Page */
.book-page.page-back-cover {
  justify-content: center;
  align-items: center;
  text-align: center;
}

.back-cover-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  width: 100%;
  height: 100%;
  flex: 1;
  box-sizing: border-box;
}

.back-cover-title {
  font-family: 'Great Vibes', cursive;
  font-size: 44px;
  margin-bottom: 16px;
}

.back-cover-text {
  font-size: 15px;
  line-height: 1.7;
  font-style: italic;
  max-width: 480px;
  opacity: 0.85;
}

/* Footer Section */
.page-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  margin-top: 6px;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  opacity: 0.55;
  flex-shrink: 0;
}

.page-footer .page-num {
  font-weight: 600;
}

/* Binding Gutter Margin handled dynamically in JS */
.book-page.left-page-binding,
.book-page.right-page-binding {
  /* Gutter offsets are computed cleanly without breaking base equal margins */
}

/* ========================================================
   Toast Notification
   ======================================================== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background-color: #242933;
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  font-size: 13px;
  font-weight: 500;
  z-index: 1000;
  transform: translateY(0);
  opacity: 1;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.hidden {
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
}

/* ========================================================
   Photos & Grid Image Replacement Styles
   ======================================================== */
.image-requirement-alert {
  background: #1e2634;
  border: 1px solid #334155;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 10px;
}

.requirement-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.req-title {
  color: #e2e8f0;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.req-counter {
  font-weight: 700;
  color: #38bdf8;
  font-size: 13px;
}

/* Upload Dropzone */
.image-upload-dropzone {
  border: 2px dashed #475569;
  border-radius: var(--radius-sm);
  background-color: rgba(30, 41, 59, 0.5);
  padding: 18px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.image-upload-dropzone:hover,
.image-upload-dropzone.dragover {
  border-color: #38bdf8;
  background-color: rgba(56, 189, 248, 0.08);
}

.dropzone-icon {
  font-size: 26px;
  color: #94a3b8;
  margin-bottom: 6px;
}

.dropzone-text {
  font-size: 12px;
  color: #e2e8f0;
  margin-bottom: 2px;
}

.dropzone-subtext {
  font-size: 10px;
  color: #64748b;
  display: block;
}

/* Uploaded Gallery Thumbnails */
.image-gallery-thumbnails {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 6px;
  max-height: 180px;
  overflow-y: auto;
  padding: 2px;
}

.image-thumb-card {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #334155;
  background: #0f172a;
}

.image-thumb-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-delete-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0, 0, 0, 0.7);
  color: #f87171;
  border: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.thumb-delete-btn:hover {
  background: #ef4444;
  color: #fff;
}

.thumb-index-badge {
  position: absolute;
  bottom: 2px;
  left: 2px;
  background: rgba(0, 0, 0, 0.65);
  color: #e2e8f0;
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 600;
}

/* Date Cell: Photo Replacement Style */
.date-cell.is-image-replacement {
  padding: 0 !important;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background-color: rgba(255, 255, 255, 0.95);
  cursor: pointer;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  user-select: none;
}

.date-cell.is-image-replacement:hover {
  box-shadow: 0 0 0 2px #38bdf8, 0 4px 12px rgba(0, 0, 0, 0.25);
}

.date-cell.is-image-replacement.is-editing-active {
  touch-action: none;
  box-shadow: 0 0 0 3px #38bdf8, 0 8px 24px rgba(56, 189, 248, 0.35) !important;
  z-index: 40 !important;
}

.photo-cell-wrapper {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Direct dragging interaction on active photo cell */
.date-cell.is-image-replacement.is-editing-active .photo-cell-wrapper {
  cursor: grab;
}

.date-cell.is-image-replacement.is-editing-active.is-dragging .photo-cell-wrapper {
  cursor: grabbing !important;
}

.photo-cell-img {
  display: block;
  flex-shrink: 0;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: center center;
  pointer-events: auto;
}

/* Natural uncropped cover and contain sizing */
.photo-cell-img.photo-fit-h-fill {
  height: 100% !important;
  width: auto !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: unset !important;
}

.photo-cell-img.photo-fit-w-fill {
  width: 100% !important;
  height: auto !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: unset !important;
}

/* Fallback if natural dimensions are pending */
.photo-cell-img:not(.photo-fit-h-fill):not(.photo-fit-w-fill) {
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
}

/* Hover hint badge on cell */
.photo-cell-hover-hint {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #38bdf8;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(56, 189, 248, 0.4);
  pointer-events: none;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.date-cell.is-image-replacement:hover .photo-cell-hover-hint {
  opacity: 1;
  transform: translateY(0);
}

.date-cell.is-image-replacement.is-editing-active .photo-cell-hover-hint {
  display: none !important;
}

/* Rule-of-Thirds Grid Overlay (Professional framing aid) */
.photo-crop-grid-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: none;
  z-index: 8;
}

.date-cell.is-image-replacement.is-editing-active .photo-crop-grid-overlay {
  display: block;
}

.photo-crop-grid-overlay .grid-line {
  position: absolute;
  background: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.6);
}

.photo-crop-grid-overlay .line-h-1 {
  top: 33.333%;
  left: 0;
  right: 0;
  height: 1px;
}

.photo-crop-grid-overlay .line-h-2 {
  top: 66.666%;
  left: 0;
  right: 0;
  height: 1px;
}

.photo-crop-grid-overlay .line-v-1 {
  left: 33.333%;
  top: 0;
  bottom: 0;
  width: 1px;
}

.photo-crop-grid-overlay .line-v-2 {
  left: 66.666%;
  top: 0;
  bottom: 0;
  width: 1px;
}

/* Active editing indicator badge */
.photo-cell-active-indicator {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #38bdf8;
  font-size: 9px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.4);
  pointer-events: none;
  z-index: 12;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Floating Image Editor Popover / Panel */
.photo-editor-popover {
  position: fixed;
  z-index: 3000;
  width: 324px;
  max-width: calc(100vw - 24px);
  background: rgba(18, 22, 30, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(56, 189, 248, 0.2);
  color: #f1f5f9;
  font-family: var(--font-ui);
  animation: photoPopoverFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  user-select: none;
}

@keyframes photoPopoverFadeIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(4px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.photo-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(30, 41, 59, 0.75);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  cursor: move;
}

.photo-editor-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.photo-editor-title-group i {
  color: #38bdf8;
  font-size: 13px;
}

.photo-editor-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #ffffff;
}

.photo-editor-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
}

.photo-editor-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.photo-editor-btn-icon {
  background: none;
  border: none;
  color: #94a3b8;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s ease;
}

.photo-editor-btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.photo-editor-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.photo-editor-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.photo-editor-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: #cbd5e1;
}

.photo-editor-label-row span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.photo-editor-label-row i {
  color: #38bdf8;
  font-size: 11px;
}

.photo-editor-val {
  font-size: 11px;
  font-weight: 700;
  color: #38bdf8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.photo-editor-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.photo-editor-slider-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #e2e8f0;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11px;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.photo-editor-slider-btn:hover {
  background: #334155;
  color: #ffffff;
  border-color: #475569;
}

.photo-editor-slider {
  flex: 1;
  accent-color: #38bdf8;
  cursor: pointer;
  height: 4px;
  background: #334155;
  border-radius: 2px;
}

.photo-editor-btn-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.photo-editor-chip-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #cbd5e1;
  font-size: 10px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.photo-editor-chip-btn:hover {
  background: #334155;
  color: #ffffff;
  border-color: #475569;
}

.photo-editor-chip-btn.active {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.5);
}

/* Translation D-Pad & Sliders */
.photo-editor-pos-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.photo-editor-dpad {
  display: grid;
  grid-template-columns: repeat(3, 26px);
  grid-template-rows: repeat(3, 26px);
  gap: 3px;
  justify-content: center;
}

.photo-editor-dpad-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #cbd5e1;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 10px;
  transition: all 0.15s ease;
}

.photo-editor-dpad-btn:hover {
  background: #38bdf8;
  color: #0f172a;
  border-color: #38bdf8;
}

.photo-editor-dpad-center {
  font-size: 8px;
  font-weight: 700;
}

.photo-editor-tip {
  font-size: 10px;
  color: #94a3b8;
  line-height: 1.35;
  background: rgba(30, 41, 59, 0.4);
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 6px;
}

.photo-editor-tip i {
  color: #38bdf8;
  flex-shrink: 0;
}

.photo-editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(30, 41, 59, 0.5);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  gap: 6px;
}

/* Slot Photo Picker Popover (for placeholder slot) */
.photo-slot-picker-popover {
  position: fixed;
  z-index: 3000;
  width: 320px;
  max-width: calc(100vw - 24px);
  background: rgba(18, 22, 30, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
  color: #f1f5f9;
  padding: 14px;
  animation: photoPopoverFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.photo-slot-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
  margin-top: 8px;
}

.photo-slot-picker-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 4px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.photo-slot-picker-thumb:hover {
  border-color: #38bdf8;
  transform: scale(1.05);
}

/* Image Filter variations */
.photo-filter-warm-sepia {
  filter: sepia(0.55) contrast(1.05) brightness(0.96);
}

.photo-filter-monochrome {
  filter: grayscale(1) contrast(1.1);
}

.photo-filter-soft-fade {
  filter: brightness(1.05) contrast(0.9) opacity(0.85);
}

/* Photo Date Badge Overlay */
.photo-date-overlay-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  color: #ffffff;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  z-index: 5;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.photo-memory-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(255, 255, 255, 0.88);
  color: #1e293b;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  z-index: 5;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Placeholder Art Framing when no uploaded image */
.photo-placeholder-frame {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px;
  box-sizing: border-box;
  background: linear-gradient(135deg, rgba(255,255,255,0.7), rgba(240,240,235,0.6));
  position: relative;
}

.photo-placeholder-frame.theme-vintage-film {
  background: #1e2229;
  color: #f1f5f9;
}

.photo-placeholder-frame.theme-vintage-film .ph-icon {
  color: #f59e0b;
}

.placeholder-dashed-inner {
  width: 90%;
  height: 90%;
  border: 1.5px dashed currentColor;
  opacity: 0.5;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px;
  box-sizing: border-box;
}

.ph-icon {
  font-size: 24px;
  margin-bottom: 6px;
  opacity: 0.75;
}

.ph-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.ph-subtitle {
  font-size: 9px;
  opacity: 0.6;
}

/* ========================================================
   Expanded Multi-Slot Date Cell Styles
   ======================================================== */
.expanded-date-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1c222c;
  border: 1px solid #2d3748;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 11.5px;
}

.expanded-date-item .exp-date-title {
  font-weight: 600;
  color: #a78bfa;
}

.expanded-date-item .exp-date-meta {
  color: #94a3b8;
  font-size: 10.5px;
  margin-left: 6px;
}

.expanded-date-item .exp-delete-btn {
  background: transparent;
  border: none;
  color: #f87171;
  cursor: pointer;
  padding: 2px 5px;
  font-size: 12px;
  border-radius: 3px;
  transition: all 0.15s ease;
}

.expanded-date-item .exp-delete-btn:hover {
  background: #ef4444;
  color: #fff;
}

/* Date cell span variations */
.date-cell.is-expanded-date {
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.date-cell.span-2 {
  grid-column: span 2;
}

.date-cell.span-3 {
  grid-column: span 3;
}

.date-cell.span-4 {
  grid-column: span 2;
  grid-row: span 2;
}

/* Expanded date tag badge */
.expanded-tag-badge {
  background: rgba(167, 139, 250, 0.15);
  border: 1px solid rgba(167, 139, 250, 0.35);
  color: #8b5cf6;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.6px;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  margin-left: auto;
}

/* Divided columns writing layout inside expanded cell */
.cell-body.divided-columns-layout {
  display: flex;
  flex-direction: row;
  gap: 12px;
  height: 100%;
}

.expanded-column-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  border-right: 1px dashed currentColor;
  padding-right: 10px;
  opacity: 0.9;
}

.expanded-column-pane:last-child {
  border-right: none;
  padding-right: 0;
}

.expanded-column-pane .cell-prompt {
  margin-top: auto;
}

/* Borderless Grid: Disables grid lines and cell borders between cells */
.grid-3x3.grid-borderless .date-cell {
  border-color: transparent !important;
  border-width: 0 !important;
  box-shadow: none !important;
  background-color: transparent !important;
}

/* Centered Date Number across expanded slot headers */
.cell-header.is-centered-date-number {
  justify-content: center !important;
  text-align: center;
}

/* Merged Expanded Cells (Removes dividing borders/lines between adjacent expanded slots and closes gap seamlessly) */
.date-cell.is-expanded-date.is-expanded-merged {
  border-radius: 0;
  position: relative;
  z-index: 2;
}

.date-cell.is-expanded-date.is-expanded-merged.expanded-part-first {
  border-top-left-radius: inherit;
  border-bottom-left-radius: inherit;
  border-right-style: none !important;
  border-right-width: 0 !important;
  margin-right: calc(-1 * var(--grid-gap-val, 14px));
  padding-right: calc(10px + var(--grid-gap-val, 14px));
}

.date-cell.is-expanded-date.is-expanded-merged.expanded-part-middle {
  border-radius: 0;
  border-left-style: none !important;
  border-left-width: 0 !important;
  border-right-style: none !important;
  border-right-width: 0 !important;
  margin-right: calc(-1 * var(--grid-gap-val, 14px));
  padding-right: calc(10px + var(--grid-gap-val, 14px));
}

.date-cell.is-expanded-date.is-expanded-merged.expanded-part-last {
  border-top-right-radius: inherit;
  border-bottom-right-radius: inherit;
  border-left-style: none !important;
  border-left-width: 0 !important;
}

/* ========================================================
   Header Project Info & Navigation
   ======================================================== */
.header-brand {
  cursor: pointer;
  user-select: none;
  transition: opacity 0.2s ease;
}

.header-brand:hover {
  opacity: 0.85;
}

.header-project-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 0 1 auto;
  overflow: hidden;
}

.project-title-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 0;
  flex: 0 1 auto;
  max-width: 100%;
  overflow: hidden;
}

.project-title-input {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: #f8fafc;
  font-size: 14px;
  font-weight: 600;
  padding: 4px 22px 4px 8px;
  field-sizing: content;
  width: auto;
  min-width: 60px;
  max-width: clamp(140px, 20vw, 340px);
  flex: 0 1 auto;
  font-family: inherit;
  transition: max-width 0.22s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.project-title-input:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.18);
}

.project-title-input:focus {
  outline: none;
  background: var(--bg-sidebar-elevated);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(79, 128, 225, 0.25);
  max-width: clamp(160px, 25vw, 380px);
}

.title-edit-icon {
  position: absolute;
  right: 6px;
  font-size: 10px;
  color: #64748b;
  pointer-events: none;
  opacity: 0.6;
}

.save-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  color: #4ade80;
  white-space: nowrap;
  padding: 3px 8px;
  border-radius: 12px;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.save-status-indicator.dirty {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.2);
}

.save-status-indicator.saving {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.2);
}

.header-io-group {
  display: inline-flex;
  align-items: center;
  background: var(--bg-sidebar-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  height: 28px;
}

.btn-ghost-sm {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px 9px;
  font-size: 11.5px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
  height: 100%;
}

.btn-ghost-sm:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.header-io-divider {
  width: 1px;
  height: 14px;
  background-color: var(--border-color);
  opacity: 0.6;
}

#btnOrderPdf {
  background: linear-gradient(135deg, #d4a373 0%, #bba27e 100%);
  color: #0f172a !important;
  font-weight: 600;
  border: 1px solid rgba(212, 163, 115, 0.4);
  box-shadow: 0 2px 6px rgba(212, 163, 115, 0.25);
  padding: 5px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

#btnOrderPdf:hover {
  background: linear-gradient(135deg, #e0b487 0%, #c9b392 100%);
  box-shadow: 0 3px 10px rgba(212, 163, 115, 0.35);
  transform: translateY(-1px);
}

#btnOrderPdf.btn-licensed {
  background: linear-gradient(135deg, #16a34a, #15803d) !important;
  color: #fff !important;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.4) !important;
}

#btnOrderPdf.btn-licensed:hover {
  background: linear-gradient(135deg, #22c55e, #16a34a) !important;
}

/* ========================================================
   Main Menu Dashboard Page
   ======================================================== */
.main-menu-view {
  position: fixed;
  inset: 56px 0 0 0;
  background-color: rgba(11, 13, 17, 0.97);
  backdrop-filter: blur(12px);
  z-index: 1200;
  overflow-y: auto;
  padding: 32px 24px 64px;
  animation: fadeInMenu 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInMenu {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.main-menu-container {
  max-width: 1200px;
  margin: 0 auto;
}

.main-menu-hero {
  background: linear-gradient(135deg, #151922 0%, #1e2535 60%, #151c2c 100%);
  border: 1px solid #2d3748;
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  margin-bottom: 36px;
}

.hero-left {
  max-width: 650px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent-gold);
  background: rgba(197, 160, 89, 0.12);
  border: 1px solid rgba(197, 160, 89, 0.3);
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 12px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.hero-title {
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.hero-subtitle {
  font-size: 14.5px;
  color: #94a3b8;
  line-height: 1.6;
}

.hero-right .btn-lg {
  padding: 12px 24px;
  font-size: 14.5px;
  font-weight: 600;
  border-radius: var(--radius-md);
}

.menu-section {
  margin-bottom: 40px;
}

.menu-section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid #1e2430;
}

.menu-section-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 8px;
}

.menu-section-desc {
  font-size: 12.5px;
  color: var(--text-muted);
}

.new-design-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.new-card {
  background: #141822;
  border: 1px solid #232a3b;
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.new-card:hover {
  transform: translateY(-3px);
  border-color: #3b82f6;
  box-shadow: 0 10px 24px rgba(59, 130, 246, 0.15);
  background: #182030;
}

.blank-new-card {
  border: 2px dashed #334155;
  background: rgba(30, 41, 59, 0.3);
  align-items: center;
  text-align: center;
  justify-content: center;
  min-height: 190px;
}

.blank-new-card:hover {
  border-color: var(--primary);
  background: rgba(79, 128, 225, 0.08);
}

.blank-new-card .new-card-icon {
  font-size: 34px;
  color: #38bdf8;
  margin-bottom: 12px;
}

.preset-card-preview {
  height: 90px;
  border-radius: var(--radius-sm);
  border: 2px solid;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  padding: 8px;
  box-shadow: inset 0 0 12px rgba(0,0,0,0.06);
}

.preview-mini-title {
  font-size: 16px;
  line-height: 1.2;
}

.preview-mini-sub {
  font-size: 9px;
  letter-spacing: 1px;
  font-weight: 600;
  margin-top: 4px;
}

.new-card-body h4 {
  font-size: 14.5px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}

.new-card-body p {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.4;
  margin-bottom: 10px;
}

.badge-tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.saved-designs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}

.saved-card {
  background: #141822;
  border: 1px solid #232a3b;
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
  position: relative;
}

.saved-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

.saved-card.active-project {
  border-color: #4ade80;
  background: #131d27;
}

.saved-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.saved-card-title {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  word-break: break-word;
}

.saved-card-active-pill {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #4ade80;
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.saved-card-meta {
  font-size: 12px;
  color: #94a3b8;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.saved-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.saved-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #1e2634;
}

.saved-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 20px;
  background: #12151c;
  border: 1px dashed #242c3d;
  border-radius: var(--radius-md);
}

.saved-empty-icon {
  font-size: 42px;
  color: #475569;
  margin-bottom: 12px;
}

.saved-empty-state h4 {
  font-size: 16px;
  color: #cbd5e1;
  margin-bottom: 6px;
}

.saved-empty-state p {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 16px;
}

/* ========================================================
   Modal Dialogs (Saved Designs Manager & New Design)
   ======================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.hidden {
  display: none !important;
}

.modal-dialog {
  background: #161a23;
  border: 1px solid #2e3748;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalEnter 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-dialog.modal-lg {
  max-width: 840px;
}

@keyframes modalEnter {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 16px 20px;
  background: #1a202c;
  border-bottom: 1px solid #2d3748;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: var(--transition);
}

.modal-close-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.modal-subbar {
  padding: 12px 20px;
  background: #141720;
  border-bottom: 1px solid #232a38;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-search-wrapper {
  position: relative;
  flex: 1;
}

.modal-search-wrapper input {
  background: #1b202c;
  border: 1px solid #2e3748;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 13px;
  padding: 6px 10px 6px 30px;
  width: 100%;
  outline: none;
}

.modal-search-wrapper .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  font-size: 12px;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 20px;
  background: #1a202c;
  border-top: 1px solid #2d3748;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* ========================================================
   Step 3: Watermark Overlay (Anti-Circumvention)
   ======================================================== */
.watermark-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.watermark-text {
  font-family: var(--font-ui);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 6px;
  text-transform: uppercase;
  color: rgba(220, 38, 38, 0.18); /* Subtle diagonal red stamp */
  transform: rotate(-30deg);
  user-select: none;
  white-space: nowrap;
  border: 4px dashed rgba(220, 38, 38, 0.22);
  padding: 14px 40px;
  border-radius: 8px;
}

/* ========================================================
   Step 1: Product Catalog View
   ======================================================== */
.view-screen {
  position: fixed;
  inset: 56px 0 0 0;
  background-color: var(--bg-app);
  overflow-y: auto;
  z-index: 1100;
  padding: 40px 24px 80px;
  animation: fadeInView 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInView {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.catalog-container {
  max-width: 1080px;
  margin: 0 auto;
}

.catalog-header {
  text-align: center;
  margin-bottom: 48px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(197, 160, 89, 0.15);
  border: 1px solid rgba(197, 160, 89, 0.35);
  color: var(--accent-gold);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.catalog-header h2 {
  font-size: 32px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
  margin-bottom: 10px;
}

.catalog-header p {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 620px;
  margin: 0 auto;
}

/* Roadmap Flow Banner inside Catalog Header */
.flow-roadmap-bar {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: 30px;
  padding: 8px 20px;
  margin-top: 20px;
  box-shadow: var(--shadow-sm);
}

.roadmap-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
}

.roadmap-item.active {
  color: #fff;
  font-weight: 600;
}

.roadmap-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-sidebar-elevated);
  border: 1px solid var(--border-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.roadmap-item.active .roadmap-num {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 6px rgba(79, 128, 225, 0.5);
}

.roadmap-arrow {
  font-size: 10px;
  color: #475569;
}

.product-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 28px;
}

.product-card {
  position: relative;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 30px;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.product-card.active-card {
  border-color: rgba(79, 128, 225, 0.4);
  background: linear-gradient(180deg, rgba(35, 39, 48, 0.8) 0%, var(--bg-sidebar) 100%);
  cursor: pointer;
}

.product-card.active-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--primary);
}

.product-card.disabled-card {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(20%);
}

.product-card-badge {
  position: absolute;
  top: 18px;
  right: 18px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.product-card-badge.muted {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-muted);
  border-color: rgba(148, 163, 184, 0.2);
}

.product-card-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: rgba(197, 160, 89, 0.12);
  border: 1px solid rgba(197, 160, 89, 0.25);
  color: var(--accent-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 20px;
}

.product-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-card-body h3 {
  font-size: 20px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 10px;
}

.product-card-body p {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 20px;
  flex: 1;
}

.product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

.product-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: #cbd5e1;
  background: var(--bg-sidebar-elevated);
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

/* Start Flow via Import Design or Saved Books in Catalog */
.catalog-existing-flow-section {
  margin-top: 28px;
  width: 100%;
}

.catalog-existing-flow-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  transition: var(--transition);
}

.catalog-existing-flow-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(187, 162, 126, 0.35);
}

.catalog-existing-flow-card .existing-flow-icon {
  font-size: 22px;
  color: var(--accent-gold);
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(187, 162, 126, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
}

.catalog-existing-flow-card .existing-flow-content {
  flex: 1;
}

.catalog-existing-flow-card .existing-flow-content h4 {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  margin: 0 0 3px;
}

.catalog-existing-flow-card .existing-flow-content p {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}

.catalog-existing-flow-card .existing-flow-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .catalog-existing-flow-card {
    flex-direction: column;
    align-items: flex-start;
  }
  .catalog-existing-flow-card .existing-flow-actions {
    width: 100%;
    flex-direction: column;
  }
  .catalog-existing-flow-card .existing-flow-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ========================================================
   Step 2: Onboarding Questionnaire Wizard
   ======================================================== */
.wizard-view {
  display: flex;
  justify-content: center;
}

.wizard-container {
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  box-shadow: var(--shadow-md);
}

/* Wizard Header Flow Intro */
.wizard-header-intro {
  text-align: center;
  margin-bottom: 24px;
}

.wizard-header-intro h2 {
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  margin: 8px 0 4px;
}

.wizard-header-intro p {
  font-size: 13.5px;
  color: var(--text-muted);
}

.wizard-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-sidebar-input);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 28px;
}

.wizard-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent-gold));
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 4px;
}

.wizard-step-pane {
  display: none;
}

.wizard-step-pane.active {
  display: block;
  animation: fadeInStep 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInStep {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.wizard-step-indicator {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-gold);
  margin-bottom: 8px;
}

.wizard-step-pane h3 {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.wizard-desc {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.wizard-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 30px;
}

.wizard-choice-card {
  position: relative;
  background: var(--bg-sidebar-elevated);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: var(--transition);
}

.wizard-choice-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.wizard-choice-card:hover {
  border-color: rgba(79, 128, 225, 0.5);
  background: #282d37;
}

.wizard-choice-card.active,
.wizard-choice-card:has(input[type="radio"]:checked) {
  border-color: var(--primary);
  background: rgba(79, 128, 225, 0.12);
  box-shadow: 0 0 0 1px var(--primary);
}

.wizard-choice-card i {
  font-size: 24px;
  color: var(--accent-gold);
  margin-bottom: 12px;
}

.wizard-choice-card strong {
  font-size: 16px;
  color: #fff;
  margin-bottom: 4px;
}

.wizard-choice-card span {
  font-size: 12.5px;
  color: var(--text-muted);
}

.wizard-form-fields {
  margin-bottom: 30px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.wizard-preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 30px;
}

.wizard-preset-card {
  position: relative;
  background: var(--bg-sidebar-elevated);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: var(--transition);
}

.wizard-preset-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.wizard-preset-card:hover {
  border-color: rgba(79, 128, 225, 0.5);
}

.wizard-preset-card.active,
.wizard-preset-card:has(input[type="radio"]:checked) {
  border-color: var(--primary);
  background: rgba(79, 128, 225, 0.1);
  box-shadow: 0 0 0 1px var(--primary);
}

.wiz-preview {
  height: 64px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  padding: 0 12px;
  text-align: center;
}

.wizard-preset-card strong {
  font-size: 14.5px;
  color: #fff;
  margin-bottom: 2px;
}

.wizard-preset-card small {
  font-size: 12px;
  color: var(--text-muted);
}

.wizard-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

/* ========================================================
   Step 4: Stripe Checkout Modal Styles
   ======================================================== */
.checkout-summary-box {
  background: var(--bg-sidebar-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
}

.checkout-summary-box h4 {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.checkout-features-list {
  list-style: none;
  margin-bottom: 20px;
}

.checkout-features-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  color: var(--text-main);
  padding: 6px 0;
}

.checkout-features-list li i {
  color: #22c55e;
  font-size: 14px;
}

.checkout-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 18px;
  border-top: 1px dashed var(--border-color);
  font-size: 14px;
  font-weight: 600;
}

.price-tag {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent-gold);
}

.btn-licensed {
  background: linear-gradient(135deg, #16a34a, #15803d) !important;
  color: #fff !important;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.4) !important;
}
.btn-licensed:hover {
  background: linear-gradient(135deg, #22c55e, #16a34a) !important;
}

@media (max-width: 900px) {
  .app-flow-stepper .stepper-label {
    display: none;
  }
  .app-flow-stepper {
    padding: 3px 6px;
  }
  .flow-roadmap-bar {
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* ========================================================
   Authentication & Account Management System
   ======================================================== */
.header-auth-section {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: 4px;
}

.auth-guest-view {
  display: flex;
  align-items: center;
  gap: 6px;
}

.auth-user-view {
  position: relative;
  display: flex;
  align-items: center;
  z-index: 1600;
}

.user-menu-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.user-pill-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  padding: 4px 10px 4px 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
  user-select: none;
}

.user-pill-btn * {
  pointer-events: none;
}

.user-pill-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.user-avatar-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent-gold));
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}

.user-display-name {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-dropdown-menu {
  position: fixed;
  top: 54px;
  right: 18px;
  min-width: 240px;
  background: #1a1e28 !important;
  border: 1px solid #333d52 !important;
  border-radius: var(--radius-md) !important;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.08) !important;
  z-index: 999999 !important;
  overflow: visible;
  padding: 6px 0;
  animation: dropdownEnter 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.user-dropdown-menu.hidden {
  display: none !important;
}

@keyframes dropdownEnter {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.user-dropdown-info {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.user-dropdown-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}

.user-dropdown-meta {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-dropdown-meta strong {
  font-size: 13px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-dropdown-meta span {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-dropdown-divider {
  height: 1px;
  background: #242c3d;
  margin: 6px 0;
}

.dropdown-item {
  width: 100%;
  border: none;
  background: transparent;
  padding: 9px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #cbd5e1;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.dropdown-item-danger {
  color: #f87171;
}

.dropdown-item-danger:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.user-dropdown-footer {
  padding: 8px 14px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #242c3d;
  margin-top: 6px;
}

.user-dropdown-app-name {
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  letter-spacing: 0.3px;
}

.user-dropdown-version {
  font-size: 11px;
  color: var(--accent-gold);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 600;
  letter-spacing: 0.5px;
  background: rgba(187, 162, 126, 0.12);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(187, 162, 126, 0.25);
}

/* Auth Modal */
.auth-modal-dialog {
  max-width: 480px;
}

.auth-modal-body {
  padding: 20px;
}

.auth-context-banner {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}

.auth-context-banner .banner-icon {
  color: #60a5fa;
  font-size: 16px;
  margin-top: 2px;
  flex-shrink: 0;
}

.auth-context-banner strong {
  display: block;
  font-size: 13px;
  color: #93c5fd;
  font-weight: 600;
}

.auth-context-banner p {
  font-size: 12px;
  color: #cbd5e1;
  margin: 2px 0 0;
  line-height: 1.4;
}

/* Guest Warning in Checkout Gate */
.auth-guest-warning-card {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.auth-guest-warning-card.hidden {
  display: none !important;
}

.warning-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #fbbf24;
  margin-bottom: 6px;
}

.auth-guest-warning-card p {
  font-size: 12px;
  color: #e2e8f0;
  line-height: 1.45;
  margin: 0 0 10px;
}

.btn-warning-outline {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #fde68a;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  padding: 7px 12px;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-warning-outline:hover {
  background: rgba(245, 158, 11, 0.22);
  color: #fff;
  border-color: #fbbf24;
}

/* Auth Tabs */
.auth-tab-buttons {
  display: flex;
  gap: 6px;
  background: rgba(0, 0, 0, 0.25);
  padding: 4px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.auth-tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.auth-tab-btn:hover {
  color: #e2e8f0;
}

.auth-tab-btn.active {
  background: #242c3d;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-form.hidden {
  display: none !important;
}

.auth-error-msg {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.4;
}

.auth-error-msg.hidden {
  display: none !important;
}

.auth-error-msg.auth-success-msg {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.35);
  color: #4ade80;
}

.auth-switch-text {
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
  margin-top: 4px;
}

.auth-switch-text a {
  color: var(--accent-gold);
  text-decoration: none;
  font-weight: 600;
}

.auth-switch-text a:hover {
  text-decoration: underline;
}

/* Checkout Badges */
.checkout-account-badge {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  color: #4ade80;
  font-size: 12px;
  text-align: left;
}

.checkout-account-badge strong {
  color: #86efac;
}

.checkout-account-badge small {
  display: block;
  color: #a7f3d0;
  font-size: 11px;
  margin-top: 1px;
}

.checkout-guest-warning-banner {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
  color: #fde68a;
  font-size: 12px;
  text-align: left;
}

.checkout-guest-warning-banner strong {
  display: block;
  color: #fbbf24;
  font-size: 13px;
  margin-bottom: 2px;
}

.checkout-guest-warning-banner small {
  display: block;
  color: #e2e8f0;
  font-size: 11px;
  line-height: 1.35;
}

/* Success Modal Account Notice */
.success-account-notice {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #93c5fd;
  font-size: 12px;
  margin-bottom: 14px;
  text-align: left;
}

.success-guest-warning {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #fde68a;
  font-size: 12px;
  margin-bottom: 14px;
  text-align: left;
}

.success-guest-warning strong {
  display: block;
  color: #fbbf24;
  font-size: 13px;
  margin-bottom: 2px;
}

.success-guest-warning small {
  display: block;
  color: #e2e8f0;
  font-size: 11px;
}

/* Guest Callout in Main Menu */
.saved-guest-gate-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed #334155;
  border-radius: 12px;
  padding: 32px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  grid-column: 1 / -1;
}

.guest-gate-icon {
  font-size: 32px;
  color: var(--accent-gold);
  margin-bottom: 4px;
}

.saved-guest-gate-card h4 {
  font-size: 16px;
  color: #fff;
  margin: 0;
}

.saved-guest-gate-card p {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 460px;
  margin: 0;
  line-height: 1.45;
}

.guest-gate-actions {
  margin-top: 8px;
}

/* ========================================================
   Account Settings Modal & Profile Management
   ======================================================== */
.settings-modal-dialog {
  max-width: 580px;
  width: 100%;
}

.settings-modal-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: calc(85vh - 130px);
  overflow-y: auto;
}

.settings-identity-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid #2e3748;
  border-radius: var(--radius-md);
  padding: 16px 18px;
}

.settings-avatar-big {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent-gold));
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.settings-identity-info h4 {
  font-size: 17px;
  color: #fff;
  margin: 0 0 6px 0;
  font-weight: 600;
}

.settings-meta-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-badge {
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 3px 10px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.badge-cloud-active {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.settings-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--accent-gold);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.settings-form {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid #242c3d;
  border-radius: var(--radius-md);
  padding: 18px;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon i {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.input-with-icon input {
  padding-left: 38px;
}

.settings-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}

.input-readonly {
  background: #11141a !important;
  color: #94a3b8 !important;
  border-color: #242c3d !important;
  cursor: not-allowed;
}

.font-mono {
  font-family: monospace;
  font-size: 11.5px;
}

.settings-save-row {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

.settings-pref-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid #242c3d;
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.settings-pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.pref-desc strong {
  display: block;
  font-size: 13.5px;
  color: #fff;
  margin-bottom: 3px;
}

.pref-desc span {
  display: block;
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

.settings-divider {
  height: 1px;
  background: #242c3d;
}

/* ========================================================
   In-App Confirmation & Prompt Dialog Modal
   ======================================================== */
.hidden {
  display: none !important;
}

#appConfirmInputWrapper.hidden {
  display: none !important;
}

.app-confirm-backdrop {
  z-index: 999999 !important;
}

.app-confirm-dialog {
  max-width: 460px;
  background: #161a23;
  border: 1px solid #2e3748;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.75);
}

.app-confirm-dialog .modal-header {
  border-bottom: 1px solid #242c3d;
  padding: 16px 20px;
}

.app-confirm-dialog .modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-confirm-dialog .modal-header h3 i {
  color: var(--accent-gold);
}

.app-confirm-dialog .modal-header h3.danger-title i {
  color: #ef4444;
}

.app-confirm-body {
  padding: 22px 20px;
}

.app-confirm-message {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: #cbd5e1;
}

.app-confirm-footer {
  padding: 14px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #131722;
  border-top: 1px solid #242c3d;
}

.btn-danger {
  background: #ef4444 !important;
  border-color: #ef4444 !important;
  color: #fff !important;
}

.btn-danger:hover {
  background: #dc2626 !important;
  border-color: #dc2626 !important;
}

/* ========================================================
   Locked Licensed Edition & Duplicate as Draft Styles
   ======================================================== */
.locked-edition-banner {
  margin: 12px 14px 10px 14px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.12), rgba(16, 185, 129, 0.05));
  border: 1px solid rgba(34, 197, 94, 0.35);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  animation: fadeIn 0.25s ease-out;
}

.locked-edition-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.locked-edition-icon {
  font-size: 15px;
  color: #4ade80;
  background: rgba(34, 197, 94, 0.2);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.locked-edition-title strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #86efac;
}

.locked-edition-title span {
  display: block;
  font-size: 11px;
  color: #94a3b8;
}

.locked-edition-desc {
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.45;
  margin-bottom: 12px;
}

.btn-locked-duplicate {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  font-weight: 600;
  font-size: 12.5px;
  background: #10b981;
  color: #0f172a;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-locked-duplicate:hover {
  background: #34d399;
  transform: translateY(-1px);
}

/* Sidebar Locked State - Remove Left Column on Licensed Books */
body.is-licensed .sidebar,
.sidebar.is-locked {
  display: none !important;
}

.badge-licensed-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(34, 197, 94, 0.16);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #4ade80;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.02em;
}

.saved-card-licensed-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.35);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
}

/* ========================================================
   Print Styles (Pixel-perfect booklet printing)
   ======================================================== */
@media print {
  @page {
    margin: 0;
  }

  body, html {
    background: #fff !important;
    color: #000 !important;
    overflow: visible !important;
    height: auto !important;
    width: auto !important;
  }

  .app-header,
  .sidebar,
  .preview-toolbar,
  .toast,
  .main-menu-view,
  .view-screen,
  .catalog-view,
  .wizard-view,
  .modal-backdrop,
  .book-spine-divider,
  .photo-cell-hover-hint,
  .photo-editor-popover,
  .photo-crop-grid-overlay,
  .photo-cell-active-indicator,
  .photo-slot-picker-popover {
    display: none !important;
  }

  /* Force watermarks to print if a user triggers browser print before payment */
  body:not(.is-licensed) .watermark-overlay {
    display: flex !important;
    position: absolute !important;
  }
  body:not(.is-licensed) .watermark-text {
    color: rgba(0, 0, 0, 0.25) !important;
    border-color: rgba(0, 0, 0, 0.25) !important;
  }
  body.is-licensed .watermark-overlay {
    display: none !important;
  }

  .app-container,
  .workspace,
  .preview-area,
  .booklet-viewport,
  .booklet-canvas-wrapper,
  .booklet-container,
  .booklet-container.mode-spread,
  .booklet-container.mode-grid,
  .booklet-container.mode-scroll,
  .booklet-container.mode-printing {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    width: auto !important;
    height: auto !important;
    transform: none !important;
    background: none !important;
    box-shadow: none !important;
  }

  .book-page {
    box-shadow: none !important;
    margin: 0 !important;
    page-break-after: always !important;
    break-after: page !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .book-page:last-child {
    page-break-after: auto !important;
    break-after: auto !important;
  }

  .grid-overview-card {
    display: contents !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
  }

  .grid-card-bar {
    display: none !important;
  }

  .grid-thumb-stage {
    display: contents !important;
    width: auto !important;
    height: auto !important;
  }

  .grid-thumb-stage .book-page {
    position: relative !important;
    transform: none !important;
    pointer-events: auto !important;
  }
}

/* ========================================================
   Legal Pages, Catalog Footer & Checkout Legal Notices
   ======================================================== */
.catalog-footer {
  margin-top: 50px;
  padding: 30px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

.catalog-footer-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
}

.catalog-footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
}

.catalog-footer-links a:hover {
  color: var(--accent-gold);
  text-decoration: underline;
}

.catalog-footer-copy {
  font-size: 12px;
  color: #64748b;
}

.checkout-legal-notice {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-muted);
  margin-top: 14px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.checkout-legal-notice a {
  color: var(--accent-gold);
  text-decoration: underline;
}

.checkout-legal-notice a:hover {
  color: #fff;
}

/* Standalone Legal Document Layout */
html.legal-page-html,
body.legal-page-body {
  background-color: #0f1115 !important;
  color: var(--text-main) !important;
  min-height: 100vh !important;
  height: auto !important;
  width: 100% !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

body.legal-page-body {
  display: flex !important;
  flex-direction: column !important;
}

.legal-container {
  max-width: 860px;
  margin: 30px auto 60px;
  padding: 0 24px;
  width: 100%;
}

.legal-nav-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.legal-nav-pill {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-muted);
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.legal-nav-pill:hover {
  color: #fff;
  border-color: var(--border-hover);
}

.legal-nav-pill.active {
  color: #0f172a;
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  font-weight: 600;
}

.legal-card {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.legal-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 24px;
  margin-bottom: 30px;
}

.legal-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

.legal-header p {
  color: var(--text-muted);
  font-size: 13px;
}

.legal-section {
  margin-bottom: 28px;
}

.legal-section h2 {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.legal-section h2 i {
  color: var(--accent-gold);
  font-size: 16px;
}

.legal-section p, .legal-section li {
  font-size: 14px;
  line-height: 1.7;
  color: #cbd5e1;
  margin-bottom: 10px;
}

.legal-section ul {
  padding-left: 22px;
  margin-bottom: 14px;
}

.legal-callout-box {
  background: rgba(212, 163, 115, 0.08);
  border-left: 4px solid var(--accent-gold);
  padding: 16px 20px;
  border-radius: 4px 8px 8px 4px;
  margin: 18px 0;
}

.legal-callout-box p {
  margin-bottom: 0;
  color: #f1f5f9;
  font-size: 13.5px;
}

.legal-footer-contact {
  background: var(--bg-sidebar-elevated);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  margin-top: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.legal-footer-contact h4 {
  font-size: 15px;
  color: #fff;
  margin-bottom: 4px;
}

.legal-footer-contact p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 0;
}

/* Cloud Asset Library Styles */
.asset-modal-dialog {
  max-width: 820px;
}

.asset-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  margin-bottom: 12px;
  padding: 8px 10px;
  background-color: var(--bg-sidebar-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.asset-actions-bar #btnOpenAssetLibrary {
  background-color: var(--bg-sidebar-input);
  border-color: var(--border-color);
  color: var(--text-main);
  gap: 6px;
}

.asset-actions-bar #btnOpenAssetLibrary:hover {
  background-color: #2b303b;
  border-color: #404856;
  color: #ffffff;
}

#assetLibraryBadgeCount {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 16px;
  padding: 0 5px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
  line-height: 1;
}

.asset-storage-badge {
  font-size: 10px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.asset-storage-badge.cloud {
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.25);
  background: rgba(56, 189, 248, 0.08);
}

.asset-storage-badge.guest {
  color: #94a3b8;
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.asset-card {
  position: relative;
  background: #111827;
  border: 1px solid #334155;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
}

.asset-card:hover {
  border-color: var(--accent-gold);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

.asset-card.in-book {
  border-color: rgba(34, 197, 94, 0.45);
}

.asset-card-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: #0b0f19;
  overflow: hidden;
}

.asset-card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s ease;
}

.asset-card:hover .asset-card-thumb {
  transform: scale(1.04);
}

.asset-in-book-tag {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(22, 101, 52, 0.92);
  color: #86efac;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.asset-card-details {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.asset-card-name {
  font-size: 11.5px;
  font-weight: 500;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.asset-card-date {
  font-size: 10px;
  color: #64748b;
}

.asset-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.btn-use-asset {
  flex: 1;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 4px;
  background: #1e293b;
  color: #38bdf8;
  border: 1px solid #334155;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.btn-use-asset:hover {
  background: #38bdf8;
  color: #0f172a;
  border-color: #38bdf8;
}

.btn-use-asset.is-in-book {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.3);
}

.btn-use-asset.is-in-book:hover {
  background: rgba(34, 197, 94, 0.25);
}

.btn-delete-asset {
  padding: 4px 8px;
  font-size: 11px;
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-delete-asset:hover {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
}

/* Checkout Locked Alert & Workspace Banner */
.checkout-locked-alert {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 14px;
  margin-bottom: 10px;
  color: #fecaca;
  font-size: 12.5px;
  text-align: left;
}

.checkout-locked-alert .alert-icon {
  font-size: 18px;
  color: #f87171;
  flex-shrink: 0;
  margin-top: 1px;
}

.checkout-locked-alert .alert-content strong {
  display: block;
  color: #fca5a5;
  font-size: 13px;
  margin-bottom: 3px;
}

.checkout-locked-alert .alert-content p {
  margin: 0;
  color: #e2e8f0;
  font-size: 11.5px;
  line-height: 1.45;
}

.checkout-locked-alert .alert-content p strong {
  display: inline;
  color: #fecaca;
}


.checkout-lock-ack-group {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.checkout-lock-ack-group.has-error {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.6);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

.checkout-lock-ack-group.has-error .custom-checkbox {
  border-color: #ef4444 !important;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}

.checkout-lock-ack-group.has-error label {
  color: #fca5a5 !important;
}

@keyframes shakeLockCheck {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.checkout-lock-ack-group.shake-error {
  animation: shakeLockCheck 0.35s ease-in-out;
}

.workspace-locked-notice {
  background: linear-gradient(90deg, rgba(197, 160, 89, 0.08), rgba(212, 163, 115, 0.16), rgba(197, 160, 89, 0.08));
  border-bottom: 1px solid rgba(197, 160, 89, 0.35);
  padding: 8px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  z-index: 10;
}

.workspace-locked-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.workspace-locked-icon {
  color: var(--accent-gold);
  font-size: 13.5px;
}

.workspace-locked-content strong {
  display: inline-block;
  color: #f1dfbe;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.25px;
}

/* Responsive Header Polish */
@media (max-width: 1200px) {
  .app-flow-stepper .stepper-label {
    display: none;
  }
  .app-flow-stepper {
    padding: 3px 6px;
    gap: 3px;
  }
  .project-title-input {
    max-width: clamp(120px, 18vw, 240px);
  }
  .project-title-input:focus {
    max-width: clamp(140px, 22vw, 270px);
  }
}

@media (max-width: 992px) {
  .header-center-zone {
    display: none;
  }
  .header-io-group span {
    display: none;
  }
  .header-io-group .btn-ghost-sm {
    padding: 4px 7px;
  }
}

@media (max-width: 768px) {
  .header-brand .version-tag {
    display: none;
  }
  #btnOpenSavedModal span {
    display: none;
  }
  #btnOpenSavedModal {
    padding: 5px 8px;
  }
  .user-display-name {
    display: none;
  }
}


/* ========================================================
   Interactive Preview Inspector (Click-to-Highlight & Edit)
   ======================================================== */
.preview-selectable-active {
  position: relative;
  outline: 2px solid #eab308 !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 4px rgba(234, 179, 8, 0.25), 0 0 16px rgba(234, 179, 8, 0.35) !important;
  border-radius: 4px;
  transition: outline 0.15s ease, box-shadow 0.15s ease;
  z-index: 25;
}

.preview-element-badge {
  position: absolute;
  top: -26px;
  left: 0;
  background: #0f172a;
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.4);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  pointer-events: none;
  z-index: 99;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  animation: badgePopIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes badgePopIn {
  from { opacity: 0; transform: translateY(4px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.sidebar-context-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1px solid rgba(234, 179, 8, 0.35);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  animation: slideDownFade 0.2s ease-out;
}

@keyframes slideDownFade {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.context-banner-text {
  font-size: 11.5px;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.context-banner-text strong {
  color: #fbbf24;
}

.btn-clear-context {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94a3b8;
  font-size: 10.5px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.btn-clear-context:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}

/* Control spotlight highlight */
.control-spotlight {
  position: relative;
  background-color: rgba(234, 179, 8, 0.09) !important;
  border-radius: 6px;
  padding: 6px 10px;
  box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.65), 0 0 16px rgba(234, 179, 8, 0.3) !important;
  transition: all 0.25s ease;
}

/* Non-destructive dimming: related controls stay visible at soft opacity rather than disappearing! */
.sidebar.is-inspecting .accordion-item.search-has-match .form-group:not(.control-spotlight),
.sidebar.is-inspecting .accordion-item.search-has-match .form-row:not(.control-spotlight),
.sidebar.is-inspecting .accordion-item.search-has-match .form-check-group:not(.control-spotlight),
.sidebar.is-inspecting .accordion-item.search-has-match .color-tree-node:not(.control-spotlight) {
  opacity: 0.55;
  transition: opacity 0.2s ease;
}

.sidebar.is-inspecting .accordion-item.search-has-match .form-group:not(.control-spotlight):hover,
.sidebar.is-inspecting .accordion-item.search-has-match .form-row:not(.control-spotlight):hover,
.sidebar.is-inspecting .accordion-item.search-has-match .form-check-group:not(.control-spotlight):hover,
.sidebar.is-inspecting .accordion-item.search-has-match .form-group:not(.control-spotlight):focus-within,
.sidebar.is-inspecting .accordion-item.search-has-match .form-row:not(.control-spotlight):focus-within {
  opacity: 1;
}

/* Hover cues for interactive canvas items */
.cover-title,
.cover-names,
.cover-subtitle,
.cover-date,
.cover-crest,
.back-cover-title,
.back-cover-text,
.back-cover-signoff,
.page-month-title,
.page-subtitle,
.page-num,
.date-number,
.day-of-week,
.writing-lines,
.ruled-lines,
.cell-prompt,
.date-cell,
.inner-border-frame {
  cursor: pointer;
}

.cover-title:hover,
.cover-names:hover,
.cover-subtitle:hover,
.cover-date:hover,
.cover-crest:hover,
.back-cover-title:hover,
.back-cover-text:hover,
.back-cover-signoff:hover,
.page-month-title:hover,
.page-subtitle:hover,
.page-num:hover,
.date-number:hover,
.day-of-week:hover,
.cell-prompt:hover {
  outline: 1.5px dashed rgba(234, 179, 8, 0.5);
  outline-offset: 2px;
  border-radius: 2px;
}


/* ========================================================
   Refined Initial Creation Flow: Catalog & Flagship Card
   ======================================================== */
.flagship-product-card {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 36px;
  background: linear-gradient(135deg, rgba(26, 32, 44, 0.95) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1.5px solid rgba(212, 175, 55, 0.35);
  border-radius: var(--radius-lg);
  padding: 38px 42px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5), 0 0 24px rgba(212, 175, 55, 0.1);
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
  transition: all 0.25s ease;
}

.flagship-product-card:hover {
  border-color: rgba(212, 175, 55, 0.6);
  box-shadow: 0 20px 42px rgba(0, 0, 0, 0.6), 0 0 32px rgba(212, 175, 55, 0.18);
  transform: translateY(-2px);
}

.flagship-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: rgba(212, 175, 55, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(212, 175, 55, 0.4);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 14px;
}

.flagship-content h3 {
  font-size: 28px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 10px;
  letter-spacing: -0.3px;
}

.flagship-content p {
  font-size: 14.5px;
  color: #94a3b8;
  line-height: 1.6;
  margin-bottom: 22px;
  max-width: 620px;
}

.flagship-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 20px;
  margin-bottom: 28px;
}

.flagship-highlights span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 500;
  color: #e2e8f0;
}

.flagship-highlights span i {
  color: #fbbf24;
  font-size: 11px;
}

.flagship-preview-visual {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flagship-book-mockup {
  position: relative;
  width: 250px;
  height: 190px;
  background: #fbf9f5;
  border-radius: 4px 8px 8px 4px;
  box-shadow: -8px 0 16px rgba(0,0,0,0.4), 16px 16px 32px rgba(0,0,0,0.6);
  border: 1px solid #bba27e;
  display: flex;
  transform: perspective(600px) rotateY(-8deg) rotateX(4deg);
  transition: transform 0.3s ease;
}

.flagship-product-card:hover .flagship-book-mockup {
  transform: perspective(600px) rotateY(-4deg) rotateX(2deg) scale(1.03);
}

.mockup-spine {
  width: 14px;
  height: 100%;
  background: linear-gradient(90deg, #1f2937 0%, #374151 50%, #1f2937 100%);
  border-radius: 4px 0 0 4px;
}

.mockup-cover {
  flex: 1;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mockup-frame {
  width: 100%;
  height: 100%;
  border: 1.5px solid #bba27e;
  border-radius: 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
}

.mockup-crest {
  font-size: 18px;
  color: #84663a;
  margin-bottom: 6px;
}

.mockup-title {
  font-family: 'Great Vibes', cursive;
  font-size: 24px;
  color: #2a2421;
  line-height: 1.1;
  margin-bottom: 4px;
}

.mockup-names {
  font-family: 'Cormorant Garamond', serif;
  font-size: 12px;
  color: #4b5563;
  margin-bottom: 2px;
}

.mockup-date {
  font-family: 'Cormorant Garamond', serif;
  font-size: 10px;
  color: #84663a;
  letter-spacing: 0.5px;
}

/* Quick-Start Section */
.catalog-quickstart-section {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 32px;
}

.quickstart-header {
  margin-bottom: 16px;
}

.quickstart-header h4 {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.quickstart-header h4 i {
  color: var(--accent-gold);
}

.quickstart-header span {
  font-size: 12.5px;
  color: var(--text-muted);
}

.quickstart-chips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.quickstart-theme-chip {
  background: var(--bg-sidebar-elevated);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
  transition: all 0.18s ease;
  font-family: inherit;
}

.quickstart-theme-chip:hover {
  background: rgba(56, 189, 248, 0.08);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.theme-swatch {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  margin-bottom: 6px;
  display: inline-block;
}

.quickstart-theme-chip strong {
  font-size: 13.5px;
  color: #f1f5f9;
}

.quickstart-theme-chip small {
  font-size: 11px;
  color: var(--text-muted);
}

.catalog-roadmap-section {
  margin-bottom: 36px;
}

.roadmap-header {
  margin-bottom: 16px;
}

.roadmap-header h4 {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.roadmap-header span {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ========================================================
   Step 2: Interactive Split-Screen Creation Studio Wizard
   ======================================================== */
.wizard-view {
  display: flex;
  justify-content: center;
  padding: 30px 20px;
}

.wizard-studio-layout {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) 460px;
  gap: 32px;
  max-width: 1160px;
  width: 100%;
  margin: 0 auto;
  align-items: start;
}

.wizard-studio-sidebar {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.wizard-header-intro {
  margin-bottom: 20px;
}

.wizard-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.wizard-btn-text {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.wizard-btn-text:hover {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.05);
}

.wizard-header-intro h2 {
  font-size: 24px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 4px;
}

.wizard-header-intro p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Interactive Stepper Navigation Pills */
.wizard-step-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  background: var(--bg-sidebar-elevated);
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.wizard-step-tab {
  background: transparent;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.18s ease;
}

.wizard-step-tab .tab-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
}

.wizard-step-tab .tab-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.18s ease;
}

.wizard-step-tab:hover .tab-label {
  color: #e2e8f0;
}

.wizard-step-tab.active {
  background: rgba(79, 128, 225, 0.15);
}

.wizard-step-tab.active .tab-num {
  background: var(--primary);
  color: #ffffff;
}

.wizard-step-tab.active .tab-label {
  color: #ffffff;
}

.wizard-step-tab.completed .tab-num {
  background: #22c55e;
  color: #ffffff;
}

.tab-connector {
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 0 4px;
}

.wizard-progress-bar {
  width: 100%;
  height: 4px;
  background: var(--bg-sidebar-input);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 24px;
}

.wizard-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent-gold));
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 2px;
}

.wizard-step-pane {
  display: none;
}

.wizard-step-pane.active {
  display: block;
  animation: fadeInStep 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.wizard-step-indicator {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent-gold);
  margin-bottom: 6px;
}

.wizard-step-pane h3 {
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 4px;
}

.wizard-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* Occasion & Size Cards Grid */
.wizard-options-grid.occasion-grid,
.wizard-options-grid.size-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.wizard-choice-card {
  position: relative;
  background: var(--bg-sidebar-elevated);
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.wizard-choice-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.wizard-choice-card:hover {
  border-color: rgba(79, 128, 225, 0.5);
  background: rgba(79, 128, 225, 0.05);
}

.wizard-choice-card.active,
.wizard-choice-card:has(input[type="radio"]:checked) {
  border-color: var(--primary);
  background: rgba(79, 128, 225, 0.12);
  box-shadow: 0 0 0 1px var(--primary);
}

.choice-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(212, 175, 55, 0.12);
  color: var(--accent-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.choice-text {
  display: flex;
  flex-direction: column;
}

.choice-text strong {
  font-size: 14px;
  color: #ffffff;
  margin-bottom: 2px;
}

.choice-text span {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.35;
}

.choice-tag {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
}

.wizard-form-fields {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.wizard-form-fields .form-group label {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
}

.wizard-form-fields .form-group label i {
  font-size: 13px;
  color: var(--text-muted);
  width: 14px;
  text-align: center;
  flex-shrink: 0;
}


/* ========================================================
   Redesigned Aesthetic Theme Carousel (Step 3 of 4)
   ======================================================== */
.theme-carousel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 12px;
}

.theme-carousel-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.theme-counter-badge {
  font-size: 11.5px;
  font-weight: 600;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.06);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.theme-counter-badge i {
  color: #f59e0b;
}

.theme-active-name-pill {
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  background: rgba(79, 128, 225, 0.16);
  border: 1px solid rgba(79, 128, 225, 0.35);
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 0.2px;
}

.theme-carousel-nav {
  display: flex;
  gap: 8px;
}

.theme-nav-arrow {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #19202a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
  font-size: 13px;
  padding: 0;
}

.theme-nav-arrow:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(79, 128, 225, 0.35);
}

.theme-nav-arrow:active {
  transform: scale(0.96);
}

.wizard-theme-carousel-container {
  position: relative;
  width: 100%;
  margin-bottom: 12px;
  border-radius: 12px;
}

.wizard-theme-carousel-track {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: 8px 44px 16px 44px;
  margin: 0 -12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.wizard-theme-carousel-track::-webkit-scrollbar {
  height: 5px;
}

.wizard-theme-carousel-track::-webkit-scrollbar-track {
  background: transparent;
}

.wizard-theme-carousel-track::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 4px;
}

.wizard-theme-carousel-track::-webkit-scrollbar-thumb:hover {
  background: rgba(79, 128, 225, 0.6);
}

/* Theme Cards in Peek Carousel */
.wizard-theme-carousel-track .wizard-preset-card {
  flex: 0 0 calc(100% - 68px);
  max-width: 370px;
  min-width: 285px;
  scroll-snap-align: center;
  position: relative;
  background: #141820;
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.24s ease, border-color 0.2s ease, box-shadow 0.24s ease, background-color 0.2s ease;
  opacity: 0.58;
  transform: scale(0.92);
  filter: brightness(0.85);
  user-select: none;
}

.wizard-theme-carousel-track .wizard-preset-card:hover {
  opacity: 0.88;
  transform: scale(0.95);
  filter: brightness(0.96);
  border-color: rgba(79, 128, 225, 0.4);
}

.wizard-theme-carousel-track .wizard-preset-card.active,
.wizard-theme-carousel-track .wizard-preset-card:has(input[type="radio"]:checked) {
  opacity: 1;
  transform: scale(1);
  filter: none;
  border-color: var(--primary);
  background: linear-gradient(180deg, #18202d 0%, #12161f 100%);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 0 0 1.5px var(--primary);
}

.wizard-theme-carousel-track .wizard-preset-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.theme-card-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.theme-category-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.06);
  padding: 2.5px 8px;
  border-radius: 4px;
}


.wizard-preset-card .wiz-theme-swatch-box {
  height: 68px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  text-align: center;
  position: relative;
  overflow: hidden;
  margin-bottom: 2px;
  transition: transform 0.2s ease;
}

.theme-swatch-ornament {
  font-size: 11px;
  margin-bottom: 2px;
  line-height: 1;
}

.wiz-theme-names {
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.theme-swatch-date {
  font-size: 9.5px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-top: 2px;
}

.wizard-preset-card .wiz-preset-info strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 2px;
}

.theme-mood-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0;
}

.theme-card-details {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.theme-detail-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.theme-detail-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #64748b;
}

.theme-palette-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.palette-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  display: inline-block;
}

.theme-font-pair {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.font-tag {
  font-size: 10.5px;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 7px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.theme-badges-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.theme-spec-badge {
  font-size: 10px;
  color: #94a3b8;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}


/* Pagination Dots */
.theme-carousel-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin: 2px 0 16px 0;
}

.carousel-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: all 0.22s ease;
}

.carousel-dot:hover {
  background: rgba(255, 255, 255, 0.45);
  transform: scale(1.2);
}

.carousel-dot.active {
  width: 22px;
  height: 7px;
  border-radius: 4px;
  background: var(--primary);
  box-shadow: 0 0 8px rgba(79, 128, 225, 0.5);
}


.wizard-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

/* ========================================================
   Right Column: Live Real-Time Hardcover Book Preview Stage
   ======================================================== */
.wizard-studio-preview-pane {
  background: #111418;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: sticky;
  top: 24px;
}

.wizard-preview-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.preview-live-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #fbbf24;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.35);
  padding: 3px 8px;
  border-radius: 12px;
}

.preview-size-tag {
  font-size: 11.5px;
  color: #94a3b8;
  font-family: monospace;
}

.wizard-book-stage {
  width: 100%;
  min-height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 900px;
  padding: 10px 0;
}

.wizard-book-hardcover {
  width: 380px;
  aspect-ratio: 10 / 8;
  background: #fbf9f5;
  border-radius: 4px 8px 8px 4px;
  box-shadow: -10px 0 20px rgba(0,0,0,0.5), 18px 20px 36px rgba(0,0,0,0.55);
  border: 1.5px solid #bba27e;
  position: relative;
  display: flex;
  padding: 20px 24px 20px 34px;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  transform: rotateY(-3deg);
}

.book-spine-crease {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 20px;
  background: linear-gradient(90deg, rgba(0,0,0,0.2) 0%, rgba(255,255,255,0.06) 40%, rgba(0,0,0,0.18) 100%);
  border-radius: 3px 0 0 3px;
  box-shadow: inset -1px 0 2px rgba(0,0,0,0.2);
}

.book-inner-frame {
  flex: 1;
  border: 1.5px double #bba27e;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 14px;
  transition: border-color 0.25s ease;
}

.book-crest-icon {
  font-size: 26px;
  color: #84663a;
  margin-bottom: 8px;
  transition: all 0.25s ease;
}

.book-title {
  font-family: 'Great Vibes', cursive;
  font-size: 38px;
  color: #2a2421;
  line-height: 1.1;
  margin-bottom: 6px;
  transition: all 0.25s ease;
}

.book-names {
  font-family: 'Cormorant Garamond', serif;
  font-size: 16px;
  font-weight: 500;
  color: #2a2421;
  margin-bottom: 6px;
  transition: all 0.25s ease;
}

.book-subtitle {
  font-family: 'Cormorant Garamond', serif;
  font-size: 12px;
  color: #64748b;
  margin-bottom: 4px;
  transition: all 0.25s ease;
}

.book-date {
  font-family: 'Cormorant Garamond', serif;
  font-size: 12px;
  color: #84663a;
  letter-spacing: 0.6px;
  transition: all 0.25s ease;
}

.book-ornament {
  font-size: 10px;
  color: #84663a;
  margin-top: 8px;
  transition: all 0.25s ease;
}

.wizard-preview-footer {
  width: 100%;
  text-align: center;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.wizard-preview-footer span {
  font-size: 11.5px;
  color: #64748b;
}

.wizard-preview-footer span i {
  color: #22c55e;
}

/* ========================================================
   Comprehensive Responsive & Reactive Design System
   Guarantees fluid responsiveness across all screens (320px - 4K)
   ======================================================== */

/* Global Fluid Bounds & Overflow Protection */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

.view-screen {
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

.catalog-view,
.wizard-view,
.main-menu-view {
  width: 100%;
  box-sizing: border-box;
}

/* Mobile Workspace Navigation (Hidden on desktop) */
.workspace-mobile-nav {
  display: none;
}

/* ========================================================
   Breakpoints: 1080px (Tablet Landscape & Laptops)
   ======================================================== */
@media (max-width: 1080px) {
  .catalog-container {
    padding: 30px 18px;
  }
  .flagship-product-card {
    grid-template-columns: 1fr 280px;
    padding: 30px 32px;
    gap: 24px;
  }
  .flagship-content h3 {
    font-size: 24px;
  }
  .wizard-studio-layout {
    grid-template-columns: 1fr;
    gap: 24px;
    max-width: 760px;
  }
  .wizard-studio-preview-pane {
    position: static;
  }
  .wizard-book-hardcover {
    width: 340px;
    margin: 0 auto;
  }
  .sidebar {
    width: 330px;
    min-width: 300px;
  }
}

/* ========================================================
   Breakpoints: 860px (Tablets & Mobile View Switcher)
   ======================================================== */
@media (max-width: 860px) {
  /* Workspace becomes tab-switched on mobile */
  .workspace {
    flex-direction: column;
    height: calc(100vh - 56px);
  }

  .workspace-mobile-nav {
    display: flex;
    background: #11141b;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 6px 12px;
    gap: 8px;
    width: 100%;
    flex-shrink: 0;
    z-index: 50;
  }

  .mobile-nav-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-sidebar-elevated);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.18s ease;
    font-family: inherit;
  }

  .mobile-nav-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
  }

  .mobile-nav-btn.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(79, 128, 225, 0.35);
  }

  /* Default on mobile: controls tab active */
  .workspace:not([data-mobile-tab="preview"]) .sidebar {
    display: flex !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex: 1;
    border-right: none;
  }

  .workspace:not([data-mobile-tab="preview"]) .preview-area {
    display: none !important;
  }

  /* When preview tab is active */
  .workspace[data-mobile-tab="preview"] .sidebar {
    display: none !important;
  }

  .workspace[data-mobile-tab="preview"] .preview-area {
    display: flex !important;
    width: 100% !important;
    flex: 1;
  }

  /* If licensed, always show preview */
  body.is-licensed .workspace .sidebar {
    display: none !important;
  }
  body.is-licensed .workspace .preview-area {
    display: flex !important;
    width: 100% !important;
  }
  body.is-licensed .workspace-mobile-nav {
    display: none !important;
  }

  /* Preview Toolbar compact adjustments */
  .preview-toolbar {
    height: 44px;
    padding: 0 10px;
    gap: 6px;
  }
  .toolbar-btn span {
    display: none;
  }
  .toolbar-btn {
    padding: 6px 9px;
  }
  .zoom-slider {
    display: none;
  }
  .booklet-viewport {
    padding: 20px 10px;
  }

  /* Flagship Card Tablet */
  .flagship-product-card {
    grid-template-columns: 1fr;
    padding: 24px 20px;
    gap: 20px;
  }
  .flagship-preview-visual {
    order: -1;
    margin: 0 auto 6px;
  }
  .flagship-book-mockup {
    width: 220px;
    height: 165px;
    transform: perspective(600px) rotateY(-5deg) rotateX(2deg);
  }
  .quickstart-chips-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
  .catalog-footer {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
  .catalog-footer-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 12px;
  }

  /* Main Menu Hero Tablet */
  .main-menu-hero {
    flex-direction: column;
    align-items: flex-start;
    padding: 24px 20px;
    gap: 18px;
  }
  .hero-right {
    width: 100%;
  }
  .hero-right .btn-lg {
    width: 100%;
    justify-content: center;
  }
  .new-design-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
  }
}

/* ========================================================
   Breakpoints: 640px (Mobile Phones & Small Tablets)
   ======================================================== */
@media (max-width: 640px) {
  /* Header Mobile Compact */
  .app-header {
    padding: 0 10px;
    gap: 6px;
  }
  .header-brand .brand-text h1 {
    font-size: 16.5px;
  }
  .header-brand .brand-icon {
    font-size: 16px;
  }
  .header-project-info .header-brand-divider {
    display: none;
  }
  .save-status-indicator span {
    display: none;
  }
  .save-status-indicator {
    padding: 2px 4px;
  }
  .project-title-input {
    width: auto;
    min-width: 50px;
    max-width: clamp(90px, 22vw, 160px);
    font-size: 13px;
    padding: 3px 20px 3px 6px;
  }
  .project-title-input:focus {
    max-width: clamp(110px, 28vw, 190px);
  }
  #btnHeaderSavedDesigns span,
  #btnHeaderCatalogResume span,
  #btnHeaderExitWizard span,
  #btnHeaderSignIn span {
    display: none;
  }
  #btnHeaderSavedDesigns,
  #btnHeaderCatalogResume,
  #btnHeaderExitWizard,
  #btnHeaderSignIn {
    padding: 5px 8px;
  }
  #btnOrderPdf {
    padding: 5px 9px;
    font-size: 12px;
  }

  /* Catalog View Mobile */
  .catalog-container {
    padding: 20px 12px;
  }
  .catalog-hero h2 {
    font-size: 24px;
  }
  .catalog-hero p {
    font-size: 13.5px;
  }
  .flagship-product-card {
    padding: 20px 16px;
  }
  .flagship-content h3 {
    font-size: 21px;
  }
  .flagship-content p {
    font-size: 13.5px;
    margin-bottom: 18px;
  }
  .flagship-highlights {
    gap: 8px 14px;
    margin-bottom: 22px;
  }
  .flagship-highlights span {
    font-size: 12px;
  }
  .flagship-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .quickstart-chips-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .catalog-roadmap-section .product-cards-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Wizard Studio Mobile */
  .wizard-view {
    padding: 14px 10px;
  }
  .wizard-studio-sidebar {
    padding: 22px 16px;
    border-radius: 12px;
  }
  .wizard-header-intro h2 {
    font-size: 20px;
  }
  .wizard-header-intro p {
    font-size: 12.5px;
  }
  .wizard-options-grid.occasion-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .wizard-preset-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .wizard-options-grid.size-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .wizard-actions {
    padding-top: 18px;
    flex-direction: column-reverse;
    gap: 10px;
  }
  .wizard-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .wizard-studio-preview-pane {
    padding: 16px 12px;
  }
  .wizard-book-hardcover {
    width: 100%;
    max-width: 290px;
  }
  .wizard-book-hardcover .book-title {
    font-size: 24px !important;
  }
  .wizard-book-hardcover .book-names {
    font-size: 14px !important;
  }

  /* Modals Mobile */
  .modal-backdrop {
    padding: 8px;
  }
  .modal-dialog {
    max-height: 94vh;
    border-radius: 12px;
  }
  .modal-header {
    padding: 12px 14px;
  }
  .modal-header h3 {
    font-size: 14px;
  }
  .modal-body {
    padding: 14px 12px;
  }
  .modal-footer {
    padding: 10px 12px;
    flex-direction: column-reverse;
    gap: 8px;
  }
  .modal-footer .btn {
    width: 100%;
    justify-content: center;
  }
  .checkout-summary-box {
    padding: 14px 12px;
  }
  .checkout-summary-box h4 {
    font-size: 15px;
    margin-bottom: 12px;
  }
  .checkout-features-list li {
    font-size: 12.5px;
    gap: 8px;
  }
  .price-tag {
    font-size: 20px;
  }
  .auth-modal-dialog {
    max-width: 100%;
  }
  .auth-tabs {
    gap: 4px;
  }
  .auth-tab-btn {
    padding: 7px 10px;
    font-size: 12px;
  }

  /* In-Preview Popovers Safe Mobile Positioning */
  .photo-editor-popover,
  .photo-slot-picker-popover {
    max-width: calc(100vw - 20px) !important;
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
  }
}

/* ========================================================
   Breakpoints: 480px (Compact Mobile Phones)
   ======================================================== */
@media (max-width: 480px) {
  .project-title-input {
    min-width: 36px;
    max-width: clamp(70px, 24vw, 115px);
    font-size: 12px;
    padding: 2px 18px 2px 5px;
  }
  .project-title-input:focus {
    max-width: clamp(80px, 30vw, 130px);
  }
  #btnOrderPdf span {
    display: none;
  }
  #btnOrderPdf::after {
    content: " $14.99";
    font-weight: 700;
  }
  body.is-licensed #btnOrderPdf::after {
    content: " PDF";
  }

  /* Stepper tabs: keep numbers and only show active step label */
  .wizard-step-tab {
    padding: 5px 7px;
  }
  .wizard-step-tab .tab-label {
    display: none;
  }
  .wizard-step-tab.active .tab-label {
    display: inline;
    font-size: 11px;
  }
  .wizard-choice-card .choice-text span {
    display: none;
  }
  .wizard-preset-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .quickstart-chips-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .page-indicator {
    display: none;
  }
  .spread-counter {
    font-size: 11px;
    padding: 2px 4px;
  }
  .history-controls {
    margin-left: 2px;
    padding-left: 2px;
  }
  .wizard-book-hardcover {
    max-width: 260px;
  }
  .hero-title {
    font-size: 22px;
  }
}

/* ========================================================
   Breakpoints: 360px (Ultra-Compact Phones e.g. iPhone SE)
   ======================================================== */
@media (max-width: 360px) {
  .header-brand .brand-text {
    display: none;
  }
  .project-title-input {
    min-width: 30px;
    max-width: 90px;
    font-size: 11px;
    padding: 2px 14px 2px 4px;
  }
  .project-title-input:focus {
    max-width: 105px;
  }
  .wizard-options-grid.occasion-grid {
    grid-template-columns: 1fr;
  }
  .wizard-book-hardcover {
    max-width: 230px;
  }
  .wizard-book-hardcover .book-title {
    font-size: 20px !important;
  }
  .wizard-book-hardcover .book-names {
    font-size: 12px !important;
  }
}

/* ========================================================
   SEO On-Page Semantic Sections (Features, Specs, FAQ)
   ======================================================== */
.catalog-seo-section {
  margin-top: 40px;
  margin-bottom: 24px;
}

.catalog-seo-section .section-header {
  margin-bottom: 20px;
}

.catalog-seo-section .section-header h4 {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.catalog-seo-section .section-header h4 i {
  color: var(--accent-gold);
}

.catalog-seo-section .section-header p {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
}

/* Feature & Spec Grids */
.seo-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.seo-feature-card {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 22px;
  transition: all 0.2s ease;
}

.seo-feature-card:hover {
  border-color: rgba(212, 163, 115, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.seo-card-icon {
  font-size: 22px;
  color: var(--accent-gold);
  margin-bottom: 12px;
}

.seo-feature-card h5 {
  font-size: 15px;
  font-weight: 600;
  color: #f8fafc;
  margin-bottom: 6px;
}

.seo-feature-card p {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-muted);
  margin: 0;
}

/* Compatibility Badges */
.seo-print-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.seo-print-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  color: #e2e8f0;
  font-weight: 500;
}

.seo-print-badge i {
  color: var(--accent-gold);
  font-size: 11px;
}

/* ========================================================
   Hierarchical Color Tree System
   ======================================================== */
.color-quick-palettes-bar {
  margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
}

.quick-palettes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.quick-palettes-header .section-sub-label {
  font-size: 12px;
  font-weight: 600;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 6px;
}

.quick-palettes-header .section-sub-label i {
  color: var(--accent-gold);
}

.quick-palettes-header small {
  font-size: 11px;
  color: var(--text-muted);
}

.quick-palettes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 6px;
}

.btn-palette-chip {
  background: var(--bg-sidebar-elevated);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 500;
}

.btn-palette-chip:hover {
  border-color: var(--accent-gold);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.palette-swatch-combo {
  display: flex;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.palette-swatch-combo span {
  width: 12px;
  height: 12px;
  display: inline-block;
}

/* Tree Structure & Toolbar */
.color-tree-system-wrapper {
  margin-bottom: 20px;
}

.color-tree-top-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 2px;
}

.color-tree-info {
  display: flex;
  flex-direction: column;
}

.color-tree-info strong {
  font-size: 13px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.color-tree-info strong i {
  color: var(--accent-gold);
}

.color-tree-info span {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}

.color-tree-actions {
  display: flex;
  gap: 4px;
}

.btn-tree-action {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-tree-action:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.color-tree-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Tree Branch (Master Category Card) */
.color-tree-branch {
  background: rgba(20, 23, 32, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.color-tree-branch:hover {
  border-color: rgba(255, 255, 255, 0.16);
}

.color-tree-branch.is-locked {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(21, 24, 33, 0.98);
}

.branch-children-container {
  padding: 4px 6px 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* Subgroup Section Divider (Depth 1 organizational header) */
.color-tree-subgroup {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  margin-top: 6px;
  margin-bottom: 2px;
  background: rgba(255, 255, 255, 0.025);
  border-left: 2px solid var(--accent-gold);
  border-radius: 4px;
}

.subgroup-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #cbd5e1;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.subgroup-icon {
  font-size: 10.5px;
  color: var(--accent-gold);
}

/* Redesigned Compact Two-Tier Node */
.color-tree-node {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 5px 8px;
  background: rgba(255, 255, 255, 0.018);
  border: 1px solid rgba(255, 255, 255, 0.035);
  border-radius: 4px;
  position: relative;
  transition: all 0.15s ease;
}

.color-tree-node:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

/* Depth 0: Master Category Header Card */
.color-tree-node.depth-0 {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.015) 100%);
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0;
  gap: 4px;
}

/* Depth 2: Leaf items with subtle guide */
.color-tree-node.depth-2 {
  margin-left: 6px;
  border-left: 2px solid rgba(255, 255, 255, 0.07);
}

.color-tree-node.is-custom-node {
  border-color: rgba(56, 189, 248, 0.25);
  background: rgba(56, 189, 248, 0.02);
}

.color-tree-node.is-node-locked {
  border-color: rgba(245, 158, 11, 0.22);
  background: rgba(245, 158, 11, 0.015);
}

/* Node Header Row */
.node-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
}

.node-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.node-branch-toggle {
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 0 2px;
  font-size: 10px;
  transition: transform 0.2s ease, color 0.2s ease;
}

.node-branch-toggle:hover {
  color: #cbd5e1;
}

.color-tree-branch.collapsed .node-branch-toggle {
  transform: rotate(-90deg);
}

.color-tree-branch.collapsed .branch-children-container {
  display: none !important;
}

.node-icon {
  font-size: 11px;
  color: var(--accent-gold);
  flex-shrink: 0;
  width: 13px;
  text-align: center;
}

.depth-0 .node-icon {
  font-size: 13px;
}

/* Label: full width to expand naturally without cutoff */
.node-label {
  font-size: 12px;
  font-weight: 500;
  color: #f1f5f9;
  line-height: 1.25;
  white-space: normal;
  word-break: break-word;
}

.depth-0 .node-label {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.1px;
}

/* Actions in Header (Compact Revert & Lock Buttons) */
.node-actions-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.btn-tree-lock {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  border-radius: 4px;
  width: 20px;
  height: 20px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 10px;
  transition: all 0.18s ease;
}

.color-tree-subgroup .btn-tree-lock {
  width: auto;
  height: 18px;
  padding: 1px 5px;
  font-size: 9.5px;
  gap: 3px;
}

.btn-tree-lock:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.07);
}

.btn-tree-lock.is-locked {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.45);
  color: #fbbf24;
}

.btn-tree-revert {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #38bdf8;
  border-radius: 4px;
  width: 20px;
  height: 20px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 10px;
  transition: all 0.15s ease;
}

.btn-tree-revert:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.5);
  color: #7dd3fc;
}

/* Node Controls Row */
.node-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.node-picker-box {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.color-tree-node .tree-color-picker {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  cursor: pointer;
  background: transparent;
  transition: transform 0.15s ease, border-color 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.depth-0 .tree-color-picker {
  width: 22px;
  height: 22px;
}

.color-tree-node .tree-color-picker:hover:not(:disabled) {
  transform: scale(1.08);
  border-color: var(--accent-gold);
}

.color-tree-node .tree-color-picker:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

.color-tree-node .tree-hex-input {
  width: 58px;
  height: 20px;
  padding: 1px 4px;
  font-size: 10.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  color: #f8fafc;
  text-align: center;
  font-weight: 500;
  letter-spacing: 0.2px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.color-tree-node .tree-hex-input:focus {
  border-color: var(--primary);
  background: rgba(0, 0, 0, 0.55);
  outline: none;
}

.color-tree-node .tree-hex-input:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  background: rgba(0, 0, 0, 0.12);
}

/* Inheritance / Status Hints */
.node-hint-box {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  flex: 1;
}

.tree-status-hint {
  font-size: 10px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.tree-status-hint.is-inherited {
  color: #94a3b8;
}

.tree-status-hint.is-custom {
  color: #38bdf8;
  font-weight: 500;
}

.tree-status-hint.is-locked {
  color: #fbbf24;
  font-weight: 500;
}

.tree-status-hint.is-master {
  color: var(--accent-gold);
  font-weight: 500;
}

/* Section divider for surface geometry */
.color-section-divider {
  border-top: 1px solid var(--border-color);
  margin: 18px 0 14px 0;
  padding-top: 14px;
  display: flex;
  align-items: center;
}

.color-section-divider span {
  font-size: 12px;
  font-weight: 600;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.color-section-divider span i {
  color: var(--accent-gold);
}
