/* Pascoe Field Services — light surfaces only until BRAND-02 is resolved.
   Brand green sampled from the approved mark: deep green on near-white. */

:root {
  --green: #106020;
  --green-dark: #0b451a;
  --ink: #16211a;
  --muted: #5c6b61;
  --line: #dde5df;
  --bg: #f6f8f6;
  --card: #ffffff;
  /* Was #b97c10, which measured 3.09:1 on #fdeeda -- the background of EVERY
     text use of this token: the offline pill, the queued pill, "due soon",
     "due" and the offline note. WCAG AA wants 4.5:1 for normal text, so all
     five failed, on states an engineer reads on a phone in daylight.
     #8a5507 measures 5.44:1 on #fdeeda and 6.21:1 on white, and matches the
     dark ochre `.access-notes` already uses on the same background, so it is
     the palette's own answer rather than a new one. It is also the 5px accent
     border on `.card.asset.due-soon`, where the bar is 3:1 for a non-text
     indicator and darkening only helps. MEASURED, not eyeballed. */
  --amber: #8a5507;
  --red: #b3261e;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: #ffffff; border-bottom: 1px solid var(--line);
  padding: 10px 14px;
  position: sticky; top: 0; z-index: 5;
}
.brand { height: 40px; width: auto; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.linklike {
  background: none; border: none; color: var(--green);
  font-size: 14px; cursor: pointer; padding: 4px;
}

.sync-pill {
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  background: #e7f2e9; color: var(--green-dark); white-space: nowrap;
}
.sync-pill.offline { background: #fdeeda; color: var(--amber); }
.sync-pill.queued  { background: #fdeeda; color: var(--amber); }
.sync-pill.syncing { background: #e2ecfb; color: #23508f; }

.content { max-width: 680px; margin: 0 auto; padding: 16px 14px 90px; }
h1 { font-size: 24px; margin: 8px 0 4px; }
h2 { font-size: 20px; margin: 10px 0 6px; }
h3 { font-size: 16px; margin: 0 0 8px; }
.muted { color: var(--muted); margin: 4px 0 12px; }
.muted.small { font-size: 13px; }
.error { color: var(--red); min-height: 1em; }
.empty { color: var(--muted); background: var(--card); border: 1px dashed var(--line);
  border-radius: var(--radius); padding: 18px; text-align: center; }

.tabs { display: flex; gap: 8px; margin: 6px 0 14px; }
.tab {
  flex: 1; padding: 10px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); font-size: 15px; color: var(--muted); cursor: pointer;
}
.tab.active { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }

.cards { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px;
  text-decoration: none; color: inherit; display: block;
}
.card.asset.overdue { border-left: 5px solid var(--red); }
.card.asset.due-soon { border-left: 5px solid var(--amber); }
.card.asset.ok { border-left: 5px solid var(--green); }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ref { font-weight: 700; letter-spacing: 0.02em; }
.card-main { margin: 4px 0 2px; }
.card-sub { color: var(--muted); font-size: 13.5px; }

.pill {
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em;
  padding: 2px 9px; border-radius: 999px; background: #eef1ee; color: var(--muted);
  white-space: nowrap;
}
.pill.overdue { background: #fbe4e2; color: var(--red); }
.pill.due-soon { background: #fdeeda; color: var(--amber); }
.pill.ok { background: #e7f2e9; color: var(--green-dark); }
.pill.gen { background: #e7f2e9; color: var(--green-dark); }
.pill.open-job { margin-left: 8px; background: #e2ecfb; color: #23508f; }
.pill.status-due { background: #fdeeda; color: var(--amber); }
.pill.status-scheduled, .pill.status-assigned { background: #e2ecfb; color: #23508f; }
.pill.status-in_progress, .pill.status-on_site { background: #e7f2e9; color: var(--green-dark); }
.pill.status-complete, .pill.status-done { background: #e7f2e9; color: var(--green-dark); }
.pill.offline-note { display: inline-block; margin-bottom: 10px; background: #fdeeda; color: var(--amber); }

button.primary, button.step, button.complete {
  display: block; width: 100%; padding: 13px 16px; margin: 8px 0;
  border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font-size: 16px; cursor: pointer;
}
button.primary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
button.primary[disabled] { opacity: 0.6; }
/* A completed step is a statement, not a control, so it is a <p> and not a
   <button> -- it shares the button's box so the sheet keeps its rhythm, but it
   takes no focus and no pointer cursor, because there is nothing to press. */
p.step.done {
  display: block; width: 100%; padding: 13px 16px; margin: 8px 0;
  border-radius: var(--radius); font-size: 16px;
  background: #e7f2e9; border: 1px solid #cfe4d4; color: var(--green-dark);
}
button.complete { background: var(--green-dark); border-color: var(--green-dark); color: #fff; font-weight: 700; }
button.wide { width: 100%; }

.schedule-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.schedule-row select, .schedule-row input {
  flex: 1; min-width: 130px; padding: 10px; border-radius: 10px;
  border: 1px solid var(--line); font-size: 15px; background: #fff;
}
.schedule-row button { width: auto; flex-basis: 100%; margin: 0; }

.signin { max-width: 360px; margin: 8vh auto 0; }
.chk-input {
  width: 100%; padding: 12px; margin: 6px 0; font-size: 16px;
  border-radius: 10px; border: 1px solid var(--line); background: #fff;
}

.steps { margin-top: 14px; }
.step-block {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; margin: 10px 0;
}
.site-block { margin-bottom: 4px; }
.access-notes {
  margin-top: 6px; padding: 8px 10px; background: #fdeeda;
  border-radius: 8px; font-size: 13.5px; color: #6b4a0e;
}
.back { display: inline-block; margin: 2px 0 8px; color: var(--green); text-decoration: none; }
.done-banner {
  background: #e7f2e9; border: 1px solid #cfe4d4; color: var(--green-dark);
  border-radius: var(--radius); padding: 14px; font-weight: 600;
}

.chk-row { margin: 12px 0; }
.chk-row label,
.chk-row .chk-label { display: block; font-size: 14.5px; margin-bottom: 6px; }
.seg { display: flex; gap: 8px; }
.seg-opt {
  flex: 1; padding: 10px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; font-size: 15px; text-transform: capitalize; cursor: pointer;
}
.seg-opt.picked { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }

.hidden-file { display: none; }
.sig-pad {
  width: 100%; height: auto; touch-action: none;
  background: #fff; border: 1px dashed var(--line); border-radius: 10px;
}
.sig-actions { display: flex; gap: 8px; }
.sig-actions button { flex: 1; }
.flash { color: var(--red); font-size: 13px; }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; background: #fff; border-top: 1px solid var(--line);
}
.bottom-nav a {
  flex: 1; text-align: center; padding: 13px 0 max(13px, env(safe-area-inset-bottom));
  color: var(--muted); text-decoration: none; font-size: 15px;
}
.bottom-nav a.active { color: var(--green-dark); font-weight: 700; }

.foot { color: var(--muted); font-size: 12.5px; text-align: center; padding: 18px 14px 80px; }

@media (min-width: 700px) {
  .cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .card { align-self: start; }
}

/* A capture the server refused permanently. Deliberately the loudest state the
   pill has: unlike "queued", waiting will not clear it, and unlike "offline"
   the engineer cannot fix it by walking outside. Someone has to look. */
.sync-pill.blocked {
  background: #7a1f1f;
  color: #fff;
  border-color: #7a1f1f;
  font-weight: 600;
}

/* A queue held up only because the session expired. Louder than plain "queued"
   -- waiting will not clear this one either -- but not the blocked red, because
   nothing has been refused and nothing needs deciding: the captures are intact
   and one sign-in sends them. The distinction is carried by the pill's TEXT
   ("sign in again"); this only stops it looking like ordinary waiting. */
.sync-pill.queued.signed-out {
  background: #fbe3d0;
  color: #8a3d0b;
  border-color: #e9bb96;
  font-weight: 600;
}

/* Visually hidden, still announced. The schedule row is a compact horizontal
   strip and visible captions would push it onto two lines on a phone, but an
   unlabelled <select> and <input type=date> are read out as bare controls -- so
   the label exists and only the sighted layout is unchanged. NOT display:none
   or visibility:hidden: both remove it from the accessibility tree, which is
   the whole thing being fixed. */
.sr-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* The refused-capture card. `reason` is the server's own words, so it is set in
   the monospace face and allowed to wrap: it is the one line an office user
   needs to read exactly rather than skim. */
.card.blocked-capture { border-left: 4px solid #7a1f1f; }
.card.blocked-capture .reason {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  overflow-wrap: anywhere;
  margin-top: 6px;
}
a.sync-pill { text-decoration: none; }
