/* Sign Check. One narrow column built for a thumb. */
:root {
  color-scheme: light;
  --bg: #edeee9;
  --surface: #f8f8f4;
  --ink: #1c211d;
  --muted: #5d665f;
  --line: #cfd3cb;
  --accent: #e8590c;
  --accent-ink: #ffffff;
  --ok: #1d7a43;
  --ok-bg: #dcefe2;
  --bad: #b42318;
  --bad-bg: #f8dcd8;
  --row: #1f5fa8;
  --row-bg: #dce8f6;
  --font-display: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #151a16;
    --surface: #1f2621;
    --ink: #eef1ec;
    --muted: #9aa59c;
    --line: #34403a;
    --accent: #ff8a3d;
    --accent-ink: #1a0e05;
    --ok: #5fd08a;
    --ok-bg: #17331f;
    --bad: #ff8a80;
    --bad-bg: #3a1a17;
    --row: #8cb8f0;
    --row-bg: #17283b;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
}
img { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--accent); }

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* header */
header.bar {
  position: sticky;
  top: 0;
  z-index: 9;
  background: var(--ink);
  color: var(--bg);
  padding-top: env(safe-area-inset-top, 0px);
}
header.bar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 10px; }
h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0;
  line-height: 1;
}
nav.tabs { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
nav.tabs a, .navbtn {
  font: 600 14px var(--font-body);
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 6px;
  border: 0;
  background: transparent;
  color: var(--bg);
  opacity: 0.75;
  text-decoration: none;
  cursor: pointer;
}
nav.tabs a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); opacity: 1; }
form.inline { margin: 0; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .tile:focus-within {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

main { padding-block: 16px 40px; display: grid; gap: 14px; }
main#logform { padding-bottom: 150px; }
main.narrow { padding-top: 24px; }

/* sections and form controls */
.field { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px; display: grid; gap: 10px; margin: 0; min-width: 0; }
.field > h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.field > h2 .done { font: 600 12px var(--font-body); letter-spacing: 0; text-transform: none; color: var(--ok); }
.field > h2 .opt { font: 400 12px var(--font-body); letter-spacing: 0; text-transform: none; color: var(--muted); }
.field label { font-weight: 600; font-size: 14px; }
.btn {
  font: 600 16px var(--font-body);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 18px;
  border-radius: 8px;
  border: 2px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.coords { font-family: var(--font-mono); font-size: 15px; word-break: break-word; }
.hint { color: var(--muted); font-size: 14px; margin: 0; }
.hint.warn { color: var(--bad); }
input[type="text"], input[type="password"], select, textarea {
  width: 100%;
  font: 16px var(--font-body);
  padding: 12px;
  min-height: 48px;
  border-radius: 8px;
  border: 1.5px solid var(--line);
  background: var(--bg);
  color: var(--ink);
}
textarea { resize: vertical; min-height: 72px; }
.addrow { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.addrow .btn { min-height: 48px; }

.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice button {
  font: 600 17px/1.2 var(--font-body);
  min-height: 64px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 2px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
}
.choice button small { display: block; font-weight: 400; font-size: 13px; color: var(--muted); margin-top: 2px; }
.choice button[aria-pressed="true"] { color: #fff; border-color: transparent; }
.choice button[aria-pressed="true"] small { color: rgba(255, 255, 255, 0.85); }
.choice button[data-v="yes"][aria-pressed="true"] { background: var(--ok); }
.choice button[data-v="no"][aria-pressed="true"] { background: var(--bad); }
.choice button[data-v="private"][aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.choice button[data-v="private"][aria-pressed="true"] small { color: var(--bg); opacity: 0.8; }
.choice button[data-v="row"][aria-pressed="true"] { background: var(--row); }
@media (prefers-color-scheme: dark) {
  .choice button[data-v="yes"][aria-pressed="true"],
  .choice button[data-v="no"][aria-pressed="true"],
  .choice button[data-v="row"][aria-pressed="true"] { color: #0e120f; }
  .choice button[aria-pressed="true"] small { color: rgba(14, 18, 15, 0.8); }
}

.photos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  position: relative;
  aspect-ratio: 3 / 4;
  max-width: 100%;
  border: 2px dashed var(--line);
  border-radius: 8px;
  background: var(--bg);
  display: grid;
  place-items: center;
  text-align: center;
  overflow: hidden;
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
}
.tile input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile .lbl { position: relative; padding: 8px; pointer-events: none; }
.tile .lbl b { display: block; font-family: var(--font-display); font-size: 22px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); }
.tile.has { border-style: solid; border-color: var(--ok); }
.tile .tag {
  position: absolute; left: 6px; bottom: 6px; pointer-events: none;
  background: var(--ink); color: var(--bg); font: 600 12px var(--font-body);
  padding: 3px 8px; border-radius: 4px;
}

/* save bar */
.savebar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 8;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-top: 10px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}
.savebar .wrap { display: grid; gap: 8px; }
.savebar .missing { margin: 0; font-size: 13px; color: var(--muted); min-height: 18px; }
.savebar .btn { width: 100%; }

/* records */
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip {
  font: 600 14px var(--font-body);
  display: inline-flex; align-items: center;
  min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  text-decoration: none; cursor: pointer;
}
.chip[aria-current="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chips .spacer { flex: 1; }
.filterrow { margin: 0; }
.tablewrap { overflow-x: auto; }
.sumtable { width: 100%; border-collapse: collapse; font-size: 14px; }
.sumtable th { text-align: left; font-weight: 600; color: var(--muted); padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.sumtable td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.sumtable td.bad { color: var(--bad); font-weight: 600; }
.list { display: grid; gap: 12px; padding: 0; margin: 0; list-style: none; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: grid; gap: 10px; min-width: 0; }
.thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.thumbs a { position: relative; display: block; aspect-ratio: 4 / 3; border-radius: 6px; overflow: hidden; background: var(--bg); max-width: 100%; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumbs span { position: absolute; left: 6px; bottom: 6px; background: var(--ink); color: var(--bg); font: 600 11px var(--font-body); padding: 2px 6px; border-radius: 4px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { font: 600 13px var(--font-body); padding: 4px 10px; border-radius: 4px; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.private { background: var(--ink); color: var(--bg); }
.badge.row { background: var(--row-bg); color: var(--row); }
.badge.cand { background: var(--bg); color: var(--ink); border: 1px solid var(--line); }
.meta { display: grid; gap: 2px; font-size: 14px; color: var(--muted); min-width: 0; overflow-wrap: anywhere; }
.meta .coords { color: var(--ink); font-size: 14px; }
.meta a { font-weight: 600; }
.foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0; }
.linkbtn { font: 600 13px var(--font-body); background: none; border: 0; color: var(--bad); padding: 10px 4px; min-height: 40px; cursor: pointer; text-decoration: underline; }
.pager { display: flex; gap: 8px; justify-content: center; }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: 8px; padding: 28px 16px; text-align: center; color: var(--muted); }
.empty b { display: block; font-family: var(--font-display); font-size: 22px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink); margin-bottom: 4px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(150px + env(safe-area-inset-bottom, 0px));
  max-width: min(520px, calc(100% - 32px));
  background: var(--ink); color: var(--bg);
  padding: 12px 16px; border-radius: 8px; font-weight: 600; z-index: 20;
}
.toast.err { background: var(--bad); color: #fff; }
@media (prefers-color-scheme: dark) { .toast.err { color: #0e120f; } }
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: pop 0.18s ease-out; }
  @keyframes pop { from { opacity: 0; transform: translate(-50%, 8px); } }
}

/* ---- additions: roles, edit page, users ---- */
.banner { margin: 0; padding: 10px 14px; border-radius: 8px; background: var(--ok-bg); color: var(--ok); font-weight: 600; font-size: 14px; }
.banner.bad { background: var(--bad-bg); color: var(--bad); }
.twobtn { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.savebar .twobtn .btn { width: 100%; }
.stack { display: grid; gap: 8px; margin: 0; }
.usertop { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.usertop b { font-size: 17px; }
.usertop .badge { margin-left: auto; }
.meta .edited { font-style: italic; }
.foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0; }
a.linkbtn { display: inline-flex; align-items: center; text-decoration: underline; }
.linkbtn.neutral { color: var(--accent); }
.field .newcand { margin-top: 0; }
@media (display-mode: standalone) {
  main#logform { padding-bottom: 160px; }
}

/* ---- sign type ---- */
.choice.type button { min-height: 52px; font-size: 16px; }
.choice.type button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: transparent; }
.badge.type { background: var(--bg); color: var(--ink); border: 1px solid var(--line); }

.filterrow { display: grid; gap: 8px; }

/* app update banner and footer */
.updatebar { position: fixed; left: 0; right: 0; top: env(safe-area-inset-top, 0px); z-index: 30; background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.updatebar[hidden] { display: none; }
.updatebar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-block: 8px; }
.updatebar button { font: 600 15px var(--font-body); min-height: 44px; padding: 0 16px; border-radius: 8px; border: 2px solid currentColor; background: transparent; color: inherit; cursor: pointer; }
.appfoot { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 16px 28px; }
.savebar ~ .appfoot { padding-bottom: 150px; }
.appfoot button { font: 600 14px var(--font-body); min-height: 44px; padding: 0 12px; background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; }
.appfoot .hint { margin: 0; font-size: 12px; }
