:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --ink: #1f2933;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-ink: #ffffff;
  --ok: #15803d;
  --warn: #b45309;
  --border: #d7dbe0;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: env(safe-area-inset-top, 0) 16px 0;
  height: calc(52px + env(safe-area-inset-top, 0));
  background: var(--ink);
  color: #fff;
}
.app-title { font-weight: 600; font-size: 17px; }
.conn-status { font-size: 13px; opacity: 0.85; }
.conn-status.offline { color: #fca5a5; }

#app { padding: 16px; max-width: 640px; margin: 0 auto; }

.screen { display: none; }
.screen.active { display: block; animation: fade 0.15s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

h1 { font-size: 24px; margin: 8px 0 16px; }
.hint, .job-ref { color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.job-ref { font-weight: 500; color: var(--ink); }

.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.field input,
.field textarea,
.custom-room input {
  width: 100%;
  padding: 14px;
  font-size: 16px; /* prevents iOS zoom-on-focus */
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
}
.field textarea { resize: vertical; }
.field span small { color: var(--muted); font-weight: 400; }

/* Side-by-side fields (e.g. State + ZIP) */
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }

button {
  font-size: 16px;
  font-family: inherit;
  border: none;
  border-radius: var(--radius);
  padding: 14px 18px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button.primary {
  display: block;
  width: 100%;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  margin-top: 8px;
}
button.primary:disabled { opacity: 0.5; }
button.big { padding: 22px; font-size: 18px; }
button.ghost {
  display: block;
  width: 100%;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
  margin-top: 10px;
}

.room-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.room-btn {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 12px;
  font-size: 15px;
  text-align: center;
  color: var(--ink);
}
.room-btn .count {
  position: absolute;
  top: 6px;
  right: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  min-width: 20px;
  height: 20px;
  line-height: 20px;
  border-radius: 10px;
  padding: 0 6px;
}
.room-btn.has-photos { border-color: var(--accent); }

.custom-room { display: flex; gap: 8px; margin-bottom: 20px; }
.custom-room input { flex: 1; }
.custom-room button { flex: 0 0 auto; width: auto; margin: 0; }

.thumb-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 80px;
  margin-bottom: 16px;
}
.thumb {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  background: #e5e7eb;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .del {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  font-size: 14px;
  padding: 0;
}

.review-list, .upload-log { list-style: none; padding: 0; margin: 0 0 16px; }
.review-list li {
  display: flex;
  justify-content: space-between;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}
.review-list .room-name { font-weight: 500; }
.review-list .count { color: var(--muted); }
.review-list .count.zero { color: var(--warn); }

.progress-wrap {
  width: 100%;
  height: 10px;
  background: var(--border);
  border-radius: 5px;
  overflow: hidden;
  margin: 8px 0 12px;
}
.progress-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.2s ease;
}
.progress-text { color: var(--muted); font-size: 14px; }
.upload-log li { font-size: 13px; color: var(--muted); padding: 2px 0; }
.upload-log li.ok::before { content: "✓ "; color: var(--ok); }
.upload-log li.err::before { content: "⚠ "; color: var(--warn); }
.done #done-title { color: var(--ok); }
