:root {
  --bg: #f6f4ef; --card: #fff; --ink: #222; --muted: #757068; --line: #e2ded5;
  --accent: #2f6f5e; --accent-ink: #fff; --danger: #b3382c; --warn: #c98a16;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #17181a; --card: #222427; --ink: #eceae4; --muted: #9b978d; --line: #35373b; --accent: #5bb59c; --accent-ink: #10231d; --danger: #e0685b; --warn: #e3a93a; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.6rem; margin: .4em 0; } h2 { font-size: 1.2rem; } h3 { margin: .2em 0; } h4 { margin: 1em 0 .3em; }
.muted { color: var(--muted); }
.top { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; text-decoration: none; color: var(--ink); font-size: 1.15rem; }
.top nav { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.top nav a { text-decoration: none; }
form.inline { display: inline; margin: 0; }
button, input[type=submit] { font: inherit; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); text-align: left; }
button.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
button.small { padding: 3px 9px; font-size: .85rem; margin-left: 4px; }
button:disabled { opacity: .5; }
input:not([type=checkbox]):not([type=file]) { font: inherit; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); width: 100%; }
input[type=file] { width: 100%; }
label { display: block; margin: 10px 0; font-weight: 500; }
label.check { font-weight: 400; margin: 4px 0; } label.check input { margin-right: 6px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 12px 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; margin: 14px 0; }
.card.narrow { max-width: 420px; margin: 40px auto; }
.flash { background: #fff6d6; color: #4a3b00; border: 1px solid #e8d48a; padding: 8px 12px; border-radius: 8px; margin: 10px 0; }
.row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.row input { flex: 1 1 140px; width: auto; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; text-decoration: none; color: var(--ink); display: block; }
.tile img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.tile .cap { display: block; padding: 8px 10px; font-size: .92rem; }
.badge { display: inline-block; background: var(--warn); color: #111; border-radius: 99px; padding: 0 8px; font-size: .75rem; margin-left: 4px; }

.viewer { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
@media (max-width: 800px) { .viewer { grid-template-columns: 1fr; } }
.photo-wrap { position: relative; display: inline-block; max-width: 100%; line-height: 0; border-radius: 8px; overflow: hidden; background: #000; }
.photo-wrap img { max-width: 100%; max-height: 80vh; height: auto; width: auto; display: block; }
.photo-wrap.tagging img { cursor: crosshair; }
.toolbar { margin-top: 10px; display: flex; gap: 12px; align-items: center; }
.marker { position: absolute; transform: translate(-50%, -50%); width: 30px; height: 30px; padding: 0; border-radius: 50%; border: 3px solid #fff; color: #fff; font-weight: 700; font-size: .85rem; line-height: 24px; text-align: center; box-shadow: 0 0 0 1px rgba(0,0,0,.6), 0 2px 6px rgba(0,0,0,.5); cursor: pointer; }
.marker.named { background: #2f8f5e; }
.marker.disputed { background: #c98a16; }
.marker.unknown { background: #7a4fc4; }
.marker.pending { background: #fff; color: #000; border-color: #000; pointer-events: none; }
.marker.selected { outline: 3px solid #fff; transform: translate(-50%, -50%) scale(1.2); }
.side { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.people-list { list-style: none; padding: 0; margin: 0 0 10px; }
.people-list li { padding: 4px 0; }
.people-list li.selected button { font-weight: 700; }
.people-list li.unknown button { color: #7a4fc4; }
.panel { border-top: 1px solid var(--line); padding-top: 10px; }
.labels { padding-left: 0; list-style: none; } .labels li { margin: 6px 0; }
.status.named { color: #2f8f5e; font-weight: 600; }
.status.disputed { color: var(--warn); font-weight: 600; }

.badge.soft { background: var(--line); color: var(--ink); }
.comments { margin-top: 6px; }
.comment { padding: 8px 0; border-bottom: 1px solid var(--line); }
.comment:last-of-type { border-bottom: 0; }
.c-head { font-size: .88rem; }
.c-body { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.c-form { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; align-items: flex-start; }
.c-form textarea { width: 100%; font: inherit; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); resize: vertical; }
button.danger-link { color: var(--danger); font-size: .85rem; }
.toolbar button[hidden] { display: none; }
.person { margin: 18px 0; }
.strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.strip img { height: 110px; width: 110px; object-fit: cover; border-radius: 8px; display: block; }
.table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 12px; overflow: hidden; }
.table th, .table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.two-col { display: grid; grid-template-columns: 240px 1fr; gap: 20px; align-items: start; }
@media (max-width: 700px) { .two-col { grid-template-columns: 1fr; } }
.preview { width: 100%; border-radius: 10px; }
.review { display: grid; grid-template-columns: 160px 1fr; gap: 16px; }
.review img { width: 100%; border-radius: 8px; }
.review ul { list-style: none; padding: 0; }
