:root {
  --bg: #0f1115;
  --surface: #1a1e26;
  --surface-2: #232833;
  --border: #333a47;
  --text: #f0f2f5;
  --muted: #9aa4b2;
  --accent: #2563eb;
  --accent-2: #f59e0b;
  --danger: #ef4444;
  --success: #22c55e;
  --success-2: #0d9488;
  --accent-3: #ea580c;
  --accent-4: #a855f7;
}

* { box-sizing: border-box; }

.app-footer {
  max-width: 480px;
  margin: 0 auto;
  text-align: center;
  color: var(--muted);
  font-size: 0.75rem;
  padding: 0 16px 20px;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

#app-root {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 48px;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 12px; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1rem; color: var(--muted); margin-top: 24px; }

.driver-group-heading { font-weight: 700; margin: 14px 0 4px; font-size: 0.95rem; }

.tagline { font-size: 1.05rem; margin: -8px 0 0; }

.landing-steps { display: flex; flex-direction: column; gap: 10px; }
.landing-step { display: flex; gap: 10px; align-items: flex-start; }
.landing-step-num {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.screen { display: flex; flex-direction: column; gap: 12px; }

.muted { color: var(--muted); }
.small { font-size: 0.8rem; }
.muted.small { font-size: 0.8rem; }
.version-tag { text-align: center; margin-top: 8px; }
.landing-footer-tag { line-height: 1.5; margin-bottom: -34px; }
.landing-tight-heading { margin-top: -8px; }

.landing-header { position: relative; }
.landing-title { display: flex; align-items: center; justify-content: center; gap: 8px; text-align: center; }
.landing-logo { width: 1.3em; height: 1.3em; border-radius: 20%; }
.landing-signin-link { position: absolute; top: 4px; right: 0; }
.instruction { font-size: 1.05rem; line-height: 1.5; }
.error { color: var(--danger); }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: 12px;
}

.btn-primary, .btn-secondary {
  width: 100%;
  padding: 16px;
  font-size: 1.05rem;
  font-weight: 600;
  border-radius: 12px;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:active { background: #1d4ed8; }
.btn-primary:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }

.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:active { background: #2c3341; }

.btn-large { padding: 20px; font-size: 1.15rem; }

.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  text-align: center;
}

.tile-icon { font-size: 1.8rem; }
.tile-sub { font-size: 0.75rem; color: var(--muted); font-weight: 400; }
.tile-connect { border-color: var(--success); }
.tile-disconnect { border-color: var(--accent-2); }
.tile-close-connect { border-color: var(--success-2); }
.tile-close-disconnect { border-color: var(--accent-3); }
.tile-walkaround { border-color: var(--accent-4); }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.field input, .field select, .field textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 12px;
  font-size: 1rem;
  font-family: inherit;
}

.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--accent);
}

.camera-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
}

.camera-preview {
  width: 100%;
  border-radius: 12px;
  background: black;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  transform-origin: center;
  transition: transform 0.15s ease-out;
}

.torch-btn, .zoom-btn {
  position: absolute;
  top: 12px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(15, 17, 21, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  color: var(--text);
}

.torch-btn { right: 12px; }
.zoom-btn { left: 12px; font-size: 0.85rem; font-weight: 700; }
.zoom-btn.zoom-active { opacity: 1; background: rgba(37, 99, 235, 0.85); border-color: var(--accent); }

.torch-btn.torch-on {
  background: rgba(245, 158, 11, 0.85);
  border-color: var(--accent-2);
  opacity: 1;
}

.photo-preview {
  width: 100%;
  border-radius: 12px;
  object-fit: cover;
  cursor: zoom-in;
}

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
}

.lightbox-overlay img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.thumb img { cursor: zoom-in; }

.step-progress {
  font-size: 0.85rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
}

.thumb img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

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

.list-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
}

.list-item-main { display: flex; flex-direction: column; gap: 2px; }

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  width: fit-content;
}

.badge.open { background: rgba(245, 158, 11, 0.2); color: var(--accent-2); }
.badge.complete { background: rgba(34, 197, 94, 0.2); color: var(--success); }
.badge.pending { background: rgba(37, 99, 235, 0.2); color: var(--accent); }

.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.home-header h1 { margin: 0; }

.btn-link {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: underline;
  padding: 4px;
  width: auto;
}

.pending-badge {
  background: rgba(37, 99, 235, 0.15);
  color: var(--accent);
  border: 1px solid rgba(37, 99, 235, 0.3);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.85rem;
  margin: 0;
  display: block;
  width: 100%;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
}

.walkaround-item { display: flex; flex-direction: column; gap: 10px; cursor: default; }
.walkaround-item-actions { display: flex; gap: 8px; }
.walkaround-item-actions button { flex: 1; width: auto; padding: 10px; font-size: 0.9rem; }
.walkaround-selected.walkaround-pass-btn { background: rgba(34, 197, 94, 0.2); border-color: var(--success); color: var(--success); }
.walkaround-selected.walkaround-defect-btn { background: rgba(239, 68, 68, 0.2); border-color: var(--danger); color: var(--danger); }

.warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-2);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.85rem;
  margin: 0;
}
