/* POC Tracker. Light, simple, phone-first. Navy and teal on a pale grey ground. */
:root {
  --bg: #F3F5F8; --card: #FFFFFF; --card2: #EEF1F6; --line: #E6E9EF; --line2: #C8CCD3;
  --tx: #172033; --tx2: #5A6478; --tx3: #5A6478;
  --navy: #13294B; --navy2: #24406E; --teal: #0B6B5C; --link: #2459D6;
  --hv: #13294B; --on-hv: #FFFFFF;
  --ok: #0B6B5C; --bad: #B42E28; --unk: #8A5300; --na: #9AA3B2;
  --red-bg: #FBE3E2; --green-bg: #E1F3EF; --blue: #1E4AB3; --blue-bg: #E3ECFB; --amber-bg: #FDF1DC;
  --r: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { background: var(--bg); color: var(--tx); font: 400 15px/1.45 Inter, -apple-system, "Segoe UI", system-ui, sans-serif; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--link); text-decoration: none; }
a:hover { color: #173E9E; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 600; }

/* ---------- app shell ---------- */
body.app { min-height: 100dvh; display: flex; flex-direction: column; }
.bar { flex: none; position: sticky; top: 0; z-index: 10; min-height: 64px; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 20px; padding-top: env(safe-area-inset-top); }
.bar h1 { font-size: 20px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .back-btn { width: 44px; height: 44px; margin-left: -12px; border: 0; background: none; color: #fff; display: grid; place-items: center; flex: none; }
.bar .lead { display: flex; align-items: center; gap: 4px; min-width: 0; }
.user-menu { position: relative; flex: none; }
.user-menu summary { list-style: none; cursor: pointer; font-size: 13px; font-weight: 600; background: var(--navy2); color: #fff; border-radius: 16px; padding: 8px 14px; min-height: 36px; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu-pop { position: absolute; right: 0; top: 44px; min-width: 200px; background: var(--card); color: var(--tx); border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: 0 12px 30px rgba(19,41,75,.18); }
.user-menu-pop .who { padding: 8px 10px; font-size: 13px; color: var(--tx2); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.user-menu-pop a, .user-menu-pop button { display: block; width: 100%; text-align: left; padding: 12px 10px; border: 0; background: none; border-radius: 8px; color: var(--tx); font-size: 15px; }
.user-menu-pop a:hover, .user-menu-pop button:hover { background: var(--card2); }
.user-menu-pop .ver { padding: 8px 10px 4px; font-size: 12px; color: var(--tx2); }

#app { flex: 1 1 auto; width: 100%; max-width: 640px; margin: 0 auto; padding: 16px 16px 24px; display: flex; flex-direction: column; gap: 12px; }
body.app #app { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 9; height: calc(68px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--card); border-top: 1px solid var(--line); display: flex; }
.tabs a { flex: 1 1 0; display: grid; place-items: center; font-size: 14px; font-weight: 600; color: var(--tx2); }
.tabs a[aria-current="page"] { color: var(--navy); box-shadow: inset 0 3px 0 var(--navy); }
@media (min-width: 860px) {
  .tabs { position: sticky; top: 64px; bottom: auto; height: 52px; padding: 0; justify-content: center; border-top: 0; border-bottom: 1px solid var(--line); }
  .tabs a { flex: 0 0 150px; }
  .tabs a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--navy); }
  body.app #app { padding-bottom: 40px; }
  #app.wide { max-width: 980px; }
}

/* ---------- pieces ---------- */
.label { font-size: 13px; font-weight: 600; color: var(--tx2); margin-top: 8px; }
.label:first-child { margin-top: 0; }
.card { background: var(--card); border-radius: var(--r); }
.poc { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.poc .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.poc .top span:last-child { font-size: 12px; color: var(--tx2); }
.poc .name { font-size: 18px; font-weight: 600; }
.poc .sub, .sub { font-size: 13px; color: var(--tx2); margin-top: 2px; }
.poc .btns, .btns { display: flex; gap: 8px; }
.empty { padding: 18px 16px; color: var(--tx2); }
.chip { display: inline-block; flex: none; font-size: 12px; font-weight: 600; border-radius: 6px; padding: 4px 8px; white-space: nowrap; background: var(--card2); color: var(--tx2); }
.chip.red { background: var(--red-bg); color: var(--bad); }
.chip.green { background: var(--green-bg); color: var(--teal); }
.chip.blue { background: var(--blue-bg); color: var(--blue); }
.chip.amber { background: var(--amber-bg); color: var(--unk); }

.rows { padding: 4px 16px; display: flex; flex-direction: column; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; min-height: 56px; color: inherit; background: none; border: 0; width: 100%; text-align: left; }
.row + .row { border-top: 1px solid var(--card2); }
a.row:hover, button.row:hover { color: inherit; }
.row .main { min-width: 0; }
.row .t { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.row .t.small { font-size: 15px; }
.row > .chip { max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.row .side { flex: none; text-align: right; display: flex; align-items: center; gap: 10px; }
.row .days { text-align: right; }
.row .days b { display: block; font-size: 18px; font-weight: 700; color: var(--teal); line-height: 1.2; }
.row .days.late b { color: var(--bad); }
.row .days small { font-size: 12px; color: var(--tx2); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line2); background: var(--card); color: var(--navy); font-size: 15px; font-weight: 600; text-align: center; }
.btn:hover { color: var(--navy); border-color: var(--navy); }
.btn.grow { flex: 1 1 0; }
.btn.navy, .btn.pri, .btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.teal { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.big { min-height: 52px; border-radius: 12px; font-size: 16px; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger { color: var(--bad); }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--line2); border-color: var(--line2); color: #3A4458; cursor: default; }
.textlink { min-height: 44px; border: 0; background: none; color: var(--link); font-size: 14px; font-weight: 600; text-align: left; padding: 0; display: inline-flex; align-items: center; }
.note { font-size: 13px; line-height: 19px; color: var(--tx2); }
.note.warn { color: var(--unk); background: var(--amber-bg); border-radius: 10px; padding: 10px 12px; }
.status-line { font-size: 14px; color: var(--tx2); min-height: 21px; margin-top: 10px; }
.status-line.error { color: var(--bad); } .status-line.success, .status-line.ok { color: var(--ok); }

.in, .field-group input, .field-group select, .invite-row input, .invite-row select, .link-box input { width: 100%; min-height: 48px; padding: 0 12px; border: 1px solid var(--line2); border-radius: 10px; background: var(--card); font-size: 16px; color: var(--tx); }
textarea.in { padding: 12px; min-height: 96px; line-height: 1.4; resize: vertical; }
.inrow { display: flex; gap: 8px; align-items: center; }
.inrow .in { flex: 1 1 0; min-width: 0; }
.step { font-size: 15px; font-weight: 600; margin-top: 8px; }
.step span { font-weight: 400; color: var(--tx2); }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tile { min-height: 60px; text-align: left; border-radius: 12px; padding: 10px 12px; border: 1px solid var(--line2); background: var(--card); color: var(--tx); }
.tile b { display: block; font-size: 14px; font-weight: 600; }
.tile small { display: block; font-size: 12px; margin-top: 2px; opacity: .85; }
.tile[aria-pressed="true"] { border: 2px solid var(--teal); padding: 9px 11px; background: var(--teal); color: #fff; }

/* ---------- full-screen task (ship, return, a unit, a POC) ---------- */
.sheet { position: fixed; inset: 0; z-index: 20; background: var(--bg); display: flex; flex-direction: column; }
.sheet .bar { position: static; padding-left: 8px; }
.sheet .bar .back-btn { margin-left: 0; }
.sheet .body { flex: 1 1 0; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.sheet .foot { flex: none; padding: 12px 16px calc(20px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.sheet .body > *, .sheet .foot > * { width: 100%; max-width: 608px; margin-left: auto; margin-right: auto; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--tx2); } .kv dd { text-align: right; overflow-wrap: anywhere; }
.scan video { width: 100%; max-height: 50vh; border-radius: 12px; background: #000; }

/* ---------- results ---------- */
.range { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.range .in { width: auto; flex: 1 1 140px; }
.res { width: 100%; border-collapse: collapse; }
.res th { text-align: right; font-size: 12px; font-weight: 600; color: var(--tx2); padding: 12px 0 8px 12px; }
.res th:first-child, .res td:first-child { text-align: left; padding-left: 0; }
.res td { padding: 12px 0 12px 12px; border-top: 1px solid var(--card2); text-align: right; vertical-align: top; font-size: 16px; font-weight: 600; }
.res td:first-child { font-weight: 400; font-size: 15px; }
.res td small { display: block; font-size: 12px; font-weight: 400; color: var(--tx2); }

/* ---------- dialog and toast ---------- */
.veil { position: fixed; inset: 0; z-index: 40; background: rgba(19,41,75,.45); display: grid; place-items: center; padding: 20px; }
.dialog { width: 100%; max-width: 440px; padding: 22px; }
.dialog p { color: var(--tx2); font-size: 14px; margin-top: 8px; }
.dialog .row { display: flex; gap: 10px; margin-top: 16px; padding: 0; min-height: 0; }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 60; max-width: 480px; margin: 0 auto; padding: 14px 16px; border-radius: 12px; background: var(--tx); color: #fff; font-size: 14px; line-height: 20px; opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: none; }
.toast.error { background: var(--bad); }
@media (max-width: 640px) {
  .veil { place-items: end center; padding: 0; }
  .dialog { max-width: none; border-radius: 22px 22px 0 0; padding-bottom: calc(26px + env(safe-area-inset-bottom)); }
}

/* ---------- sign-in and account pages (markup shared with MoJoPro Remote Control) ---------- */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 0 20px; background: var(--navy); color: #fff; }
.topbar img { height: 14px; display: block; }
.topbar .prod { font-size: 15px; font-weight: 600; padding-left: 12px; border-left: 1px solid rgba(255,255,255,.25); }
.topbar .link-btn { margin-left: auto; color: #fff; }
.link-btn { background: none; border: 0; color: var(--tx2); font-size: 14px; min-height: 44px; padding: 6px 0; }
.page { max-width: 640px; margin: 0 auto; padding: 20px 16px 40px; min-height: calc(100vh - 140px); }
.back { font-size: 14px; color: var(--tx2); display: inline-block; padding: 6px 0; margin-bottom: 8px; }
.appfoot { display: flex; justify-content: center; gap: 8px; padding: 0 20px 28px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--tx2); }
.appfoot span:first-child { text-transform: none; letter-spacing: .06em; }
.auth-panel { max-width: 420px; margin: 8vh auto 0; background: var(--card); border-radius: var(--r); padding: 26px; }
.connection-head .brand-logo { height: 16px; display: block; margin-bottom: 18px; }
.panel-copy { color: var(--tx2); font-size: 14px; margin: 4px 0 18px; }
.field-group { margin-bottom: 14px; }
.field-group label { display: block; font-size: 13px; color: var(--tx2); margin-bottom: 6px; }
.form-hint { font-size: 12px; color: var(--tx2); margin-top: 6px; }
.auth-panel .actions { margin-top: 6px; }
.auth-panel .actions .btn { width: 100%; }
.auth-foot { margin-top: 14px; font-size: 13px; color: var(--tx2); }
.account-page { max-width: 760px; }
.account-page h1 { margin-bottom: 18px; }
.account-section { background: var(--card); border-radius: var(--r); padding: 22px; margin-bottom: 14px; }
.account-section h2 { margin-bottom: 12px; }
.account-section h2 + p { margin-top: -6px; }
.account-section > p { color: var(--tx2); font-size: 14px; margin-bottom: 14px; }
.account-form { max-width: 420px; }
.account-divider { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.secret-row { display: flex; gap: 8px; }
.btn-inline { min-height: 48px; padding: 0 14px; flex: none; }
.team-subtitle { font-size: 14px; font-weight: 600; color: var(--tx2); margin: 20px 0 8px; }
.team-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.team-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--tx2); padding: 8px 6px; border-bottom: 1px solid var(--line); }
.team-table td { padding: 10px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.team-table input, .team-table select { min-height: 40px; padding: 0 10px; border: 1px solid var(--line2); border-radius: 8px; background: var(--card); width: 100%; max-width: 180px; font-size: 15px; }
.team-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.team-actions .btn { min-height: 36px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.pill { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--card2); color: var(--tx2); }
.pill.admin { color: var(--blue); background: var(--blue-bg); }
.pill.off { color: var(--bad); background: var(--red-bg); }
.muted { color: var(--tx2); }
.presence { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.presence-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--na); }
.presence.active .presence-dot { background: var(--ok); }
.presence-where { display: block; font-size: 12px; color: var(--tx2); }
.invite-row { display: flex; gap: 8px; flex-wrap: wrap; }
.invite-row input { flex: 2; min-width: 180px; } .invite-row select { flex: 1; min-width: 120px; }
.link-box { display: flex; gap: 8px; margin-top: 10px; }
.live-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; border-radius: 12px; background: var(--card2); margin-bottom: 6px; }
.live-row b { display: block; font-weight: 600; } .live-row small { font-size: 13px; color: var(--tx2); }
.nudge-list { display: grid; gap: 8px; font-size: 14px; }
.nudge-list div { padding: 10px 12px; border-radius: 10px; background: var(--card2); white-space: pre-line; }
.nudge-list small { display: block; font-size: 12px; color: var(--tx2); margin-bottom: 2px; }
.nudge-list .bad small { color: var(--bad); }
@media (max-width: 640px) {
  .team-table thead { display: none; }
  .team-table tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .team-table td { display: block; border: 0; padding: 3px 0; }
  .team-actions { justify-content: flex-start; margin-top: 6px; }
}
