:root {
  --bg: #1a2332;
  --bg2: #243044;
  --surface: #2c3b52;
  --text: #f5f0e8;
  --muted: #a8b3c5;
  --accent: #d4a04a;
  --accent-2: #3d9b8f;
  --danger: #d46a6a;
  --ok: #6dbf8a;
  --warn: #e0b35a;
  --radius: 14px;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); }
body {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(212,160,74,.18), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(61,155,143,.14), transparent 50%),
    var(--bg);
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: var(--accent); }

#app { min-height: 100dvh; }
.boot { padding: 2rem; text-align: center; color: var(--muted); }

.shell { max-width: 1100px; margin: 0 auto; padding: 1rem 1rem calc(5rem + var(--safe-b)); }
.shell.desktop { max-width: 1280px; padding-bottom: 2rem; }

.brand-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.brand-bar h1 { font-family: var(--display); font-size: 1.55rem; margin: 0; letter-spacing: .01em; }
.brand-bar .sub { color: var(--muted); font-size: .9rem; margin: .15rem 0 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; padding: .75rem 1.1rem; border-radius: 12px;
  background: var(--surface); color: var(--text); font-weight: 600;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: #1a180f; }
.btn-teal { background: var(--accent-2); color: #061513; }
.btn-danger { background: var(--danger); color: #1a0f0f; }
.btn-ghost { background: transparent; border: 1px solid rgba(245,240,232,.18); }
.btn-xl { min-height: 72px; font-size: 1.15rem; width: 100%; border-radius: 16px; }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; }

.login {
  min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem;
}
.login-card {
  width: min(420px, 100%);
  background: linear-gradient(180deg, rgba(44,59,82,.95), rgba(26,35,50,.92));
  border: 1px solid rgba(245,240,232,.08);
  border-radius: 20px; padding: 1.75rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.login-card h1 { font-family: var(--display); margin: 0 0 .35rem; }
.login-card p { color: var(--muted); margin: 0 0 1.25rem; }
.pin-input {
  width: 100%; letter-spacing: .4em; text-align: center; font-size: 1.6rem;
  padding: 1rem; border-radius: 12px; border: 1px solid rgba(245,240,232,.15);
  background: rgba(0,0,0,.25); margin-bottom: 1rem;
}
.check { display: flex; align-items: center; gap: .6rem; color: var(--muted); margin-bottom: 1rem; }
.err { color: var(--danger); margin: .5rem 0 0; min-height: 1.25rem; }

.tabs { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .4rem; margin-bottom: 1rem; }
.tab {
  white-space: nowrap; padding: .65rem .9rem; border-radius: 999px;
  background: rgba(255,255,255,.04); color: var(--muted); font-weight: 600; font-size: .92rem;
}
.tab.active { background: var(--accent); color: #1a180f; }

.search {
  width: 100%; padding: .85rem 1rem; border-radius: 12px;
  border: 1px solid rgba(245,240,232,.12); background: rgba(0,0,0,.2); margin-bottom: 1rem;
}

.grid { display: grid; gap: .75rem; }
.card {
  display: grid; grid-template-columns: 72px 1fr auto; gap: .85rem; align-items: center;
  padding: .85rem; border-radius: var(--radius); background: rgba(44,59,82,.7);
  border: 1px solid rgba(245,240,232,.06); text-align: left; width: 100%;
}
.card img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; background: #111; }
.card .meta { min-width: 0; }
.card .meta strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .meta span { color: var(--muted); font-size: .88rem; }
.badge {
  font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: .35rem .5rem; border-radius: 8px; background: rgba(0,0,0,.25); color: var(--muted);
}
.badge.READY, .badge.LISTED { color: var(--ok); }
.badge.NEEDS_REVIEW, .badge.QUEUED, .badge.ANALYZING { color: var(--warn); }
.badge.ERROR { color: var(--danger); }
.badge.SOLD { color: var(--accent-2); }

.stats {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: .65rem; margin-bottom: 1.25rem;
}
.stat {
  background: rgba(44,59,82,.65); border-radius: 12px; padding: .9rem;
  border: 1px solid rgba(245,240,232,.06);
}
.stat b { display: block; font-size: 1.25rem; font-family: var(--display); }
.stat span { color: var(--muted); font-size: .82rem; }

.mobile-cta { margin: 1rem 0 1.5rem; }

.wizard h2 { font-family: var(--display); margin: 0 0 .5rem; }
.wizard .hint { color: var(--muted); margin: 0 0 1rem; }
.steps { display: grid; gap: .7rem; margin-bottom: 1rem; }
.step {
  display: grid; grid-template-columns: 1fr auto; gap: .6rem; align-items: center;
  padding: .9rem; border-radius: 12px; background: rgba(44,59,82,.7);
}
.step .label { font-weight: 600; }
.step .desc { color: var(--muted); font-size: .85rem; }
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: 1rem 0; }
.thumb {
  position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #111;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .rm {
  position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%;
  background: rgba(0,0,0,.65); color: #fff; font-weight: 700;
}
.hidden-file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }

.detail { display: grid; gap: 1rem; }
@media (min-width: 900px) {
  .detail { grid-template-columns: 1fr 1.1fr; align-items: start; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .table { width: 100%; border-collapse: collapse; }
  .table th, .table td { text-align: left; padding: .75rem .5rem; border-bottom: 1px solid rgba(255,255,255,.06); }
  .table th { color: var(--muted); font-size: .8rem; font-weight: 600; }
}
.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; }
.form-grid { display: grid; gap: .7rem; }
.form-grid label { display: grid; gap: .35rem; font-size: .88rem; color: var(--muted); }
.form-grid input, .form-grid textarea, .form-grid select {
  padding: .75rem .85rem; border-radius: 10px; border: 1px solid rgba(245,240,232,.12);
  background: rgba(0,0,0,.22); color: var(--text);
}
.form-grid textarea { min-height: 140px; resize: vertical; }
.price-box {
  background: rgba(61,155,143,.12); border: 1px solid rgba(61,155,143,.25);
  border-radius: 12px; padding: 1rem; margin: .5rem 0 1rem;
}
.price-box.warning { background: rgba(224,179,90,.1); border-color: rgba(224,179,90,.3); }
.price-box.market { background: rgba(61,155,143,.14); border-color: rgba(61,155,143,.35); }
.price-box-title { font-family: var(--display); font-size: 1.05rem; margin: 0 0 .55rem; letter-spacing: .02em; }
.price-alert { color: var(--warn); font-weight: 700; margin: 0 0 .4rem; }
.price-primary { font-size: 1.15rem; margin: .35rem 0; }
.price-primary-muted { margin: .45rem 0; color: var(--text); }
.price-aux { margin: .45rem 0; color: var(--muted); font-size: .92rem; display: flex; gap: .4rem; flex-wrap: wrap; align-items: baseline; }
.price-aux-value { font-weight: 600; color: var(--muted); font-size: .95rem; }
.price-note { margin: .45rem 0 0; color: var(--muted); font-size: .85rem; }
.group-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: 1rem;
}
.group-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .45rem; min-height: 7.2rem; padding: 1rem .6rem;
  border-radius: 16px; border: 1px solid rgba(245,240,232,.12);
  background: rgba(0,0,0,.22); color: var(--text); font-weight: 600;
}
.group-tile:active { transform: scale(.98); }
.group-emoji { font-size: 2rem; line-height: 1; }
.group-label { font-size: .95rem; text-align: center; }
.group-badge {
  display: inline-block; margin: .4rem 0 .6rem; padding: .25rem .65rem;
  border-radius: 999px; background: rgba(61,155,143,.18); border: 1px solid rgba(61,155,143,.3);
  font-size: .8rem; font-weight: 700; letter-spacing: .02em;
}
@media (min-width: 900px) {
  .group-grid { grid-template-columns: repeat(3, 1fr); }
}
.nav-bottom {
  position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr);
  gap: .25rem; padding: .55rem .55rem calc(.55rem + var(--safe-b));
  background: rgba(26,35,50,.92); backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255,255,255,.06);
}
.nav-bottom button { color: var(--muted); font-size: .75rem; font-weight: 600; padding: .4rem; }
.nav-bottom button.active { color: var(--accent); }
.offline {
  position: sticky; top: 0; z-index: 20; background: var(--warn); color: #1a180f;
  text-align: center; padding: .5rem; font-weight: 700;
}
.toast {
  position: fixed; left: 50%; bottom: calc(5rem + var(--safe-b)); transform: translateX(-50%);
  background: #0e1420; border: 1px solid rgba(255,255,255,.12); padding: .7rem 1rem;
  border-radius: 999px; z-index: 50; opacity: 0; pointer-events: none; transition: .2s;
}
.toast.show { opacity: 1; }
.desktop-only { display: none; }
.mobile-only { display: block; }
@media (min-width: 900px) {
  .desktop-only { display: block; }
  .mobile-only { display: none; }
  .nav-bottom { display: none; }
}
