/* DeCA ShelfSure – shared design system (field app + HQ dashboard).
   Every color is a token so light and dark themes stay in step. */
@font-face {
  font-family: "Inter";
  src: url("fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}
:root {
  --brand-50: #effcf9; --brand-100: #d2f5ee; --brand-500: #14b8a6; --brand-600: #0d9488; --brand-700: #0f766e; --brand-800: #115e59;
  --brand-ink: #0f766e;            /* brand color used for text and icons */
  --on-brand: #ffffff;
  --accent: #f59e0b; --accent-soft: #fff6e0; --accent-ink: #92580a;
  --bg: #f5f7f8; --surface: #ffffff; --surface-2: #f7f9fa; --surface-3: #eef2f4;
  --line: #e4e9ec; --line-strong: #cdd5db;
  --text: #0f1b24; --muted: #5d6b78; --faint: #93a0ac;
  --green: #15803d; --green-bg: #e7f7ee; --amber: #b45309; --amber-bg: #fff4dd; --red: #c62828; --red-bg: #fdecec;
  --blue: #2563eb; --blue-bg: #eaf1ff;
  --appbar-bg: rgba(255,255,255,0.86);
  --radius: 16px; --radius-sm: 11px;
  --shadow-sm: 0 1px 2px rgba(15,27,36,0.05);
  --shadow: 0 1px 2px rgba(15,27,36,0.04), 0 6px 18px rgba(15,27,36,0.06);
  --shadow-lg: 0 18px 50px rgba(15,27,36,0.18);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand-50: #0f2a27; --brand-100: #134540; --brand-ink: #3ddcc6; --on-brand: #04201d;
    --brand-600: #2dd4bf; --brand-700: #14b8a6; --brand-800: #0d9488;
    --accent-soft: #3a2a0a; --accent-ink: #fbbf24;
    --bg: #0a1013; --surface: #121a1f; --surface-2: #172128; --surface-3: #1d2932;
    --line: #23313b; --line-strong: #33444f;
    --text: #e7eef2; --muted: #9aabb7; --faint: #6c7d89;
    --green: #4ade80; --green-bg: #12301f; --amber: #fbbf24; --amber-bg: #34270c; --red: #f87171; --red-bg: #3a1717;
    --blue: #7aa7ff; --blue-bg: #162746;
    --appbar-bg: rgba(18,26,31,0.86);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3); --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 6px 18px rgba(0,0,0,0.25); --shadow-lg: 0 18px 50px rgba(0,0,0,0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand-50: #0f2a27; --brand-100: #134540; --brand-ink: #3ddcc6; --on-brand: #04201d;
  --brand-600: #2dd4bf; --brand-700: #14b8a6; --brand-800: #0d9488;
  --accent-soft: #3a2a0a; --accent-ink: #fbbf24;
  --bg: #0a1013; --surface: #121a1f; --surface-2: #172128; --surface-3: #1d2932;
  --line: #23313b; --line-strong: #33444f;
  --text: #e7eef2; --muted: #9aabb7; --faint: #6c7d89;
  --green: #4ade80; --green-bg: #12301f; --amber: #fbbf24; --amber-bg: #34270c; --red: #f87171; --red-bg: #3a1717;
  --blue: #7aa7ff; --blue-bg: #162746;
  --appbar-bg: rgba(18,26,31,0.86);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3); --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 6px 18px rgba(0,0,0,0.25); --shadow-lg: 0 18px 50px rgba(0,0,0,0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-feature-settings: "cv11", "ss01"; background: var(--bg); color: var(--text); line-height: 1.45; -webkit-font-smoothing: antialiased; min-height: 100vh; }
button, input, select, textarea { font-family: inherit; color: inherit; }
.ic { width: 18px; height: 18px; flex-shrink: 0; vertical-align: -3px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand-600) 45%, transparent); outline-offset: 2px; }

.app-container { max-width: 720px; margin: 0 auto; padding: 16px 16px 120px; display: flex; flex-direction: column; gap: 14px; }
.wide .app-container { max-width: 1160px; padding-bottom: 48px; }

/* ---------- App bar (field app) ---------- */
.appbar { position: sticky; top: 0; z-index: 30; background: var(--appbar-bg); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); border-bottom: 1px solid var(--line); padding: calc(10px + env(safe-area-inset-top)) 16px 10px; }
.appbar-inner { max-width: 720px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.appbar img { width: 42px; height: auto; flex-shrink: 0; }
.appbar .titles { flex: 1; min-width: 0; }
.wordmark { font-size: 1.12rem; font-weight: 750; letter-spacing: -0.02em; line-height: 1.15; display: flex; align-items: center; gap: 6px; }
.wordmark .deca { color: var(--muted); font-weight: 600; }
.wordmark .sure { color: var(--brand-ink); }
.appbar .sub { font-size: 0.78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand-500), var(--brand-700)); color: #fff; font-weight: 700; font-size: 0.85rem; border: none; cursor: pointer; flex-shrink: 0; letter-spacing: 0.02em; }
.avatar.lg { width: 64px; height: 64px; font-size: 1.3rem; }
.pill-tag { font-size: 0.6rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; background: var(--accent-soft); color: var(--accent-ink); padding: 2px 7px; border-radius: 999px; }

/* ---------- Bottom tab bar ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--appbar-bg); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
.tabbar-inner { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); }
.tabbar button { display: flex; flex-direction: column; align-items: center; gap: 3px; background: none; border: none; padding: 6px 4px; font-size: 0.7rem; font-weight: 600; color: var(--faint); cursor: pointer; position: relative; }
.tabbar button .ic { width: 22px; height: 22px; }
.tabbar button.active { color: var(--brand-ink); }
.tabbar button.active::before { content: ""; position: absolute; top: -7px; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand-600); }
.tabbar .badge-dot { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: 0.64rem; font-weight: 700; display: grid; place-items: center; }

/* ---------- Header (HQ dashboard) ---------- */
.topbar { background: var(--surface); color: var(--text); padding: 14px 16px 12px; border-bottom: 1px solid var(--line); position: relative; }
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: linear-gradient(90deg, var(--brand-500), var(--brand-700) 60%, var(--accent)); }
.topbar-inner { max-width: 720px; margin: 0 auto; }
.wide .topbar-inner { max-width: 1160px; }
.topbar .brand { display: flex; align-items: center; gap: 14px; }
.topbar .brand img { width: 50px; height: auto; flex-shrink: 0; }
.topbar .brand .grow { flex: 1; min-width: 0; }
.topbar .zone { display: flex; align-items: center; gap: 8px; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.topbar .zone .pilot { color: var(--accent-ink); background: var(--accent-soft); padding: 2px 7px; border-radius: 999px; letter-spacing: 0.08em; font-size: 0.6rem; }
.topbar h1 { font-size: 1.4rem; font-weight: 750; letter-spacing: -0.02em; line-height: 1.15; margin: 2px 0 1px; }
.topbar h1 .sure { color: var(--brand-ink); }
.topbar .sub { font-size: 0.8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); color: var(--text); border: 1px solid var(--line-strong); border-radius: 10px; padding: 9px 12px; font-weight: 600; font-size: 0.82rem; cursor: pointer; white-space: nowrap; transition: background .15s; }
.icon-btn:hover { background: var(--surface-3); }
.tabs { display: flex; gap: 4px; margin-top: 12px; overflow-x: auto; background: var(--surface-3); padding: 4px; border-radius: 12px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: none; color: var(--muted); border: none; border-radius: 9px; padding: 9px 12px; font-weight: 600; font-size: 0.85rem; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; }
.tab .ic { width: 16px; height: 16px; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface); color: var(--brand-ink); box-shadow: var(--shadow-sm); }

/* ---------- Surfaces ---------- */
.card, .grid-2 > * { min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.section-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.section-title { display: inline-flex; align-items: center; gap: 9px; font-size: 1rem; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.section-title .ic { color: var(--brand-ink); width: 19px; height: 19px; }
.section-header .count { font-size: 0.75rem; color: var(--muted); font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.page-title { font-size: 1.6rem; font-weight: 780; letter-spacing: -0.03em; margin: 4px 2px 0; }
.page-sub { font-size: 0.88rem; color: var(--muted); margin: -8px 2px 0; }
.group-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 6px 4px -4px; }

/* ---------- Forms ---------- */
.input-field label, .lbl { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; display: block; }
input[type="text"], input[type="date"], input[type="number"], input[type="url"], input[type="password"], select, textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font-size: 0.95rem; background: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-600); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-600) 18%, transparent); }
input:disabled { background: var(--surface-2); color: var(--faint); }
textarea { min-height: 72px; resize: vertical; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid-1 { display: grid; gap: 14px; }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: 0.9rem; cursor: pointer; line-height: 1.4; }
.check input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--brand-600); flex-shrink: 0; }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--surface-3); padding: 4px; border-radius: 12px; }
.segmented button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: none; background: none; padding: 9px 8px; border-radius: 9px; font-weight: 600; font-size: 0.85rem; color: var(--muted); cursor: pointer; }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Buttons ---------- */
.btn { white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center; text-decoration: none; padding: 12px 16px; border-radius: var(--radius-sm); font-size: 0.93rem; font-weight: 650; border: 1px solid transparent; cursor: pointer; transition: background .15s, box-shadow .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn.block { display: flex; width: 100%; }
.btn.sm { padding: 7px 11px; font-size: 0.8rem; border-radius: 9px; }
.btn.sm .ic { width: 15px; height: 15px; }
.btn.primary { background: var(--brand-600); color: var(--on-brand); box-shadow: 0 1px 2px rgba(13,148,136,0.25), 0 4px 12px rgba(13,148,136,0.18); }
.btn.primary:hover { background: var(--brand-700); }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.ghost { background: var(--brand-50); border: 1.5px dashed color-mix(in srgb, var(--brand-600) 45%, transparent); color: var(--brand-ink); }
.btn.light { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn.light:hover { background: var(--surface-2); }
.btn.danger { background: var(--red-bg); color: var(--red); }
.btn.green { background: var(--brand-600); color: var(--on-brand); box-shadow: 0 1px 2px rgba(13,148,136,0.3), 0 4px 12px rgba(13,148,136,0.2); }
.btn.green:hover { background: var(--brand-700); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; }
.actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.link { display: inline-flex; align-items: center; gap: 4px; background: none; border: none; color: var(--brand-ink); font-weight: 600; font-size: 0.85rem; cursor: pointer; padding: 0; text-decoration: none; }
.link:hover { text-decoration: underline; }
.link:disabled { color: var(--faint); cursor: default; text-decoration: none; }
.link.red { color: var(--red); }
.link .ic { width: 16px; height: 16px; }

/* ---------- Messages ---------- */
.hint { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
.notice { display: flex; align-items: flex-start; gap: 10px; font-size: 0.85rem; border-radius: 12px; padding: 11px 14px; border: 1px solid transparent; }
.notice .ic { margin-top: 1px; }
.notice.ok { background: var(--green-bg); color: var(--green); }
.notice.warn { background: var(--amber-bg); color: var(--amber); }
.notice.err { background: var(--red-bg); color: var(--red); }
.notice.info { background: var(--brand-50); color: var(--brand-ink); }
.empty { font-size: 0.88rem; color: var(--muted); text-align: center; padding: 22px 12px; background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: 12px; }

/* ---------- Chips & scores ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 0.7rem; font-weight: 650; padding: 3px 9px; border-radius: 999px; white-space: nowrap; letter-spacing: 0.01em; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.done { background: var(--green-bg); color: var(--green); }
.chip.open { background: var(--brand-50); color: var(--brand-ink); }
.chip.overdue { background: var(--red-bg); color: var(--red); }
.chip.hq { background: var(--accent-soft); color: var(--accent-ink); }
.chip.std { background: var(--surface-3); color: var(--muted); }
.chip.pending { background: var(--amber-bg); color: var(--amber); }
.score { font-weight: 700; font-variant-numeric: tabular-nums; }
.score.good { color: var(--green); }
.score.mid { color: var(--amber); }
.score.bad { color: var(--red); }

/* ---------- Field app: home ---------- */
.hero { position: relative; overflow: hidden; display: flex; align-items: center; gap: 18px; background: linear-gradient(135deg, #0d9488 0%, #115e59 100%); color: #fff; border: none; }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: rgba(255,255,255,0.08); }
.hero::before { content: ""; position: absolute; right: 40px; bottom: -90px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255,255,255,0.06); }
.ring { --p: 0; width: 78px; height: 78px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; background: conic-gradient(#fff calc(var(--p) * 1%), rgba(255,255,255,0.22) 0); position: relative; z-index: 1; }
.ring::after { content: attr(data-label); width: 62px; height: 62px; border-radius: 50%; background: #0f766e; display: grid; place-items: center; font-weight: 750; font-size: 1.05rem; color: #fff; font-variant-numeric: tabular-nums; }
.hero > div:last-child { position: relative; z-index: 1; }
.hero h2 { font-size: 1.15rem; font-weight: 720; letter-spacing: -0.01em; }
.hero p { font-size: 0.86rem; color: rgba(255,255,255,0.86); margin-top: 2px; }
.hero .score.bad { color: #ffd5d5; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; box-shadow: var(--shadow-sm); }
.stat .v { font-size: 1.35rem; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 0.72rem; color: var(--muted); font-weight: 600; }
.mission-card { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 10px; cursor: pointer; font: inherit; color: inherit; transition: border-color .15s, box-shadow .15s, transform .05s; }
.mission-card:last-child { margin-bottom: 0; }
.mission-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.mission-card:active { transform: scale(0.99); }
.mission-card .tile { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; background: var(--brand-50); color: var(--brand-ink); }
.mission-card .tile .ic { width: 22px; height: 22px; }
.mission-card.hq .tile { background: var(--accent-soft); color: var(--accent-ink); }
.mission-card.overdue .tile { background: var(--red-bg); color: var(--red); }
.mission-card.done .tile { background: var(--green-bg); color: var(--green); }
.mission-card .body { flex: 1; min-width: 0; }
.mission-card .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mission-card .title { font-weight: 650; font-size: 0.97rem; letter-spacing: -0.005em; }
.mission-card .meta { display: block; font-size: 0.8rem; color: var(--muted); margin-top: 3px; }
.mission-card .go { color: var(--faint); }
.mission-card.done .title { color: var(--muted); }
.hist-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 0.88rem; width: 100%; background: none; border-left: none; border-right: none; border-top: none; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.hist-row:first-child { padding-top: 0; }
.hist-row:last-child { border-bottom: none; padding-bottom: 0; }
.hist-row .t { font-weight: 600; }
.hist-row .lead { width: 38px; height: 38px; border-radius: 11px; background: var(--surface-3); color: var(--muted); display: grid; place-items: center; flex-shrink: 0; }
.hist-row .grow { flex: 1; min-width: 0; }
.install-card { display: flex; align-items: center; gap: 14px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.install-card img { width: 48px; height: 48px; border-radius: 12px; box-shadow: var(--shadow-sm); }
.install-card .grow { flex: 1; min-width: 0; }
.install-card b { display: block; font-size: 0.95rem; }
.install-card span { font-size: 0.8rem; color: var(--muted); }
.install-card .x { background: none; border: none; color: var(--faint); cursor: pointer; padding: 4px; }

/* ---------- Profile ---------- */
.profile-head { display: flex; align-items: center; gap: 16px; }
.profile-head h2 { font-size: 1.2rem; font-weight: 720; letter-spacing: -0.01em; }
.profile-head p { font-size: 0.85rem; color: var(--muted); }
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 13px 2px; border-bottom: 1px solid var(--line); background: none; border-left: none; border-right: none; border-top: none; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; text-decoration: none; font-size: 0.93rem; }
.list-row:last-child { border-bottom: none; }
.list-row .lead { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-ink); flex-shrink: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .val { color: var(--muted); font-size: 0.85rem; }
.list-row .go { color: var(--faint); }

/* ---------- Field app: filling in a mission ---------- */
.mission-head .kicker { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.mission-head h2 { font-size: 1.3rem; font-weight: 760; letter-spacing: -0.02em; }
.mission-head p { font-size: 0.9rem; color: var(--muted); margin-top: 4px; }
.mission-head .due { display: inline-flex; align-items: center; gap: 6px; font-size: 0.82rem; font-weight: 600; color: var(--brand-ink); margin-top: 10px; }
.progress { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; margin-top: 14px; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-500), var(--brand-700)); border-radius: 999px; transition: width .25s; }
.q { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); transition: border-color .15s; }
.q.missing { border-color: var(--red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 15%, transparent); }
.q.failed { border-left: 4px solid var(--red); }
.q .qtext { display: flex; gap: 10px; font-weight: 600; font-size: 0.97rem; line-height: 1.4; }
.q .qnum { width: 24px; height: 24px; border-radius: 7px; background: var(--surface-3); display: grid; place-items: center; font-size: 0.75rem; font-weight: 700; color: var(--muted); flex-shrink: 0; }
.q .qtext .req { color: var(--red); }
.q .qmeta { font-size: 0.76rem; color: var(--muted); margin: 4px 0 0 34px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.seg.opts { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
.seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 6px; border-radius: 11px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 650; font-size: 0.92rem; cursor: pointer; color: var(--text); transition: all .12s; }
.seg button .ic { width: 17px; height: 17px; }
.seg button.pass .ic { color: var(--green); } .seg button.fail .ic { color: var(--red); } .seg button.na .ic { color: var(--faint); }
.seg button.on .ic { color: #fff; }
.seg button.on.pass, .seg button.on.opt { background: #16a34a; border-color: #16a34a; color: #fff; box-shadow: 0 3px 10px rgba(22,163,74,0.3); }
.seg button.on.fail { background: #dc2626; border-color: #dc2626; color: #fff; box-shadow: 0 3px 10px rgba(220,38,38,0.3); }
.seg button.on.na { background: #64748b; border-color: #64748b; color: #fff; }
.q .extra { margin-top: 12px; display: grid; gap: 10px; }
.photo-btn { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 13px; border-radius: 11px; background: var(--brand-50); border: 1.5px dashed color-mix(in srgb, var(--brand-600) 45%, transparent); color: var(--brand-ink); font-weight: 650; font-size: 0.9rem; cursor: pointer; }
.photo-btn.req { background: var(--red-bg); border-color: color-mix(in srgb, var(--red) 45%, transparent); color: var(--red); }
.photo-btn input { display: none; }
.photo-thumb { display: block; max-width: 240px; max-height: 170px; border-radius: 11px; border: 1px solid var(--line); margin-top: 4px; object-fit: cover; box-shadow: var(--shadow-sm); }
.range-bad { display: inline-flex; align-items: center; gap: 6px; color: var(--red); font-weight: 650; font-size: 0.82rem; }
.result { text-align: center; padding: 30px 18px; }
.result .badge { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 14px; background: var(--green-bg); color: var(--green); animation: pop .35s cubic-bezier(.2,1.6,.4,1); }
.result .badge .ic { width: 38px; height: 38px; stroke-width: 2.5; }
.result h2 { font-size: 1.2rem; font-weight: 720; }
.result-big { font-size: 3.2rem; font-weight: 800; letter-spacing: -0.03em; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.welcome { text-align: center; padding: 26px 20px; }
.welcome .badge { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; margin: 0 auto 12px; background: var(--brand-50); color: var(--brand-ink); }
.welcome .badge .ic { width: 30px; height: 30px; }
.welcome h2 { font-size: 1.3rem; font-weight: 760; letter-spacing: -0.02em; }
.welcome p { color: var(--muted); font-size: 0.9rem; margin: 4px 0 18px; }
.welcome .form-grid-1 { text-align: left; }

/* ---------- Onboarding ---------- */
.onboard { position: fixed; inset: 0; z-index: 70; background: var(--bg); display: flex; flex-direction: column; padding: calc(20px + env(safe-area-inset-top)) 0 calc(20px + env(safe-area-inset-bottom)); }
.onboard .skip { align-self: flex-end; margin-right: 20px; }
.slides { flex: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.slides::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 32px; }
.slide .art { width: 150px; height: 150px; border-radius: 40px; display: grid; place-items: center; margin-bottom: 32px; background: linear-gradient(135deg, var(--brand-500), var(--brand-800)); color: #fff; box-shadow: 0 20px 40px rgba(13,148,136,0.3); transform: rotate(-4deg); }
.slide .art .ic { width: 64px; height: 64px; stroke-width: 1.6; transform: rotate(4deg); }
.slide.s2 .art { background: linear-gradient(135deg, #f59e0b, #d97706); box-shadow: 0 20px 40px rgba(217,119,6,0.3); transform: rotate(3deg); }
.slide.s2 .art .ic { transform: rotate(-3deg); }
.slide.s3 .art { background: linear-gradient(135deg, #3b82f6, #1d4ed8); box-shadow: 0 20px 40px rgba(29,78,216,0.3); }
.slide h2 { font-size: 1.6rem; font-weight: 780; letter-spacing: -0.03em; max-width: 340px; }
.slide p { color: var(--muted); font-size: 1rem; margin-top: 10px; max-width: 320px; }
.dots { display: flex; justify-content: center; gap: 8px; margin: 18px 0; }
.dots span { width: 8px; height: 8px; border-radius: 999px; background: var(--line-strong); transition: all .2s; }
.dots span.on { width: 24px; background: var(--brand-600); }
.onboard .btn { margin: 0 24px; }

/* ---------- Splash ---------- */
.splash { position: fixed; inset: 0; z-index: 90; background: radial-gradient(circle at 50% 42%, var(--brand-50) 0%, var(--bg) 62%); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; transition: opacity .6s ease, visibility .6s; }
.splash img { width: 120px; height: auto; margin-bottom: 6px; animation: pop .7s cubic-bezier(.2,1.4,.4,1) both; }
.splash .wordmark { font-size: 1.7rem; animation: rise .6s ease-out .45s both; }
.splash .tagline { font-size: 0.92rem; color: var(--muted); letter-spacing: 0.01em; animation: rise .6s ease-out .9s both; }
.splash .loader { margin-top: 14px; animation: rise .4s ease-out 1.3s both; width: 44px; height: 4px; border-radius: 999px; background: var(--surface-3); overflow: hidden; position: relative; }
.splash .loader::after { content: ""; position: absolute; inset: 0; width: 40%; border-radius: 999px; background: var(--brand-600); animation: slide 1s ease-in-out infinite; }
.splash.hide { opacity: 0; visibility: hidden; }

/* ---------- Skeleton & pull to refresh ---------- */
.skel { border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.ptr { height: 0; overflow: hidden; display: flex; align-items: flex-end; justify-content: center; color: var(--brand-ink); font-size: 0.8rem; font-weight: 600; gap: 6px; transition: height .2s; }
.ptr .ic { transition: transform .2s; }
.ptr.ready .ic { transform: rotate(180deg); }
.ptr.spin .ic { animation: spin .8s linear infinite; }

/* ---------- HQ dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.kpi .kh { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi .l { font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.kpi .kic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-ink); }
.kpi .kic.good { background: var(--green-bg); color: var(--green); } .kpi .kic.mid { background: var(--amber-bg); color: var(--amber); } .kpi .kic.bad { background: var(--red-bg); color: var(--red); }
.kpi .v { font-size: 2rem; font-weight: 750; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tbl-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
th { text-align: left; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); padding: 9px 10px; background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child { border-radius: 8px 0 0 8px; border-left: 1px solid var(--line); } th:last-child { border-radius: 0 8px 8px 0; border-right: 1px solid var(--line); }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
td b { font-weight: 600; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bar { height: 7px; background: var(--surface-3); border-radius: 999px; overflow: hidden; min-width: 90px; margin-top: 6px; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-500), var(--brand-700)); border-radius: 999px; }
.filters { display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 12px; align-items: end; }
.ans-row { padding: 13px 0; border-bottom: 1px solid var(--line); }
.ans-row.fail { background: var(--red-bg); border-left: 3px solid var(--red); padding-left: 12px; margin: 0 -4px; border-radius: 0 8px 8px 0; }
.ans-row .a { font-weight: 650; margin-top: 3px; }
.detail-meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 8px; }
.item-ed { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--surface-2); }
.item-ed .row { display: grid; grid-template-columns: 2.4fr 1fr 0.6fr; gap: 10px; }
.item-ed .row2 { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin-top: 10px; }
.item-ed .row2 .input-field { min-width: 130px; }
.item-ed .tools { display: flex; gap: 4px; margin-left: auto; }
.item-ed .tools button { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); cursor: pointer; }
.item-ed .tools button:hover:not(:disabled) { background: var(--brand-50); color: var(--brand-ink); }
.item-ed .tools button.red:hover { background: var(--red-bg); color: var(--red); }
.item-ed .tools button:disabled { opacity: 0.4; cursor: default; }
.item-ed .tools .ic { width: 16px; height: 16px; }
.ic.up, .ic.down { transform: rotate(90deg); }
.loc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; margin-top: 8px; }
.loc-grid .check { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.region-head { display: flex; align-items: center; gap: 10px; margin-top: 14px; }

/* ---------- Overlays ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(5,12,16,0.5); backdrop-filter: blur(3px); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 24px 12px; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 20px; width: 100%; max-width: 780px; padding: 22px; box-shadow: var(--shadow-lg); }
.modal .section-header { position: sticky; top: -24px; background: var(--surface); padding: 8px 0; z-index: 1; border-bottom: 1px solid var(--line); }
.sheet-bg { position: fixed; inset: 0; z-index: 60; background: rgba(5,12,16,0.45); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.sheet { background: var(--surface); width: 100%; max-width: 720px; max-height: 88vh; overflow-y: auto; border-radius: 22px 22px 0 0; padding: 10px 18px calc(22px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg); animation: up .25s cubic-bezier(.2,.9,.3,1); }
.sheet .grab { width: 40px; height: 5px; border-radius: 999px; background: var(--line-strong); margin: 0 auto 12px; }
.bottom-bar { position: fixed; bottom: 0; left: 0; right: 0; background: var(--appbar-bg); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); border-top: 1px solid var(--line); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); z-index: 31; }
.bottom-bar .inner { max-width: 720px; margin: 0 auto; display: flex; gap: 12px; align-items: center; }
.bottom-bar .inner .btn { flex: 1; }
.bottom-bar .scorebox { display: flex; flex-direction: column; min-width: 92px; }
.bottom-bar .scorebox small { font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.bottom-bar .scorebox .score { font-size: 1.15rem; }
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-size: 0.88rem; font-weight: 600; z-index: 95; max-width: calc(100% - 32px); box-shadow: var(--shadow-lg); animation: toast-in .2s ease-out; }

/* ---------- Motion ---------- */
.enter { animation: enter .22s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes slide { 0% { left: -40%; } 100% { left: 100%; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes up { from { transform: translateY(40px); opacity: 0.6; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

@media (max-width: 760px) {
  .tbl-wrap table { min-width: 600px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; } .kpi .v { font-size: 1.6rem; }
  .grid-2 { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr 1fr; }
  .detail-meta { grid-template-columns: 1fr 1fr; }
  .item-ed .row { grid-template-columns: 1fr 1fr; }
  .item-ed .row .input-field:first-child { grid-column: 1 / -1; }
  .tab span { display: none; }
  .tab.active span { display: inline; }
}
@media (max-width: 480px) {
  .form-grid-2 { grid-template-columns: 1fr; }
  .app-container { padding: 12px 12px 120px; gap: 12px; }
  .wide .app-container { padding-bottom: 40px; }
  .card { padding: 16px; }
  .tbl-wrap { margin: 0 -16px; padding: 0 16px; }
  .topbar h1 { font-size: 1.25rem; }
  .topbar .brand img { width: 42px; }
  .icon-btn span { display: none; }
}
@media print {
  body { background: #fff; padding: 0; }
  body.printing > *:not(.modal-bg) { display: none !important; }
  .modal-bg { position: static; background: none; padding: 0; backdrop-filter: none; }
  .modal { max-width: none; padding: 0; box-shadow: none; }
  .no-print { display: none !important; }
}

/* ---------- Follow-ups, photos, maps & charts ---------- */
[hidden] { display: none !important; }
.q.followup { margin-left: 18px; border-left: 3px solid var(--brand-100); }
.fu-tag { display: inline-block; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--brand-ink); background: var(--brand-50); padding: 2px 6px; border-radius: 6px; margin-right: 6px; vertical-align: 2px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumbs:empty { display: none; }
.thumb { position: relative; width: 96px; height: 96px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.thumb-x { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--surface); background: var(--red); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.thumb-x .ic { width: 13px; height: 13px; stroke-width: 3; }

/* ---------- HQ: page layout ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head .page-title { margin: 0; }
.sub-title { font-size: 1.15rem; font-weight: 720; letter-spacing: -0.01em; margin-top: 6px; }
.actions.wrap { flex-wrap: wrap; }
.sm-select { width: auto; padding: 7px 10px; font-size: 0.82rem; border-radius: 9px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.78rem; }
.kpis.six { grid-template-columns: repeat(6, 1fr); }
.kpi .v small { font-size: 0.95rem; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.grid-map { display: grid; grid-template-columns: 1.7fr 1fr; gap: 14px; }
.grid-map > * { min-width: 0; }
.grid-map > .card:first-child { display: flex; flex-direction: column; }
.grid-map > .card:first-child .map { flex: 1; min-height: 360px; }
.wide-filters { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.wide-filters .search { grid-column: span 2; }
.wide-filters .segmented { width: 100%; }
.wide-filters .date-field { grid-column: span 2; }
.segmented button { white-space: nowrap; }
table.sortable th[data-sort] { cursor: pointer; user-select: none; }
table.sortable th[data-sort]:hover, table.sortable th.sorted { color: var(--brand-ink); }
.avatar.sm-av { width: 26px; height: 26px; font-size: 0.66rem; display: inline-grid; vertical-align: middle; margin-right: 8px; cursor: default; }

/* ---------- Map ---------- */
.map { height: 360px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-3); z-index: 0; }
.map-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 0.72rem; color: var(--muted); justify-content: flex-end; }
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.map-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.map-bubble-wrap { background: none; border: none; }
.map-bubble { border-radius: 50%; color: #fff; font-weight: 750; font-size: 0.82rem; display: grid; place-items: center; border: 3px solid #fff; box-shadow: 0 3px 10px rgba(0,0,0,0.3); font-family: "Inter", sans-serif; }
.map-pop { font-family: "Inter", sans-serif; min-width: 210px; }
.pop-grid { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; font-size: 0.82rem; }
.pop-grid span { color: #5d6b78; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { border-radius: 14px; }
.leaflet-container { font-family: "Inter", sans-serif; }
:root[data-theme="dark"] .leaflet-tile-pane { filter: brightness(0.75) contrast(1.1) saturate(0.8); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .leaflet-tile-pane { filter: brightness(0.75) contrast(1.1) saturate(0.8); } }

/* ---------- Charts ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: "Inter", sans-serif; }
.chart .col { fill: var(--brand-600); }
.chart rect[data-tip]:hover + text, .chart rect[data-tip]:hover { fill: color-mix(in srgb, var(--brand-600) 8%, transparent); }
.chart-tip { position: fixed; z-index: 120; background: var(--text); color: var(--bg); font-size: 0.8rem; font-weight: 600; padding: 7px 10px; border-radius: 8px; pointer-events: none; box-shadow: var(--shadow-lg); max-width: 260px; }
.donut-wrap { display: flex; align-items: center; gap: 18px; }
.donut { width: 132px; height: 132px; flex-shrink: 0; }
.donut path, .donut circle { stroke: var(--surface); stroke-width: 1.5; }
.donut-num { font-size: 22px; font-weight: 750; fill: var(--text); font-family: "Inter", sans-serif; }
.donut-lbl { font-size: 9px; fill: var(--muted); font-family: "Inter", sans-serif; text-transform: uppercase; letter-spacing: 0.06em; }
.legend { flex: 1; display: grid; gap: 6px; min-width: 0; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 0.86rem; }
.legend-row .grow { flex: 1; }
.sw { width: 12px; height: 12px; border-radius: 4px; flex-shrink: 0; }
.hbars { display: grid; gap: 12px; }
.hbar-top { display: flex; justify-content: space-between; gap: 8px; font-size: 0.86rem; margin-bottom: 5px; }
.hbar-track { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.hbar-track span { display: block; height: 100%; border-radius: 999px; background: var(--brand-600); min-width: 2px; }

/* ---------- Responses & review ---------- */
.review-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 10px; margin: 4px 0 8px; }
.review-box textarea { min-height: 56px; }
.ans-row.fu { margin-left: 18px; padding-left: 12px; border-left: 3px solid var(--brand-100); }
.ans-row.fu.fail { border-left-color: var(--red); }
.tlabel { display: inline-block; font-size: 0.7rem; font-weight: 700; color: var(--brand-ink); background: var(--brand-50); padding: 1px 6px; border-radius: 6px; margin-right: 8px; }
button.thumb { padding: 0; border: none; background: none; cursor: zoom-in; }
img.broken { background: var(--surface-3); }

/* ---------- Photos ---------- */
.album-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.album-chip { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-weight: 600; font-size: 0.84rem; cursor: pointer; }
.album-chip .ic { width: 15px; height: 15px; color: var(--brand-ink); }
.album-chip.view { border-style: dashed; }
.album-chip.on { background: var(--brand-600); border-color: var(--brand-600); color: var(--on-brand); }
.album-chip.on .ic, .album-chip.on .hint { color: inherit; }
.photo-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.photo-bar .segmented { flex: 0 1 420px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.photo-card { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; padding: 0; cursor: pointer; font: inherit; color: inherit; box-shadow: var(--shadow-sm); transition: box-shadow .15s, transform .1s; }
.photo-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.photo-card.picked { outline: 3px solid var(--brand-600); outline-offset: -3px; }
.ph-img { position: relative; display: block; aspect-ratio: 4 / 3; background: var(--surface-3); }
.ph-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-badge { position: absolute; top: 8px; left: 8px; }
.ph-check { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; background: rgba(15,27,36,0.35); color: transparent; display: grid; place-items: center; }
.picked .ph-check { background: var(--brand-600); color: #fff; }
.ph-check .ic { width: 15px; height: 15px; stroke-width: 3; }
.ph-cap { display: grid; gap: 1px; padding: 10px 12px 12px; font-size: 0.8rem; }
.ph-cap b, .ph-cap span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-cap b { font-size: 0.86rem; }
.viewer-bg { position: fixed; inset: 0; z-index: 70; background: rgba(5,10,14,0.94); animation: fade .15s; }
.viewer { position: absolute; inset: 0; display: flex; flex-direction: column; }
.viewer-top { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; }
.vbtn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.15); background: rgba(255,255,255,0.08); color: #fff; display: grid; place-items: center; cursor: pointer; }
.vbtn:hover, .vbtn.on { background: rgba(255,255,255,0.2); }
.viewer-body { flex: 1; display: flex; min-height: 0; }
.viewer-stage { flex: 1; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 0 12px 16px; min-width: 0; }
.viewer-stage img { max-width: calc(100% - 120px); max-height: 100%; object-fit: contain; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,0.5); }
.vnav { width: 46px; height: 46px; border-radius: 50%; border: none; background: rgba(255,255,255,0.12); color: #fff; display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }
.vnav:disabled { opacity: 0.25; cursor: default; }
.vnav .ic { width: 24px; height: 24px; }
.viewer-info { width: 320px; background: var(--surface); color: var(--text); padding: 20px; overflow-y: auto; border-radius: 16px 0 0 0; }
.viewer-info h3 { font-size: 1.05rem; font-weight: 720; }
.viewer-info dl { display: grid; gap: 2px; margin: 14px 0 16px; font-size: 0.88rem; }
.viewer-info dt { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-top: 10px; }

/* ---------- Mission analytics ---------- */
.mission-banner { display: flex; gap: 16px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.mb-main { flex: 1; min-width: 260px; }
.mb-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; font-size: 0.85rem; color: var(--brand-ink); font-weight: 600; align-items: center; }
.mb-meta > span:not(.chip) { display: inline-flex; align-items: center; gap: 6px; }
.store-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.store-chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border-radius: 10px; font-size: 0.84rem; border: 1px solid var(--line); }
.store-chip.yes { background: var(--brand-50); color: var(--brand-ink); border-color: transparent; }
.store-chip.no { color: var(--muted); border-style: dashed; }
.store-chip .ic { width: 15px; height: 15px; }
.task-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.task-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.task-card.fu { border-left: 4px solid var(--brand-100); }
.task-head { display: flex; gap: 12px; padding: 16px 16px 10px; font-size: 0.92rem; line-height: 1.35; }
.task-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); flex-shrink: 0; }
.task-ic .ic { width: 17px; height: 17px; }
.task-body { padding: 6px 16px 14px; flex: 1; }
.task-foot { border-top: 1px solid var(--line); padding: 10px 16px; font-size: 0.8rem; color: var(--muted); }
.task-empty { padding: 28px 12px; }
.fail-at { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 12px; }
.num-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.num-stats div { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.num-stats b { display: block; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.ans-list { display: grid; }
.ans-item { display: flex; gap: 10px; align-items: flex-start; padding: 9px 2px; border: none; border-bottom: 1px solid var(--line); background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; font-size: 0.86rem; }
.ans-item:last-child { border-bottom: none; }
.ans-item .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex-shrink: 0; }
.ans-item .grow { flex: 1; min-width: 0; }

/* ---------- Builder follow-ups ---------- */
.item-ed.fu { margin-left: 22px; border-left: 4px solid var(--brand-100); }
.followup-row { padding-top: 10px; border-top: 1px dashed var(--line); }
.followup-row select { width: auto; min-width: 160px; }
.followup-row .lbl .ic { width: 14px; height: 14px; vertical-align: -2px; }

@media (max-width: 1100px) { .kpis.six { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px) { .grid-map { grid-template-columns: 1fr; } .viewer-info { position: absolute; right: 0; bottom: 0; top: 64px; width: min(340px, 90%); box-shadow: var(--shadow-lg); } }
@media (max-width: 760px) {
  .kpis.six { grid-template-columns: 1fr 1fr; }
  .wide-filters { grid-template-columns: 1fr 1fr; }
  .wide-filters .search, .wide-filters .date-field { grid-column: 1 / -1; }
  .segmented button { padding: 9px 4px; font-size: 0.8rem; }
  .num-stats { grid-template-columns: 1fr 1fr; }
  .map { height: 300px; }
  .task-grid { grid-template-columns: 1fr; }
  .viewer-stage img { max-width: 100%; }
  .vnav { position: absolute; bottom: 20px; }
  .vnav[data-act="prev"] { left: 20px; } .vnav[data-act="next"] { right: 20px; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}
img[data-photo]:not([src]) { visibility: hidden; }
.thumb, .ph-img { background: var(--surface-3); border-radius: 10px; }
