:root {
  --background: #021a13;
  --surface: #062e22;
  --surface-variant: #0b3d2f;
  --surface-elevated: #0f4a39;
  --outline: #1b5e48;
  --outline-light: #124535;
  --on-background: #f1f5f9;
  --on-surface: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  --primary: #34d399;
  --primary-hover: #10b981;
  --primary-container: #064e3b;
  --on-primary-container: #d1fae5;
  --positive: #34d399;
  --positive-bg: rgba(52, 211, 153, 0.15);
  --positive-border: rgba(52, 211, 153, 0.3);
  --negative: #f87171;
  --negative-bg: rgba(239, 68, 68, 0.15);
  --negative-border: rgba(239, 68, 68, 0.3);
  --warning: #fbbf24;
  --warning-bg: rgba(251, 191, 36, 0.15);
  --warning-border: rgba(251, 191, 36, 0.3);
  --neutral: #94a3b8;
  --neutral-bg: rgba(148, 163, 184, 0.12);
  --neutral-border: rgba(148, 163, 184, 0.25);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.5);
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { 
  font-family: var(--font-family); 
  background: radial-gradient(circle at top right, #06382a 0%, #021a13 100%); 
  color: var(--on-background); 
  min-height: 100vh; 
  -webkit-font-smoothing: antialiased; 
  padding-bottom: 30px;
}

/* App Bar */
.app-bar { 
  position: sticky; 
  top: 0; 
  width: 100%; 
  height: 60px; 
  background: rgba(6, 46, 34, 0.85); 
  backdrop-filter: blur(12px); 
  -webkit-backdrop-filter: blur(12px); 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  z-index: 100; 
  border-bottom: 1px solid var(--outline-light); 
  padding: 0 16px; 
}
.app-title-group { display: flex; align-items: center; gap: 12px; }
.app-title { text-decoration: none; color: inherit; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 17px; }
.app-actions { display: flex; gap: 8px; align-items: center; }

/* Status Badges & Controls */
.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--radius-full); font-size: 11px; font-weight: 500; }
.status-badge.online { background: var(--positive-bg); color: var(--positive); border: 1px solid var(--positive-border); }
.status-badge.offline { background: var(--negative-bg); color: var(--negative); border: 1px solid var(--negative-border); }
.status-badge.paused { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning-border); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.status-dot.syncing { background: var(--warning); animation: pulse 1.5s infinite; }
.status-dot.synced { background: var(--positive); }
.status-dot.error { background: var(--negative); }

.btn-header-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--radius-sm); background: var(--surface-variant); color: var(--primary); border: 1px solid var(--outline); font-size: 12px; font-weight: 500; cursor: pointer; }
.btn-header-toggle:hover { background: var(--surface-elevated); }

/* Main Content Layout */
.main-content { max-width: 680px; margin: 0 auto; padding: 16px; }

/* Sync Banner */
.sync-banner { margin-bottom: 20px; padding: 14px 16px; border-radius: var(--radius-md); background: rgba(6, 78, 59, 0.4); border: 1px solid var(--positive-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sync-banner h4 { font-size: 14px; font-weight: 600; color: #fff; margin-bottom: 2px; }
.sync-banner p { font-size: 12px; color: var(--text-muted); }

/* Stats Bar */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border: 1px solid var(--outline-light); border-radius: var(--radius-md); padding: 12px; text-align: center; }
.stat-value { font-size: 20px; font-weight: 700; color: #fff; }
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.5px; }

/* Search & Filters */
.search-box { position: relative; margin-bottom: 14px; }
.search-input { width: 100%; padding: 12px 14px 12px 38px; border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--outline); color: var(--on-surface); font-size: 14px; outline: none; transition: border-color 0.2s; }
.search-input:focus { border-color: var(--primary); }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }

.filter-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 16px; scrollbar-width: none; }
.filter-scroll::-webkit-scrollbar { display: none; }
.filter-pill { padding: 6px 14px; border-radius: var(--radius-full); font-size: 12px; font-weight: 500; background: var(--surface); color: var(--text-muted); border: 1px solid var(--outline-light); cursor: pointer; white-space: nowrap; transition: all 0.2s; }
.filter-pill.active { background: var(--primary); color: #021a13; font-weight: 600; border-color: var(--primary); }

/* Plot Cards */
.plot-list { display: flex; flex-direction: column; gap: 10px; }
.plot-card { background: var(--surface); border: 1px solid var(--outline-light); border-radius: var(--radius-md); padding: 14px; cursor: pointer; transition: transform 0.15s, border-color 0.15s; }
.plot-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.plot-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.plot-id-group { display: flex; align-items: center; gap: 8px; }
.plot-num { font-size: 18px; font-weight: 700; color: #fff; }

.pill { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: var(--radius-full); font-size: 11px; font-weight: 600; }
.pill-success { background: var(--positive-bg); color: var(--positive); border: 1px solid var(--positive-border); }
.pill-danger { background: var(--negative-bg); color: var(--negative); border: 1px solid var(--negative-border); }
.pill-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning-border); }
.pill-neutral { background: var(--neutral-bg); color: var(--neutral); border: 1px solid var(--neutral-border); }
.pill-letter { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }

.plot-checks-summary { display: flex; gap: 8px; font-size: 12px; }
.check-item { padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; }
.check-item.pass { background: rgba(52, 211, 153, 0.1); color: var(--positive); }
.check-item.fail { background: rgba(239, 68, 68, 0.1); color: var(--negative); }

.plot-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--outline-light); font-size: 11px; color: var(--text-muted); }
.album-link { display: inline-flex; align-items: center; gap: 4px; color: var(--primary); text-decoration: none; font-weight: 500; }

/* Inspection Form */
.inspect-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.inspect-header h2 { font-size: 22px; font-weight: 700; }

.letter-selection-group { display: flex; gap: 8px; margin-bottom: 20px; }
.letter-chip { flex: 1; text-align: center; padding: 10px 0; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--outline); cursor: pointer; font-weight: 600; font-size: 14px; color: var(--text-muted); transition: all 0.2s; }
.letter-chip.active { background: #2563eb; border-color: #3b82f6; color: #fff; }

.inspect-check-card { background: var(--surface); border: 1px solid var(--outline-light); border-radius: var(--radius-md); padding: 14px; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }
.inspect-check-label { font-size: 14px; font-weight: 500; color: #fff; }
.toggle-switch-group { display: flex; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--outline); }
.toggle-btn { padding: 8px 16px; border: none; background: var(--surface-variant); color: var(--text-muted); font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.toggle-btn.active.pass-toggle { background: var(--positive); color: #021a13; }
.toggle-btn.active.fail-toggle { background: var(--negative); color: #fff; }

.status-preview { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; border-radius: var(--radius-md); font-weight: 600; font-size: 14px; margin: 20px 0; }
.status-preview.passed { background: var(--positive-bg); color: var(--positive); border: 1px solid var(--positive-border); }
.status-preview.failed { background: var(--negative-bg); color: var(--negative); border: 1px solid var(--negative-border); }

/* Photos Gallery & Camera */
.photos-strip { display: flex; gap: 10px; overflow-x: auto; padding: 10px 0; margin-bottom: 16px; }
.photo-thumb { position: relative; width: 72px; height: 72px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--outline); flex-shrink: 0; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.btn-remove-photo { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%; background: rgba(0,0,0,0.7); color: #fff; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; cursor: pointer; border: none; transition: background 0.2s; }
.btn-primary { background: var(--primary); color: #021a13; width: 100%; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface-variant); color: var(--on-surface); border: 1px solid var(--outline); }
.btn-secondary:hover { background: var(--surface-elevated); }
.btn-danger { background: var(--negative-bg); color: var(--negative); border: 1px solid var(--negative-border); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; }

/* Modals & Overlays */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.85); display: flex; align-items: center; justify-content: center; z-index: 1000; backdrop-filter: blur(8px); padding: 16px; }
.modal-card { background: var(--surface); border: 1px solid var(--outline); border-radius: var(--radius-lg); padding: 24px; width: 100%; max-width: 480px; box-shadow: var(--shadow-md); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-header h3 { font-size: 18px; font-weight: 600; }

/* Camera Viewfinder */
.camera-viewfinder { position: relative; width: 100%; height: 320px; background: #000; border-radius: var(--radius-md); overflow: hidden; margin-bottom: 16px; }
.camera-viewfinder video { width: 100%; height: 100%; object-fit: cover; }
.camera-controls { display: flex; justify-content: space-around; align-items: center; }
.shutter-btn { width: 64px; height: 64px; border-radius: 50%; background: #fff; border: 4px solid var(--primary); cursor: pointer; transition: transform 0.1s; }
.shutter-btn:active { transform: scale(0.92); }

/* Holds View */
.hold-card { background: var(--surface); border: 1px solid var(--outline-light); border-radius: var(--radius-md); padding: 14px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }

/* Toast Notifications */
.toast-container { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; width: 90%; max-width: 360px; pointer-events: none; }
.toast { padding: 10px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; background: #1e293b; color: #fff; box-shadow: var(--shadow-md); transition: opacity 0.3s; pointer-events: auto; }
.toast-success { background: #065f46; color: #d1fae5; border: 1px solid #10b981; }
.toast-error { background: #881337; color: #ffe4e6; border: 1px solid #f43f5e; }
.toast-info { background: #1e293b; color: #e2e8f0; border: 1px solid #475569; }
.toast.fade-out { opacity: 0; }

.empty-state { text-align: center; padding: 40px 16px; color: var(--text-muted); font-size: 14px; }
.hidden { display: none !important; }
.font-bold { font-weight: 700; }
.text-lg { font-size: 18px; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text-muted); }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.w-full { width: 100%; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
