/* ===== RP Geolog — theme + primitives ===== */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --font-sans: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  /* light (default) */
  --bg: #eef2f7;
  --app-bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --surface-3: #e9eef4;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #64748b;
  --faint: #94a3b8;

  --accent: #2563eb;
  --accent-press: #1d4ed8;
  --accent-soft: #eff4ff;
  --accent-text: #1d4ed8;
  --on-accent: #ffffff;

  --green: #15803d;  --green-bg: #dcfce7; --green-bd: #bbf7d0;
  --amber: #b45309;  --amber-bg: #fef3c7; --amber-bd: #fde68a;
  --slatebadge: #475569; --slate-bg: #e2e8f0; --slate-bd: #cbd5e1;

  --shadow-card: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.04);
  --shadow-pop: 0 8px 28px rgba(15,23,42,.16), 0 2px 6px rgba(15,23,42,.08);
  --shadow-fab: 0 6px 16px rgba(37,99,235,.34);
  --shadow-device: 0 30px 70px -20px rgba(15,23,42,.45), 0 10px 30px -10px rgba(15,23,42,.25);

  --r-sm: 8px; --r: 12px; --r-lg: 16px;
  --tap: 48px;
}

[data-theme="dark"] {
  --bg: #05070d;
  --app-bg: #0b1120;
  --surface: #111a2e;
  --surface-2: #0f1729;
  --surface-3: #1a2540;
  --border: #1e2b45;
  --border-strong: #2c3c5e;
  --text: #e7ecf4;
  --text-2: #aab6cc;
  --muted: #8493ad;
  --faint: #5d6b85;

  --accent: #3b82f6;
  --accent-press: #2563eb;
  --accent-soft: #16223f;
  --accent-text: #93b4fb;
  --on-accent: #ffffff;

  --green: #4ade80;  --green-bg: #0e2a1b; --green-bd: #1c5236;
  --amber: #fbbf24;  --amber-bg: #2c2008; --amber-bd: #574213;
  --slatebadge: #cbd5e1; --slate-bg: #1c2640; --slate-bd: #2c3c5e;

  --shadow-card: 0 1px 2px rgba(0,0,0,.4);
  --shadow-pop: 0 12px 34px rgba(0,0,0,.6);
  --shadow-fab: 0 6px 18px rgba(59,130,246,.45);
  --shadow-device: 0 30px 80px -20px rgba(0,0,0,.8);
}

html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-sans);
  background:
    radial-gradient(1200px 600px at 80% -10%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 60%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ===== Stage / device shell ===== */
.stage {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
}
.device {
  width: 400px;
  max-width: 100%;
  height: min(860px, calc(100vh - 56px));
  background: var(--app-bg);
  border-radius: 30px;
  box-shadow: var(--shadow-device);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
}
@media (max-width: 460px) {
  .stage { padding: 0; }
  .device { width: 100%; height: 100vh; border-radius: 0; border: none; }
}

/* faux status bar */
.statusbar {
  height: 26px;
  flex: 0 0 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  font: 600 12px/1 var(--font-mono);
  color: var(--text-2);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.statusbar .dots { display: flex; gap: 4px; align-items: center; }
.statusbar .dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }

.screen { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.scroll { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.scroll::-webkit-scrollbar { width: 0; }

/* ===== Top app bar ===== */
.appbar {
  flex: 0 0 auto;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
}
.appbar .grow { flex: 1 1 auto; min-width: 0; }
.appbar h1 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.appbar .sub { font: 500 11px/1.2 var(--font-mono); color: var(--muted); margin-top: 2px; letter-spacing: .02em; }

.iconbtn {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent; color: var(--text-2);
  border-radius: var(--r-sm); cursor: pointer; flex: 0 0 auto;
  transition: background .14s, color .14s;
}
.iconbtn:hover { background: var(--surface-2); color: var(--text); }
.iconbtn:active { transform: scale(.94); }

.userchip { display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-text);
  display: grid; place-items: center;
  font: 600 12px/1 var(--font-mono);
  border: 1px solid var(--border);
}

/* ===== Cards / lists ===== */
.pad { padding: 16px; }
.list { display: flex; flex-direction: column; gap: 12px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-card);
  text-align: left;
  width: 100%;
  cursor: pointer;
  transition: border-color .14s, transform .1s, box-shadow .14s;
  color: inherit;
  font-family: inherit;
}
.card:hover { border-color: var(--border-strong); }
.card:active { transform: scale(.99); }
.card.tap { padding: 16px; display: block; }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 11px/1 var(--font-mono); letter-spacing: .02em;
  padding: 5px 9px; border-radius: 999px;
  border: 1px solid transparent; white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.green { color: var(--green); background: var(--green-bg); border-color: var(--green-bd); }
.badge.amber { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-bd); }
.badge.slate { color: var(--slatebadge); background: var(--slate-bg); border-color: var(--slate-bd); }

.metaline { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 10px; }
.meta { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.meta svg { color: var(--faint); }
.meta b { font-weight: 600; color: var(--text); font-family: var(--font-mono); }

.section-label {
  font: 600 11px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin: 4px 2px 12px;
  display: flex; align-items: center; justify-content: space-between;
}

/* type kind tag (BH/TP) */
.kindtag {
  width: 40px; height: 40px; flex: 0 0 auto;
  border-radius: 10px; display: grid; place-items: center;
  font: 700 13px/1 var(--font-mono);
  background: var(--accent-soft); color: var(--accent-text);
  border: 1px solid var(--border);
}
.kindtag.tp { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-bd); }

/* ===== FAB ===== */
.fab {
  position: absolute; right: 18px; bottom: 22px;
  width: 56px; height: 56px; border-radius: 18px;
  background: var(--accent); color: var(--on-accent);
  border: none; cursor: pointer;
  display: grid; place-items: center;
  box-shadow: var(--shadow-fab);
  transition: transform .12s, background .14s;
  z-index: 20;
}
.fab:hover { background: var(--accent-press); }
.fab:active { transform: scale(.92); }

/* ===== Buttons ===== */
.btn {
  height: var(--tap); padding: 0 18px; border-radius: var(--r-sm);
  font: 600 15px/1 var(--font-sans); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; transition: background .14s, border-color .14s, transform .1s;
  width: 100%;
}
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-press); }
.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--border-strong); }
.btn-sm { height: 40px; font-size: 14px; width: auto; padding: 0 14px; }

/* ===== Form fields ===== */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font: 600 12px/1.2 var(--font-sans); color: var(--text-2);
  display: flex; align-items: center; gap: 7px;
}
.field label .ags {
  font: 600 10px/1 var(--font-mono); letter-spacing: .04em;
  color: var(--muted); background: var(--surface-2);
  padding: 3px 6px; border-radius: 5px; border: 1px solid var(--border);
}
.input, .select {
  height: var(--tap); width: 100%;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text);
  padding: 0 14px; font: 500 15px/1 var(--font-sans);
  transition: border-color .14s, box-shadow .14s;
  appearance: none; -webkit-appearance: none;
}
.input.mono { font-family: var(--font-mono); }
.input:focus, .select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.input::placeholder { color: var(--faint); }
.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 38px; cursor: pointer;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.formstack { display: flex; flex-direction: column; gap: 16px; }

/* disabled (admin-locked) fields */
.input:disabled, .select:disabled {
  background: var(--surface-2, #f1f4f8);
  color: var(--muted, #64748b);
  border-color: var(--border);
  cursor: not-allowed;
  -webkit-text-fill-color: var(--muted, #64748b);
  opacity: 1;
}

/* lock bar above the admin-set fields */
.lockbar {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2, #f1f4f8);
}
.lockbar.on { border-color: color-mix(in srgb, var(--accent) 32%, var(--border)); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.lockbar-ic { display: inline-flex; flex: none; color: var(--accent); }
.lockbar:not(.on) .lockbar-ic { color: var(--ok, #2f7d4f); }
.lockbar-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.lockbar-txt b { font-size: 13px; font-weight: 600; color: var(--text); }
.lockbar-txt span { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.lockbtn {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 13px;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.lockbtn:active { transform: scale(.97); }

/* ===== Tabs ===== */
.tabs {
  flex: 0 0 auto; display: flex; background: var(--surface);
  border-bottom: 1px solid var(--border); overflow-x: auto;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1 1 auto; min-width: 0; padding: 12px 6px 10px;
  border: none; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  color: var(--muted); position: relative;
  font: 600 10px/1 var(--font-mono); letter-spacing: .05em;
}
.tab span.lbl { font: 600 12.5px/1.15 var(--font-sans); letter-spacing: -.01em; text-align: center; }
.tab span.ags { font: 600 9px/1 var(--font-mono); opacity: .85; }
.tab.active { color: var(--accent-text); }
.tab.active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 2.5px;
  background: var(--accent); border-radius: 2px 2px 0 0;
}

/* ===== editable data rows (strata/samples/spt) ===== */
.datarow {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 12px; position: relative;
  box-shadow: var(--shadow-card);
}
.datarow .rowhead {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.datarow .rownum { font: 600 11px/1 var(--font-mono); color: var(--muted); letter-spacing: .04em; }
.delbtn {
  width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--muted); cursor: pointer;
  display: grid; place-items: center; transition: color .14s, border-color .14s, background .14s;
}
.delbtn:hover { color: #dc2626; border-color: color-mix(in srgb, #dc2626 40%, var(--border)); background: color-mix(in srgb, #dc2626 8%, var(--surface)); }
.field.sm label { font-size: 11px; }
.field.sm .input, .field.sm .select { height: 42px; font-size: 14px; }

.addbtn {
  width: 100%; height: 46px; border-radius: var(--r-sm);
  border: 1.5px dashed var(--border-strong); background: transparent;
  color: var(--accent-text); cursor: pointer; font: 600 14px/1 var(--font-sans);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: border-color .14s, background .14s;
}
.addbtn:hover { border-color: var(--accent); background: var(--accent-soft); }

/* empty state */
.empty {
  text-align: center; padding: 40px 24px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.empty .ico {
  width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center;
  background: var(--surface-2); color: var(--faint); border: 1px solid var(--border);
}
.empty h3 { margin: 0; font-size: 15px; color: var(--text); font-weight: 600; }
.empty p { margin: 0; font-size: 13px; max-width: 240px; line-height: 1.5; }

/* photos */
.photogrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.photo {
  aspect-ratio: 1; border-radius: var(--r); overflow: hidden;
  border: 1px solid var(--border); position: relative; cursor: pointer;
  background: var(--surface-2);
}
.photo .stripes {
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(45deg, var(--surface-3) 0 10px, var(--surface-2) 10px 20px);
}
.photo .cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 7px 9px;
  background: linear-gradient(transparent, rgba(0,0,0,.6));
  color: #fff; font: 500 10px/1.3 var(--font-mono);
}
.photo.filled .stripes { background: var(--accent-soft); }
.photo.filled .fillmark { position: absolute; inset: 0; display: grid; place-items: center; color: var(--accent); }

/* save bar */
.savebar {
  flex: 0 0 auto; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.savebar .saveinfo { flex: 1 1 auto; font: 500 12px/1.3 var(--font-mono); color: var(--muted); }

/* toast */
.toast {
  position: absolute; left: 50%; bottom: 92px; transform: translateX(-50%) translateY(12px);
  background: var(--text); color: var(--app-bg);
  padding: 12px 18px; border-radius: 999px; font: 600 13px/1 var(--font-sans);
  display: flex; align-items: center; gap: 9px; white-space: nowrap;
  box-shadow: var(--shadow-pop); opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s; z-index: 60;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast .tk { color: #4ade80; display: inline-flex; }

/* login */
.login-wrap { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; padding: 28px 24px; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 16px; margin-bottom: 32px; }
.logo {
  width: 64px; height: 64px; border-radius: 18px; overflow: hidden;
  border: 1px solid var(--border); box-shadow: var(--shadow-card);
  display: grid; grid-template-rows: repeat(4, 1fr);
}
.logo i { display: block; }
.logo i:nth-child(1){ background: #93b4fb; }
.logo i:nth-child(2){ background: #5b8def; }
.logo i:nth-child(3){ background: #2563eb; }
.logo i:nth-child(4){ background: #1e3a8a; }
.brand h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.brand h1 .rp { color: var(--accent-text); }
.brand p { margin: 0; font: 500 12px/1 var(--font-mono); color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.login-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; gap: 16px;
}
.linkrow { display: flex; justify-content: flex-end; }
.link { color: var(--accent-text); font: 500 13px/1 var(--font-sans); text-decoration: none; cursor: pointer; }
.foot { text-align: center; margin-top: 22px; font: 500 11px/1.4 var(--font-mono); color: var(--faint); }

/* misc fade */
.fade-in { animation: fadeUp .28s ease both; }
@keyframes fadeUp { from { transform: translateY(7px); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .fade-in { animation: none; } }
.title-lg { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.title-sub { font-size: 13px; color: var(--muted); margin: 4px 0 0; }

/* ===== Reaalprojekt logo ===== */
.rplogo { display: inline-flex; align-items: center; flex: 0 0 auto; }
.rplogo img { width: auto; display: block; }
[data-theme="dark"] .rplogo img { filter: brightness(0) invert(1); }

/* ===== material swatch + picker ===== */
.matswatch {
  flex: 0 0 auto; display: inline-block;
  box-shadow: inset 0 0 0 1px rgba(15,23,42,.18);
}
[data-theme="dark"] .matswatch { box-shadow: inset 0 0 0 1px rgba(255,255,255,.22); }

.matfield {
  width: 100%; min-height: var(--tap);
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border: 1px solid var(--border-strong);
  border-radius: var(--r-sm); background: var(--surface); cursor: pointer;
  text-align: left; transition: border-color .14s;
}
.matfield:hover { border-color: var(--accent); }
.matfield-txt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.matfield-code { font: 600 14px/1.2 var(--font-mono); color: var(--text); }
.matfield-desc { font-size: 11.5px; color: var(--muted); line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.matfield-ph { color: var(--faint); font-size: 14px; }
.matfield-chev { color: var(--faint); flex: 0 0 auto; }

.sheet-scrim {
  position: absolute; inset: 0; z-index: 80;
  background: rgba(15,23,42,.42); display: flex; flex-direction: column; justify-content: flex-end;
}
[data-theme="dark"] .sheet-scrim { background: rgba(0,0,0,.6); }
.sheet {
  background: var(--surface); border-radius: 20px 20px 0 0;
  box-shadow: var(--shadow-pop); max-height: 86%; display: flex; flex-direction: column;
  border-top: 1px solid var(--border);
}
.sheet-grab { width: 38px; height: 4px; border-radius: 2px; background: var(--border-strong); margin: 9px auto 2px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px 6px; }
.sheet-title { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.sheet-sub { font: 500 11px/1.2 var(--font-mono); color: var(--muted); margin-top: 2px; }
.sheet-head .iconbtn { transform: rotate(45deg); }
.sheet-search { padding: 4px 16px 10px; }
.sheet-list { overflow-y: auto; padding: 0 10px 16px; }
.sheet-group { margin-top: 6px; }
.sheet-grouphd {
  position: sticky; top: 0; z-index: 1; background: var(--surface);
  display: flex; align-items: baseline; gap: 8px; padding: 8px 8px 6px;
  font: 600 11px/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--text-2);
}
.sheet-groupen { font: 500 10px/1 var(--font-sans); letter-spacing: 0; text-transform: none; color: var(--faint); }
.matrow {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 10px 8px; border: none; background: transparent; cursor: pointer;
  border-radius: 10px; text-align: left; transition: background .12s;
}
.matrow:hover { background: var(--surface-2); }
.matrow.sel { background: var(--accent-soft); }
.matrow-txt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.matrow-code { font: 600 14px/1.2 var(--font-mono); color: var(--text); }
.matrow-desc { font-size: 12px; color: var(--muted); line-height: 1.35; }
.matrow-rgb { font-size: 10.5px; color: var(--faint); flex: 0 0 auto; }
.matrow-check { color: var(--accent); flex: 0 0 auto; }

/* field picker rows — bigger tap targets, glove friendly */
.matrow.fieldrow { padding: 13px 10px; gap: 14px; }
.fieldrow-en { font: 500 11px/1 var(--font-mono); color: var(--faint); letter-spacing: .01em; }
.sheet-note {
  display: flex; align-items: center; gap: 8px; margin: 10px 8px 4px; padding: 11px 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  font-size: 12px; color: var(--muted); line-height: 1.4;
}
.sheet-note svg { color: var(--faint); flex: 0 0 auto; }

/* coloured stratum row accent */
.datarow.mat { border-left: 4px solid var(--matcol, var(--border)); }

/* ============================================================= */
/* ===== Bottom navigation ===== */
.bottomnav {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 12px rgba(15,23,42,.05);
}
[data-theme="dark"] .bottomnav { box-shadow: 0 -2px 14px rgba(0,0,0,.4); }
.navtab {
  flex: 1 1 0; min-height: 52px; border: none; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--muted); border-radius: 12px; transition: background .14s;
  font: 600 11px/1 var(--font-sans);
}
.navtab:hover { background: var(--surface-2); }
.navtab.on { color: var(--accent-text); }
.navtab.on svg { transform: translateY(-1px); }
.fab.raised { bottom: 86px; }

/* ===== generic content block ===== */
.card-block {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-card); padding: 16px; margin-top: 14px;
}
.block-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.block-title { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.block-sub { font: 500 11px/1.3 var(--font-mono); color: var(--muted); margin-top: 3px; }

/* ===== project filter chips ===== */
.chiprow { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 2px; margin: 0 -2px; scrollbar-width: none; }
.chiprow::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
  font: 600 12.5px/1 var(--font-sans); cursor: pointer; transition: all .14s;
}
.chip.mono { font-family: var(--font-mono); font-size: 11.5px; }
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* ===== LAYOUT A: funnel pipeline ===== */
.funnel { display: flex; align-items: flex-end; gap: 6px; height: 120px; }
.funnel-col { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.funnel-bar-wrap { flex: 1 1 auto; display: flex; align-items: flex-end; width: 100%; justify-content: center; }
.funnel-bar {
  width: 100%; border-radius: 7px 7px 4px 4px; position: relative;
  display: flex; align-items: flex-start; justify-content: center; min-height: 12px;
}
.funnel-count { color: #fff; font: 700 12px/1 var(--font-mono); padding-top: 6px; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.funnel-lbl { font: 600 9.5px/1.1 var(--font-mono); color: var(--muted); text-align: center; letter-spacing: -.02em; }

/* ===== LAYOUT A: stage board ===== */
.board { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.board-col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 12px; box-shadow: var(--shadow-card); }
.board-colhead { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.board-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.board-name { font-size: 13.5px; font-weight: 600; flex: 1 1 auto; }
.board-count { font: 700 12px/1 var(--font-mono); color: var(--muted); background: var(--surface-2); padding: 4px 8px; border-radius: 999px; }
.board-empty { color: var(--faint); font-size: 13px; padding: 2px 0 4px; }
.board-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bhchip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px 5px 5px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2);
  cursor: pointer; font-size: 12px; color: var(--text); transition: border-color .14s, transform .1s;
}
.bhchip:hover { border-color: var(--c); }
.bhchip:active { transform: scale(.96); }
.bhchip-kind {
  width: 22px; height: 22px; border-radius: 5px; display: grid; place-items: center;
  font: 700 9px/1 var(--font-mono); color: #fff; background: var(--c);
}
.bhchip-kind.tp { opacity: .82; }

/* ===== LAYOUT B: dashboard ===== */
.dash-hero { display: flex; align-items: center; gap: 18px; padding: 4px 2px 6px; }
.ring { flex: 0 0 auto; }
.ring-num { font: 700 20px var(--font-mono); fill: var(--text); }
.dash-hero-txt { min-width: 0; }
.dash-hero-big { font-size: 34px; font-weight: 700; line-height: 1; letter-spacing: -.02em; }
.dash-hero-lbl { font-size: 13px; color: var(--text-2); margin-top: 4px; font-weight: 600; }
.dash-hero-note { font: 500 11px/1.3 var(--font-mono); color: var(--muted); margin-top: 8px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.tile { border: 1px solid var(--border); border-left: 3px solid var(--c); border-radius: var(--r); padding: 12px 14px; background: var(--surface-2); }
.tile-n { font-size: 24px; font-weight: 700; line-height: 1; color: var(--c); }
.tile-l { font-size: 13px; font-weight: 600; margin-top: 5px; }
.tile-s { font: 500 10px/1 var(--font-mono); color: var(--muted); margin-top: 2px; letter-spacing: .04em; text-transform: uppercase; }

/* ===== LAYOUT B: per-project bars ===== */
.pbars { display: flex; flex-direction: column; gap: 12px; }
.pbar { text-align: left; border: none; background: transparent; cursor: pointer; padding: 4px; border-radius: 10px; transition: background .12s; }
.pbar:hover { background: var(--surface-2); }
.pbar-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.pbar-name { font-size: 13.5px; font-weight: 600; }
.pbar-pct { font-size: 13px; font-weight: 700; color: var(--accent-text); }
.pbar-track { height: 12px; border-radius: 999px; overflow: hidden; display: flex; background: var(--surface-3); }
.pbar-seg { height: 100%; }
.pbar-seg:first-child { border-radius: 999px 0 0 999px; }
.pbar-seg:last-child { border-radius: 0 999px 999px 0; }
.pbar-foot { font-size: 10.5px; color: var(--muted); margin-top: 6px; }

/* ===== site plan map ===== */
.siteplan {
  position: relative; aspect-ratio: 4/3; border-radius: var(--r); overflow: hidden;
  border: 1px solid var(--border); background: var(--surface-2);
}
.siteplan-stripes { position: absolute; inset: 0; background-image: repeating-linear-gradient(45deg, var(--surface-3) 0 12px, var(--surface-2) 12px 24px); opacity: .6; }
.siteplan-grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 28px 28px; opacity: .5;
}
.siteplan-tag { position: absolute; left: 10px; bottom: 9px; font-size: 9.5px; color: var(--faint); letter-spacing: .08em; }
.pin { position: absolute; width: 12px; height: 12px; border-radius: 50%; transform: translate(-50%, -50%); box-shadow: 0 1px 3px rgba(0,0,0,.4); border: 1.5px solid #fff; }
[data-theme="dark"] .pin { border-color: rgba(255,255,255,.55); }
.pin-ring { position: absolute; inset: -5px; border-radius: 50%; border: 1.5px solid; opacity: .35; }
.maplegend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 12px; }
.legend { display: inline-flex; align-items: center; gap: 5px; font: 500 10.5px/1 var(--font-mono); color: var(--muted); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }

/* ===== process map ===== */
.proc-intro {
  display: flex; align-items: flex-start; gap: 9px; margin-top: 4px; padding: 12px 14px;
  background: var(--accent-soft); border: 1px solid var(--border); border-radius: var(--r);
  font-size: 12.5px; line-height: 1.45; color: var(--text-2);
}
.proc-intro svg { color: var(--accent); flex: 0 0 auto; margin-top: 1px; }
.proc-flow { margin-top: 16px; position: relative; }
.pnode { display: flex; gap: 14px; position: relative; }
.pnode-rail { flex: 0 0 32px; display: flex; flex-direction: column; align-items: center; position: relative; }
.pnode-rail::before {
  content: ""; position: absolute; top: 0; bottom: -2px; left: 50%; width: 2px;
  background: var(--border-strong); transform: translateX(-50%);
}
.pnode:first-child .pnode-rail::before { top: 16px; }
.pnode-dot {
  width: 32px; height: 32px; border-radius: 50%; background: var(--surface);
  border: 2px solid var(--border-strong); color: var(--text-2);
  display: grid; place-items: center; z-index: 1; margin-top: 2px; flex: 0 0 auto;
}
.pnode.hl .pnode-dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.pnode.sel .pnode-dot { border-color: var(--accent); color: var(--accent-text); }
.pnode.side .pnode-dot { background: var(--surface-2); border-style: dashed; }
.pnode-card {
  flex: 1 1 auto; min-width: 0; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow-card); padding: 13px 14px; margin-bottom: 12px;
  transition: border-color .14s; color: inherit; font-family: inherit;
}
.pnode-card:hover { border-color: var(--border-strong); }
.pnode.sel .pnode-card { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.pnode.hl .pnode-card { background: var(--accent-soft); }
.pnode-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pnode-titles { min-width: 0; }
.pnode-name { font-size: 15px; font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: 7px; }
.pnode-en { font: 500 10.5px/1.2 var(--font-mono); color: var(--muted); margin-top: 2px; }
.agschip, .pnode .agschip { font: 700 8.5px/1 var(--font-mono); letter-spacing: .06em; color: var(--accent-text); background: var(--surface); border: 1px solid var(--accent); padding: 2px 5px; border-radius: 4px; }
.pnode-count { flex: 0 0 auto; font-size: 11px; color: var(--muted); white-space: nowrap; }
.pnode-count b { font-size: 15px; color: var(--text); margin-right: 2px; }
.pnode-branches { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.branchpill { font: 600 10.5px/1 var(--font-mono); padding: 5px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.branchpill.ghost { background: transparent; }
.branchpill.in { background: var(--amber-bg); border-color: var(--amber-bd); color: var(--amber); }
.pnode-inputs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 10px; color: var(--faint); }
.pnode-note { font-size: 12px; line-height: 1.45; color: var(--text-2); margin: 10px 0 0; }
.pnode-note.clamp { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pnode-detail { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.pnode-byproj { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
.byproj { display: flex; align-items: center; gap: 9px; }
.byproj-code { font-size: 10.5px; color: var(--muted); width: 86px; flex: 0 0 auto; }
.byproj-track { flex: 1 1 auto; height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.byproj-fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.byproj-n { font-size: 11px; font-weight: 600; width: 24px; text-align: right; flex: 0 0 auto; }
.proc-end { display: flex; align-items: center; gap: 14px; padding-left: 0; margin-top: 2px; }
.pnode-dot.done { width: 32px; height: 32px; border-radius: 50%; background: var(--green); border: none; color: #fff; display: grid; place-items: center; flex: 0 0 auto; margin-left: 0; }
.proc-end > div { padding: 4px 0; }

/* ===== v2: persistence + maps + camera additions ===== */

/* boot splash while IndexedDB hydrates */
.boot {
  height: 100%; min-height: 320px;
  display: flex; flex-direction: column; gap: 16px;
  align-items: center; justify-content: center;
  color: var(--muted); font-size: 12px; letter-spacing: .04em;
}

/* real map (Leaflet) */
.bhmap {
  width: 100%; position: relative; z-index: 0;
  border-radius: var(--r); overflow: hidden;
  border: 1px solid var(--border); background: var(--surface-2);
}
.bhmap-off { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 11px; }
.bhmap .leaflet-control-attribution { font-size: 9px; }
.bhmap-pop { font-family: var(--font-sans); font-size: 12px; line-height: 1.55; }
[data-theme="dark"] .bhmap .leaflet-tile { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.86) saturate(.7); }
[data-theme="dark"] .bhmap .leaflet-control-zoom a { background: var(--surface); color: var(--text); border-color: var(--border); }
[data-theme="dark"] .bhmap .leaflet-control-attribution { background: rgba(17,26,46,.7); color: var(--muted); }

/* GPS capture row (LOCA tab) */
.gpsrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gpsbtn { width: auto; height: 46px; padding: 0 16px; display: inline-flex; align-items: center; gap: 9px; }
.gpsmsg { font-size: 11px; color: var(--muted); }

/* export popover (borehole list appbar) */
.expwrap { position: relative; }
.expmenu {
  position: absolute; right: 0; top: 46px; z-index: 80;
  min-width: 196px; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow-pop); overflow: hidden;
}
.expitem {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 15px; border: none; background: none; cursor: pointer;
  color: var(--text); font: 600 13.5px var(--font-sans); text-align: left;
}
.expitem:hover { background: var(--surface-2); }

/* real photos in the photo grid */
.photo { overflow: hidden; }
.photo.real img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-del {
  position: absolute; top: 6px; right: 6px; z-index: 3;
  width: 27px; height: 27px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(15,23,42,.58); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.photo.real .cap { background: linear-gradient(transparent, rgba(15,23,42,.72)); color: #fff; }

/* ===== v5: GPS fix quality ===== */
.gpswrap { display: flex; flex-direction: column; gap: 8px; }
.gpsmsg { display: inline-flex; align-items: center; gap: 7px; }
.gpsmsg .gpsdot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.gpsmsg.good { color: #15803d; }
.gpsmsg.ok { color: #b45309; }
.gpsmsg.bad { color: #dc2626; }
.gpshint {
  font-size: 12px; line-height: 1.5; border-radius: 9px; padding: 9px 12px;
}
.gpshint.good { background: color-mix(in srgb, #15803d 9%, var(--surface)); color: #15803d; border: 1px solid color-mix(in srgb, #15803d 25%, var(--border)); }
.gpshint.ok { background: color-mix(in srgb, #d97706 9%, var(--surface)); color: #b45309; border: 1px solid color-mix(in srgb, #d97706 25%, var(--border)); }
.gpshint.bad { background: color-mix(in srgb, #dc2626 8%, var(--surface)); color: #dc2626; border: 1px solid color-mix(in srgb, #dc2626 25%, var(--border)); }
[data-theme="dark"] .gpsmsg.good { color: #4ade80; }
[data-theme="dark"] .gpsmsg.ok { color: #fbbf24; }
[data-theme="dark"] .gpsmsg.bad { color: #f87171; }
[data-theme="dark"] .gpshint.good { color: #4ade80; }
[data-theme="dark"] .gpshint.ok { color: #fbbf24; }
[data-theme="dark"] .gpshint.bad { color: #f87171; }

/* v11: position-from-plan hint */
.posplan {
  display: flex; align-items: center; gap: 8px;
  margin-top: -4px; padding: 8px 11px; border-radius: 8px;
  font-size: 11.5px; color: var(--muted);
  background: var(--surface-2); border: 1px dashed var(--border-strong);
}

/* v14: demo account picker (login) */
.acct-cap { font: 600 10.5px/1.4 var(--font-mono); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 10px; }
.acct-list { display: flex; flex-direction: column; gap: 8px; }
.acct {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.acct:hover { border-color: var(--border-strong); }
.acct:disabled { opacity: .5; cursor: not-allowed; }
.acct-av {
  width: 36px; height: 36px; border-radius: 50%; color: #fff; flex: 0 0 auto;
  display: grid; place-items: center; font: 600 12px/1 var(--font-mono);
}
.acct-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.acct-body b { font-size: 14px; }
.acct-body span { font-size: 11.5px; color: var(--muted); }
.acct > svg { color: var(--faint, var(--muted)); flex: 0 0 auto; }

