/* Rogers Mechanical Dispatch — branded to the company logo:
   red #E93337 + blue #091CF3 on black/white artwork.
   Mobile-first: the crew lives on phones (ServicePal's app won't even run
   on an iPhone — this one must). */

:root {
  --brand-red: #e93337;
  --red: #d21f26;          /* primary-button red — deepened for white-text contrast */
  --red-dark: #b2161b;
  --brand-blue: #091cf3;   /* electric logo blue — accents only */
  --blue-deep: #0b1fa6;    /* deepened brand blue for text, links, buttons */
  --navy: #14161f;         /* near-black structure (kept var name: used app-wide) */
  --navy-2: #0b1fa6;       /* deepened brand blue (kept var name: used app-wide) */
  --bar: #111114;          /* dark bar: nav, board column headers */
  --bg: #eef0f5;
  --card: #ffffff;
  --ink: #17181d;
  --muted: #626b7d;
  --line: #d7dce6;
  --blue: #0b1fa6;         /* "New job" pill — aligned to brand blue */
  --amber: #f5a623;
  --amber-dark: #b45309;   /* "In progress" — dark amber/orange */
  --teal: #0e7c86;         /* "Appointment confirmed" */
  --purple: #7c3aed;       /* "Job Delayed" */
  --green: #1fa34a;
  --gray: #8a97a5;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
a { color: var(--blue-deep); }

/* ---------------- header ----------------
   White brand band (the logo art is black-based — light surface only)
   over a near-black nav bar with a red accent edge. */
.app-header { box-shadow: 0 2px 8px rgba(10, 10, 20, .18); }
.brand-band {
  background: #fff;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: center;
  padding: 8px 14px;
}
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand-logo { height: 46px; width: auto; display: block; }
.main-nav {
  background: var(--bar);
  border-bottom: 3px solid var(--brand-red);
  display: flex;
  flex-wrap: wrap;
  gap: 2px 4px;
  padding: 6px 12px;
}
.main-nav a {
  color: #e8eaf2;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding: 6px 9px;
  border-radius: 6px;
  border-bottom: 3px solid transparent;
  margin-bottom: -3px;
}
.main-nav a:hover { color: #fff; background: rgba(255,255,255,.08); border-bottom-color: var(--brand-red); }
.who { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); }
.who-role { color: var(--red-dark); font-weight: 600; }
.who .btn-ghost { color: var(--blue-deep); }

.container { max-width: 1400px; margin: 0 auto; padding: 14px; }

/* ---------------- footer ---------------- */
.app-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 10px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 18px 8px 26px;
}
.footer-icon { height: 30px; width: auto; border-radius: 5px; }
.footer-licenses { flex-basis: 100%; font-size: 11px; }

/* ---------------- generic ---------------- */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(10, 12, 25, .06);
}
.btn {
  display: inline-block;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--blue-deep);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { border-color: var(--blue-deep); }
.btn-primary { background: var(--red); border-color: var(--red-dark); color: #fff; font-weight: 700; }
.btn-primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-small { padding: 4px 9px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.inline { display: inline; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.inline-form input, .inline-form select { flex: 1 1 160px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.alert { background: #ffe3e3; border: 1px solid #e5a1a1; color: #7a1212; padding: 10px; border-radius: 8px; }
input, select, textarea {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  min-height: 40px;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--blue-deep);
  outline-offset: 1px;
  border-color: var(--blue-deep);
}
.form-grid { display: grid; grid-template-columns: 1fr; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.form-grid.compact { padding: 10px; }
@media (min-width: 720px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .full { grid-column: 1 / -1; }
}
.search-bar { display: flex; gap: 8px; margin: 10px 0 14px; }
.search-bar input { flex: 1; }
.page-top { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.list-rows { list-style: none; margin: 0 0 14px; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.list-rows li { padding: 11px 14px; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.list-rows li:last-child { border-bottom: none; }
.table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.table th, .table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
.table th { background: var(--bar); color: #fff; border-bottom: 3px solid var(--brand-red); }
.total-row td { font-weight: 800; font-size: 16px; }

/* pills & badges — the color language of the app */
.pill, .badge {
  display: inline-block; border: none; cursor: pointer;
  font-size: 12px; font-weight: 700; letter-spacing: .3px;
  padding: 4px 10px; border-radius: 999px; color: #fff; text-transform: capitalize;
}
.badge { cursor: default; }
/* job status pills — Aaron's 8 ServicePal statuses, one color each */
.pill-new_job { background: var(--blue); }
.pill-appointment_confirmed { background: var(--teal); }
.pill-on_my_way { background: var(--amber); color: #412c00; }
.pill-in_progress { background: var(--amber-dark); }
.pill-completed { background: var(--green); }
.pill-closed { background: var(--gray); }
.pill-cancelled { background: var(--red); }
.pill-job_delayed { background: var(--purple); }
/* document / agreement badges */
.badge-draft { background: var(--blue); }
.badge-sent { background: var(--amber); color: #412c00; }
.badge-paid, .badge-accepted, .badge-active { background: var(--green); }
.badge-void, .badge-declined, .badge-expired, .badge-cancelled { background: var(--gray); }
.badge-converted { background: var(--blue-deep); }
.badge-paused { background: var(--amber); color: #412c00; }

/* ---------------- login ----------------
   Near-black page, faint red/blue corner glows, white branded card. */
.login-body {
  display: flex; min-height: 100vh; align-items: center; justify-content: center;
  background:
    radial-gradient(560px 340px at 12% 8%, rgba(233, 51, 55, .28), transparent 70%),
    radial-gradient(560px 340px at 88% 92%, rgba(9, 28, 243, .30), transparent 70%),
    #0c0c10;
  padding: 16px;
}
.login-card { background: #fff; border-radius: 16px; padding: 26px; width: 100%; max-width: 400px; box-shadow: 0 14px 40px rgba(0,0,0,.5); border-top: 5px solid var(--brand-red); }
.login-logo { display: block; width: 260px; max-width: 100%; height: auto; margin: 0 auto; }
.login-subtitle { text-align: center; margin: 2px 0 0; font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: 6px; color: var(--blue-deep); }
.login-card h1 { margin: 14px 0 14px; font-size: 22px; text-align: center; }
.login-card label { display: block; margin-bottom: 12px; font-size: 14px; }
.login-card input { width: 100%; margin-top: 4px; }
.login-company { margin: 18px 0 0; text-align: center; font-size: 12.5px; color: var(--ink); }
.login-licenses { margin: 3px 0 0; text-align: center; font-size: 11px; color: var(--muted); }

/* ---------------- board ---------------- */
.board-top { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.stats { display: flex; flex-wrap: wrap; gap: 8px; margin-right: auto; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 13px; }
.stat-amber strong { color: #b97a08; }
.stat-green strong { color: var(--green); }
/* crew panel header = dark bar with red accent, same language as the nav */
.crew-panel { overflow: hidden; }
.crew-panel h2 {
  margin: -14px -16px 12px;
  padding: 9px 16px;
  background: var(--bar);
  color: #fff;
  border-bottom: 3px solid var(--brand-red);
  font-size: 15px;
}
.crew-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 22px; }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: var(--gray); vertical-align: middle; }
.dot-at_shop { background: var(--blue); }
.dot-en_route { background: var(--amber); }
.dot-on_site { background: var(--green); }
.dot-off_duty { background: var(--gray); }

.board { display: grid; grid-template-columns: 1fr; gap: 12px; align-items: start; }
@media (min-width: 900px) { .board { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1250px) { .board { grid-template-columns: repeat(4, 1fr); } }
.board-col { background: #e3e7ef; border-radius: 12px; padding: 10px; min-height: 120px; }
.board-col.drag-over { outline: 3px dashed var(--brand-red); }
/* column header = dark bar with red accent */
.col-title {
  margin: -10px -10px 10px;
  padding: 9px 12px;
  background: var(--bar);
  color: #fff;
  border-bottom: 3px solid var(--brand-red);
  border-radius: 12px 12px 0 0;
  font-size: 16px;
}
.col-title small { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: #b9c2e8; }
.col-loc { display: block; font-size: 12px; font-weight: 400; color: #dfe4f2; margin-top: 3px; }
.empty-col { text-align: center; padding: 12px 0; }

.job-card {
  background: var(--card);
  border-left: 6px solid var(--blue);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  box-shadow: 0 2px 5px rgba(10,12,25,.10);
}
.job-card.status-appointment_confirmed { border-left-color: var(--teal); }
.job-card.status-on_my_way { border-left-color: var(--amber); }
.job-card.status-in_progress { border-left-color: var(--amber-dark); }
.job-card.status-completed { border-left-color: var(--green); }
.job-card.status-closed { border-left-color: var(--gray); opacity: .75; }
.job-card.status-cancelled { border-left-color: var(--red); opacity: .75; }
.job-card.status-job_delayed { border-left-color: var(--purple); }
.job-time { font-size: 12px; font-weight: 700; color: var(--blue-deep); display: flex; justify-content: space-between; }
.job-id { color: var(--muted); font-weight: 400; }
.job-customer { display: block; font-size: 16px; font-weight: 800; color: var(--ink); text-decoration: none; margin-top: 2px; }
.job-title { display: block; color: var(--ink); text-decoration: none; font-weight: 600; }
.job-desc { margin: 4px 0; font-size: 14px; }
.job-addr { margin: 2px 0; font-size: 13px; color: var(--muted); }
.job-note { margin: 4px 0; font-size: 13px; background: #fdf0f0; border: 1px solid #f3c2c3; border-radius: 6px; padding: 5px 8px; }
.job-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.job-actions select { min-height: 32px; padding: 4px 6px; font-size: 13px; }

/* photos */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-bottom: 10px; }
.photo-grid figure { margin: 0; }
.photo-grid img { width: 100%; height: 110px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.photo-grid figcaption { font-size: 12px; color: var(--muted); }

/* dead-easy photo adding: one big tap opens the camera/library picker,
   choosing files uploads immediately (no second tap, no caption step) */
.photo-add-form { margin: 0 0 12px; }
.btn-add-photos {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 54px; padding: 14px 20px;
  font-size: 17px; border-radius: 10px; cursor: pointer;
}
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap; border: 0;
}
.photo-item { position: relative; }
.photo-del { position: absolute; top: 6px; right: 6px; margin: 0; }
.photo-del-btn {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff;
  background: rgba(178, 22, 27, .92); color: #fff;
  font-size: 14px; font-weight: 700; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0; box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.photo-del-btn:hover { background: var(--red-dark, #b2161b); }

/* tracking page — customers see this: dark branded backdrop, white card */
.track-body {
  display: flex; min-height: 100vh; align-items: center; justify-content: center;
  background:
    radial-gradient(560px 340px at 12% 8%, rgba(233, 51, 55, .28), transparent 70%),
    radial-gradient(560px 340px at 88% 92%, rgba(9, 28, 243, .30), transparent 70%),
    #0c0c10;
  padding: 16px;
}
.track-card { background: #fff; border-radius: 16px; padding: 26px; width: 100%; max-width: 440px; text-align: center; box-shadow: 0 14px 40px rgba(0,0,0,.5); border-top: 5px solid var(--brand-red); }
.brand-center { margin-bottom: 10px; }
.track-logo { width: 230px; max-width: 100%; height: auto; }
.track-big { font-size: 22px; font-weight: 800; color: var(--blue-deep); }
