/* EUDR Capture — brand: Fira Sans, #434343 / #4d4d4d / highlight #287691 */
@font-face { font-family: 'Fira Sans'; font-weight: 300; font-display: swap; src: local('Fira Sans Light'), url('fonts/fira-300.woff2') format('woff2'); }
@font-face { font-family: 'Fira Sans'; font-weight: 400; font-display: swap; src: local('Fira Sans'), url('fonts/fira-400.woff2') format('woff2'); }
@font-face { font-family: 'Fira Sans'; font-weight: 600; font-display: swap; src: local('Fira Sans SemiBold'), url('fonts/fira-600.woff2') format('woff2'); }

:root {
  --ink: #434343;
  --ink-2: #4d4d4d;
  --hl: #287691;
  --hl-dark: #1f5d73;
  --bg: #f4f5f4;
  --card: #ffffff;
  --line: #dfe2e1;
  --good: #2e9e5b;
  --fair: #d99a00;
  --poor: #d64545;
  --radius: 12px;
  --tap: 52px;
  font-size: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Fira Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-weight: 400; font-size: 1rem; line-height: 1.4;
  color: var(--ink); background: var(--bg);
  -webkit-text-size-adjust: 100%; overscroll-behavior-y: contain;
}
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }

.hidden { display: none !important; }

/* ---------- header + progress ---------- */
.app-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; background: var(--ink); color: #fff;
  padding-top: calc(10px + env(safe-area-inset-top));
}
.hdr-title { flex: 1; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 1.05rem; }
.hdr-step { background: var(--hl); color: #fff; border-radius: 20px; padding: 2px 10px; font-size: .8rem; font-weight: 600; }
.hdr-right { display: flex; align-items: center; gap: 6px; }
/* live signal-strength indicator (reads OS estimate — consumes no data) */
.net-badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 6px; border-radius: 14px; background: rgba(255,255,255,.12); }
.net-badge .sig-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.net-badge .bar { width: 3px; border-radius: 1px; background: rgba(255,255,255,.28); }
.net-badge .bar:nth-child(1) { height: 5px; }
.net-badge .bar:nth-child(2) { height: 9px; }
.net-badge .bar:nth-child(3) { height: 13px; }
.net-badge.lvl-1 .bar.on { background: #f0a020; }
.net-badge.lvl-2 .bar.on { background: #f7d04a; }
.net-badge.lvl-3 .bar.on { background: #58c46a; }
.net-badge .sig-label { font-size: .72rem; font-weight: 600; letter-spacing: .02em; min-width: 16px; text-align: center; }
.net-badge.is-off { background: rgba(214,69,69,.28); }
.net-badge.is-off .sig-label { color: #ffd2d2; }
.hdr-btn {
  min-width: 44px; height: 44px; border: 0; background: transparent; color: #fff;
  font-size: 1.5rem; border-radius: 8px; cursor: pointer;
}
.progress { height: 4px; background: var(--line); }
.progress-fill { height: 100%; width: 25%; background: var(--hl); transition: width .25s; }

/* ---------- screens ---------- */
#main { flex: 1; }
.screen { padding: 18px 16px 32px; }
.screen-center { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 80vh; gap: 6px; }
.screen-h { font-weight: 600; font-size: 1.25rem; margin: 4px 0 16px; }

.brand-mark { font-size: 3.4rem; }
.brand-title { font-weight: 600; font-size: 1.4rem; margin: 4px 0; color: var(--ink); }
.brand-sub { font-size: 1.1rem; color: var(--ink-2); margin: 6px 0 18px; }
.hint { color: var(--ink-2); font-size: .9rem; font-weight: 300; }

.lang-grid { display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 320px; margin: 8px 0 18px; }
.lang-btn {
  display: flex; align-items: center; gap: 14px; justify-content: flex-start;
  min-height: 64px; padding: 0 22px; font-size: 1.2rem; font-weight: 600;
  background: var(--card); color: var(--ink); border: 2px solid var(--line); border-radius: var(--radius); cursor: pointer;
}
.lang-btn:active { border-color: var(--hl); }
.lang-flag { font-size: 1.8rem; }

/* ---------- forms ---------- */
.field-label { display: block; font-weight: 600; font-size: .95rem; margin: 14px 0 6px; color: var(--ink); }
.text-input {
  width: 100%; min-height: var(--tap); padding: 12px 14px; font-size: 1.05rem;
  border: 2px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink);
}
.text-input:focus { outline: none; border-color: var(--hl); }

.id-photo-block { margin-top: 8px; }
.id-photo-preview {
  margin: 6px 0 10px; min-height: 160px; border: 2px dashed var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: #fff; color: var(--ink-2); overflow: hidden;
}
.id-photo-preview.empty { background: #fafbfb; }
.id-photo-preview img { width: 100%; height: 100%; max-height: 280px; object-fit: contain; }
.photo-icon { font-size: 2.4rem; }
.photo-hint { font-size: .9rem; font-weight: 300; }
.optional-fields { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 4px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 12px 18px; font-family: inherit; font-size: 1.05rem; font-weight: 600;
  border: 0; border-radius: var(--radius); cursor: pointer; color: #fff; background: var(--ink-2);
}
.btn-ic { font-size: 1.2rem; }
.btn-block { width: 100%; }
.btn-lg { min-height: 58px; font-size: 1.15rem; margin-top: 16px; }
.btn-xl { min-height: 72px; font-size: 1.3rem; }
.btn-primary { background: var(--hl); }
.btn-primary:active { background: var(--hl-dark); }
.btn-secondary { background: #fff; color: var(--ink); border: 2px solid var(--line); }
.btn-secondary:active { border-color: var(--hl); }
.btn-record { background: var(--hl); box-shadow: 0 4px 0 var(--hl-dark); }
.btn-record:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--hl-dark); }
.ctrl-row { display: flex; gap: 10px; margin-top: 10px; }
.ctrl-row .btn { flex: 1; }

/* ---------- capture ---------- */
.screen-capture { padding-bottom: 18px; }
.mode-toggle { display: flex; gap: 8px; margin-bottom: 12px; }
.mode-btn {
  flex: 1; min-height: 50px; display: flex; align-items: center; justify-content: center; gap: 6px;
  font-weight: 600; font-size: 1rem; background: #fff; color: var(--ink-2);
  border: 2px solid var(--line); border-radius: var(--radius); cursor: pointer;
}
.mode-btn.active { background: var(--hl); color: #fff; border-color: var(--hl); }

.stats-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 4px; text-align: center; }
.stat-label { display: block; font-size: .7rem; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .03em; }
.stat-val { display: block; font-size: .98rem; font-weight: 600; margin-top: 2px; }
.gps-pill { border-radius: 20px; padding: 2px 4px; color: #fff; font-size: .82rem; }
.gps-unknown { background: #9aa3a1; }
.gps-good { background: var(--good); }
.gps-fair { background: var(--fair); }
.gps-poor { background: var(--poor); }

.map-wrap { position: relative; width: 100%; height: 46vh; min-height: 240px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #0f1d22; isolation: isolate; }
.review-map { height: 40vh; }
.gmap { position: absolute; inset: 0; width: 100%; height: 100%; background: #0f1d22; }
.canvas-map { position: absolute; inset: 0; width: 100%; height: 100%; display: none; }
.map-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: rgba(255,255,255,.7); }
/* Leaflet satellite map */
.leaflet-container { background: #0f1d22; font: inherit; }
.leaflet-control-attribution { font-size: 9px; background: rgba(255,255,255,.7); }
.pt-marker { background: none; border: 0; }
.pt-dot { display: flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: #287691; color: #fff; font-size: 11px; font-weight: 600; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.5); }
.pt-dot.low { background: #d64545; }

.capture-controls { margin-top: 12px; }
.auto-row { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.switch-label { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .95rem; color: var(--ink); }
.switch-label input { width: 22px; height: 22px; accent-color: var(--hl); }

/* ---------- review ---------- */
.summary-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 14px; margin: 14px 0; }
.sum-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 1rem; }
.sum-row:last-child { border-bottom: 0; }
.sum-row span { color: var(--ink-2); }
.sum-photo img { max-width: 120px; max-height: 90px; border-radius: 8px; border: 1px solid var(--line); }
.warnings { margin: 8px 0; }
.warn-item { background: #fff7e6; border: 1px solid #f0d48a; color: #8a6400; border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; font-size: .92rem; }

/* ---------- confirm ---------- */
.confirm-icon { width: 96px; height: 96px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 3rem; color: #fff; background: var(--good); }
.confirm-icon.wait { background: var(--fair); }
.confirm-msg { color: var(--ink-2); max-width: 320px; }
.confirm-ref { font-weight: 600; font-size: 1.2rem; background: #eef4f6; color: var(--hl-dark); border-radius: 10px; padding: 10px 18px; margin: 8px 0; }

/* ---------- settings drawer ---------- */
.drawer { position: fixed; inset: 0; z-index: 50; background: var(--bg); max-width: 560px; margin: 0 auto; overflow-y: auto; }
.drawer-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--ink); color: #fff; padding-top: calc(12px + env(safe-area-inset-top)); }
.drawer-head h2 { margin: 0; font-size: 1.15rem; font-weight: 600; }
.drawer-body { padding: 16px 16px 40px; }
.set-switch { margin: 16px 0; }
.set-h { font-size: 1rem; font-weight: 600; margin: 10px 0; }
.sep { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.ver { text-align: center; color: var(--ink-2); font-size: .8rem; margin-top: 20px; }

.pending-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.pending-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: .92rem; }
.pill { font-size: .78rem; font-weight: 600; padding: 3px 8px; border-radius: 20px; white-space: nowrap; }
.pill.ok { background: #e3f5ea; color: var(--good); }
.pill.wait { background: #fff3da; color: #8a6400; }
.pill.bad { background: #fbe3e3; color: var(--poor); }
.mono { font-family: ui-monospace, monospace; font-size: .82rem; color: var(--hl-dark); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 100; max-width: 90%; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 24px;
  font-size: .95rem; font-weight: 600; box-shadow: 0 6px 18px rgba(0,0,0,.25); text-align: center;
}
.toast.ok { background: var(--good); }
.toast.warn { background: var(--poor); }
