/* Closet: light Apple. Tokens from design/mockup/*.dc.html. One accent per screen. */
:root {
  --ground: #F5F5F7;
  --surface: #FFFFFF;
  --ink: #1D1D1F;
  --ink-2: #6E6E73;
  --ink-3: #3A3A3C;
  --hair: rgba(0, 0, 0, 0.08);
  --accent: #345A9B;
  --accent-ink: #26457A;
  --accent-soft: #EAF0F8;
  --fill: #E8E8ED;
  --fill-2: #F0F0F2;
  --track: #E2E2E7;
  --danger: #D93A2F;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, monospace;
  --tabbar: calc(49px + max(34px, env(safe-area-inset-bottom)));
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; cursor: pointer; color: inherit; }
a { color: var(--accent); }
img { display: block; }
input, select { font: inherit; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Screen frame */
.screen {
  max-width: 430px;
  margin: 0 auto;
  padding: max(54px, calc(env(safe-area-inset-top) + 10px)) 16px calc(var(--tabbar) + 24px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100vh;
}
.screen.loose { gap: 14px; }

/* Large title header */
.hdr { display: flex; justify-content: space-between; align-items: flex-end; height: 62px; flex: none; }
.hdr-left { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--ink-2); letter-spacing: 0.2px; display: flex; align-items: center; gap: 6px; }
.large-title { margin: 0; font-size: 34px; line-height: 40px; font-weight: 700; letter-spacing: -0.6px; }
.hdr-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; padding-bottom: 4px; min-width: 0; }
.temps { font-size: 22px; font-weight: 600; letter-spacing: -0.3px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.temps span { color: var(--ink-2); font-weight: 500; }
.wx { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.icon-btn { border: 0; background: none; padding: 0; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); border-radius: 11px; position: relative; }
.icon-btn::after { content: ''; position: absolute; inset: -11px; }
.icon-btn:active { background: var(--fill); }
.icon-btn.spin svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pill-btn { border: 0; height: 32px; padding: 0 14px; border-radius: 16px; background: var(--fill); color: var(--ink); font-size: 14px; font-weight: 600; margin-bottom: 4px; white-space: nowrap; }

/* Grouped rows */
.card { background: var(--surface); border-radius: 16px; display: flex; flex-direction: column; }
.card.big { border-radius: 20px; padding: 16px; gap: 14px; }
.row { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 14px; border-bottom: 1px solid var(--hair); font-size: 15px; }
.row:last-child { border-bottom: 0; }
.row .time { min-width: 40px; font-family: var(--mono); font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.row .grow { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .value { color: var(--ink-2); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.row.between { justify-content: space-between; }
.row.between > :first-child { flex: none; white-space: nowrap; }
.time-pick { position: relative; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.time-pick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
button.row { width: 100%; border: 0; background: none; text-align: left; border-bottom: 1px solid var(--hair); }
.chip { font-size: 12px; font-weight: 600; color: var(--ink-3); background: var(--fill-2); border-radius: 8px; padding: 3px 8px; white-space: nowrap; }
.chip.accent { color: var(--accent); background: var(--accent-soft); }
.note { margin: -2px 2px 0; font-size: 13px; line-height: 17px; color: var(--ink-2); }
.muted { color: var(--ink-2); }

/* Segmented control */
.seg { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 2px; background: var(--fill); border-radius: 10px; padding: 2px; height: 34px; flex: none; }
.seg button { border: 0; border-radius: 8px; font-size: 13px; font-weight: 600; background: transparent; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }

/* The look: photo plus piece column */
.look { display: flex; gap: 12px; }
.look-photo { flex: 1; min-width: 0; aspect-ratio: 270 / 338; border-radius: 22px; background: var(--fill); overflow: hidden; position: relative; }
.look-photo img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.look-photo.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 20px; }
.mini-grid { display: grid; grid-template-columns: repeat(2, 64px); gap: 8px; }
.mini-grid img, .mini-grid .ph { width: 64px; height: 64px; border-radius: 12px; background: var(--surface); object-fit: cover; }
.placeholder-text { font-size: 14px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.placeholder-text .dot { width: 6px; height: 6px; border-radius: 3px; background: var(--ink-2); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }
.pieces { width: 76px; flex: none; display: flex; flex-direction: column; gap: 11px; }
.piece { width: 76px; height: 76px; border-radius: 16px; background: var(--surface); object-fit: cover; border: 0; padding: 0; overflow: hidden; }
.piece img { width: 100%; height: 100%; object-fit: cover; }
.piece.swapped { outline: 2px solid var(--accent); outline-offset: -2px; }
.look-text { display: flex; flex-direction: column; gap: 4px; min-height: 62px; }
.look-title-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.look-title { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.3px; }
.text-btn { border: 0; background: none; padding: 4px 0 4px 8px; font-size: 15px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.text-btn.accent { color: var(--accent); }
.why { margin: 0; font-size: 14px; line-height: 18px; color: var(--ink-2); }

/* Buttons */
.btn-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.btn { height: 44px; border: 0; border-radius: 12px; background: var(--fill); color: var(--ink); font-size: 16px; font-weight: 600; padding: 0 14px; }
.btn.primary { background: var(--accent); color: #FFFFFF; }
.btn.small { height: 40px; font-size: 15px; }
.btn:disabled { opacity: 0.5; }
.btn-trio { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 8px; }
.btn-trio .btn { height: 40px; font-size: 15px; background: var(--fill-2); }
.btn-trio .btn.primary { background: var(--accent); }
.worn-row { height: 44px; display: flex; align-items: center; justify-content: space-between; background: var(--surface); border-radius: 12px; padding: 0 14px; }
.worn-row span { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.worn-row button { border: 0; background: none; color: var(--accent); font-size: 15px; font-weight: 600; padding: 8px 0 8px 8px; }
.state-card { background: var(--surface); border-radius: 20px; padding: 22px 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.state-card h2 { margin: 0; font-size: 17px; font-weight: 600; }
.state-card p { margin: 0; font-size: 14px; line-height: 19px; color: var(--ink-2); }

/* Closet */
.search { display: flex; align-items: center; gap: 8px; height: 38px; background: var(--fill); border-radius: 12px; padding: 0 12px; flex: none; }
.search input { flex: 1; border: 0; background: transparent; font-size: 16px; color: var(--ink); outline: none; min-width: 0; }
.search input::-webkit-search-cancel-button { display: none; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; flex: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; height: 32px; padding: 0 12px; border-radius: 16px; font-size: 14px; font-weight: 600; border: 1px solid rgba(0, 0, 0, 0.10); background: var(--surface); color: var(--ink); }
.chips button[aria-pressed="true"] { background: var(--ink); color: #FFFFFF; border-color: var(--ink); }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 10px; row-gap: 14px; }
.tile { display: flex; flex-direction: column; gap: 6px; border: 0; background: none; padding: 0; text-align: left; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.tile .img { width: 100%; aspect-ratio: 1; border-radius: 16px; background: var(--surface); overflow: hidden; position: relative; }
.tile .img img { width: 100%; height: 100%; object-fit: cover; }
.tile.wash .img img { opacity: 0.45; }
.tile .badge { position: absolute; left: 6px; bottom: 6px; font-size: 10px; font-weight: 600; background: rgba(255, 255, 255, 0.92); color: var(--ink-3); border-radius: 6px; padding: 2px 6px; }
.tile .name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .sub { font-size: 11px; line-height: 14px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph { background: var(--surface); }

/* Add */
.rec-row { display: flex; gap: 14px; align-items: center; }
.rec-dot { width: 52px; height: 52px; flex: none; border-radius: 26px; border: 3px solid var(--accent); display: flex; align-items: center; justify-content: center; }
.rec-dot div { width: 22px; height: 22px; border-radius: 11px; background: var(--danger); }
.rec-row p { margin: 0; font-size: 15px; line-height: 20px; }
.scan { display: flex; flex-direction: column; gap: 6px; padding: 0 2px; }
.scan-top { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.scan-top b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scan-top span { color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar { height: 4px; border-radius: 2px; background: var(--track); overflow: hidden; }
.bar div { height: 4px; background: var(--accent); transition: width 0.3s; }
.bar.off div { background: #AEAEB2; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 2px; }
.section-head h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.3px; }
.section-head span { font-size: 13px; color: var(--ink-2); }
.review { background: var(--surface); border-radius: 20px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.review-top { display: flex; gap: 12px; }
.review-top img, .review-top .ph { width: 104px; height: 104px; border-radius: 14px; background: var(--ground); object-fit: cover; flex: none; }
.review-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.review-name { font-size: 17px; font-weight: 600; line-height: 21px; }
.review-src { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.review-src.match { color: var(--accent); }
.review-quote { font-size: 13px; line-height: 17px; color: var(--ink-2); }
.facts { display: flex; flex-direction: column; border-top: 1px solid var(--hair); }
.facts div { display: flex; justify-content: space-between; gap: 12px; height: 34px; align-items: center; font-size: 14px; border-bottom: 1px solid var(--hair); }
.facts div:last-child { border-bottom: 0; }
.facts span:first-child { color: var(--ink-2); white-space: nowrap; }
.facts span:last-child { text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fixbox { display: flex; align-items: center; gap: 10px; background: var(--accent-soft); border-radius: 12px; padding: 10px 12px; font-size: 14px; color: var(--accent-ink); }
.fixbox input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; color: var(--accent-ink); font-size: 16px; }
.fixbox input::placeholder { color: #5D7BAE; }

/* Me */
.group-label { margin: 0 2px; font-size: 13px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.4px; }
.me-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.me-grid button { border: 0; padding: 0; background: var(--fill); border-radius: 14px; aspect-ratio: 4 / 5; overflow: hidden; }
.me-grid img { width: 100%; height: 100%; object-fit: cover; }
.me-grid button.off img { opacity: 0.4; }
.me-grid .add { border: 1.5px dashed #AEAEB2; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--accent); font-size: 12px; font-weight: 600; }
.caption { margin: 0 2px; font-size: 13px; line-height: 17px; color: var(--ink-2); }
.style-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.style-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.style-head span { font-size: 12px; color: var(--ink-2); text-align: right; }
.swatches { display: flex; gap: 8px; }
.swatches div { width: 30px; height: 30px; border-radius: 15px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08); }
.style-lines { display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 19px; }
.style-lines span { color: var(--ink-2); }
.inline-input { height: 40px; border: 0; border-radius: 12px; background: var(--fill-2); padding: 0 12px; font-size: 16px; width: 100%; outline: none; }
.row input[type="time"], .row select {
  border: 0; background: transparent; color: var(--ink-2); font-size: 15px; text-align: right; font-variant-numeric: tabular-nums;
  -webkit-appearance: none; appearance: none; padding: 0; min-width: 0; outline: none;
}
.row input[type="time"]::-webkit-date-and-time-value { text-align: right; }
.switch { width: 51px; height: 31px; border: 0; border-radius: 16px; padding: 2px; background: var(--track); display: flex; justify-content: flex-start; flex: none; transition: background 0.2s; }
.switch[aria-checked="true"] { background: var(--accent); justify-content: flex-end; }
.switch span { width: 27px; height: 27px; border-radius: 14px; background: #FFFFFF; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.18); display: block; }
.danger-text { color: var(--danger); }

/* Tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--tabbar);
  padding: 7px 8px 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  background: rgba(255, 255, 255, 0.78); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border-top: 1px solid var(--hair); z-index: 10;
}
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; text-decoration: none; color: var(--ink-2); font-size: 10px; font-weight: 600; }
.tabbar a[aria-current="page"] { color: var(--accent); }
@media (min-width: 431px) { .tabbar { left: 50%; right: auto; width: 430px; transform: translateX(-50%); } }

/* Sheets */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.28); z-index: 30; display: flex; align-items: flex-end; justify-content: center; animation: fade 0.18s ease-out; }
.sheet {
  width: 100%; max-width: 430px; max-height: 92vh; overflow-y: auto; background: var(--ground);
  border-radius: 20px 20px 0 0; padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px; animation: rise 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet .grabber { width: 36px; height: 5px; border-radius: 3px; background: #C7C7CC; margin: 0 auto 4px; flex: none; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; min-height: 32px; }
.sheet-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.sheet-head button { border: 0; background: none; color: var(--accent); font-size: 17px; font-weight: 600; padding: 4px 0 4px 12px; }
.sheet .row-thumb { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; background: var(--fill); flex: none; }
.sheet .big-photo { width: 100%; max-width: 280px; aspect-ratio: 1; border-radius: 20px; object-fit: cover; background: var(--surface); align-self: center; }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* Recorder */
.recorder { position: fixed; inset: 0; background: #000; z-index: 40; display: flex; flex-direction: column; }
.recorder video { flex: 1; width: 100%; height: 100%; object-fit: cover; }
.rec-top { position: absolute; top: max(16px, env(safe-area-inset-top)); left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: 0 16px; color: #FFFFFF; }
.rec-top button { border: 0; background: rgba(0, 0, 0, 0.4); color: #FFFFFF; border-radius: 16px; height: 32px; padding: 0 14px; font-size: 15px; font-weight: 600; }
.rec-time { font-variant-numeric: tabular-nums; font-size: 17px; font-weight: 600; display: flex; align-items: center; gap: 8px; background: rgba(0, 0, 0, 0.4); border-radius: 16px; padding: 4px 12px; }
.rec-time i { width: 8px; height: 8px; border-radius: 4px; background: var(--danger); }
.rec-bottom { position: absolute; bottom: max(30px, calc(env(safe-area-inset-bottom) + 16px)); left: 0; right: 0; display: flex; justify-content: center; }
.rec-stop { width: 76px; height: 76px; border-radius: 38px; border: 4px solid #FFFFFF; background: transparent; display: flex; align-items: center; justify-content: center; }
.rec-stop div { width: 30px; height: 30px; border-radius: 6px; background: var(--danger); }

/* Toast */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); top: max(12px, calc(env(safe-area-inset-top) + 6px)); z-index: 70;
  max-width: calc(100% - 32px); width: max-content; background: rgba(29, 29, 31, 0.94); color: #FFFFFF;
  border-radius: 14px; padding: 11px 14px; font-size: 14px; line-height: 18px; display: flex; align-items: center; gap: 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}
.toast button { border: 0; background: none; color: #FFFFFF; font-weight: 700; font-size: 14px; padding: 0; text-decoration: underline; text-underline-offset: 2px; }

/* Sign in */
body.login { min-height: 100vh; }
.login-wrap { max-width: 400px; margin: 0 auto; padding: max(96px, calc(env(safe-area-inset-top) + 60px)) 16px 40px; display: flex; flex-direction: column; gap: 12px; }
.login-sub { margin: 0 0 8px; font-size: 15px; line-height: 20px; color: var(--ink-2); }
.login-card { background: var(--surface); border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input { height: 44px; border: 0; border-radius: 12px; background: var(--fill-2); padding: 0 12px; font-size: 17px; color: var(--ink); outline: none; font-variant-numeric: tabular-nums; }
.field input:focus { box-shadow: 0 0 0 2px var(--accent-soft); }
.recovery summary { cursor: pointer; font-size: 15px; font-weight: 600; color: var(--ink-2); padding: 10px 2px; list-style: none; }
.recovery summary::-webkit-details-marker { display: none; }
.recovery[open] summary { margin-bottom: 4px; }
.login-msg { margin: 4px 2px 0; font-size: 14px; min-height: 18px; color: var(--ink-2); }
.login-msg[data-kind="error"] { color: var(--danger); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.more-row { width: 100%; background: none; border: 0; border-bottom: 0; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.more-row .grow.muted { color: var(--ink-2); }

/* Outfit photo opens full size */
button.look-photo { border: 0; padding: 0; display: block; cursor: zoom-in; }
.zoom { position: fixed; inset: 0; z-index: 60; border: 0; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); background: #000; display: flex; align-items: center; justify-content: center; cursor: zoom-out; animation: fade 0.18s ease-out; }
.zoom img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* Small additions */
.row .value.small { font-size: 13px; }
.accent-text { color: var(--accent); font-weight: 600; }
.text-btn.center { align-self: center; padding: 2px 8px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font-size: inherit; font-weight: 600; }
.sheet .inline-input { background: var(--surface); height: 44px; }
.photo-pick { border: 1.5px dashed #AEAEB2; background: var(--surface); border-radius: 20px; min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--accent); font-size: 15px; font-weight: 600; padding: 0; overflow: hidden; }
.photo-pick.has { border: 0; background: var(--fill); }
.photo-pick img { width: 100%; max-height: 300px; object-fit: contain; }

/* Store lookup block in the item sheet */
.store-box .row .grow.muted { white-space: normal; padding: 10px 0; line-height: 19px; }
.store-details { margin: 0; padding: 10px 14px; font-size: 14px; line-height: 19px; color: var(--ink-2); border-bottom: 1px solid var(--hair); }
.link-row { width: 100%; background: none; border: 0; color: var(--accent); font: inherit; text-align: left; cursor: pointer; }
.state-card .btn + .btn { margin-top: 2px; }
