/* GW Trail Work Reports */
:root {
  --green: #2f5233;
  --green-dark: #1f3a23;
  --green-tint: #e8efe6;
  --ink: #1d2320;
  --muted: #5b655f;
  --line: #d4dbd3;
  --bg: #f5f6f2;
  --card: #fff;
  --warn: #9a5b00;
  --error: #b42318;
  --ok: #2f855a;
  --radius: 10px;
  --top: 52px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
h1 { font-size: 1.35rem; margin: 0 0 .75rem; }
h2 { font-size: 1.05rem; margin: 1.5rem 0 .5rem; }
a { color: var(--green); }
.muted { color: var(--muted); font-size: .875rem; }
.hint { color: var(--muted); font-size: .85rem; margin: .35rem 0 0; display: block; font-weight: 400; }
.error { color: var(--error); }
.notice { background: var(--green-tint); padding: .75rem 1rem; border-radius: var(--radius); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 1000; height: var(--top);
  padding: 0 12px; padding-top: env(safe-area-inset-top);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--green); color: #fff;
}
.brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 600; font-size: 1.05rem; min-width: 0; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand img { background: #fff; border-radius: 6px; padding: 2px; }
.outbox { border: 0; border-radius: 999px; background: #f4c95d; color: #3a2a00; font: inherit; font-size: .8rem; font-weight: 600; padding: 6px 10px; cursor: pointer; white-space: nowrap; }
.topbar .right { display: flex; align-items: center; gap: 8px; }
.topbar .right a, .topbar .right button { color: #fff; }

/* Map */
.map-view { position: relative; height: calc(100vh - var(--top)); height: calc(100dvh - var(--top)); }
#map { position: absolute; inset: 0; background: #dfe5dc; }
.map-offline { padding: 2rem; text-align: center; color: var(--muted); }
.filters { position: absolute; z-index: 500; top: 10px; left: 10px; right: 10px; display: flex; gap: 6px; flex-wrap: wrap; pointer-events: none; }
.chip { pointer-events: auto; border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .85rem; box-shadow: 0 1px 3px rgba(0,0,0,.15); cursor: pointer; }
.chip.on { background: var(--green); border-color: var(--green); color: #fff; }
.fab {
  position: absolute; z-index: 600; left: 50%; transform: translateX(-50%);
  bottom: calc(24px + env(safe-area-inset-bottom));
  background: var(--green); color: #fff; text-decoration: none; font-weight: 600; font-size: 1.05rem;
  padding: 14px 22px; border-radius: 999px; box-shadow: 0 3px 10px rgba(0,0,0,.3); white-space: nowrap;
}
.fab:active { background: var(--green-dark); }
.locate-btn { width: 34px; height: 34px; border: 2px solid rgba(0,0,0,.2); border-radius: 4px; background: #fff; font-size: 20px; line-height: 1; cursor: pointer; color: #1a73e8; background-clip: padding-box; }
.popup { display: grid; gap: 4px; font-size: .9rem; }
.popup img { width: 100%; max-height: 140px; object-fit: cover; border-radius: 6px; }
.badge { display: inline-block; justify-self: start; font-size: .75rem; font-weight: 600; color: #fff; background: var(--c, #666); padding: 2px 8px; border-radius: 999px; }

/* Pages */
.page { padding: 16px 12px 48px; }
.card { background: var(--card); border-radius: var(--radius); padding: 18px 16px; max-width: 640px; margin: 0 auto; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.card.narrow { max-width: 440px; margin-top: 32px; }
.page-plain { padding: 16px; }

/* Forms */
.form { display: grid; gap: 16px; }
.form label { display: grid; gap: 6px; font-weight: 600; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px 12px; margin: 0; min-width: 0; }
legend { font-weight: 600; padding: 0 4px; }
input, select, textarea { font: inherit; font-weight: 400; font-size: 16px; padding: 10px; border: 1px solid #b9c2b8; border-radius: 8px; background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green); outline-offset: 1px; }
.radio { display: flex !important; align-items: center; gap: 8px; font-weight: 400 !important; padding: 6px 0; }
.radio input { width: 20px; height: 20px; margin: 0; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 16px; border-radius: 8px; border: 1px solid var(--green);
  background: #fff; color: var(--green); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn.primary { background: var(--green); color: #fff; }
.btn.ghost { border-color: transparent; }
.btn.big { flex: 1; font-size: 1.05rem; }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: .85rem; }
.btn.danger { border-color: var(--error); color: var(--error); }
.btn:disabled { opacity: .55; cursor: default; }
.photo-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.photo-row:empty { display: none; }
.thumb { position: relative; width: 84px; height: 84px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.thumb button { position: absolute; top: -6px; right: -6px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: #000c; color: #fff; font-size: 16px; line-height: 1; cursor: pointer; }
.pick-map { height: 220px; border-radius: 8px; margin: 8px 0 0; background: #dfe5dc; }
.gps { margin: 0; font-size: .9rem; }
.gps.ok { color: var(--ok); }
.gps.warn { color: var(--warn); }

/* Issue page */
.back { display: inline-block; margin-bottom: 10px; text-decoration: none; }
.issue .badge { margin-bottom: 12px; }
.gallery { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.gallery img { height: 150px; border-radius: 8px; display: block; }
.desc { white-space: pre-wrap; font-size: 1.02rem; line-height: 1.45; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.history { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.history li { display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.outbox-list { list-style: none; padding: 0; display: grid; gap: 12px; }
.outbox-list li { border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: grid; gap: 6px; justify-items: start; }

/* Toast */
.toast { position: fixed; z-index: 2000; left: 50%; transform: translateX(-50%); bottom: calc(90px + env(safe-area-inset-bottom)); background: #222; color: #fff; padding: 10px 16px; border-radius: 8px; max-width: 90vw; font-size: .9rem; box-shadow: 0 3px 10px rgba(0,0,0,.3); }

/* Triage page */
.admin-wrap { max-width: 980px; margin: 0 auto; padding: 16px 12px 48px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs .chip { box-shadow: none; }
.queue { display: grid; gap: 14px; }
.qcard { background: #fff; border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,.08); padding: 14px; display: grid; gap: 10px; }
.qcard header { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.qcard h3 { margin: 0; font-size: 1.05rem; }
.qcard .gallery img { height: 110px; }
.qcard .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.qcard .actions select, .qcard .actions input { width: auto; padding: 6px 8px; }
.near { background: #fff4e0; border-radius: 8px; padding: 6px 10px; font-size: .9rem; }
.empty { text-align: center; color: var(--muted); padding: 2rem; }
details.panel { background: #fff; border-radius: var(--radius); padding: 10px 14px; margin-top: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
details.panel summary { cursor: pointer; font-weight: 600; }
details.panel .form { margin-top: 12px; max-width: 420px; }
