:root {
  --bg: #0b1220;
  --bg-elev: #121a2b;
  --card: #172033;
  --line: rgba(226, 232, 240, 0.12);
  --text: #f8fafc;
  --muted: #94a3b8;
  --blue: #60a5fa;
  --blue-deep: #2563eb;
  --green: #34d399;
  --danger: #f87171;
  --warn: #fbbf24;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

body {
  min-height: 100dvh;
}

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

button { cursor: pointer; }

#app { min-height: 100dvh; }

.screen {
  width: min(480px, 100%);
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 18px calc(96px + env(safe-area-inset-bottom));
}

.auth-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
}

.brand {
  font-weight: 750;
  letter-spacing: -0.04em;
  font-size: 1.7rem;
}

.brand span { color: var(--blue); }

.lede {
  color: var(--muted);
  line-height: 1.45;
  margin: 8px 0 22px;
}

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

.stack { display: flex; flex-direction: column; gap: 12px; }

label { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--muted); }

input, select, textarea {
  /* 16px or more stops iOS Safari zooming the page when a field gets focus. */
  font-size: 16px;
  color: var(--text, inherit);
  background: #0d1526;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}

textarea { min-height: 80px; resize: vertical; }

input:focus, select:focus, textarea:focus { border-color: var(--blue); }

.btn, .btn-secondary, .btn-danger, .btn-quiet {
  border: 0;
  border-radius: 14px;
  padding: 14px 16px;
  font-weight: 650;
}

.btn { background: var(--blue-deep); color: white; }
.btn-secondary { background: #243044; color: var(--text); }
.btn-danger { background: #7f1d1d; color: #fecaca; }
.btn-quiet { background: transparent; color: var(--blue); padding: 8px 0; text-align: left; }

.btn:disabled { opacity: 0.55; }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.topbar h1 {
  font-size: 1.35rem;
  margin: 0;
  letter-spacing: -0.03em;
}

.muted { color: var(--muted); }
.small { font-size: 0.85rem; line-height: 1.4; }

.banner {
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 12px;
  line-height: 1.4;
}

.banner.warn { background: #3b2a0a; color: #fde68a; }
.banner.bad { background: #3f1515; color: #fecaca; }
.banner.ok { background: #052e24; color: #a7f3d0; }

.list { display: flex; flex-direction: column; gap: 10px; }

.item, .bin-card {
  display: flex;
  gap: 12px;
  align-items: center;
  text-align: left;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  color: inherit;
}

.thumb {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  background: #0d1526;
  flex: none;
}

.thumb.placeholder { display: grid; place-items: center; color: var(--muted); font-size: 0.75rem; }

.item h2, .bin-card h2 { margin: 0 0 4px; font-size: 1rem; }
.item p, .bin-card p { margin: 0; color: var(--muted); font-size: 0.85rem; }

.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-around;
  background: rgba(11, 18, 32, 0.94);
  border-top: 1px solid var(--line);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  backdrop-filter: blur(16px);
}

.nav button {
  background: transparent;
  border: 0;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  min-width: 64px;
  padding: 6px;
}

.nav button.active { color: var(--text); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.chip {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 12px;
  white-space: nowrap;
}
.chip.on { background: #1d4ed8; color: white; border-color: transparent; }

.progress {
  height: 6px;
  background: #0d1526;
  border-radius: 99px;
  overflow: hidden;
}
.progress span {
  display: block;
  height: 100%;
  width: 40%;
  background: var(--blue);
  animation: slide 1s ease-in-out infinite;
}
@keyframes slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(280%); }
}

.steps { margin: 0; padding-left: 18px; color: var(--muted); }
.steps li { margin: 8px 0; }

.noscript {
  max-width: 28rem;
  margin: 2rem auto;
  padding: 0 1rem;
}

.member {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.role {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--blue);
}

.history { list-style: none; padding: 0; margin: 0; }
.history li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }

code.invite {
  display: block;
  font-size: 1.4rem;
  letter-spacing: 0.18em;
  background: #0d1526;
  padding: 12px;
  border-radius: 12px;
  text-align: center;
}

.phrase {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 8px;
}

.tip { border-color: var(--blue); margin-bottom: 14px; }
.tip h3 { margin-top: 0; }
pre.readonly {
  margin: 0;
  padding: 12px;
  max-height: 50vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.8rem;
  background: #0d1526;
  border: 1px solid var(--line);
  border-radius: 12px;
}

/* Flex containers would otherwise override the hidden attribute. */
[hidden] { display: none !important; }

.hint { margin: -4px 0 0; }

.title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 4px;
}
.bin-title {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
  min-width: 0;
}
.btn-small {
  flex: none;
  padding: 10px 14px;
  min-height: 44px;
  font-size: 0.95rem;
}
.rename { margin: 4px 0 12px; }
.rename input { width: 100%; }
.bin-card h2 { overflow-wrap: anywhere; }
.subtitle-row { align-items: center; margin: 0 0 12px; }
.bin-subtitle { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.switch-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  min-height: 44px;
}
.switch-row input[type="checkbox"] {
  width: 24px;
  height: 24px;
  min-height: 0;
  flex: none;
  margin: 0;
}

/* Estimated value scale: five $ signs, unlit ones gray but readable. */
.value-scale { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.value-signs { display: inline-flex; gap: 1px; font-weight: 700; font-size: 1rem; letter-spacing: 0.02em; }
.value-signs .sign { color: var(--muted); opacity: 0.45; }
.value-signs .sign.on { color: var(--green); opacity: 1; }
.value-note { font-size: 0.75rem; color: var(--muted); }

/* Duplicate prompt on a scanned item ("Already in this bin"). */
.duplicate { border-color: var(--blue); padding: 10px; }
.duplicate .row { flex-wrap: wrap; gap: 8px; }
.shelf-tip { margin: 0; }

/* iOS wrap: bottom tab bar respects the home indicator; offline overlay. */
.native-ios .nav { position: fixed; left: 0; right: 0; bottom: 0; padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
.native-ios .screen { padding-bottom: calc(72px + env(safe-area-inset-bottom)); padding-top: env(safe-area-inset-top); }
.offline-screen { position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; gap: 12px; text-align: center; padding: 24px; background: #0f172a; color: #f8fafc; }

a.btn { display: block; text-align: center; text-decoration: none; }
