:root {
  overflow: hidden;
  overscroll-behavior: none;
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #201d2b;
  background: #f8f7fb;
  --accent: #4939bc;
  --accent-dark: #382aa1;
  --soft: #efebff;
  --ink: #201d2b;
  --muted: #625e72;
  --border: #e5e2ec;
  --white: #fff;
  --image: #efede8;
  --radius: 16px;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 300px; overflow: hidden; }
#app { height: 100dvh; overflow: hidden auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
body:has(dialog[open]) #app { overflow-y: hidden; }
h1, h2, h3, p, figure, ul { margin: 0; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
input { min-width: 0; }
a { color: inherit; text-decoration: none; }
button:disabled { opacity: .58; cursor: default; }
img { display: block; width: 100%; height: 100%; object-fit: contain; }
:focus-visible { outline: 3px solid #7565e4; outline-offset: 3px; }
.icon { width: 20px; height: 20px; display: inline-block; vertical-align: middle; flex: 0 0 auto; }
.skip-link { position: fixed; left: 12px; top: 10px; transform: translateY(-150%); z-index: 12; background: var(--white); padding: 12px; }
.skip-link:focus { transform: none; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 192px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; display: flex; height: 100dvh; flex-direction: column; background: var(--white); border-right: 1px solid var(--border); padding: 34px 18px 22px; }
.brand { display: inline-flex; align-items: center; gap: 11px; width: max-content; color: var(--ink); font-size: 1.27rem; font-weight: 750; letter-spacing: .11em; }
.sidebar .brand { margin-left: 11px; }
.brand-icon { width: 34px; height: 34px; flex: none; border-radius: 10px; background: var(--accent); }
.navigation { margin-top: 50px; display: grid; gap: 8px; }
.nav-link { display: flex; gap: 12px; align-items: center; min-height: 46px; padding: 9px 12px; border-radius: 11px; color: var(--muted); font-size: .94rem; font-weight: 620; }
.nav-link:hover { background: #f7f5fb; }
.nav-link[aria-current] { color: var(--accent); background: var(--soft); font-weight: 750; }
.sidebar-footer { margin-top: auto; border-top: 1px solid var(--border); padding: 11px 2px 1px; }
.sidebar-footer p { margin: 2px 10px 0; color: var(--muted); font-size: .76rem; }
.sidebar-footer .try-on-task { width: 100%; margin-bottom: 6px; }
.mobile-header { display: none; }
.main-content { width: min(100%, 1240px); min-width: 0; margin: 0 auto; padding: 48px clamp(24px, 4.35vw, 70px) 32px; }
.main-content:focus { outline: 0; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 25px; }
.page-header h1 { font-weight: 760; font-size: clamp(2rem, 3.6vw, 3rem); letter-spacing: -.055em; line-height: 1.18; }
.page-date { margin: 0 0 8px; font-size: .89rem; color: var(--muted); font-weight: 530; }
.page-header > .btn { margin-bottom: 3px; flex: 0 0 auto; }

.btn { min-height: 42px; display: inline-flex; justify-content: center; align-items: center; gap: 7px; padding: 9px 15px; border: 1px solid transparent; border-radius: 10px; font-weight: 650; font-size: .89rem; line-height: 1.4; white-space: nowrap; }
.btn .icon { width: 17px; height: 17px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn.primary:hover:enabled { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.secondary { background: white; color: var(--ink); border-color: var(--border); }
.btn.secondary:hover:enabled, .btn.secondary[aria-pressed="true"] { color: var(--accent); border-color: #c5baf8; background: #f8f5ff; }
.btn.danger-outline { color: #a12738; border-color: #ebc9ce; }
.btn.danger-outline:hover:enabled { background: #fff2f3; color: #8b1f2e; border-color: #d9a4ac; }
.btn.danger { background: #a12738; border-color: #a12738; color: white; }
.btn.danger:hover:enabled { background: #8b1f2e; border-color: #8b1f2e; }
.btn[aria-pressed="true"] .icon { fill: #d9d0ff; }
.btn.try-on-task { background: var(--soft); color: var(--accent); }
.try-on-task[hidden], .styling-background[hidden] { display: none; }
.btn.quiet { background: transparent; color: var(--muted); min-height: 39px; padding: 7px 9px; }
.btn.quiet:hover { background: var(--soft); color: var(--accent); }
.text-button { border: 0; background: transparent; border-radius: 4px; padding: 4px 0; color: var(--accent); font-size: inherit; font-weight: 650; }
.text-button:hover { text-decoration: underline; }
.icon-button { display: grid; place-items: center; width: 40px; height: 40px; border: 0; background: #f5f3f9; color: var(--muted); border-radius: 10px; }

.conditions { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(0, 1fr) minmax(0, 1.55fr) auto; gap: 12px 14px; align-items: end; padding: 16px 17px; background: white; border: 1px solid var(--border); border-radius: var(--radius); }
.conditions > label { display: grid; gap: 7px; min-width: 0; }
.field-label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .86rem; font-weight: 620; }
.field-label .icon { width: 15px; height: 15px; color: var(--accent); }
.temperature-field { border: 0; padding: 0; margin: 0; min-width: 0; }
.temperature-field legend { padding: 0; margin-bottom: 7px; }
.temperature-inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.temperature-bound { display: block; position: relative; min-width: 0; }
.temperature-bound span { position: absolute; top: 4px; left: 8px; color: var(--muted); font-size: .75rem; pointer-events: none; }
.temperature-bound input[type="number"] { padding: 16px 7px 2px; appearance: textfield; font-size: 1rem; }
.temperature-bound input::-webkit-inner-spin-button { appearance: none; }
.weather-controls { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: .82rem; }
.weather-controls .text-button { padding: 5px 0; }
.weather-controls [aria-disabled="true"] { opacity: .65; cursor: wait; }
.weather-status a { color: var(--accent); }
.styling-entry { margin-inline-start: auto; min-height: 34px; padding: 5px 10px; }
.conditions-error { grid-column: 1 / -1; }
.conditions-error:empty { display: none; }
.select-wrap { position: relative; display: block; min-width: 0; }
.select-wrap::after { position: absolute; content: ""; right: 15px; top: 45%; border: solid #57506c; border-width: 0 1.6px 1.6px 0; display: block; padding: 3px; transform: rotate(45deg); pointer-events: none; }
select, input:not([type=file], [type=checkbox]) { width: 100%; height: 42px; border: 1px solid var(--border); border-radius: 9px; padding: 6px 11px; background: #faf9fd; color: var(--ink); font-size: .94rem; }
select { appearance: none; text-overflow: ellipsis; padding-right: 35px; }
input[type="date"] { display: block; max-width: 100%; }
input[type="date"]::-webkit-date-and-time-value { min-width: 0; text-align: start; }
.conditions > .btn { height: 42px; }

.look-section { margin-top: 26px; }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 9px; margin-bottom: 13px; }
.section-title h2 { font-size: 1.24rem; font-weight: 750; letter-spacing: -.025em; }
.section-title p { color: var(--muted); font-size: .83rem; margin-top: 4px; }
.pill { padding: 5px 9px; border-radius: 20px; background: var(--soft); color: var(--accent); font-size: .78rem; font-weight: 640; white-space: nowrap; }
.look-card { display: grid; grid-template-columns: minmax(0, 1.16fr) minmax(270px, .84fr); overflow: hidden; background: white; border: 1px solid var(--border); border-radius: 19px; }
.look-board { --board-color: #f0ede7; display: flex; min-width: 0; min-height: 355px; padding: 14px 15px; background: var(--board-color); gap: 5px; }
.look-column { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 0; }
.look-column:nth-child(1) { flex: 1.16; }
.look-column:nth-child(3) { flex: .86; }
.look-photo { flex: none; height: 156px; min-height: 0; }
.look-column:has(.look-photo:only-child) .look-photo { height: 86%; max-height: 265px; }
.look-column:has(.look-photo:nth-child(3)) .look-photo { height: 102px; }
.look-board img { mix-blend-mode: multiply; }
.look-details { display: flex; flex-direction: column; min-width: 0; padding: 16px 18px; }
.look-details-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.look-details-title h3 { font-size: .96rem; }
.look-details-controls { display: flex; align-items: center; gap: 9px; }
.look-details-controls > span { font-size: .83rem; color: var(--muted); white-space: nowrap; }
.look-details-controls .btn { color: var(--accent); padding-inline: 9px; }
.outfit-items { list-style: none; padding: 0; margin: 6px 0 11px; }
.outfit-items li { min-height: 51px; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 9px; border-bottom: 1px solid #efedf3; }
.outfit-items li:last-child { border-bottom: none; }
.row-photo { border-radius: 7px; width: 36px; height: 36px; overflow: hidden; background: var(--image); }
.row-photo img { object-fit: cover; }
.row-name { min-width: 0; display: grid; gap: 2px; padding: 2px 0; }
.row-name span { font-size: .88rem; font-weight: 620; overflow-wrap: anywhere; line-height: 1.18; }
.row-name small { color: var(--muted); font-size: .75rem; }
.outfit-item-actions { display: flex; align-items: center; }
.replace { border: 0; background: transparent; color: var(--accent); border-radius: 6px; display: inline-flex; align-items: center; gap: 4px; padding: 7px 5px; font-size: .81rem; font-weight: 650; min-height: 38px; }
.replace:hover { background: var(--soft); }
.replace .icon, .locked .icon { width: 13px; height: 13px; }
.remove-outfit-item { width: 38px; justify-content: center; color: var(--muted); }
.remove-outfit-item .icon { width: 16px; height: 16px; }
.locked { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); white-space: nowrap; font-size: .75rem; padding-right: 5px; }
.base-layer-note { margin-bottom: 10px; padding: 4px 10px; border-radius: 9px; background: #f8f7fb; font-size: .875rem; }
.base-layer-note .text-button { min-height: 36px; padding-inline: 2px; }
.base-layer-note .text-button .icon { width: 15px; height: 15px; }
.base-layer-note-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.base-layer-note p { margin-bottom: 6px; color: var(--muted); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
#base-layer-form textarea { width: 100%; min-height: 5.5rem; padding: 9px 10px; resize: vertical; border: 1px solid var(--border); border-radius: 8px; background: var(--white); color: var(--ink); font-family: inherit; font-size: 1rem; line-height: 1.5; }
.base-layer-help { color: var(--muted); font-size: .875rem; }
.look-actions { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 6px; margin-top: auto; }
.look-actions .btn { padding-inline: 5px; gap: 4px; }
.look-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-bottom: 10px; }
.look-options.four-options { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.look-option { background: white; border: 1px solid var(--border); border-radius: 12px; min-width: 0; min-height: 58px; display: flex; align-items: center; justify-content: center; padding: 6px 8px; gap: 8px; color: var(--muted); }
.look-option span { flex: none; font-weight: 650; white-space: nowrap; font-size: .83rem; }
.look-option .mini-photos { min-width: 0; }
.look-option img:nth-child(n+4) { display: none; }
.look-option.selected { background: #f3efff; border-color: #a999ee; color: var(--accent); }
.look-option:hover { border-color: #a999ee; }
.mini-photos { display: flex; gap: 3px; align-items: center; }
.mini-photos img { width: min(32px, 4vw); height: min(34px, 4vw); object-fit: cover; background: var(--image); border-radius: 5px; }
.demo-note { display: flex; align-items: center; justify-content: center; gap: 9px; flex-wrap: wrap; color: var(--muted); margin-top: 16px; font-size: .82rem; }
.empty { padding: 32px 17px; min-height: 226px; border-radius: var(--radius); border: 1px dashed #d8d1e8; background: white; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; }
.empty-icon { display: grid; place-items: center; width: 47px; height: 47px; margin-bottom: 5px; border-radius: 14px; background: var(--soft); color: var(--accent); }
.empty-icon .icon { width: 24px; height: 24px; }
.empty h3 { font-size: 1.07rem; }
.empty p { font-size: .91rem; color: var(--muted); line-height: 1.55; }
.empty .btn { margin-top: 4px; }

.closet-toolbar { display: flex; gap: 10px; align-items: stretch; margin-bottom: 14px; }
.search { display: flex; align-items: center; gap: 8px; padding: 0 12px; min-width: 0; width: min(100%, 340px); border: 1px solid var(--border); background: white; border-radius: 10px; color: var(--muted); }
.search input { border: 0 !important; background: white !important; padding: 5px 0 !important; }
.search:focus-within { outline: 2px solid #7565e4; }
.search input:focus { outline: none; }
.chips { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 16px; }
.chip { background: white; border: 1px solid var(--border); color: var(--muted); font-weight: 620; font-size: .88rem; border-radius: 24px; padding: 6px 12px; min-height: 37px; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--soft); border-color: #d5cbfa; color: var(--accent); }
.chip:hover { border-color: #b0a1ec; }

.closet-grid, .swap-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.garment { display: block; overflow: hidden; padding: 0; text-align: left; background: white; color: var(--ink); border: 1px solid var(--border); border-radius: 12px; min-width: 0; }
.garment:hover { border-color: #a999ee; }
.garment-image { display: block; position: relative; min-height: 0; aspect-ratio: 1.1; background: var(--image); }
.garment-image img { object-fit: contain; }
.image-tag { position: absolute; top: 7px; left: 7px; border-radius: 6px; padding: 4px 6px; background: #fffffff2; color: #4c445b; font-size: .72rem; }
.image-tag.unavailable { left: auto; right: 7px; background: #fdf0e7; color: #7f4530; }
.garment-caption { display: grid; gap: 4px; padding: 9px 10px 10px; }
.garment-caption strong { min-width: 0; overflow-wrap: anywhere; font-size: .87rem; line-height: 1.25; }
.garment-caption small { font-size: .79rem; color: var(--muted); }
.swap-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.records-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .9fr); gap: 14px; align-items: start; }
.calendar-card, .record-detail, .favorite-card { background: white; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.calendar-header { display: flex; justify-content: space-between; align-items: center; gap: 5px; margin-bottom: 10px; }
.calendar-header h2 { font-size: 1rem; white-space: nowrap; }
.calendar-header .btn { padding: 6px 8px; min-height: 35px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.weekday { padding: 8px 0; color: var(--muted); text-align: center; font-size: .82rem; }
.calendar-day { background: #f9f8fc; color: var(--ink); position: relative; min-height: 47px; border: 1px solid transparent; border-radius: 8px; display: grid; place-content: center; text-align: center; gap: 2px; font-weight: 600; padding: 4px 1px; }
.calendar-temperature { display: flex; flex-wrap: wrap; justify-content: center; color: var(--muted); font-size: .75rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.calendar-day[aria-pressed="true"] .calendar-temperature { color: inherit; }
.calendar-day[aria-current="date"] { border-color: #aa9ae9; }
.calendar-day[aria-pressed="true"] { background: var(--accent); color: white; }
.calendar-day:hover:not([aria-pressed="true"]) { background: var(--soft); }
.calendar-day i { width: 4px; height: 4px; position: absolute; top: 4px; right: 4px; border-radius: 50%; background: var(--accent); }
.calendar-day[aria-pressed=true] i { background: white; }
.record-detail .empty { min-height: 190px; border: 0; background: #faf9fd; padding: 17px 9px; }
.record-items { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.record-item { border: 1px solid var(--border); border-radius: 8px; background: white; color: var(--ink); overflow: hidden; padding: 0; text-align: left; }
.record-item img { height: auto; aspect-ratio: 1.15; background: var(--image); }
.record-item span { display: block; padding: 5px 6px; font-size: .8rem; overflow-wrap: anywhere; }
.record-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.record-detail .base-layer-note { margin-top: 12px; padding-block: 8px; }
.record-detail .base-layer-note p { margin-bottom: 0; }
.favorite-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.favorite-card .mini-photos { background: var(--image); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border-radius: 10px; overflow: hidden; }
.favorite-card .mini-photos img { width: 100%; height: auto; aspect-ratio: 1; }
.favorite-card p { margin: 9px 0; color: var(--muted); line-height: 1.55; font-size: .9rem; overflow-wrap: anywhere; }

dialog { --dialog-padding: 18px; --dialog-max-height: calc(100dvh - 24px); width: min(540px, calc(100% - 24px)); max-height: var(--dialog-max-height); overflow: hidden; border: 1px solid var(--border); border-radius: 19px; padding: 0; color: var(--ink); background: white; box-shadow: 0 20px 80px #27213a35; }
dialog[open] { display: flex; flex-direction: column; }
dialog[data-anchored] { top: var(--dialog-top); bottom: auto; margin-block: 0; max-height: min(var(--dialog-max-height), var(--dialog-visible-height)); }
dialog::backdrop { background: #21183285; }
.dialog-heading { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 12px; padding: var(--dialog-padding) var(--dialog-padding) 12px; }
.dialog-heading .icon-button { flex: none; }
.dialog-heading h2 { font-size: 1.26rem; overflow-wrap: anywhere; }
.dialog-body { min-height: 0; overflow: hidden auto; overscroll-behavior: contain; scroll-padding-block: 8px; padding: 0 var(--dialog-padding) var(--dialog-padding); }
.dialog-note { color: var(--muted); font-size: .95rem; line-height: 1.6; margin-bottom: 14px; }
.dialog-actions, .backup-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.styling-item-action { margin-top: 12px; }
.styling-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: end; }
.styling-fields .temperature-field { margin-block: 0; }
.styling-fields .form-field { margin-bottom: 0; }
#styling-form .btn { width: 100%; margin-top: 10px; }
dialog:has(#styling-results:not([hidden])) { width: min(700px, calc(100% - 24px)); }
.styling-summary { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 10px; margin-bottom: 12px; }
.styling-anchor-photo { width: 48px; height: 48px; overflow: hidden; border-radius: 9px; background: var(--image); }
.styling-summary h3 { font-size: 1.05rem; line-height: 1.25; overflow-wrap: anywhere; }
.styling-summary p { margin-top: 3px; color: var(--muted); font-size: .82rem; line-height: 1.35; }
.styling-summary .btn { padding-inline: 9px; color: var(--accent); }
.styling-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 15px; }
.styling-options button { min-width: 0; min-height: 44px; padding: 6px; border: 1px solid var(--border);
  border-radius: 11px; background: #faf9fc; color: var(--muted); font-size: .88rem; font-weight: 660; }
.styling-options button:hover { border-color: #a999ee; }
.styling-options button[aria-pressed="true"] { border-color: #9b88ea; background: var(--soft); color: var(--accent); }
.styling-stage { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; gap: 12px; }
.styling-stage h4 { margin: 0 0 6px; font-size: .95rem; line-height: 1.35; }
.styling-preview { width: 100%; max-width: max(125px, 42dvh); justify-self: center; }
.styling-figure { display: grid; place-items: center; aspect-ratio: 2 / 3; overflow: hidden; border-radius: 14px;
  border: 1px solid var(--border); background: #f4f0f6; }
.styling-result { display: block; width: 100%; height: auto; }
.styling-placeholder { display: grid; justify-items: center; gap: 8px; padding: 10px; text-align: center; }
.styling-placeholder .icon { width: 26px; height: 26px; color: var(--accent); }
.styling-status { color: var(--muted); font-size: .875rem; line-height: 1.45; }
.styling-figure [hidden] { display: none; }
.styling-pieces ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 0; list-style: none; }
.styling-pieces li { display: grid; align-content: start; gap: 4px; min-width: 0; color: var(--ink); font-size: .82rem; line-height: 1.25; overflow-wrap: anywhere; }
.styling-piece-photo { position: relative; height: clamp(58px, 16vw, 95px); border-radius: 8px; overflow: hidden; background: var(--image); }
.styling-piece-tag { position: absolute; inset: 3px auto auto 3px; padding: 2px 4px; border-radius: 5px; background: #fffffff2; color: var(--ink);
  white-space: nowrap; font-size: .72rem; font-weight: 680; }
.styling-piece-tag.anchor { background: var(--soft); color: var(--accent); }
.styling-note { color: var(--muted); font-size: .82rem; line-height: 1.45; margin-top: 8px; }
.styling-retry:not([hidden]) { margin-top: 8px; }
.styling-retry[hidden] { display: none; }
.styling-background { margin-top: 10px; }
.try-on-views { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
.try-on-views[hidden] { display: none; }
.try-on-views .btn { min-height: 38px; padding-inline: 4px; }
dialog:has(.fitting-layout) { width: min(680px, calc(100% - 24px)); }
.fitting-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(248px, 1fr); gap: 18px; align-items: start; }
.fitting-preview { min-width: 0; }
.fitting-stage { display: grid; place-items: center; min-width: 0; min-height: 320px; overflow: hidden; border-radius: 14px;
  border: 1px solid var(--border); background: #f4f0f6; }
.fitting-stage .fitting-result { width: 100%; height: auto; max-height: 520px; }
.fitting-placeholder { display: grid; justify-items: center; gap: 10px; padding: 18px; color: var(--muted); text-align: center; font-size: .92rem; }
.fitting-placeholder .icon { width: 32px; height: 32px; color: var(--accent); }
.fitting-stage [hidden], .model-upload-row [hidden], .fitting-footer [hidden] { display: none; }
.fitting-controls { min-width: 0; }
.fitting-heading { display: flex; gap: 6px; align-items: center; justify-content: space-between; }
.fitting-heading h3 { font-size: 1rem; }
.fitting-heading .btn { color: var(--accent); }
.model-upload-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; padding: 8px;
  border: 1px solid var(--border); border-radius: 9px; background: #faf9fd; }
.model-upload-info { flex: 1; min-width: max-content; }
.model-source { color: var(--muted); font-size: .88rem; margin-bottom: 5px; }
.model-thumbnail { width: 42px; height: 58px; border-radius: 6px; object-fit: cover; }
.model-upload-row .btn { min-height: 36px; padding: 5px 8px; }
.model-upload-row .import-label:has(input:disabled) { opacity: .58; pointer-events: none; }
.fitting-garments-title { margin-bottom: 6px; font-size: 1rem; }
.fitting-note { color: var(--muted); font-size: .88rem; line-height: 1.55; margin: 0 0 9px; }
.fitting-items { display: grid; gap: 5px; list-style: none; padding: 0; max-height: 335px; overflow: auto; }
.fitting-item { display: grid; grid-template-columns: 34px minmax(0, 1fr) 22px; gap: 8px; align-items: center;
  width: 100%; min-height: 46px; padding: 4px 7px; border: 1px solid var(--border); border-radius: 9px;
  background: white; color: var(--ink); text-align: start; }
.fitting-item:hover, .fitting-item[aria-pressed="true"] { background: #f8f5ff; border-color: #c5baf8; }
.fitting-item:focus-visible { outline-offset: -3px; }
.fitting-item .row-photo { width: 34px; height: 34px; }
.fitting-item .row-photo img { object-fit: contain; }
.fitting-item-check { display: grid; place-items: center; width: 20px; height: 20px; border: 1px solid #b4a9c7; border-radius: 6px; color: transparent; }
.fitting-item[aria-pressed="true"] .fitting-item-check { border-color: var(--accent); color: white; background: var(--accent); }
.fitting-item-check .icon { width: 14px; height: 14px; }
.fitting-footer { flex: none; padding: 10px var(--dialog-padding) calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }
.fitting-footer .fitting-note { margin-bottom: 6px; }
.fitting-saved { margin-bottom: 6px; color: var(--accent); font-size: .875rem; }
.fitting-status:not(:empty) { margin-bottom: 8px; color: var(--muted); font-size: .875rem; line-height: 1.45; }
.fitting-footer-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.fitting-footer-actions .primary { flex: 1; }
.appearance-range { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 1px 8px; margin-block: 8px; }
.appearance-range label { font-size: .88rem; font-weight: 640; }
.appearance-range output { color: var(--accent); font-size: .84rem; font-variant-numeric: tabular-nums; }
.appearance-range input[type="range"] { grid-column: 1 / -1; height: 26px; margin: 0; padding: 0;
  border: 0; background: transparent; accent-color: var(--accent); }
.appearance-reset { font-size: .86rem; }
.outfit-picker-filter { margin-bottom: 10px; }
.outfit-picker-list { display: grid; gap: 6px; }
.outfit-picker-item { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 60px; padding: 5px 12px 5px 6px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.outfit-picker-item[hidden] { display: none; }
.outfit-picker-item:hover, .outfit-picker-item:has(input:checked) { background: #f8f5ff; border-color: #c5baf8; }
.outfit-picker-item .row-photo { width: 48px; height: 48px; }
.outfit-picker-item .row-photo img { object-fit: contain; }
.outfit-picker-item input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.outfit-picker-actions { flex: none; padding: 10px var(--dialog-padding) calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }
.outfit-picker-actions .btn { width: 100%; }
.import-label, .upload { position: relative; cursor: pointer; }
.import-label input, .upload input { opacity: 0; position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.import-label:focus-within, .upload:focus-within { outline: 3px solid #7565e4; outline-offset: 3px; }
.upload { display: flex; align-items: center; gap: 12px; background: #f8f6fc; border: 1px dashed #cfc4eb; border-radius: 10px; padding: 9px; margin-bottom: 10px; }
.upload span:first-child { width: 53px; height: 53px; flex: none; border-radius: 7px; background: var(--soft); color: var(--accent); display: grid; place-items: center; overflow: hidden; }
.upload span:nth-child(2) { display: grid; gap: 4px; font-size: .91rem; }
.upload small { color: var(--muted); }
.form-field { display: grid; min-width: 0; gap: 4px; font-size: .88rem; font-weight: 640; margin-bottom: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 10px; }
.purchase-fields { margin-top: 12px; }
.purchase-fields legend { margin-bottom: 6px; }
fieldset { border: 0; padding: 0; margin: 2px 0; min-width: 0; }
legend { padding: 0; font-size: .88rem; font-weight: 640; }
legend span { color: var(--muted); font-weight: 450; }
.scene-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.scene-tags label { display: inline-flex; align-items: center; gap: 4px; min-height: 35px; padding: 4px 7px; border: 1px solid var(--border); border-radius: 8px; font-size: .86rem; cursor: pointer; }
.scene-tags input { accent-color: var(--accent); }
.form-error:not(:empty) { display: block; margin-top: 8px; color: #a12631; font-size: .88rem; }
.item-detail { display: grid; grid-template-columns: minmax(105px, 1fr) 1.2fr; align-items: center; gap: 12px; }
.item-detail-photo { height: 145px; border-radius: 11px; overflow: hidden; background: var(--image); }
button.item-detail-photo { position: relative; min-width: 0; padding: 0; border: 0; cursor: zoom-in; }
.photo-expand { position: absolute; right: 6px; bottom: 6px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: #fffffff0; color: var(--ink); }
.photo-expand .icon { width: 15px; height: 15px; }
.photo-preview {
  width: 100%; max-width: none; height: 100dvh; max-height: none; margin: 0; border: 0; border-radius: 0; box-shadow: none;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: transparent; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 12px; place-items: center;
}
.photo-preview[open] { display: grid; }
.photo-preview::backdrop { background: #181423eb; }
.photo-preview .icon-button { justify-self: end; width: 44px; height: 44px; color: var(--ink); }
.photo-preview img { width: auto; height: auto; max-width: min(100%, 960px); max-height: 100%; border-radius: 12px; background: var(--image); }
.item-detail.viewing-original { grid-template-columns: 1fr; }
.viewing-original .item-detail-photo { height: min(38vh, 320px); }
.photo-tools { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.photo-status:not(:empty) { margin-top: 7px; color: var(--muted); font-size: .88rem; line-height: 1.5; }
#display-editor canvas { display: block; width: min(100%, 320px); height: auto; aspect-ratio: 1; margin: 10px auto; background: var(--image); border: 1px solid var(--border); border-radius: 10px; cursor: crosshair; touch-action: none; }
.display-edit-options, .display-brush { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.display-search { margin: 12px 0; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: #faf9fd; }
.display-search [hidden] { display: none; }
.display-search-reference { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.display-search-reference img { flex: none; width: 82px; height: 82px; object-fit: contain; border-radius: 8px; background: var(--image); }
.display-search-reference h3 { margin-bottom: 4px; font-size: 1rem; }
.display-search-reference p, .display-search-note { color: var(--muted); font-size: .875rem; line-height: 1.5; }
.display-search-note { margin-top: 6px; }
.display-search details { margin-top: 10px; }
.display-search summary { min-height: 32px; padding-block: 5px; color: var(--accent); font-size: .89rem; font-weight: 650; cursor: pointer; }
.display-search-import { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.display-brush { justify-content: space-between; margin-top: 7px; }
.display-brush label { display: flex; align-items: center; gap: 8px; font-size: .88rem; font-weight: 620; }
.display-brush input[type="range"] { width: 125px; height: 32px; margin: 0; padding: 0; border: 0; background: transparent; accent-color: var(--accent); }
.item-detail p { font-size: .92rem; margin: 5px 0; overflow-wrap: anywhere; }
.item-summary { color: var(--muted); }
.item-history { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 10px; }
.item-history h3 { font-size: 1rem; }
.item-history p { font-size: .86rem; color: var(--muted); margin: 4px 0; }
.history-rows { display: grid; gap: 4px; margin-top: 7px; }
.history-rows button { border: 1px solid var(--border); color: var(--ink); background: #faf9fd; border-radius: 8px; display: grid; gap: 4px; text-align: left; padding: 7px; font-size: .86rem; }
.history-rows small { color: var(--muted); overflow-wrap: anywhere; }
#toast { position: fixed; z-index: 100; bottom: 22px; left: 50%; transform: translate(-50%, 8px); pointer-events: none; opacity: 0; transition: opacity .17s, transform .17s; max-width: min(400px, calc(100% - 24px)); width: max-content; border-radius: 10px; padding: 10px 14px; font-size: .91rem; background: #282138; color: white; box-shadow: 0 4px 18px #211d322e; }
#toast.visible { opacity: 1; transform: translate(-50%, 0); }
.loading { display: grid; align-content: center; justify-items: center; text-align: center; min-height: 100dvh; gap: 8px; padding: 18px; }

@media (max-width: 1000px) {
  .shell { grid-template-columns: 154px minmax(0, 1fr); }
  .sidebar { padding-left: 13px; padding-right: 13px; }
  .main-content { padding-inline: 24px; }
  .look-details { padding-inline: 13px; }
  .look-options { gap: 7px; }
}
@media (max-width: 740px), (pointer: coarse) {
  select, input:not([type=file], [type=checkbox], [type=range]) { font-size: max(16px, 1rem); }
  input[type="date"] { appearance: none; }
}
@media (max-width: 740px) {
  #app { scrollbar-gutter: auto; scroll-padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  #app:has(.mobile-header .try-on-task:not([hidden])) { scroll-padding-top: 59px; }
  .shell { display: block; }
  .sidebar { height: auto; padding: 0; position: static; background: transparent; border: 0; }
  .sidebar .brand, .sidebar-footer { display: none; }
  .mobile-header { display: flex; align-items: center; justify-content: space-between; min-height: 59px; border-bottom: 1px solid var(--border); background: white; padding: 9px 16px; }
  .mobile-header:has(.try-on-task:not([hidden])) { position: sticky; top: 0; z-index: 2; }
  .mobile-header .brand { font-size: 1.08rem; gap: 8px; }
  .mobile-header .brand-icon { width: 30px; height: 30px; border-radius: 8px; }
  .mobile-tools { display: flex; gap: 4px; }
  .mobile-tools .try-on-task { padding-inline: 8px; }
  .navigation { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; position: fixed; z-index: 3; left: 0; right: 0; bottom: 0; margin: 0; min-height: 60px; padding: 4px 10px calc(4px + env(safe-area-inset-bottom)); background: white; border-top: 1px solid var(--border); }
  .nav-link { justify-content: center; flex-direction: column; gap: 3px; padding: 5px 8px; font-size: .78rem; min-height: 47px; }
  .nav-link .icon { width: 19px; height: 19px; }
  .main-content { padding: 22px 15px calc(81px + env(safe-area-inset-bottom)); }
  .page-header { margin-bottom: 17px; }
  .page-header h1 { font-size: clamp(1.68rem, 6vw, 2.2rem); }
  .page-date { font-size: .84rem; margin-bottom: 5px; }
  .page-header > .btn { margin-bottom: 0; }
  .conditions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding: 11px; }
  .conditions label { gap: 5px; }
  .temperature-field legend { margin-bottom: 5px; }
  .conditions .btn { min-height: 42px; }
  .look-section { margin-top: 18px; }
  .look-card { grid-template-columns: minmax(0, 1fr); }
  .look-board { min-height: 215px; padding: 8px 11px; }
  .look-photo { height: 112px; }
  .look-column:has(.look-photo:nth-child(3)) .look-photo { height: 73px; }
  .look-details { padding: 13px; }
  .outfit-items li { min-height: 48px; }
  .look-option { flex-direction: column; gap: 4px; padding: 5px 4px; }
  .look-option img { width: min(26px, 6vw); height: min(26px, 6vw); }
  .look-option span { font-size: .79rem; }
  .closet-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .closet-toolbar { gap: 7px; }
  .chips { gap: 5px; }
  .chip { padding-inline: 9px; }
  .records-layout { grid-template-columns: minmax(0, 1fr); }
  .favorite-grid { grid-template-columns: minmax(0, 1fr); }
  dialog { --dialog-padding: 14px; --dialog-max-height: 90dvh; margin: auto auto 0; width: 100%; max-width: 100%; border-radius: 19px 19px 0 0; }
  .dialog-body { padding-bottom: calc(var(--dialog-padding) + env(safe-area-inset-bottom)); }
  dialog:has(.outfit-picker-actions) .dialog-body { padding-bottom: var(--dialog-padding); }
  dialog:has(.fitting-layout) { width: min(100%, 600px); }
  dialog:has(#styling-results:not([hidden])) { width: min(100%, 600px); }
  dialog:has(.fitting-layout) .dialog-body { padding-bottom: var(--dialog-padding); }
  #toast { bottom: calc(74px + env(safe-area-inset-bottom)); }
}
@media (max-width: 550px) {
  .fitting-layout { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .fitting-stage { min-height: 155px; }
  .fitting-stage .fitting-result { max-height: min(50dvh, 450px); }
  .fitting-items { max-height: none; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fitting-item { grid-template-columns: 30px minmax(0, 1fr) 17px; gap: 5px; padding-inline: 4px; }
  .fitting-item .row-photo { width: 30px; height: 30px; }
  .fitting-item-check { width: 16px; height: 16px; }
  .fitting-item-check .icon { width: 12px; height: 12px; }
}
@media (max-width: 425px) {
  .closet-grid, .swap-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .header-button { padding-inline: 9px; min-height: 38px; }
  .look-board { min-height: 207px; }
  .look-photo { height: 95px; }
  .look-column:has(.look-photo:nth-child(3)) .look-photo { height: 64px; }
  .page-header { gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
