:root {
  --bg: #faf8f5; --fg: #222; --muted: #6b6b6b; --line: #e3ded6; --card: #fff;
  --accent: #2f5d50; --accent-fg: #fff; --danger: #a33;
  --keep: #2f5d50; --sell: #2b5b8a; --donate: #7a5a1f; --toss: #777;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #171717; --fg: #eee; --muted: #a0a0a0; --line: #333; --card: #222; --accent: #6fb39e; --accent-fg: #111; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 17px/1.4 system-ui, -apple-system, sans-serif; }
main { max-width: 760px; margin: 0 auto; padding: 12px 16px 48px; }
h1 { font-size: 1.4rem; margin: 8px 0; }
h2 { font-size: 1.2rem; margin: 16px 0 4px; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
section { margin: 16px 0; }

.nav { position: sticky; top: 0; z-index: 2; display: flex; gap: 16px; align-items: center; padding: 10px 16px;
  background: var(--card); border-bottom: 1px solid var(--line); }
.nav a { text-decoration: none; font-weight: 600; }
.nav-add { background: var(--accent); color: var(--accent-fg) !important; padding: 4px 12px; border-radius: 999px; }

.flash { padding: 8px 12px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); }
.flash-alert { border-color: var(--danger); color: var(--danger); }

input, select, textarea { font: inherit; width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--fg); }
input.big { font-size: 1.6rem; }
label { display: block; font-weight: 600; }
label > input, label > select, label > textarea { margin-top: 4px; font-weight: normal; }
.stack { display: grid; gap: 12px; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline input[type=text] { flex: 1; }

.button { display: inline-block; font: inherit; font-weight: 600; padding: 10px 16px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--fg); text-decoration: none; text-align: center; }
.button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.button.danger { color: var(--danger); border-color: var(--danger); }
.button.wide { display: block; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; }
.link.danger { color: var(--danger); }
button[type=submit], input[type=submit] { width: auto; }

.camera { display: flex; align-items: center; justify-content: center; min-height: 120px; border: 2px dashed var(--line);
  border-radius: 12px; cursor: pointer; font-weight: 600; }
.camera { position: relative; }
.camera input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.camera-big { min-height: 200px; font-size: 1.3rem; background: var(--card); }
.add-photo .camera { min-height: 0; aspect-ratio: 1; }

.search { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 600px) { .search { grid-template-columns: 2fr 1fr 1fr; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chips form { margin: 0; }
.chip { display: inline-block; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card);
  color: var(--fg); text-decoration: none; font: inherit; font-size: .95rem; cursor: pointer; }
.chip-on { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.count { opacity: .7; font-size: .85em; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; background: #f3d36b; color: #4a3a00; font-size: .8rem; font-weight: 700; }

.items { list-style: none; padding: 0; margin: 0; }
.item-row { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.item-text { display: grid; flex: 1; min-width: 0; }
.item-text > strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; flex: none; }
.thumb-empty { display: grid; place-items: center; background: var(--line); color: var(--muted); font-weight: 700; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.photos figure { margin: 0; position: relative; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; display: block; }
.photos .remove { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.6); color: #fff; cursor: pointer; }

.decision .buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.decision .buttons form, .decision .buttons .button { width: 100%; }
.decision > form { margin-top: 8px; }
.choice-keep.on { background: var(--keep); color: #fff; border-color: var(--keep); }
.choice-sell.on { background: var(--sell); color: #fff; border-color: var(--sell); }
.choice-donate.on { background: var(--donate); color: #fff; border-color: var(--donate); }
.choice-toss.on { background: var(--toss); color: #fff; border-color: var(--toss); }

.identification .value { font-size: 1.3rem; font-weight: 700; margin: 4px 0; }
dl { margin: 12px 0; }
dt { font-weight: 600; color: var(--muted); font-size: .9rem; }
dd { margin: 0 0 10px; }
@media (min-width: 600px) {
  dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; }
  dd { margin: 0; }
}
.people { list-style: none; padding: 0; }
.people li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.people li .inline { flex: 1 1 260px; }

.exchange { border-left: 3px solid var(--line); padding-left: 12px; margin: 12px 0; }
.exchange .said { display: flex; gap: 8px; align-items: start; justify-content: space-between; }
.exchange .said p { font-weight: 600; margin: 0 0 4px; }
.trash { background: none; border: 0; cursor: pointer; font-size: 1.1rem; padding: 0 4px; opacity: .7; }
.exchange .reply { margin: 0; white-space: pre-line; }

.footer { max-width: 760px; margin: 0 auto; padding: 0 16px 32px; display: flex; flex-wrap: wrap; gap: 4px 0; font-size: .9rem; }
.footer > * + *::before { content: "·"; display: inline-block; margin: 0 8px; color: var(--muted); }
.summary { width: 100%; border-collapse: collapse; margin: 8px 0 20px; }
.summary th, .summary td { padding: 10px 4px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.summary th { font-size: .85rem; color: var(--muted); font-weight: 600; }
.summary .num { text-align: right; white-space: nowrap; }
.summary tr.total td { font-weight: 700; border-bottom: 0; }
.summary a { color: inherit; }
.big-total { font-size: 2rem; font-weight: 700; margin: 4px 0; }
.footer a, .footer .link { color: var(--muted); }
.inline-form { display: inline; }
.grow { flex: 1 1 200px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: normal; }
.check input { width: auto; }
.chips-sub { margin-top: -4px; padding-left: 12px; border-left: 3px solid var(--line); }
.flash ul { margin: 4px 0 0; padding-left: 20px; }
.nav a { padding: 4px 2px; border-bottom: 3px solid transparent; }
.nav a.current { border-bottom-color: var(--accent); color: var(--fg); }
.nav a.nav-add { border-bottom: 0; padding: 4px 12px; }
.nav a.nav-add.current { box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--accent); }
.footer a.current { color: var(--fg); font-weight: 600; text-decoration: none; }
