/* Crew Timecard: phone-first styles. Big buttons and strong contrast so it works with gloves and in sunlight. */
:root {
  --ink: #1f2933;
  --muted: #5b6875;
  --line: #d5dbe1;
  --bg: #eef1f4;
  --card: #ffffff;
  --go: #1e7b34;
  --stop: #b3261e;
  --meal: #b25e00;
  --rest: #1f5fa8;
  --note: #2f5d62;
  --warn-bg: #fff4d6;
  --warn-ink: #6b4a00;
  --bad-bg: #fde3e1;
  --bad-ink: #8a1c15;
  --ok-bg: #e2f4e6;
  --ok-ink: #145224;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, select { font: inherit; }

.bar {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 0.75rem;
  padding: calc(env(safe-area-inset-top) + 0.6rem) 1rem 0.6rem;
  background: var(--ink); color: #fff;
}
.brand { display: flex; align-items: center; gap: 0.55rem; font-weight: 700; white-space: nowrap; }
.brand .logo { height: 34px; width: auto; flex: none; }
@media (max-width: 480px) {
  /* Phone: the company name may take two lines so the worker's name and Sign out still fit. */
  .brand { white-space: normal; line-height: 1.15; font-size: 0.95rem; min-width: 0; }
}
.who { margin-left: auto; opacity: 0.85; font-size: 0.95rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link { background: none; border: 0; color: #fff; text-decoration: underline; padding: 0.4rem 0; cursor: pointer; white-space: nowrap; }

.banner { padding: 0.7rem 1rem; font-weight: 600; }
.banner.warn { background: var(--warn-bg); color: var(--warn-ink); }
.banner.bad { background: var(--bad-bg); color: var(--bad-ink); }

main { max-width: 34rem; margin: 0 auto; padding: 1rem 1rem calc(env(safe-area-inset-bottom) + 2rem); }
.loading { text-align: center; color: var(--muted); padding: 3rem 1rem; }
.card { background: var(--card); border-radius: 14px; padding: 1rem 1.1rem; margin-bottom: 1rem; box-shadow: 0 1px 2px rgb(0 0 0 / 0.08); }
h1 { font-size: 1.6rem; margin: 0 0 0.3rem; }
h2 { font-size: 1.2rem; margin: 0 0 0.6rem; }
p { margin: 0.35rem 0; line-height: 1.4; }
.hint { color: var(--muted); font-size: 0.95rem; }
.error { color: var(--bad-ink); font-weight: 600; min-height: 1.4em; }

.login label, .pickers label { display: block; font-weight: 600; margin: 0.8rem 0 0.3rem; }
input, select {
  width: 100%; padding: 0.8rem; font-size: 1.1rem;
  border: 2px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: 3px solid #7fb0ea; border-color: var(--rest); }

.status { border-left: 8px solid var(--muted); }
.status.working { border-left-color: var(--go); }
.status.meal { border-left-color: var(--meal); }
.status.rest { border-left-color: var(--rest); }
.status .where { font-weight: 600; font-size: 1.1rem; }

.actions { display: grid; gap: 0.75rem; margin-bottom: 1rem; }
.pickers { background: var(--card); border-radius: 14px; padding: 0.2rem 1.1rem 1.1rem; }
/* Job list on the clock-in screen: search box, then tappable jobs, nearest first */
.picked { margin: 0 0 0.5rem; font-size: 1.05rem; }
.picked.none { color: var(--muted); }
.picked .hint { font-size: 0.9rem; }
.gps { margin: 0.4rem 0 0.1rem; font-size: 0.9rem; min-height: 1.2em; }
.joblist { display: grid; gap: 0.45rem; max-height: 19rem; overflow-y: auto; padding: 0.2rem 2px; }
.jobrow {
  display: grid; grid-template-columns: 1fr auto; gap: 0.15rem 0.7rem; align-items: center;
  width: 100%; min-height: 3.4rem; padding: 0.65rem 0.8rem; text-align: left; font-size: 1.05rem;
  border: 2px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); cursor: pointer;
}
.jobrow .jname { font-weight: 600; overflow-wrap: anywhere; }
.jobrow .jdist { color: var(--muted); font-size: 0.9rem; white-space: nowrap; }
.jobrow .jdist.here { color: var(--ok-ink); font-weight: 700; }
.jobrow .jaddr { grid-column: 1 / -1; color: var(--muted); font-size: 0.9rem; }
.jobrow.on { border-color: var(--go); background: var(--ok-bg); box-shadow: inset 0 0 0 1px var(--go); }

.big {
  display: block; width: 100%; min-height: 4.2rem; padding: 0.9rem 1rem;
  font-size: 1.35rem; font-weight: 700; border: 0; border-radius: 14px; color: #fff; cursor: pointer;
}
.big:disabled { opacity: 0.45; cursor: default; }
.big.go { background: var(--go); }
.big.stop { background: var(--stop); }
.big.stop.confirm { outline: 4px solid #f5b3ae; }
.big.meal { background: var(--meal); }
.big.rest { background: var(--rest); }
.big.plain { background: #fff; color: var(--ink); border: 2px solid var(--line); }
.login .big { margin-top: 1rem; }

.toast { border-radius: 12px; padding: 0.8rem 1rem; margin-bottom: 1rem; font-weight: 600; }
.toast.ok { background: var(--ok-bg); color: var(--ok-ink); }
.toast.warn { background: var(--warn-bg); color: var(--warn-ink); }

.tabs { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
.tab { flex: 1; padding: 0.6rem; border: 2px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); cursor: pointer; }
.tab.on { border-color: var(--ink); background: var(--ink); color: #fff; }
.range { color: var(--muted); }
.totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin: 0.6rem 0 0.8rem; text-align: center; }
.totals div { background: var(--bg); border-radius: 10px; padding: 0.5rem 0.2rem; }
.totals b { display: block; font-size: 1.15rem; }
.totals span { color: var(--muted); font-size: 0.85rem; }
.day { border-top: 1px solid var(--line); padding: 0.6rem 0; }
.dayhead { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 0.3rem; }
.punch { display: flex; flex-wrap: wrap; gap: 0.2rem 0.6rem; padding: 0.2rem 0; font-size: 0.98rem; }
.punch .time { width: 4.8rem; font-variant-numeric: tabular-nums; }
.punch .kind { font-weight: 600; }
.punch .job { color: var(--muted); }
.tag { font-size: 0.8rem; padding: 0.05rem 0.45rem; border-radius: 999px; background: var(--bg); color: var(--muted); }
.tag.warn { background: var(--warn-bg); color: var(--warn-ink); }

/* My info, first sign-in check and change requests */
.inforow { display: flex; justify-content: space-between; gap: 1rem; padding: 0.45rem 0; border-top: 1px solid var(--line); }
.inforow span { color: var(--muted); }
.inforow b { text-align: right; overflow-wrap: anywhere; }
.readonly { background: var(--bg); border-radius: 10px; padding: 0.5rem 0.8rem; margin: 0.8rem 0 0.4rem; }
.request { border-top: 1px solid var(--line); padding: 0.6rem 0; }
.tag.ok { background: var(--ok-bg); color: var(--ok-ink); }
.tag.bad { background: var(--bad-bg); color: var(--bad-ink); }

/* Field notes and photos */
.big.note { background: var(--note); }
textarea {
  width: 100%; padding: 0.8rem; font: inherit; font-size: 1.1rem; line-height: 1.4; resize: vertical;
  border: 2px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
textarea:focus { outline: 3px solid #7fb0ea; border-color: var(--rest); }
.notecard label { display: block; font-weight: 600; margin: 0.9rem 0 0.3rem; }
.notecard .readonly { margin-top: 0.6rem; }
.pickers.notejob { padding: 0; }
.photobtns { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.big.half { font-size: 1.1rem; min-height: 3.6rem; }
.notethumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr)); gap: 0.5rem; margin-top: 0.5rem; }
.nthumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--bg); }
.nthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nremove {
  position: absolute; top: 0.25rem; right: 0.25rem; width: 2.2rem; height: 2.2rem; border-radius: 999px; border: 0;
  background: rgb(0 0 0 / 0.65); color: #fff; font-size: 1.3rem; line-height: 1; cursor: pointer;
}
.fnote { border-top: 1px solid var(--line); padding: 0.7rem 0; }
.fjob { font-weight: 600; margin: 0.1rem 0; }
.ftext { white-space: pre-wrap; overflow-wrap: anywhere; }
.fphotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr)); gap: 0.4rem; margin-top: 0.5rem; }
.fphoto { aspect-ratio: 1; padding: 0; border: 0; border-radius: 8px; overflow: hidden; background: var(--bg); cursor: zoom-in; }
.fphoto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fphoto.none { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 0.85rem; cursor: default; }

/* Full-size photo viewer (viewer.js), crew app and office site */
.viewer { position: fixed; inset: 0; z-index: 50; background: rgb(10 14 18 / 0.94); display: flex; align-items: center; justify-content: center; }
.viewer img { max-width: 100vw; max-height: calc(100vh - 3.5rem); object-fit: contain; }
.viewer button { position: absolute; border: 0; background: rgb(255 255 255 / 0.15); color: #fff; cursor: pointer; border-radius: 999px; }
.viewer .vclose { top: calc(env(safe-area-inset-top) + 0.6rem); right: 0.6rem; width: 3rem; height: 3rem; font-size: 1.8rem; line-height: 1; }
.viewer .vprev, .viewer .vnext { top: 50%; transform: translateY(-50%); width: 3rem; height: 3rem; font-size: 2rem; line-height: 1; }
.viewer .vprev { left: 0.6rem; }
.viewer .vnext { right: 0.6rem; }
.viewer .vbar { position: absolute; bottom: calc(env(safe-area-inset-bottom) + 0.8rem); left: 0; right: 0; display: flex; justify-content: center; gap: 1.2rem; color: #fff; }
.viewer .vbar a { color: #cfe3ff; }
