/* m.css
   ----------------------------------------------------------------------
   The field app (portal/m/). Standalone - it deliberately shares nothing
   with portal.css, which is 6,000 lines of desktop portal built around a
   sidebar this app doesn't have.

   Sizing rules that are not negotiable here, because the user is
   outdoors, in sunlight, possibly wearing gloves, holding the phone in
   one hand:
     - every tap target is at least 56px tall
     - the primary action is 64px and full width
     - body text never goes below 15px
     - contrast stays high; no grey-on-grey secondary text
   ---------------------------------------------------------------------- */

:root {
  --navy: #071c36;
  --navy-soft: #0c264a;
  --blue: #0b65dd;
  --blue-dark: #084da8;
  --ink: #1f2d3d;
  --muted: #55657a;
  --line: #dbe4ef;
  --bg: #f5f9fe;
  --good: #147a45;
  --bad: #a3302f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Home-screen launch sits under the status bar without this. */
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ---- top bar: name + sign out, nothing else ------------------------- */
.m-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--navy);
  color: #fff;
  padding: 14px 18px;
}
.m-hello { font-size: 15px; font-weight: 700; }
.m-signout { color: #9db9dd; font-size: 14px; text-decoration: none; padding: 8px; margin: -8px; }

/* ---- today's job: the screen ---------------------------------------- */
.m-job {
  background: #fff;
  margin: 14px;
  padding: 20px 18px 18px;
  border-radius: 18px;
  box-shadow: 0 6px 22px rgba(7, 28, 54, 0.09);
}
.m-kicker {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue);
}
.m-service { margin: 0 0 2px; font-size: 26px; line-height: 1.2; color: var(--navy); }
.m-customer { margin: 0; font-size: 18px; font-weight: 600; }
.m-address { margin: 4px 0 0; font-size: 15px; color: var(--muted); }
.m-job-idle { text-align: center; color: var(--muted); }
.m-job-idle h1 { font-size: 20px; color: var(--navy); margin: 0 0 4px; }
.m-job-idle p { margin: 0; }

/* ---- call / text / directions --------------------------------------- */
.m-contact { display: flex; gap: 10px; margin: 16px 0 4px; }
.m-contact-btn {
  flex: 1 1 0;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.m-contact-btn:active { background: #e8f1fd; }
.m-contact-icon { font-size: 20px; line-height: 1; }

.m-note {
  margin: 14px 0 0;
  padding: 12px 14px;
  background: #fffbe8;
  border-left: 4px solid #e0b400;
  border-radius: 0 10px 10px 0;
  font-size: 15px;
}

/* ---- buttons -------------------------------------------------------- */
.m-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  border: 0;
  border-radius: 14px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.m-btn:disabled { opacity: 0.55; }

.m-btn-primary {
  min-height: 64px;
  margin-top: 18px;
  background: var(--blue);
  color: #fff;
  font-size: 19px;
  box-shadow: 0 8px 20px rgba(11, 101, 221, 0.28);
}
.m-btn-primary:active { background: var(--blue-dark); }

.m-btn-quiet {
  margin-top: 10px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--navy);
}
.m-btn-small {
  width: auto;
  min-height: 44px;
  padding: 0 16px;
  background: var(--blue);
  color: #fff;
  font-size: 14px;
}

.m-action-note {
  margin: 10px 2px 0;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}

/* Shown instead of a button when the job is genuinely waiting on someone
   else - saying so plainly beats a button that would only error. */
.m-waiting {
  margin-top: 18px;
  padding: 16px;
  background: var(--bg);
  border: 1px dashed #b9cbe2;
  border-radius: 14px;
  text-align: center;
}
.m-waiting strong { display: block; font-size: 16px; color: var(--navy); }
.m-waiting span { font-size: 14px; color: var(--muted); }

/* ---- "More" --------------------------------------------------------- */
.m-more { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 6px; }
.m-more summary {
  padding: 12px 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--blue);
  cursor: pointer;
  list-style: none;
}
.m-more summary::-webkit-details-marker { display: none; }
.m-more summary::after { content: " ▾"; }
.m-more[open] summary::after { content: " ▴"; }
.m-more-body { padding-bottom: 4px; }

.m-adjust label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.m-adjust-row { display: flex; gap: 10px; }
.m-adjust-row input {
  flex: 1 1 auto;
  min-height: 56px;
  padding: 0 14px;
  border: 1px solid #cfdae7;
  border-radius: 14px;
  font-family: inherit;
  font-size: 18px;
  color: var(--ink);
}
.m-adjust-row .m-btn { width: auto; margin-top: 0; padding: 0 20px; }
.m-gate { margin: 12px 0 0; font-size: 13px; color: var(--muted); text-align: center; }

/* ---- next up / just finished ---------------------------------------- */
.m-list { margin: 22px 14px; }
.m-list h2 {
  margin: 0 0 8px 4px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.m-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 8px;
}
.m-row-main { min-width: 0; }
.m-row-main strong { display: block; font-size: 16px; color: var(--navy); }
.m-row-main span {
  display: block;
  font-size: 14px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.m-row-side { flex: none; text-align: right; }
.m-when { display: block; font-size: 13px; font-weight: 700; color: var(--ink); }
.m-row-call {
  display: inline-block;
  margin-top: 4px;
  padding: 8px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

/* ---- empty state ---------------------------------------------------- */
.m-empty { padding: 64px 28px; text-align: center; color: var(--muted); }
.m-empty-icon { font-size: 44px; margin: 0 0 10px; }
.m-empty h1 { font-size: 20px; color: var(--navy); margin: 0 0 6px; }
.m-empty p { margin: 0; font-size: 15px; }

/* ---- sign-in -------------------------------------------------------- */
.m-auth { padding: 48px 24px 24px; max-width: 420px; margin: 0 auto; text-align: center; }
.m-auth-logo { border-radius: 18px; margin-bottom: 14px; }
.m-auth h1 { font-size: 22px; color: var(--navy); margin: 0 0 2px; }
.m-sub { margin: 0 0 26px; color: var(--muted); font-size: 15px; }
.m-auth form { text-align: left; }
.m-auth label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin: 14px 0 6px; }
.m-auth input[type="email"],
.m-auth input[type="password"] {
  width: 100%;
  min-height: 56px;
  padding: 0 14px;
  border: 1px solid #cfdae7;
  border-radius: 14px;
  background: #fff;
  font-family: inherit;
  font-size: 17px;
  color: var(--ink);
}
/* Says plainly whose tool this is, before anyone types a password. */
.m-gate-notice {
  margin: 0 0 22px;
  padding: 12px 14px;
  background: #eef4fd;
  border: 1px solid #cfdef5;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
}
.m-gate-notice a { color: var(--blue); font-weight: 700; }

.m-denied-actions { display: flex; flex-direction: column; gap: 10px; margin: 24px 0 16px; }
.m-denied-actions .m-btn { margin-top: 0; }
.m-denied-help { font-size: 13.5px; color: var(--muted); margin: 0; }

.m-check { display: flex; align-items: center; gap: 10px; margin: 18px 0 4px; }
.m-check input { width: 22px; height: 22px; accent-color: var(--blue); }
.m-check span { font-size: 15px; font-weight: 600; color: var(--ink); }
.m-auth .m-btn-primary { margin-top: 22px; }
.m-error {
  margin: 14px 0 0;
  padding: 12px 14px;
  background: #fff0f0;
  border-radius: 12px;
  color: var(--bad);
  font-size: 15px;
}

/* ---- toast ---------------------------------------------------------- */
.m-toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  background: var(--navy);
  color: #fff;
  padding: 14px 20px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(7, 28, 54, 0.35);
  z-index: 50;
}
.m-toast.bad { background: var(--bad); }
.m-toast[hidden] { display: none; }
