:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --text: #2d2d2d;
  --muted: #766f68;
  --accent: #b58a5a;
  --accent-strong: #9b7041;
  --secondary: #7d8b6a;
  --line: #e8e3dc;
  --danger: #9b4f42;
  --shadow: 0 18px 48px rgba(45, 45, 45, 0.08);
  --radius: 8px;
  --bottom-nav: 76px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: .72;
}

.app-shell {
  min-height: 100vh;
}

.screen {
  min-height: 100vh;
  padding: 18px 18px calc(var(--bottom-nav) + 22px);
}

.screen.nonav {
  padding-bottom: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  margin-bottom: 12px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--secondary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 4px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: 20px;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

.muted {
  color: var(--muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.quiet-card {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 24px;
}

.action-button {
  min-height: 104px;
  padding: 14px 8px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.action-button .icon {
  display: block;
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 26px;
}

.primary,
.secondary,
.ghost,
.danger {
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 700;
}

.primary {
  color: #fff;
  background: var(--accent);
}

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

.secondary {
  color: var(--text);
  background: var(--surface);
  border-color: var(--line);
}

.ghost {
  color: var(--accent-strong);
  background: transparent;
}

.danger {
  color: #fff;
  background: var(--danger);
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  min-height: var(--bottom-nav);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(250, 248, 245, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.nav-item {
  display: grid;
  place-items: center;
  gap: 3px;
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
}

.nav-item strong {
  color: inherit;
  font-size: 20px;
  line-height: 1;
}

.nav-item.active {
  color: var(--accent-strong);
}

.toolbar,
.chips,
.button-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.chip {
  min-height: 34px;
  white-space: nowrap;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
}

.chip.active {
  color: #fff;
  background: var(--secondary);
  border-color: var(--secondary);
}

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

.piece-card {
  overflow: hidden;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.piece-photo,
.look-photo {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1 / 1.12;
  overflow: hidden;
  background:
    radial-gradient(circle at 28% 18%, rgba(181, 138, 90, .18), transparent 28%),
    linear-gradient(145deg, #f2eee7, #fff);
  color: var(--secondary);
  font-size: 38px;
}

.piece-photo img,
.look-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.piece-body {
  padding: 10px;
}

.piece-body p {
  margin-bottom: 2px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(125, 139, 106, .14);
  color: var(--secondary);
  font-size: 12px;
  font-weight: 700;
}

.badge.wishlist {
  background: rgba(181, 138, 90, .16);
  color: var(--accent-strong);
}

.badge.retired {
  background: rgba(155, 79, 66, .12);
  color: var(--danger);
}

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

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

.field label,
.label {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.field textarea {
  min-height: 88px;
  resize: vertical;
}

.upload-box {
  display: grid;
  place-items: center;
  min-height: 152px;
  padding: 16px;
  border: 1px dashed #cfc6b9;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .62);
  text-align: center;
}

.upload-box input {
  width: 100%;
}

.look-result {
  display: grid;
  gap: 14px;
}

.look-pieces {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.look-piece {
  padding: 10px;
}

.reason {
  padding: 14px;
  line-height: 1.45;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat {
  padding: 12px 8px;
  text-align: center;
}

.stat strong {
  display: block;
  font-size: 20px;
}

.pin-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(250, 248, 245, .62), var(--bg)),
    radial-gradient(circle at 50% 18%, rgba(181, 138, 90, .16), transparent 34%);
}

.pin-panel {
  width: min(100%, 360px);
  padding: 22px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: 0 auto 18px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--accent);
  font-size: 36px;
}

.empty {
  padding: 18px;
  text-align: center;
}

.flash {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid rgba(125, 139, 106, .32);
  border-radius: var(--radius);
  background: rgba(125, 139, 106, .14);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

@media (max-width: 360px) {
  .screen {
    padding-right: 14px;
    padding-left: 14px;
  }

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

  .action-button {
    min-height: 74px;
  }

  .piece-grid,
  .look-pieces {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 720px) {
  body {
    display: grid;
    justify-content: center;
  }

  .app-shell {
    width: min(100vw, 460px);
    min-height: 100vh;
    border-right: 1px solid var(--line);
    border-left: 1px solid var(--line);
    background: var(--bg);
  }

  .bottom-nav {
    right: calc((100vw - min(100vw, 460px)) / 2);
    left: calc((100vw - min(100vw, 460px)) / 2);
  }
}
