:root {
  --navy: #0b2a5b; --navy-2: #163f80; --ink: #15202e; --muted: #5b6878; --line: #d9dfe7; --bg: #f1f4f8; --card: #fff;
  --ok: #1f8a3e; --ok-bg: #e3f6e7; --wait: #a86f00; --wait-bg: #fff4d6; --warn: #c0392b; --warn-bg: #ffe8e4;
  --radius: 12px; --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; padding-bottom: calc(24px + var(--safe-b)); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--navy-2); }
[hidden] { display: none !important; }

/* header */
.top { background: var(--navy); color: #fff; padding-top: env(safe-area-inset-top, 0); }
.top-inner { max-width: 880px; margin: 0 auto; padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.top .logo { width: 46px; height: 46px; flex: none; object-fit: contain; }
.title-block { flex: 1; text-align: center; min-width: 0; }
.eyebrow { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; opacity: .75; }
h1 { font-size: 20px; margin: 2px 0 0; }
.top-actions { max-width: 880px; margin: 0 auto; padding: 0 14px 10px; display: flex; gap: 8px; justify-content: flex-end; }
.ghost { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: 9px; padding: 0 14px; font-size: 14px; min-height: 40px; }
.ios-hint { max-width: 880px; margin: 10px auto 0; background: #e8f0ff; border: 1px solid #c5d6f5; color: #173a74; padding: 10px 44px 10px 14px; border-radius: 10px; font-size: 14px; position: relative; }
.x { position: absolute; right: 2px; top: 0; background: none; border: 0; font-size: 26px; width: 44px; height: 44px; color: var(--muted); }

main { max-width: 880px; margin: 0 auto; padding: 12px; }
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(15,30,60,.06), 0 0 0 1px rgba(15,30,60,.05); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
h2 { font-size: 17px; margin: 0; }
h3 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 12.5px; }
p { margin: 0 0 10px; }

/* form controls */
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
input:not([type=checkbox]), select, textarea { display: block; width: 100%; min-width: 0; max-width: 100%; margin-top: 4px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); font-size: 16px; min-height: 44px; }
input[type=date] { -webkit-appearance: none; appearance: none; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--navy-2); border-color: transparent; }
.grid { display: grid; gap: 10px; grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
.grid > * { min-width: 0; }
.grid .wide { grid-column: 1 / -1; }
@media (min-width: 640px) { .grid.g4 { grid-template-columns: repeat(4, 1fr); } .grid.g3 { grid-template-columns: repeat(3, 1fr); } }
.btn { min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-weight: 600; font-size: 15px; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.danger { color: var(--warn); }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: 14px; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.link-btn { background: none; border: 0; color: var(--navy-2); font-weight: 600; padding: 0 6px; min-height: 44px; font-size: 15px; }

/* home */
.member { display: flex; gap: 14px; align-items: center; }
.avatar { width: 54px; height: 54px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 18px; flex: none; }
.member-name { font-weight: 700; font-size: 17px; }
.track-card { display: flex; align-items: center; gap: 14px; background: #fff; border-radius: 14px; padding: 14px; text-decoration: none; color: var(--ink); border: 1px solid var(--line); margin-top: 10px; }
.track-card:active { transform: scale(.99); }
.badge { flex: none; width: 58px; height: 54px; border-radius: 12px; display: grid; place-items: center; background: var(--navy); color: #fff; font-weight: 800; font-size: 14px; }
.track-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.chev { font-size: 28px; color: #a5afbd; flex: none; }
.bar { height: 8px; background: #e6ebf2; border-radius: 6px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--navy-2); border-radius: 6px; }
.bar.done > span { background: var(--ok); }
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); min-height: 44px; }
.list-row:first-child { border-top: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 20px; background: #e8eef8; color: var(--navy); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.wait { background: var(--wait-bg); color: var(--wait); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }

/* track */
.back { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; text-decoration: none; margin-bottom: 4px; }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 8px 0; }
.tab { text-decoration: none; color: var(--ink); min-height: 52px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-weight: 700; font-size: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 4px; }
.tab small { font-weight: 600; font-size: 11.5px; color: var(--muted); }
.tab.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.tab.on small { color: #c9d6ee; }
.banner { border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 12px; }
.banner.info { background: #e8f0ff; color: #173a74; }
.banner.ok { background: var(--ok-bg); color: #155f2b; }
.banner.wait { background: var(--wait-bg); color: #6d4a00; }
.sec-title { font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin: 16px 0 4px; display: flex; justify-content: space-between; }
.req { display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; background: #fff; border: 0; border-top: 1px solid var(--line); padding: 12px 2px; min-height: 56px; }
.req:first-of-type { border-top: 0; }
.dot { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 2px solid #b9c3d1; display: grid; place-items: center; font-size: 15px; font-weight: 800; color: #fff; margin-top: 1px; }
.dot.ok { background: var(--ok); border-color: var(--ok); }
.dot.wait { border-color: var(--wait); color: var(--wait); background: var(--wait-bg); font-size: 13px; }
.req-text { flex: 1; min-width: 0; font-size: 15px; }
.req-sub { display: block; font-size: 13px; color: var(--muted); margin-top: 3px; }
.req-sub.ok { color: var(--ok); font-weight: 600; }
.req-sub.wait { color: var(--wait); font-weight: 600; }
.req-sub.warn { color: var(--warn); font-weight: 600; }
.sig-box { border: 1px dashed #aab5c4; border-radius: 10px; min-height: 64px; display: grid; place-items: center; background: #fafbfd; width: 100%; }
.sig-box img { max-height: 56px; max-width: 90%; }
.pub-row { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--line); padding: 10px 2px; min-height: 52px; }

/* modals */
.modal { position: fixed; inset: 0; background: rgba(10,20,40,.55); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 640px) { .modal { align-items: center; } }
.sheet { background: #fff; width: 100%; max-width: 620px; max-height: 92vh; overflow: auto; border-radius: 16px 16px 0 0; padding: 18px 16px calc(18px + var(--safe-b)); }
@media (min-width: 640px) { .sheet { border-radius: 16px; } }
.sheet h2 { margin-bottom: 8px; }
.sheet .req-full { font-size: 15px; margin-bottom: 10px; }
.sheet .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.chip { min-height: 36px; padding: 0 12px; border-radius: 18px; border: 1px solid var(--line); background: #f5f7fb; font-size: 14px; font-weight: 600; }
.auto-box { border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 12px; }
.pad { width: 100%; height: 200px; border: 1px solid var(--line); border-radius: 10px; touch-action: none; background: #fff; display: block; }
.step-label { font-size: 12.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); font-weight: 500; min-height: 44px; }
.chk input { width: 20px; height: 20px; }
.pv-frame { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 8px; }
.toast { position: fixed; left: 50%; bottom: calc(20px + var(--safe-b)); transform: translateX(-50%); background: #15202e; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 80; max-width: 90vw; }
.foot { text-align: center; color: var(--muted); font-size: 13px; margin: 8px 0 20px; }
