:root {
  --navy: #1B365D; --navy-2: #2E4A73; --bg: #F4F6FA; --card: #FFFFFF; --line: #D9DEE7; --ink: #1F2933; --muted: #5F6B7A;
  --green: #2E8B57; --green-soft: #E3F4EA; --amber: #B7791F; --amber-soft: #FDF3DC; --red: #C53030; --red-soft: #FDE8E8;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.4 Roboto, "Segoe UI", system-ui, sans-serif; }
button { font: inherit; }
a { color: inherit; }

.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px;
       padding: calc(10px + env(safe-area-inset-top)) 20px 10px;          /* clear the iPhone notch when opened from the home screen */
       background: var(--navy); color: #fff; min-height: 60px; }
.brand { font-weight: 800; font-size: 22px; letter-spacing: 1px; text-decoration: none; }
.crumb { flex: 1; font-size: 16px; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-right { display: flex; align-items: center; gap: 12px; }
.net { font-size: 14px; padding: 4px 10px; border-radius: 99px; background: rgba(255,255,255,.12); }
.net.off { background: var(--amber); }
.outbox-btn, .rep { color: #fff; background: rgba(255,255,255,.12); border: 0; border-radius: 99px; padding: 8px 14px;
                    text-decoration: none; font-size: 15px; cursor: pointer; }
.outbox-btn b { background: var(--amber); border-radius: 99px; padding: 0 7px; margin-left: 4px; }

main { max-width: 1180px; margin: 0 auto; padding: 20px 20px 120px; }
h1 { font-size: 26px; margin: 4px 0 4px; }
h2 { font-size: 20px; margin: 26px 0 10px; color: var(--navy); }
.sub { color: var(--muted); margin: 0 0 16px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
a.card { display: block; text-decoration: none; }
a.card:active { background: #EEF2F7; }
.card-title { font-weight: 700; font-size: 19px; }
.card-meta { color: var(--muted); font-size: 15px; margin-top: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { font-size: 13px; padding: 3px 10px; border-radius: 99px; background: #EEF2F7; color: var(--navy-2); }
.chip.done { background: var(--green-soft); color: var(--green); }
.chip.prog { background: var(--amber-soft); color: var(--amber); }
.chip.far { background: var(--red-soft); color: var(--red); }

.checkin { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--radius); margin: 8px 0 4px;
           background: var(--green-soft); color: var(--green); font-weight: 600; }
.checkin.far { background: var(--amber-soft); color: var(--amber); }
.checkin.none { background: #EEF2F7; color: var(--muted); }

.mission-head { position: sticky; top: calc(60px + env(safe-area-inset-top)); z-index: 10; background: var(--bg); padding: 12px 0 10px; border-bottom: 1px solid var(--line);
                display: flex; align-items: center; gap: 16px; }
.mission-head .grow { flex: 1; min-width: 0; }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress > i { display: block; height: 100%; background: var(--green); }
.btn { border: 0; border-radius: 10px; padding: 14px 22px; font-weight: 700; cursor: pointer; background: var(--navy); color: #fff; font-size: 17px; }
.btn.green { background: var(--green); }
.btn.ghost { background: #E6EBF2; color: var(--navy); }
.btn:disabled { opacity: .5; }

.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 0 10px; }
.list-head h2 { margin: 0; }
.tag { font-size: 13px; font-weight: 600; color: var(--muted); background: #E6EBF2; border-radius: 99px; padding: 3px 10px; margin-left: 8px; vertical-align: middle; }

.item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.item.missing { border: 2px solid var(--red); }
.item.answered { border-left: 6px solid var(--green); }
.item-name { font-weight: 700; font-size: 18px; }
.item-ids { color: var(--muted); font-size: 14px; margin-top: 2px; }
.q { margin-top: 14px; }
.q .label { font-size: 15px; font-weight: 600; color: var(--navy-2); margin-bottom: 8px; }
.q .label .opt { font-weight: 400; color: var(--muted); }
.q.sub { margin-left: 18px; padding-left: 14px; border-left: 3px solid var(--line); }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { border: 2px solid var(--line); background: #fff; border-radius: 10px; padding: 12px 16px; min-height: 52px; cursor: pointer;
          font-size: 16px; text-align: left; }
.choice.on { border-color: var(--navy); background: var(--navy); color: #fff; }
.choice.on.good { border-color: var(--green); background: var(--green); }
.choice.on.bad { border-color: var(--red); background: var(--red); }
.stepper { display: inline-flex; align-items: center; border: 2px solid var(--line); border-radius: 10px; overflow: hidden; }
.stepper button { width: 56px; height: 52px; border: 0; background: #EEF2F7; font-size: 26px; cursor: pointer; }
.stepper input { width: 80px; height: 52px; border: 0; text-align: center; font-size: 20px; }
.photos { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.photos img { width: 104px; height: 104px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.shot { position: relative; }
.shot button { position: absolute; top: -8px; right: -8px; width: 30px; height: 30px; border-radius: 99px; border: 0; background: var(--red);
               color: #fff; font-size: 18px; cursor: pointer; }
.cam { border: 2px dashed var(--navy-2); background: #F7F9FC; color: var(--navy); border-radius: 10px; height: 104px; padding: 0 18px;
       font-weight: 700; cursor: pointer; }
.link { background: none; border: 0; color: var(--navy-2); text-decoration: underline; cursor: pointer; padding: 6px 0; font-size: 15px; }
.empty { color: var(--muted); padding: 10px 0; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.banner { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 14px; background: var(--amber-soft); color: #7A5200; }
.banner.ok { background: var(--green-soft); color: var(--green); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1F2933; color: #fff; padding: 14px 22px;
         border-radius: 12px; font-size: 16px; z-index: 50; max-width: 90vw; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; z-index: 40; padding: 20px; }
.modal .card { width: min(560px, 100%); }
.modal input { width: 100%; font-size: 18px; padding: 12px; border: 2px solid var(--line); border-radius: 10px; margin: 12px 0 16px; }
.modal ul { padding-left: 20px; max-height: 40vh; overflow: auto; }

@media (max-width: 640px) {
  main { padding: 14px 14px 110px; }
  .crumb { display: none; }
  .mission-head { flex-wrap: wrap; }
}
