:root {
  --bg: #f4f6f5; --card: #fff; --ink: #17201b; --mute: #66726b; --line: #e1e6e3;
  --green: #14804a; --green-d: #0f5132; --red: #c0352b; --orange: #c46a00; --orange-bg: #fff4e5; --blue: #1f63c6;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
#app { display: flex; flex-direction: column; height: 100%; max-width: 560px; margin: 0 auto; }
.splash { margin: auto; color: var(--mute); }

header { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--green-d); color: #fff; }
header div { display: flex; flex-direction: column; min-width: 0; }
header b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header small { opacity: .8; font-size: 13px; }
main { flex: 1; overflow-y: auto; padding: 16px; }
nav { display: flex; border-top: 1px solid var(--line); background: #fff; padding-bottom: env(safe-area-inset-bottom); }
nav button { flex: 1; padding: 14px 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--mute); }
nav button.on { color: var(--green-d); box-shadow: inset 0 3px 0 var(--green); }

.pill { border: 0; border-radius: 99px; padding: 5px 11px; font: 600 13px/1 inherit; white-space: nowrap; color: #fff; }
.pill.green { background: rgba(255,255,255,.18); }
.pill.orange { background: var(--orange); }
.pill.blue { background: var(--blue); }
.pill.grey { background: rgba(255,255,255,.25); }

.btn { display: block; width: 100%; border: 0; border-radius: 12px; padding: 13px 16px; margin: 8px 0 0;
  font: 600 16px/1.2 inherit; background: #e8ecea; color: var(--ink); cursor: pointer; }
.btn:disabled { opacity: .45; }
.btn.green { background: var(--green); color: #fff; }
.btn.red { background: var(--red); color: #fff; }
.btn.big { padding: 16px; font-size: 18px; }
.btn.huge { padding: 26px; font-size: 24px; letter-spacing: 1px; border-radius: 18px; margin-top: 18px; }
.btn.small { width: auto; display: inline-block; padding: 9px 14px; margin: 0; font-size: 15px; border-radius: 10px; flex: none; }
.btn.plain { background: none; color: var(--mute); }
.btn.link { background: none; color: var(--blue); text-decoration: underline; }
.btn.wide { width: 100%; }

.status { background: var(--card); border-radius: 18px; padding: 22px 18px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.status .label { color: var(--mute); font-weight: 600; text-transform: uppercase; font-size: 13px; letter-spacing: .5px; }
.status.in { border: 2px solid var(--green); }
.status.in .label { color: var(--green); }
.status .site { font-size: 22px; font-weight: 700; margin-top: 4px; }
.status .since { color: var(--mute); }

h3 { margin: 22px 0 8px; font-size: 15px; color: var(--mute); text-transform: uppercase; letter-spacing: .4px; }
.card h3 { margin: 0; }
.list { list-style: none; margin: 0; padding: 0; background: var(--card); border-radius: 14px; overflow: hidden; }
.list li { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.list li:last-child { border-bottom: 0; }
.list .times { text-align: right; white-space: nowrap; }
.list small, .row small { display: block; color: var(--mute); font-size: 13px; }
.empty { color: var(--mute); text-align: center; padding: 14px; margin: 0; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; border-radius: 6px; padding: 2px 6px; margin-left: 6px; vertical-align: middle; }
.tag.orange { background: var(--orange-bg); color: var(--orange); }
.orange-t { color: var(--orange); font-weight: 600; }

.card { display: block; background: var(--card); border-radius: 14px; padding: 14px; margin-bottom: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.card.warn { background: var(--orange-bg); border: 1px solid #f3c98b; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
details.card summary { font-weight: 600; color: var(--mute); cursor: pointer; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.row:first-of-type { border-top: 0; }
.row > div { min-width: 0; }
.crew-top { margin-bottom: 12px; }
.crew-top select { font-weight: 700; }

input, select { width: 100%; font: inherit; font-size: 17px; padding: 12px; border: 1px solid #cdd5d1; border-radius: 10px; background: #fff; color: var(--ink); margin-top: 4px; }
input[type=search] { margin-bottom: 4px; }
label { display: block; margin: 12px 0 0; font-weight: 600; font-size: 14px; color: var(--mute); }
.check { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); margin: 0; color: var(--ink); font-size: 16px; }
.check input { width: 22px; height: 22px; margin: 0; flex: none; }
.check span { flex: 1; font-weight: 600; }
.checks { max-height: 38vh; overflow-y: auto; margin-top: 8px; }

.gps { color: var(--orange); font-size: 14px; margin: 10px 0 0; }
.gps.ok { color: var(--green); }
.err { color: var(--red); min-height: 1em; margin: 8px 0 0; }
.note { background: var(--orange-bg); color: var(--orange); padding: 10px; border-radius: 10px; }
.small { font-size: 13px; color: var(--mute); }
.center { text-align: center; }

.sheet-wrap { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet-wrap[hidden] { display: none; }
.sheet { background: #fff; width: 100%; max-width: 560px; max-height: 94vh; overflow-y: auto; border-radius: 20px 20px 0 0;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); }
.sheet h2 { margin: 0 0 10px; font-size: 20px; }
.preview { display: block; width: 100%; max-height: 34vh; object-fit: contain; background: #111; border-radius: 12px; }

.login { margin: auto; width: 100%; padding: 28px 22px; }
.login .logo { width: 72px; height: 72px; border-radius: 18px; display: block; margin: 0 auto 8px; }
.login h1 { text-align: center; font-size: 22px; margin: 0 0 8px; }

.toast { position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #222; color: #fff;
  padding: 11px 18px; border-radius: 99px; z-index: 20; font-weight: 600; max-width: 90vw; text-align: center; }
.toast[hidden] { display: none; }

.seg { display: flex; gap: 8px; margin-top: 4px; }
.seg label { flex: 1; margin: 0; }
.seg input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg span { display: block; text-align: center; padding: 11px 6px; border: 1px solid #cdd5d1; border-radius: 10px; color: var(--ink); font-size: 15px; }
.seg input:checked + span { background: var(--green-d); border-color: var(--green-d); color: #fff; }
.site-row { display: flex; gap: 8px; align-items: center; }
.site-row select { flex: 1; margin: 0; }

[hidden] { display: none !important; }
