:root {
  color-scheme: light;
  --bg: #f4f2ed;
  --bg-soft: #ebe6dc;
  --panel: #ffffff;
  --panel-tint: #fbfaf7;
  --ink: #3d3d38;
  --ink-soft: #555247;
  --muted: #746f66;
  --line: #d7d0c3;
  --line-soft: #e7e1d7;
  --accent: #285d52;
  --accent-dark: #1d463e;
  --warn: #9a5b13;
  --warn-bg: #fff4de;
  --shadow: 0 18px 44px rgba(34, 30, 22, 0.14);
  --shadow-soft: 0 8px 22px rgba(34, 30, 22, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 220px),
    var(--bg);
  color: var(--ink);
  font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.topbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  min-height: 72px;
  padding: 13px 24px;
  position: sticky;
  top: 0;
  z-index: 4;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  font-weight: 680;
  letter-spacing: 0;
}

.app-brand {
  align-items: baseline;
  display: flex;
  gap: 6px;
}

.app-title {
  align-items: baseline;
  display: flex;
  gap: 0;
  line-height: 1.08;
  width: fit-content;
}

.app-title span:first-child {
  color: #2d5a27;
  font-weight: 720;
}

.app-title span:last-child {
  color: #5a9e50;
  font-family: inherit;
  font-size: 1em;
  font-style: italic;
  font-weight: 720;
}

.app-build {
  color: var(--ink-faint, #bbb);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1;
  user-select: none;
}

h2 {
  font-size: 17px;
  font-weight: 750;
}

.summary-button {
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  display: block;
  font-size: 12px;
  font-weight: 600;
  min-height: 0;
  padding: 3px 0;
  text-align: left;
}

.summary-button:disabled {
  background: transparent;
  color: var(--muted);
  cursor: default;
}

.summary-button:not(:disabled):hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.summary-button.is-active {
  color: var(--accent);
}

.header-actions {
  align-items: center;
  display: flex;
  gap: 10px;
  margin-left: auto;
}

.header-actions .summary-button {
  white-space: nowrap;
}

.header-actions .summary-button.is-active {
  background: rgba(40, 93, 82, 0.08);
  border-color: var(--accent);
  color: var(--accent);
}

.search-tools-row {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  margin: 18px 0 7px;
}

.search-tools-row .field-label {
  margin: 0;
}

.review-summary-button {
  background: rgba(255, 255, 255, 0.48);
  border: 1px solid rgba(211, 201, 188, 0.72);
  border-radius: var(--m-control-radius, 8px);
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  min-height: 26px;
  padding: 3px 9px;
  justify-self: center;
  text-align: center;
}

.review-summary-button:not(:disabled):hover,
.review-summary-button:not(:disabled):focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 3px rgba(40, 93, 82, 0.08);
  text-decoration: none;
}

.review-summary-button:disabled {
  opacity: 0.56;
}

.layout {
  display: grid;
  grid-template-columns: 292px 1fr;
  min-height: calc(100vh - 82px);
}

.sidebar {
  background: rgba(251, 250, 247, 0.68);
  border-right: 1px solid var(--line);
  padding: 22px;
}

.content {
  padding: 24px 28px 36px;
}

.layout[data-view="outfits"],
.layout[data-view="calendar"] {
  grid-template-columns: minmax(0, 1fr);
}

.primary-view {
  overflow-x: hidden;
  padding: 24px 28px 36px;
}

.primary-view[hidden] {
  display: none;
}

.content-header {
  align-items: center;
  display: none;
  justify-content: flex-end;
  margin-bottom: 0;
}

.catalog-title-row {
  align-items: center;
  display: flex;
  gap: 10px;
}

.filter-button {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--accent);
  display: inline-flex;
  height: 30px;
  justify-content: center;
  min-height: 30px;
  padding: 0;
  width: 34px;
  position: relative;
}

.filter-button:hover {
  border-color: var(--accent);
}

.filter-svg {
  fill: currentColor;
  height: 22px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
  width: 22px;
}

.filter-svg circle {
  r: 1.8px;
  stroke-width: 0;
}

.calendar-jump-icon {
  fill: none;
}

.calendar-jump-icon circle {
  fill: currentColor;
}

.filter-count {
  align-items: center;
  background: var(--warn);
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: 10px;
  font-weight: 800;
  height: 18px;
  justify-content: center;
  line-height: 1;
  min-width: 18px;
  padding: 0 4px;
  position: absolute;
  right: -7px;
  top: -7px;
}

.filter-count[hidden] {
  display: none;
}

.filter-panel {
  align-items: end;
  background: rgba(251, 250, 247, 0.82);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(130px, 1fr)) auto auto;
  margin-bottom: 18px;
  padding: 14px;
}

.filter-panel[hidden] {
  display: none;
}

.filter-panel label {
  color: var(--muted);
  display: grid;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
}

.filter-panel input,
.filter-panel select {
  min-height: 36px;
}

.field-label {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 700;
  margin: 18px 0 7px;
  text-transform: uppercase;
}

.text-input,
select,
textarea,
input[type="text"],
input[type="date"],
input[type="search"] {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font-size: 16px;
  min-height: 40px;
  padding: 8px 11px;
  width: 100%;
}

.text-input:focus,
select:focus,
textarea:focus,
input[type="text"]:focus,
input[type="date"]:focus,
input[type="search"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(40, 93, 82, 0.12);
  outline: none;
}

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

.catalog-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

.item-card {
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  min-width: 0;
  overflow: hidden;
  position: relative;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.item-card:hover,
.item-card:focus-within {
  border-color: #c2b8a7;
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.item-image-button {
  background: #fff;
  border: 0;
  cursor: zoom-in;
  display: block;
  height: 210px;
  padding: 20px 12px 8px;
  width: 100%;
}

.item-card.category-shoes .item-image-button {
  background: #fff;
}

.item-image-button img {
  display: block;
  height: 100%;
  object-fit: contain;
  width: 100%;
  opacity: 0;
  transition: opacity 500ms ease;
}
.item-image-button img.img-loaded {
  opacity: 1;
}

.item-body {
  background: #fff;
  border-top: 0;
  padding: 0 12px 18px;
}

.item-title {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.item-detail {
  color: var(--muted);
  font-size: 13px;
  min-height: 19px;
  overflow-wrap: anywhere;
  text-align: center;
}

.item-separator {
  margin: 0 8px;
}

.item-brand {
  color: var(--ink-soft);
  font-weight: 650;
}

.item-wear-count {
  color: var(--muted);
  font-weight: 650;
  white-space: nowrap;
}

.review-badge {
  background: rgba(255, 244, 222, 0.92);
  border: 1px solid #e7c783;
  border-radius: 999px;
  color: var(--warn);
  font-size: 10px;
  font-weight: 700;
  min-height: 0;
  padding: 3px 6px;
  position: absolute;
  right: 8px;
  top: 8px;
}

.review-badge:hover {
  background: #ffffff;
  border-color: #dca738;
}

.restore-badge {
  background: rgba(232, 246, 241, 0.92);
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  min-height: 0;
  padding: 3px 8px;
  position: absolute;
  right: 8px;
  top: 8px;
}

.restore-badge:hover {
  background: #ffffff;
}

.danger-button {
  background: transparent;
  border: 1px solid #c0392b;
  border-radius: 6px;
  color: #c0392b;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  margin-right: auto;
  min-height: 36px;
  padding: 7px 12px;
}

.danger-button:hover {
  background: #fdf0ee;
}

.primary-button {
  background: var(--accent);
  border: 1px solid var(--accent-dark);
  border-radius: 6px;
  color: white;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  min-height: 36px;
  padding: 7px 12px;
  transition: background 140ms ease, transform 140ms ease;
}

.primary-button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.compact-button {
  font-size: 12px;
  min-height: 32px;
  padding: 5px 10px;
}

.add-item-button {
  align-items: center;
  background: var(--accent);
  border: 1px solid var(--accent-dark);
  border-radius: 999px;
  color: white;
  display: inline-grid;
  font-size: 0;
  font-weight: 500;
  height: 38px;
  justify-content: center;
  line-height: 1;
  min-height: 38px;
  padding: 0;
  position: relative;
  transition: background 140ms ease, transform 140ms ease;
  width: 38px;
}

.add-item-button::before,
.add-item-button::after {
  background: currentColor;
  border-radius: 999px;
  content: "";
  height: max(2px, 8%);
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 42%;
}

.add-item-button::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.add-item-button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

button {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  min-height: 34px;
  padding: 7px 12px;
}

dialog {
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
  box-sizing: border-box;
  padding: 0;
  touch-action: pan-y;
}

dialog::backdrop {
  background: rgba(25, 24, 22, 0.45);
}

.item-dialog {
  max-width: 720px;
  width: calc(100vw - 32px);
}

.item-dialog form {
  background: var(--panel-tint);
  padding: 22px;
}

.dialog-header,
.dialog-actions,
.viewer-toolbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.icon-button {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: inline-flex;
  font-size: 14px;
  font-weight: 500;
  height: 28px;
  justify-content: center;
  line-height: 0.9;
  min-height: 0;
  min-width: 0;
  padding: 0 0 2px;
  width: 28px;
}

.icon-button:hover {
  border-color: var(--accent);
}

.icon-button:focus,
.icon-button:focus-visible {
  border-color: var(--accent);
  border-radius: 8px;
  box-shadow: 0 0 0 2px rgba(40, 93, 82, 0.12);
  outline: 0;
}

.form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.item-category-label {
  color: var(--muted);
  display: grid;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 14px;
}

.item-photo-section {
  margin: 0 0 16px;
  position: relative;
}

/* Category-pending: dim both photo section and form grid until category is chosen */
.item-dialog form.category-pending .item-photo-section {
  opacity: 0.38;
  pointer-events: none;
}

.item-dialog form.category-pending .form-grid {
  opacity: 0.38;
  pointer-events: none;
}

/* Photo-pending: category chosen, but no photo yet — keep form grid dimmed */
.item-dialog form.photo-pending .form-grid {
  opacity: 0.38;
  pointer-events: none;
}
.item-dialog form.photo-pending .item-save-button {
  opacity: 0.38;
  pointer-events: none;
}

/* Landscape frame for shoes — empty state and analyzing state: show as landscape */
.item-photo-section--landscape:not(.has-photo) .item-photo-placeholder,
.item-photo-section--landscape.is-analyzing .item-photo-placeholder {
  aspect-ratio: 4 / 3;
  min-height: 0 !important;
  overflow: hidden;
}

/* Shoe analyzing: raw photo shown while BG removal runs — cover-fit so any source
   orientation fills the landscape container without overflow or portrait flash. */
.item-photo-preview.shoe-preview-analyzing {
  display: block !important;
  height: 100% !important;
  object-fit: cover !important;
  padding: 0 !important;
  width: 100% !important;
}

/* Shoe preview: 1200×800 landscape canvas — fill width, let height be natural.
   Completely separate from swatch-processed which forces portrait height for ties. */
.item-photo-preview.shoe-preview-processed {
  display: block !important;
  height: auto !important;
  max-height: none !important;
  max-width: 100% !important;
  object-fit: contain !important;
  padding: 0 !important;
  width: 100% !important;
}

.item-photo-tip {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-style: italic;
  line-height: 1.45;
  margin-top: 8px;
  padding: 0 2px;
}

.item-photo-tip:empty {
  display: none;
}

.item-photo-input {
  height: 1px;
  opacity: 0;
  overflow: hidden;
  position: absolute;
  width: 1px;
}

.item-photo-placeholder {
  align-items: center;
  background: rgba(255, 255, 255, 0.72);
  border: 1px dashed rgba(36, 97, 84, 0.36);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-items: center;
  justify-content: center;
  min-height: 230px;
  overflow: visible;
  padding: 18px;
  position: relative;
}

.item-photo-preview {
  display: none;
  height: auto;
  max-height: 420px;
  max-width: 100%;
  min-height: 0;
  min-width: 0;
  object-fit: contain;
  width: min(100%, 420px);
}

.item-photo-section.has-photo .item-photo-preview {
  display: block;
}

.item-photo-section.has-photo .item-photo-placeholder {
  align-items: center;
  background: rgba(255, 255, 255, 0.9);
  gap: 10px;
  justify-content: flex-start;
  padding: 10px;
}

.item-photo-section.has-photo .item-photo-preview {
  flex: 0 0 auto;
  height: auto;
  max-height: 420px;
  width: min(100%, 420px);
}

.item-photo-input:focus-visible + .item-photo-placeholder {
  box-shadow: 0 0 0 3px rgba(230, 149, 8, 0.25);
}

.item-photo-placeholder:hover {
  border-color: rgba(36, 97, 84, 0.58);
}

.item-photo-placeholder .item-photo-button {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(211, 201, 188, 0.95);
  border-radius: var(--m-control-radius, 6px);
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
  padding: 8px 16px;
  pointer-events: none;
  position: relative;
  white-space: nowrap;
  z-index: 1;
}

.item-photo-section.has-photo .item-photo-button {
  align-self: center;
  flex: 0 0 auto;
}

.item-photo-status {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  display: none;
  pointer-events: none;
  position: relative;
  align-self: center;
  text-align: center;
  z-index: 1;
}

.item-photo-status:not(:empty) {
  display: block;
}

.item-photo-section.has-photo .item-photo-status {
  align-self: center;
  flex: 0 0 auto;
  max-width: 100%;
}

.item-photo-section.is-analyzing .item-photo-button {
  opacity: 0.74;
}

/* Scanning light sweep during analysis.
   ::after targets the img wrapper so the sweep stays within the image bounds
   and doesn't bleed into the button/status below. */
.item-photo-img-wrap {
  display: none;
  flex: 0 0 auto;
  overflow: hidden;
  position: relative;
}

.item-photo-section.has-photo .item-photo-img-wrap {
  display: block;
}

/* Give the portrait wrapper an explicit height during analysis so that:
   (a) the ::after's inset:0 has a definite containing-block height to fill
       (percentage top/bottom on abs. positioned elements resolve to auto when
       the containing block has height:auto, breaking the gradient sweep), and
   (b) the frame stays the same size before and after processing. */
.item-photo-section:not(.item-photo-section--landscape).is-analyzing .item-photo-img-wrap {
  height: min(38dvh, 340px);
}

/* Scan bar — pre-register the animation as paused so the compositor already
   has the layer set up. Switching paused→running is instant on the GPU;
   starting a brand-new animation while the main thread is busy is not.
   opacity:0 keeps it invisible without removing it from the compositor. */
.item-scan-bar {
  animation: scan-sweep-h 1.6s ease-in-out infinite alternate;
  animation-play-state: paused;
  bottom: 0;
  left: -4%;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  top: 0;
  width: 22%;
  z-index: 2;
  background: linear-gradient(
    90deg,
    transparent 0%,
    transparent 18%,
    rgba(255, 255, 255, 0.52) 42%,
    rgba(255, 255, 255, 0.72) 50%,
    rgba(255, 255, 255, 0.52) 58%,
    transparent 82%,
    transparent 100%
  );
}

/* Horizontal sweep for shoes (landscape container) */
.item-photo-section--landscape.is-analyzing .item-scan-bar {
  animation-play-state: running;
  opacity: 1;
}

@keyframes scan-sweep-h {
  from { transform: translateX(0%); }
  to   { transform: translateX(391%); }
}

/* Vertical sweep — portrait (non-shoe) container.
   Uses @property so --scan-pos interpolates in keyframes (Safari 16.4+, Chrome 85+).
   The ::after fills the img wrapper (inset:0) and renders a moving gradient band
   whose center tracks --scan-pos, sweeping from above the top edge to below the bottom. */
@property --scan-pos {
  syntax: "<percentage>";
  inherits: false;
  initial-value: -12%;
}

.item-photo-section:not(.item-photo-section--landscape).is-analyzing .item-photo-img-wrap::after {
  animation: scan-sweep-v 1.6s ease-in-out infinite alternate;
  background: linear-gradient(
    180deg,
    transparent calc(var(--scan-pos) - 12%),
    rgba(255, 255, 255, 0.52) calc(var(--scan-pos) - 4%),
    rgba(255, 255, 255, 0.72) var(--scan-pos),
    rgba(255, 255, 255, 0.52) calc(var(--scan-pos) + 4%),
    transparent calc(var(--scan-pos) + 12%)
  );
  bottom: 0;
  content: "";
  left: 0;
  pointer-events: none;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 2;
}

@keyframes scan-sweep-v {
  from { --scan-pos: -12%; }
  to   { --scan-pos: 112%; }
}

.item-photo-section.analysis-failed .item-photo-status {
  color: #8f5f18;
}

.form-grid label {
  color: var(--muted);
  display: grid;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
}

.form-grid label[hidden] {
  display: none;
}

.item-choice-select {
  display: none;
}

.form-grid label.needs-attention {
  color: var(--warn);
}

.form-grid label.needs-attention input,
.form-grid label.needs-attention select,
.form-grid label.needs-attention textarea {
  background: var(--warn-bg);
  border-color: #dca738;
  box-shadow: 0 0 0 3px rgba(220, 167, 56, 0.16);
}

.form-grid textarea {
  line-height: 1.25;
  min-height: 40px;
  overflow: hidden;
  resize: none;
}

.wide {
  grid-column: 1 / -1;
}

.dialog-actions {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 16px;
}

.upload-pending-badge {
  background: rgba(0, 0, 0, 0.55);
  border-radius: 4px;
  font-size: 14px;
  left: 6px;
  line-height: 1;
  padding: 3px 5px;
  position: absolute;
  top: 6px;
  z-index: 2;
}

.upload-failed-toast {
  background: #b71c1c;
  border-radius: 10px;
  bottom: 90px;
  color: #fff;
  font-size: 13px;
  left: 12px;
  line-height: 1.4;
  opacity: 0;
  padding: 10px 14px;
  position: fixed;
  right: 12px;
  transition: opacity 300ms ease;
  z-index: 9999;
}

.upload-failed-toast.is-visible {
  opacity: 1;
}

.item-save-button {
  align-items: center;
  display: flex;
  gap: 7px;
  justify-content: center;
}

.item-save-spinner {
  animation: wardrobe-spin 0.8s linear infinite;
  animation-play-state: paused;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  border-top-color: #ffffff;
  flex-shrink: 0;
  height: 14px;
  opacity: 0;
  width: 14px;
}

.item-dialog.is-saving .item-save-spinner {
  animation-play-state: running;
  opacity: 1;
}

.item-dialog.is-saving .item-save-label {
  font-size: 0;
}

.item-dialog.is-saving .item-save-label::after {
  content: "Saving…";
  font-size: 1rem;
}

.image-dialog {
  background: #ffffff;
  border-radius: 8px;
  height: min(920px, calc(100vh - 20px));
  overflow: hidden;
  width: min(1180px, calc(100vw - 20px));
}

.image-dialog:not([open]) {
  display: none;
}

.image-stage {
  align-items: center;
  background: #ffffff;
  cursor: default;
  display: flex;
  height: 100%;
  justify-content: center;
  overflow: hidden;
  padding: 24px;
  position: relative;
  touch-action: none;
}

#viewerCanvas {
  display: none;
  height: 100%;
  left: 0;
  pointer-events: none;
  position: absolute;
  top: 0;
  width: 100%;
}

#viewerImage {
  max-height: calc(100vh - 150px);
  max-width: calc(100vw - 250px);
  opacity: 1;
  transform-origin: center;
  transition: opacity 500ms ease;
  user-select: none;
  will-change: transform;
}

.image-stage.is-loading #viewerImage {
  opacity: 0;
}

.image-dialog.is-shoe-viewer #viewerImage {
  background: #fff;
  max-height: calc(100vh - 220px);
  max-width: calc(100vw - 96px);
  object-fit: contain;
}

.viewer-caption {
  background: rgba(255, 255, 255, 0.92);
  border-top: 1px solid var(--line);
  bottom: 0;
  left: 0;
  padding: 9px 48px 11px;
  position: absolute;
  right: 0;
  text-align: center;
}

.viewer-actions {
  align-items: center;
  display: grid;
  gap: 8px;
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 124px;
  z-index: 3;
}

.caption-action-button {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  min-height: 32px;
  padding: 6px 10px;
}

.caption-action-button:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.detail-dialog,
.outfit-dialog,
.schedule-dialog,
.created-outfit-dialog,
.outfits-dialog,
.calendar-dialog {
  max-width: 980px;
  width: calc(100vw - 32px);
}

.outfit-dialog {
  max-height: calc(100vh - 24px);
  overflow: auto;
}

.detail-shell,
.outfit-shell,
.schedule-shell,
.created-outfit-shell,
.outfits-shell,
.calendar-shell {
  background: var(--bg);
  padding: 22px;
  box-sizing: border-box;
  min-width: 0;
}

.schedule-dialog {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(34, 30, 22, 0.22);
  overflow: hidden;
}

.schedule-dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
}

.schedule-shell {
  width: 100%;
}

.schedule-dialog .dialog-actions {
  text-align: center;
}

.created-outfit-dialog {
  max-width: 560px;
}

.detail-shell > .dialog-header {
  position: relative;
  text-align: center;
}

.detail-shell > .dialog-header > div {
  flex: 1 1 auto;
  padding: 4px 44px 0;
}

.detail-shell > .dialog-header .icon-button {
  position: absolute;
  right: 0;
  top: 0;
}

#detailTitle {
  font-size: 20px;
  line-height: 1.15;
  margin: 0;
}

.detail-title-type,
.detail-title-separator {
  font-weight: 500;
}

.detail-title-brand {
  font-weight: 800;
}

.created-outfit-shell .dialog-header {
  display: block;
  position: relative;
  text-align: center;
}

.created-outfit-shell .dialog-header h2 {
  font-size: 20px;
  margin: 0;
}

.created-outfit-shell .dialog-header .icon-button {
  position: absolute;
  right: 0;
  top: 0;
}

.outfits-dialog {
  max-width: 720px;
}

.calendar-dialog {
  max-width: 760px;
}

#detailSubtitle {
  color: var(--muted);
  margin-top: 3px;
  text-align: center;
}

.detail-layout {
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(220px, 320px) 1fr;
  margin-top: 18px;
}

.detail-image-wrap {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  min-height: 320px;
  overflow: hidden;
  padding: 14px;
  position: relative;
}

.detail-image-wrap img {
  max-height: 420px;
  max-width: 100%;
  object-fit: contain;
}

#detailFullBg {
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  bottom: 14px;
  left: 14px;
  pointer-events: none;
  position: absolute;
  right: 14px;
  top: 14px;
}


.detail-image-wrap.is-shoe {
  height: 260px;
  min-height: 0;
}

.detail-image-wrap.is-loading {
  position: relative;
}

.detail-image-wrap.is-loading::after {
  animation: spin 0.8s linear infinite;
  border: 3px solid var(--line-soft);
  border-radius: 50%;
  border-top-color: var(--accent, #666);
  content: "";
  height: 32px;
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
}

@keyframes spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.detail-main {
  display: grid;
  gap: 16px;
}

.detail-action-section {
  display: flex;
  justify-content: flex-end;
}

.detail-action-section .primary-button {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  min-width: 150px;
}

.detail-action-section .primary-button:hover,
.detail-action-section .primary-button:focus-visible,
.detail-action-section .primary-button:active {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(40, 93, 82, 0.08);
  color: var(--accent);
  text-decoration: none;
  transform: none;
}

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

.detail-stats div,
.detail-section {
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 14px;
}

.detail-stats span {
  color: var(--ink);
  display: block;
  font-size: 14px;
  font-weight: 700;
  text-transform: none;
}

.detail-stats strong {
  color: var(--ink-soft);
  display: block;
  font-size: 15px;
  font-weight: 600;
  margin-top: 4px;
}

.detail-section h3 {
  color: var(--ink);
  font-size: 15px;
  font-weight: 850;
  margin: 0 0 12px;
  text-align: center;
}

.section-heading-row {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-heading-row h3 {
  margin: 0;
}

.text-button {
  background: transparent;
  border: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
  min-height: 0;
  padding: 3px 0;
}

.text-button:hover {
  color: var(--accent-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.outfit-form {
  margin-top: 18px;
}

.outfit-dialog .dialog-header {
  background: var(--bg);
  border-bottom: 1px solid var(--line-soft);
  box-shadow: 0 8px 18px rgba(244, 242, 237, 0.96);
  display: grid;
  gap: 10px 12px;
  grid-template-areas:
    "title center gear close"
    "styles styles styles styles";
  grid-template-columns: auto minmax(0, 1fr) 32px auto;
  margin: -22px -22px 10px;
  overflow: visible;
  padding: 14px 22px 10px;
  position: sticky;
  top: 0;
  z-index: 80;
}

.outfit-title-row {
  align-items: center;
  display: flex;
  gap: 14px;
  grid-area: title;
  min-width: 0;
}

.outfit-title-row h2 {
  font-size: 21px;
  line-height: 1;
  margin: 0;
}

.outfit-builder-spinner {
  border: 4px solid rgba(40, 93, 82, 0.16);
  border-radius: 50%;
  border-top-color: var(--accent);
  display: none;
  grid-column: 2;
  grid-row: 1;
  height: 30px;
  justify-self: start;
  margin-left: calc((100% - var(--outfit-mode-width, 0px)) / 4 - 15px);
  width: 30px;
}

.outfit-dialog.is-preparing-options .outfit-builder-spinner {
  animation: wardrobe-spin 0.85s linear infinite;
  display: inline-block;
}

.outfit-notes {
  color: var(--muted);
  display: grid;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
}

.outfit-settings-gear {
  align-self: center;
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  grid-area: gear;
  justify-self: center;
  min-height: 0;
  opacity: 0.55;
  padding: 4px;
  transition: opacity 150ms ease;
}

.outfit-settings-gear:hover,
.outfit-dialog.is-settings-open .outfit-settings-gear {
  background: transparent;
  border: none;
  box-shadow: none;
  opacity: 1;
}

.outfit-settings-gear:focus {
  outline: none;
}

.outfit-settings-gear:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.outfit-settings-scrim {
  display: none;
  inset: 0;
  position: fixed;
  background: rgba(20, 17, 12, 0.45);
  /* Absorb all touch events so gestures on the scrim don't scroll content beneath it. */
  touch-action: none;
  z-index: 70;
}

.outfit-dialog.is-settings-open .outfit-settings-scrim {
  display: block;
}

.settings-divider {
  background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.25), transparent);
  border: none;
  height: 1px;
  margin: 20px 0;
}

.settings-done-button {
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: #fff;
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 16px auto 0;
  min-height: 0;
  padding: 6px 28px;
  width: fit-content;
}

.settings-done-button:hover {
  background: var(--accent);
  border: none;
  opacity: 0.88;
}

/* Lock background scroll while the settings panel is open. */
.outfit-dialog.is-settings-open .outfit-form {
  overflow: hidden;
  touch-action: none;
}

.outfit-settings-panel {
  background: #fff;
  border: none;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(34, 30, 22, 0.22), 0 2px 8px rgba(34, 30, 22, 0.10);
  display: none;
  left: 50%;
  padding: 20px 22px 22px;
  position: fixed;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 290px;
  z-index: 300;
}

.outfit-dialog.is-settings-open .outfit-settings-panel {
  display: block;
}

.settings-panel-title {
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 16px;
  text-align: center;
}

.settings-row {
  align-items: center;
  display: flex;
  justify-content: center;
}

.outfit-mode {
  background: var(--bg-soft);
  border-radius: 999px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 2px;
  position: relative;
}

.outfit-mode-thumb {
  background: #fff;
  border-radius: 999px;
  bottom: 2px;
  box-shadow: 0 1px 3px rgba(34, 30, 22, 0.12);
  left: 2px;
  pointer-events: none;
  position: absolute;
  top: 2px;
  transition: transform 420ms ease-in-out;
  width: calc(50% - 2px);
  will-change: transform;
}

.outfit-mode.is-separates .outfit-mode-thumb {
  transform: translateX(100%);
}

.outfit-mode label {
  -webkit-tap-highlight-color: transparent;
  align-items: center;
  border: none;
  color: var(--ink-soft);
  cursor: pointer;
  display: flex;
  font-size: 10px;
  font-weight: 750;
  justify-content: center;
  min-height: 22px;
  padding: 2px 10px;
  position: relative;
  transition: color 420ms ease-in-out;
  user-select: none;
  z-index: 1;
}

.outfit-mode:not(.is-separates) label:first-child,
.outfit-mode.is-separates label:last-child {
  color: var(--ink);
}

.outfit-mode input {
  appearance: none;
  display: none;
  outline: none;
  pointer-events: none;
}

.outfit-header-actions {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-area: styles;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
}

.outfit-dialog-close {
  grid-area: close;
  justify-self: end;
}

.outfit-builder-layout {
  display: grid;
  gap: 12px;
  padding: 0;
  position: relative;
  z-index: 0;
}

.outfit-slots {
  display: grid;
  gap: 12px;
}

.outfit-slot-row {
  background: #fff;
  border-radius: 10px;
  display: grid;
  gap: 0;
  overflow: hidden;
  padding: 14px 0 10px;
  position: relative;
  z-index: 0;
}

.outfit-slot-row.is-active {
  box-shadow: none;
}

.outfit-slot-row.is-locked {
  box-shadow: none;
}

.outfit-slot-row.is-preparing {
  opacity: 0.46;
  pointer-events: none;
}

.outfit-slot-row.is-preparing .outfit-carousel {
  filter: grayscale(0.25);
}

.outfit-slot-header {
  align-items: center;
  display: flex;
  gap: 10px;
  left: 4px;
  justify-content: space-between;
  position: absolute;
  right: 4px;
  top: 10px;
  z-index: 1;
}

.slot-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.slot-label-anchor {
  display: inline-block;
  margin-left: 4px;
}

.separates-shuffle-button {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  padding: 7px 10px;
}

.separates-shuffle-button:hover {
  border-color: var(--accent);
}

.outfit-notes {
  margin: 0;
}

.picker-header {
  display: none;
}

#pickerTitle {
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 750;
}

.ai-suggest-button {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  display: inline-flex;
  font-size: 14px;
  font-weight: 800;
  gap: 5px;
  min-height: 38px;
  padding: 5px 12px 5px 14px;
  justify-content: center;
  min-width: 0;
  width: 100%;
}

.ai-suggest-button:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(40, 93, 82, 0.08);
}

.ai-suggest-button.is-active {
  background: rgba(40, 93, 82, 0.08);
  border-color: var(--accent);
  box-shadow: inset 0 2px 5px rgba(34, 30, 22, 0.12), 0 0 0 2px rgba(218, 146, 0, 0.28);
  transform: translateY(1px);
}

.ai-suggest-button.is-loading {
  cursor: wait;
  opacity: 0.82;
}

.ai-suggest-button.is-empty {
  cursor: not-allowed;
  opacity: 0.42;
}

.ai-suggest-button.is-empty:hover {
  border-color: var(--line);
  box-shadow: none;
}

.suggest-count {
  color: var(--muted);
  font-size: 0.9em;
  margin-left: 1px;
  margin-right: 10px;
}

.suggest-spinner {
  border: 2px solid rgba(40, 93, 82, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  display: none;
  height: 12px;
  width: 12px;
}

.ai-suggest-button.is-loading .suggest-spinner {
  display: none;
}

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

.suggestion-box-icon {
  fill: none;
  flex: 0 0 auto;
  height: 21px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
  width: 31px;
}

.suggestion-box-icon-avant {
  width: 35px;
}

.suggestion-box-icon .box-back {
  opacity: 0.68;
}

.outfit-carousel {
  align-items: center;
  cursor: grab;
  display: block;
  margin-left: -18px;
  margin-right: -18px;
  min-height: 274px;
  overflow: hidden;
  padding: 18px 0 24px;
  position: relative;
  touch-action: pan-y;
  user-select: none;
  --carousel-card-width: 166px;
  --carousel-gap: 18px;
  width: calc(100% + 36px);
}

.outfit-carousel:active {
  cursor: grabbing;
}

.rail-button {
  align-items: center;
  align-self: center;
  backdrop-filter: blur(2px);
  background: rgba(255, 255, 255, 0.68);
  border-color: rgba(214, 205, 192, 0.62);
  border-radius: 999px;
  color: var(--accent);
  display: inline-flex;
  font-size: 15px;
  font-weight: 800;
  height: 24px;
  justify-content: center;
  line-height: 1;
  min-height: 24px;
  padding: 0;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  z-index: 40;
}

.rail-button.prev {
  left: 0;
}

.rail-button.next {
  right: 0;
}

.rail-button:hover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.86);
}

.rail-button:disabled {
  color: var(--line);
  cursor: default;
  opacity: 0.45;
}

.rail-button:disabled:hover {
  border-color: var(--line);
}

.outfit-carousel-track {
  align-items: center;
  display: block;
  gap: var(--carousel-gap);
  height: 100%;
  justify-items: start;
  margin: 0;
  overflow: visible;
  padding: 0;
  position: relative;
  transform: translateX(0);
  transition: none;
}

.slot-shoes .outfit-carousel {
  min-height: 184px;
  padding-left: 0;
  padding-right: 0;
  --carousel-card-width: 268px;
  --carousel-gap: 30px;
}

.slot-shoes .outfit-carousel-track {
  gap: var(--carousel-gap);
}

.locked-seed-carousel {
  margin: 0 auto;
  max-width: 230px;
  min-height: auto;
  padding: 0;
  width: 100%;
}

.locked-seed-track {
  display: block;
  overflow: visible;
  transform: none !important;
}

.locked-seed-card {
  cursor: default;
  flex-basis: 100%;
  opacity: 1;
  pointer-events: none;
  transform: none;
  width: 100%;
}

.locked-seed-card img {
  aspect-ratio: 0.62;
}

.outfit-option-card {
  background: #fff;
  border: 1px solid transparent;
  border-radius: 8px;
  display: grid;
  flex: 0 0 var(--carousel-card-width);
  gap: 4px;
  grid-template-rows: 1fr auto;
  opacity: var(--carousel-opacity, 1);
  padding: 6px;
  text-align: center;
  transform-origin: center center;
  transform: scale(var(--carousel-scale, 0.78));
  transition: box-shadow 180ms ease;
  width: var(--carousel-card-width);
  will-change: transform;
}

.outfit-carousel:not(.locked-seed-carousel) .outfit-option-card {
  left: 0;
  position: absolute;
  top: 50%;
}

.outfit-option-card:hover,
.outfit-option-card.is-selected {
  border-color: transparent;
  box-shadow: none;
}

.outfit-option-card.is-current {
  border-color: transparent;
  box-shadow: none;
  opacity: 1;
}

.outfit-option-card.locked-seed-card {
  flex-basis: 100%;
  transform: none;
  width: 100%;
}

.outfit-option-card.is-fringe {
  box-shadow: none;
}

.outfit-option-card.is-fringe img {
  object-fit: cover;
}

.outfit-option-card.is-current.is-selected {
  box-shadow: none;
}

.outfit-option-card img {
  aspect-ratio: 0.62;
  background: transparent;
  border-radius: 4px;
  color: transparent;
  display: block;
  font-size: 0;
  object-fit: cover;
  padding: 0;
  width: 100%;
}

.outfit-option-card img.is-image-missing {
  opacity: 0;
}

.outfit-option-card.category-shoes img,
.outfit-option-card.category-shoes.is-current img,
.locked-seed-card.category-shoes img {
  aspect-ratio: 1.78;
  background: #fff;
  object-fit: contain;
}

.slot-shoes .outfit-option-card.category-shoes {
  max-width: none;
}

.outfit-option-card span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 650;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.outfit-option-caption {
  align-items: baseline;
  display: inline-flex;
  gap: 5px;
  justify-content: center;
  min-width: 0;
}

.outfit-option-separator {
  color: var(--muted);
  font-weight: 400;
}

.outfit-option-card strong {
  color: var(--ink-soft);
  font-weight: 700;
}

.clear-option {
  align-content: center;
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
}

.picker-empty {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 13px;
  justify-content: center;
  min-height: 82px;
  padding: 8px 10px;
  text-align: center;
}

.aesthetic-logic {
  background: var(--panel-tint);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  display: grid;
  gap: 6px;
  padding: 12px 14px;
}

.aesthetic-logic h3 {
  color: var(--accent);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0;
  margin: 0;
  text-transform: uppercase;
}

.aesthetic-logic p {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.45;
  margin: 0;
}

.aesthetic-logic p.is-updating {
  color: var(--muted);
  font-style: italic;
}

.detail-empty {
  color: var(--muted);
  font-size: 13px;
}

.detail-list {
  display: grid;
  column-gap: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  row-gap: 8px;
}

.detail-list div {
  border-top: 0;
  display: grid;
  gap: 3px;
  padding-top: 0;
  position: relative;
  text-align: center;
}

.detail-date-cell:nth-child(3n + 2)::before,
.detail-date-cell:nth-child(3n + 3)::before {
  background: var(--line-soft);
  bottom: 18%;
  content: "";
  left: 0;
  position: absolute;
  top: 18%;
  width: 1px;
}

.detail-list strong {
  color: var(--ink-soft);
  font-size: 13px;
}

.detail-list span {
  color: var(--muted);
  font-size: 12px;
}

.mobile-preview-mode .detail-list {
  column-gap: 10px;
  grid-template-columns: repeat(3, max-content);
  justify-content: center;
}

.mobile-preview-mode .detail-date-cell {
  font-size: 12px;
  white-space: nowrap;
}

.mobile-preview-mode .detail-date-cell:nth-child(3n + 2)::before,
.mobile-preview-mode .detail-date-cell:nth-child(3n + 3)::before {
  left: -5px;
}

.mobile-preview-mode .detail-outfit-list {
  grid-template-columns: 1fr;
  justify-items: center;
}

.mobile-preview-mode .detail-outfit-thumbnail {
  width: min(100%, 210px);
}

.mobile-preview-mode .detail-outfit-thumbnail::before {
  padding-top: 120%;
}

.mobile-preview-mode .detail-outfit-thumbnail-collage {
  height: 318px;
  transform: translate(-50%, -50%) scale(0.54);
}

.detail-outfit-list {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-outfit-thumbnail {
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  display: block;
  overflow: hidden;
  padding: 0;
  position: relative;
  width: 100%;
}

.detail-outfit-thumbnail:hover,
.detail-outfit-thumbnail:focus-visible {
  box-shadow: 0 0 0 3px rgba(40, 93, 82, 0.08);
  outline: 0;
}

.detail-outfit-thumbnail-collage {
  height: 320px;
  left: 50%;
  position: relative;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.52);
  transform-origin: center;
  width: 286px;
}

.detail-outfit-thumbnail::before {
  content: "";
  display: block;
  padding-top: 100%;
}

.detail-outfit-thumbnail > .detail-outfit-thumbnail-collage {
  position: absolute;
}

.detail-outfit-description {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  gap: 8px;
  line-height: 1.4;
  margin: 0;
}

.detail-outfit-description-row {
  display: grid;
  gap: 1px;
}

.detail-outfit-description-row strong {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.15;
}

.detail-outfit-description-row span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
}

.outfit-stack-inline-details {
  align-self: stretch;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 12px 14px;
}

.detail-outfit-preview-dialog {
  max-width: min(430px, calc(100vw - 64px));
  width: auto;
}

.detail-outfit-preview-dialog::backdrop {
  background: rgba(28, 25, 20, 0.42);
}

.detail-outfit-preview-shell {
  background: var(--panel-tint);
  padding: 12px;
  position: relative;
}

.detail-outfit-preview-shell > .dialog-header {
  justify-content: flex-end;
  min-height: 42px;
  padding: 0;
}

.detail-outfit-preview-body {
  display: grid;
  justify-items: center;
  margin-top: 0;
}

.schedule-date-field {
  color: var(--muted);
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  margin-top: 16px;
  min-width: 0;
}

.schedule-date-field input[type="date"] {
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.schedule-dialog .dialog-actions {
  text-align: center;
}

.outfits-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.calendar-list {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.primary-view > .outfits-list,
.primary-view > .calendar-list {
  margin-top: 0;
}

.calendar-date-group {
  display: grid;
  gap: 8px;
}

.calendar-entry-date {
  color: var(--accent);
  font-size: 14px;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1.1;
  margin: 2px 0 0;
  text-align: center;
}

.calendar-entries {
  display: grid;
  gap: 8px;
}

.saved-outfit-row,
.calendar-entry {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  display: grid;
  gap: 16px;
  grid-template-columns: auto 1fr auto;
  padding: 12px;
}

.calendar-entry {
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  position: relative;
}

.saved-outfit-row {
  grid-template-columns: 1fr;
  justify-items: center;
  position: relative;
}

.outfit-delete-button {
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--ink-2, #888);
  cursor: pointer;
  height: 28px;
  width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  position: absolute;
  right: 6px;
  top: 6px;
  opacity: 0.6;
  transition: opacity 0.15s, color 0.15s, border-color 0.15s;
  z-index: 2;
}

.outfit-delete-button:hover,
.outfit-delete-button:active {
  color: #c0392b;
  opacity: 1;
}

.saved-outfit-row--deleted {
  opacity: 0.7;
}

.outfit-restore-bar {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-top: 10px;
  padding: 4px 2px;
  width: 100%;
  max-width: 340px;
}

.outfit-restore-days {
  color: var(--ink-2, #888);
  font-size: 13px;
}

.dialog-header-actions {
  display: flex;
  gap: 8px;
}

.icon-button--active {
  background: var(--accent, #246154);
  border-color: var(--accent, #246154);
  color: #fff;
}

.search-row-actions {
  align-items: center;
  display: flex;
  gap: 14px;
}

.view-trash-button {
  align-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-light, #777);
  display: inline-grid;
  font-size: 0;
  height: 30px;
  justify-content: center;
  min-height: 30px;
  padding: 0;
  position: relative;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
  width: 30px;
}
.view-trash-button::before {
  content: "🗑";
  font-size: 14px;
  line-height: 1;
}
.view-trash-button[hidden] {
  display: none;
}
.view-trash-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.view-trash-button--active {
  background: var(--accent);
  border-color: var(--accent);
}
.view-trash-button--active::before {
  filter: brightness(10);
}

#outfitsSearch,
#calendarSearch {
  margin-bottom: 18px;
}

.outfits-filter-panel {
  grid-template-columns: minmax(160px, 1fr) minmax(200px, 1fr) auto auto;
}

.created-outfit-preview {
  display: grid;
  justify-items: center;
  margin-top: 18px;
  min-height: 280px;
  width: 100%;
}

.outfit-stack-card--created {
  max-width: 420px;
  width: 100%;
}

.outfit-stack-card--created .outfit-stack-content {
  gap: 16px;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
}

.outfit-stack-card--created .outfit-stack-composition-panel {
  justify-self: center;
}

.outfit-stack-card--created .outfit-stack-count {
  display: none;
}

.outfit-stack-card--created .outfit-stack-selfie-panel.has-photo {
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.outfit-stack-card--created .outfit-stack-photo {
  border-radius: 0;
  max-width: 100%;
  width: 100%;
}

.outfit-stack-card--created .outfit-stack-selfie-panel.has-photo .selfie-action-button {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  bottom: 10px;
  left: 50%;
  margin: 0;
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
}

.created-outfit-actions {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 18px;
  padding-top: 18px;
}

.created-outfit-actions .primary-button,
.created-outfit-actions .text-button {
  border-radius: 6px;
  font-size: 14px;
  min-height: 42px;
  padding: 8px 22px;
}

.created-outfit-actions .text-button {
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(211, 201, 188, 0.95);
}

.created-outfit-actions .text-button:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.saved-outfit-row .text-button {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(211, 201, 188, 0.9);
  border-radius: 999px;
  justify-self: center;
  margin-top: 0;
  padding: 7px 14px;
}

.outfit-card-actions,
.calendar-entry-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 10px;
}

.outfit-card-actions .text-button,
.calendar-entry-actions .text-button {
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(211, 201, 188, 0.95);
  border-radius: 999px;
  padding: 7px 14px;
}

.selfie-action-button {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(211, 201, 188, 0.95);
  border-radius: var(--m-control-radius, 6px);
  color: var(--accent);
  cursor: pointer;
  font-weight: 800;
  padding: 7px 14px;
  white-space: nowrap;
}

.selfie-action-button:hover,
.selfie-action-button:focus-visible,
.selfie-action-button:active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(40, 93, 82, 0.08);
  text-decoration: none;
}

.selfie-action-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.calendar-entry {
  grid-template-columns: 1fr;
  justify-items: center;
}

.outfit-stack-card {
  align-items: center;
  display: grid;
  justify-items: center;
  position: relative;
  width: clamp(220px, 34vw, 300px);
}

.outfit-stack-content {
  align-items: start;
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(220px, 300px);
  justify-items: center;
}

.outfit-stack-composition-panel {
  align-items: center;
  display: grid;
  gap: 16px;
  justify-items: center;
  width: 100%;
}

.outfit-stack-composition-panel .text-button {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(211, 201, 188, 0.95);
  border-radius: 999px;
  cursor: pointer;
  padding: 7px 14px;
}

.outfit-stack-composition-panel .text-button:hover,
.outfit-stack-composition-panel .text-button:focus-visible,
.outfit-stack-composition-panel .text-button:active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(40, 93, 82, 0.08);
  color: var(--accent);
  text-decoration: none;
}

.outfit-stack-card--with-photo {
  width: min(100%, 820px);
}

.outfit-stack-card--with-photo .outfit-stack-content {
  align-items: stretch;
  grid-template-columns: minmax(220px, 300px) minmax(260px, 420px);
}

.outfit-stack-card--with-photo .outfit-stack-composition-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.outfit-stack-card--with-photo .outfit-stack-composition-panel .text-button {
  margin-top: auto;
}

.outfit-stack-selfie-panel {
  align-items: center;
  background: rgba(255, 255, 255, 0.58);
  border: 1px dashed rgba(36, 97, 84, 0.34);
  border-radius: 8px;
  box-shadow: none;
  display: grid;
  gap: 12px;
  justify-items: center;
  min-height: 350px;
  padding: 14px;
  width: 100%;
}

.outfit-stack-selfie-panel.has-photo {
  align-items: center;
  background: transparent;
  border: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  padding: 0;
}

.outfit-stack-selfie-panel.has-photo .selfie-action-button {
  margin-top: auto;
}

.outfit-stack-selfie-panel .selfie-action-button {
  margin: 0;
}

.outfit-stack-selfie-empty {
  align-items: center;
  display: grid;
  height: 280px;
  justify-items: center;
  text-align: center;
  width: 100%;
}

.outfit-stack-photo {
  border-radius: 6px;
  display: block;
  height: auto;
  max-height: 520px;
  object-fit: scale-down;
  width: 100%;
}

.outfit-stack-count {
  align-items: center;
  appearance: none;
  background: rgba(255, 255, 255, 0.72);
  border: 1.25px solid rgba(36, 97, 84, 0.52);
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(44, 39, 31, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.95);
  color: rgba(36, 97, 84, 0.68);
  cursor: pointer;
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  height: 23px;
  justify-content: center;
  letter-spacing: 0;
  line-height: 1;
  min-height: 0;
  min-width: 0;
  padding: 0;
  position: absolute;
  left: 15%;
  top: 168px;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, color 140ms ease, transform 140ms ease;
  width: 23px;
  z-index: 8;
}

.outfit-stack-count:hover,
.outfit-stack-count:focus-visible {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 3px 10px rgba(44, 39, 31, 0.18), 0 0 0 3px rgba(36, 97, 84, 0.12);
  color: var(--accent);
  outline: 0;
  transform: translateY(-1px);
}

.outfit-stack-collage {
  height: 300px;
  position: relative;
  width: 100%;
}

.outfit-stack-image {
  background: #fff;
  border-radius: 2px;
  display: block;
  object-fit: cover;
  position: absolute;
}

.outfit-stack-suit,
.outfit-stack-shirt,
.outfit-stack-tie,
.outfit-stack-trousers {
  box-shadow: 0 1px 2px rgba(44, 39, 31, 0.08);
}

.outfit-stack-trousers {
  height: 132px;
  left: 39%;
  top: 128px;
  width: 28%;
  z-index: 0;
}

.outfit-stack-suit {
  height: 150px;
  left: 16%;
  top: 10px;
  width: 34%;
  z-index: 2;
}

.outfit-stack-shirt {
  height: 136px;
  left: 42%;
  top: 22px;
  width: 33%;
  z-index: 1;
}

.outfit-stack-tie {
  height: 108px;
  left: 34%;
  top: 68px;
  width: 30%;
  z-index: 3;
}

.outfit-stack-shoes {
  background: transparent;
  height: 86px;
  left: 22%;
  object-fit: contain;
  top: 226px;
  width: 66%;
  z-index: 4;
}

.outfit-stack-card--mockup {
  width: clamp(260px, 38vw, 360px);
}

.outfit-stack-card--mockup .outfit-stack-content {
  grid-template-columns: minmax(260px, 360px);
}

.outfit-stack-card--mockup .outfit-stack-collage {
  height: 330px;
}

.outfit-stack-card--mockup .outfit-stack-count {
  background: rgba(255, 255, 255, 0.62);
  border-color: rgba(36, 97, 84, 0.38);
  color: rgba(36, 97, 84, 0.58);
  font-size: 10px;
  height: 21px;
  left: 20%;
  min-width: 21px;
  top: 218px;
  z-index: 12;
}

@media (max-width: 520px) {
  .outfit-stack-card--with-photo {
    width: min(100%, 360px);
  }

  .outfit-stack-card--with-photo .outfit-stack-content {
    gap: 12px;
    grid-template-columns: 1fr;
  }

  .outfit-stack-selfie-panel {
    min-height: 0;
    width: min(100%, 260px);
  }
}

.outfit-mockup-figure {
  height: 100%;
  position: relative;
  width: 100%;
}

.outfit-mockup-layer {
  background-color: #f4f1eb;
  background-image: var(--mockup-image);
  background-position: center;
  background-repeat: repeat;
  background-size: 130px 190px;
  position: absolute;
}

.outfit-mockup-shirt {
  background-size: cover;
  clip-path: polygon(38% 7%, 62% 7%, 70% 74%, 30% 74%);
  height: 236px;
  left: 22%;
  top: 12px;
  width: 56%;
  z-index: 1;
}

.outfit-mockup-collar-left,
.outfit-mockup-collar-right {
  background-size: cover;
  height: 42px;
  top: 30px;
  width: 15%;
  z-index: 6;
}

.outfit-mockup-collar-left {
  clip-path: polygon(0 0, 100% 0, 76% 100%, 0 54%);
  left: 37.5%;
}

.outfit-mockup-collar-right {
  clip-path: polygon(0 0, 100% 0, 100% 54%, 24% 100%);
  left: 47.5%;
}

.outfit-mockup-jacket-left,
.outfit-mockup-jacket-right {
  background-color: #3a3a3a;
  background-size: 116px 190px;
  height: 240px;
  top: 38px;
  width: 46%;
  z-index: 2;
}

.outfit-mockup-jacket-left {
  clip-path: polygon(8% 14%, 50% 0, 54% 75%, 14% 82%, 0 50%);
  left: 7%;
}

.outfit-mockup-jacket-right {
  clip-path: polygon(50% 0, 92% 14%, 100% 50%, 86% 82%, 46% 75%);
  left: 47%;
}

.outfit-mockup-lapel-left,
.outfit-mockup-lapel-right {
  background-color: rgba(255, 255, 255, 0.18);
  background-blend-mode: screen;
  background-size: 96px 160px;
  height: 150px;
  top: 52px;
  width: 18%;
  z-index: 4;
}

.outfit-mockup-lapel-left {
  clip-path: polygon(18% 0, 100% 24%, 82% 100%, 0 40%);
  left: 31%;
}

.outfit-mockup-lapel-right {
  clip-path: polygon(0 24%, 82% 0, 100% 40%, 18% 100%);
  left: 51%;
}

.outfit-mockup-tie {
  background-color: #7d2030;
  background-size: 90px 150px;
  clip-path: polygon(42% 0, 58% 0, 68% 24%, 58% 100%, 42% 100%, 32% 24%);
  height: 166px;
  left: 43%;
  top: 64px;
  width: 14%;
  z-index: 8;
}

.outfit-mockup-neck {
  background: linear-gradient(135deg, #ded5d1, #f5f0ee 48%, #cfc4c1);
  border-radius: 50% 50% 44% 44%;
  height: 34px;
  left: 43.8%;
  position: absolute;
  top: 7px;
  width: 12.4%;
  z-index: 7;
}

.outfit-mockup-shoes {
  background: transparent;
  display: block;
  height: 78px;
  left: 16%;
  object-fit: contain;
  position: absolute;
  top: 246px;
  width: 68%;
  z-index: 10;
}

.outfit-stack-details {
  backdrop-filter: blur(2px);
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(44, 39, 31, 0.18);
  left: 50%;
  max-height: 178px;
  overflow: hidden;
  padding: 14px 46px 12px 12px;
  position: absolute;
  top: 42px;
  transform: translateX(-50%);
  width: min(252px, calc(100% - 14px));
  z-index: 20;
}

.outfit-stack-details-close {
  align-items: center;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(211, 201, 188, 0.95);
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  font-weight: 500;
  height: 18px;
  justify-content: center;
  line-height: 0.9;
  min-height: 0;
  padding: 0;
  position: absolute;
  right: 10px;
  top: 10px;
  width: 18px;
}

.outfit-stack-details-list {
  display: grid;
  gap: 4px;
}

.outfit-stack-details-heading {
  color: var(--accent);
  display: block;
  font-size: 12px;
  margin-bottom: 7px;
}

.outfit-stack-details-row {
  display: grid;
  gap: 1px;
}

.outfit-stack-details-row strong {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.15;
}

.outfit-stack-details-row span {
  color: var(--muted);
  display: -webkit-box;
  font-size: 11px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  line-height: 1.15;
  overflow: hidden;
}

.outfit-stack-empty {
  color: var(--muted);
  font-size: 11px;
}

.saved-outfit-body,
.calendar-entry-body {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.saved-outfit-body strong,
.calendar-entry-body strong {
  color: var(--ink-soft);
  font-size: 13px;
}

.saved-outfit-body span,
.calendar-entry-body span {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .saved-outfit-row,
  .calendar-entry {
    align-items: start;
    grid-template-columns: 1fr;
  }

  .saved-outfit-row .text-button {
    justify-self: center;
  }

  .outfit-stack-card:not(.outfit-stack-card--with-photo) {
    width: min(100%, 240px);
  }
}

.detail-photo-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
}

.detail-photo-grid img {
  aspect-ratio: 1;
  border-radius: 6px;
  object-fit: cover;
  width: 100%;
}

#viewerMeta {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-top: 2px;
}

#viewerTitle {
  display: block;
  font-size: 13px;
}

.viewer-close {
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-flex;
  font-size: 14px;
  font-weight: 500;
  height: 28px;
  justify-content: center;
  line-height: 0.9;
  min-height: 0;
  padding: 0 0 2px;
  position: absolute;
  right: 12px;
  top: 12px;
  width: 28px;
  z-index: 2;
}

.viewer-close:hover {
  background: #ffffff;
}

.viewer-close:focus,
.viewer-close:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(40, 93, 82, 0.12);
  outline: 0;
}

@media (max-width: 760px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  body {
    display: flex;
    flex-direction: column;
    font-size: 15px;
    min-height: 100dvh;
    overflow: hidden;
  }

  .topbar {
    align-items: center;
    background: var(--panel-tint);
    border-bottom: 1px solid var(--line);
    backdrop-filter: none;
    display: grid;
    flex: 0 0 auto;
    gap: 8px 12px;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 0;
    padding: 8px 12px 9px;
    position: relative;
    top: auto;
    z-index: 20;
  }

  .mobile-preview-mode .topbar {
    padding-top: 38px;
  }

  h1 {
    font-size: 90px;
  }

  .app-title {
    gap: 0;
    max-width: calc(100vw - 84px);
    white-space: nowrap;
  }

  .header-actions {
    display: grid;
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-left: 0;
    width: 100%;
  }

  .header-actions .summary-button {
    min-height: 30px;
    padding-bottom: 4px;
    padding-top: 4px;
  }

  .add-item-button {
    grid-column: 2;
    grid-row: 1;
    height: 30px;
    justify-self: end;
    min-height: 30px;
    width: 30px;
  }

  .view-trash-button {
    height: 30px;
    min-height: 30px;
    width: 30px;
  }

  .mobile-preview-mode {
    scrollbar-color: rgba(47, 48, 45, 0.14) transparent;
    scrollbar-width: thin;
  }

  .mobile-preview-mode * {
    scrollbar-color: rgba(47, 48, 45, 0.14) transparent;
    scrollbar-width: thin;
  }

  .mobile-preview-mode ::-webkit-scrollbar {
    height: 2px;
    width: 2px;
  }

  .mobile-preview-mode ::-webkit-scrollbar-track {
    background: transparent;
  }

  .mobile-preview-mode ::-webkit-scrollbar-thumb {
    background: rgba(47, 48, 45, 0.14);
    border-radius: 999px;
  }

  .mobile-preview-mode ::-webkit-scrollbar-button {
    display: none;
    height: 0;
    width: 0;
  }

  .mobile-preview-mode .outfit-dialog {
    scrollbar-gutter: stable;
  }

  .mobile-preview-mode .outfit-dialog::-webkit-scrollbar-track {
    margin-bottom: 18px;
    margin-top: 74px;
  }

  .mobile-preview-mode .rail-button {
    display: none;
  }

  .header-actions {
    display: grid;
    flex: 1 1 100%;
    gap: 6px;
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
  }

  .header-actions .summary-button {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line-soft);
    border-radius: var(--m-control-radius, 12px);
    font-size: 14px;
    font-weight: 800;
    min-height: 32px;
    overflow: hidden;
    padding: 5px 4px;
    text-align: center;
    text-overflow: ellipsis;
  }

  .header-actions .summary-button:not(:disabled):hover {
    border-color: var(--accent);
    text-decoration: none;
  }

  .image-dialog {
    border-radius: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    margin: 0;
    max-height: 100vh;
    max-width: none;
    overflow: hidden;
    width: 100vw;
  }

  .image-stage {
    align-items: center;
    flex: 1 1 auto;
    height: auto;
    justify-content: center;
    min-height: 0;
    order: 1;
    padding: 52px 12px 4px;
  }

  #viewerImage {
    max-height: 100%;
    max-width: calc(100vw - 24px);
  }

  .image-dialog.is-shoe-viewer #viewerImage {
    max-height: 100%;
    max-width: calc(100vw - 24px);
  }

  .viewer-close {
    right: 12px;
    top: 12px;
  }

  .viewer-caption {
    border-top: 0;
    bottom: auto;
    left: auto;
    order: 2;
    padding: 6px 42px 4px;
    position: static;
    right: auto;
  }

  .viewer-actions {
    border-top: 0;
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 18px;
    order: 3;
    padding: 0 12px 48px;
    position: static;
    transform: none;
    width: auto;
  }

  .layout {
    display: block;
    flex: 1 1 0;
    height: auto;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .layout[data-view="outfits"],
  .layout[data-view="calendar"] {
    display: block;
  }

  .sidebar {
    background: var(--panel-tint);
    border-bottom: 1px solid var(--line);
    border-right: 0;
    padding: 12px 14px 14px;
  }

  .search-tools-row {
    margin-top: 0;
  }

  .field-label {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.01em;
    margin-top: 12px;
  }

  .content {
    padding: 14px 14px 24px;
  }

  .primary-view {
    padding: 14px 14px 24px;
  }

  .content-header {
    margin-bottom: 10px;
  }

  .catalog-grid {
    gap: 14px;
    grid-template-columns: 1fr;
  }

  .item-card {
    border-radius: 8px;
  }

  .item-card:hover,
  .item-card:focus-within {
    transform: none;
  }

  .item-image-button {
    height: clamp(220px, 66vw, 330px);
    padding: 20px 14px 8px;
  }

  .filter-panel {
    grid-template-columns: 1fr;
  }

  .item-dialog form {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100dvh;
    overflow: auto;
    row-gap: 0;
  }

  .item-dialog .form-grid {
    gap: 8px;
    margin-top: 0;
  }

  .item-dialog .form-grid label {
    font-size: 11px;
    gap: 3px;
  }

  .item-dialog select,
  .item-dialog input[type="text"],
  .item-dialog textarea {
    font-size: 16px;
    font-weight: 400;
    min-height: 34px;
    padding: 6px 10px;
  }

  .item-dialog select,
  .item-dialog .item-choice-summary {
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%23285d52' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-position: right 10px center;
    background-repeat: no-repeat;
    background-size: 12px 12px;
    padding: 6px 30px 6px 10px;
  }

  .item-dialog select {
    appearance: none;
  }

  .item-dialog .item-choice-select {
    color: var(--accent);
    display: block;
    font-size: 12px;
    margin-top: 3px;
    min-height: 30px;
  }

.item-dialog .item-choice-summary {
    align-items: center;
    background-color: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    font-size: 16px;
    font-weight: 400;
    justify-content: space-between;
    min-height: 34px;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: capitalize;
    white-space: nowrap;
  }

  .item-dialog .item-choice-summary::-webkit-details-marker {
    display: none;
  }

  .item-dialog .item-choice-summary::after {
    content: none;
  }

  .item-dialog .item-choice-menu[open] .item-choice-summary {
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 7.5 6 4.5 9 7.5' fill='none' stroke='%23285d52' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    border-color: var(--accent);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  .item-dialog .item-choice-options {
    background: #fff;
    border: 1px solid var(--accent);
    border-top: 0;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 8px 18px rgba(34, 30, 22, 0.08);
    display: grid;
    max-height: min(180px, 34dvh);
    overflow: auto;
    overscroll-behavior: contain;
  }

  /* Category has a small fixed option set — show all without scrolling */
  .item-dialog .item-choice-menu[data-target-field="category"] .item-choice-options {
    max-height: none;
    overflow: visible;
  }

  .item-dialog .item-choice-option {
    align-items: center;
    border: 0;
    border-radius: 0;
    color: var(--ink);
    display: flex;
    font-size: 12px;
    font-weight: 650;
    gap: 8px;
    min-height: 32px;
    padding: 6px 10px;
    text-align: left;
    text-transform: capitalize;
    width: 100%;
  }

  .item-dialog .item-choice-color-swatch {
    align-self: stretch;
    border: none;
    border-radius: 0;
    display: block;
    margin-left: 8px;
  }

  .item-dialog .item-choice-summary-swatch {
    border: 1px solid rgba(0, 0, 0, 0.18);
    border-radius: 2px;
    display: inline-block;
    flex-shrink: 0;
    height: 14px;
    margin-right: 6px;
    width: 14px;
  }

  /* Color-picker summary: wide bar + name when a color is chosen */
  .item-dialog .item-choice-menu[data-is-color-picker="true"] .item-choice-summary.has-color {
    column-gap: 8px;
    display: grid;
    grid-template-columns: 1fr var(--color-col-w, 90px);
    padding-left: 0;
  }

  .item-dialog .item-choice-menu[data-is-color-picker="true"] .item-choice-summary.has-color
  .item-choice-summary-swatch {
    align-self: stretch;
    border: none;
    border-radius: 0;
    display: block;
    height: auto;
    margin-left: 8px;
    margin-right: 0;
    width: auto;
  }

  .item-dialog .item-choice-menu[data-is-color-picker="true"] .item-choice-summary.has-color
  .item-choice-summary-text {
    align-self: center;
    flex: none;
    overflow: visible;
    white-space: nowrap;
  }

  .item-dialog .item-choice-summary-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .item-dialog .item-choice-menu[data-is-color-picker="true"] .item-choice-options {
    max-height: min(300px, 55dvh);
  }

  /* Dropdown rows: shared label column width + same right padding as summary chevron slot */
  .item-dialog .item-choice-menu[data-is-color-picker="true"] .item-choice-option {
    column-gap: 8px;
    display: grid;
    grid-template-columns: 1fr var(--color-col-w, 90px);
    padding-left: 0;
    padding-right: 30px;
  }

  .item-dialog .item-choice-menu[data-is-color-picker="true"] .item-choice-option-label {
    align-self: center;
    white-space: nowrap;
  }

  .item-dialog .item-choice-option + .item-choice-option {
    border-top: 1px solid var(--line-soft);
  }

  .item-dialog .item-choice-option:hover,
  .item-dialog .item-choice-option:focus-visible {
    background: rgba(40, 93, 82, 0.07);
  }

  .item-dialog .item-choice-option.is-selected {
    background: rgba(40, 93, 82, 0.1);
    color: var(--accent);
    padding-right: 30px;
    position: relative;
  }

  .item-dialog .item-choice-option.is-selected::after {
    content: "✓";
    font-size: 11px;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
  }

  .item-dialog .item-choice-clear {
    border: 0;
    border-bottom: 1px solid var(--line-soft);
    border-radius: 0;
    color: var(--accent);
    font-size: 11px;
    font-weight: 600;
    min-height: 26px;
    padding: 4px 10px;
    text-align: left;
    width: 100%;
  }

  .item-dialog .item-choice-additive-field[readonly] {
    background: var(--panel-tint);
    color: var(--ink-secondary, var(--ink));
    cursor: default;
    pointer-events: none;
  }

  .item-dialog .item-choice-additive-field[readonly]:has(~ .item-choice-select[data-multi-value="false"]) {
    display: none;
  }

  .item-dialog .dialog-actions {
    margin-top: 10px;
    padding-top: 10px;
  }

  .item-dialog .dialog-actions button {
    min-height: 34px;
    padding-bottom: 6px;
    padding-top: 6px;
  }

  dialog:not(.image-dialog):not(.detail-outfit-preview-dialog) {
    border-radius: 0;
    height: 100vh;
    margin: 0;
    max-height: 100vh;
    max-width: none;
    width: 100vw;
  }

  .detail-shell,
  .schedule-shell,
  .created-outfit-shell,
  .outfits-shell,
  .calendar-shell,
  .item-dialog form {
    max-height: 100vh;
    overflow: auto;
    padding: 16px;
  }

  .item-photo-section {
    align-self: stretch;
    box-sizing: border-box;
    display: block;
    flex: 0 0 auto;
    margin: 8px 0 14px;
    min-height: 0;
    position: relative;
    width: 100%;
  }

  .item-photo-placeholder {
    box-sizing: border-box;
    display: flex;
    flex: 0 0 auto;
    min-height: clamp(160px, 24dvh, 220px);
    overflow: hidden;
    padding: 12px;
    width: 100%;
  }

  .item-photo-section.has-photo .item-photo-placeholder {
    align-items: center;
    justify-content: flex-start;
    min-height: 0;
    overflow: hidden;
    padding: 12px;
  }

  .item-photo-section.has-photo .item-photo-preview {
    display: block;
    height: auto;
    max-height: min(40dvh, 360px);
    max-width: 100%;
    object-fit: contain;
    position: static;
    width: min(100%, 360px);
  }

  .mobile-preview-mode .item-dialog form {
    align-items: stretch;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    max-height: 100dvh;
    min-height: 100dvh;
    overflow: auto;
    padding: 18px 16px 16px;
    width: 100%;
  }

  .mobile-preview-mode .item-dialog .dialog-header {
    background: var(--panel-tint);
    border-bottom: 1px solid var(--line-soft);
    margin: -18px -16px 0;
    padding: 18px 16px 10px;
    position: sticky;
    top: 0;
    z-index: 12;
  }

  .mobile-preview-mode .item-dialog .dialog-header,
  .mobile-preview-mode .item-dialog .form-grid,
  .mobile-preview-mode .item-dialog .dialog-actions {
    align-self: stretch;
    flex: 0 0 auto;
    width: 100%;
  }

  .mobile-preview-mode .item-dialog .dialog-header {
    align-self: stretch;
    width: auto;
  }

  .mobile-preview-mode .item-dialog .form-grid {
    margin-top: 0;
  }

  .mobile-preview-mode .item-dialog .item-photo-section {
    align-self: stretch;
    box-sizing: border-box;
    display: block;
    flex: 0 0 auto;
    margin: 12px 0 16px;
    min-height: 0;
    position: relative;
    width: 100%;
  }

  .mobile-preview-mode .item-dialog .item-photo-placeholder {
    align-items: center;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
    max-width: none;
    min-height: clamp(180px, 25dvh, 232px);
    overflow: hidden;
    padding: 12px;
    position: relative;
    width: 100%;
  }

  .mobile-preview-mode .item-dialog .item-photo-section.has-photo .item-photo-placeholder {
    align-items: center;
    flex-direction: column;
    gap: 12px;
    height: auto;
    justify-content: flex-start;
    min-height: 0;
    overflow: hidden;
    padding: 10px;
    position: relative;
    width: 100%;
  }

  .mobile-preview-mode .item-dialog .item-photo-section.has-photo .item-photo-preview {
    display: block;
    flex: 0 0 auto;
    height: auto;
    inset: auto;
    margin: 0 auto;
    max-height: min(38dvh, 340px);
    max-width: min(100%, 340px);
    min-height: 0;
    object-fit: contain;
    position: static !important;
    transform: none;
    width: auto;
  }

  /* Match the base wrapper height rule in the mobile context. */
  .mobile-preview-mode .item-dialog .item-photo-section:not(.item-photo-section--landscape).is-analyzing .item-photo-img-wrap {
    height: min(38dvh, 340px);
  }

  .mobile-preview-mode .item-dialog .item-photo-section.has-photo .item-photo-button,
  .mobile-preview-mode .item-dialog .item-photo-section.has-photo .item-photo-status {
    align-self: center;
    flex: 0 0 auto;
    inset: auto;
    margin: 0;
    max-width: 100%;
    position: static !important;
    text-align: center;
    transform: none !important;
  }

  .created-outfit-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
  }

  .created-outfit-shell .dialog-header {
    flex: 0 0 auto;
    padding-top: 34px;
  }

  .created-outfit-shell .dialog-header .icon-button {
    top: 28px;
  }

  .created-outfit-preview {
    flex: 0 0 auto;
    margin-top: 22px;
  }

  .created-outfit-actions {
    margin-top: auto;
  }

  .outfits-shell,
  .calendar-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
  }

  .outfits-shell > .dialog-header,
  .calendar-shell > .dialog-header {
    flex: 0 0 auto;
    padding-bottom: 12px;
  }

  .mobile-preview-mode .outfits-shell > .dialog-header,
  .mobile-preview-mode .calendar-shell > .dialog-header {
    padding-bottom: 4px;
    padding-top: 18px;
  }

  .mobile-preview-mode .outfits-list,
  .mobile-preview-mode .calendar-list {
    margin-top: 4px;
  }

  .outfits-list,
  .calendar-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 18px;
  }

  .dialog-header,
  .dialog-actions {
    gap: 10px;
  }

  .icon-button {
    height: 30px;
    width: 30px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .detail-layout,
  .detail-stats,
  .outfit-builder-layout,
  .outfit-slots {
    grid-template-columns: 1fr;
  }

  .detail-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }

  .mobile-preview-mode .detail-shell > .dialog-header {
    padding-top: 34px;
  }

  .mobile-preview-mode .detail-shell > .dialog-header > div {
    padding-left: 28px;
    padding-right: 28px;
  }

  .mobile-preview-mode .detail-shell > .dialog-header .icon-button {
    border-radius: 8px;
    top: 30px;
  }

  .mobile-preview-mode #detailTitle {
    font-size: 16px;
    line-height: 1.08;
  }

  .mobile-preview-mode #detailSubtitle {
    font-size: 13px;
    line-height: 1.18;
    margin-top: 5px;
  }

  .detail-layout {
    align-content: start;
    flex: 1 1 auto;
  }

  .detail-main {
    align-content: start;
    display: flex;
    flex-direction: column;
  }

  .detail-action-section {
    margin-top: auto;
    justify-content: center;
  }

  .detail-action-section .primary-button {
    width: auto;
  }

  .detail-outfit-preview-shell {
    display: flex;
    flex-direction: column;
    max-height: min(90vh, 860px);
    overflow: auto;
    padding: 14px 12px 0;
  }

  .detail-outfit-preview-shell > .dialog-header {
    min-height: 0;
    padding-top: 0;
    position: absolute;
    right: 12px;
    top: 12px;
    z-index: 3;
  }

  .detail-outfit-preview-body .outfit-stack-card--with-photo {
    width: min(100%, 350px);
  }

  .detail-outfit-preview-dialog {
    border-radius: 12px;
    height: auto;
    margin: auto;
    max-height: min(92vh, 880px);
    max-width: min(430px, calc(100vw - 72px));
    width: auto;
  }

  .detail-outfit-preview-dialog .outfit-stack-card--with-photo .outfit-stack-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    grid-template-columns: 1fr;
  }

  .detail-outfit-preview-dialog .outfit-stack-collage {
    height: 272px;
  }

  .detail-outfit-preview-dialog .outfit-stack-inline-details {
    padding: 8px 12px;
  }

  .detail-outfit-preview-dialog .outfit-stack-selfie-panel {
    flex: 1 1 auto;
    min-height: 332px;
    padding: 10px;
  }

  .detail-outfit-preview-dialog .outfit-stack-selfie-empty {
    height: 100%;
    min-height: 312px;
  }

  .outfit-dialog {
    border-radius: 0;
    height: 100vh;
    max-height: 100vh;
    width: 100vw;
  }

  .outfit-shell {
    min-height: 100vh;
    padding: 14px;
  }

  .outfit-dialog .dialog-header {
    gap: 8px;
    grid-template-areas:
      "title center close"
      "styles styles styles";
    grid-template-columns: auto minmax(0, 1fr) auto;
    margin: -14px -14px 10px;
    padding: 12px 14px 8px;
  }

  .mobile-preview-mode .outfit-dialog .dialog-header {
    gap: 5px;
    grid-template-areas:
      "title spinner center close"
      "styles styles styles styles";
    grid-template-columns: max-content minmax(0, 1fr) max-content 22px;
    padding: 40px 12px 7px;
  }

  .mobile-preview-mode .outfit-title-row {
    gap: 6px;
    min-width: 0;
    white-space: nowrap;
  }

  .mobile-preview-mode .outfit-title-row h2 {
    font-size: 14px;
  }

  .mobile-preview-mode .outfit-mode {
    align-self: center;
    grid-area: center;
    justify-content: center;
    justify-self: end;
  }

  .mobile-preview-mode .outfit-mode label {
    font-size: 8px;
    gap: 3px;
    min-height: 20px;
    padding: 2px 5px;
  }

  .mobile-preview-mode .outfit-mode input {
    height: 9px;
    width: 9px;
  }

  .mobile-preview-mode .outfit-dialog-close {
    align-self: center;
    border-radius: 7px;
    font-size: 11px;
    height: 22px;
    min-height: 22px;
    width: 22px;
  }

  .mobile-preview-mode .outfit-header-actions {
    gap: 5px;
    margin-top: 1px;
  }

  .outfit-form {
    margin-top: 16px;
  }

  .outfit-builder-layout {
    padding-top: 16px;
  }

  .outfit-title-row {
    gap: 12px;
  }

  .outfit-title-row h2 {
    font-size: 19px;
  }

  .outfit-builder-spinner {
    border-width: 3px;
    grid-area: spinner;
    height: 16px;
    justify-self: center;
    margin-left: 0;
    width: 16px;
  }

  .outfit-header-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    justify-content: stretch;
    width: 100%;
  }

  .outfit-mode {
    align-items: center;
    gap: 4px;
  }

  .outfit-mode label {
    font-size: 10px;
    min-height: 23px;
    padding: 2px 7px;
  }

  .ai-suggest-button {
    border-radius: 8px;
    display: grid;
    font-size: 9px;
    grid-template-areas:
      "label icon"
      "count icon";
    grid-template-columns: minmax(0, 1fr) 17px;
    gap: 0 2px;
    justify-content: center;
    line-height: 1.02;
    min-height: 28px;
    min-width: 0;
    padding: 3px 5px;
  }

  .suggest-count {
    grid-area: count;
    margin-left: 0;
    margin-right: 0;
  }

  .suggest-label {
    grid-area: label;
    min-width: 0;
    white-space: nowrap;
  }

  .suggestion-box-icon {
    grid-area: icon;
    height: 13px;
    justify-self: end;
    width: 16px;
  }

  .suggestion-box-icon-avant {
    width: 18px;
  }

  .rail-button {
    height: 22px;
    min-height: 22px;
    width: 22px;
  }

  .rail-button.prev {
    left: 0;
  }

  .rail-button.next {
    right: 0;
  }

  .slot-shoes .outfit-carousel {
    min-height: 112px;
    padding-left: 0;
    padding-right: 0;
    padding-top: 22px;
    --carousel-card-width: 116px;
    --carousel-gap: 12px;
  }

  .outfit-carousel {
    margin-left: 0;
    margin-right: 0;
    min-height: 180px;
    overflow: hidden;
    padding-bottom: 22px;
    padding-top: 4px;
    --carousel-card-width: 82px;
    --carousel-gap: 9px;
    width: 100%;
  }

  .locked-seed-carousel {
    margin: 0 auto;
    max-width: 142px;
    min-height: auto;
    padding: 0;
    width: 100%;
  }

  .outfit-slot-row {
    padding-top: 22px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .outfit-slot-row.slot-shoes {
    padding-top: 34px;
  }

  .outfit-slot-header {
    left: 12px;
    right: 4px;
    top: 11px;
  }

  .outfit-carousel {
    margin-left: -12px;
    margin-right: -12px;
    overflow: hidden;
    width: calc(100% + 24px);
  }

  .locked-seed-carousel {
    margin: 0 auto;
    width: 100%;
  }

  .mobile-preview-mode .slot-label {
    display: inline-grid;
    justify-items: center;
  }

  .mobile-preview-mode .slot-label-anchor {
    display: block;
    line-height: 0.9;
    margin-left: 0;
    margin-top: 3px;
  }

  .separates-shuffle-button {
    border-radius: 6px;
    font-size: 7px;
    line-height: 1;
    min-height: 16px;
    padding: 1px 6px;
  }

  .saved-outfit-row,
  .calendar-entry {
    padding: 14px 12px;
  }

  .outfits-list,
  .calendar-list {
    gap: 12px;
  }

  .outfit-stack-card,
  .outfit-stack-card--mockup,
  .outfit-stack-card--with-photo {
    width: min(100%, 420px);
  }

  .outfit-stack-content,
  .outfit-stack-card--with-photo .outfit-stack-content,
  .outfit-stack-card--mockup .outfit-stack-content {
    gap: 14px;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
  }

  .outfit-stack-composition-panel {
    gap: 12px;
  }

  .outfit-stack-card--with-photo .outfit-stack-composition-panel {
    height: auto;
  }

  .outfit-stack-card--with-photo .outfit-stack-composition-panel .text-button {
    margin-top: 0;
  }

  .outfit-stack-collage {
    height: 322px;
    margin: 0 auto;
    max-width: 300px;
  }

  .outfit-stack-card--mockup .outfit-stack-collage {
    height: 300px;
    max-width: 330px;
  }

  .outfit-stack-count {
    left: calc(50% - 104px);
    top: 168px;
  }

  .outfit-stack-card--mockup .outfit-stack-count {
    left: calc(50% - 102px);
    top: 198px;
  }

  .outfit-stack-selfie-panel {
    justify-self: center;
    min-height: 0;
    padding: 12px;
    width: min(100%, 340px);
  }

  .outfit-stack-selfie-empty {
    height: 240px;
  }

  .outfit-stack-photo {
    max-height: min(360px, 72vw);
    width: min(100%, 340px);
  }

  .created-outfit-preview {
    min-height: 0;
  }

  .viewer-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  #viewerImage {
    max-width: calc(100vw - 64px);
  }

  .viewer-actions {
    display: flex;
    justify-content: center;
  }

  .caption-action-button {
    font-size: 11px;
    min-height: 30px;
    padding: 5px 8px;
  }
}

@media (max-width: 430px) {
  :root {
    --m-ui-scale: clamp(0.9, calc(100vw / 430px), 1);
    --m-control-radius: calc(12px * var(--m-ui-scale));
    --m-suggest-button-radius: calc(8px * var(--m-ui-scale));
    --m-suggest-button-min-height: calc(28px * var(--m-ui-scale));
    --m-suggest-button-pad-x: calc(5px * var(--m-ui-scale));
    --m-suggest-icon-column: calc(18px * var(--m-ui-scale));
    --m-suggest-icon-height: calc(13px * var(--m-ui-scale));
    --m-suggest-icon-width: calc(16px * var(--m-ui-scale));
  }

  .topbar {
    padding-left: 10px;
    padding-right: 10px;
  }

  h1 {
    font-size: 28px;
  }

  .header-actions {
    gap: 5px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .header-actions .summary-button {
    font-size: 12px;
    font-weight: 800;
    min-height: 30px;
    padding-bottom: 4px;
    padding-left: 4px;
    padding-right: 4px;
    padding-top: 4px;
  }

  .add-item-button {
    height: 28px;
    min-height: 28px;
    width: 28px;
  }

  .view-trash-button {
    height: 30px;
    min-height: 30px;
    width: 30px;
  }

  .caption-action-button,
  .saved-outfit-row .text-button,
  .outfit-card-actions .text-button,
  .calendar-entry-actions .text-button,
  .outfit-stack-composition-panel .text-button,
  .outfit-stack-selfie-panel .selfie-action-button {
    border-radius: var(--m-control-radius);
  }

  .sidebar,
  .content {
    padding-left: 10px;
    padding-right: 10px;
  }

  .item-image-button {
    height: clamp(210px, 74vw, 300px);
  }

  .detail-shell,
  .schedule-shell,
  .created-outfit-shell,
  .outfits-shell,
  .calendar-shell,
  .item-dialog form,
  .outfit-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .outfit-dialog .dialog-header {
    gap: 7px 8px;
    grid-template-areas:
      "title spinner gear close"
      "styles styles styles styles";
    grid-template-columns: max-content minmax(14px, 1fr) 32px 32px;
    margin-bottom: 0;
    margin-left: -12px;
    margin-right: -12px;
    padding-bottom: 0;
    padding-left: 10px;
    padding-right: 10px;
  }


  .outfit-form {
    margin-top: 0;
  }

  .outfit-builder-layout {
    padding-top: 12px;
  }

  .outfit-title-row h2 {
    font-size: 17px;
  }

  .outfit-builder-spinner {
    border-width: 3px;
    grid-area: spinner;
    height: 18px;
    justify-self: center;
    margin-left: 0;
    width: 18px;
  }

  .outfit-mode label {
    font-size: 11px;
    min-height: 28px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .outfit-header-actions {
    gap: 5px;
  }

  .ai-suggest-button {
    border-radius: var(--m-suggest-button-radius);
    column-gap: 0;
    font-size: 12px;
    grid-template-areas:
      "label icon"
      "count icon";
    grid-template-columns: minmax(0, 1fr) var(--m-suggest-icon-column);
    min-height: var(--m-suggest-button-min-height);
    padding-left: var(--m-suggest-button-pad-x);
    padding-right: var(--m-suggest-button-pad-x);
    row-gap: 0;
  }

  .suggest-label {
    grid-area: label;
    justify-self: center;
    line-height: 1.05;
    text-align: center;
    white-space: nowrap;
  }

  .suggest-count {
    grid-area: count;
    justify-self: center;
    margin-right: 0;
    text-align: center;
  }

  .suggestion-box-icon {
    grid-area: icon;
    height: var(--m-suggest-icon-height);
    justify-self: end;
    stroke-width: 2.7;
    width: var(--m-suggest-icon-width);
  }

  .aesthetic-logic h3 {
    font-size: 13px;
  }

  .aesthetic-logic p {
    font-size: 15px;
    line-height: 1.45;
  }

  .slot-label {
    font-size: 15px;
  }

  .outfit-option-card span {
    font-size: 10px;
  }

  .outfit-stack-collage,
  .detail-outfit-thumbnail-collage {
    opacity: 0;
    transition: opacity 500ms ease;
  }

  .outfit-stack-collage.is-image-ready,
  .detail-outfit-thumbnail-collage.is-image-ready,
  .outfit-stack-collage.is-image-timeout,
  .detail-outfit-thumbnail-collage.is-image-timeout {
    opacity: 1;
  }

  .saved-outfit-row,
  .calendar-entry {
    padding-left: 10px;
    padding-right: 10px;
  }

  .outfit-stack-collage {
    height: 318px;
    max-width: 286px;
  }

  .outfit-stack-count {
    left: calc(50% - 98px);
    top: 166px;
  }

  .outfit-stack-selfie-panel {
    min-height: 0;
    width: min(100%, 320px);
  }

  .outfit-stack-selfie-empty {
    height: 220px;
  }

  .detail-outfit-preview-dialog .outfit-stack-collage {
    height: 304px;
  }

  .detail-outfit-preview-dialog .outfit-stack-card--with-photo .outfit-stack-content {
    gap: 12px;
  }

  .detail-outfit-preview-dialog .outfit-stack-inline-details {
    padding: 8px 11px;
  }

  .detail-outfit-preview-dialog .outfit-stack-selfie-panel {
    flex: 1 1 auto;
    min-height: 322px;
    padding: 9px;
  }

  .detail-outfit-preview-dialog .outfit-stack-selfie-empty {
    height: 100%;
    min-height: 304px;
  }

  .outfit-stack-photo {
    max-height: min(330px, 74vw);
    width: min(100%, 320px);
  }
}

/* ── Login overlay ─────────────────────────────────────────── */

.login-overlay {
  align-items: center;
  background: var(--color-bg, #f7f4ee);
  bottom: 0;
  display: flex;
  justify-content: center;
  left: 0;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 9999;
}

.login-overlay.is-hidden {
  display: none;
}

.app-loading-msg {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: var(--text-secondary);
  background: var(--bg-primary, #f5f2ed);
  z-index: 50;
  pointer-events: none;
}

.app-loading-msg.is-hidden {
  display: none;
}

.login-card {
  background: #fff;
  border: 1px solid #d8cfbf;
  border-radius: 12px;
  padding: 40px 36px 36px;
  width: min(360px, calc(100vw - 40px));
}

.login-mark {
  color: #285d52;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  margin-bottom: 28px;
  text-align: center;
  text-transform: uppercase;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.login-field label {
  color: #5d574e;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.login-field input {
  background: #fff;
  border: 1px solid #d8cfbf;
  border-radius: 8px;
  color: #27231d;
  font-size: 14px;
  height: 40px;
  outline: none;
  padding: 0 12px;
  transition: border-color 0.15s;
  width: 100%;
}

.login-field input:focus {
  border-color: #285d52;
}

.login-error {
  color: #b04040;
  font-size: 13px;
  margin: 0;
  text-align: center;
}

.login-btn {
  background: #285d52;
  border: none;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  height: 42px;
  letter-spacing: 0.03em;
  margin-top: 4px;
  transition: background 0.15s;
  width: 100%;
}

.login-btn:hover {
  background: #1f4840;
}

.login-btn:disabled {
  background: #8fb3ae;
  cursor: default;
}

/* ─── Du Jour ──────────────────────────────────────────────────────────────── */

.du-jour-view {
  padding: 0 0 12px;
}

.du-jour-sections {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 12px;
}

/* White panel card per tier */
.du-jour-section {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  padding: 10px 0 10px;
}

.du-jour-section-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin: 0 0 6px;
  padding: 0 16px;
  text-transform: uppercase;
}

/* Carousel container — clips sliding track, positions arrows */
.du-jour-carousel-wrap {
  overflow: hidden;
  padding: 4px 0;
  position: relative;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

/* Arrow buttons inside the du-jour carousel */
.du-jour-carousel-wrap .rail-button {
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
}

.du-jour-carousel-wrap .rail-button.prev {
  left: 6px;
}

.du-jour-carousel-wrap .rail-button.next {
  right: 6px;
}

/* Sliding track — JS controls transform */
.du-jour-track {
  display: flex;
  will-change: transform;
}

/* Individual card slot */
.du-jour-card {
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0.4;
  overflow: hidden;
  padding: 0;
  position: relative;
  transform: scale(0.4);
  transform-origin: center center;
  transition: none;
  -webkit-tap-highlight-color: transparent;
  z-index: 1;
}

/* Centered (active) card is full-size and on top */
.du-jour-card.dj-center {
  opacity: 1;
  transform: scale(1.1);
  z-index: 2;
}

/* Suppress focus rings on carousel cards — touch-only context */
.du-jour-card:focus,
.du-jour-card:focus-visible,
.du-jour-card .outfit-stack-card:focus,
.du-jour-card .outfit-stack-card:focus-visible {
  outline: none;
}

/* outfit-stack-card inside the slot fills the slot width */
.du-jour-card .outfit-stack-card {
  width: 100%;
}

/* Content column fills the card */
.du-jour-card .outfit-stack-content {
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
}

/* Collage — 300×328 natural size; card is also 300px wide so no clipping needed.
   No zoom — displays at full natural resolution for maximum clarity. */
.du-jour-card .outfit-stack-collage {
  height: 328px;
  margin: 0 auto;
  max-width: none;
  width: 300px;
}

/* Du Jour detail dialog */
.du-jour-detail-dialog {
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  flex-direction: column;
  max-height: 90dvh;
  max-width: min(480px, calc(100vw - 32px));
  overflow: hidden;
  padding: 0;
  width: 100%;
}

.du-jour-detail-dialog[open] {
  display: flex;
}

.du-jour-detail-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 20px 20px 0;
}

.du-jour-detail-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.du-jour-detail-preview {
  display: flex;
  justify-content: center;
  margin: 12px 0 16px;
}

.du-jour-detail-preview .outfit-stack-card {
  width: 300px;
}

.du-jour-detail-preview .outfit-stack-content {
  grid-template-columns: 300px;
}

.du-jour-detail-swatch {
  pointer-events: none;
}

.du-jour-detail-swatch .outfit-stack-collage {
  height: 328px;
  max-width: none;
  width: 300px;
}

.du-jour-detail-items {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 14px;
}

.du-jour-detail-item-row {
  display: grid;
  gap: 1px;
}

.du-jour-detail-item-row strong {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.3;
}

.du-jour-detail-item-row span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.du-jour-detail-logic {
  border-top: 1px solid var(--line-soft);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
  margin: 0;
  padding-top: 14px;
  padding-bottom: 20px;
}

.du-jour-detail-dialog .dialog-actions {
  background: var(--panel, #fff);
  border-top: 1px solid var(--line-soft);
  flex-shrink: 0;
  padding: 14px 20px 20px;
}

/* Delete confirmation dialog */
#confirmDeleteDialog {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: none;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(34, 30, 22, 0.22);
  height: fit-content;
  left: 50%;
  margin: 0;
  max-width: 270px;
  padding: 0;
  position: fixed;
  top: 50%;
  transform: translate(-50%, -50%);
  width: calc(100vw - 80px);
}
#confirmDeleteDialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
}
.confirm-delete-body {
  padding: 22px 20px 18px;
}
.confirm-delete-question {
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 8px;
}
.confirm-delete-title {
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  margin: 0 0 2px;
}
.confirm-delete-desc {
  color: var(--ink-2, #666);
  font-size: 14px;
  margin: 0;
}
.confirm-delete-rule {
  border: none;
  border-top: 1px solid var(--line-soft);
  margin: 16px 0;
}
.confirm-delete-notice {
  color: var(--ink-2, #666);
  font-size: 13px;
  margin: 0 0 18px;
}
.confirm-delete-actions {
  display: flex;
  gap: 10px;
}
.confirm-delete-actions button {
  border: 1px solid var(--line);
  border-radius: 8px;
  flex: 1;
  font-size: 16px;
  padding: 9px 20px;
}
#confirmDeleteCancel {
  background: var(--panel, #fff);
  color: var(--ink);
}
#confirmDeleteOk {
  background: #c0392b;
  border-color: #c0392b;
  color: #fff;
  font-weight: 600;
}

/* Processed swatch — shown in the Add Item dialog after center-crop/BG removal.
   Sized to match the pre-analysis analyzing preview so there is no frame jump
   when is-analyzing is removed. min(38dvh,340px) matches the wrapper height rule
   used during analysis. */
.item-photo-preview.swatch-processed {
  display: block !important;
  height: auto !important;
  max-height: min(38dvh, 340px) !important;
  max-width: min(100%, 340px) !important;
  object-fit: contain !important;
  width: auto !important;
}

.item-photo-section.has-photo .item-photo-placeholder:has(.swatch-processed) {
  gap: 12px;
  padding: 10px;
}

/* Brand autocomplete — open state border matches accent */
.item-dialog input[name="brand"].brand-ac-open {
  border-color: var(--accent);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  box-shadow: none;
}

/* Brand autocomplete dropdown */
.brand-ac-dropdown {
  background: #fff;
  border: 1px solid var(--accent);
  border-top: 0;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 8px 18px rgba(34, 30, 22, 0.08);
  left: 0;
  max-height: min(220px, 40dvh);
  overflow-y: auto;
  overscroll-behavior: contain;
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 20;
}

.brand-ac-option {
  border: 0;
  border-radius: 0;
  color: var(--ink);
  display: block;
  font-size: 16px;
  font-weight: 400;
  padding: 8px 11px;
  text-align: left;
  width: 100%;
}

.brand-ac-option + .brand-ac-option {
  border-top: 1px solid var(--line-soft);
}

.brand-ac-option:hover,
.brand-ac-option:focus {
  background: rgba(40, 93, 82, 0.07);
  outline: none;
}
