/* What To Wear: editorial fashion aesthetic
   Display: Fraunces. Body: Geist. Palette: cream, bone, ink. */

:root {
  --cream: #f5efe6;
  --bone: #ece4d6;
  --paper: #fbf8f3;
  --ink: #16130f;
  --soot: #2a2520;
  --stone: #8a8278;
  --mist: #c9c2b6;
  --line: #d9d0c1;
  --gold: #b08a4a;
  --signal: #7c3a2e;
  --radius: 18px;
  --radius-sm: 10px;
  --shadow-card: 0 1px 2px rgba(22, 19, 15, 0.04), 0 12px 32px rgba(22, 19, 15, 0.06);
  --shadow-pop: 0 8px 24px rgba(22, 19, 15, 0.12);
  --tab-height: 76px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: 'Geist', system-ui, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
}

img { display: block; max-width: 100%; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, select {
  font-family: inherit;
  font-size: 16px;
  color: var(--ink);
}

.hidden { display: none !important; }

.view { display: none; }
.view.active { display: block; }

/* LOGIN */
.login-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 10%, rgba(176, 138, 74, 0.08), transparent 50%),
    radial-gradient(circle at 80% 90%, rgba(124, 58, 46, 0.05), transparent 50%),
    var(--cream);
}

.brand {
  text-align: center;
  margin-bottom: 36px;
}

.brand-mark {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--ink);
  color: var(--cream);
  display: grid;
  place-items: center;
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 32px;
  margin: 0 auto 18px;
  letter-spacing: -0.02em;
}

.brand-name {
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: 36px;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}

.brand-tag {
  margin: 0;
  color: var(--stone);
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: 0.02em;
  max-width: 320px;
}

.login-form {
  width: 100%;
  max-width: 360px;
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field > span {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--stone);
  font-weight: 500;
}

.field input,
.field select {
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--ink);
  background: white;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.btn-primary {
  background: var(--ink);
  color: var(--cream);
  padding: 14px 22px;
  border-radius: 999px;
  font-weight: 500;
  letter-spacing: 0.02em;
  font-size: 15px;
  transition: transform 0.1s ease, background 0.15s ease;
}

.btn-primary:hover { background: var(--soot); }
.btn-primary:active { transform: scale(0.98); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 14px;
  font-weight: 500;
}

.btn-ghost:hover { background: var(--bone); }
.btn-ghost.full { width: 100%; margin-top: 16px; }

.form-error {
  color: var(--signal);
  font-size: 14px;
  margin: 0;
  min-height: 1em;
}

/* APP SHELL */
.app {
  max-width: 720px;
  margin: 0 auto;
  padding: max(env(safe-area-inset-top), 24px) 20px calc(var(--tab-height) + env(safe-area-inset-bottom) + 24px);
}

.app.hidden { display: none; }

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
  padding-top: 8px;
}

.eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--stone);
  margin: 0 0 4px;
  font-weight: 500;
}

.page-title {
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: 32px;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.05;
}

/* TODAY CARDS */
.occasion-row {
  margin: -8px 0 20px;
}

.occasion-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0;
  scrollbar-width: none;
}
.occasion-chips::-webkit-scrollbar { display: none; }

.occ-chip {
  padding: 9px 16px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--soot);
  font-size: 13px;
  white-space: nowrap;
  font-weight: 500;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}

.occ-chip:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.occ-chip-other {
  background: var(--ink);
  color: var(--cream);
  border-color: var(--ink);
}

.occ-chip-other:hover {
  background: var(--soot);
  border-color: var(--soot);
  color: var(--cream);
}

#occasion-input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 16px;
  resize: none;
  color: var(--ink);
}

#occasion-input:focus {
  outline: none;
  border-color: var(--ink);
  background: white;
}

.occasion-interpretation {
  background: var(--bone);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--soot);
  line-height: 1.5;
}

.occasion-interpretation strong {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--stone);
  font-weight: 500;
  margin-bottom: 4px;
}

.occasion-outfit {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease;
}

.occasion-outfit:active { transform: scale(0.99); }

.occasion-outfit-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}

.occasion-outfit-label {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.occasion-outfit-rule {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--gold);
  font-weight: 500;
}

.occasion-outfit-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
  margin-bottom: 12px;
}

.occasion-outfit-strip > div {
  aspect-ratio: 3 / 4;
  background: var(--bone);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.occasion-outfit-strip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.occasion-outfit-reason {
  font-size: 13px;
  line-height: 1.5;
  color: var(--soot);
  margin: 0;
}

.today-cards {
  display: grid;
  gap: 20px;
}

.outfit-card {
  background: var(--paper);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: rise 0.5s ease both;
}

.outfit-card:nth-child(2) { animation-delay: 0.08s; }
.outfit-card:nth-child(3) { animation-delay: 0.16s; }

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

.outfit-card:active { transform: scale(0.99); }

.outfit-card-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}

.outfit-card-label .style-name {
  font-family: 'Fraunces', serif;
  font-size: 22px;
  letter-spacing: -0.01em;
}

.outfit-card-label .style-tag {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--stone);
}

.outfit-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 1px;
  background: var(--line);
  min-height: 180px;
}

.outfit-strip .strip-cell {
  background: var(--bone);
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
}

.outfit-strip .strip-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.outfit-card-summary {
  padding: 16px 20px 20px;
}

.outfit-card-summary p {
  margin: 0;
  color: var(--soot);
  font-size: 14px;
  line-height: 1.5;
}

.color-rule-badge {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 500;
  color: var(--gold);
  border: 1px solid var(--gold);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.outfit-card-bring-back {
  border: 1px solid var(--gold);
}

.outfit-card-bring-back .outfit-card-label .style-name {
  color: var(--gold);
}

.color-rule-card {
  background: var(--bone);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.color-rule-name {
  font-family: 'Fraunces', serif;
  font-size: 18px;
  letter-spacing: -0.01em;
  text-transform: capitalize;
}

.color-rule-def {
  font-size: 13px;
  color: var(--soot);
  line-height: 1.5;
}

/* WARDROBE */
.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 18px;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.filter-row::-webkit-scrollbar { display: none; }

.chip {
  padding: 8px 14px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--soot);
  font-size: 13px;
  white-space: nowrap;
  font-weight: 500;
}

.chip.active {
  background: var(--ink);
  color: var(--cream);
  border-color: var(--ink);
}

.chip-review { display: flex; align-items: center; gap: 6px; }
.chip-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--gold); color: var(--cream); font-size: 10px; font-weight: 600; }
.chip.active .chip-badge { background: var(--cream); color: var(--ink); }
.chip-review[data-hidden="true"] { display: none; }

.upload-options {
  display: grid;
  gap: 12px;
}

.upload-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  background: var(--paper);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.upload-option:hover {
  border-color: var(--ink);
  background: white;
}

.upload-option-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--bone);
  display: grid;
  place-items: center;
  color: var(--ink);
  flex-shrink: 0;
}

.upload-option-icon svg { width: 22px; height: 22px; }

.upload-option strong {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 17px;
  display: block;
  margin-bottom: 2px;
}

.upload-option small {
  font-size: 12px;
  color: var(--stone);
}

.bulk-status {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}

.bulk-progress {
  width: 100%;
  height: 6px;
  background: var(--bone);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}

.bulk-progress-bar {
  width: 0%;
  height: 100%;
  background: var(--ink);
  transition: width 0.3s ease;
}

.bulk-detail {
  font-size: 13px;
  color: var(--stone);
  margin: 0 0 20px;
}

.bulk-thumbs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.bulk-thumbs .bulk-thumb {
  aspect-ratio: 3 / 4;
  background: var(--bone);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

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

.bulk-thumbs .bulk-thumb.done::after {
  content: "✓";
  position: absolute;
  inset: 0;
  background: rgba(22, 19, 15, 0.55);
  color: var(--cream);
  display: grid;
  place-items: center;
  font-size: 18px;
}

.bulk-thumbs .bulk-thumb.failed::after {
  content: "!";
  position: absolute;
  inset: 0;
  background: rgba(124, 58, 46, 0.7);
  color: var(--cream);
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 600;
}

.item-tile-review-flag {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--gold);
  color: var(--cream);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  padding: 3px 7px;
  border-radius: 999px;
  font-weight: 600;
}

/* Photo guide */
.guide-tip {
  display: flex;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.guide-tip:first-of-type { padding-top: 8px; }

.guide-tip-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--bone);
  display: grid;
  place-items: center;
  color: var(--ink);
  flex-shrink: 0;
}

.guide-tip-icon svg { width: 26px; height: 26px; }

.guide-tip strong {
  display: block;
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 16px;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.guide-tip p {
  margin: 0;
  font-size: 13px;
  color: var(--soot);
  line-height: 1.5;
}

.rack-recommendation {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
  margin: 20px 0 0;
  background: var(--bone);
  border-radius: var(--radius);
}

.rack-rec-art {
  width: 60px;
  height: 80px;
  flex-shrink: 0;
  color: var(--soot);
}

.rack-rec-art svg { width: 100%; height: 100%; }

.rack-rec-text strong {
  display: block;
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 15px;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.rack-rec-text p {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--soot);
  line-height: 1.5;
}

.rack-rec-link {
  font-size: 12px;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 500;
}

.setting-row-tappable {
  cursor: pointer;
}

.setting-row-tappable:hover {
  background: var(--bone);
  margin: 0 -20px;
  padding-left: 20px;
  padding-right: 20px;
}

.setting-link {
  color: var(--gold);
  font-size: 13px;
  font-weight: 500;
}

.wardrobe-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 600px) {
  .wardrobe-grid { grid-template-columns: repeat(3, 1fr); }
}

.item-tile {
  background: var(--paper);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.item-tile:active { transform: scale(0.98); }

.item-tile-img {
  aspect-ratio: 3 / 4;
  background: var(--bone);
  overflow: hidden;
  position: relative;
}

.item-tile-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-tile-fav {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(251, 248, 243, 0.9);
  display: grid;
  place-items: center;
  font-size: 14px;
}

.item-tile-meta {
  padding: 10px 12px 12px;
}

.item-tile-meta .item-name {
  font-size: 14px;
  font-weight: 500;
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-tile-meta .item-sub {
  font-size: 12px;
  color: var(--stone);
  text-transform: capitalize;
  margin: 0;
}

/* HISTORY */
.history-list {
  display: grid;
  gap: 16px;
}

.history-card {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-card);
  display: grid;
  gap: 12px;
  cursor: pointer;
}

.history-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.history-card-head .date {
  font-family: 'Fraunces', serif;
  font-size: 18px;
}

.history-card-head .cat {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--stone);
}

.history-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
}

.history-strip .mini {
  aspect-ratio: 3 / 4;
  background: var(--bone);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.history-strip .mini img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* SETTINGS */
.settings-card {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 4px 20px;
  box-shadow: var(--shadow-card);
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}

.setting-row:last-child { border-bottom: none; }

.setting-row strong {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 20px;
}

.settings-note {
  color: var(--stone);
  font-size: 13px;
  text-align: center;
  margin: 24px 0 0;
  line-height: 1.5;
}

.body-photo-section {
  margin-top: 32px;
  padding: 20px;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.section-heading {
  font-family: 'Fraunces', serif;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
}

.section-sub {
  font-size: 13px;
  color: var(--stone);
  line-height: 1.5;
  margin: 0 0 16px;
}

.body-photo-display {
  display: flex;
  gap: 16px;
  align-items: center;
}

.body-photo-thumb {
  width: 90px;
  height: 120px;
  border-radius: var(--radius-sm);
  background: var(--bone);
  overflow: hidden;
  flex-shrink: 0;
}

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

.body-photo-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.body-photo-actions button {
  font-size: 13px;
  padding: 8px 14px;
}

.see-with-you {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.see-with-you-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--stone);
  margin: 0 0 12px;
  font-weight: 500;
}

.see-with-you-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.see-with-you-me {
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-sm);
  background: var(--bone);
  overflow: hidden;
}

.see-with-you-me img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.see-with-you-pieces {
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  gap: 6px;
}

.see-with-you-pieces > div {
  background: var(--bone);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}

.see-with-you-pieces img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.see-with-you-empty {
  background: var(--bone);
  border-radius: var(--radius-sm);
  padding: 18px;
  text-align: center;
  font-size: 13px;
  color: var(--soot);
  line-height: 1.5;
}

.see-with-you-empty button {
  margin-top: 10px;
  font-size: 13px;
  padding: 8px 14px;
}

/* EMPTY / LOADING */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.empty-title {
  font-family: 'Fraunces', serif;
  font-size: 24px;
  margin: 0 0 8px;
}

.empty-sub {
  color: var(--stone);
  margin: 0 0 20px;
  font-size: 15px;
}

.empty-divider {
  margin: 16px 0 12px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--stone);
}

.stylist-card {
  margin-top: 28px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

@media (min-width: 540px) {
  .stylist-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.stylist-card-title {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.stylist-card-sub {
  font-size: 13px;
  color: var(--soot);
  line-height: 1.5;
  margin: 0;
}

.stylist-card .btn-ghost {
  white-space: nowrap;
  align-self: flex-start;
}

.loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--stone);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--line);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

/* TAB BAR */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(251, 248, 243, 0.92);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 100;
  height: var(--tab-height);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px;
  color: var(--stone);
  font-size: 11px;
  letter-spacing: 0.04em;
  transition: color 0.15s ease;
}

.tab svg {
  width: 22px;
  height: 22px;
}

.tab.active { color: var(--ink); }

/* MODAL */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(22, 19, 15, 0.4);
  z-index: 200;
  display: grid;
  align-items: end;
  animation: fade 0.2s ease;
}

@media (min-width: 700px) {
  .modal { align-items: center; justify-content: center; padding: 24px; }
}

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

.modal.hidden { display: none; }

.modal-sheet {
  background: var(--cream);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  overflow-y: auto;
  animation: slideUp 0.25s ease;
}

@media (min-width: 700px) {
  .modal-sheet { border-radius: 24px; max-height: 86dvh; }
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--cream);
  z-index: 1;
}

.modal-header h3 {
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: 22px;
  margin: 0;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bone);
  color: var(--soot);
  font-size: 20px;
  line-height: 1;
}

.modal-body {
  padding: 20px 24px 28px;
}

.modal-hint {
  color: var(--stone);
  font-size: 14px;
  margin: 0 0 16px;
}

.file-drop {
  display: block;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 36px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.file-drop:hover {
  border-color: var(--ink);
  background: white;
}

.file-drop input { display: none; }

.file-drop-inner strong {
  display: block;
  font-family: 'Fraunces', serif;
  font-size: 20px;
  margin-bottom: 4px;
}

.file-drop-inner small {
  color: var(--stone);
  font-size: 13px;
}

.preview-image {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--bone);
  margin-bottom: 16px;
}

.analyzing {
  text-align: center;
  color: var(--stone);
  padding: 20px;
}

.confirm-form {
  display: grid;
  gap: 14px;
}

/* OUTFIT DETAIL */
.outfit-detail-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.outfit-detail-strip > div {
  aspect-ratio: 3 / 4;
  background: var(--bone);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.outfit-detail-strip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.outfit-reason h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--stone);
  margin: 18px 0 6px;
  font-weight: 500;
}

.outfit-reason p {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--soot);
}

.outfit-pieces {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}

.piece-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px;
  background: var(--paper);
  border-radius: var(--radius-sm);
}

.piece-row img {
  width: 50px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--bone);
}

.piece-row .piece-name {
  font-size: 14px;
  font-weight: 500;
  margin: 0 0 2px;
}

.piece-row .piece-meta {
  font-size: 12px;
  color: var(--stone);
  margin: 0;
  text-transform: capitalize;
}

.outfit-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

.outfit-actions .btn-primary,
.outfit-actions .btn-ghost {
  flex: 1;
}

/* ITEM DETAIL */
.item-detail-img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: var(--bone);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.item-detail-meta {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.meta-row .label {
  color: var(--stone);
}

.meta-row .value {
  font-weight: 500;
  text-transform: capitalize;
}

.item-actions {
  display: flex;
  gap: 10px;
}

.item-actions button { flex: 1; }

.btn-danger {
  background: transparent;
  color: var(--signal);
  border: 1px solid var(--signal);
  padding: 12px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 14px;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: calc(var(--tab-height) + 20px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--cream);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 300;
  box-shadow: var(--shadow-pop);
  animation: toastIn 0.25s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
