/* app.css
   field-first interface: large targets, high contrast, one-handed operation */

:root {
  --ink: #1c211b;
  --paper: #f3f1e9;
  --field: #3b5236;
  --field-bright: #5a7d4f;
  --clay: #b5622f;
  --line: #c9c5b6;
  --muted: #6b6b60;
  --tap: 56px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font: 17px/1.45 system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--paper);
  padding-bottom: 76px;
}

.hidden { display: none !important; }
.sub { font-size: 13px; color: var(--muted); }
.err { color: var(--clay); }
.lede { font-size: 15px; color: var(--muted); margin: 4px 0 14px; }

header {
  background: var(--field); color: var(--paper);
  padding: 12px 16px; display: flex; align-items: center;
  justify-content: space-between; position: sticky; top: 0; z-index: 10;
}
header .brand { font-size: 18px; font-weight: 600; letter-spacing: .3px; }
header .sub { color: rgba(243,241,233,.75); }
header .who { font-size: 13px; opacity: .8; }

.crumb {
  padding: 10px 16px; font-size: 13px; text-transform: uppercase;
  letter-spacing: 1px; color: var(--field); background: #e9e6da;
  border-bottom: 1px solid var(--line);
}

main { padding: 16px; max-width: 680px; margin: 0 auto; }

/* buttons */
button, .btn {
  min-height: var(--tap); font-size: 17px; border: none; border-radius: 8px;
  padding: 0 18px; background: var(--field); color: var(--paper); cursor: pointer;
}
button.secondary { background: #d8d4c6; color: var(--ink); }
button.gps { background: var(--field-bright); }
button.wide { width: 100%; margin-top: 12px; }
button:active { filter: brightness(.92); }
button[disabled] { opacity: .5; }

/* fields */
.field { margin-bottom: 14px; }
label { display: block; margin-bottom: 5px; font-size: 14px; font-weight: 600; }
input, select, textarea {
  width: 100%; min-height: var(--tap); font-size: 17px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  color: var(--ink);
}
textarea { min-height: 84px; }

/* chips: enum and boolean controls */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  flex: 1 1 30%; min-height: var(--tap); padding: 0 10px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--line); border-radius: 8px; background: #fff;
  color: var(--ink); font-size: 15px; text-align: center;
}
.chip.on { background: var(--field); color: var(--paper); border-color: var(--field); }

/* stepper: integer control */
.stepper { display: flex; gap: 8px; align-items: stretch; }
.stepper input { text-align: center; flex: 1; }
.stepper .step {
  width: 64px; flex: 0 0 64px; font-size: 26px; background: #d8d4c6;
  color: var(--ink); border-radius: 8px;
}

/* cards and rows */
.card {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 14px; margin-bottom: 10px;
}
.card.tappable:active { background: #f7f5ee; }
.card-title { font-size: 17px; font-weight: 600; }
.card-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }

.feature-row {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px;
  margin-bottom: 8px; background: #fff; border: 1px solid var(--line);
  border-radius: 10px;
}
.feature-row:active { background: #f7f5ee; }
.feature-label {
  font-size: 21px; font-weight: 700; min-width: 52px; text-align: center;
  color: var(--field);
}
.feature-meta { flex: 1; min-width: 0; }
.feature-meta > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { color: var(--muted); font-size: 22px; }

.badge {
  font-size: 12px; padding: 4px 9px; border-radius: 20px;
  background: #e6e2d5; color: var(--ink);
}
.badge.alert { background: var(--clay); color: #fff; }

.zone-head {
  margin: 22px 0 8px; font-size: 13px; text-transform: uppercase;
  letter-spacing: 1px; color: var(--field);
  border-bottom: 2px solid var(--line); padding-bottom: 4px;
}

.hist {
  padding: 10px 0; border-bottom: 1px solid var(--line);
}

/* finder */
.finder { text-align: center; padding: 18px 0; }
.arrow {
  font-size: 116px; line-height: 1; display: inline-block;
  color: var(--field); transition: transform .2s ease;
}
.dist { font-size: 40px; font-weight: 700; margin: 6px 0; }
.bearing { font-size: 15px; color: var(--muted); margin-bottom: 8px; }

/* map */
#map { height: 66vh; border-radius: 10px; margin-top: 10px; }
#module-filter .chip { flex: 0 1 auto; min-height: 44px; font-size: 14px; }

/* nav */
nav.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex;
  background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
nav.tabs button {
  flex: 1; background: none; color: var(--muted); border-radius: 0;
  font-size: 11px; min-height: 62px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px; padding: 0 2px;
}
nav.tabs button .ic { font-size: 20px; }
nav.tabs button.active { color: var(--field); font-weight: 600; }

/* login */
.login-wrap { max-width: 360px; margin: 10vh auto; padding: 0 20px; }
.login-wrap h1 { color: var(--field); margin-bottom: 2px; }

.toast {
  position: fixed; bottom: 88px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 12px 20px;
  border-radius: 24px; font-size: 15px; z-index: 50; max-width: 80%;
}

/* export cards */
.export-controls {
  display: flex; gap: 8px; align-items: center; margin-top: 10px;
  flex-wrap: wrap;
}
.export-controls select { width: auto; flex: 0 0 auto; min-width: 96px; }
.export-controls button { flex: 1 1 auto; min-height: 48px; font-size: 15px; }

/* field help */
.field-head { display: flex; align-items: center; gap: 8px; }
.field-head label { margin-bottom: 0; flex: 1; }
.help-btn {
  min-height: 30px; width: 30px; flex: 0 0 30px; padding: 0;
  border-radius: 50%; background: #d8d4c6; color: var(--field);
  font-size: 15px; font-weight: 700; line-height: 1;
}
.help-body {
  background: #eeebe0; border-left: 3px solid var(--field-bright);
  padding: 10px 12px; margin-bottom: 8px; font-size: 14px;
  border-radius: 0 8px 8px 0;
}
.help-codes { margin: 8px 0 0; padding-left: 18px; font-size: 13px; }
.help-codes li { margin-bottom: 4px; }
.glossary-group { margin: 12px 0 6px; font-weight: 600; }

/* round coverage */
.feature-row.done { opacity: .62; }
.badge.ok { background: var(--field-bright); color: #fff; }

/* header menu */
.header-right { display: flex; align-items: center; gap: 10px; }
.menu-btn {
  min-height: 40px; width: 40px; padding: 0; font-size: 22px;
  background: rgba(255,255,255,.15); color: var(--paper); border-radius: 8px;
}
.menu {
  position: absolute; top: 56px; right: 12px; z-index: 40;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,.18); overflow: hidden; min-width: 190px;
}
.menu a { text-decoration: none; display: block; }
.menu button {
  display: block; width: 100%; text-align: left; background: none;
  color: var(--ink); border-radius: 0; min-height: 50px; font-size: 16px;
  border-bottom: 1px solid var(--line);
}
.menu button:active { background: #f2efe6; }
.menu > button:last-child { border-bottom: none; }

/* password reveal */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 52px; }
.pw-reveal {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  min-height: 44px; width: 44px; padding: 0; background: none;
  color: var(--muted); display: flex; align-items: center; justify-content: center;
}
.pw-reveal:active { background: none; color: var(--field); }

/* diagnostics */
.diag-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: 15px;
}
.diag-key { color: var(--muted); }
.diag-val { text-align: right; word-break: break-word; }
.diag-ok { color: var(--field-bright); font-weight: 600; }
.diag-no { color: var(--clay); font-weight: 600; }
.card.diag-warn { border-left: 4px solid var(--clay); }
.card.diag-good { border-left: 4px solid var(--field-bright); }

/* connection and queue state */
.conn-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 16px; font-size: 14px; line-height: 1.35;
}
.conn-bar.offline { background: #e6e2d5; color: var(--ink);
  border-bottom: 1px solid var(--line); }
.conn-bar.pending { background: var(--clay); color: #fff; }
.conn-bar button {
  min-height: 38px; padding: 0 14px; font-size: 14px;
  background: rgba(255,255,255,.22); color: inherit; margin-left: auto;
}
.conn-bar.offline button { background: #d8d4c6; color: var(--ink); }

/* diagnostics text panel */
.diag-text {
  background: #eeebe0; border: 1px solid var(--line); border-radius: 8px;
  padding: 12px; font-size: 12px; line-height: 1.4; overflow-x: auto;
  white-space: pre-wrap; word-break: break-word; user-select: all;
}
