/* ═══════════════════════════════════════════════════════
   SRND Shark AI Demo — app.css
   Marine Professional palette + 3-panel desktop layout
════════════════════════════════════════════════════════ */
:root {
  --bg:         #FAF9F6;
  --bg2:        #F0F4F5;
  --white:      #FFFFFF;
  --primary:    #0F4C5C;
  --primary-dk: #0A3A47;
  --accent:     #2A9D8F;
  --accent2:    #00b4d8;
  --text:       #2F3E46;
  --text-muted: #6C7A89;
  --border:     #E6F0F2;
  --border2:    #D0DBDD;
  --ok:         #2A9D8F;
  --warn:       #F4A261;
  --danger:     #E76F51;
  --confirmed:  #2A9D8F;
  --candidate:  #F4A261;
  --inconc:     #E76F51;

  --sidebar-w:  240px;
  --rp-w:       296px;
  --titlebar-h: 40px;
  --radius:     10px;
  --radius-lg:  16px;
  --shadow:     0 4px 20px -2px rgba(15,76,92,0.09);
  --shadow-sm:  0 2px 8px -1px rgba(15,76,92,0.07);
  --font:       'Plus Jakarta Sans', system-ui, sans-serif;
  --mono:       'JetBrains Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  height: 100%;
  overflow: hidden;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ── Title Bar ─────────────────────────────────────────── */
.titlebar {
  height: var(--titlebar-h);
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 12px;
  flex-shrink: 0;
  position: relative;
  z-index: 100;
}
.titlebar__left { display: flex; align-items: center; gap: 8px; }
.titlebar__right { display: flex; align-items: center; gap: 16px; }
.titlebar__icon { font-size: 16px; }
.titlebar__app { font-weight: 700; letter-spacing: 0.5px; }
.titlebar__sep { opacity: 0.4; }
.titlebar__version { opacity: 0.6; font-size: 11px; }
.titlebar__badge {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  color: #b3e8f0;
  padding: 1px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.titlebar__status { display: flex; align-items: center; gap: 6px; color: #b3d8e0; font-size: 11px; }
.titlebar__dot { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; }
.titlebar__dot--warn { background: #fbbf24; }
.titlebar__dot--anim { animation: pulse-dot 2s infinite; }
@keyframes pulse-dot { 0%,100%{opacity:1}50%{opacity:0.4} }
.titlebar__unit { color: rgba(255,255,255,0.55); font-size: 11px; }

/* ── Workspace: 3-panel ────────────────────────────────── */
.workspace {
  display: flex;
  height: calc(100vh - var(--titlebar-h));
  overflow: hidden;
}

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar__top { flex: 1; overflow-y: auto; padding: 16px 12px; }
.sidebar__header { margin-bottom: 12px; }
.sidebar__label { font-size: 10px; font-weight: 700; color: var(--text-muted); letter-spacing: 1px; text-transform: uppercase; }

.sidebar__nav { display: flex; flex-direction: column; gap: 2px; }
.snav-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: all 0.15s;
}
.snav-btn:hover { background: var(--bg2); color: var(--text); }
.snav-btn.active { background: var(--border); color: var(--primary); font-weight: 600; }
.snav-icon { font-size: 14px; width: 18px; text-align: center; }

.sidebar__device {
  margin: 0 12px;
  padding: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
}
.sidebar__device-label { font-size: 9px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 6px; }
.sidebar__device-row { display: flex; justify-content: space-between; font-size: 11px; color: var(--text); margin-top: 4px; }
.sidebar__device-ok { color: #16a34a; font-weight: 600; }

.sidebar__footer { padding: 10px 16px; border-top: 1px solid var(--border); text-align: center; }
.sidebar__footer-brand { font-size: 10px; font-weight: 600; color: var(--primary); }

/* ── Main Canvas ───────────────────────────────────────── */
.main-canvas {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--bg2);
}

/* ── Views ─────────────────────────────────────────────── */
.view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 0;
}
.view--active {
  opacity: 1;
  pointer-events: auto;
  z-index: 1;
}

/* ── Glass utility ─────────────────────────────────────── */
.glass {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
}

/* ══════════════════════════════════════════════
   SPLASH VIEW
══════════════════════════════════════════════ */
.view--splash { background: #020d1a; align-items: center; justify-content: center; overflow: hidden; }
.splash-bg { position: absolute; inset: 0; pointer-events: none; }
.splash-wave {
  position: absolute; bottom: 0; left: -40%;
  width: 180%; height: 40%; border-radius: 50%;
  background: rgba(15,76,92,0.15);
}
.splash-wave.w1 { animation: wave1 8s ease-in-out infinite; }
.splash-wave.w2 { height: 35%; animation: wave2 10s ease-in-out infinite; background: rgba(42,157,143,0.10); }
.splash-wave.w3 { height: 30%; animation: wave3 12s ease-in-out infinite; background: rgba(0,180,216,0.08); }
@keyframes wave1 { 0%,100%{transform:translateX(0) translateY(0)} 50%{transform:translateX(-3%) translateY(-5%)} }
@keyframes wave2 { 0%,100%{transform:translateX(0)} 50%{transform:translateX(3%)} }
@keyframes wave3 { 0%,100%{transform:translateX(0) translateY(0)} 50%{transform:translateX(-5%) translateY(3%)} }

.splash-content { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 24px; }

.splash-emblem { position: relative; width: 100px; height: 100px; }
.splash-ring {
  position: absolute; border-radius: 50%;
  border: 2px solid rgba(42,157,143,0.3);
  animation: rotate-slow 8s linear infinite;
}
.splash-ring.outer { inset: 0; }
.splash-ring.inner { inset: 14px; animation-direction: reverse; animation-duration: 5s; }
@keyframes rotate-slow { to { transform: rotate(360deg); } }
.splash-shark-icon {
  position: absolute; inset: 20px;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); animation: pulse-icon 3s ease-in-out infinite;
}
@keyframes pulse-icon { 0%,100%{opacity:0.8}50%{opacity:1} }

.splash-brand { color: white; }
.splash-ministry { font-size: 11px; color: rgba(255,255,255,0.5); letter-spacing: 1px; margin-bottom: 6px; }
.splash-title { font-size: 36px; font-weight: 800; letter-spacing: -1px; }
.splash-accent { color: var(--accent2); }
.splash-sub { font-size: 13px; color: rgba(255,255,255,0.5); margin-top: 4px; }

.splash-loader { width: 280px; }
.splash-bar { height: 2px; background: rgba(255,255,255,0.1); border-radius: 1px; overflow: hidden; margin-bottom: 8px; }
.splash-fill { height: 100%; background: var(--accent2); width: 0%; transition: width 0.4s ease; border-radius: 1px; }
.splash-loader-txt { font-size: 11px; color: rgba(255,255,255,0.4); }

.splash-ver { font-size: 10px; color: rgba(255,255,255,0.25); }

.splash-start-btn {
  display: none;
  align-items: center; justify-content: center;
  padding: 14px 52px;
  background: var(--accent);
  border: none; border-radius: 30px;
  color: white;
  font-family: var(--font); font-size: 16px; font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  box-shadow: 0 4px 20px rgba(42,157,143,0.4);
}
.splash-start-btn:hover { background: #23867a; transform: translateY(-2px); }
.splash-start-btn:active { transform: translateY(0); }

/* ══════════════════════════════════════════════
   HOME VIEW
══════════════════════════════════════════════ */
.view--home { overflow-y: auto; padding: 0; }
.home-hero {
  background: var(--primary);
  padding: 36px 40px 32px;
  position: relative;
  overflow: hidden;
}
.home-hero-bg { position: absolute; inset: 0; pointer-events: none; }
.hero-ocean {
  position: absolute;
  bottom: -40px; right: -40px;
  width: 280px; height: 280px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
  font-size: 160px;
  display: flex; align-items: center; justify-content: center;
}
.hero-ocean::after { content: '🌊'; }

.home-hero-content { position: relative; z-index: 1; max-width: 560px; }
.home-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15);
  padding: 4px 12px; border-radius: 20px; margin-bottom: 16px;
}
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; animation: pulse-dot 2s infinite; flex-shrink: 0; }
.home-title { font-size: 32px; font-weight: 800; color: white; letter-spacing: -0.5px; line-height: 1.15; margin-bottom: 12px; }
.gradient-text { background: linear-gradient(90deg,#b3e8f0,#2A9D8F); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; }
.home-desc { font-size: 13.5px; color: rgba(255,255,255,0.65); line-height: 1.6; max-width: 480px; }

.home-stats {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 12px;
  padding: 20px 24px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}
.stat-card--green .stat-card__icon { background: #ecfdf5; }
.stat-card__icon {
  width: 40px; height: 40px;
  background: var(--border);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.stat-card__label { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card__val { font-size: 15px; font-weight: 700; color: var(--text); margin-top: 2px; }

.home-cta-wrap { padding: 0 24px 20px; text-align: center; }
.home-cta-hint { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

.home-srnd-card {
  margin: 0 24px 24px;
  padding: 16px 18px;
  border-radius: var(--radius);
}
.home-srnd-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.home-srnd-badge {
  background: var(--primary); color: white;
  font-size: 10px; font-weight: 800; letter-spacing: 1px;
  padding: 3px 8px; border-radius: 6px;
}
.home-srnd-title { font-size: 13px; font-weight: 700; color: var(--text); }
.home-srnd-features { display: flex; flex-direction: column; gap: 8px; }
.home-srnd-feat {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 12px; color: var(--text-muted); line-height: 1.55;
}
.feat-icon { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.home-srnd-feat strong { color: var(--text); }

/* ══════════════════════════════════════════════
   MODAL SCREEN (Mode, Preview share this)
══════════════════════════════════════════════ */
.modal-screen { display: flex; flex-direction: column; height: 100%; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title { font-size: 15px; font-weight: 700; color: var(--text); }
.modal-body { flex: 1; overflow-y: auto; padding: 24px; }
.modal-hint { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; text-align: center; }

/* ── Mode cards ────────────────────────────────── */
.mode-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.mode-card {
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  display: flex; flex-direction: column; align-items: center;
  text-align: center; cursor: pointer;
  transition: all 0.2s;
  position: relative;
  font-family: var(--font);
}
.mode-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.mode-card__icon { font-size: 36px; margin-bottom: 12px; }
.mode-card__label { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.mode-card__desc { font-size: 11.5px; color: var(--text-muted); line-height: 1.5; }
.mode-badge {
  position: absolute; top: 12px; right: 12px;
  font-size: 9px; font-weight: 700; letter-spacing: 0.5px;
  color: var(--accent); background: #e0f8f5;
  border: 1px solid var(--accent); padding: 2px 8px; border-radius: 20px;
}
.mode-card--disabled { opacity: 0.55; cursor: not-allowed; }
.mode-card--disabled:hover { border-color: var(--border) !important; transform: none !important; box-shadow: none !important; }
.mode-badge--warn { background: #fff3e0 !important; color: #b45309 !important; border-color: var(--warn) !important; }
.mode-privacy {
  font-size: 11px; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
  justify-content: center;
  padding: 10px; background: var(--bg2);
  border-radius: 8px; border: 1px solid var(--border);
}
.mode-privacy svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ══════════════════════════════════════════════
   CAPTURE VIEW
══════════════════════════════════════════════ */
.view--capture { overflow: hidden; }
.capture-layout { display: flex; height: 100%; }
.capture-guide-panel {
  width: 230px; flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--border);
  padding: 18px 16px;
  display: flex; flex-direction: column; gap: 16px;
}
.capture-guide-title { font-size: 12px; font-weight: 700; color: var(--text); text-transform: uppercase; letter-spacing: 0.5px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.capture-guide-list { font-size: 12px; color: var(--text-muted); line-height: 1.6; padding-left: 18px; }
.capture-guide-list li + li { margin-top: 8px; }
.capture-lens-info { margin-top: auto; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 10px; font-size: 11px; color: var(--text); }
.capture-lens-label { display: block; font-size: 9px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 4px; }

.capture-viewport {
  flex: 1; background: #1E1E1E;
  position: relative; overflow: hidden;
  display: flex; flex-direction: column;
}
.camera-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camera-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.camera-top-bar {
  position: absolute; top: 0; left: 0; right: 0;
  padding: 10px 16px;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: space-between;
  z-index: 10;
}
.cam-btn {
  width: 36px; height: 36px; border-radius: 8px;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: white; background: rgba(255,255,255,0.15);
  transition: background 0.15s;
}
.cam-btn:hover { background: rgba(255,255,255,0.25); }
.cam-btn svg { width: 18px; height: 18px; }
.cam-live-badge {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: white; font-weight: 600; letter-spacing: 0.5px;
}
.cam-live-dot { width: 7px; height: 7px; border-radius: 50%; background: #ef4444; animation: pulse-dot 1.2s infinite; }

.camera-guide {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  z-index: 5; pointer-events: none;
}
.guide-frame { position: relative; width: 75%; height: 55%; }
.gc {
  position: absolute; width: 22px; height: 22px;
  border-color: rgba(42,157,143,0.8); border-style: solid;
}
.gc--tl { top:0;left:0; border-width:2px 0 0 2px; }
.gc--tr { top:0;right:0; border-width:2px 2px 0 0; }
.gc--bl { bottom:0;left:0; border-width:0 0 2px 2px; }
.gc--br { bottom:0;right:0; border-width:0 2px 2px 0; }
.guide-hint {
  position: absolute; bottom: -28px; left: 50%; transform: translateX(-50%);
  font-size: 11px; color: rgba(255,255,255,0.7); white-space: nowrap;
  background: rgba(0,0,0,0.4); padding: 3px 10px; border-radius: 20px;
}

.camera-quality-bar {
  position: absolute; top: 52px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.5); border-radius: 8px;
  padding: 6px 14px; display: flex; gap: 16px;
  z-index: 10;
}
.cq-item { display: flex; align-items: center; gap: 8px; font-size: 11px; color: rgba(255,255,255,0.8); }
.cq-meter { width: 60px; height: 4px; background: rgba(255,255,255,0.2); border-radius: 2px; overflow: hidden; }
.cq-fill { height: 100%; background: var(--accent); border-radius: 2px; width: 0%; transition: width 0.3s; }

.camera-controls {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 16px 24px 20px;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: space-between;
  z-index: 10;
}
.btn-capture {
  width: 68px; height: 68px; border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.6);
  background: rgba(255,255,255,0.15);
  cursor: pointer; position: relative;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.btn-capture:hover { background: rgba(255,255,255,0.25); border-color: white; }
.btn-capture:active { transform: scale(0.95); }
.capture-ring {
  position: absolute; inset: 4px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4);
}
.capture-dot {
  width: 40px; height: 40px; border-radius: 50%;
  background: white;
}

.capture-passive-panel {
  width: 220px; flex-shrink: 0;
  background: var(--white); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 24px 16px;
  gap: 8px;
}
.capture-passive-icon { font-size: 32px; opacity: 0.3; }
.capture-passive-title { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.capture-passive-desc { font-size: 11.5px; color: var(--text-muted); line-height: 1.5; }

/* ══════════════════════════════════════════════
   PREVIEW VIEW
══════════════════════════════════════════════ */
.view--preview { overflow: hidden; }
.preview-layout { display: flex; height: 100%; }
.preview-side-panel {
  width: 220px; flex-shrink: 0;
  background: var(--white); border-right: 1px solid var(--border);
  padding: 18px 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.preview-side-title { font-size: 12px; font-weight: 700; color: var(--text); text-transform: uppercase; letter-spacing: 0.5px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.preview-side-desc { font-size: 12px; color: var(--text-muted); line-height: 1.55; }
.preview-meta { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 10px; }
.preview-meta div { margin-top: 4px; }
.pm-label { display: block; font-size: 9px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.pm-val { font-size: 12px; font-weight: 600; color: var(--text); }
.preview-actions { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }

.preview-canvas-area {
  flex: 1; background: #2F3E46;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; position: relative;
}
.preview-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; box-shadow: 0 8px 32px rgba(0,0,0,0.4); }
.preview-overlay {
  position: absolute; inset: 30px;
  border: 1px solid rgba(42,157,143,0.35);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.preview-overlay-tag {
  font-size: 10px; font-weight: 700; color: rgba(42,157,143,0.7);
  letter-spacing: 1px;
}

/* ══════════════════════════════════════════════
   QUALITY VIEW
══════════════════════════════════════════════ */
.view--quality { overflow: hidden; }
.quality-layout { display: flex; height: 100%; }
.quality-side-panel {
  width: 220px; flex-shrink: 0;
  background: var(--white); border-right: 1px solid var(--border);
  padding: 18px 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.quality-side-title { font-size: 12px; font-weight: 700; color: var(--text); text-transform: uppercase; letter-spacing: 0.5px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.quality-side-img-wrap {
  width: 100%; border-radius: 8px; overflow: hidden;
  background: #2F3E46;
  display: flex; align-items: center; justify-content: center;
  height: 110px;
}
.quality-side-img {
  max-width: 100%; max-height: 100%;
  object-fit: contain;
}
.quality-side-desc { font-size: 12px; color: var(--text-muted); line-height: 1.55; }

.quality-main { flex: 1; overflow-y: auto; padding: 24px; display: flex; align-items: flex-start; justify-content: center; }
.quality-card {
  width: 100%; max-width: 560px;
  background: var(--white); border-radius: var(--radius-lg);
  border: 1px solid var(--border); padding: 28px;
  box-shadow: var(--shadow);
}
.quality-card-header { text-align: center; margin-bottom: 24px; }
.quality-card-title { font-size: 16px; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.quality-card-sub { font-size: 12px; color: var(--text-muted); }

.quality-metrics { display: flex; flex-direction: column; gap: 18px; }
.qm-item {}
.qm-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 12px; }
.qm-name { font-weight: 500; color: var(--text); }
.qm-val { font-weight: 700; color: var(--ok); }
.qm-val--warn { color: var(--warn); }
.qm-val--fail { color: var(--danger); }
.qm-bar-bg { width: 100%; height: 7px; background: var(--border); border-radius: 4px; overflow: hidden; }
.qm-bar-fill {
  height: 100%; background: #22c55e; border-radius: 4px;
  width: 0%; transition: width 0.8s cubic-bezier(0.25,1,0.5,1);
}
.qm-bar-fill--teal { background: var(--primary); }

.quality-overall {
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.qo-label { font-size: 13px; font-weight: 600; color: var(--text); }
.qo-score { font-size: 22px; font-weight: 800; color: var(--primary); }

/* ══════════════════════════════════════════════
   PROCESSING VIEW
══════════════════════════════════════════════ */
.view--processing { align-items: center; justify-content: center; background: var(--bg2); }
.processing-center { width: 100%; max-width: 480px; padding: 24px; }
.processing-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 36px 32px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center;
  text-align: center; position: relative; overflow: hidden;
}
.scanner-line {
  position: absolute; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(to right, transparent, var(--accent), transparent);
  box-shadow: 0 0 10px var(--accent);
  animation: scan 2.2s ease-in-out infinite;
  top: 0;
}
@keyframes scan { 0%{top:10%} 50%{top:90%} 100%{top:10%} }

.processing-spinner {
  width: 56px; height: 56px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin-bottom: 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.processing-title { font-size: 17px; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.processing-sub { font-size: 12.5px; color: var(--text-muted); line-height: 1.6; margin-bottom: 24px; max-width: 360px; }

.processing-steps { width: 100%; display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; text-align: left; }
.pstep { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-muted); }
.pstep-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border); flex-shrink: 0; transition: background 0.3s; }
.pstep.active .pstep-dot { background: var(--accent2); box-shadow: 0 0 6px var(--accent2); }
.pstep.done .pstep-dot { background: var(--ok); }
.pstep.active { color: var(--text); font-weight: 600; }
.pstep.done { color: var(--ok); }

.processing-bar-bg { width: 100%; height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; margin-bottom: 16px; }
.processing-bar {
  height: 100%; background: var(--primary);
  border-radius: 2px; width: 0%;
  transition: width 0.5s ease;
}

/* ══════════════════════════════════════════════
   RESULT VIEW
══════════════════════════════════════════════ */
.view--result { overflow: hidden; }
.result-layout { display: flex; height: 100%; }

.result-canvas-area {
  flex: 1; background: #2F3E46;
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.result-canvas { width: 100%; height: 100%; }
.result-canvas-header {
  position: absolute; top: 8px; left: 8px; right: 8px;
  padding: 8px 14px; border-radius: 8px;
  display: flex; align-items: center; gap: 12px;
  font-size: 12px;
}
.result-id { font-family: var(--mono); font-weight: 600; color: var(--primary); font-size: 11px; }
.result-ts { color: var(--text-muted); font-size: 11px; }
.result-mode-badge {
  margin-left: auto; font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  background: var(--accent); color: white;
  padding: 2px 8px; border-radius: 20px;
}

.result-panel {
  width: 320px; flex-shrink: 0;
  border-left: 1px solid var(--border);
  overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}

/* Fusion badge */
.fusion-badge {
  background: linear-gradient(135deg, var(--primary), #145E72);
  border-radius: var(--radius);
  padding: 14px;
  display: flex; align-items: center; gap: 14px;
  color: white;
}
.fusion-badge__score { display: flex; align-items: baseline; gap: 2px; }
.fusion-num { font-size: 36px; font-weight: 800; line-height: 1; }
.fusion-pct { font-size: 16px; font-weight: 600; opacity: 0.7; }
.fusion-tier { font-size: 13px; font-weight: 700; letter-spacing: 0.5px; }
.fusion-tier.tier--confirmed { color: #86efac; }
.fusion-tier.tier--candidate { color: #fde68a; }
.fusion-tier.tier--hidden { color: #fca5a5; }
.fusion-scenario { font-size: 11px; opacity: 0.6; margin-top: 2px; }

/* Species */
.result-species { padding: 10px 0; border-bottom: 1px solid var(--border); }
.species-name { font-size: 15px; font-weight: 700; color: var(--text); }
.species-sci { font-size: 12px; color: var(--text-muted); font-style: italic; margin-top: 2px; }

/* Stats */
.result-stats { display: flex; gap: 8px; }
.rstat { flex: 1; text-align: center; background: var(--bg2); border-radius: 8px; padding: 10px 6px; border: 1px solid var(--border); }
.rstat__val { font-size: 20px; font-weight: 800; color: var(--primary); }
.rstat__label { font-size: 10px; color: var(--text-muted); font-weight: 500; margin-top: 2px; }

/* Specimen box */
.specimen-box { padding: 12px; border-radius: var(--radius); }
.specimen-box__title { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.specimen-type { font-size: 13px; font-weight: 700; color: var(--text); }
.specimen-desc { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; line-height: 1.5; }

/* Threshold notice */
.threshold-notice {
  font-size: 11.5px; color: var(--text-muted);
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px;
  display: flex; gap: 6px;
}

/* Selection */
.sel-section { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.sel-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 10px 12px; background: var(--bg2); border-bottom: 1px solid var(--border);
}
.sel-title { font-size: 12px; font-weight: 700; color: var(--text); }
.sel-count { font-size: 10px; color: var(--text-muted); margin-top: 1px; }
.sel-actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.chip-btn {
  padding: 3px 8px; font-size: 10px; font-weight: 600;
  border: 1px solid var(--border2); border-radius: 6px;
  background: var(--white); color: var(--text-muted);
  cursor: pointer; font-family: var(--font);
  transition: all 0.15s;
}
.chip-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }

.det-cards { padding: 8px; display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.det-card {
  display: flex; align-items: center;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--white);
  transition: all 0.15s; overflow: hidden;
}
.det-card:hover { border-color: var(--border2); }
.det-card.inactive { opacity: 0.45; }
.det-card__body {
  display: flex; align-items: center; gap: 8px;
  flex: 1; padding: 8px 10px; cursor: pointer; min-width: 0;
}
.det-card__cb { width: 16px; height: 16px; border-radius: 4px; border: 2px solid var(--border2); flex-shrink: 0; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
.det-card__cb.checked { background: var(--primary); border-color: var(--primary); }
.det-card__cb.checked::after { content: '✓'; font-size: 10px; color: white; font-weight: 700; }
.det-card__dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.det-card__info { flex: 1; min-width: 0; }
.det-card__label { font-size: 11.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.det-card__type { font-size: 10px; color: var(--text-muted); }
.det-card__conf { font-size: 11px; font-weight: 700; font-family: var(--mono); flex-shrink: 0; min-width: 34px; text-align: right; }
.det-card__conf.conf--confirmed { color: var(--confirmed); }
.det-card__conf.conf--candidate { color: var(--candidate); }
.det-card__actions {
  display: flex; border-left: 1px solid var(--border); flex-shrink: 0;
}
.det-act {
  width: 28px; height: 100%; min-height: 38px;
  border: none; background: transparent; cursor: pointer;
  font-size: 11px; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.det-act--edit:hover { background: var(--bg2); color: var(--primary); }
.det-act--del:hover  { background: #fff5f5; color: var(--danger); }
.det-conf-input {
  width: 44px; font-family: var(--mono); font-size: 11px; font-weight: 700;
  border: 1px solid var(--primary); border-radius: 4px;
  padding: 2px 4px; text-align: right; outline: none;
  color: var(--primary); background: white;
}

.det-empty { text-align: center; padding: 20px; font-size: 12px; color: var(--text-muted); }
.sel-tip { font-size: 10.5px; color: var(--text-muted); padding: 8px 10px; border-top: 1px solid var(--border); line-height: 1.5; }

/* Result actions */
.result-actions { display: flex; gap: 8px; margin-top: auto; }
.result-actions .btn { flex: 1; }

/* ══════════════════════════════════════════════
   REPORT VIEW
══════════════════════════════════════════════ */
.view--report { overflow: hidden; flex-direction: column; }
.report-view { display: flex; flex-direction: column; height: 100%; }
.report-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.report-topbar-title { font-size: 14px; font-weight: 700; color: var(--text); }
.report-scroll { flex: 1; overflow-y: auto; padding: 24px; background: #2F3E46; }
.report-card {
  max-width: 720px; margin: 0 auto;
  background: white;
  border-radius: var(--radius);
  padding: 40px 44px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.3);
}

/* Report sections */
.rpt-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.rpt-header__logo { display: flex; align-items: center; gap: 12px; }
.rpt-shark-icon { font-size: 28px; }
.rpt-ministry { font-size: 13px; font-weight: 700; color: var(--text); }
.rpt-system { font-size: 10.5px; color: var(--text-muted); }
.rpt-qr { width: 80px; height: 80px; background: var(--text); border-radius: 4px; display: flex; align-items: center; justify-content: center; color: white; font-size: 10px; font-weight: 700; }

.rpt-divider { height: 1px; background: var(--border); margin: 18px 0; }

.rpt-meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rmi { }
.rmi-label { display: block; font-size: 9px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.rmi-val { font-size: 12.5px; font-weight: 600; color: var(--text); margin-top: 2px; display: block; }
.rmi-val--hi { color: var(--ok); }

.rpt-section { margin-bottom: 4px; }
.rpt-section-title { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; }

.rpt-fusion-grid { display: flex; gap: 20px; align-items: flex-start; }
.rpt-fusion-score-box { text-align: center; flex-shrink: 0; }
.rpt-fusion-num { display: block; font-size: 40px; font-weight: 800; color: var(--primary); line-height: 1; }
.rpt-fusion-tier { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.5px; margin-top: 4px; color: var(--ok); }
.rpt-fusion-rows { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.rfr { display: flex; justify-content: space-between; font-size: 12px; padding: 3px 0; border-bottom: 1px solid var(--border); }
.rfr span:first-child { color: var(--text-muted); }
.rfr span:last-child { font-weight: 600; color: var(--text); }

.rpt-fields { display: flex; flex-direction: column; gap: 6px; }
.rpt-field { display: flex; justify-content: space-between; font-size: 12px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.rpt-field span:first-child { color: var(--text-muted); }
.rpt-field span:last-child { font-weight: 600; color: var(--text); }
.rpt-italic { font-style: italic; }
.rpt-cites { color: var(--warn); font-weight: 700; }

.rpt-analysis-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 8px; }
.rpt-img-wrap { display: flex; flex-direction: column; gap: 6px; }
.rpt-img-container {
  height: 210px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; padding: 8px;
}
.rpt-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.rpt-img-label { font-size: 10px; color: var(--text-muted); text-align: center; }

.det-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.det-table th { text-align: left; padding: 6px 8px; font-size: 9px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid var(--border); }
.det-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); color: var(--text); }
.det-table tr:last-child td { border-bottom: none; }

.rpt-sum-row { display: flex; gap: 16px; margin-top: 8px; }
.rpt-sum { font-size: 11px; }
.rpt-sum span:first-child { color: var(--text-muted); }
.rpt-sum span:last-child { font-weight: 700; color: var(--text); margin-left: 4px; }

.rpt-validator-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.rv-field { }
.rv-label { display: block; font-size: 10px; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.3px; }
.rv-line { height: 1px; background: var(--text); width: 100%; margin-bottom: 4px; }
.rv-sig { grid-column: 1/-1; }
.rv-box { height: 80px; border: 1px solid var(--border); border-radius: 6px; }

/* Officer select controls */
.rv-officer-ctrl { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.rv-select { flex: 1; padding: 9px 12px; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 13px; font-family: inherit; cursor: pointer; }
.rv-select:focus { outline: none; border-color: var(--accent); }
.rv-data { min-height: 28px; padding: 4px 0; font-size: 13px; color: var(--text); border-bottom: 1px dashed var(--border); }
.rv-data:empty::before { content: '—'; color: var(--text-muted); font-style: italic; }

/* Add Officer Modal */
.officer-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 9000; display: flex; align-items: center; justify-content: center; }
.officer-modal-inner { width: min(420px, 92vw); padding: 24px; border-radius: 14px; }
.officer-modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.officer-modal-header h3 { font-size: 16px; font-weight: 700; color: var(--text); margin: 0; }
.officer-modal-close { background: none; border: none; font-size: 16px; cursor: pointer; color: var(--text-muted); padding: 4px 8px; border-radius: 4px; line-height: 1; }
.officer-modal-close:hover { background: var(--bg2); color: var(--text); }
.officer-modal-body { display: flex; flex-direction: column; gap: 16px; margin-bottom: 20px; }
.officer-modal-footer { display: flex; gap: 10px; justify-content: flex-end; }
.om-field { display: flex; flex-direction: column; gap: 6px; }
.om-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); }
.om-input { padding: 10px 12px; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 13px; font-family: inherit; transition: border-color 0.15s; }
.om-input:focus { outline: none; border-color: var(--accent); }
.om-lokasi-row { display: flex; gap: 8px; align-items: stretch; }
.om-lokasi-row .om-input { flex: 1; }
.om-gps-btn { padding: 0 12px; font-size: 16px; flex-shrink: 0; }

.rpt-disclaimer { font-size: 10px; color: var(--text-muted); line-height: 1.6; }
.rpt-disclaimer p + p { margin-top: 6px; }
.rpt-disclaimer-footer { margin-top: 10px; text-align: center; opacity: 0.6; }

/* ══════════════════════════════════════════════
   ERROR VIEW
══════════════════════════════════════════════ */
.view--error { align-items: center; justify-content: center; }
.error-center { text-align: center; max-width: 360px; padding: 24px; }
.error-icon { font-size: 56px; margin-bottom: 16px; }
.error-title { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.error-msg { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; line-height: 1.6; }
.error-code { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.error-code code { font-family: var(--mono); font-size: 12px; color: var(--danger); }
.error-actions { display: flex; gap: 12px; justify-content: center; }

/* ══════════════════════════════════════════════
   RIGHT PANEL — Fusion Calculator
══════════════════════════════════════════════ */
.right-panel {
  width: var(--rp-w);
  background: var(--white);
  border-left: 1px solid var(--border);
  flex-shrink: 0;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex; flex-direction: column; gap: 14px;
}
.rp-section { }
.rp-title { font-size: 10px; font-weight: 700; color: var(--text-muted); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 4px; }
.rp-desc { font-size: 11.5px; color: var(--text-muted); line-height: 1.5; }

.rp-scores { display: flex; flex-direction: column; gap: 10px; }
.rp-score-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px;
}
.rp-score-label { font-size: 11.5px; font-weight: 600; color: var(--text); white-space: nowrap; width: 90px; flex-shrink: 0; }
.rp-score-bar-wrap { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.rp-score-bar { height: 100%; border-radius: 3px; width: 0%; transition: width 0.6s cubic-bezier(0.25,1,0.5,1); }
.rp-score-bar--body { background: var(--primary); }
.rp-score-bar--fin  { background: var(--accent); }
.rp-score-pct { font-size: 12px; font-weight: 700; color: var(--primary); font-family: var(--mono); width: 28px; text-align: right; flex-shrink: 0; }

.rp-info-note {
  font-size: 10.5px; color: var(--text-muted); line-height: 1.55;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; text-align: center;
}

.rp-chart-wrap {
  position: relative;
  height: 200px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.rp-chart-center {
  position: absolute;
  inset: 0; top: 12px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  pointer-events: none;
}
.rp-chart-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.rp-chart-score { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1.1; }
.rp-chart-badge {
  font-size: 9px; font-weight: 700; letter-spacing: 0.5px;
  padding: 2px 8px; border-radius: 20px; margin-top: 4px;
  background: var(--ok); color: white;
}
.rp-chart-badge.warn { background: var(--warn); }
.rp-chart-badge.danger { background: var(--danger); }

.rp-tiers { display: flex; gap: 4px; }
.rp-tier {
  flex: 1; text-align: center; padding: 6px 4px;
  border-radius: 6px; border: 1px solid;
}
.rp-tier--red { background: #fff5f5; border-color: #fca5a5; }
.rp-tier--amber { background: #fffbeb; border-color: #fde68a; }
.rp-tier--green { background: #f0fdf4; border-color: #86efac; }
.rp-tier-label { display: block; font-size: 8.5px; font-weight: 700; letter-spacing: 0.3px; color: var(--text); }
.rp-tier-range { display: block; font-size: 9px; color: var(--text-muted); margin-top: 2px; }
.rp-tier--red .rp-tier-label { color: var(--danger); }
.rp-tier--amber .rp-tier-label { color: #d97706; }
.rp-tier--green .rp-tier-label { color: var(--ok); }

.rp-formula {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; text-align: center;
}
.rp-formula code { font-family: var(--mono); font-size: 11px; color: var(--primary); }

.rp-legal {
  background: rgba(42,157,143,0.05); border: 1px solid rgba(42,157,143,0.2);
  border-radius: 8px; padding: 10px;
}
.rp-legal-title { display: block; font-size: 9px; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.rp-legal p { font-size: 10.5px; color: var(--text-muted); line-height: 1.55; }

/* ══════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 18px; height: 38px;
  border-radius: 8px; border: none;
  font-family: var(--font); font-weight: 600; font-size: 13px;
  cursor: pointer; text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn--primary { background: var(--primary); color: white; }
.btn--primary:hover { background: var(--primary-dk); }
.btn--primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn--ghost { background: transparent; color: var(--primary); border: 1.5px solid var(--border2); }
.btn--ghost:hover { background: var(--bg2); }
.btn--xl { height: 52px; padding: 0 32px; font-size: 15px; border-radius: 10px; }
.btn--sm { height: 32px; padding: 0 14px; font-size: 12px; }
.btn--xs { height: 26px; padding: 0 12px; font-size: 11px; }
.btn--full { width: 100%; }
.btn svg { width: 16px; height: 16px; }
.btn--xl svg { width: 20px; height: 20px; }
.btn-back {
  width: 34px; height: 34px; border-radius: 8px;
  border: 1.5px solid var(--border2); background: transparent;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--primary); transition: all 0.15s;
}
.btn-back:hover { background: var(--bg2); }
.btn-back svg { width: 18px; height: 18px; }

/* ══════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════ */
.toast-container {
  position: fixed; bottom: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 9999;
}
.toast {
  padding: 10px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  animation: toast-in 0.3s ease;
  max-width: 340px;
}
@keyframes toast-in { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:translateY(0)} }
.toast--success { background: var(--primary); color: white; }
.toast--error   { background: var(--danger); color: white; }
.toast--warn    { background: var(--warn); color: white; }
.toast--info    { background: #1e293b; color: white; }

/* ══════════════════════════════════════════════
   PRINT STYLES
══════════════════════════════════════════════ */
.no-print { }

@media print {
  .no-print { display: none !important; }
  .titlebar, .sidebar, .right-panel, .report-topbar { display: none !important; }
  .workspace { display: block !important; height: auto !important; overflow: visible !important; }
  .main-canvas { display: block !important; overflow: visible !important; height: auto !important; position: static !important; }
  .view { position: static !important; opacity: 1 !important; pointer-events: auto !important; z-index: auto !important; overflow: visible !important; }
  .view:not(.view--active) { display: none !important; }
  .view--report { display: flex !important; flex-direction: column !important; }
  .report-view { height: auto !important; }
  .report-scroll { overflow: visible !important; background: white !important; padding: 0 !important; flex: none !important; }
  .report-card { box-shadow: none !important; padding: 20px !important; max-width: 100% !important; }
  .rpt-img-container { height: 210px !important; page-break-inside: avoid; }
  .rpt-analysis-grid { page-break-inside: avoid; }
  .rpt-section { page-break-inside: avoid; }
}

/* ══════════════════════════════════════════════
   QUALITY MOBILE BAR — hidden on desktop
══════════════════════════════════════════════ */
.quality-mobile-bar { display: none; }
.mode-badge--native  { background: #e0f2fe; color: #0369a1; border-color: #7dd3fc; }
.mode-badge--gallery { background: #fef3c7; color: #92400e; border-color: #fcd34d; }

/* ══════════════════════════════════════════════
   GALLERY VIEW
══════════════════════════════════════════════ */
.view--gallery { display: flex; flex-direction: column; overflow: hidden; padding: 0; }

.gallery-topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; flex-shrink: 0;
  background: var(--white);
  border-bottom: 1px solid var(--border);
}
.gallery-topbar-info { flex: 1; min-width: 0; }
.gallery-title { font-size: 15px; font-weight: 700; color: var(--text); }
.gallery-count { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

/* Filter tabs — horizontal scroll */
.gallery-filters {
  display: flex; gap: 6px;
  padding: 8px 14px;
  overflow-x: auto; flex-shrink: 0;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.gallery-filters::-webkit-scrollbar { display: none; }
.gallery-filter {
  flex-shrink: 0;
  padding: 5px 14px; border-radius: 20px;
  border: 1px solid var(--border2);
  background: var(--white); color: var(--text-muted);
  font-size: 12px; font-weight: 600; cursor: pointer;
  white-space: nowrap; transition: all 0.15s;
  font-family: var(--font);
}
.gallery-filter--active {
  background: var(--primary); color: white; border-color: var(--primary);
}
.gallery-filter:hover:not(.gallery-filter--active) {
  background: var(--bg2); color: var(--text);
}

/* Grid gambar */
.gallery-grid {
  flex: 1; overflow-y: auto;
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 3px; padding: 3px;
  background: var(--bg2);
  -webkit-overflow-scrolling: touch;
}
.gallery-tile {
  /* Tidak pakai aspect-ratio: 1 karena tidak bekerja di grid dalam flex-overflow:hidden.
     Pakai teknik ::before padding-bottom: 100% yang selalu andal di semua browser. */
  overflow: hidden;
  border: none; padding: 0; margin: 0;
  background: var(--border); cursor: pointer;
  position: relative; display: block;
  transition: opacity 0.15s;
}
/* Trick kotak: padding-bottom 100% dari LEBAR tile → tinggi = lebar → persegi */
.gallery-tile::before {
  content: '';
  display: block;
  padding-bottom: 100%;
}
.gallery-tile:hover  { opacity: 0.85; }
.gallery-tile:active { opacity: 0.65; }
.gallery-tile img {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  transition: opacity 0.3s;
}
/* Lazy load fade-in */
.gallery-tile img[data-src] { opacity: 0; }
.gallery-tile--loaded img   { opacity: 1; }
/* Selected indicator */
.gallery-tile--active::after {
  content: '✓';
  position: absolute; inset: 0;
  background: rgba(42,157,143,0.55);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; color: white; font-weight: 800;
}
.gallery-placeholder {
  grid-column: 1/-1; text-align: center;
  padding: 60px 20px; color: var(--text-muted); font-size: 14px;
}
.gallery-empty {
  grid-column: 1/-1; text-align: center;
  padding: 40px 20px; color: var(--text-muted); font-size: 13px;
}

/* ══════════════════════════════════════════════
   RESPONSIVE — Mobile (≤ 900px)
══════════════════════════════════════════════ */
@media (max-width: 900px) {

  /* ══ LAYOUT SKELETON ══════════════════════════════════════════ */
  .sidebar     { display: none !important; }
  .right-panel { display: none !important; }

  .titlebar { padding: 0 14px; height: 48px; flex-shrink: 0; }
  .titlebar__sep,
  .titlebar__version,
  .titlebar__unit { display: none; }
  .titlebar__app   { font-size: 13px; font-weight: 700; }
  .titlebar__badge { font-size: 9px; padding: 2px 6px; }
  #titlebarStatusText { font-size: 11px; }

  /* Workspace: tepat di bawah titlebar, tidak ada scroll horizontal */
  .workspace   { height: calc(100dvh - 48px); overflow: hidden; }
  .main-canvas { width: 100% !important; height: 100% !important; overflow: hidden; }

  /* Views: scroll vertikal, tidak ada overflow horizontal */
  .view {
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    max-width: 100vw;
  }

  /* ══ SPLASH ══════════════════════════════════════════════════ */
  /* Sembunyikan animasi wave di splash (hemat performa) */
  .splash-bg        { display: none !important; }
  .splash-content   { padding: 48px 24px 56px; gap: 20px; }
  .splash-emblem    { width: 80px; height: 80px; }
  .splash-title     { font-size: 26px; }
  .splash-sub       { font-size: 13px; }
  .splash-ver       { font-size: 10px; }
  .splash-start-btn { font-size: 16px; padding: 14px 40px; width: 100%; max-width: 280px; border-radius: 14px; }

  /* ══ HOME ════════════════════════════════════════════════════ */
  /* Sembunyikan dekorasi wave emoji di hero */
  .hero-ocean       { display: none !important; }
  .home-hero        { padding: 20px 16px 18px; }
  .home-badge       { font-size: 11px; padding: 3px 10px; margin-bottom: 10px; }
  .home-title       { font-size: 22px; margin-bottom: 8px; }
  .home-desc        { font-size: 12px; line-height: 1.5; }
  /* Stats: 3 kolom kompak */
  .home-stats       { grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 12px 14px; }
  .stat-card        { padding: 10px 8px; gap: 8px; flex-direction: column; align-items: flex-start; }
  .stat-card__icon  { width: 28px; height: 28px; font-size: 14px; border-radius: 6px; }
  .stat-card__label { font-size: 8px; }
  .stat-card__val   { font-size: 11px; font-weight: 700; }
  /* CTA button */
  .home-cta-wrap    { padding: 4px 14px 16px; }
  .home-cta-wrap .btn--xl { width: 100%; padding: 16px; font-size: 15px; justify-content: center; border-radius: 14px; }
  .home-cta-hint    { font-size: 11px; }
  /* SRND card */
  .home-srnd-card   { margin: 0 14px 80px; padding: 14px; }
  .home-srnd-title  { font-size: 12px; }
  .home-srnd-feat   { font-size: 11px; gap: 8px; }
  .feat-icon        { font-size: 13px; }

  /* ══ MODE SELECT ═════════════════════════════════════════════ */
  .modal-screen   { height: 100%; }
  .modal-header   { padding: 14px 16px; }
  .modal-body     { padding: 16px 14px 80px; }
  .modal-hint     { font-size: 12px; margin-bottom: 14px; }
  .mode-cards     { grid-template-columns: 1fr; gap: 10px; }
  .mode-card      {
    padding: 16px 14px; flex-direction: row;
    align-items: center; gap: 14px; text-align: left;
    width: 100%; box-sizing: border-box;
  }
  .mode-card__icon  { font-size: 28px; flex-shrink: 0; }
  .mode-card__label { font-size: 14px; }
  .mode-card__desc  { font-size: 11px; }
  .mode-badge       { position: static; margin-bottom: 4px; align-self: flex-start; font-size: 10px; }
  .mode-privacy     { font-size: 11px; margin-top: 14px; }
  .mode-card--disabled { opacity: 0.5; }
  .mode-badge--warn   { background: var(--warn) !important; color: white !important; }
  .mode-badge--native { background: #e0f2fe !important; color: #0369a1 !important; border-color: #7dd3fc !important; }

  /* ══ CAPTURE — Fullscreen seperti kamera native ══════════════ */
  .capture-guide-panel   { display: none !important; }
  .capture-passive-panel { display: none !important; }

  /* View dan layout tidak perlu layout khusus — viewport yang fullscreen */
  .view--capture  { overflow: hidden; padding: 0; }
  .capture-layout { height: 100%; width: 100%; }

  /* Kamera viewport: cover seluruh layar (termasuk titlebar) */
  .capture-viewport {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    z-index: 500;
    border-radius: 0 !important;
  }
  /* Video & canvas sudah position:absolute inset:0 — otomatis ikut fullscreen */

  /* Controls di bawah — ukuran lebih besar untuk jari */
  .camera-controls {
    padding: 16px 24px max(24px, env(safe-area-inset-bottom));
  }
  .btn-capture { width: 76px; height: 76px; }
  .capture-dot { width: 46px; height: 46px; }

  /* Tombol atas (back + flip) lebih besar */
  .cam-btn { width: 44px; height: 44px; }

  /* ══ QUALITY ═════════════════════════════════════════════════ */
  .quality-side-panel { display: none !important; }

  /* Action bar sticky di atas */
  .quality-mobile-bar {
    display: flex; gap: 10px;
    padding: 12px 14px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 10;
    flex-shrink: 0;
  }
  .quality-mobile-bar .btn { flex: 1; padding: 12px 8px; font-size: 13px; min-height: 46px; }

  /* Layout: kolom, scroll main area */
  .view--quality    { display: flex; flex-direction: column; overflow: hidden; }
  .quality-layout   { flex: 1; overflow-y: auto; overflow-x: hidden; }

  /* Main area: block (bukan flex) agar kartu selalu penuh lebar */
  .quality-main {
    display: block;
    padding: 14px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  /* Kartu kualitas: full width, tidak ada max-width */
  .quality-card {
    width: 100%;
    max-width: 100%;
    padding: 14px;
    box-sizing: border-box;
  }
  .quality-card-header { margin-bottom: 16px; }
  .quality-card-title  { font-size: 14px; }
  .quality-card-sub    { font-size: 11px; }
  .quality-metrics     { gap: 14px; }
  .qm-header           { flex-wrap: wrap; gap: 4px; }
  .qm-name             { font-size: 11px; flex: 1; min-width: 0; }
  .qm-val              { font-size: 12px; white-space: nowrap; }
  .quality-overall     { padding: 12px; border-radius: 8px; margin-top: 12px; }
  .qo-label            { font-size: 12px; }
  .qo-score            { font-size: 20px; }

  /* ══ PROCESSING ═══════════════════════════════════════════════ */
  .view--processing  { display: flex; align-items: center; justify-content: center; min-height: 100%; }
  .processing-center { padding: 20px 14px; width: 100%; max-width: 100%; }
  .processing-card   { padding: 28px 18px; }
  .processing-title  { font-size: 15px; }
  .processing-sub    { font-size: 12px; }
  .processing-bar-bg { margin-top: 16px; }
  .pstep             { font-size: 12px; }
  .pstep-dot         { width: 8px; height: 8px; flex-shrink: 0; }

  /* ══ RESULT ═══════════════════════════════════════════════════ */
  .view--result {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .result-layout {
    display: flex;
    flex: 1;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    height: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 80px; /* ruang untuk action bar */
  }
  /* Canvas: tinggi proporsional portrait */
  .result-canvas-area {
    width: 100% !important;
    height: 56vw;
    min-height: 180px;
    max-height: 320px;
    flex-shrink: 0;
  }
  /* Panel info di bawah canvas */
  .result-panel {
    width: 100% !important;
    max-width: 100%;
    flex-shrink: 0;
    overflow-y: visible;
    overflow-x: hidden;
    padding: 12px 14px 14px;
    border-left: none;
    border-top: 1px solid var(--border);
    box-sizing: border-box;
  }
  .fusion-badge  { padding: 10px 12px; flex-wrap: wrap; gap: 8px; }
  .fusion-num    { font-size: 26px; }
  .det-card      { padding: 10px 10px; }
  .det-card__conf { white-space: nowrap; }

  /* Action bar fixed di bawah */
  .result-actions {
    position: fixed; bottom: 0; left: 0; right: 0;
    padding: 10px 14px max(14px, env(safe-area-inset-bottom));
    background: var(--white);
    border-top: 1px solid var(--border);
    display: flex; gap: 8px;
    z-index: 30;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
  }
  .result-actions .btn { flex: 1; padding: 13px 6px; font-size: 13px; min-height: 46px; }

  /* ══ GALLERY ═════════════════════════════════════════════════ */
  .gallery-grid   { grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 2px; }
  .gallery-topbar { padding: 10px 14px; }
  .gallery-title  { font-size: 14px; }
  .gallery-filter { font-size: 11px; padding: 5px 12px; }

  /* ══ REPORT ═══════════════════════════════════════════════════ */
  .view--report  { overflow-y: auto; }
  .report-view   { flex-direction: column; min-height: 100%; }
  .report-topbar {
    padding: 10px 12px; gap: 6px; flex-wrap: wrap;
    position: sticky; top: 0; z-index: 10;
    background: var(--white);
    border-bottom: 1px solid var(--border);
  }
  .report-topbar .btn   { padding: 10px 12px; font-size: 12px; }
  .report-scroll        { padding: 12px 12px 60px; flex: 1; }
  .report-card          { padding: 16px 12px; border-radius: 10px; max-width: 100%; }
  .rpt-header           { flex-direction: column; gap: 10px; }
  .rpt-analysis-grid    { grid-template-columns: 1fr; }
  .rpt-validator-grid   { grid-template-columns: 1fr; }
  .rv-officer-ctrl      { flex-direction: column; }
  .rv-select            { width: 100%; }
  .rpt-table th,
  .rpt-table td         { font-size: 10px; padding: 6px 4px; }

  /* ══ TOAST — atas layar ═══════════════════════════════════════ */
  .toast-container {
    bottom: auto; top: 54px;
    left: 10px; right: 10px;
    align-items: stretch;
  }
  .toast { max-width: 100%; font-size: 13px; }

  /* ══ OFFICER MODAL ════════════════════════════════════════════ */
  .officer-modal-inner { width: 96vw; padding: 18px 14px; }

  /* ══ MISC ══════════════════════════════════════════════════════ */
  .glass { backdrop-filter: none; -webkit-backdrop-filter: none; }
}

/* ══ LANDSCAPE saat kamera aktif: biarkan fullscreen, jangan dipotong ══════ */
@media (max-width: 900px) and (orientation: landscape) {
  /* Workspace dan view tidak berubah — capture-viewport sudah fixed fullscreen */
  .workspace { height: calc(100dvh - 48px); }
}
