@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,460;0,9..144,500;1,9..144,400&family=Onest:wght@400;500;600;700&display=swap');

/* ===========================================================================
   Looks Engine — "Maison Ателье" editorial quiet-luxury concierge
   Warm paper, near-black ink, one bordeaux accent, hairlines over boxes.
   =========================================================================== */

:root {
  --bg: #f1ebe1;
  --surface: #fbf8f2;
  --surface-alt: #ede7db;
  --ink: #1f1a15;
  --muted: #6e655a;
  --line: #e0d8c9;
  --line-strong: #c9beac;

  --primary: #5a1e28;
  --on-primary: #fbf8f2;
  --primary-hover: #471620;
  --accent: #5a1e28;
  --accent-soft: rgba(90, 30, 40, 0.10);

  --select-bg: #1f1a15;
  --select-fg: #fbf8f2;

  --success: #2f6b43;
  --warning: #8a5a1e;
  --danger: #9c3b33;
  --success-wash: rgba(47, 107, 67, 0.12);
  --danger-wash: rgba(156, 59, 51, 0.12);

  --font-display: "Fraunces", "Times New Roman", Georgia, serif;
  --font-body: "Onest", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  --t-h2: clamp(28px, 3vw, 40px);
  --t-h3: 26px;
  --t-quote: 24px;
  --t-metric: 40px;
  --t-price: 22px;

  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-9: 96px;

  --r-control: 2px;
  --r-surface: 4px;

  --shadow-hover: 0 12px 28px rgba(31, 26, 21, 0.10);
  --shadow-toast: 0 8px 24px rgba(31, 26, 21, 0.18);

  --ease: cubic-bezier(0.2, 0, 0, 1);
  --dur: 140ms;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01" 1;
}

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

button {
  cursor: pointer;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

a {
  color: inherit;
}

.app {
  display: grid;
  grid-template-columns: minmax(300px, 360px) 1fr;
  min-height: 100vh;
}

/* ---------- Rail (brief) ---------- */

.sidebar {
  position: relative;
  max-height: 100vh;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: var(--bg);
  padding: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-control);
  background: var(--ink);
  color: var(--on-primary);
  font-family: var(--font-display);
  font-weight: 460;
  font-size: 17px;
}

.brand h1 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand p {
  font-size: 13px;
  color: var(--muted);
}

.profiles {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
}

.profiles select {
  flex: 1;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: transparent;
  padding: 0 24px 0 10px;
  font-size: 13px;
  font-weight: 600;
}

.profiles button {
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 14px;
  flex-shrink: 0;
}

.form {
  display: grid;
  gap: 24px;
  padding-bottom: 120px;
}

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

.section-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.section-title span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.section-title h2 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink);
}

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

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

input,
select,
textarea {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 10px 2px;
  font-size: 15px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-bottom-color: var(--ink);
  box-shadow: inset 0 -1px 0 0 var(--primary);
}

textarea {
  min-height: 64px;
  resize: vertical;
  line-height: 1.5;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236e655a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 4px center;
  padding-right: 20px;
}

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

.compact-grid.two {
  grid-template-columns: 1fr 1fr;
}

/* photo dropzone */
.photo-field {
  border: 1.5px dashed var(--line-strong);
  background: var(--surface-alt);
  padding: 18px;
  border-radius: 0;
}

.photo-field > span {
  margin-bottom: 6px;
}

.photo-field input {
  border: none;
  box-shadow: none;
  font-size: 13px;
  color: var(--muted);
}

.photo-preview {
  display: none;
}

.photo-preview.active {
  display: grid;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.photo-preview img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 0;
  background: var(--surface-alt);
}

.photo-meta {
  font-size: 12px;
  color: var(--muted);
}

/* chips + segmented = ink inversion when selected */
.chip-grid,
.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-grid label,
.segmented label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.chip-grid input,
.segmented input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.chip-grid label:hover,
.segmented label:hover {
  border-color: var(--line-strong);
}

.chip-grid label:has(input:checked),
.segmented label:has(input:checked) {
  background: var(--select-bg);
  color: var(--select-fg);
  border-color: var(--ink);
}

.chip-grid label:has(input:focus-visible),
.segmented label:has(input:focus-visible) {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* advanced details — recessive plumbing */
.advanced {
  border-top: 1px solid var(--line);
  padding-top: 4px;
}

.advanced > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.advanced > summary::-webkit-details-marker {
  display: none;
}

.advanced > summary::before {
  content: "▸ ";
}

.advanced[open] > summary::before {
  content: "▾ ";
}

.ai-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ai status note — left bar, never a pill */
.ai-status {
  font-size: 13px;
  color: var(--muted);
  border-left: 2px solid var(--line);
  padding: 2px 0 2px 12px;
}

.ai-status.good {
  border-left-color: var(--success);
  color: var(--success);
}

.ai-status.bad {
  border-left-color: var(--danger);
  color: var(--danger);
}

.ai-status.pending {
  border-left-color: var(--warning);
  color: var(--warning);
}

/* sticky CTA */
.actions {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 0 0;
  background: var(--bg);
  border-top: 1px solid var(--line);
}

/* ---------- Buttons ---------- */

button {
  height: 44px;
  padding: 0 16px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

button:hover {
  border-color: var(--ink);
  background: var(--surface-alt);
}

button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.55;
  cursor: default;
}

button.primary {
  flex-basis: 100%;
  height: 52px;
  background: var(--primary);
  border: none;
  color: var(--on-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

button.primary:hover {
  background: var(--primary-hover);
}

button.primary:active {
  transform: translateY(1px);
}

/* ---------- Workspace ---------- */

.workspace {
  max-width: 1100px;
  width: 100%;
  margin-inline: auto;
  padding: 28px 28px 80px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin-bottom: 8px;
}

#pageTitle {
  font-family: var(--font-display);
  font-weight: 460;
  font-size: var(--t-h2);
  line-height: 1.04;
  letter-spacing: -0.015em;
}

.top-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* metric stat-strip */
.metrics {
  display: flex;
  flex-wrap: wrap;
  margin-top: 28px;
}

.metric {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-height: 56px;
  padding: 0 24px;
}

.metric:first-child {
  padding-left: 0;
}

.metric + .metric {
  border-left: 1px solid var(--line);
}

.metric > span:first-child {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.metric strong {
  font-family: var(--font-display);
  font-weight: 460;
  font-size: var(--t-metric);
  line-height: 1;
  font-feature-settings: "tnum" 1;
}

.metric > span:last-child {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

/* panels — borderless regions separated by whitespace */
.panel {
  display: grid;
  gap: 24px;
  margin-top: var(--s-9);
}

.panel-head h3 {
  font-family: var(--font-display);
  font-weight: 460;
  font-size: var(--t-h3);
  line-height: 1.05;
  margin-bottom: 4px;
}

.panel-head p {
  font-size: 15px;
  color: var(--muted);
  max-width: 64ch;
}

/* ---------- AI snapshot ---------- */

.snapshot-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.snapshot-card {
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.snapshot-card > span {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.snapshot-card strong {
  display: block;
  margin-top: 6px;
  font-size: 17px;
  font-weight: 600;
}

.snapshot-card.note {
  grid-column: 1 / -1;
  border-top: none;
  border-left: 2px solid var(--primary);
  background: var(--surface);
  border-radius: var(--r-surface);
  padding: 24px 28px;
  margin-bottom: 24px;
}

.snapshot-card.note strong {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: var(--t-quote);
  line-height: 1.4;
  max-width: 60ch;
}

.swatch-row {
  display: inline-flex;
  gap: 5px;
  margin-right: 8px;
  vertical-align: -3px;
}

.swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(31, 26, 21, 0.15);
  background: var(--c, var(--line-strong));
}

/* ---------- Plan / outfits / shopping — de-carded lists ---------- */

.slot-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 40px;
}

.outfit-grid,
.shopping-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 40px;
}

.slot-card,
.outfit-card,
.shopping-card {
  padding: 22px 0;
  border-top: 1px solid var(--line);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.slot-card h4,
.outfit-card h4,
.shopping-card h4 {
  font-size: 17px;
  font-weight: 600;
}

.slot-card p,
.outfit-card p,
.shopping-card p {
  font-size: 15px;
  color: var(--muted);
}

.slot-card .badge-row,
.shopping-card .badge-row {
  margin-top: 12px;
}

.outfit-card ul {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.outfit-card li {
  font-size: 15px;
  padding-left: 18px;
  position: relative;
}

.outfit-card li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--primary);
}

/* ---------- Badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-feature-settings: "tnum" 1;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge.good {
  color: var(--success);
  border-color: rgba(47, 107, 67, 0.4);
}

.badge.warn {
  color: var(--warning);
  border-color: rgba(138, 90, 30, 0.4);
}

.badge.bad {
  color: var(--danger);
  border-color: rgba(156, 59, 51, 0.4);
}

/* ---------- Products — the hero lookbook ---------- */

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  column-gap: 32px;
  row-gap: 48px;
}

.product-card {
  position: relative;
  border: none;
  background: none;
  padding: 0;
  transition: box-shadow 240ms var(--ease), transform 240ms var(--ease);
}

.product-card:hover {
  box-shadow: var(--shadow-hover);
}

.product-photo {
  position: relative;
  margin: 0;
  aspect-ratio: 3 / 4;
  background: var(--surface-alt);
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.product-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 300ms var(--ease);
}

.product-card:hover .product-photo img {
  transform: scale(1.03);
}

.badge.score {
  position: absolute;
  top: 12px;
  right: 12px;
  min-height: 0;
  border: none;
  border-radius: var(--r-surface);
  padding: 5px 8px;
  background: rgba(31, 26, 21, 0.62);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--on-primary);
  letter-spacing: 0.04em;
}

.product-caption {
  display: grid;
  gap: 8px;
  padding: 16px 0 0;
}

.product-caption h4 {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-sub {
  font-size: 13px;
  color: var(--muted);
}

.product-figures {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-feature-settings: "tnum" 1;
}

.product-figures .price {
  font-family: var(--font-display);
  font-weight: 460;
  font-size: var(--t-price);
}

.product-figures .rate {
  font-size: 13px;
  color: var(--muted);
}

.product-sizes {
  font-size: 13px;
  color: var(--muted);
  font-feature-settings: "tnum" 1;
}

.score-bar {
  height: 2px;
  margin: 6px 0 2px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.score-bar span {
  display: block;
  width: var(--score, 0%);
  height: 100%;
  background: var(--primary);
}

.score-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-feature-settings: "tnum" 1;
}

.product-why,
.product-ai {
  font-size: 13px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.link-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.product-card .link-row {
  margin-top: 8px;
}

.product-card .link-row a {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-decoration: none;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.product-card .link-row a:hover {
  background: var(--ink);
  color: var(--on-primary);
  border-color: var(--ink);
}

.card-acts {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.card-act {
  flex: 1;
  height: 38px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
}

.card-act:hover {
  border-color: var(--ink);
  background: var(--surface-alt);
}

.card-act.on {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--accent-soft);
}

.product-card.saved .product-photo {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.wardrobe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  column-gap: 24px;
  row-gap: 32px;
}

.wardrobe-card {
  display: grid;
  gap: 0;
}

.wardrobe-card .product-caption {
  gap: 6px;
  padding-top: 12px;
}

.product-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.taste-note {
  font-size: 12px;
  color: var(--muted);
  border-left: 2px solid var(--primary);
  padding-left: 12px;
}

.taste-note[hidden] {
  display: none;
}

.inline-status {
  font-size: 13px;
  color: var(--muted);
  border-left: 2px solid var(--line);
  padding-left: 12px;
}

.inline-status.good {
  border-left-color: var(--success);
  color: var(--success);
}

.inline-status.bad {
  border-left-color: var(--danger);
  color: var(--danger);
}

.inline-status.pending {
  border-left-color: var(--warning);
  color: var(--warning);
}

.empty-state {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  place-items: center;
  text-align: center;
  padding: 56px 24px;
  border: 1px dashed var(--line-strong);
}

.empty-state strong {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: 22px;
}

.empty-state span {
  font-size: 14px;
  color: var(--muted);
  max-width: 46ch;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  padding: 12px 16px;
  background: var(--ink);
  color: var(--on-primary);
  border-radius: var(--r-control);
  border-top: 2px solid var(--primary);
  box-shadow: var(--shadow-toast);
  font-size: 14px;
  animation: toast-in 200ms var(--ease);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Responsive ---------- */

@media (max-width: 880px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .metric + .metric {
    border-left: none;
  }

  .metric {
    padding: 0;
    min-width: 45%;
    margin-bottom: 12px;
  }

  .snapshot-grid,
  .slot-grid,
  .outfit-grid,
  .shopping-grid {
    grid-template-columns: 1fr;
  }

  .panel {
    margin-top: 64px;
  }
}

@media (max-width: 560px) {
  .workspace {
    padding: 20px 16px 64px;
  }

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

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }

  .product-card:hover .product-photo img {
    transform: none;
  }
}

/* ---------- Wait-time mini-game ---------- */

.wait {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(31, 26, 21, 0.34);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.wait[hidden] {
  display: none;
}

.wait-card {
  width: min(540px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-surface);
  box-shadow: var(--shadow-hover);
  padding: 24px;
  display: grid;
  gap: 18px;
  animation: toast-in 220ms var(--ease);
}

.wait-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wait-head .eyebrow {
  margin: 0;
}

.wait-close {
  height: auto;
  padding: 2px 0;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 12px;
}

.wait-close:hover {
  background: none;
  color: var(--ink);
}

.wait-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--line-strong);
}

.wait-steps span {
  position: relative;
  padding-left: 16px;
}

.wait-steps span::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
}

.wait-steps span.active {
  color: var(--ink);
}

.wait-steps span.active::before {
  border-color: var(--primary);
  background: var(--primary);
  animation: pulse 1s var(--ease) infinite;
}

.wait-steps span.done {
  color: var(--muted);
}

.wait-steps span.done::before {
  border-color: var(--success);
  background: var(--success);
  animation: none;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-soft); }
  50% { box-shadow: 0 0 0 4px var(--accent-soft); }
}

.wait-lead {
  font-size: 13px;
  color: var(--muted);
}

.wait-game {
  display: grid;
  gap: 14px;
  min-height: 150px;
}

.quiz-q {
  font-family: var(--font-display);
  font-weight: 460;
  font-size: 22px;
  line-height: 1.2;
}

.quiz-opts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.quiz-opt {
  height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: transparent;
  font-size: 14px;
  font-weight: 600;
}

.quiz-opt:hover:not(:disabled) {
  border-color: var(--ink);
  background: var(--surface-alt);
}

.quiz-opt.ok {
  border-color: var(--success);
  color: var(--success);
  background: var(--success-wash);
}

.quiz-opt.no {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-wash);
}

.quiz-reveal {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  min-height: 36px;
}

.quiz-reveal.ok {
  color: var(--ink);
}

.quiz-reveal.no {
  color: var(--ink);
}

.quiz-src {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.wait-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}

.wait-src {
  font-size: 11px;
}

.wait .primary {
  width: 100%;
}

/* ---------- Print ---------- */

@media print {
  .sidebar,
  .top-actions,
  .product-actions {
    display: none;
  }

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

  .panel {
    margin-top: 32px;
    break-inside: avoid;
  }

  .product-card:hover {
    box-shadow: none;
  }
}

/* ---------- Telegram Mini App skin + feedback ("ОС") ----------
   In a plain browser body.in-telegram is never set, so the desktop look is
   unchanged. The feedback FAB/sheet work everywhere (Telegram and browser). */

body.in-telegram {
  background: var(--tg-theme-bg-color, var(--bg));
}
/* Inside Telegram only the JSON/Печать dev buttons are noise; the profile
   selector AND the in-page submit STAY visible so no control ever silently
   disappears. MainButton is additive, not a replacement. */
body.in-telegram .top-actions {
  display: none;
}
body.in-telegram .sidebar,
body.in-telegram .workspace {
  padding-left: max(16px, var(--tg-safe-left, 0px));
  padding-right: max(16px, var(--tg-safe-right, 0px));
}
body.in-telegram .workspace {
  padding-bottom: max(96px, calc(var(--tg-safe-bottom, 0px) + 96px));
}
/* Use Telegram's stable viewport height instead of 100vh for the wait overlay. */
body.in-telegram .wait {
  height: var(--tg-stable-vh, 100vh);
}

/* Floating feedback button — above the wait overlay (z-index 60), tappable on every stage. */
.feedback-fab {
  position: fixed;
  right: max(16px, var(--tg-safe-right, 0px));
  bottom: max(16px, calc(var(--tg-safe-bottom, 0px) + 16px));
  z-index: 70;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--primary);
  color: var(--on-primary);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(31, 26, 21, 0.25);
  transition: transform 0.15s ease;
}
.feedback-fab:hover { transform: translateY(-2px); }
.feedback-fab:active { transform: scale(0.94); }

/* Bottom-sheet feedback form. */
.feedback-sheet {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(31, 26, 21, 0.45);
}
.feedback-sheet[hidden] { display: none; }
.fb-card {
  width: min(560px, 100%);
  max-height: min(86vh, var(--tg-stable-vh, 86vh));
  overflow: auto;
  background: var(--tg-theme-secondary-bg-color, var(--surface));
  color: var(--tg-theme-text-color, var(--ink));
  border-radius: 18px 18px 0 0;
  border: 1px solid var(--line);
  padding: 20px 18px calc(20px + max(0px, var(--tg-safe-bottom, 0px)));
  box-shadow: 0 -12px 40px rgba(31, 26, 21, 0.3);
  animation: fbUp 0.22s ease;
}
@keyframes fbUp { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.fb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.fb-head strong { font-family: var(--font-display); font-size: 20px; }
.fb-x {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
}
.fb-stage { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.fb-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.fb-chip {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
}
.fb-chip.on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.fb-text,
.fb-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  padding: 12px;
  margin-bottom: 12px;
  resize: vertical;
}
.fb-contact { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.fb-acts { display: flex; gap: 10px; }
.fb-send,
.fb-cancel {
  flex: 1;
  border-radius: 12px;
  padding: 13px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--line-strong);
}
.fb-send { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.fb-cancel { background: transparent; color: var(--ink); }

/* Per-card "пожаловаться на подбор" icon action — stays narrow next to save/hide. */
.card-act.bad {
  flex: 0 0 44px;
  color: var(--danger);
}
.card-act.bad:hover {
  border-color: var(--danger);
  background: var(--danger-wash);
}

/* ---------- "Стилист офлайн" blocking banner (laptop model unreachable) ---------- */
.model-banner {
  position: fixed;
  inset: 0;
  z-index: 100; /* above the wait overlay and the feedback sheet */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(31, 26, 21, 0.55);
  backdrop-filter: blur(3px);
}
.model-banner[hidden] { display: none; }
.model-banner-card {
  width: min(440px, 100%);
  text-align: center;
  background: var(--tg-theme-secondary-bg-color, var(--surface));
  color: var(--tg-theme-text-color, var(--ink));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 32px 24px;
  box-shadow: 0 20px 60px rgba(31, 26, 21, 0.35);
}
.model-banner-mark {
  font-size: 34px;
  line-height: 1;
  margin-bottom: 12px;
}
.model-banner-card h3 {
  font-family: var(--font-display);
  font-size: 24px;
  margin: 0 0 8px;
}
.model-banner-card p {
  color: var(--muted);
  margin: 0 0 20px;
  line-height: 1.5;
}
.model-banner-card .primary { width: 100%; }
