:root {
  --bg: #f8f4ec;
  --card: #ffffff;
  --ink: #2a2926;
  --muted: #6b675e;
  --line: #e7dfce;
  --green: #234f3b;
  --green-dark: #1a3b2c;
  --red: #9c2f3b;
  --red-dark: #7f2330;
  --gold: #b8913f;
  --gold-soft: #f3e8c8;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(40, 35, 20, .06), 0 4px 14px rgba(40, 35, 20, .05);
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; padding-block: 28px 48px; }
.wrap { width: 100%; max-width: 980px; margin-inline: auto; padding-inline: 20px; }
h1, h2 { font-family: var(--serif); font-weight: 700; color: var(--green-dark); line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: 2rem; } h2 { font-size: 1.2rem; }
a { color: var(--red); }
a:hover { color: var(--red-dark); }
.muted { color: var(--muted); }
.center { text-align: center; }
p { margin: 0 0 .8em; }

/* header */
.site-header { background: var(--green); color: #fff; border-bottom: 5px solid transparent;
  border-image: repeating-linear-gradient(-45deg, var(--red) 0 10px, #f8f4ec 10px 20px) 1; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; padding-block: 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font: 700 1.35rem var(--serif); }
.brand:hover { color: var(--gold-soft); }
.site-header nav { display: flex; align-items: center; gap: 4px 18px; flex-wrap: wrap; }
.site-header nav a, .site-header nav .link { color: #e8efe9; text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; font-size: .95rem; }
.site-header nav a:hover, .site-header nav .link:hover { color: #fff; border-color: var(--gold); }
.site-header nav a.on { color: #fff; border-color: var(--gold); }

/* cards & forms */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card.narrow { max-width: 440px; margin: 24px auto; }
.card.narrow.wide { max-width: 600px; }
.stack { display: grid; gap: 14px; }
label { display: grid; gap: 4px; font-weight: 600; font-size: .92rem; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
input[type=text], input[type=password], input:not([type]), input[type=url], textarea { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid #cfc6b1; border-radius: 8px; background: #fffefb; color: var(--ink); }
input:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(35, 79, 59, .3); outline-offset: 1px; border-color: var(--green); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > input { flex: 1 1 260px; width: auto; }
.row.tight { gap: 6px; flex-wrap: nowrap; }
.inline { display: inline; margin: 0; }
form { margin: 0; }

.btn { display: inline-block; font: 600 .95rem var(--sans); background: var(--green); color: #fff; border: 1px solid var(--green); padding: 10px 18px; border-radius: 8px; cursor: pointer; text-decoration: none; text-align: center; }
.btn:hover { background: var(--green-dark); color: #fff; }
.btn.small { padding: 6px 12px; font-size: .85rem; }
.btn.ghost { background: transparent; color: var(--green); }
.btn.ghost:hover { background: #eaf1ec; color: var(--green-dark); }
.btn.danger { background: var(--red); border-color: var(--red); }
.btn.danger:hover { background: var(--red-dark); }
.btn:disabled { opacity: .6; cursor: wait; }
button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--red); cursor: pointer; text-decoration: underline; }
button.link.danger { color: var(--red); }

.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; border: 1px solid; }
.flash.success { background: #eaf4ee; border-color: #b8d8c4; color: var(--green-dark); }
.flash.error { background: #fbeceb; border-color: #e5b5b6; color: var(--red-dark); }
.flash.info { background: var(--gold-soft); border-color: #e4d09a; color: #6b5214; }

/* people */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 20px; }
.person { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; margin: 0; transition: transform .12s, box-shadow .12s; }
.person:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(40, 35, 20, .1); color: inherit; }
.person.me { border-color: var(--gold); background: linear-gradient(135deg, #fffdf6, var(--gold-soft)); }
.avatar { flex: none; width: 46px; height: 46px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font: 700 1.2rem var(--serif); }
.person.me .avatar { background: var(--red); }
.who { display: grid; line-height: 1.3; }
.who .muted { font-size: .88rem; }

/* list */
.page-head { margin-bottom: 14px; }
.add-form label { display: block; margin-bottom: 8px; font-weight: 400; }
.add-form .row { flex-wrap: nowrap; }
.empty { text-align: center; color: var(--muted); }
.items { display: grid; gap: 16px; }
.item, .detail { display: grid; grid-template-columns: 150px 1fr; gap: 20px; margin: 0; }
.thumb { display: block; width: 150px; height: 150px; border-radius: 10px; overflow: hidden; background: #f0ebdd; }
.thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; display: block; }
.placeholder { width: 100%; height: 100%; display: grid; place-items: center; }
.detail { grid-template-columns: 240px 1fr; margin-bottom: 20px; }
.detail .thumb { width: 240px; height: 240px; }
.item h2 { font-size: 1.15rem; margin-bottom: .15em; }
.item h2 a { color: var(--green-dark); text-decoration: none; }
.item h2 a:hover { text-decoration: underline; }
.price { font-weight: 700; color: var(--red); margin-bottom: .3em; }
.desc { color: var(--muted); font-size: .92rem; margin-bottom: .5em; }
.meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: .88rem; margin-bottom: 10px; }
.status-row { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.owner-tools { display: flex; gap: 14px; align-items: center; margin-top: 10px; font-size: .85rem; }
.item.purchased { background: #f6f4ee; } .item.purchased .thumb { opacity: .75; }
.badge { display: inline-block; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; }
.badge.claimed { background: var(--gold-soft); color: #6b5214; border: 1px solid #e4d09a; }
.badge.purchased { background: #e3efe7; color: var(--green-dark); border: 1px solid #b8d8c4; }
.badge.shared { background: #f2e5e6; color: var(--red-dark); font-weight: 600; }
.badge.disabled { background: #eee; color: #555; }
.crumb { margin-bottom: 14px; }

/* comments */
.comments { list-style: none; padding: 0; margin: 0 0 18px; }
.comments li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.comments li p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.c-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: .9rem; }
.c-head .inline { margin-left: auto; font-size: .85rem; }
.comment-form { max-width: 560px; }

/* admin */
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; align-items: end; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tr.is-disabled td { color: var(--muted); }
td .row.tight input { min-width: 140px; padding: 6px 10px; }

.site-footer { padding-block: 22px; color: var(--muted); font-size: .85rem; text-align: center; border-top: 1px solid var(--line); }

@media (max-width: 620px) {
  h1 { font-size: 1.6rem; }
  .item { grid-template-columns: 96px 1fr; gap: 14px; padding: 14px; }
  .item .thumb { width: 96px; height: 96px; }
  .detail { grid-template-columns: 1fr; }
  .detail .thumb { width: 100%; height: 240px; }
  .add-form .row { flex-wrap: wrap; }
  .add-form .btn { width: 100%; }
}

/* home stats */
.person { align-items: flex-start; }
.who { flex: 1; min-width: 0; }
.small { font-size: .85rem; }
.stats { list-style: disc; margin: 6px 0 0; padding-left: 1.1rem; font-size: .9rem; color: var(--muted); }
.stats li::marker { color: var(--gold); }
.stats b { color: var(--green-dark); font-weight: 700; }

/* notifications */
.bell { position: relative; display: inline-flex; align-items: center; }
.bell .count { position: absolute; top: -6px; right: -9px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font: 700 .7rem/18px var(--sans); text-align: center; border: 2px solid var(--green); box-sizing: content-box; }
.notes { list-style: none; padding: 0; overflow: hidden; }
.notes li { border-bottom: 1px solid var(--line); }
.notes li:last-child { border: 0; }
.notes a { display: flex; align-items: baseline; gap: 12px; padding: 14px 18px; color: var(--ink); text-decoration: none; }
.notes a:hover { background: #faf7ef; }
.notes .text { flex: 1; }
.notes .when { font-size: .8rem; white-space: nowrap; }
.notes .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: transparent; }
.notes li.unread { background: #fffaf0; }
.notes li.unread .dot { background: var(--red); }
