/* Side panel layout. Designed for 320-560 px wide. */
html, body { min-height: 100%; }
.app { min-height: 100vh; display: flex; flex-direction: column; position: relative; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: -0.01em; }
.brand-mark { width: 24px; height: 24px; flex: none; }
.quota {
  font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--brand); white-space: nowrap;
}
@media (prefers-color-scheme: dark) { .quota { color: var(--brand-2); } }
.quota.empty { background: var(--danger-soft); color: var(--danger); }

.screens { flex: 1; padding: 16px; }
.screen { display: grid; gap: 12px; align-content: start; animation: fade 160ms ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Consent */
.hero { padding: 6px 0 2px; }
.facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.facts li { display: flex; gap: 10px; align-items: flex-start; }
.facts .dot { width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--gold); flex: none; }
.consent .btn { margin-top: 8px; }

/* Photo */
.back { justify-self: start; font-size: 13px; }
.photo-saved img { width: 100%; max-height: 380px; object-fit: contain; border-radius: var(--radius); background: var(--surface-2); margin-bottom: 10px; }
.photo-saved .row { margin-bottom: 8px; }
#photo-empty .btn + .btn { margin-top: 8px; }
.status { font-size: 13px; color: var(--muted); }
.status.error { color: var(--danger); }

/* Fitting room */
.me-row { display: flex; align-items: center; gap: 10px; }
.me-thumb { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; background: var(--surface-2); border: 1px solid var(--border); }
.me-text { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.me-label { font-weight: 600; }

.chips-row { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.chips-row .fine { margin: 0; }
.chips-row .btn { justify-self: start; }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; font-weight: 600; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track {
  position: relative; width: 36px; height: 20px; flex: none; border-radius: 999px;
  background: var(--border); transition: background-color 140ms ease;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 140ms ease;
}
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:disabled + .track { opacity: 0.5; }

.dropzone {
  display: grid; justify-items: center; gap: 6px; text-align: center;
  padding: 22px 16px; border: 2px dashed var(--border); border-radius: var(--radius);
  color: var(--muted); background: var(--surface);
}
.dropzone svg { width: 42px; height: 42px; color: var(--brand); }
@media (prefers-color-scheme: dark) { .dropzone svg { color: var(--brand-2); } }
.dropzone strong { color: var(--text); font-size: 15px; }
.dropzone span { font-size: 13px; }
.dropzone .btn { margin-top: 6px; }

.garment { display: grid; grid-template-columns: 112px 1fr; gap: 12px; padding: 12px; }
.garment-media { position: relative; }
.garment-media img {
  width: 112px; height: 148px; object-fit: contain; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
}
.garment-loading {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: color-mix(in srgb, var(--surface) 65%, transparent); border-radius: var(--radius-sm);
}
.garment-info { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.garment-title { font-weight: 650; margin: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.garment-site { font-size: 12px; color: var(--muted); margin: 0; }
.garment-info .notice { margin-top: 4px; }
.garment-info .btn { justify-self: start; align-self: flex-start; }
.garment-info .link { align-self: flex-start; margin-top: 2px; }
.field { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.field select {
  flex: 1; min-width: 0; height: 32px; padding: 0 8px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 13px var(--font);
}
@media (max-width: 340px) {
  .garment { grid-template-columns: 1fr; }
  .garment-media img { width: 100%; height: 200px; }
}

.progress { display: grid; gap: 6px; font-size: 13px; color: var(--muted); text-align: center; }
.progress-bar { height: 6px; border-radius: 999px; background: var(--accent-soft); overflow: hidden; }
.progress-bar span {
  display: block; height: 100%; width: 40%; border-radius: inherit; background: var(--brand);
  animation: slide 1.3s ease-in-out infinite;
}
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }

.result { display: grid; gap: 8px; }
.result-media { position: relative; }
.result-media img { width: 100%; border-radius: var(--radius); background: var(--surface-2); box-shadow: var(--shadow); }
.result-close { position: absolute; top: 8px; right: 8px; }
.result-meta { font-size: 12px; color: var(--muted); margin: 0; }
.result-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.result-actions .btn { padding: 0 8px; font-size: 13px; }

.history { display: grid; gap: 8px; margin-top: 6px; }
.history-head { display: flex; align-items: baseline; justify-content: space-between; }
.history-head h3 { margin: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.tile { position: relative; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
.tile button.open { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.tile img.res { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.tile img.gar {
  position: absolute; left: 6px; bottom: 6px; width: 30px; height: 30px; object-fit: cover;
  border-radius: 8px; border: 2px solid var(--surface); background: var(--surface);
}
.tile .del {
  position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; font-size: 16px;
  opacity: 0; transition: opacity 120ms ease;
}
.tile:hover .del, .tile:focus-within .del { opacity: 1; }
.tile .badge {
  position: absolute; right: 6px; bottom: 6px; font-size: 11px; font-weight: 700;
  padding: 2px 6px; border-radius: 999px; background: var(--surface); color: var(--ok);
}
.tile .badge.no { color: var(--danger); }

.privacy { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 6px; }
.privacy .btn { padding-left: 0; }
.privacy .btn.confirm { background: var(--danger); color: #fff; padding: 0 12px; }

.foot {
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
  padding: 10px 16px 14px; font-size: 12px; color: var(--muted);
}

.drop-overlay {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px;
  background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(2px);
}
.drop-overlay div {
  width: 100%; height: 100%; display: grid; place-items: center;
  border: 3px dashed var(--brand); border-radius: var(--radius);
  font-size: 18px; font-weight: 700; color: var(--brand);
}
@media (prefers-color-scheme: dark) { .drop-overlay div { color: var(--brand-2); border-color: var(--brand-2); } }

.toast {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 30;
  padding: 10px 14px; border-radius: 12px; background: var(--text); color: var(--bg);
  font-size: 13px; box-shadow: var(--shadow); animation: fade 160ms ease;
}

.camera-inline { margin-top: 4px; }

.notice .error-detail { display: inline-block; margin-top: 4px; opacity: 0.8; font-size: 11px; line-height: 1.35; }
