/* Baby Jackson's Wishlist — soft mauve, big friendly buttons, light theme only. */

:root {
  color-scheme: light;
  --bg: #f7f0f5;
  --surface: #ffffff;
  --surface-2: #f1e6ee;
  --line: #e6d6e1;
  --text: #2f2230;
  --muted: #6e5a6b;
  --accent: #915f8b;
  --accent-dark: #774a72;
  --accent-soft: #f0e1ec;
  --ok: #3f7a55;
  --ok-soft: #e3f1e7;
  --warn: #9a6a12;
  --warn-soft: #fbf0d9;
  --bad: #a8433f;
  --bad-soft: #f9e4e2;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(80, 40, 75, .06), 0 8px 24px rgba(80, 40, 75, .07);
  --tabbar-h: 72px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 18px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--accent-dark); }
img { max-width: 100%; }
[hidden] { display: none !important; }

/* ----------------------------------------------------------------- buttons */

button, .btn {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border-radius: 14px;
  border: 2px solid transparent;
  min-height: 52px;
  padding: 12px 20px;
  background: var(--surface-2);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  line-height: 1.2;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: .55; cursor: default; }

.primary { background: var(--accent); color: #fff; }
.primary:hover { background: var(--accent-dark); }
.secondary { background: var(--surface); color: var(--accent-dark); border-color: var(--accent); }
.ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.danger { background: var(--bad-soft); color: var(--bad); }
.success { background: var(--ok-soft); color: var(--ok); }
.big { width: 100%; min-height: 60px; font-size: 20px; }
.wide { width: 100%; }

.small-btn {
  min-height: 44px;
  padding: 8px 14px;
  font-size: 15px;
  background: var(--surface);
  border: 2px solid var(--line);
  color: var(--muted);
}

button:focus-visible, .btn:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > * { flex: 1 1 160px; }

/* -------------------------------------------------------------------- forms */

label { display: block; font-weight: 600; margin: 16px 0 6px; }
.hint { font-weight: 400; color: var(--muted); font-size: 15px; }

input[type="text"], input[type="password"], input[type="url"], input[type="number"], textarea {
  width: 100%;
  font: inherit;
  font-size: 18px;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 13px 15px;
  min-height: 54px;
}
textarea { min-height: 110px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #a996a6; }

.pin-input { font-size: 26px; letter-spacing: .5em; text-align: center; }

.form-error {
  margin: 14px 0 0;
  color: var(--bad);
  background: var(--bad-soft);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 17px;
}

/* -------------------------------------------------------------------- login */

.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 20px 16px;
  background: radial-gradient(1200px 600px at 50% -10%, #ead3e5, var(--bg) 60%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 30px 24px 26px;
  text-align: center;
}
.login-mark { font-size: 52px; line-height: 1; }
.login-card h1 { margin: 12px 0 4px; font-size: 26px; line-height: 1.2; color: var(--accent-dark); }
.login-sub { margin: 0 0 12px; color: var(--muted); }
.login-card form { text-align: left; }
.login-card .big { margin-top: 22px; }
.login-hint { color: var(--muted); font-size: 16px; margin: 10px 0 0; }
.login-error { background: var(--bad-soft); color: var(--bad); border-radius: 12px; padding: 12px 14px; margin: 10px 0 0; text-align: left; }
.login-switch { margin: 22px 0 0; font-size: 17px; }
.login-switch a { font-weight: 700; display: inline-block; padding: 8px 4px; }

.show-pin { display: flex; align-items: center; gap: 10px; font-weight: 400; color: var(--muted); margin-top: 14px; min-height: 44px; cursor: pointer; }
.show-pin input { width: 24px; height: 24px; accent-color: var(--accent); }

/* ------------------------------------------------------------------- topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--accent);
  color: #fff;
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { margin: 0; font-size: 20px; line-height: 1.2; display: flex; align-items: center; gap: 8px; }
.brand-mark { font-size: 22px; }
.logout-form { margin: 0; flex: 0 0 auto; }
.topbar .small-btn { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .55); }

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 18px 16px calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom, 0px));
}

.page-title { font-size: 26px; margin: 4px 0 4px; color: var(--accent-dark); }
.page-sub { margin: 0 0 18px; color: var(--muted); }
.loading { color: var(--muted); text-align: center; padding: 40px 0; }
.section-title { font-size: 21px; margin: 28px 0 10px; color: var(--accent-dark); }

.banner {
  background: var(--accent-soft);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: space-between;
}
.banner .small-btn { background: var(--surface); }

/* ------------------------------------------------------------------- tabbar */

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 18px rgba(80, 40, 75, .08);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabbar-inner { max-width: 720px; margin: 0 auto; display: flex; }
.tab {
  flex: 1 1 0;
  min-height: var(--tabbar-h);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  flex-direction: column;
  gap: 2px;
  padding: 8px 4px;
  font-size: 15px;
  border: none;
  border-top: 4px solid transparent;
}
.tab .tab-icon { font-size: 24px; line-height: 1; }
.tab.is-active { color: var(--accent-dark); border-top-color: var(--accent); background: var(--accent-soft); }
.tab { position: relative; }
.tab .count {
  position: absolute;
  top: 6px;
  left: calc(50% + 10px);
  display: inline-block;
  min-width: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  line-height: 22px;
}

/* -------------------------------------------------------------------- cards */

.cards { display: grid; gap: 16px; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-body { padding: 16px; display: grid; gap: 10px; }
.card-title { margin: 0; font-size: 21px; line-height: 1.3; }
.card-desc { margin: 0; color: var(--muted); white-space: pre-line; }
.card-desc.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.card-img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 300px;
  object-fit: contain;
  background: #fff;
  border: none;
  padding: 0;
  border-bottom: 1px solid var(--line);
}
.card-img.placeholder {
  display: grid;
  place-items: center;
  font-size: 52px;
  background: var(--accent-soft);
  aspect-ratio: 16 / 5;
}
button.card-img { border-radius: 0; min-height: 0; cursor: zoom-in; }

.shop-link { font-weight: 600; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }

.need {
  display: inline-block;
  font-weight: 700;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 4px 12px;
  justify-self: start;
}

.pill { white-space: nowrap; display: inline-block; border-radius: 999px; padding: 4px 12px; font-weight: 700; font-size: 16px; justify-self: start; }
.pill.claimed { background: var(--warn-soft); color: var(--warn); }
.pill.bought { background: var(--ok-soft); color: var(--ok); }
.pill.mine { background: var(--ok-soft); color: var(--ok); }
.pill.muted { background: var(--surface-2); color: var(--muted); }
.pill.alert { background: var(--accent); color: #fff; }

.empty {
  text-align: center;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 22px;
}
.empty .big-emoji { font-size: 56px; line-height: 1; margin-bottom: 10px; }
.empty h2 { margin: 0 0 8px; font-size: 22px; color: var(--accent-dark); }
.empty p { margin: 0 0 14px; color: var(--muted); }

.note-btn .count, .link-count {
  display: inline-block; min-width: 22px; padding: 0 6px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 13px; line-height: 22px;
}

/* ------------------------------------------------------------------- admin */

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 8px; }
.stat { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 14px; }
.stat b { display: block; font-size: 30px; line-height: 1.1; color: var(--accent-dark); }
.stat span { color: var(--muted); font-size: 16px; }
.stat.alert { background: var(--accent); }
.stat.alert b, .stat.alert span { color: #fff; }
button.stat { display: block; text-align: left; min-height: 0; font-weight: 400; border: none; }

.row-item { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); }
.row-item:first-child { border-top: none; }
.thumb { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; background: var(--accent-soft); flex: 0 0 auto; display: grid; place-items: center; font-size: 28px; }
.row-main { flex: 1 1 auto; min-width: 0; }
.row-main b { display: block; overflow-wrap: anywhere; }
.row-main small { color: var(--muted); font-size: 15px; }

.claim-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.claim-list li { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.claim-list .who { font-weight: 700; }

.person-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.person-head h3 { margin: 0; font-size: 21px; }

.thumb-preview { display: flex; gap: 12px; align-items: center; margin-top: 10px; }
.thumb-preview img { width: 120px; height: 120px; object-fit: contain; border-radius: 12px; background: #fff; border: 1px solid var(--line); }

.file-label {
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 12px 20px;
  border-radius: 14px;
  background: var(--surface);
  color: var(--accent-dark);
  border: 2px solid var(--accent);
  cursor: pointer;
  flex: 1 1 160px;
}
.file-label input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-label:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }

.stepper { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 18px 0 6px; }
.stepper button { width: 64px; height: 64px; font-size: 32px; border-radius: 50%; padding: 0; background: var(--accent-soft); color: var(--accent-dark); }
.stepper output { font-size: 44px; font-weight: 700; min-width: 70px; text-align: center; color: var(--accent-dark); }
.stepper-note { text-align: center; color: var(--muted); margin: 0; }

/* --------------------------------------------------------------- messages */

.thread { display: grid; gap: 10px; margin: 6px 0 12px; max-height: 50vh; overflow-y: auto; padding: 2px; }
.bubble { max-width: 85%; border-radius: 16px; padding: 10px 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble small { display: block; font-size: 13px; opacity: .8; margin-bottom: 2px; font-weight: 600; }
.bubble.theirs { background: var(--surface-2); justify-self: start; border-bottom-left-radius: 4px; }
.bubble.mine { background: var(--accent); color: #fff; justify-self: end; border-bottom-right-radius: 4px; }
.thread-empty { color: var(--muted); margin: 4px 0 8px; }

.msg-card .row-item { cursor: pointer; }
.msg-card.unread { box-shadow: 0 0 0 3px var(--accent), var(--shadow); }
.msg-open { padding: 0 16px 16px; }

/* ------------------------------------------------------------------ modal */

.modal-back {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(47, 34, 48, .45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
.modal {
  background: var(--surface);
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  max-height: 92dvh;
  overflow-y: auto;
  border-radius: 24px 24px 0 0;
  padding: 22px 18px calc(22px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -10px 40px rgba(47, 34, 48, .25);
}
.modal h2 { margin: 0 0 6px; font-size: 23px; color: var(--accent-dark); padding-right: 50px; }
.modal-head { position: relative; }
.modal-close {
  position: absolute; top: -6px; right: -4px;
  min-height: 48px; width: 48px; padding: 0; border-radius: 50%;
  background: var(--surface-2); color: var(--muted); font-size: 24px;
}
.modal-actions { display: grid; gap: 10px; margin-top: 20px; }
.modal-img { width: 100%; max-height: 50vh; object-fit: contain; border-radius: 14px; background: #fff; }

@media (min-width: 640px) {
  .modal-back { align-items: center; padding: 24px; }
  .modal { border-radius: 24px; }
  .stats { grid-template-columns: repeat(4, 1fr); }
}

/* ------------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 60;
  background: var(--text);
  color: #fff;
  padding: 14px 20px;
  border-radius: 14px;
  font-weight: 600;
  box-shadow: var(--shadow);
  max-width: calc(100% - 32px);
  text-align: center;
}
