/* MPLS 311 Quick Report — style.css
 * Mobile-first, big fonts, big touch targets, dark-mode friendly.
 * Desktop gets a centered column layout — same components.
 */

:root {
  --green: #0a7d32;
  --green-dark: #086427;
  --green-light: #e6f4ea;
  --bg: #f5f6f7;
  --card: #ffffff;
  --text: #1a1c1e;
  --text-dim: #5f6368;
  --border: #dadce0;
  --danger: #c5221f;
  --warn: #b06000;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --target: 56px; /* min touch target */
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121416;
    --card: #1e2124;
    --text: #e8eaed;
    --text-dim: #9aa0a6;
    --border: #33363a;
    --green-light: #14361f;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 20px; /* big base font */
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ================= Top bar ================= */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--green);
  color: #fff;
  padding: 0.4rem 1rem;
  padding-top: calc(0.4rem + env(safe-area-inset-top));
  min-height: 60px;
}

.topbar-title {
  background: none;
  border: none;
  color: inherit;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.5rem;
}

.topbar-settings {
  background: none;
  border: none;
  color: inherit;
  font-size: 1.5rem;
  cursor: pointer;
  min-width: var(--target);
  min-height: var(--target);
  border-radius: 10px;
}

/* ================= Layout ================= */

.screen-container {
  max-width: 680px;
  margin: 0 auto;
  padding: 1rem;
}

.view { animation: fadeIn 0.15s ease-out; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ================= Home ================= */

.home-hero { text-align: center; padding: 1.5rem 0 1.25rem; }

.home-hero h1 {
  font-size: 2.1rem;
  line-height: 1.15;
  margin: 0 0 0.5rem;
}

.accent { color: var(--green); }

.home-sub { color: var(--text-dim); margin: 0 0 1.75rem; }

.btn-hero {
  width: 100%;
  flex-direction: column;
  padding: 1.5rem 1rem;
  margin-bottom: 1.25rem;
}

.btn-icon { font-size: 2.6rem; line-height: 1; margin-bottom: 0.4rem; }

.btn-title { font-size: 1.5rem; font-weight: 700; display: block; }

.btn-sub { font-size: 0.85rem; opacity: 0.9; font-weight: 400; display: block; }

.home-links {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.home-hint { text-align: center; color: var(--text-dim); font-size: 0.85rem; margin-top: 1.5rem; }

/* ================= Buttons ================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  min-height: var(--target);
  padding: 0.65rem 1.2rem;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: var(--green);
  color: #fff;
}

.btn-primary:active { background: var(--green-dark); }

.btn-secondary {
  background: var(--card);
  color: var(--text);
  border-color: var(--border);
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border-color: transparent;
  text-decoration: underline;
}

.btn-giant { width: 100%; font-size: 1.3rem; min-height: 68px; }

.btn-small { min-height: 40px; font-size: 0.85rem; padding: 0.3rem 0.8rem; }

.link-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--green);
  text-decoration: underline;
  cursor: pointer;
  min-height: 44px;
  padding: 0.25rem 0.5rem;
}

.link-inline {
  background: none;
  border: none;
  font-family: inherit;
  color: var(--green);
  text-decoration: underline;
  font-size: 0.9rem;
  cursor: pointer;
}

/* ================= Cards ================= */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem;
  margin-bottom: 1rem;
}

.step-title {
  margin: 0 0 0.8rem;
  font-size: 1.1rem;
  color: var(--green);
  font-weight: 700;
}

.view-title { margin: 0.25rem 0 1rem; font-size: 1.5rem; }

.view-sub { color: var(--text-dim); margin: -0.5rem 0 1rem; font-size: 0.9rem; }

.section-title { margin: 0 0 0.75rem; font-size: 1.05rem; }

/* ================= Photo ================= */

.photo-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 180px;
  border: 3px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  padding: 1rem;
  transition: border-color 0.15s;
}

.photo-drop:active { border-color: var(--green); }

.photo-drop-icon { font-size: 3rem; }

.photo-drop-text small { color: var(--text-dim); }

.photo-preview-wrap { text-align: center; }

.photo-preview {
  max-width: 100%;
  max-height: 320px;
  border-radius: var(--radius);
  object-fit: contain;
  margin-bottom: 0.5rem;
}

/* ================= Location ================= */

.loc-row {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.loc-row .btn { flex: 1 1 auto; }

.select-compact { flex: 1 1 140px; min-height: 44px; }

.loc-status {
  font-size: 0.9rem;
  color: var(--text-dim);
  min-height: 1.4em;
  margin-bottom: 0.6rem;
}

.loc-coords {
  font-size: 0.85rem;
  color: var(--text-dim);
  font-family: ui-monospace, monospace;
  margin-top: 0.4rem;
}

/* ================= Inputs ================= */

.field-label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0.9rem 0 0.35rem;
}

.field-label small { font-weight: 400; color: var(--text-dim); }

.field-hint { font-size: 0.8rem; color: var(--text-dim); margin: 0.6rem 0 0; }

.input, .textarea, .select {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
}

.select-big { min-height: 60px; font-size: 1.15rem; font-weight: 600; }

.textarea { resize: vertical; min-height: 130px; }

.input:focus, .textarea:focus, .select:focus,
.btn:focus-visible, .link-btn:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 1px;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1rem;
  font-size: 1rem;
  min-height: 44px;
  cursor: pointer;
}

.check-label input { width: 1.4rem; height: 1.4rem; accent-color: var(--green); }

.summary-preview {
  background: var(--green-light);
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  margin-top: 0.8rem;
  font-size: 0.9rem;
}

.summary-preview-label { color: var(--text-dim); margin-bottom: 0.2rem; }

.summary-preview-text { font-weight: 600; }

/* ================= Report actions ================= */

.report-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 1.25rem 0 2rem;
}

/* ================= Submitted ================= */

.success-card { text-align: center; padding: 2rem 1.25rem; }

.success-icon { font-size: 3.5rem; margin-bottom: 0.5rem; }

.submitted-summary { color: var(--text-dim); margin: 0.5rem 0 1.25rem; }

.success-meta { margin-top: 1rem; }

.submitted-meta { font-size: 0.85rem; color: var(--text-dim); }

/* ================= History & templates ================= */

.history-list { margin-bottom: 1.5rem; }

.history-item { padding: 0.9rem 1rem; }

.history-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.history-date { font-size: 0.8rem; color: var(--text-dim); white-space: nowrap; }

.history-addr { color: var(--text-dim); font-size: 0.9rem; margin-top: 0.25rem; }

.history-failed { border-color: var(--danger); }

.history-tag {
  display: inline-block;
  font-size: 0.75rem;
  background: var(--green-light);
  color: var(--green);
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  margin-top: 0.4rem;
}

.history-tag-fail { background: rgba(197, 34, 31, 0.12); color: var(--danger); }

.template-item { padding: 0.9rem 1rem; }

.tpl-actions { display: flex; gap: 0.35rem; }

.tpl-desc {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 0.35rem;
  white-space: pre-wrap;
}

.empty-state { text-align: center; color: var(--text-dim); padding: 2.5rem 1rem; }

/* ================= Vehicle details expander ================= */

.veh-details {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.veh-summary {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0.5rem 1rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  list-style: none;
  background: var(--bg);
}

.veh-summary::-webkit-details-marker { display: none; }

.veh-summary::after {
  content: "▾";
  margin-left: auto;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.veh-details[open] .veh-summary::after { content: "▴"; }

.veh-grid { padding: 0.25rem 1rem 1rem; }

/* ================= Login screen ================= */

.login-card {
  max-width: 380px;
  margin: 3rem auto 0;
  text-align: center;
  padding: 2rem 1.5rem;
}

.login-icon { font-size: 3rem; margin-bottom: 0.3rem; }

.login-title { margin: 0; font-size: 1.6rem; }

.login-sub { color: var(--text-dim); margin: 0.3rem 0 1.25rem; }

.pin-input {
  font-size: 1.7rem;
  text-align: center;
  letter-spacing: 0.35em;
  margin-bottom: 1rem;
}

.login-error {
  min-height: 1.4em;
  margin-top: 0.9rem;
  font-size: 0.9rem;
  color: var(--danger);
}

/* ================= Portal sign-in status ================= */

.portal-status {
  font-size: 0.9rem;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  margin-bottom: 0.9rem;
  cursor: pointer;
  border: 1px solid transparent;
}

.portal-status.ok {
  background: var(--green-light);
  color: var(--green);
  border-color: var(--green);
}

.portal-status.no {
  background: rgba(176, 96, 0, 0.12);
  color: var(--warn);
}

.portal-status.unknown {
  background: var(--bg);
  color: var(--text-dim);
  border-color: var(--border);
}

.portal-status-home {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin: 0.85rem 0 0;
}

/* ================= Auto-submit success ================= */

.auto-success { text-align: center; }

.auto-case {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--green);
  margin: 0.4rem 0;
}

/* ================= Handoff screen ================= */

.handoff-note {
  font-size: 0.95rem;
  margin: 0.5rem 0;
  min-height: 1.4em;
}

.handoff-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1.1rem;
}

/* ================= Toast ================= */

.toast {
  position: fixed;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: #2d2f33;
  color: #fff;
  font-size: 0.95rem;
  padding: 0.8rem 1.2rem;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  z-index: 100;
  max-width: min(92vw, 560px);
  text-align: center;
}

/* ================= Desktop ================= */

@media (min-width: 700px) {
  body { font-size: 18px; }
  .screen-container { padding: 2rem 1.5rem; }
  .report-actions { flex-direction: row; }
  .report-actions .btn-giant { flex: 1; }
  .photo-drop { min-height: 240px; }
}
