/* ── RESET ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* ── TOKENS ── */
:root {
  /* Semantic color tokens */
  --bg:            #ffffff;
  --bg-30:         rgba(255, 255, 255, 0.3);
  --surface:       #f5efe9;
  --border:        #c4c4c4;
  --border-light:  rgba(232, 232, 242, 0.8);
  --border-brand:  rgba(255, 153, 255, 0.3);
  --text-primary:  #212121;
  --text-secondary:#666666;
  --brand:         #ff99ff;
  --danger:        #ff6c6c;
  --warning:       #ff9f0a;

  --font-display: 'Cormorant Garamond', serif;
  --font-body:    'Manrope', sans-serif;

  --radius-sm:   8px;
  --radius-md:   16px;
  --radius-lg:   24px;
  --radius-pill: 999px;

  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out:    cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in:     cubic-bezier(0.4, 0, 1, 1);

  --motion-fast: 160ms;
  --motion-base: 220ms;
  --motion-slow: 280ms;

  /* Graph-paper grid */
  --grid-line: rgba(0, 0, 0, 0.035);
  --grid-size: 44px;
}

/* ── BASE ── */
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: clip;   /* clip (not hidden) so it doesn't break position:sticky */
  width: 100%;
}

html {
  overflow-x: clip;   /* clip (not hidden) so it doesn't break position:sticky */
}

.hidden { display: none !important; }

/* ── HEADER ── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  width: 100%;
}

.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 40px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  box-sizing: border-box;
}

.logo {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--text-primary);
  flex-shrink: 0;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}
.logo img { height: 26px; width: auto; display: block; }

/* ── HEADER ACTIONS ── */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Glass pill button — "Create a Look" */
.btn-pill {
  position: relative;
  border: 1px solid var(--border-light);
  background: var(--bg-30);
  border-radius: var(--radius-pill);
  height: 44px;
  padding: 0 20px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: inset 0 1.5px 3px rgba(138, 138, 138, 0.2), inset 0 -3px 10px rgba(138, 138, 138, 0.2);
  transition: background var(--motion-base) var(--ease-out), box-shadow var(--motion-base) var(--ease-out);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-pill:hover {
  background: rgba(255, 255, 255, 0.6);
}

/* Glass icon button — rules, sign-out */
.icon-btn {
  position: relative;
  background: var(--bg-30);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--motion-base) var(--ease-out);
  flex-shrink: 0;
  box-shadow: inset 0 1.5px 3px rgba(138, 138, 138, 0.2), inset 0 -3px 10px rgba(138, 138, 138, 0.2);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.6);
}

.icon-btn.active {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: var(--bg);
  box-shadow: none;
}

/* Sign-out: ghost, no pill — just the icon */
#signOutBtn {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--text-secondary);
}

#signOutBtn:hover {
  background: transparent;
  color: var(--text-primary);
}

/* Floating action button — "+" add piece */
.btn-fab {
  position: fixed;
  bottom: 130px;
  right: 75px;
  z-index: 150;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-brand);
  background: var(--brand);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: inset 0 1.5px 3px #ffbff6, inset 0 -3px 10px rgba(183, 41, 164, 0.5);
  transition: transform var(--motion-base) var(--ease-spring);
}

.btn-fab:hover { transform: scale(1.08); }

/* Inline add button (empty state, modals) */
.add-btn {
  background: var(--text-primary);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-pill);
  padding: 10px 24px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: opacity var(--motion-base) var(--ease-out);
}

.add-btn:hover { opacity: 0.85; }





/* ── WARDROBE SECTION ── */
.wardrobe-section {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0;
  position: relative;
}

/* Pink radial gradient blob — no transform, avoids stacking-context side effects */
.wardrobe-section::after {
  content: '';
  position: fixed;
  bottom: -80px;
  left: -5vw;
  width: 110vw;
  height: 340px;
  background: radial-gradient(ellipse at 50% 80%, rgba(255, 153, 255, 0.18) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
}

/* ── WARDROBE FILTER (category chips) ── */
.wardrobe-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  position: sticky;
  top: 64px;                 /* pin just under the sticky 64px header */
  z-index: 90;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  /* Mobile: horizontally scrollable, no wrap, hidden scrollbar */
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.wardrobe-filter::-webkit-scrollbar { display: none; }
.wardrobe-filter .chip { flex: 0 0 auto; }

/* Shown when the current filter matches no looks */
.filter-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: #9a9a9a;
  font-family: var(--font-body);
  font-size: 14px;
  padding: 64px 0;
}

/* ── OUTFITS GRID ── */
.outfits-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  row-gap: 40px;
  column-gap: 0;
  padding: 40px 14px 120px;
  position: relative;
  z-index: 1;
}

/* ── OUTFIT CARD ── */
.outfit-card {
  cursor: pointer;
  aspect-ratio: 2 / 3;
  max-height: 280px;
  min-width: 0;
  overflow: hidden;
  position: relative;
  background: transparent;
  transition: opacity var(--motion-base) var(--ease-out), transform var(--motion-base) var(--ease-out);
}

.outfit-card:hover { opacity: 0.85; }

/* Staggered grid entrance — first load only */
@keyframes cardEnter {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.outfit-card.entrance {
  animation: cardEnter var(--motion-base) var(--ease-out) both;
  animation-delay: var(--stagger, 0ms);
}

/* Expand-in-place: dim others, scale the expanded card */
.outfits-grid.has-expanded .outfit-card {
  opacity: 0.25;
}

.outfits-grid.has-expanded .outfit-card.card-expanded {
  opacity: 1;
  transform: scale(1.08);
  z-index: 10;
}

.outfit-card-inner {
  display: contents;
}

/* ── OUTFIT FIGURE (cutout photo) ── */
.outfit-figure {
  width: 100%;
  height: 100%;
  display: block;
}

.outfit-figure img,
.outfit-card > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  display: block;
}

.outfit-card-name-sm {
  display: none;
}

/* Web grid: 5 columns, tall cells */
@media (min-width: 768px) {
  .wardrobe-filter {
    padding: 14px 40px;
    margin-top: 56px;        /* airy gap under header at rest; still pins on scroll */
    flex-wrap: wrap;
    overflow: visible;
  }
  .outfits-grid {
    grid-template-columns: repeat(5, 1fr);
    row-gap: 120px;
    /* top padding reduced (was 120px) — filter row now occupies the header gap */
    padding: 32px 5px 40px;
  }
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 80px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.empty-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  font-style: italic;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.empty-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}


/* ════════════════════════════════════════
   SHARED OVERLAY / MODAL SYSTEM
   Desktop  → centred card over dim backdrop
   Mobile (≤767px) → bottom sheet
   ════════════════════════════════════════ */

/* ── OVERLAY BACKDROP (desktop default) ── */
.modal-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

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

/* ── MODAL CARD (desktop: centred popup) ── */
.modal {
  background: var(--bg);
  border-radius: 20px;
  padding: 24px;
  width: 100%;
  max-width: 460px;
  position: relative;
  animation: modalFadeIn var(--motion-base) var(--ease-out) both;
  max-height: 90vh;
  overflow-y: auto;
  scrollbar-width: none;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal::-webkit-scrollbar { display: none; }

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

/* ── CLOSE BUTTON ── */
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  border-radius: var(--radius-pill);
  width: 40px;
  height: 40px;
  font-size: 17px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--motion-base) var(--ease-out);
  font-family: var(--font-body);
  line-height: 1;
  z-index: 1;
}

.modal-close:hover {
  background: var(--surface);
  color: var(--text-primary);
}

/* ── TODAY'S LOOK — hide overlay when inner panel is hidden ── */
.suggestion-overlay {
  /* inherits .modal-overlay styles */
}

.suggestion-overlay:has(.suggestion-panel.hidden) {
  display: none !important;
}

/* The suggestion-panel inherits .modal card styles */
.modal-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 0;
}

.modal-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* ── UPLOAD ── */
.upload-placeholder {
  text-align: center;
  color: var(--text-secondary);
  pointer-events: none;
}

.upload-icon {
  font-size: 28px;
  display: block;
  margin-bottom: 8px;
  color: var(--brand);
}

.upload-placeholder p { font-size: 13px; }

.upload-sub {
  font-size: 11px !important;
  margin-top: 4px;
}


/* ── FIELDS ── */
.modal-field { margin-bottom: 20px; }


.field-label {
  display: block;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-secondary);
}


.text-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 14px 20px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg);
  outline: none;
  transition: border-color var(--motion-base) var(--ease-out);
  box-sizing: border-box;
}

.text-input::placeholder { color: var(--text-secondary); }
.text-input:focus { border-color: var(--brand); }

/* ── BUTTONS ── */
.save-btn {
  position: relative;
  width: 100%;
  background: var(--bg-30);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  height: 44px;
  padding: 0 20px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.02em;
  cursor: pointer;
  transition: background var(--motion-base) var(--ease-out);
  margin-top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1.5px 3px rgba(138, 138, 138, 0.2), inset 0 -3px 10px rgba(138, 138, 138, 0.2);
}

.save-btn:hover { background: rgba(255, 255, 255, 0.6); }

.save-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* "Try another" — brand-coloured text link, same serif size as Save */
.save-btn.outline {
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--brand);
  font-size: 20px;
  height: 36px;
  width: auto;
  padding: 0 12px;
}

.save-btn.outline:hover { background: transparent; opacity: 0.75; }

/* ── TODAY'S LOOK PANEL ── */
.suggestion-panel {
  gap: 2px;
  padding: 0 16px 16px;
  overflow-y: auto;
  scrollbar-width: none;
}

.suggestion-panel::-webkit-scrollbar { display: none; }

/* ── SUGGESTION HEADER (shared: Today's Look, Log a Look, Tag a Look) ── */
.suggestion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  flex-shrink: 0;
}

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

.suggestion-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 0;
}

/* ✦ Style rules link in sheet header */
.suggestion-rules-link {
  background: none;
  border: none;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px 8px;
  white-space: nowrap;
  transition: color var(--motion-fast) var(--ease-out);
}

.suggestion-rules-link:hover { color: var(--brand); }

.suggestion-close {
  background: none;
  border: none;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 17px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--motion-base) var(--ease-out);
  flex-shrink: 0;
}

.suggestion-close:hover { background: var(--surface); }

/* ── FLATLAY BOX (beige container on desktop) ── */
.suggestion-flatlay {
  background: var(--surface);
  border-radius: 14px;
  overflow: hidden;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── OUTFIT SUGGESTION (flatlay grid inside) ── */
.outfit-suggestion {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  width: 100%;
}

/* Row that holds one or two cards side-by-side */
.outfit-row {
  display: flex;
  gap: 6px;
}

.outfit-item-card {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  flex: 1;
  transition: transform var(--motion-base) var(--ease-spring), box-shadow var(--motion-base) var(--ease-out);
  cursor: default;
}

.outfit-item-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255, 153, 255, 0.2);
}

/* Featured item (top/dress) — tall */
.outfit-item-card.role-featured {
  height: 220px;
}

/* Standard items (bottom) */
.outfit-item-card.role-standard {
  height: 160px;
}

/* Small items (shoes, bag, accessories) — side by side */
.outfit-item-card.role-small {
  height: 120px;
}

.outfit-item-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  padding: 8px;
}

.outfit-item-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px 10px 8px;
  background: linear-gradient(transparent, rgba(26,26,26,0.45));
  color: rgba(255,255,255,0.92);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ── ITEM ARROWS ── */
.item-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.88);
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  z-index: 10;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  color: var(--text-primary);
}

.item-arrow-prev { left: 6px; }
.item-arrow-next { right: 6px; }

.outfit-item-card.locked {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

.outfit-item-card.locked .outfit-item-label::before {
  content: '✦ ';
  color: var(--border-light);
}

/* ── OUTFIT NAME ROW ── */

.outfit-name-row { margin-bottom: 0; }

.outfit-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.outfit-actions .save-btn { margin-top: 0; }

/* ── DETAIL MODAL ── */
.modal-detail {
  text-align: left;
  gap: 0;
}

/* Desktop: Expand a Look — transparent overlay, panel slides from bottom-center */
@keyframes detailPanelUp {
  from { transform: translateY(56px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

@media (min-width: 768px) {
  #outfitDetailModal {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    align-items: center;
    padding: 0;
  }

  #outfitDetailModal .modal-detail {
    max-width: 840px;
    width: 840px;
    padding: 0;
    border-radius: 24px;
    box-shadow: 0px -16px 48px -4px rgba(57, 57, 57, 0.18);
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 0;
    overflow: hidden;
    animation: detailPanelUp 180ms var(--ease-out) both;
  }

  #outfitDetailModal .detail-img { display: none; }

  /* Both columns exactly 420px, no outer padding */
  #outfitDetailModal .detail-left {
    flex: 0 0 420px;
    width: 420px;
    border-right: 1px solid rgba(196, 196, 196, 0.35);
    padding: 0;
    display: flex;
    flex-direction: column;
  }

  #outfitDetailModal .detail-right {
    flex: 0 0 420px;
    width: 420px;
    padding: 0;
    display: flex;
    flex-direction: column;
  }

  /* Section headers: pl:16 pr:10 py:12 outer, py:4 inner — no divider */
  #outfitDetailModal .sheet-section-hdr {
    margin: 0;
    padding: 12px 10px 12px 16px;
    border-bottom: none;
    background: var(--bg);
    min-height: 0;
  }

  /* Hide X close on desktop — backdrop click dismisses */
  #outfitDetailModal .modal-close { display: none; }

  /* Item Name row: h:32, pb:4, px:12 */
  #outfitDetailModal .detail-info-row {
    margin: 0;
    padding: 0 12px 4px;
    height: 32px;
    min-height: 0;
  }

  /* Occasion row: allow chips to wrap naturally */
  #outfitDetailModal .detail-occ-row {
    height: auto;
    min-height: 64px;
    padding: 12px 12px 8px;
    align-items: flex-start;
  }

  /* Buttons container: less top padding so button sits higher */
  #outfitDetailModal .detail-actions {
    padding: 4px 12px 12px;
    gap: 2px;
  }

  /* Hide empty Items section on desktop; collapse modal to Info width only */
  #outfitDetailModal .detail-left:has(.detail-pieces-row:empty) { display: none; }
  #outfitDetailModal .modal-detail:has(.detail-pieces-row:empty) { width: 420px; }

  /* ── TODAY'S LOOK — 480px popup (Figma 241:1749) ── */
  .modal.suggestion-panel {
    width: 480px;
    max-width: 480px;
    border-radius: 24px;
    box-shadow: 0px -16px 48px -4px rgba(57, 57, 57, 0.18);
    padding: 0 16px 16px;
    gap: 2px;
  }
  .suggestion-panel .suggestion-flatlay {
    width: 100%;
    height: 320px;
    min-height: 320px;
    border-radius: 14px;
    flex-shrink: 0;
    overflow: hidden;
  }
  /* Flatlay grid: height-driven so it scales to fit the 320px box.
     Transparent bg — suggestion-flatlay already supplies the beige. */
  .suggestion-panel .outfit-flatlay {
    height: 100%;
    width: auto;
    aspect-ratio: 4 / 5;
    max-width: 100%;
    background: transparent;
    border-radius: 0;
  }
  .suggestion-panel .occasion-picker {
    gap: 4px 8px;
    padding-bottom: 12px;
    margin-bottom: 0;
  }
  .suggestion-panel #outfitNameInput {
    margin-top: 16px;
  }
  .suggestion-panel .outfit-actions {
    margin-top: 16px;
    padding: 12px 0;
    width: 100%;
  }

  /* ── LOG A LOOK — 480px popup (Figma 241:1610) ── */
  #outfitUploadModal .modal {
    width: 480px;
    max-width: 480px;
    border-radius: 24px;
    box-shadow: 0px -16px 48px -4px rgba(57, 57, 57, 0.18);
    padding: 0 16px 20px;
    gap: 0;
  }
  #outfitUploadModal .outfit-photo-wrap {
    height: 280px;
    min-height: 280px;
    max-height: none;
    aspect-ratio: auto;
    border-radius: var(--radius-md);
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    margin-top: 4px;
  }
  #outfitUploadModal #outfitPhotoName {
    margin-top: 20px;
  }
  #outfitUploadModal .modal-field {
    margin: 16px 0 0;
  }
  #outfitUploadModal .outfit-actions {
    margin-top: 20px;
    padding: 0;
    width: 100%;
  }

  /* ── TAG A LOOK — info section rows (Figma 262:1066) ── */
  .tag-look-info .detail-info-row {
    padding: 0 12px 4px;
    height: 32px;
    min-height: 0;
  }
  .tag-look-info .detail-occ-row {
    height: auto;
    min-height: 64px;
    padding: 12px 12px 8px;
    align-items: flex-start;
  }
  .tag-look-info .detail-actions {
    padding: 4px 12px 12px;
    gap: 2px;
  }
}

/* Base: pass-through wrapper so desktop layout is unchanged */
.detail-figure-wrap { display: contents; }

/* Photo hero — bleeds edge-to-edge */
.detail-img {
  width: calc(100% + 32px);
  max-height: 38vh;
  object-fit: contain;
  object-position: center bottom;
  background: transparent;
  display: block;
  margin: -16px -16px 0;
}

/* Hide "Items" section when no pieces tagged */
.detail-pieces-row:empty { display: none; }
.sheet-section-hdr:has(+ .detail-pieces-row:empty) { display: none; }

/* ── SECTION HEADERS ── */
.sheet-section-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 10px 12px 16px;
  border-bottom: none;
  margin: 0;
  background: var(--bg);
  min-height: 0;
}

/* Inner header row gives py:4px breathing room around title */
.sheet-section-hdr > * { padding-top: 4px; padding-bottom: 4px; }

.sheet-section-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.4px;
  color: var(--text-primary);
  line-height: 1;
}

/* Small icon button (pencil/edit in section header) */
.icon-btn-sm {
  background: transparent;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--motion-base) var(--ease-out);
}

.icon-btn-sm:hover { background: var(--surface); }

/* ── PIECES ROW (horizontal scroll) ── */
.detail-pieces-row {
  display: flex;
  flex-direction: row;
  gap: 16px;
  overflow-x: auto;
  padding: 12px;
  margin: 0;
  scrollbar-width: none;
}

.detail-pieces-row::-webkit-scrollbar { display: none; }

/* Override flatlay card styles inside pieces row */
.detail-pieces-row .outfit-item-card,
.detail-pieces-row .outfit-item-card.role-featured,
.detail-pieces-row .outfit-item-card.role-standard,
.detail-pieces-row .outfit-item-card.role-small {
  flex-shrink: 0;
  width: 120px;
  height: auto;
  background: transparent;
  border-radius: 0;
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: none;
}

.detail-pieces-row .outfit-item-card img {
  width: 120px;
  height: auto;
  object-fit: contain;
  padding: 0;
}

.detail-pieces-row .outfit-item-label {
  position: static;          /* flow below the image, not absolute over it */
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.2;
  color: var(--text-secondary);
  background: transparent;
  padding: 0;
  text-align: center;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.piece-name-input {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--brand);
  outline: none;
  text-align: center;
  width: 120px;
  padding: 0;
}

/* ── INFO ROWS ── */
.detail-info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.32px;
  margin: 0;
  min-height: 32px;
}

.detail-info-label {
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
  padding-top: 1px;
}

.detail-name-input {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.32px;
  color: var(--text-primary);
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  outline: none;
  flex: 1;
  padding: 0;
  min-width: 0;
  transition: border-color var(--motion-base) var(--ease-out);
}

.detail-name-input:focus { border-bottom-color: var(--brand); }
.detail-name-input::placeholder { color: var(--text-secondary); }

.detail-name-wrap {
  padding: 8px 16px 4px;
  display: flex;
  align-items: center;
}

/* Occasion wrap inside info row */
.detail-occ-wrap {
  flex: 1;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: center;
  min-width: 0;
}

/* Chips become direct flex participants in the wrap row */
.detail-occ-wrap .occ-options {
  display: contents;
}

/* ── DETAIL ACTIONS ── */
.detail-actions {
  padding: 12px 0 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.detail-edit-actions {
  padding: 12px 0 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

/* Hide + add occasion outside edit mode in Expand a Look */
.detail-edit-hidden { display: none !important; }

/* ── "+ tag items" link (replaces Tag Items pill) ── */
.tag-items-link {
  background: transparent;
  border: none;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  transition: color var(--motion-fast) var(--ease-out);
  align-self: flex-start;
}

.tag-items-link:hover { color: var(--text-primary); }

/* ── Heart button ── */
.detail-heart-btn {
  background: transparent;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: color var(--motion-fast) var(--ease-out), transform var(--motion-fast) var(--ease-spring);
}

.detail-heart-btn:hover { color: var(--danger); }
.detail-heart-btn.saved { color: var(--danger); }
.detail-heart-btn:active { transform: scale(0.85); }

/* ── Kebab menu (⋯) ── */
.detail-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  margin-left: auto;
  padding-right: 4px;
}

.detail-kebab-btn {
  background: transparent;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: background var(--motion-fast) var(--ease-out);
  letter-spacing: 0.1em;
  line-height: 1;
}

.detail-kebab-btn:hover { background: var(--surface); color: var(--text-primary); }

/* Kebab at top-right of the panel */
.detail-panel-kebab {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 5;
}

.detail-kebab-wrap {
  position: relative;
}

.detail-kebab-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  bottom: auto;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  min-width: 120px;
  overflow: hidden;
  z-index: 10;
  animation: fadeIn var(--motion-fast) var(--ease-out) both;
}

.kebab-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: transparent;
  border: none;
  text-align: left;
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  transition: background var(--motion-fast) var(--ease-out);
}

.kebab-item:hover { background: var(--surface); }

.kebab-item.danger {
  color: var(--danger);
}


/* Delete button — danger text, Figma: h:32 w:63 rounded-16 Cormorant 16px */
.delete-btn {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.32px;
  color: var(--danger);
  background: transparent;
  border: none;
  cursor: pointer;
  height: 32px;
  width: 63px;
  padding: 9px 12px;
  border-radius: 16px;
  transition: opacity var(--motion-base) var(--ease-out);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.delete-btn:hover { opacity: 0.7; }



/* ── INLINE ADD ── */
.inline-add-trigger {
  /* Design-system "link" button (Figma 238:372) — borderless serif text link */
  background: transparent;
  border: none;
  border-radius: 6px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.28px;
  color: var(--text-primary);
  cursor: pointer;
  height: 32px;
  min-width: 56px;
  padding: 0 12px 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  white-space: nowrap;
  transition: opacity var(--motion-fast) var(--ease-out);
  flex-shrink: 0;
}

.inline-add-trigger:hover { opacity: 0.65; }

.inline-add-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}

.inline-add-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--text-primary);
  background: var(--bg);
  outline: none;
  transition: border-color var(--motion-base) var(--ease-out);
}

.inline-add-input:focus { border-color: var(--brand); }

.inline-add-confirm {
  position: relative;
  background: var(--bg-30);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  height: 36px;
  padding: 0 14px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.02em;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: inset 0 1.5px 3px rgba(138,138,138,0.2), inset 0 -3px 10px rgba(138,138,138,0.2);
  transition: background var(--motion-base) var(--ease-out);
}

.inline-add-confirm:hover { background: rgba(255,255,255,0.6); }

/* ── OCCASIONS ── */
/* Small label above occasion chips */
.occasion-label {
  display: block;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
  margin-bottom: 4px;
  letter-spacing: 0.01em;
}

.occasion-picker {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

/* occ-pill is an alias for .chip — see canonical definition below */
.occ-pill.active {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: var(--bg);
}

.occ-options {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
}

/* Expand a Look: show only the selected occasion chip in view mode */
#detailOccasionChips .chip:not(.selected) { display: none; }
#detailOccasionChips .chip.selected {
  background: var(--border-light);
  border-color: var(--border-light);
  color: var(--text-primary);
  font-weight: 400;
}

/* Edit mode: show ALL chips, selected one goes dark */
#outfitDetailModal.is-editing #detailOccasionChips .chip { display: inline-flex; }
#outfitDetailModal.is-editing #detailOccasionChips .chip.selected {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: var(--bg);
  font-weight: 500;
}

/* Piece × remove button — hidden by default, shown in edit mode */
.piece-remove-btn {
  display: none;
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-primary);
  color: var(--bg);
  border: none;
  cursor: pointer;
  font-size: 11px;
  font-family: var(--font-body);
  line-height: 1;
  padding: 0;
  align-items: center;
  justify-content: center;
  z-index: 2;
  flex-shrink: 0;
  transition: background var(--motion-fast) var(--ease-out);
}

.piece-remove-btn:hover { background: var(--danger); }

#outfitDetailModal.is-editing .piece-remove-btn { display: flex; }







/* ── MODAL TITLE ROW ── */
.modal-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0 12px;
  margin-bottom: 0;
}

.modal-title-row .modal-title {
  margin-bottom: 0;
}



@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}



/* ── STYLE RULES MODAL ── */
.rules-toggles {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.rule-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.rule-toggle-info { flex: 1; }

.rule-toggle-label {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: 2px;
}

.rule-toggle-sub {
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.toggle-btn {
  width: 44px;
  height: 24px;
  border-radius: var(--radius-pill);
  background: var(--border);
  border: none;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: background var(--motion-base) var(--ease-out);
}

.toggle-btn::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg);
  transition: transform var(--motion-base) var(--ease-spring);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.toggle-btn[aria-checked="true"] {
  background: var(--brand);
}

.toggle-btn[aria-checked="true"]::after {
  transform: translateX(20px);
}

.rules-section-label {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.rules-notes {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rule-note {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-primary);
  transition: border-color var(--motion-base) var(--ease-out);
}

.rule-note:hover { border-color: var(--border); }

.rule-note-text { flex: 1; }

.rule-note-del {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all var(--motion-base) var(--ease-out);
  flex-shrink: 0;
  line-height: 1;
}

.rule-note-del:hover {
  color: #c62828;
  background: #fff5f5;
}

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: var(--text-primary);
  color: var(--bg);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 400;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  z-index: 500;
  box-shadow: 0 8px 24px rgba(26,26,26,0.2);
  letter-spacing: 0.02em;
  transition: opacity var(--motion-slow) var(--ease-out), transform var(--motion-slow) var(--ease-out);
  pointer-events: none;
}

.toast.error {
  background: var(--danger);
}

.toast.warning {
  background: var(--warning);
}

.toast.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
  pointer-events: none;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

/* ── SIGN IN ── */
.signin-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.signin-box {
  text-align: center;
  max-width: 340px;
  width: 100%;
}

.signin-logo {
  font-family: var(--font-display);
  font-size: 52px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--text-primary);
  display: block;
  margin-bottom: 12px;
}
.signin-logo img { height: 46px; width: auto; display: block; margin: 0 auto; }

.signin-sub {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
  font-style: italic;
  color: var(--text-secondary);
  margin-bottom: 48px;
  line-height: 1.4;
}

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 14px 20px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--motion-base) var(--ease-out);
  margin-bottom: 16px;
}

.google-btn:hover {
  border-color: var(--brand);
  background: var(--surface);
}

.signin-note {
  font-size: 12px;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

/* ── MOBILE (≤767px): bottom sheets ── */
@media (max-width: 767px) {
  /* Header — Figma: px-14 py-24 → 24+40+24=88px total (241:568) */
  .header-inner { height: auto; padding: 24px 14px; }
  .logo { font-size: 20px; letter-spacing: -0.4px; }
  .logo img { height: 20px; }
  .btn-pill { font-size: 16px; height: 40px; padding: 0 16px; }
  .icon-btn { width: 40px; height: 40px; }
  .btn-fab {
    width: 48px; height: 48px;
    bottom: 64px;
    right: 20px;
  }

  /* Grid — Figma: grid starts 9px below 88px header (241:568) */
  .outfits-grid { padding: 9px 14px 120px; }
  .wardrobe-section { padding: 0; }
  /* Category bar pins under the 88px mobile header */
  .wardrobe-filter { top: 88px; margin-top: 0; padding: 10px 14px; }

  /* Chip font-size on mobile: 12px (mobile/p2), not the global 14px */

  /* Full-screen takeover — hide wardrobe grid when any modal/sheet is open */
  body:has(#outfitDetailModal:not(.hidden)) #outfitsSection,
  body:has(#outfitUploadModal:not(.hidden)) #outfitsSection,
  body:has(#suggestionPanel:not(.hidden)) #outfitsSection { display: none; }

  /* ══════════════════════════════════════════
     MOBILE MODAL SYSTEM — full-screen takeover
     Figure/preview: top 55% of viewport
     Bottom sheet: bottom 45%, slides up
     ══════════════════════════════════════════ */

  /* Overlay is transparent — no dim, no backdrop blur */
  .modal-overlay {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 0;
    align-items: flex-end;
  }

  /* Hide the sticky header when any sheet is open */
  body:has(#outfitDetailModal:not(.hidden)) .header,
  body:has(#outfitUploadModal:not(.hidden)) .header,
  body:has(#suggestionPanel:not(.hidden)) .header { display: none; }

  /* Bottom sheet card — all sheets capped at 50vh, no internal scroll */
  .modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 50vh;
    border-radius: 24px 24px 0 0;
    background: var(--bg);
    box-shadow: 0px -16px 48px -4px rgba(57, 57, 57, 0.18);
    padding: 0 20px max(24px, env(safe-area-inset-bottom));
    animation: sheetUp var(--motion-fast) var(--ease-out) both;
    overflow: hidden;
    gap: 6px;
    z-index: 201;
  }

  /* suggestion-panel: overflow:visible so flatlay can float above */
  .modal.suggestion-panel {
    overflow: visible;
  }

  /* Log a Look: same 50vh cap, keep overflow:visible for photo-wrap */
  #outfitUploadModal .modal {
    overflow: visible;
  }

  /* Expand a Look: grow to fit content, scroll internally if it gets tall */
  .modal-detail {
    max-height: 88vh;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  /* Figure sits behind the sheet; keep the photo in the upper area in edit mode */
  #outfitDetailModal.is-editing .detail-figure-wrap {
    bottom: 60vh;
  }

  /* Drag handle pill */
  .modal::before {
    content: '';
    display: block;
    flex-shrink: 0;
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 8px auto 0;
  }

  /* ── FIGURE AREA (top 55%) ── */
  /*
     All three figure elements are now DOM siblings of their .modal (not inside it),
     so position:fixed works correctly — no iOS overflow containing-block issue.
  */

  /* Expand a look: wrapper fills space above the sheet, flex-centers the figure */
  #outfitDetailModal .detail-figure-wrap {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 50vh;
    padding: 16px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
  }
  #outfitDetailModal .detail-img {
    position: static;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 100%;
    object-fit: contain;
    background: transparent;
    margin: 0;
  }

  /* Log a look: photo-wrap inside .modal — absolute bottom:100% floats it above the sheet */
  #outfitUploadModal .outfit-photo-wrap {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    width: 100%;
    height: 59vh; /* Figma 274:2024: figure area = 59vh */
    aspect-ratio: auto;
    border-radius: 0;
    background: transparent;
    margin: 0;
    z-index: 1;
  }
  /* Allow absolute photo-wrap to overflow above the bottom sheet */
  #outfitUploadModal .modal {
    overflow: visible;
  }

  /* Today's Look: flatlay floats above the fixed bottom sheet via absolute positioning.
     The modal is position:fixed (bottom:0, 45vh). bottom:100% places the flatlay
     immediately above it, covering the top 55vh of the viewport. */
  .suggestion-panel .suggestion-flatlay {
    display: flex;
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    height: 55vh;
    border-radius: 0;
    background: transparent;
    align-items: center;
    justify-content: center;
    width: auto;
    min-height: 0;
    z-index: 1;
  }
  .suggestion-panel .outfit-flatlay {
    background: transparent;
    border-radius: 0;
    overflow: visible;
    margin: 0 auto;
    width: min(80vw, 320px);
  }

  /* ── BACK ARROW — fixed top-left, always tappable ── */
  .modal-close:not(.hidden) {
    display: flex;
    position: fixed;
    top: max(56px, calc(env(safe-area-inset-top) + 16px));
    left: 16px;
    z-index: 210;
    right: auto;
    bottom: auto;
    width: 40px;
    height: 40px;
    font-size: 0; /* hide ✕ text */
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-pill);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    cursor: pointer;
  }

  /* CSS ← chevron */
  .modal-close::before {
    content: '';
    display: block;
    width: 9px;
    height: 9px;
    border-left: 2px solid var(--text-primary);
    border-bottom: 2px solid var(--text-primary);
    transform: rotate(45deg) translate(2px, -2px);
    flex-shrink: 0;
  }

  /* Detail columns stack vertically on mobile */
  #outfitDetailModal .detail-left,
  #outfitDetailModal .detail-right { width: 100%; }

  /* Log a Look mobile: transparent figure area, hide redundant header Done btn */
  #outfitUploadModal .outfit-photo-wrap { background: transparent; }
  #outfitUploadModal .log-done-btn { display: none; }
  /* Ensure sheet has horizontal padding */
  #outfitUploadModal .modal { padding: 0 20px max(24px, env(safe-area-inset-bottom)); }

  /* Typography */
  .modal-title { font-size: 16px; }
  /* Note: .modal-detail min/max-height now set per-spec above */
  .text-input { font-size: 12px; padding: 12px 16px; }
  .save-btn { font-size: 16px; height: 40px; }

  /* Title row divider on mobile */
  .modal-title-row {
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
    margin-bottom: 4px;
  }

  /* + Add Occasion: inherit inline layout on mobile */

  /* Today's Look — sheet title: Cormorant 16px (mobile/h2), divider below */
  .suggestion-title { font-size: 16px; }
  /* Input inside Today's Look uses 14px text (desktop/p2 per Figma 241:1079) */
  .suggestion-panel .text-input { font-size: 14px; }
  /* Both Save + Try another use mobile default button size (Figma: 16px Cormorant) */
  .save-btn.outline { font-size: 16px; height: 40px; }
  /* Hide close/rules btns in Today's Look sheet on mobile — backdrop closes */
  .suggestion-header-actions { display: none; }
  /* Sheet header divider line on mobile — subtle, not harsh */
  .suggestion-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding-bottom: 12px;
  }


  /* Occasion label in Log a Look: mobile/p2 = 12px Manrope Medium */
  .occasion-section-label { font-size: 12px; }

  /* Expand a Look — natural-flow spacing (sheet scrolls if tall) */
  .detail-pieces-row { padding: 6px 2px; gap: 16px; }
  .detail-pieces-row .outfit-item-card { width: 72px; }
  .detail-pieces-row .outfit-item-card img { width: 72px; }
  .detail-pieces-row .outfit-item-label { font-size: 11px; max-width: 72px; }
  .sheet-section-hdr { padding: 8px 0; }
  /* Name input gets its own row so it can't overlap the chips below */
  #outfitDetailModal .detail-name-wrap { padding: 6px 0 8px; }
  #outfitDetailModal .detail-name-input { min-height: 22px; line-height: 22px; }
  #outfitDetailModal .detail-info-row { min-height: 28px; padding: 4px 0; }
  #outfitDetailModal .detail-occ-row { min-height: 44px; padding: 6px 0 8px; }
  #outfitDetailModal .detail-actions { padding: 8px 0; gap: 4px; }

  /* Expand a Look info rows: mobile/p1 = Manrope Medium 14px (241:956) */
  .detail-info-row { font-size: 14px; }

  /* Toast */
  .toast {
    bottom: max(24px, env(safe-area-inset-bottom));
    left: 16px; right: 16px;
    width: auto;
    transform: translateY(0);
    text-align: center;
  }
  .toast.hidden { transform: translateY(8px); }
}



/* ── UPLOAD PHOTO WRAP ── */
.outfit-photo-wrap {
  width: 100%;
  aspect-ratio: 2/3;
  max-height: 44vh;
  background: var(--bg); /* white — Figma shows no beige background */
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.outfit-photo-preview {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

.outfit-processing-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
}

/* ── COVE LOGO LOADER (background-removal wait) ── */
.cove-loader-mark {
  position: relative;
  width: 120px;
  aspect-ratio: 676 / 280;          /* logo native ratio */
  animation: coveBreathe 2.2s var(--ease-out) infinite;
  filter: drop-shadow(0 6px 18px rgba(232, 122, 224, 0.32));
}
.cove-loader-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
@keyframes coveBreathe {
  0%, 100% { transform: scale(1);     opacity: 0.82; }
  50%      { transform: scale(1.045); opacity: 1; }
}
/* Light sweep, shaped to the wordmark via the logo's own alpha mask */
@supports ((-webkit-mask-image: url("x")) or (mask-image: url("x"))) {
  .cove-loader-shine {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(100deg,
      transparent 38%, rgba(255,255,255,0.9) 50%, transparent 62%);
    background-size: 220% 100%;
    background-repeat: no-repeat;
    -webkit-mask: url("cove-logo.png?v=2") center / contain no-repeat;
            mask: url("cove-logo.png?v=2") center / contain no-repeat;
    animation: coveShine 1.9s ease-in-out infinite;
  }
}
@keyframes coveShine {
  0%   { background-position: 170% 0; }
  60%, 100% { background-position: -70% 0; }
}
#outfitProcessing #processingLabel { margin-top: 14px; }
@media (prefers-reduced-motion: reduce) {
  .cove-loader-mark, .cove-loader-shine { animation: none; }
}

/* Floating piece cards */
.piece-cards {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.piece-card {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 110px;
  pointer-events: auto;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 4px;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.piece-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 3px;
  background: var(--bg);
  box-shadow: inset 0 3px 3px rgba(255,153,255,0.1), inset 0 -3px 3px rgba(255,153,255,0.1);
}

.piece-card .pc-actions {
  display: flex;
  gap: 8px;
}

.piece-card .pc-btn {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: transform var(--motion-fast) var(--ease-out);
}

.piece-card .pc-btn:active { transform: scale(0.9); }

.piece-card .pc-confirm {
  background: var(--bg-30);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  box-shadow: inset 0 1.5px 3px rgba(138,138,138,0.2), inset 0 -3px 10px rgba(138,138,138,0.2);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.02em;
  width: auto;
  padding: 0 12px;
  height: 28px;
  border-radius: var(--radius-pill);
}
.piece-card .pc-refresh { background: var(--surface); color: var(--text-secondary); border: 1px solid var(--border-light); }

.piece-card .pc-close {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 28px;
  height: 28px;
  border-radius: 14px;
  background: rgba(255,255,255,0.3);
  border: 1px solid var(--border-light);
  cursor: pointer;
  font-size: 11px;
  font-family: var(--font-body);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.piece-card.generating {
  min-height: 48px;
  justify-content: center;
}

.piece-card.generating .pc-actions { display: none; }

.piece-card.generating::after {
  content: "…";
  font-size: 18px;
  color: var(--text-secondary);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 1; }
}

/* Naming list (stage 2) */
.naming-list {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.naming-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.naming-row img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.naming-row input {
  flex: 1;
  padding: 10px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color var(--motion-base) var(--ease-out);
}

.naming-row input:focus { border-color: var(--brand); }

.occasion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.chip,
.occ-pill {
  padding: 5px 16px 6px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-light);
  background: var(--border-light);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--motion-fast) var(--ease-out);
  user-select: none;
  white-space: nowrap;
  text-transform: capitalize;
}

.chip:hover,
.occ-pill:hover { opacity: 0.8; }

.chip.selected,
.occ-pill.active { background: var(--text-primary); color: var(--bg); border-color: var(--text-primary); }

/* Occasion label in detail modal */
.detail-occasion {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 2px;
  min-height: 16px;
}

/* Flatlay layout (Create-an-outfit output) */
.outfit-flatlay {
  position: relative;
  aspect-ratio: 4 / 5;
  width: 100%;
  background: #f1ede4;
  border-radius: var(--radius-md);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows:    repeat(8, 1fr);
  padding: 36px;
  gap: 12px;
  overflow: hidden;
}

.outfit-flatlay .fl-piece {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}

.outfit-flatlay .fl-piece img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 8px 12px rgba(0,0,0,0.08));
}

.outfit-flatlay .fl-top    { grid-column: 1 / span 4; grid-row: 1 / span 4; }
.outfit-flatlay .fl-bottom { grid-column: 1 / span 4; grid-row: 5 / span 3; }
.outfit-flatlay .fl-shoes  { grid-column: 1 / span 3; grid-row: 7 / span 2; }
.outfit-flatlay .fl-bag    { grid-column: 4 / span 3; grid-row: 7 / span 2; }
.outfit-flatlay .fl-scarf  { grid-column: 5 / span 2; grid-row: 1 / span 3; }
.outfit-flatlay .fl-extra  { grid-column: 5 / span 2; grid-row: 4 / span 2; }

/* ── MODEL WARMING BANNER ── */
.model-banner {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--bg);
  padding: 11px 20px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-family: var(--font-body);
  white-space: nowrap;
  z-index: 400;
  box-shadow: 0 8px 24px rgba(0,0,0,0.22);
  animation: fadeIn var(--motion-slow) var(--ease-out);
}

.model-banner-spinner {
  width: 14px !important;
  height: 14px !important;
  border-width: 2px !important;
  border-color: rgba(255,255,255,0.3) !important;
  border-top-color: var(--bg) !important;
  flex-shrink: 0;
}

/* ── OUTFIT BROWSE ROW (whole-look fallback in suggestion panel) ── */
.outfit-browse-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 8px 0 12px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.outfit-browse-row::-webkit-scrollbar { display: none; }

.browse-card {
  flex-shrink: 0;
  width: 120px;
  scroll-snap-align: start;
  cursor: pointer;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
  transition: transform var(--motion-fast) var(--ease-out);
}

.browse-card:active { transform: scale(0.96); }

.browse-card img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  display: block;
}

.browse-card-name {
  font-size: 11px;
  color: var(--text-secondary);
  padding: 4px 6px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── TAG PIECES BUTTON (in detail modal) ── */
.tag-pieces-btn {
  background: none;
  border: 1.5px solid var(--brand);
  color: var(--brand);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  padding: 9px 20px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background var(--motion-fast) var(--ease-out), color var(--motion-fast) var(--ease-out);
}
.tag-pieces-btn:hover {
  background: var(--brand);
  color: var(--bg);
}

/* ── TAG A LOOK MODAL (separate popup, above Expand a Look) ── */
#tagLookModal { z-index: 201; }

.tag-look-modal {
  width: 480px;
  max-width: 480px;
  padding: 0;
  gap: 0;
  border-radius: 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 88vh;
  box-shadow: 0px -16px 48px -4px rgba(57, 57, 57, 0.18);
  animation: modalFadeIn var(--motion-base) var(--ease-out) both;
}

/* Log a Look header — compact pill (desktop) */
.log-done-btn {
  width: auto;
  height: 36px;
  font-size: 16px;
  padding: 0 16px;
  flex-shrink: 0;
}

/* Tag a Look Done button — fixed top-right, mirrors the back arrow exactly */
.tag-look-done-fixed {
  position: fixed;
  top: max(56px, calc(env(safe-area-inset-top) + 16px));
  right: 16px;
  z-index: 210;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-primary);
  font-family: var(--font-body);
}

/* Header: title + close button */
.tag-look-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 12px 12px 20px;
  background: var(--surface);
}

.tag-look-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.4px;
  color: var(--text-primary);
  line-height: 1;
}

/* Desktop header action cluster — Done + X inside the modal */
.tag-look-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
}

.tag-look-hdr-actions {
  display: none; /* mobile: uses fixed siblings; shown on desktop below */
  align-items: center;
  gap: 4px;
}

/* Desktop Done button — same pill style as save-btn but compact */
.tag-look-done-desktop {
  width: auto;
  height: 36px;
  font-size: 16px;
  padding: 0 16px;
  flex-shrink: 0;
}

/* Desktop X close — plain ghost icon button */
.tag-look-close-desktop {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  font-size: 17px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--motion-fast) var(--ease-out);
  flex-shrink: 0;
}

.tag-look-close-desktop:hover {
  background: var(--surface);
  color: var(--text-primary);
}

/* Tag a Look desktop overrides — placed after base rules so cascade is correct */
@media (min-width: 768px) {
  /* Show in-header actions on desktop; hide the fixed mobile siblings */
  .tag-look-hdr-actions { display: flex; }
  /* Mobile fixed siblings not needed on desktop — keep them display:none */
  #tagLookClose { display: none; }
  #tagLookDoneBtn { display: none !important; }

  /* Figure: fixed 316px (overrides flex:1 from base) */
  .tag-look-figure {
    flex: none;
    height: 316px;
    min-height: 316px;
  }
}

/* Figure: fills all remaining space between header and footer */
.tag-look-figure {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: transparent; /* beige added for desktop only below */
  touch-action: none; /* let canvas handle all pointer events; stops iOS scroll interception */
}

@media (min-width: 768px) {
  .tag-look-figure {
    background: var(--surface);
  }
}

.tag-look-figure .tagging-hint { flex-shrink: 0; }

.tag-look-figure .tagging-canvas-wrap {
  flex: 1;
  min-height: 0;
}

/* Desktop: fix figure to Figma height (must come after flex:1 base rule above) */
@media (min-width: 768px) {
  .tag-look-figure {
    flex: none;
    height: 316px;
    min-height: 316px;
    padding-bottom: 16px;
  }
}

/* Information section (below figure) */
.tag-look-info {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  background: var(--bg);
}

.tag-look-item-name {
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Occasion label in upload modal (standalone paragraph, not in a row) */
.occasion-section-label {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.2;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* Legacy: kept for mobile compat */
.tag-look-footer {
  flex-shrink: 0;
  padding: 14px 20px 18px;
  background: var(--bg);
}

.tag-look-footer .save-btn { margin-top: 0; }

/* ── Mobile: full-screen takeover ── */
@media (max-width: 767px) {
  #tagLookModal {
    background: var(--bg);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 0;
    align-items: flex-start;
    z-index: 201;
  }

  .tag-look-modal {
    width: 100%;
    max-width: 100%;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
    overflow-y: auto;
  }

  /* On mobile .modal-close becomes the fixed back arrow via the global rule */
  .tag-look-modal .suggestion-header {
    height: max(56px, calc(env(safe-area-inset-top) + 44px));
    padding: 0;
    justify-content: center;
  }

  /* Tag a Look figure area: transparent on mobile (graph paper bg shows through) */
  .tag-look-figure {
    background: transparent;
  }

  .tag-look-footer {
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }
}

/* ── TAGGING MODAL (full-height sheet from bottom) ── */
.tagging-overlay {
  align-items: flex-end;
  padding: 0;
}

.tagging-sheet {
  width: 100%;
  max-width: 480px;
  height: 92vh;
  background: var(--bg);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tagging-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.tagging-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.tagging-action-btn {
  background: none;
  border: none;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.02em;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 6px 4px;
  min-width: 56px;
}

.tagging-action-accent {
  color: var(--brand);
  text-align: right;
}

.tagging-hint {
  text-align: center;
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 10px 16px 6px;
  flex-shrink: 0;
}

.tagging-stage {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.tagging-canvas-wrap {
  position: relative;
  flex: 1;
  background: var(--surface);
  overflow: hidden;
  min-height: 0;
  touch-action: none;
}

.tagging-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none; /* taps captured by wrap */
}

/* Piece card — name input + save (tagging mode) */
.piece-card .pc-name-input {
  width: 100%;
  box-sizing: border-box;
  font-size: 10px;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 3px 5px;
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg);
  outline: none;
}
.piece-card .pc-name-input:focus { border-color: var(--text-primary); }

.piece-card .pc-save {
  width: 100%;
  height: 22px;
  background: var(--text-primary);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 10px;
  font-family: var(--font-body);
  font-weight: 500;
  transition: opacity var(--motion-fast) var(--ease-out);
}
.piece-card .pc-save:hover { opacity: 0.8; }
.piece-card .pc-save:disabled { opacity: 0.4; cursor: not-allowed; }
