:root {
  --ink: #1f2521;
  --muted: #5d665f;
  --line: #dcdfd8;
  --paper: #f6f6f2;
  --stone: #f1f0ea;
  --accent: #2f5d46;
  --danger: #a3312b;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); line-height: 1.45; }
a { color: var(--accent); }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

.adminbar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  padding: 12px 20px; background: #fff; border-bottom: 1px solid var(--line);
}
.adminbar nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.adminbar nav form { margin: 0; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.brand-mark { display: block; width: 30px; height: 30px; }

.wrap { max-width: 1000px; margin: 0 auto; padding: 20px 16px 80px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
h1 { font-size: 1.6rem; margin: 8px 0 16px; }
h1 .count { font-size: 1rem; color: var(--muted); font-weight: 500; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-bottom: 18px; }
.card h2 { margin: 0 0 12px; font-size: 1.1rem; }
.hint { color: var(--muted); margin-top: 0; font-size: 14px; }

label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 14px; }
label small { font-weight: 400; color: var(--muted); }
input, select, textarea {
  display: block; width: 100%; margin-top: 5px; font: inherit; font-size: 16px; font-weight: 400;
  padding: 9px 11px; border: 1px solid #c9cdc5; border-radius: 9px; background: #fff; color: var(--ink);
}
input[type=file] { border-style: dashed; padding: 14px; background: var(--stone); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
textarea.serif { font-family: Georgia, "Times New Roman", serif; }
.req { color: var(--danger); }
.grid2, .grid3 { display: grid; gap: 0 14px; }
.grid2 { grid-template-columns: 1fr 1fr; }
.grid3 { grid-template-columns: 1fr 1fr 1fr; }

.btn {
  display: inline-block; font: inherit; font-size: 15px; font-weight: 600; padding: 9px 16px; border-radius: 10px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn.ghost { background: #fff; color: var(--accent); }
.btn.small { padding: 6px 10px; font-size: 14px; }
.btn.big { padding: 12px 26px; font-size: 16px; }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
.linkish.danger { color: var(--danger); }
.icon-btn { flex: none; width: 40px; height: 40px; margin-top: 5px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font-size: 20px; cursor: pointer; color: var(--muted); }
.icon-btn:hover { color: var(--danger); border-color: var(--danger); }

.flash { padding: 11px 14px; border-radius: 10px; margin-bottom: 12px; background: #eef3ef; border: 1px solid #cfdcd3; }
.flash-error { background: #fbeceb; border-color: #efc9c6; color: #7a211c; }
.flash-success { background: #e9f5ee; border-color: #bfe0cb; }

.login { max-width: 400px; margin: 40px auto; }

.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input { flex: 1; min-width: 200px; margin: 0; }
.toolbar select { width: auto; margin: 0; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
table.list { width: 100%; border-collapse: collapse; font-size: 15px; }
.list th, .list td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.list th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.list tr:last-child td { border-bottom: 0; }
.thumbcell { width: 56px; }
.thumbcell img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; display: block; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.status { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--stone); white-space: nowrap; }
.status-published { background: #e1f1e7; color: #1d5a36; }
.status-pending { background: #fdf1d8; color: #7a5510; }
.status-rejected { background: #f7e1df; color: #7a211c; }
.empty { text-align: center; }

.geo-search { display: flex; gap: 8px; align-items: center; }
.geo-search input { margin: 0; }
.geo-results { list-style: none; margin: 6px 0 0; padding: 4px; border: 1px solid var(--line); border-radius: 10px; max-height: 200px; overflow: auto; }
.geo-results button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 7px 8px; font: inherit; font-size: 14px; cursor: pointer; border-radius: 6px; }
.geo-results button:hover { background: var(--stone); }
.geo-results li.muted { padding: 7px 8px; font-size: 14px; }
.pick-map { height: 380px; border-radius: 12px; margin: 12px 0 14px; border: 1px solid var(--line); cursor: crosshair; }

/* One person = one small card: name / rank / unit on the first line, death date / age / notes on the second. */
.person-row {
  display: grid; gap: 10px 12px; align-items: end;
  grid-template-columns: minmax(0, 1.5fr) 90px minmax(0, 1fr) minmax(0, 1.4fr) 40px;
  grid-template-areas:
    "name  name rank  unit  remove"
    "date  age  notes notes .";
  padding: 14px; margin-bottom: 10px; background: var(--stone); border: 1px solid var(--line); border-radius: 12px;
}
.person-row .pf { margin: 0; font-size: 13px; font-weight: 600; color: var(--muted); min-width: 0; }
.person-row .pf input { margin-top: 4px; }
.pf-name { grid-area: name; }
.pf-rank { grid-area: rank; }
.pf-unit { grid-area: unit; }
.pf-date { grid-area: date; }
.pf-age { grid-area: age; }
.pf-notes { grid-area: notes; }
.pf-remove { grid-area: remove; align-self: end; margin-top: 0; }
.person-row .pf-name input { font-weight: 600; }

.photo-preview { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.photo-preview figure { margin: 0; width: 120px; font-size: 12px; color: var(--muted); word-break: break-all; }
.photo-preview img { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; display: block; }

.photo-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.photo-item { position: relative; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.photo-item img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; display: block; }
.photo-item > .status { position: absolute; top: 18px; left: 18px; }
.photo-item form { margin: 0; }
.photo-item input { font-size: 14px; padding: 7px 9px; }
.photo-item .btn { margin-top: 6px; }
.photo-actions { display: flex; justify-content: space-between; margin-top: 8px; font-size: 14px; }

.savebar {
  position: sticky; bottom: 0; display: flex; gap: 18px; align-items: center; padding: 14px 20px;
  background: rgba(255,255,255,.95); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 28px;
  box-shadow: 0 -4px 18px rgba(0,0,0,.06);
}
.danger-zone { border-color: #efc9c6; }

@media (max-width: 720px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .person-row {
    position: relative;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "name  name"
      "rank  unit"
      "date  age"
      "notes notes";
  }
  .person-row .pf-name { margin-right: 50px; }
  /* Sits beside the name input: card padding (14) + label line (18) + input margin (4). */
  .person-row .pf-remove { position: absolute; top: 36px; right: 14px; }
  .pick-map { height: 300px; }
}

/* ---- Accounts ---- */
.pill {
  display: inline-block; min-width: 20px; padding: 1px 7px; border-radius: 999px; background: #c2410c; color: #fff;
  font-size: 12px; font-weight: 700; text-align: center; line-height: 18px; vertical-align: 1px;
}
.login-alt { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.notice-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; margin-bottom: 16px; border-radius: 12px; background: #fdf1d8; border: 1px solid #f0d9a6;
}
.user-list { list-style: none; margin: 0; padding: 0; }
.user-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.user-list li:last-child { border-bottom: 0; }
.who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-width: 0; }
.who small { flex-basis: 100%; }
.user-actions { display: flex; gap: 8px; align-items: center; }
.user-actions form { margin: 0; }

/* ---- Alpha mode ---- */
.alpha-badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px; background: #fdf1d8; color: #7a5510;
  border: 1px solid #f0d9a6; font-size: 12px; font-weight: 700; letter-spacing: .03em; text-decoration: none;
  white-space: nowrap; vertical-align: middle;
}
.adminbar .brand + .alpha-badge { margin-right: auto; margin-left: -4px; }
.setting-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.setting-head h2 { margin: 0; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.access-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.access { width: 100%; max-width: 420px; text-align: center; }
.access form { text-align: left; }
.access h1 { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 8px 0 4px; }
.access-logo { width: 64px; height: 64px; }
.access .btn { width: 100%; }

/* ---- Street View link check ---- */
.sv-status { margin: -6px 0 14px; padding: 9px 12px; border-radius: 9px; font-size: 14px; background: var(--stone); }
.sv-status.good { background: #e9f5ee; }
.sv-status.warn { background: #fdf1d8; }
.sv-status.bad { background: #fbeceb; color: #7a211c; }
.sv-status .btn { margin-left: 4px; }
