/* Mobile-first: big tap targets (gloves), high contrast (sunlight). */
:root {
  --bg: #0b1220;
  --card: #17223a;
  --text: #f4f6fb;
  --muted: #a9b4c9;
  --accent: #ffb020;
  --danger: #ff5a5a;
  --ok: #3ddc84;
  --border: #2a3a5c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 18px/1.4 -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 20px;
}

/* ---------- login ---------- */
#scr-login {
  justify-content: center;
  align-items: center;
  gap: 20px;
  text-align: center;
}

#scr-login h1 {
  font-size: 1.6rem;
  margin: 0;
}

#pin {
  font-size: 2rem;
  letter-spacing: 0.3em;
  text-align: center;
  width: 100%;
  max-width: 280px;
  padding: 16px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--card);
  color: var(--text);
}

.btn-primary {
  width: 100%;
  max-width: 280px;
  min-height: 56px;
  font-size: 1.2rem;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #1a1200;
}

.btn-primary[disabled] { opacity: 0.6; }

#login-err {
  color: var(--danger);
  min-height: 1.4em;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
}

.topbar h2 { margin: 0; font-size: 1.3rem; }

.icon-btn {
  min-width: 48px;
  min-height: 48px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--card);
  font-size: 1.2rem;
}

/* ---------- job list ---------- */
#job-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding-bottom: 20px;
}

.job-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  min-height: 88px;
}

.job-card .job-time { color: var(--accent); font-weight: 700; font-size: 1.05rem; }
.job-card .job-name { font-size: 1.15rem; font-weight: 600; }
.job-card .job-addr { color: var(--muted); }
.job-card .job-status {
  align-self: flex-start;
  font-size: 0.85rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: #2a3a5c;
}
.job-card.emergency { border-color: var(--danger); }

.empty-state { color: var(--muted); text-align: center; margin-top: 40px; }

/* ---------- offline banner ---------- */
.offline-banner {
  background: var(--accent);
  color: #1a1200;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 12px;
}

/* ---------- job detail ---------- */
.detail-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.detail-label { color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }
.detail-value { font-size: 1.1rem; }

.status-row { display: flex; gap: 10px; margin-top: 8px; }
.status-btn {
  flex: 1;
  min-height: 56px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
}
.status-btn.done { background: var(--ok); color: #052; border-color: var(--ok); }

.note-input {
  width: 100%;
  min-height: 80px;
  margin-top: 8px;
  padding: 12px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--card);
  color: var(--text);
  font: inherit;
  resize: vertical;
}

.sync-line { color: var(--accent); font-size: 0.9rem; min-height: 1.4em; margin-top: 10px; }

.action-row { display: flex; gap: 12px; margin-top: auto; padding-top: 16px; }
.action-btn {
  flex: 1;
  min-height: 56px;
  border-radius: 12px;
  border: none;
  font-size: 1.1rem;
  font-weight: 600;
}
.action-btn.call { background: var(--ok); color: #052 }
.action-btn.directions { background: var(--accent); color: #1a1200; }

.back-btn {
  align-self: flex-start;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.05rem;
  padding: 8px 0 16px;
  min-height: 44px;
}

/* ---------- toast ---------- */
#toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  padding: 14px 18px;
  border-radius: 12px;
  font-weight: 600;
  text-align: center;
  z-index: 50;
}
#toast.ok { background: var(--ok); color: #052; }
#toast.bad { background: var(--danger); color: #300; }

/* ---------- manual ---------- */
#scr-manual { position: fixed; inset: 0; background: var(--bg); z-index: 40; }
#manual-search {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--card);
  color: var(--text);
  margin-bottom: 12px;
  font-size: 1rem;
}
.manual-results { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.manual-hit {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  text-align: left;
}
.manual-hit h3 { margin: 0 0 4px; font-size: 1.05rem; }
.manual-page { overflow-y: auto; }
.manual-page h1, .manual-page h2 { color: var(--accent); }

@media (min-width: 700px) {
  .screen { max-width: 480px; margin: 0 auto; }
}
