/* ─────────────────────────────────────────────────────────────
   Raph Plus Design Language — CSS Tokens & Architecture
   Neo-nostalgic macOS-inspired desktop app stylesheet
────────────────────────────────────────────────────────────── */

:root {
  /* ── Backgrounds ── */
  --color-bg:             #F0F0F0;   /* App canvas / desktop grey */
  --color-bg-elevated:    #FAFAFA;   /* Slightly lifted surfaces */
  --color-bg-card:        #FFFFFF;   /* Cards, panels, window bodies */
  --color-bg-hover:       #F5F5F5;   /* Hover state for list items */
  --color-surface:        #F8F8F8;   /* Inset/recessed regions */

  /* ── Borders ── */
  --color-border:         #D0D0D0;   /* Default border */
  --color-border-subtle:  #E0E0E0;   /* Light dividers inside cards */
  --color-border-strong:  #C0C0C0;   /* Title bar bottom, strong separators */

  /* ── Title-bar gradient ── */
  --color-titlebar-from:  #E8E8E8;
  --color-titlebar-to:    #D8D8D8;

  /* ── Text ── */
  --color-text-primary:   #1a1a1a;
  --color-text-secondary: #4a4a4a;
  --color-text-muted:     #666666;
  --color-text-faint:     #999999;

  /* ── Accent (interactive) ── */
  --color-accent:             #0088CC;
  --color-accent-light:       #0095DD;
  --color-accent-hover-from:  #00A8F0;
  --color-accent-hover-to:    #0095DD;

  /* ── Error ── */
  --color-error: #d4183d;

  /* ── Typography ── */
  --font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue',
                 'Segoe UI', sans-serif;
  --font-mono: 'SF Mono', 'Menlo', 'Monaco', monospace;

  /* ── Radii — ZERO by default ── */
  --radius-sm: 0px;
  --radius-md: 0px;
  --radius-lg: 0px;

  /* ── Shadows ── */
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md:     0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg:     0 8px 24px rgba(0,0,0,0.1);
  --shadow-window: 0 2px 8px rgba(0,0,0,0.12), 0 0 1px rgba(0,0,0,0.08);

  /* ── Transitions ── */
  --transition-fast:   150ms ease;
  --transition-normal: 250ms ease;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  background-color: var(--color-bg);
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  line-height: 1.6;
  width: 100%;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow-x: hidden;
  overflow-y: hidden;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ─────────────────────────────────────────────────────────────
   1. TOP APP BAR (38px classic Mac OS desktop chrome)
────────────────────────────────────────────────────────────── */
.topbar {
  height: 38px;
  width: 100%;
  max-width: 100%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: linear-gradient(to bottom, #FAFAFA, #E8E8E8);
  border-bottom: 1px solid var(--color-border-strong);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset;
  z-index: 100;
  user-select: none;
  position: relative;
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.topbar__logo {
  display: flex;
  align-items: center;
  color: var(--color-text-secondary);
  opacity: 0.75;
  flex-shrink: 0;
}

.topbar__appname {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  pointer-events: none;
}

.topbar__doctitle {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────────
   2. MOBILE NAVIGATION (Visible only on <= 768px)
────────────────────────────────────────────────────────────── */
.mobile-nav {
  display: none;
  height: 40px;
  width: 100%;
  max-width: 100%;
  flex-shrink: 0;
  background: linear-gradient(to bottom, #FAFAFA, #E8E8E8);
  border-bottom: 1px solid var(--color-border);
  z-index: 99;
}

.mobile-nav__item {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  height: 100%;
  padding: 0 4px;
  border-right: 1px solid var(--color-border-subtle);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.mobile-nav__item:last-child {
  border-right: none;
}

.mobile-nav__item svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.mobile-nav__item--active {
  background: var(--color-accent);
  color: #FFFFFF;
  font-weight: 600;
}

.mobile-nav__badge {
  font-size: 0.6rem;
  padding: 1px 4px;
  background: rgba(0,0,0,0.08);
  border-radius: 2px;
  line-height: 1;
}

.mobile-nav__item--active .mobile-nav__badge {
  background: rgba(255,255,255,0.3);
  color: white;
}

/* ─────────────────────────────────────────────────────────────
   3. THREE-ZONE DESKTOP SHELL
────────────────────────────────────────────────────────────── */
.app-body {
  display: flex;
  flex: 1;
  width: 100%;
  max-width: 100%;
  height: calc(100vh - 38px);
  height: calc(100dvh - 38px);
  overflow: hidden;
  min-width: 0;
}

/* 180px Classic Desktop Sidebar */
.sidebar {
  width: 180px;
  flex-shrink: 0;
  background: linear-gradient(to bottom, #F6F6F6, #EFEFEF);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  overflow-y: auto;
  user-select: none;
}

.sidebar__group-label {
  padding: 0 16px 6px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--color-text-faint);
  text-transform: uppercase;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-nav__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 0.8125rem;
  font-weight: 400;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background var(--transition-fast);
  position: relative;
}

.sidebar-nav__indicator {
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--color-border);
  flex-shrink: 0;
  transition: background var(--transition-fast);
}

.sidebar-nav__icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.sidebar-nav__label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav__badge {
  font-size: 0.625rem;
  font-weight: 500;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.06);
  color: var(--color-text-muted);
}

.sidebar-nav__item:hover:not(.sidebar-nav__item--active) {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.sidebar-nav__item--active {
  background: var(--color-accent);
  color: #FFFFFF;
}

.sidebar-nav__item--active .sidebar-nav__indicator {
  background: rgba(255, 255, 255, 0.85);
}

.sidebar-nav__item--active .sidebar-nav__badge {
  background: rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
}

.sidebar-presets {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-preset-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-preset-btn:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.sidebar-preset-bullet {
  color: var(--color-accent);
  font-size: 0.9rem;
}

.sidebar__footer {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid var(--color-border-subtle);
}

.sidebar__meta-mono {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--color-text-faint);
}

/* Content Area */
.content-area {
  flex: 1;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 24px;
  background: var(--color-bg);
  -webkit-overflow-scrolling: touch;
}

/* ─────────────────────────────────────────────────────────────
   4. STEP PROGRESS BAR (WIZARD NAVIGATION)
────────────────────────────────────────────────────────────── */
.step-progress-container {
  margin-bottom: 16px;
  width: 100%;
}

.step-progress-bar {
  display: flex;
  align-items: center;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  padding: 4px 6px;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.step-progress-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
}

.step-progress-item:hover {
  background: var(--color-bg-hover);
}

.step-number {
  width: 20px;
  height: 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 0.6875rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-title {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.step-progress-item.active {
  background: rgba(0, 136, 204, 0.08);
}

.step-progress-item.active .step-number {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #FFFFFF;
}

.step-progress-item.active .step-title {
  color: var(--color-text-primary);
  font-weight: 600;
}

.step-progress-item.completed .step-number {
  background: #10B981;
  border-color: #10B981;
  color: #FFFFFF;
}

.step-divider {
  width: 16px;
  height: 1px;
  background: var(--color-border);
  flex-shrink: 0;
  margin: 0 2px;
}

.wizard-screen {
  display: none;
  width: 100%;
  animation: fadeIn 0.25s ease-out;
}

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

.wizard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border-subtle);
  width: 100%;
}

/* ─────────────────────────────────────────────────────────────
   5. E-COMMERCE PRODUCT GRID & FILTER BAR
────────────────────────────────────────────────────────────── */
.ecommerce-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.ecommerce-search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  padding: 2px 8px;
  min-width: 220px;
}

.ecommerce-search-box svg {
  width: 14px;
  height: 14px;
  color: var(--color-text-muted);
}

.ecommerce-search-box input {
  border: none;
  box-shadow: none;
  padding: 4px 0;
  font-size: 0.75rem;
}

.ecommerce-search-box input:focus {
  box-shadow: none;
}

.ecommerce-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  width: 100%;
}

.ecommerce-card {
  border: 1px solid var(--color-border);
  background: var(--color-bg-card);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  user-select: none;
}

.ecommerce-card:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.ecommerce-card.selected {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent);
  background: rgba(0, 136, 204, 0.02);
}

.ecommerce-card__media {
  position: relative;
  width: 100%;
  height: 160px;
  background: #EAEAEA;
  overflow: hidden;
  border-bottom: 1px solid var(--color-border-subtle);
}

.ecommerce-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.ecommerce-card:hover .ecommerce-card__media img {
  transform: scale(1.03);
}

.ecommerce-card__tag {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--color-border);
  font-size: 0.625rem;
  font-weight: 600;
  padding: 1px 6px;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.ecommerce-card__check {
  display: none;
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  background: var(--color-accent);
  color: #FFFFFF;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.ecommerce-card.selected .ecommerce-card__check {
  display: flex;
}

.ecommerce-card__body {
  padding: 8px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.ecommerce-card__title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ecommerce-card__meta {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.ecommerce-card__badge {
  font-size: 0.625rem;
  color: var(--color-accent);
  font-weight: 500;
  text-transform: uppercase;
  margin-top: auto;
  padding-top: 4px;
}

/* Selected Outfit Ribbon (Sticky Footer in Step 2) */
.selected-ribbon {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: 8px 12px;
  margin-top: 14px;
  width: 100%;
}

.selected-ribbon__thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border: 1px solid var(--color-border);
  flex-shrink: 0;
}

.selected-ribbon__info {
  flex: 1;
  min-width: 0;
}

.selected-ribbon__name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.selected-ribbon__meta {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─────────────────────────────────────────────────────────────
   6. STEP 3 REVIEW DECK & STYLING
────────────────────────────────────────────────────────────── */
.review-deck {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 16px 0;
  width: 100%;
  flex-wrap: wrap;
}

.review-card {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  padding: 10px;
  width: 200px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.review-card__label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.review-card__box {
  width: 160px;
  height: 180px;
  border: 1px solid var(--color-border-subtle);
  overflow: hidden;
  background: #EAEAEA;
}

.review-card__box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.review-card__title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.review-arrow {
  width: 32px;
  height: 32px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-accent);
}

.field-hint {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* ─────────────────────────────────────────────────────────────
   7. STEP 4 DEDICATED LOADING STATE
────────────────────────────────────────────────────────────── */
.spinner-large {
  width: 36px;
  height: 36px;
  border-width: 3px;
}

.loading-preview-row {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.loading-thumb {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  animation: pulse 1.5s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; transform: scale(0.98); }
  50% { opacity: 1; transform: scale(1.02); }
}

.btn-large {
  padding: 10px 18px;
  font-size: 0.875rem;
}

.btn-sparkle {
  background: linear-gradient(135deg, #0088CC, #00B4D8);
}

/* ─────────────────────────────────────────────────────────────
   8. TYPOGRAPHY & WINDOW CARDS
────────────────────────────────────────────────────────────── */
.page-title {
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}

.page-description {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.content-header {
  margin-bottom: 16px;
  width: 100%;
}

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

.field-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.tab-pane {
  display: none;
  width: 100%;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.window-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-window);
  border-radius: 0px;
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.window-card__titlebar {
  height: 30px;
  background: linear-gradient(to bottom, var(--color-titlebar-from), var(--color-titlebar-to));
  border-bottom: 1px solid var(--color-border-strong);
  display: flex;
  align-items: center;
  padding: 0 10px;
  user-select: none;
  flex-shrink: 0;
}

.window-card__titlebar.flex-titlebar {
  justify-content: space-between;
  padding: 0;
}

.window-card__title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.window-card__meta {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  padding-right: 10px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.window-card__body {
  padding: 16px;
  flex: 1;
  min-width: 0;
  width: 100%;
  overflow: hidden;
}

/* Window Titlebar Tabs */
.window-tabs {
  display: flex;
  height: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.window-tab {
  height: 100%;
  padding: 0 12px;
  display: flex;
  align-items: center;
  border: none;
  background: transparent;
  border-right: 1px solid var(--color-border);
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--color-text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.window-tab:hover {
  background: rgba(255, 255, 255, 0.4);
}

.window-tab.active {
  background: var(--color-bg-card);
  color: var(--color-text-primary);
  font-weight: 500;
  box-shadow: 0 1px 0 var(--color-bg-card);
}

/* Buttons & Inputs */
.btn-primary {
  background: linear-gradient(to bottom, var(--color-accent-light), var(--color-accent));
  color: #FFFFFF;
  border: none;
  border-radius: 0px;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 8px 14px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(to bottom, var(--color-accent-hover-from), var(--color-accent-hover-to));
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: 0px;
  color: var(--color-text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 7px 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  white-space: nowrap;
}

.btn-secondary:hover {
  border-color: var(--color-border);
  color: var(--color-text-primary);
  background: var(--color-bg-card);
}

.btn-sm {
  padding: 4px 8px;
  font-size: 0.6875rem;
}

.btn-block {
  width: 100%;
  padding: 10px;
  font-size: 0.875rem;
}

.input {
  width: 100%;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 0px;
  padding: 8px 10px;
  font-size: 0.8125rem;
  color: var(--color-text-primary);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
  outline: none;
  font-family: var(--font-family);
  transition: border-color var(--transition-fast);
}

.input:focus {
  border-color: var(--color-accent);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06), 0 0 0 2px rgba(0, 136, 204, 0.15);
}

.field-group {
  margin-bottom: 12px;
  width: 100%;
}

.button-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  width: 100%;
}

.button-row > * {
  flex: 1;
}

/* Badges */
.badge {
  font-size: 0.625rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-faint);
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 6px;
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge--online {
  color: var(--color-accent);
  background: rgba(0, 136, 204, 0.08);
}

.badge__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
}

/* Avatars & Dropzone */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
  width: 100%;
}

.avatar-item {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  padding: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
  border-radius: 0px;
  min-width: 0;
  overflow: hidden;
}

.avatar-item:hover {
  border-color: var(--color-accent);
  background: var(--color-bg-card);
}

.avatar-item.active {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 1px var(--color-accent);
  background: rgba(0, 136, 204, 0.06);
}

.avatar-item__thumb {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
  margin-bottom: 4px;
  border: 1px solid var(--color-border-subtle);
  background: #EAEAEA;
}

.avatar-item__name {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.section-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 14px 0 12px;
  color: var(--color-text-faint);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  width: 100%;
}

.section-divider::before, .section-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--color-border-subtle);
}

.section-divider__text {
  padding: 0 8px;
  white-space: nowrap;
}

.dropzone {
  border: 1px dashed var(--color-border);
  background: var(--color-surface);
  padding: 18px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  width: 100%;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--color-accent);
  background: var(--color-bg-card);
}

.dropzone--large {
  padding: 28px 16px;
}

.dropzone__icon {
  width: 24px;
  height: 24px;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.dropzone__icon--large {
  width: 36px;
  height: 36px;
}

.dropzone__text {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-primary);
}

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

.dropzone__preview {
  position: relative;
  max-height: 220px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  width: 100%;
}

.dropzone__preview img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

.btn-clear-preview {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-clear-preview:hover {
  background: var(--color-error);
}

.file-input-hidden {
  display: none;
}

.subtabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.subtab {
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--color-border-subtle);
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.subtab.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #FFFFFF;
}

/* Try-On Result */
.tryon-result {
  width: 100%;
}

.tryon-result__image-box {
  width: 100%;
  max-height: 420px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: #EAEAEA;
}

.tryon-result__image-box img {
  width: 100%;
  height: 420px;
  object-fit: cover;
  display: block;
}

/* Comparison Block */
.comparison-block {
  margin-top: 14px;
  padding: 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  width: 100%;
}

.comparison-block__header {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
}

.comparison-item__label {
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 2px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.comparison-item__box {
  width: 100%;
  height: 90px;
  border: 1px solid var(--color-border);
  overflow: hidden;
  background: #EAEAEA;
}

.comparison-item__box--highlight {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 1px var(--color-accent);
}

.comparison-item__box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Process Loading State */
.process-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px 16px;
  text-align: center;
  width: 100%;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

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

.process-state__title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 4px;
}

.process-state__desc {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  max-width: 320px;
}

/* Empty State */
.empty-state {
  padding: 32px 16px;
  text-align: center;
  width: 100%;
}

.empty-state__title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 4px;
}

.empty-state__text {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  max-width: 280px;
  margin: 0 auto;
}

/* Extractor & Presets */
.extractor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 16px;
  width: 100%;
}

.queue-box {
  margin-top: 12px;
  padding: 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  width: 100%;
}

.queue-thumbnails {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(55px, 1fr));
  gap: 6px;
  margin-top: 6px;
}

.queue-thumb {
  width: 55px;
  height: 55px;
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.queue-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.description-text {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  margin-bottom: 12px;
}

.preset-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.preset-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  cursor: pointer;
  transition: all var(--transition-fast);
  min-width: 0;
}

.preset-row:hover {
  background: var(--color-bg-card);
  border-color: var(--color-border);
}

.preset-row__thumb {
  width: 30px;
  height: 30px;
  border: 1px solid var(--color-border);
  flex-shrink: 0;
}

.preset-row__thumb--yellow { background: #FACC15; }
.preset-row__thumb--black { background: #1E293B; }
.preset-row__thumb--cream { background: #FEF08A; }
.preset-row__thumb--green { background: #10B981; }

.preset-row__info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.preset-row__name {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preset-row__sub {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.info-callout {
  padding: 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  font-size: 0.75rem;
  width: 100%;
}

.info-callout__title {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: 2px;
}

.info-callout__body {
  color: var(--color-text-secondary);
  line-height: 1.4;
}

/* Lookbook */
.lookbook-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  width: 100%;
}

.look-entry {
  border: 1px solid var(--color-border);
  background: var(--color-bg-card);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.look-entry__media {
  height: 280px;
  overflow: hidden;
  background: #EAEAEA;
  border-bottom: 1px solid var(--color-border-subtle);
  width: 100%;
}

.look-entry__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.look-entry__body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.look-entry__title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

.look-entry__date {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--color-text-muted);
}

/* Modals & Toasts */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}

.modal-window {
  max-width: 600px;
  width: 100%;
  margin-bottom: 0;
}

.window-close-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.window-close-btn:hover {
  color: var(--color-error);
}

.modal-body img {
  width: 100%;
  max-height: 480px;
  object-fit: contain;
  background: #000000;
  display: block;
}

.toast-container {
  position: fixed;
  bottom: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 300;
  max-width: calc(100vw - 32px);
}

.toast {
  padding: 10px 14px;
  background: #FFFFFF;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
  color: var(--color-text-primary);
  font-size: 0.8125rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  border-left: 3px solid var(--color-accent);
}

.toast.success { border-left-color: #10B981; }
.toast.error { border-left-color: var(--color-error); }

/* Auth Lock Screen */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(240, 240, 240, 0.96);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  animation: fadeIn 0.25s ease-out;
}

.auth-window {
  max-width: 360px;
  width: 100%;
  margin-bottom: 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 0 1px rgba(0, 0, 0, 0.1);
}

.auth-body {
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
}

.auth-icon-box {
  width: 50px;
  height: 50px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-content {
  width: 100%;
}

.auth-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 2px;
}

.auth-subtitle {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: 14px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.auth-error-msg {
  font-size: 0.75rem;
  color: var(--color-error);
  font-weight: 500;
  text-align: center;
  padding: 2px 0;
}

.btn-lock-session {
  background: transparent;
  border: 1px solid var(--color-border-subtle);
  color: var(--color-text-muted);
  padding: 4px 6px;
  margin-left: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

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

.shake {
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%  { transform: translateX(-6px); }
  40%  { transform: translateX(6px); }
  60%  { transform: translateX(-3px); }
  80%  { transform: translateX(3px); }
}

.hidden {
  display: none !important;
}

/* ─────────────────────────────────────────────────────────────
   9. RESPONSIVE MEDIA QUERIES
────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    display: none !important;
  }

  .mobile-nav {
    display: flex;
  }

  .app-body {
    height: calc(100vh - 78px);
    height: calc(100dvh - 78px);
    width: 100%;
    max-width: 100vw;
  }

  .content-area {
    padding: 10px 8px;
    width: 100%;
    max-width: 100vw;
  }

  .step-progress-item {
    padding: 4px 8px;
    gap: 4px;
  }

  .step-title {
    font-size: 0.6875rem;
  }

  .ecommerce-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .ecommerce-card__media {
    height: 130px;
  }

  .ecommerce-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .ecommerce-search-box {
    min-width: 100%;
  }

  .review-deck {
    flex-direction: column;
    gap: 8px;
  }

  .review-card {
    width: 100%;
  }

  .review-card__box {
    width: 100%;
    height: 140px;
  }

  .review-arrow {
    transform: rotate(90deg);
  }

  .extractor-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .page-title {
    font-size: 1.15rem;
  }

  .page-description {
    font-size: 0.75rem;
  }

  .topbar__doctitle, .badge__label {
    display: none;
  }

  .lookbook-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .look-entry__media {
    height: 220px;
  }

  .tryon-result__image-box {
    max-height: 280px;
  }
  
  .tryon-result__image-box img {
    height: 280px;
  }

  .window-card {
    margin-bottom: 10px;
  }

  .window-card__body {
    padding: 10px 8px;
  }
}

/* ─────────────────────────────────────────────────────────────
   10. MINIMALIST FLAT-LAY PRODUCT GRID (SSENSE / Luxury Wardrobe)
────────────────────────────────────────────────────────────── */
.target-portrait-container {
  display: flex;
  justify-content: center;
  margin: 12px 0 16px;
  width: 100%;
}

.target-portrait-box {
  position: relative;
  width: 200px;
  height: 280px;
  background: #EAEAEA;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.target-portrait-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.target-badge {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 136, 204, 0.95);
  color: #FFFFFF;
  font-size: 0.625rem;
  font-weight: 600;
  padding: 3px 8px;
  white-space: nowrap;
  letter-spacing: 0.04em;
}

/* Minimalist Flat-Lay Grid */
.minimalist-flatlay-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  width: 100%;
  padding: 8px 0;
}

.flatlay-card {
  background: #FAF8F5; /* Warm off-white neutral studio background matching reference */
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  padding: 12px;
  user-select: none;
}

.flatlay-card:hover {
  background: #F4F0E8;
  border-color: var(--color-border);
  transform: translateY(-2px);
}

.flatlay-card.selected {
  background: #FFFFFF;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent);
}

.flatlay-card__media {
  width: 100%;
  height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.flatlay-card__media img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.25s ease;
}

.flatlay-card:hover .flatlay-card__media img {
  transform: scale(1.04);
}

.flatlay-card__check {
  display: none;
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  background: var(--color-accent);
  color: #FFFFFF;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
}

.flatlay-card.selected .flatlay-card__check {
  display: flex;
}

.flatlay-card__body {
  padding-top: 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.flatlay-card__title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.flatlay-card__meta {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.flatlay-card__badge {
  font-size: 0.625rem;
  color: var(--color-accent);
  font-weight: 600;
  text-transform: uppercase;
  margin-top: 4px;
}

@media (max-width: 768px) {
  .minimalist-flatlay-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .flatlay-card__media {
    height: 140px;
  }
}
