/* ==========================================================================
   TowGo design tokens
   Navy + green sampled directly from the logo; everything else derived.
   ========================================================================== */
:root {
  --navy: #012958;
  --navy-700: #023a78;
  --navy-100: #e8edf4;
  --green: #2bb94b;
  --green-600: #229140;
  --green-100: #e6f8ea;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #e3e8ee;
  --text: #10233d;
  --text-muted: #64748b;
  --danger: #d64545;
  --danger-100: #fdecec;
  --warning: #b8860b;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-card: 0 1px 2px rgba(1, 41, 88, 0.06), 0 6px 20px rgba(1, 41, 88, 0.06);
  --shadow-nav: 0 -2px 12px rgba(1, 41, 88, 0.08);
  --nav-height: 68px;
  --topbar-height: 56px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; display: block; }

/* --------------------------------------------------------------------- */
/* App shell: phone-width column centered on wider viewports              */
/* --------------------------------------------------------------------- */
.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
}
@media (min-width: 540px) {
  .app-shell {
    min-height: 100vh;
    box-shadow: 0 0 0 1px var(--border), 0 20px 60px rgba(1, 41, 88, 0.12);
  }
  body { background: #dfe6ee; }
}

.screen {
  flex: 1;
  padding: 16px 16px calc(var(--nav-height) + 24px);
  overflow-y: auto;
}
.screen.no-nav-padding { padding-bottom: 24px; }

/* --------------------------------------------------------------------- */
/* Top bar                                                                */
/* --------------------------------------------------------------------- */
.topbar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .logo-mark { height: 26px; }
.topbar-title { font-weight: 700; font-size: 17px; color: var(--navy); }
.topbar-back {
  background: none;
  border: none;
  color: var(--navy);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px 4px 0;
  line-height: 1;
}
.topbar-spacer { flex: 1; }
.topbar-role-chip {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--green-600);
  background: var(--green-100);
  padding: 4px 10px;
  border-radius: 999px;
}

/* --------------------------------------------------------------------- */
/* Bottom nav                                                             */
/* --------------------------------------------------------------------- */
.bottom-nav {
  position: sticky;
  bottom: 0;
  height: var(--nav-height);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  box-shadow: var(--shadow-nav);
  z-index: 20;
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  padding: 6px 0;
}
.bottom-nav-item .nav-icon { font-size: 20px; line-height: 1; }
.bottom-nav-item.active { color: var(--navy); }
.bottom-nav-item.active .nav-icon { color: var(--green); }

/* --------------------------------------------------------------------- */
/* Cards, buttons, forms                                                  */
/* --------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px;
  margin-bottom: 14px;
}
.card-flat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: none;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.05s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--green); color: #05230f; }
.btn-primary:hover:not(:disabled) { background: var(--green-600); color: #fff; }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover:not(:disabled) { background: var(--navy-700); }
.btn-outline { background: transparent; color: var(--navy); border: 1.5px solid var(--navy); }
.btn-outline:hover:not(:disabled) { background: var(--navy-100); }
.btn-ghost { background: transparent; color: var(--navy); font-weight: 600; }
.btn-danger-ghost { background: transparent; color: var(--danger); font-weight: 600; }
.btn-sm { padding: 9px 14px; font-size: 13px; width: auto; }
.btn-block-row { display: flex; gap: 10px; }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--navy);
}
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }
.field-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.field-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

.alert {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13.5px;
  margin-bottom: 14px;
}
.alert-danger { background: var(--danger-100); color: var(--danger); }
.alert-info { background: var(--navy-100); color: var(--navy); }

/* --------------------------------------------------------------------- */
/* Login                                                                  */
/* --------------------------------------------------------------------- */
.login-screen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 24px;
}
.login-logo { width: 200px; margin: 0 auto 36px; }
.login-tabs {
  display: flex;
  background: var(--navy-100);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 20px;
}
.login-tab {
  flex: 1;
  border: none;
  background: none;
  padding: 9px 0;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  color: var(--navy);
  cursor: pointer;
}
.login-tab.active { background: var(--surface); box-shadow: 0 1px 3px rgba(1, 41, 88, 0.15); }
.demo-accounts {
  margin-top: 22px;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.7;
}
.demo-accounts b { color: var(--text); }
.demo-accounts button {
  border: none;
  background: none;
  color: var(--green-600);
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  font-size: 12.5px;
}

/* --------------------------------------------------------------------- */
/* Home / TOW NOW                                                        */
/* --------------------------------------------------------------------- */
.hero-card {
  background: linear-gradient(150deg, var(--navy) 0%, #024079 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
}
.hero-card h1 { font-size: 20px; margin-bottom: 4px; }
.hero-card p { color: #c7d7ea; font-size: 13.5px; margin-bottom: 18px; }
.tow-now-btn {
  width: 100%;
  padding: 22px;
  border-radius: var(--radius-lg);
  border: none;
  background: var(--green);
  color: #05230f;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.03em;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(43, 185, 75, 0.35);
}
.tow-now-btn:active { transform: scale(0.98); }

.section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 4px 0 10px;
}

/* --------------------------------------------------------------------- */
/* Job card / list                                                       */
/* --------------------------------------------------------------------- */
.job-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
}
.job-card:hover { border-color: var(--navy); }
.job-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.job-card-problem { font-weight: 700; font-size: 15px; color: var(--navy); }
.job-card-address { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }
.job-card-price { font-weight: 800; font-size: 15px; color: var(--text); white-space: nowrap; }
.job-card-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }

.status-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
}
.status-SEARCHING { background: #fff3cd; color: #8a6100; }
.status-ACCEPTED, .status-EN_ROUTE { background: var(--navy-100); color: var(--navy); }
.status-ARRIVED, .status-LOADED, .status-TOWING, .status-ARRIVED_AT_DESTINATION { background: #dbeeff; color: #04528f; }
.status-COMPLETED { background: var(--green-100); color: var(--green-600); }
.status-CANCELLED { background: var(--danger-100); color: var(--danger); }

/* --------------------------------------------------------------------- */
/* Status timeline                                                       */
/* --------------------------------------------------------------------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-item { display: flex; gap: 12px; position: relative; padding-bottom: 20px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot-col { display: flex; flex-direction: column; align-items: center; }
.timeline-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--border);
  border: 2px solid var(--border);
  flex-shrink: 0;
  margin-top: 2px;
}
.timeline-item.done .timeline-dot { background: var(--green); border-color: var(--green); }
.timeline-item.current .timeline-dot { background: var(--navy); border-color: var(--navy); box-shadow: 0 0 0 4px var(--navy-100); }
.timeline-line { width: 2px; flex: 1; background: var(--border); margin-top: 2px; }
.timeline-item.done .timeline-line { background: var(--green); }
.timeline-label { font-size: 14px; font-weight: 600; color: var(--text-muted); }
.timeline-item.done .timeline-label, .timeline-item.current .timeline-label { color: var(--text); }
.timeline-time { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

/* --------------------------------------------------------------------- */
/* Pin map (custom lightweight placeholder — see README)                 */
/* --------------------------------------------------------------------- */
.pin-map {
  position: relative;
  width: 100%;
  height: 220px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background:
    linear-gradient(rgba(1,41,88,0.05), rgba(1,41,88,0.05)),
    repeating-linear-gradient(0deg, #e7edf3, #e7edf3 18px, #dbe4ec 18px, #dbe4ec 19px),
    repeating-linear-gradient(90deg, #e7edf3, #e7edf3 18px, #dbe4ec 18px, #dbe4ec 19px);
  cursor: crosshair;
  border: 1.5px solid var(--border);
  touch-action: none;
}
.pin-map .pin {
  position: absolute;
  transform: translate(-50%, -100%);
  font-size: 30px;
  filter: drop-shadow(0 3px 4px rgba(1,41,88,0.35));
  pointer-events: none;
}
.pin-map .pin.pickup { color: var(--green); }
.pin-map .pin.destination { color: var(--navy); }
.pin-map-hint {
  position: absolute; bottom: 8px; left: 8px; right: 8px;
  background: rgba(255,255,255,0.9);
  border-radius: 8px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 5px 8px;
  text-align: center;
}
.pin-map-locate {
  position: absolute; top: 8px; right: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 34px; height: 34px;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(1,41,88,0.15);
}

/* --------------------------------------------------------------------- */
/* Problem-type / vehicle-type chip grid                                 */
/* --------------------------------------------------------------------- */
.chip-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.chip {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  text-align: center;
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.chip .chip-icon { font-size: 22px; display: block; margin-bottom: 6px; }
.chip.selected { border-color: var(--green); background: var(--green-100); color: var(--green-600); }

/* --------------------------------------------------------------------- */
/* Star rating                                                           */
/* --------------------------------------------------------------------- */
.star-row { display: flex; gap: 8px; justify-content: center; margin: 18px 0; }
.star-btn { background: none; border: none; font-size: 40px; cursor: pointer; color: var(--border); line-height: 1; padding: 0; }
.star-btn.filled { color: var(--green); }

/* --------------------------------------------------------------------- */
/* Progress dots (multi-step new-job flow)                               */
/* --------------------------------------------------------------------- */
.step-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 18px; }
.step-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.step-dot.active { background: var(--green); width: 22px; border-radius: 4px; }
.step-dot.done { background: var(--navy); }

/* --------------------------------------------------------------------- */
/* Misc utility                                                          */
/* --------------------------------------------------------------------- */
.row { display: flex; align-items: center; justify-content: space-between; }
.muted { color: var(--text-muted); }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.empty-state { text-align: center; padding: 48px 16px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }
.price-tag { font-size: 30px; font-weight: 800; color: var(--navy); }
.loading-screen { display: flex; align-items: center; justify-content: center; height: 100vh; color: var(--navy); font-weight: 700; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }

/* --------------------------------------------------------------------- */
/* Admin table                                                           */
/* --------------------------------------------------------------------- */
.admin-shell { max-width: 960px; margin: 0 auto; padding: 24px; }
.admin-table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius-md); border: 1px solid var(--border); }
table.admin-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 720px; }
table.admin-table th {
  text-align: left; padding: 12px 14px; background: var(--navy-100); color: var(--navy);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; position: sticky; top: 0;
}
table.admin-table td { padding: 12px 14px; border-top: 1px solid var(--border); vertical-align: middle; }
table.admin-table tr:hover td { background: #fafbfd; }
.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.admin-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px; }
.admin-stat .stat-value { font-size: 24px; font-weight: 800; color: var(--navy); }
.admin-stat .stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
