/* app.css — WitnessClaim Bureau demo shell. Mobile-first. */

:root {
  /* OIC-inspired trust palette (navy + cyan + gold) */
  --navy: #0b2447;
  --navy-2: #12315c;
  --navy-grad: linear-gradient(125deg, #0b2447 0%, #123a6b 55%, #0e4f7a 100%);
  --cyan: #22d3ee;
  --cyan-soft: #67e8f9;
  --gold: #e4b44c;
  --gold-soft: #f6dc9b;

  /* Brand (interactive teal — legible on white) */
  --brand: #0e7490;
  --brand-dark: #0b566b;
  --brand-light: #d7f4fa;

  --ink: #0f2140;
  --ink-soft: #47597a;
  --muted: #93a3bb;
  --line: #e5ecf4;
  --bg: #f3f7fc;
  --surface: #ffffff;

  /* Triage — ต้องตรงกับ config.js TRIAGE.levels (semantic, ห้ามเปลี่ยน) */
  --green: #16a34a;
  --yellow: #d97706;
  --red: #dc2626;

  --radius: 18px;
  --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(11,36,71,.05), 0 10px 30px rgba(11,36,71,.07);
  --shadow-lg: 0 6px 16px rgba(11,36,71,.10), 0 20px 48px rgba(11,36,71,.14);
  --ease: cubic-bezier(.4, 0, .2, 1);
  --header-h: 58px;
  --tabbar-h: 64px;
  --banner-h: 34px;
  --font: 'IBM Plex Sans Thai', system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

/* ---------- Motion primitives ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes popIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes shimmer { to { background-position: 200% 0; } }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  padding-top: var(--header-h);
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  min-height: 100vh;
}
/* ออฟไลน์ = แถบค้าง → สำรองพื้นที่เท่าความสูงแถบพอดี (ไม่ทับหัวข้อ) */
body.banner-on { padding-top: calc(var(--header-h) + var(--banner-h)); }

/* ---------- Header (navy gradient, OIC trust tone) ---------- */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h);
  z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 0 16px;
  background: var(--navy-grad);
  border-bottom: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 2px 18px rgba(11,36,71,.28);
}
/* เส้น cyan-gold บาง ๆ ใต้ header เป็นซิกเนเจอร์ */
.app-header::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--gold));
  opacity: .9;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { filter: drop-shadow(0 2px 6px rgba(34,211,238,.4)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 15px; font-weight: 700; color: #fff; letter-spacing: .2px; }
.brand-text small { font-size: 11px; color: var(--cyan-soft); }
.env-badge {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  color: var(--navy); background: linear-gradient(120deg, var(--gold), var(--gold-soft));
  padding: 3px 9px; border-radius: 999px; box-shadow: 0 2px 8px rgba(228,180,76,.4);
}

/* ---------- Net banner ---------- */
.net-banner {
  position: fixed; top: var(--header-h); left: 0; right: 0; z-index: 19;
  height: var(--banner-h); box-sizing: border-box;
  display: flex; align-items: center; gap: 8px; justify-content: center;
  padding: 0 12px; font-size: 12.5px; font-weight: 600;
  background: #fef3c7; color: #92400e; border-bottom: 1px solid #fde68a;
}
.net-banner[hidden] { display: none; }
.net-banner.online { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.net-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* ---------- View root ---------- */
.view-root { max-width: 960px; margin: 0 auto; padding: 16px; }

/* ---------- Tabbar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; text-decoration: none; color: var(--muted);
  font-size: 11.5px; font-weight: 500;
}
.tab-ico {
  width: 24px; height: 24px; object-fit: contain; display: block;
  opacity: .5; transition: opacity .2s var(--ease), transform .25s var(--ease);
}
.tab { transition: color .2s var(--ease); }
.tab.active { color: var(--brand); }
.tab.active .tab-ico { opacity: 1; transform: translateY(-2px) scale(1.12); }
.tab:not(.active):hover .tab-ico { opacity: .8; }

/* ---------- Generic UI ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 14px;
  animation: fadeUp .45s var(--ease) both;
}
/* stagger การ์ดเล็กน้อยให้ดูมีจังหวะ */
.view-root > .card:nth-child(2) { animation-delay: .05s; }
.view-root > .card:nth-child(3) { animation-delay: .10s; }
.view-root > .card:nth-child(4) { animation-delay: .15s; }
.view-root > .card:nth-child(5) { animation-delay: .20s; }

.page-title {
  font-size: 21px; font-weight: 700; margin: 4px 0 2px; color: var(--ink);
  display: flex; align-items: center; gap: 10px; animation: fadeUp .4s var(--ease) both;
}
/* diamond motif (โมทีฟข้าวหลามตัดจากโลโก้ คปภ.) นำหน้าหัวข้อ */
.page-title::before {
  content: ''; width: 14px; height: 14px; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--cyan), var(--brand));
  transform: rotate(45deg); border-radius: 3px;
  box-shadow: 0 2px 8px rgba(34,211,238,.4);
}
.page-sub { font-size: 13.5px; color: var(--ink-soft); margin: 0 0 16px; animation: fadeUp .4s var(--ease) .05s both; }

.btn {
  appearance: none; border: 0; cursor: pointer; font-family: var(--font);
  font-weight: 600; font-size: 15px; border-radius: var(--radius-sm);
  padding: 13px 18px; color: #fff; width: 100%;
  background: linear-gradient(120deg, var(--brand), #1596b4);
  box-shadow: 0 4px 14px rgba(14,116,144,.28);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), filter .15s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(14,116,144,.36); }
.btn:active { transform: translateY(0); filter: brightness(.94); }
.btn.secondary { background: var(--brand-light); color: var(--brand-dark); box-shadow: none; }
.btn.ghost { background: var(--surface); color: var(--brand); border: 1.5px solid var(--brand-light); box-shadow: none; }
.btn.ghost:hover { border-color: var(--brand); background: var(--brand-light); }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
}
.pill.green  { color: var(--green);  background: #dcfce7; }
.pill.yellow { color: var(--yellow); background: #fef3c7; }
.pill.red    { color: var(--red);    background: #fee2e2; }

.mono { font-family: var(--mono); font-size: 12.5px; color: var(--ink-soft); word-break: break-all; }

.stub {
  text-align: center; padding: 40px 20px; color: var(--ink-soft);
}
.stub .stub-ico { font-size: 44px; }
.stub h3 { margin: 12px 0 6px; color: var(--ink); }
.stub p { margin: 0 auto; max-width: 380px; font-size: 14px; line-height: 1.6; }
.stub .phase-tag {
  display: inline-block; margin-top: 14px; font-size: 12px; font-weight: 600;
  color: var(--brand-dark); background: var(--brand-light);
  padding: 5px 12px; border-radius: 999px;
}

/* ---------- Capture view (เฟส 1) ---------- */
.cap-guide .steps {
  list-style: none; margin: 0 0 12px; padding: 0;
  display: flex; flex-direction: column; gap: 9px;
}
.cap-guide .steps li {
  font-size: 13.5px; color: var(--ink-soft); line-height: 1.5;
  display: flex; gap: 10px; align-items: flex-start;
}
.cap-guide .steps b {
  flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%;
  background: var(--brand-light); color: var(--brand-dark);
  font-size: 12px; display: grid; place-items: center; margin-top: 1px;
}
.cap-guide .steps u { text-decoration-color: var(--brand); }
.device-fp {
  font-size: 12px; color: var(--ink-soft);
  border-top: 1px dashed var(--line); padding-top: 10px;
}

.cam-wrap {
  position: relative; width: 100%; aspect-ratio: 3 / 4; max-height: 62vh;
  background: #0b1220; border-radius: var(--radius-sm); overflow: hidden;
}
@media (min-width: 768px) { .cam-wrap { aspect-ratio: 4 / 3; } }
.cam-wrap video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-overlay {
  position: absolute; inset: 0; display: grid; place-items: center;
  pointer-events: none; color: #cbd5e1;
}
.cam-overlay:not(.live)::after {
  content: '📷 กดปุ่มด้านล่างเพื่อเปิดกล้อง';
  font-size: 13px; color: #94a3b8;
}
/* ป้ายบอกสั้น ๆ ด้านบน (ไม่ใช่กรอบ crop) */
.cam-overlay.live .cam-hint {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  max-width: 90%; text-align: center; line-height: 1.35;
  background: rgba(11,36,71,.72); color: #eaf6ff; font-size: 12px; font-weight: 500;
  padding: 7px 13px; border-radius: 999px; backdrop-filter: blur(2px);
}
.cam-overlay.live .cam-hint b { color: var(--cyan-soft); font-weight: 700; }
.cam-overlay:not(.live) .cam-hint { display: none; }

.cam-controls {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin-top: 14px;
}
.cam-controls .btn { width: auto; min-width: 150px; }
.btn.shutter {
  width: 68px; height: 68px; min-width: 0; border-radius: 50%; padding: 0;
  background: #fff; border: 3px solid var(--brand);
  display: grid; place-items: center; box-shadow: var(--shadow);
}
.btn.shutter span { width: 50px; height: 50px; border-radius: 50%; background: var(--brand); display: block; }
.btn.shutter:active span { filter: brightness(.85); }
.btn.shutter:disabled { opacity: .5; }
.cam-msg {
  margin: 12px 0 0; font-size: 13px; color: #b45309;
  background: #fffbeb; border: 1px solid #fde68a; border-radius: var(--radius-sm); padding: 10px 12px;
}

.shots-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 6px 2px 10px; font-size: 14px;
}
.shots-head-right { display: flex; align-items: center; gap: 10px; }
.linkbtn {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  color: var(--muted); font-family: var(--font); font-size: 12px;
  text-decoration: underline; padding: 2px 4px;
}
.linkbtn:hover { color: var(--red); }
.shot { display: flex; gap: 14px; padding: 12px; }
.shot-thumb {
  flex: 0 0 auto; width: 92px; height: 92px; object-fit: cover;
  border-radius: var(--radius-sm); background: #e2e8f0;
}
.shot-body { flex: 1 1 auto; min-width: 0; }
.shot-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.shot-seq { font-size: 12px; font-weight: 700; color: var(--muted); }
.shot-meta { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; }
.shot-meta dt { font-size: 11.5px; color: var(--muted); }
.shot-meta dd { margin: 0; font-size: 12px; }

/* ---------- Measure area on shot ---------- */
.shot-measure { margin-top: 10px; }
.shot-measure .btn-measure { width: auto; font-size: 13px; padding: 8px 12px; }

/* ---------- Measure modal (เฟส 2) ---------- */
.measure-back {
  position: fixed; inset: 0; z-index: 50; background: rgba(15,23,42,.72);
  display: flex; align-items: center; justify-content: center; padding: 12px;
}
.measure-modal {
  background: var(--surface); border-radius: var(--radius); width: 100%; max-width: 560px;
  max-height: 92vh; overflow: auto; padding: 16px; box-shadow: var(--shadow);
}
.measure-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.measure-head strong { font-size: 15px; }
.measure-stage {
  position: relative; width: 100%; height: min(56vh, 440px);
  background: #0b1220; border-radius: var(--radius-sm); overflow: hidden;
}
#m-canvas { width: 100%; height: 100%; touch-action: none; display: block; }
.m-tools { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 8px; align-items: center; }
.m-tbtn {
  appearance: none; border: 0; cursor: pointer; font-family: var(--font);
  background: rgba(11,36,71,.82); color: #eaf6ff; font-size: 18px; font-weight: 700;
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  backdrop-filter: blur(3px); box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.m-tbtn.wide { width: auto; padding: 0 14px; font-size: 13px; }
.m-tbtn:active { filter: brightness(1.2); }
.measure-hint { font-size: 13px; color: var(--ink-soft); margin: 10px 2px; }
.measure-readout {
  border-radius: var(--radius-sm); padding: 12px 14px; margin: 6px 0 12px; font-size: 14px;
}
.measure-readout.ok { background: #dcfce7; color: #14532d; }
.measure-readout.warn { background: #fef3c7; color: #92400e; }
.measure-readout .big { font-size: 30px; font-weight: 800; }
.measure-readout .measure-sub { display: block; font-size: 11.5px; opacity: .8; margin-top: 2px; }
.measure-cta { display: flex; gap: 10px; margin-top: 12px; }
.measure-cta .btn { flex: 1; }
.measure-actions { display: flex; gap: 10px; }
.measure-actions .btn { flex: 1; }
.linkbtn.danger { color: var(--red); display: block; margin: 12px auto 0; text-align: center; width: 100%; }

/* ---------- Verification view (เฟส 3) ---------- */
.seg { display: flex; gap: 6px; background: #f1f5f9; border-radius: 999px; padding: 4px; margin-bottom: 14px; }
.seg-btn {
  flex: 1; appearance: none; border: 0; background: transparent; cursor: pointer;
  font-family: var(--font); font-size: 12.5px; font-weight: 600; color: var(--ink-soft);
  padding: 8px 6px; border-radius: 999px;
}
.seg-btn.active { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.subj { margin: 0 0 8px; display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; }
.subj dt { font-size: 12px; color: var(--muted); }
.subj dd { margin: 0; font-size: 13.5px; }
.note-real { font-size: 12.5px; color: var(--brand-dark); background: var(--brand-light); padding: 8px 10px; border-radius: var(--radius-sm); margin: 4px 0 14px; }

.result-card { display: flex; align-items: center; gap: 20px; }
.gauge-wrap { position: relative; width: 128px; height: 128px; flex: 0 0 auto; }
.gauge { width: 128px; height: 128px; transform: rotate(-90deg); }
.gauge-bg { fill: none; stroke: #e2e8f0; stroke-width: 12; }
.gauge-fg { fill: none; stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(.4,0,.2,1); }
.gauge-num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gauge-num b { font-size: 34px; font-weight: 800; line-height: 1; }
.gauge-num small { font-size: 12px; color: var(--muted); }
.result-level { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

.reasons { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.reasons li { display: flex; gap: 10px; align-items: flex-start; }
.reasons .r-ico { font-size: 16px; margin-top: 1px; }
.r-body { flex: 1; min-width: 0; }
.r-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; font-weight: 600; }
.r-score { color: var(--ink-soft); font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.r-detail { font-size: 12px; color: var(--ink-soft); margin-top: 2px; line-height: 1.45; }
.reasons li.zero .r-top { color: var(--red); }
.reasons li.partial .r-top { color: var(--yellow); }

/* ---------- Triage Dashboard (เฟส 4) ---------- */
.dash-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.kpi {
  appearance: none; border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  border-radius: var(--radius-sm); padding: 10px 6px; text-align: center; font-family: var(--font);
  display: flex; flex-direction: column; gap: 2px;
}
.kpi b { font-size: 22px; font-weight: 800; }
.kpi span { font-size: 10.5px; color: var(--ink-soft); }
.kpi.green b { color: var(--green); } .kpi.yellow b { color: var(--yellow); } .kpi.red b { color: var(--red); }
.kpi.sel { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-light); }
.kpi { transition: transform .18s var(--ease), box-shadow .18s var(--ease); }
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.dash-grid { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 14px; }
.dash-map { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
#map { width: 100%; height: 300px; background: #e8eef4; }
.map-fallback { padding: 40px 16px; text-align: center; color: var(--ink-soft); font-size: 13px; background: #eef2f7; }
.dash-side { min-width: 0; }
.case-list { display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow: auto; }
.case-row {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 8px;
  appearance: none; border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  border-radius: var(--radius-sm); padding: 9px 11px; font-family: var(--font); text-align: left; width: 100%;
}
.case-row { transition: transform .15s var(--ease), box-shadow .15s var(--ease), border-color .15s; }
.case-row:hover { transform: translateX(3px); box-shadow: var(--shadow); border-color: var(--brand-light); }
.case-row.active { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-light); }
.case-row .dot { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 auto; }
.case-row .case-id { font-size: 12.5px; font-weight: 600; }
.case-row .mini-flag { color: var(--red); font-size: 10.5px; font-weight: 700; }
.case-row .case-ins { font-size: 11.5px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.case-row .case-score { font-weight: 800; font-size: 15px; }
.case-row .case-ok { color: var(--green); font-weight: 700; }

.detail-card { min-height: 80px; }
.detail-empty { color: var(--muted); font-size: 13.5px; text-align: center; padding: 20px; }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.detail-id { font-size: 17px; font-weight: 800; }
.detail-sub { font-size: 12.5px; color: var(--ink-soft); }
.dup-banner {
  background: #fee2e2; border: 1px solid #fecaca; color: #991b1b;
  border-radius: var(--radius-sm); padding: 12px; margin-bottom: 12px; font-size: 13px; line-height: 1.5;
}
.dup-banner strong { display: block; margin-bottom: 4px; }
.dup-banner .mono { color: #b91c1c; margin-top: 4px; }
.dup-banner .linkbtn { color: #b91c1c; padding: 0; margin-top: 6px; }
.detail-meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 12px; }
.detail-meta dt { font-size: 12px; color: var(--muted); }
.detail-meta dd { margin: 0; font-size: 13px; }
.reasons.compact { gap: 6px; margin-top: 6px; margin-bottom: 14px; }
.reasons.compact .r-top { font-size: 12.5px; }

/* map markers */
.map-pin {
  width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid #fff; cursor: pointer;
  background: var(--pin, #888); box-shadow: 0 1px 4px rgba(0,0,0,.35); padding: 0;
}
.map-pin.active { width: 26px; height: 26px; box-shadow: 0 0 0 4px rgba(14,116,144,.35), 0 1px 4px rgba(0,0,0,.4); }
.map-pin.flagged { animation: pinpulse 1.4s infinite; }
@keyframes pinpulse { 0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,.5); } 50% { box-shadow: 0 0 0 7px rgba(220,38,38,0); } }

.detail-actions { display: flex; gap: 10px; }
.detail-actions .btn { flex: 1; }

/* ---------- 3D model modal (เฟส 5) ---------- */
.model-back {
  position: fixed; inset: 0; z-index: 55; background: rgba(15,23,42,.72);
  display: flex; align-items: center; justify-content: center; padding: 12px;
}
.model-modal {
  background: var(--surface); border-radius: var(--radius); width: 100%; max-width: 620px;
  padding: 16px; box-shadow: var(--shadow);
}
.model-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.model-stage { position: relative; width: 100%; height: 380px; background: #eaf2f8; border-radius: var(--radius-sm); overflow: hidden; }
#md-canvas { width: 100%; height: 100%; display: block; }
.model-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-soft); font-size: 13px; }
.model-cap { margin-top: 10px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-soft); }
.pill.blue-pill { color: #1e40af; background: #dbeafe; }

/* ---------- Hero (navy, OIC trust + tech) ---------- */
.hero {
  position: relative; overflow: hidden; color: #fff;
  background: var(--navy-grad);
  border-radius: var(--radius); padding: 20px; margin-bottom: 14px;
  box-shadow: 0 10px 30px rgba(11,36,71,.25);
  animation: fadeUp .5s var(--ease) both;
}
/* วงเรืองแสง cyan + ลายข้าวหลามตัดจาง ๆ */
.hero::before {
  content: ''; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(34,211,238,.35), transparent 70%);
  pointer-events: none;
}
.hero::after {
  content: ''; position: absolute; right: 18px; bottom: -30px; width: 90px; height: 90px;
  background: linear-gradient(135deg, var(--cyan), transparent);
  transform: rotate(45deg); opacity: .18; border-radius: 12px; animation: floaty 5s ease-in-out infinite;
}
.hero .hero-tag {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .06em;
  color: var(--navy); background: linear-gradient(120deg, var(--gold), var(--gold-soft));
  padding: 3px 10px; border-radius: 999px; margin-bottom: 10px;
}
.hero h2 { margin: 0 0 6px; font-size: 20px; font-weight: 800; line-height: 1.25; }
.hero h2 .accent { color: var(--cyan-soft); }
.hero p { margin: 0; font-size: 13px; color: #cfe4f5; line-height: 1.5; position: relative; z-index: 1; }
.hero .hero-stats { display: flex; gap: 16px; margin-top: 14px; position: relative; z-index: 1; flex-wrap: wrap; }
.hero .hstat b { display: block; font-size: 20px; font-weight: 800; color: #fff; }
.hero .hstat span { font-size: 11px; color: var(--cyan-soft); }

/* ---------- micro-polish ---------- */
.shot { transition: box-shadow .18s var(--ease), transform .18s var(--ease); }
.shot:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.shot-thumb { transition: transform .3s var(--ease); }
.shot:hover .shot-thumb { transform: scale(1.04); }
.pill { animation: popIn .3s var(--ease) both; }
.seg-btn { transition: background .2s var(--ease), color .2s var(--ease); }
.seg-btn.active { animation: popIn .25s var(--ease); }
.net-banner { border-radius: 0 0 12px 12px; }
.result-card { animation: popIn .4s var(--ease) both; }
.map-pin { transition: transform .2s var(--ease); }
.map-pin:hover { transform: scale(1.25); }
/* ปุ่มชัตเตอร์เต้นเบา ๆ เชิญชวนกด */
.cam-overlay.live .cam-hint { animation: fadeUp .4s var(--ease) both; }

/* Desktop: dashboard gets more room */
@media (min-width: 768px) {
  .view-root { padding: 24px; }
  .dash-grid { grid-template-columns: 1.5fr 1fr; }
  #map { height: 440px; }
  .case-list { max-height: 440px; }
  .hero { padding: 28px 30px; }
  .hero h2 { font-size: 26px; }
}

/* ---------- Role separation (ผู้เอาประกัน / เจ้าหน้าที่) ---------- */
.role-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: 999px;
  margin-bottom: 12px; animation: fadeUp .4s var(--ease) both;
}
.role-chip.claimant { color: var(--brand-dark); background: var(--brand-light); }
.role-chip.officer { color: #8a5a00; background: #fef3c7; }

/* active indicator bar + role divider บน tabbar */
.tab { position: relative; }
.tab::before {
  content: ''; position: absolute; top: 0; left: 24%; right: 24%; height: 3px;
  border-radius: 0 0 3px 3px; background: transparent; transition: background .2s var(--ease);
}
.tab.active::before { background: var(--brand); }
.tab[data-route="verify"] { border-left: 1px solid var(--line); }

/* guide highlight (ไม่ตัดคำกลางวลี) */
.cap-guide .hl { color: var(--brand-dark); font-weight: 700; white-space: nowrap; }

/* ---------- Claim form ---------- */
.claim-form { display: flex; flex-direction: column; gap: 12px; }
.claim-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }
.claim-form input, .claim-form select, .claim-form textarea {
  font-family: var(--font); font-size: 14px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; background: #fff; width: 100%;
}
.claim-form textarea { resize: vertical; }
.claim-form input:focus, .claim-form select:focus, .claim-form textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-light);
}
.claim-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pdpa-note { font-size: 11.5px; color: #8a5a00; background: #fffbeb; border: 1px solid #fde68a; border-radius: 9px; padding: 9px 11px; margin: 2px 0 0; line-height: 1.5; }
#btn-submit { margin-top: 14px; }
.submit-ok { margin-top: 12px; background: #dcfce7; color: #14532d; border-radius: var(--radius-sm); padding: 14px; font-size: 14px; line-height: 1.6; }
.submit-ok small { color: #166534; opacity: .85; }
.submit-warn { margin-top: 12px; background: #fef3c7; color: #92400e; border-radius: var(--radius-sm); padding: 11px 13px; font-size: 13px; }

/* ---------- Claim: multi-insurer ---------- */
.claim-multi { border: 1px dashed var(--brand-light); border-radius: 12px; padding: 12px; background: #fbfdff; }
.multi-title { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin-bottom: 10px; }
.insurer-row {
  display: grid; grid-template-columns: 1fr auto; gap: 8px;
  margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px dashed var(--line);
}
.insurer-row:last-child { border-bottom: 0; margin-bottom: 4px; padding-bottom: 0; }
.insurer-row .ins-sel { grid-column: 1 / -1; }
.ins-del {
  width: 46px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
  color: var(--red); font-size: 16px; cursor: pointer;
}
.ins-del:active { background: #fee2e2; }
.add-ins { width: auto; font-size: 13px; padding: 9px 14px; margin-top: 2px; }
.multi-note { font-size: 12px; color: var(--brand-dark); background: var(--brand-light); padding: 8px 11px; border-radius: 9px; margin: 10px 0 0; line-height: 1.5; }

/* submitted result (หลายบริษัท) */
.sub-head { margin-bottom: 10px; }
.sub-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.sub-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fff; border-radius: 8px; padding: 8px 11px; font-size: 13px; }
.sub-row .mono { color: var(--brand-dark); }
