/* Built for people in a truck bay with gloves half off: big targets, big text, plain words. */
:root {
  --ink: #1a1a1a;
  --quiet: #5f6368;
  --line: #d6d6d6;
  --bg: #f4f4f2;
  --card: #ffffff;
  --brand: #14284b;        /* department uniform navy */
  --brand-soft: #e7ecf5;
  --good: #1b7f3a;
  --good-bg: #e3f4e8;
  --warn: #9a5b00;
  --warn-bg: #fff3dc;
  --bad: #c62828;
  --bad-bg: #fde7e7;
  --info-bg: #e8f0fe;
  --radius: 12px;
  --tap: 56px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 18px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
main { max-width: 640px; margin: 0 auto; padding: 0 16px 120px; }
main.wide { max-width: 1120px; }
h1 { font-size: 28px; margin: 20px 0 4px; line-height: 1.2; }
h2 { font-size: 22px; margin: 24px 0 8px; }
h3 { font-size: 19px; margin: 0 0 6px; }
p { margin: 6px 0; }
a { color: var(--brand); }
.quiet { color: var(--quiet); }
.small { font-size: 15px; }
[hidden] { display: none !important; }

/* Top bar */
.top {
  position: sticky; top: 0; z-index: 5; background: var(--brand); color: #fff;
  margin: 0 -16px; padding: 10px 16px 10px;
}
.top .row { display: flex; align-items: center; gap: 8px; }
.top h1 { font-size: 22px; margin: 0; flex: 1; color: #fff; }
.top .quiet, .top .small { color: #c9d3e6; }
.back {
  min-height: 44px; padding: 0 12px 0 4px; border: 0; background: none; color: #fff;
  font: inherit; font-size: 17px; cursor: pointer; display: inline-flex; align-items: center;
}
.top .tabs button { background: transparent; color: #fff; border-color: #50648c; }
.top .tabs button[aria-current="page"] { background: #fff; color: var(--brand); border-color: #fff; }
.progress { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin-top: 8px; }
.top .progress { background: #3a4f78; }
.progress > div { height: 100%; background: var(--good); transition: width .2s; }

/* Buttons */
button, .btn {
  font: inherit; cursor: pointer; border-radius: var(--radius); min-height: var(--tap);
  border: 2px solid var(--line); background: var(--card); color: var(--ink); padding: 10px 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
button:disabled { opacity: .5; cursor: default; }
.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.big { width: 100%; min-height: 72px; font-size: 22px; font-weight: 700; margin: 12px 0; }
.wide-btn { width: 100%; margin: 8px 0; }
.link { border: 0; background: none; color: var(--brand); min-height: 44px; padding: 0 4px; text-decoration: underline; }
.choices { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; margin-top: 10px; }
.choice { font-weight: 600; padding: 8px 6px; }
.choice.good { color: var(--good); border-color: #9fd3ae; }
.choice.warn { color: var(--warn); border-color: #f0c98a; }
.choice.bad { color: var(--bad); border-color: #f1a7a7; }
.choice[aria-pressed="true"].good { background: var(--good); border-color: var(--good); color: #fff; }
.choice[aria-pressed="true"].warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.choice[aria-pressed="true"].bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.choice[aria-pressed="true"]::before { content: "\2713"; }

/* Cards */
.card {
  background: var(--card); border-radius: var(--radius); padding: 16px; margin: 12px 0;
  border: 1px solid var(--line);
}
.card.done { border-left: 6px solid var(--good); }
.card.flag { border-left: 6px solid var(--bad); }
.card.child { margin-left: 20px; }
.card .label { font-size: 19px; font-weight: 600; }
.card .hint { color: var(--quiet); font-size: 15px; margin-top: 2px; }
.card .checkedby { color: var(--quiet); font-size: 14px; margin-top: 8px; }
.hero { background: var(--card); border-radius: var(--radius); padding: 20px; margin: 16px 0; border: 2px solid var(--brand); }
.hero .truck { font-size: 30px; font-weight: 800; }

.notice { border-radius: 10px; padding: 10px 12px; margin: 10px 0; font-size: 16px; }
.notice.warn { background: var(--warn-bg); color: #5c3700; }
.notice.bad { background: var(--bad-bg); color: #7a1414; }
.notice.good { background: var(--good-bg); color: #0d4a22; }
.notice.info { background: var(--info-bg); color: #1a3c7a; }
.banner { background: #fff8c5; border: 1px solid #e6d36b; border-radius: 10px; padding: 12px; margin: 12px 0; font-weight: 600; }

/* Inputs */
input, textarea, select {
  font: inherit; font-size: 20px; width: 100%; padding: 12px; border-radius: 10px;
  border: 2px solid var(--line); background: #fff; color: var(--ink);
}
input.pin { -webkit-text-security: disc; text-security: disc; letter-spacing: .25em; }  /* dots, without being a password box */
input:focus, textarea:focus, select:focus { outline: 3px solid #90caf9; border-color: #1976d2; }
textarea { min-height: 76px; font-size: 18px; }
label.field { display: block; margin: 14px 0; font-weight: 600; }
label.field span { display: block; margin-bottom: 6px; }
.reading { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.reading input { max-width: 170px; font-size: 24px; text-align: center; }
.reading .unit { font-size: 20px; font-weight: 600; }

/* Counter */
.counter { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.counter button { width: 64px; font-size: 30px; font-weight: 700; padding: 0; }
.counter .n { font-size: 30px; font-weight: 800; min-width: 48px; text-align: center; }
.counter .of { font-size: 20px; color: var(--quiet); }

.extra { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 12px; }
.photos { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.photos img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.photo-btn { position: relative; overflow: hidden; }
.photo-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list > li > button, .list > li > a {
  width: 100%; justify-content: space-between; text-align: left; margin: 8px 0; padding: 14px 16px;
  background: var(--card); border: 1px solid var(--line);
}
.list .name { font-weight: 600; }
.list .meta { color: var(--quiet); font-size: 16px; white-space: nowrap; }
@media (max-width: 420px) { .list .meta { white-space: normal; } }  /* no sideways scrolling on a small phone */
.badge { display: inline-block; font-size: 13px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #eee; color: var(--ink); margin-left: 6px; }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.info { background: var(--info-bg); color: #1a3c7a; }

.sync {
  position: sticky; top: 0; z-index: 10; padding: 10px 16px; text-align: center; font-size: 16px;
  background: #263238; color: #fff;
}
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 20;
  background: #263238; color: #fff; padding: 12px 18px; border-radius: 10px; max-width: 90vw; font-size: 16px;
}
.suggest { list-style: none; padding: 0; margin: 6px 0; border: 1px solid var(--line); border-radius: 10px; max-height: 260px; overflow: auto; background: #fff; }
.suggest li button { width: 100%; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; justify-content: flex-start; min-height: 48px; }

/* Captain */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.tabs button { min-height: 46px; font-size: 16px; }
.tabs button[aria-current="page"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip { min-height: 44px; padding: 4px 12px; border-radius: 999px; font-size: 16px; font-weight: 700; }
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip.air::after { content: " \2708"; font-weight: 400; }
.match { background: var(--info-bg); border-radius: 10px; padding: 10px 12px; margin-top: 10px; font-size: 16px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.row-actions button { min-height: 46px; font-size: 16px; }
table.members { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; }
table.members th, table.members td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: 16px; }
.toggle { display: flex; align-items: center; gap: 10px; font-weight: 600; }
/* Checklist editor */
.item-row { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.item-row.child, div.child { margin-left: 28px; }
.item-main { flex: 1; min-width: 220px; }
.item-name { font-weight: 600; }
.item-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.item-actions button { min-height: 44px; padding: 6px 12px; font-size: 16px; }
.card .row-actions button, .card .row-actions a { min-height: 44px; }
.toggle input { width: 28px; height: 28px; }
@media (min-width: 900px) {
  .split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
}

/* Duty Crew team follow-up and the record of every change */
.team-box { margin-top: 12px; padding: 10px; border: 2px solid var(--brand); border-radius: 10px; background: #f4f6fb; }
.team-box textarea { width: 100%; min-height: 70px; margin: 6px 0; }
.strong { font-weight: 700; }
details.record { margin: 8px 0; }
details.record summary { cursor: pointer; font-weight: 700; color: var(--brand); min-height: 32px; }
details.record ul { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }
details.record li { margin: 3px 0; }
/* Members: one card each, every switch labelled */
.member-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.card.member h3 { margin: 0 0 6px; }
.card.member .set { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); }
.card.member .set select { min-height: 44px; font-size: 16px; max-width: 60%; }
/* Shared iPad: who is signed in, always on screen */
.who { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; align-items: center; gap: 14px;
  padding: 8px calc(16px + env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
  background: var(--brand); color: #fff; font-size: 17px; font-weight: 700; }
.who button { min-height: 44px; background: #fff; color: var(--brand); border-color: #fff; }
/* Start a truck over: clearly a big step */
.danger-box { margin-top: 10px; padding: 10px; border: 2px solid var(--bad); border-radius: 10px; background: var(--bad-bg); }
.danger-box textarea { width: 100%; min-height: 60px; margin: 6px 0; }
button.danger { background: var(--bad); color: #fff; border-color: var(--bad); }
.link.danger-link { color: var(--bad); }
