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

* { box-sizing: border-box; }

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; }

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

.muted { color: var(--muted); }
.muted.small { font-size: 0.8rem; }
.version-tag { text-align: center; margin-top: 8px; }
.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); }

.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;
}

.camera-preview {
  width: 100%;
  border-radius: 12px;
  background: black;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.torch-btn {
  position: absolute;
  top: 12px;
  right: 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;
}

.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;
}

.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;
}

.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;
}
