:root { --brand:#12355b; --brand2:#1e5a96; --accent:#f28c28; --bg:#eef2f6; --card:#fff; --line:#d5dde6; --text:#15212e; --muted:#5f6b7a; --err:#c62828; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin:0; font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; background:var(--bg); color:var(--text); padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
.topbar { position:sticky; top:0; z-index:10; background:var(--brand); color:#fff; padding:8px 12px; display:flex; justify-content:space-between; align-items:center; gap:8px; box-shadow:0 2px 6px rgba(0,0,0,.2); }
.brand { display:flex; align-items:center; gap:8px; min-width:0; flex:1; }
.brand-text { min-width:0; flex:1; }
.logo { background:var(--accent); color:#fff; font-weight:800; border-radius:8px; padding:6px 8px; font-size:14px; letter-spacing:.5px; flex-shrink:0; }
.title { font-weight:700; font-size:12px; line-height:1.2; letter-spacing:.2px;
  white-space:normal; overflow:hidden; display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2;
  word-break:break-word; }
.sub { font-size:10.5px; opacity:.8; margin-top:1px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.status { flex-shrink:0; }
.status { text-align:right; font-size:11px; display:flex; flex-direction:column; align-items:flex-end; gap:3px; }
.pill { padding:2px 8px; border-radius:10px; font-weight:600; background:#666; }
.pill.on { background:#2e7d32; } .pill.off { background:var(--err); }
.saved { opacity:.85; white-space:nowrap; }
main { max-width: 720px; margin: 0 auto; padding: 10px; }
.card { background:var(--card); border-radius:12px; margin-bottom:10px; box-shadow:0 1px 3px rgba(0,0,0,.08); overflow:hidden; }
.card > summary { list-style:none; cursor:pointer; padding:15px 16px; font-weight:700; font-size:17px; display:flex; align-items:center; gap:8px; min-height:54px; background:#f7f9fc; border-bottom:1px solid transparent; }
.card[open] > summary { border-bottom-color:var(--line); }
.card > summary::-webkit-details-marker { display:none; }
.card > summary::before { content:"▸"; color:var(--brand2); transition:transform .15s; display:inline-block; width:14px; }
.card[open] > summary::before { transform:rotate(90deg); }
.sum-right { margin-left:auto; font-weight:600; color:var(--brand2); font-size:15px; }
.card > :not(summary) { margin-left:14px; margin-right:14px; }
.card > :nth-child(2) { margin-top:12px; } .card > :last-child { margin-bottom:14px; }
label { display:block; font-size:13px; font-weight:600; color:var(--muted); margin-bottom:10px; }
.star { color:var(--err); }
label.req { position:relative; }
input, textarea { display:block; width:100%; margin-top:4px; font:inherit; font-size:16px; color:var(--text); padding:11px 12px; min-height:48px; border:1.5px solid var(--line); border-radius:9px; background:#fff; }
input:focus, textarea:focus { outline:none; border-color:var(--brand2); box-shadow:0 0 0 3px rgba(30,90,150,.15); }
label.invalid input { border-color:var(--err); background:#fff5f5; }
label.invalid::before { content:attr(data-err); position:absolute; right:0; top:0; color:var(--err); font-size:12px; }
textarea { resize:vertical; }
.grid2 { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.grid3 { display:grid; grid-template-columns:1fr 1.2fr 1fr; gap:8px; }
.ticketno { display:flex; justify-content:space-between; align-items:center; background:#fff8ef; border:1.5px dashed var(--accent); border-radius:10px; padding:10px 12px; margin-bottom:12px; }
.lbl { font-size:12px; color:var(--muted); font-weight:600; }
.tn { font-size:26px; font-weight:800; color:#b00020; letter-spacing:1px; }
.tn.pending { font-size:15px; color:var(--muted); }
.company { font-size:12.5px; color:var(--muted); background:#f6f8fa; border-radius:8px; padding:9px 11px; }
.company a { color:var(--brand2); }
.btn { font:inherit; font-weight:700; border:0; border-radius:10px; padding:12px 16px; min-height:48px; cursor:pointer; text-decoration:none; display:inline-flex; align-items:center; justify-content:center; }
.btn.primary { background:var(--accent); color:#fff; }
.btn.secondary { background:#e3ebf4; color:var(--brand); }
.card > .btn.add { display:flex; width:calc(100% - 28px); }
.btn.add { background:#fff; color:var(--brand2); border:2px dashed #a9bfd6; margin-bottom:10px; }
.card > .btn.small { min-height:40px; padding:8px 12px; font-size:14px; margin-top:8px; margin-bottom:12px; }
.btn:disabled { opacity:.6; }
.line { border:1.5px solid var(--line); border-radius:10px; padding:10px 10px 2px; margin-bottom:10px; background:#fcfdff; }
.line-head { display:flex; align-items:center; gap:8px; margin-bottom:8px; }
.line-head .amt-out { margin-left:auto; font-weight:700; color:var(--brand2); }
.icon.del { width:40px; height:40px; border-radius:50%; border:0; background:#fdecec; color:var(--err); font-size:16px; font-weight:700; cursor:pointer; }
.rowhead, .crow { display:grid; grid-template-columns: 1.15fr 0.85fr 1fr 1fr; gap:6px; align-items:center; }
.rowhead { font-size:11.5px; color:var(--muted); font-weight:700; text-transform:uppercase; margin-bottom:4px; }
.rowhead span:last-child { text-align:right; }
.crow { margin-bottom:8px; }
.crow input { margin-top:0; padding:10px 8px; }
.clabel { font-size:14px; font-weight:600; }
.crow .amt-out { text-align:right; font-weight:600; font-size:14px; font-variant-numeric:tabular-nums; }
.subtotal { display:flex; justify-content:space-between; padding:10px 2px 0; font-weight:600; border-top:1px solid var(--line); }
.totals { display:grid; grid-template-columns: 1fr auto; margin-top:12px; row-gap:0; }
.totals dt, .totals dd { margin:0; padding:10px 2px; border-bottom:1px solid var(--line); }
.totals dd { text-align:right; font-weight:600; font-variant-numeric:tabular-nums; }
.totals .grand { font-size:19px; font-weight:800; color:var(--brand); border-bottom:0; }
.totals input.pst { width:120px; text-align:right; margin:0; min-height:42px; padding:8px; }
.totals dd:has(input) { padding:4px 2px; }
.sigwrap { position:relative; border:2px solid #9fb4ca; border-radius:10px; background:#fff; height:190px; margin-top:12px; background-image:linear-gradient(to top, transparent 44px, #c7d3df 44px, #c7d3df 45px, transparent 45px); }
#sig { width:100%; height:100%; display:block; touch-action:none; border-radius:10px; }
.sighint { position:absolute; left:0; right:0; bottom:14px; text-align:center; color:#9aa8b6; pointer-events:none; font-size:14px; }
.actions { display:flex; gap:10px; margin:6px 0; }
.actions .btn { flex:1; }
.foot { font-size:12px; color:var(--muted); text-align:center; }
.empty { color:var(--muted); font-style:italic; }
.bottombar { position:fixed; left:0; right:0; bottom:0; z-index:10; background:#fff; border-top:1px solid var(--line); box-shadow:0 -2px 8px rgba(0,0,0,.1); display:flex; align-items:center; gap:12px; padding:10px 14px calc(10px + env(safe-area-inset-bottom)); }
.bottombar .bt { flex:1; }
.bottombar .amt { font-size:22px; font-weight:800; color:var(--brand); font-variant-numeric:tabular-nums; }
.bottombar .btn { min-height:54px; padding:0 22px; font-size:17px; }
.modal { position:fixed; inset:0; background:rgba(10,20,35,.55); z-index:20; display:flex; align-items:center; justify-content:center; padding:16px; }
.modal[hidden] { display:none; }
.modal-box { background:#fff; border-radius:14px; padding:18px; width:100%; max-width:420px; }
.modal-box h2 { margin:0 0 8px; font-size:20px; color:var(--brand); }
.modal-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.modal-actions .btn { flex:1; }
.steps { padding-left:18px; }
.toast { position:fixed; left:50%; transform:translateX(-50%); bottom:96px; background:#1d2733; color:#fff; padding:10px 16px; border-radius:20px; font-size:14px; z-index:30; max-width:90%; text-align:center; }
.toast[hidden] { display:none; }
.grid2 > label, .grid3 > label { min-width:0; }
input { min-width:0; }
input[type="date"] { -webkit-appearance:none; appearance:none; }
.modal-actions .btn { white-space:nowrap; padding:12px 10px; }

/* Crew PIN gate */
.pin-gate { position:fixed; inset:0; z-index:100; background:linear-gradient(160deg,#0b1f3a 0%,#12355b 50%,#1e5a96 100%);
  display:flex; align-items:center; justify-content:center; padding:20px; }
.pin-gate[hidden] { display:none !important; }
.pin-card { background:#fff; border-radius:16px; padding:28px 22px; width:100%; max-width:360px; box-shadow:0 12px 40px rgba(0,0,0,.35); text-align:center; }
.pin-logo { display:inline-block; background:var(--accent); color:#fff; font-weight:800; border-radius:10px; padding:8px 12px; font-size:18px; letter-spacing:.5px; margin-bottom:12px; }
.pin-card h1 { margin:0 0 8px; font-size:22px; color:var(--brand); }
.pin-help { margin:0 0 18px; font-size:14px; color:var(--muted); line-height:1.4; }
.pin-label { display:block; text-align:left; font-size:13px; font-weight:600; color:var(--muted); margin-bottom:14px; }
.pin-label input { letter-spacing:6px; text-align:center; font-size:22px; font-weight:700; }
.pin-error { color:var(--err); font-size:14px; font-weight:600; margin:0 0 12px; }
.pin-btn { width:100%; min-height:52px; font-size:17px; }
body.pin-locked > :not(#pinGate) { visibility:hidden; }
body.pin-locked #pinGate { visibility:visible; }
