/* ═══════════════════════════════════════════
   SAVIS App Styles
   Premium corporate, mobile-first, clean
   ═══════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green-900: #1B4332;
  --green-700: #2D6A4F;
  --green-600: #357A5B;
  --green-500: #40916C;
  --green-300: #74C69D;
  --green-200: #A7DDB8;
  --green-100: #D8F3DC;
  --green-50: #EDF7EE;
  --cream: #FEFAE0;
  --text: #1F2937;
  --text-secondary: #4B5563;
  --text-muted: #6B7280;
  --border: #E5E7EB;
  --bg: #F9FAFB;
  --card-bg: #ffffff;
  --header-bg: rgba(249,250,251,0.92);
  --white: #ffffff;
  --danger: #DC2626;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Outfit', var(--font);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html { height: 100%; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Dark Mode */
html.dark {
  --bg: #111827;
  --card-bg: #1F2937;
  --header-bg: rgba(17,24,39,0.92);
  --text: #F3F4F6;
  --text-secondary: #D1D5DB;
  --text-muted: #9CA3AF;
  --border: #374151;
  --white: #1F2937;
  --green-50: #1a2e1a;
}

/* View System */
.view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
}

.view.active {
  opacity: 1;
  pointer-events: auto;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--header-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 10;
  min-height: 56px;
  flex-shrink: 0;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: var(--green-700);
  text-decoration: none;
}

html.dark .header-brand { color: var(--green-300); }

.header-logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
}

.header-right { display: flex; align-items: center; gap: 8px; }

.header-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.icon-btn:hover { background: rgba(0,0,0,0.05); }
html.dark .icon-btn:hover { background: rgba(255,255,255,0.06); }

/* Help Button (header, labeled) */
.btn-help-header {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1.5px solid var(--green-200);
  border-radius: 100px;
  background: var(--green-50);
  color: var(--green-700);
  cursor: pointer;
  padding: 8px 16px 8px 12px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
  min-height: 40px;
  -webkit-tap-highlight-color: transparent;
}

.btn-help-header:hover { background: var(--green-100); }
.btn-help-header:active { transform: scale(0.97); }
html.dark .btn-help-header { background: rgba(45,106,79,0.15); border-color: rgba(45,106,79,0.3); color: var(--green-300); }
html.dark .btn-help-header:hover { background: rgba(45,106,79,0.25); }

/* Labeled header buttons (Simpan, Hapus) */
.btn-label-header {
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 7px 14px 7px 10px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
  min-height: 38px;
  -webkit-tap-highlight-color: transparent;
}

.btn-label-header:hover { background: rgba(0,0,0,0.04); }
.btn-label-header:active { transform: scale(0.97); }
.btn-label-header[disabled] { opacity: 0.4; pointer-events: none; }

html.dark .btn-label-header { border-color: var(--border); color: var(--text-muted); }
html.dark .btn-label-header:hover { background: rgba(255,255,255,0.06); }

/* Saved state */
.btn-label-header.saved { color: var(--green-500); border-color: var(--green-300); }
.btn-label-header.saved svg { display: none; }
.btn-label-header.saved span { font-weight: 700; }
.btn-label-header.saved::before { content: '\2713'; font-size: 16px; font-weight: 800; }

/* Danger variant (Hapus) */
.btn-label-danger { color: var(--danger); border-color: rgba(220,38,38,0.25); }
.btn-label-danger:hover { background: rgba(220,38,38,0.06); }
html.dark .btn-label-danger { color: #FCA5A5; border-color: rgba(220,38,38,0.2); }
html.dark .btn-label-danger:hover { background: rgba(220,38,38,0.1); }

/* Model Status */
.model-status {
  font-size: 13px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 100px;
  white-space: nowrap;
}

.status-idle { background: rgba(0,0,0,0.05); color: var(--text-muted); }
.status-loading { background: #FEF3C7; color: #92400E; animation: pulse 1.5s infinite; }
.status-ready { background: var(--green-100); color: var(--green-900); }
.status-error { background: #FEE2E2; color: #991B1B; }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.65; } }

/* Progress */
.progress-container {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.progress-container.hidden { display: none; }

.progress-label {
  width: 100%;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.progress-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 100px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--green-500), var(--green-300));
  border-radius: 100px;
  transition: width 0.3s;
}

.progress-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--green-700);
  min-width: 40px;
  text-align: right;
}

/* Camera */
.camera-section {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  background: #0f1419;
}

.camera-section.hidden { display: none; }

.camera-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}

#camera-feed {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-guide {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  pointer-events: none;
}

.camera-frame {
  width: min(65%, 280px);
  aspect-ratio: 1;
  border: 2px solid rgba(255,255,255,0.25);
  border-radius: 16px;
}

.camera-hint {
  font-size: 15px;
  color: rgba(255,255,255,0.6);
  font-weight: 500;
}

/* Upload Zone */
.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100% - 48px);
  max-width: 360px;
  padding: 40px 24px;
  border: 2px dashed rgba(255,255,255,0.2);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: 0.2s;
  background: rgba(255,255,255,0.03);
}

.upload-zone.drag-over { border-color: var(--green-300); background: rgba(116,198,157,0.08); }
.upload-icon-svg { stroke: rgba(255,255,255,0.4); margin-bottom: 4px; }
.upload-title { font-size: 18px; font-weight: 600; color: rgba(255,255,255,0.9); }
.upload-hint { font-size: 15px; color: rgba(255,255,255,0.5); text-align: center; line-height: 1.5; }

/* Scan Actions */
.scan-actions {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 12px 24px calc(12px + var(--safe-bottom));
  background: var(--header-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.btn-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 20px;
  min-height: 48px;
  border-radius: 12px;
  transition: 0.2s;
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
}

.btn-action:hover { background: rgba(0,0,0,0.04); color: var(--text); }
html.dark .btn-action:hover { background: rgba(255,255,255,0.04); }

.btn-capture {
  position: relative;
  width: 68px;
  height: 68px;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.capture-ring {
  position: absolute;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 3px solid var(--green-700);
  transition: all 0.3s;
}

.capture-dot {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--green-700);
  transition: transform 0.15s;
}

.btn-capture:hover .capture-ring { border-color: var(--green-500); }
.btn-capture:active .capture-dot { transform: scale(0.88); }
.btn-capture[disabled] { opacity: 0.4; pointer-events: none; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* Results */
.results-wrapper {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--safe-bottom);
}

.result-canvas {
  display: block;
  width: 100%;
  max-height: 45vh;
  object-fit: contain;
  background: #0f1419;
}

.result-canvas.hidden { display: none; }

.results-container { padding: 16px; }

.processing-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 200px;
  color: var(--text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--green-500);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.text-small { font-size: 14px; color: var(--text-muted); }

/* Results Panel */
.results-panel { display: flex; flex-direction: column; gap: 14px; }

.results-summary {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--text-muted);
}

.results-count { font-weight: 600; }

.results-empty {
  text-align: center;
  padding: 32px 16px;
}

.empty-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }

/* Result Card */
.result-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  border-left: 4px solid var(--card-accent, var(--green-700));
}

.result-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px;
  gap: 12px;
}

.result-card-title h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.detect-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-green { background: var(--green-100); color: var(--green-900); }
.badge-warning { background: #FEF3C7; color: #92400E; }

.result-card-meta { text-align: right; flex-shrink: 0; }

.result-confidence {
  display: block;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--green-700);
}

html.dark .result-confidence { color: var(--green-300); }

.result-det-count { font-size: 13px; color: var(--text-muted); }

/* Tabs */
.result-tabs {
  display: flex;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 14px 4px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: 0.2s;
  position: relative;
  min-height: 48px;
  -webkit-tap-highlight-color: transparent;
}

.tab-btn.active { color: var(--green-700); }
html.dark .tab-btn.active { color: var(--green-300); }

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 16%;
  right: 16%;
  height: 2px;
  background: var(--green-500);
  border-radius: 2px;
}

.result-tab-content { padding: 16px; }

/* Tab Body */
.tab-body { font-size: 14px; line-height: 1.7; color: var(--text); }
.tab-body p { margin-bottom: 10px; }
.tab-summary { font-weight: 500; margin-bottom: 14px !important; }

.symptom-stage { margin-bottom: 14px; }
.symptom-stage h4 { font-size: 14px; font-weight: 700; color: var(--green-700); margin-bottom: 3px; }
html.dark .symptom-stage h4 { color: var(--green-300); }
.symptom-stage p { font-size: 14px; color: var(--text-secondary); line-height: 1.6; }

.cause-detail { font-size: 14px; color: var(--text-secondary); line-height: 1.7; margin-bottom: 10px; }

.tab-body h4 { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 8px; margin-top: 4px; }

.rec-list { list-style: none; padding: 0; margin-bottom: 16px; }
.rec-list li {
  position: relative;
  padding: 5px 0 5px 18px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.rec-list li::before { content: ''; position: absolute; left: 4px; top: 12px; width: 6px; height: 6px; border-radius: 50%; background: var(--green-500); }
.rec-list.urgent li::before { background: #F59E0B; }

.fertilizer-badge {
  background: var(--green-50);
  color: var(--green-900);
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 12px;
  border: 1px solid var(--green-100);
}

html.dark .fertilizer-badge { background: rgba(45,106,79,0.2); color: var(--green-200); border-color: rgba(45,106,79,0.3); }

.rec-warning {
  background: #FEF3C7;
  color: #92400E;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.6;
  border: 1px solid #FDE68A;
}

html.dark .rec-warning { background: rgba(245,158,11,0.1); color: #FCD34D; border-color: rgba(245,158,11,0.2); }

/* History */
.history-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
}

.history-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
}

.history-date { font-size: 14px; color: var(--text-muted); margin-bottom: 3px; }
.history-classes { font-size: 14px; font-weight: 500; color: var(--text); }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  text-align: center;
  padding: 24px;
}

/* Info Page */
.info-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(16px + var(--safe-bottom));
}

.info-section { margin-bottom: 28px; }

.info-heading {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.guide-list { display: flex; flex-direction: column; gap: 8px; }

.guide-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.guide-icon { font-size: 22px; flex-shrink: 0; margin-top: 1px; }
.guide-card h4 { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.guide-card p { font-size: 14px; color: var(--text-muted); line-height: 1.5; }

.guide-avoid {
  margin-top: 12px;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: var(--radius);
  padding: 12px 14px;
}

html.dark .guide-avoid { background: rgba(220,38,38,0.08); border-color: rgba(220,38,38,0.15); }

.guide-avoid h4 { font-size: 14px; font-weight: 700; color: #991B1B; margin-bottom: 6px; }
html.dark .guide-avoid h4 { color: #FCA5A5; }
.guide-avoid ul { list-style: none; padding: 0; }
.guide-avoid li { font-size: 14px; color: var(--text-muted); padding: 3px 0 3px 18px; position: relative; line-height: 1.5; }
.guide-avoid li::before { content: ''; position: absolute; left: 2px; top: 11px; width: 6px; height: 6px; border-radius: 50%; background: #EF4444; }

/* Settings */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}

.setting-label { font-size: 14px; font-weight: 500; color: var(--text); display: block; }
.setting-help { font-size: 13px; color: var(--text-muted); display: block; margin-top: 2px; line-height: 1.4; }

.setting-control {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.setting-control input[type=range] {
  width: 100px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 100px;
  outline: none;
}

.setting-control input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--green-500);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.setting-val { font-size: 13px; font-weight: 600; min-width: 30px; text-align: right; color: var(--green-700); }
html.dark .setting-val { color: var(--green-300); }

/* Toggle */
.toggle-wrap { position: relative; width: 44px; height: 26px; flex-shrink: 0; }

.toggle-input { opacity: 0; width: 0; height: 0; position: absolute; }

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 100px;
  cursor: pointer;
  transition: 0.3s;
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: var(--white);
  border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.toggle-input:checked + .toggle-track { background: var(--green-500); }
.toggle-input:checked + .toggle-track::after { transform: translateX(18px); }

/* Info About */
.info-about {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 14px;
  line-height: 1.6;
}

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

.btn-link {
  display: inline-block;
  margin-top: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--green-700);
  text-decoration: none;
}

.btn-link:hover { text-decoration: underline; }
html.dark .btn-link { color: var(--green-300); }

/* Toast */
.toast {
  position: fixed;
  bottom: calc(76px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  padding: 10px 22px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 600;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-info { background: var(--green-900); color: var(--white); }
.toast-success { background: var(--green-700); color: var(--white); }
.toast-error { background: var(--danger); color: var(--white); }

/* Shepherd.js Tour Overrides */
.shepherd-element {
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-lg) !important;
  font-family: var(--font) !important;
}

.shepherd-text {
  font-size: 14px !important;
  line-height: 1.6 !important;
  color: var(--text) !important;
  padding: 16px !important;
}

.shepherd-header {
  padding: 16px 16px 0 !important;
}

.shepherd-title {
  font-family: var(--font-display) !important;
  font-size: 16px !important;
  font-weight: 700 !important;
}

.shepherd-footer {
  padding: 0 16px 16px !important;
}

.shepherd-button {
  border-radius: 100px !important;
  font-family: var(--font) !important;
  font-weight: 600 !important;
  font-size: 13px !important;
  padding: 8px 18px !important;
}

.shepherd-button:not(.shepherd-button-secondary) {
  background: var(--green-700) !important;
}

.shepherd-button-secondary {
  background: transparent !important;
  color: var(--text-muted) !important;
}

.shepherd-modal-overlay-container {
  z-index: 9998 !important;
}

.shepherd-element {
  z-index: 9999 !important;
}

/* Floating Help Button */
.btn-float {
  position: fixed;
  bottom: calc(88px + var(--safe-bottom));
  right: 16px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--green-700);
  color: var(--white);
  box-shadow: 0 4px 14px rgba(45,106,79,0.4);
  cursor: pointer;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s var(--ease);
}

.btn-float:hover { transform: scale(1.1); box-shadow: 0 6px 20px rgba(45,106,79,0.5); }
.btn-float:active { transform: scale(0.95); }

html.dark .btn-float { background: var(--green-500); }

/* Install Banner */
.install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  padding: 14px 16px;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transform: translateY(100%);
  transition: transform 0.4s var(--ease);
  box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
}

.install-banner.show { transform: translateY(0); }

.install-banner-text strong { display: block; font-size: 14px; color: var(--text); }
.install-banner-text span { font-size: 12px; color: var(--text-muted); }

.install-banner-actions { display: flex; gap: 8px; flex-shrink: 0; }

.install-btn {
  border: none;
  background: var(--green-700);
  color: white;
  padding: 8px 20px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font);
  transition: 0.2s;
}

.install-btn:hover { background: var(--green-600); }

.install-dismiss {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font);
}

/* Offline Bar */
.offline-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #92400E;
  color: white;
  text-align: center;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 600;
  z-index: 300;
  transform: translateY(-100%);
  transition: transform 0.3s var(--ease);
}

.offline-bar.show { transform: translateY(0); }

/* Skeleton Loading */
.skeleton-list { display: flex; flex-direction: column; gap: 12px; }

.skeleton-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skeleton-line {
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--border) 25%, rgba(0,0,0,0.04) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

html.dark .skeleton-line {
  background: linear-gradient(90deg, #374151 25%, #4B5563 50%, #374151 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.skeleton-line.w60 { width: 60%; }
.skeleton-line.w80 { width: 80%; }

@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Scan Animation (processing state) */
.scan-animation {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 16px;
}

.scan-leaf {
  width: 100%;
  height: 100%;
  border-radius: 20px;
  background: var(--green-50);
  border: 2px solid var(--green-200);
  display: flex;
  align-items: center;
  justify-content: center;
}

.scan-leaf::before {
  content: '';
  width: 50px;
  height: 60px;
  background: var(--green-300);
  border-radius: 0 50% 50% 0;
  clip-path: polygon(0 50%, 100% 0, 100% 100%);
  opacity: 0.6;
}

html.dark .scan-leaf { background: rgba(45,106,79,0.15); border-color: rgba(45,106,79,0.3); }
html.dark .scan-leaf::before { background: var(--green-500); }

.scan-line {
  position: absolute;
  left: 8px;
  right: 8px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--green-400), transparent);
  border-radius: 100px;
  animation: scanMove 1.8s ease-in-out infinite;
}

@keyframes scanMove {
  0% { top: 10%; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { top: 85%; opacity: 0; }
}

.processing-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

/* Share Button */
.btn-share {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  background: var(--card-bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-share:hover { background: var(--green-50); border-color: var(--green-300); color: var(--green-700); }
html.dark .btn-share:hover { background: rgba(45,106,79,0.15); border-color: var(--green-500); color: var(--green-300); }

/* Disclaimer */
.result-disclaimer {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.6;
  color: #78350F;
}

html.dark .result-disclaimer {
  background: rgba(245,158,11,0.08);
  border-color: rgba(245,158,11,0.15);
  color: #FCD34D;
}

/* Guide Number (replaces emoji icon) */
.guide-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green-700);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 1px;
  font-family: var(--font-display);
}

html.dark .guide-num { background: var(--green-500); }

/* Example Photos Grid */
.guide-examples { margin-top: 20px; }
.guide-examples h4 { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 10px; }

.example-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.example-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.example-img {
  width: 100%;
  height: 100px;
  object-fit: cover;
}

.example-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  padding: 8px 10px 2px;
}

.example-desc {
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 10px 8px;
  line-height: 1.4;
}

/* History Indicators */
.history-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
}

.history-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.history-ok { background: var(--green-500); }
.history-warning { background: #F59E0B; }

/* Welcome Card (inline tour fallback) */
.welcome-card {
  background: var(--green-50);
  border: 1.5px solid var(--green-200);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin: 16px;
  text-align: center;
  animation: fadeSlideUp 0.5s ease-out;
}

.welcome-card h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--green-900);
  margin-bottom: 8px;
}

html.dark .welcome-card { background: rgba(45,106,79,0.12); border-color: rgba(45,106,79,0.25); }
html.dark .welcome-card h3 { color: var(--green-200); }

.welcome-card p { font-size: 15px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 12px; }

.welcome-dismiss {
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  color: var(--green-700);
  cursor: pointer;
  padding: 8px 16px;
  font-family: var(--font);
}

html.dark .welcome-dismiss { color: var(--green-300); }

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Confirm Modal (replaces native confirm) */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.confirm-box {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  padding: 24px;
  max-width: 320px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.25s ease;
}

@keyframes scaleIn { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }

.confirm-box h3 { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.confirm-box p { font-size: 15px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 20px; }

.confirm-actions { display: flex; gap: 10px; }

.confirm-btn {
  flex: 1;
  border: none;
  border-radius: 100px;
  padding: 14px 16px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
  transition: 0.2s;
}

.confirm-cancel { background: var(--border); color: var(--text); }
.confirm-danger { background: var(--danger); color: white; }
.confirm-cancel:hover { background: #D1D5DB; }
.confirm-danger:hover { background: #B91C1C; }

/* Save Button Feedback */
.icon-btn.saved { color: var(--green-500); }
.icon-btn.saved svg { display: none; }
.icon-btn.saved::after {
  content: '\\2713';
  font-size: 20px;
  font-weight: 800;
}

/* Example Images (fix fonts) */
.example-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  padding: 8px 10px 2px;
}

.example-desc {
  font-size: 13px;
  color: var(--text-muted);
  padding: 0 10px 10px;
  line-height: 1.4;
}

/* Progress label ID (download explanation) */
#progress-label {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Responsive */
@media (min-width: 768px) {
  .camera-wrapper { max-width: 640px; margin: 0 auto; }
  .results-container { max-width: 640px; margin: 0 auto; }
  .info-body { max-width: 640px; margin: 0 auto; }
  .history-body { max-width: 640px; margin: 0 auto; }
  .example-grid { grid-template-columns: repeat(4, 1fr); }
  .confirm-box { max-width: 380px; }
}
