:root {
  --bg: #f3f5f6; --card: #fff; --ink: #14212b; --muted: #5d6b75; --line: #e2e7ea;
  --brand: #0f3d3e; --accent: #0e7c74; --accent-ink: #fff; --accent-soft: #e2f3f1;
  --amber: #b45309; --amber-soft: #fef3c7; --red: #b42318; --red-soft: #fde8e7;
  --blue: #1d4ed8; --viewer-bg: #1d272e;
  --r: 14px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body { min-height: 100%; }   /* not height:100% — on iPhone it made the page scroll inside body and the fixed bottom bar drift */
body { font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); overscroll-behavior: none; }
button, select, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; }
h3 { font-size: 15px; }
.muted { color: var(--muted); } .small { font-size: 13px; }

.top { position: fixed; left: 0; right: 0; top: 0; z-index: 20; min-height: calc(58px + var(--safe-t)); box-sizing: border-box; display: flex; align-items: center; gap: 8px; padding: calc(10px + var(--safe-t)) 12px 10px; background: var(--brand); color: #fff; }
.top h1 { flex: 1; font-size: 18px; letter-spacing: .2px; }
.icon-btn { background: none; border: 0; color: #fff; font-size: 24px; width: 40px; height: 40px; border-radius: 10px; cursor: pointer; }
.icon-btn:active { background: rgba(255,255,255,.12); }

.view { max-width: 760px; margin: 0 auto; padding: 14px 16px calc(24px + var(--safe-b)); }
.card { background: var(--card); border-radius: var(--r); padding: 14px; margin: 12px 0; box-shadow: 0 1px 2px rgba(16,24,40,.06); }
.hero .lede { color: var(--muted); margin: 4px 2px 16px; }
.big-btn { display: flex; align-items: center; gap: 14px; width: 100%; padding: 18px; margin: 10px 0; border-radius: var(--r); border: 1px solid var(--line); background: var(--card); font-size: 17px; font-weight: 600; cursor: pointer; text-align: left; }
.big-btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.big-btn.ghost { background: transparent; font-weight: 500; }
.big-btn .bi { font-size: 24px; width: 32px; text-align: center; }
.tips ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
.tips li { margin: 4px 0; }
.foot { color: var(--muted); font-size: 12px; text-align: center; margin-top: 18px; }
.order-strip { background: var(--accent-soft); border-radius: var(--r); padding: 12px 14px; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.order-strip b { color: var(--accent); }

.viewer { position: relative; height: 58vh; min-height: 300px; border-radius: var(--r); overflow: hidden; background: var(--viewer-bg); touch-action: none; }
.viewer.small { height: 36vh; min-height: 220px; }
.viewer-canvas { display: block; touch-action: none; }
.hint { color: var(--muted); font-size: 13px; margin: 8px 2px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.tb { padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 14px; max-width: 100%; }
.tb.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.actions { margin-top: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 14px; border-radius: 11px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 600; font-size: 14px; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.danger { color: var(--red); }
.btn.wide { width: 100%; padding: 15px; font-size: 16px; }
.link { background: none; border: 0; color: var(--accent); font-weight: 600; cursor: pointer; padding: 4px; }

.pages { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; }
.pages button { flex: none; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 13px; }
.pages button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.seg { display: flex; background: #e3e8ea; border-radius: 12px; padding: 3px; margin: 10px 0; }
.seg button { flex: 1; border: 0; background: none; padding: 9px; border-radius: 9px; font-weight: 600; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.row-h { display: flex; justify-content: space-between; align-items: center; }

.lines { list-style: none; margin: 8px 0 0; padding: 0; }
.lines li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 2px; border-top: 1px solid var(--line); align-items: center; }
.lines li:first-child { border-top: 0; }
.lines .nm { font-weight: 600; }
.lines .sub { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.lines .amt { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.lines li.off { opacity: .45; }
.lines li.off .nm { text-decoration: line-through; }
.lines li.included .amt, .lines li.duplicate .amt { color: var(--muted); font-weight: 500; }
.review li { cursor: pointer; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .3px; padding: 2px 7px; border-radius: 999px; background: #eef1f3; color: var(--muted); }
.badge.send { background: var(--amber-soft); color: var(--amber); }
.badge.chk { background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: var(--red-soft); color: var(--red); }
.badge.tpl { background: #e0e7ff; color: var(--blue); }
.x { border: 0; background: none; color: var(--muted); font-size: 18px; cursor: pointer; padding: 0 4px; }
#banner .note { background: var(--amber-soft); color: #7c3f06; border-radius: 12px; padding: 10px 12px; font-size: 13.5px; margin: 6px 0; }
#banner .note.ok { background: var(--accent-soft); color: #0b5d57; }

.page-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.spacer { height: 150px; }
.totals { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; transform: translateZ(0); background: var(--brand); color: #fff; padding: 12px 16px calc(12px + var(--safe-b)); box-shadow: 0 -4px 16px rgba(0,0,0,.15); }
.totals .in { max-width: 760px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 10px; }
.totals .k { font-size: 11.5px; opacity: .75; text-transform: uppercase; letter-spacing: .4px; }
.totals .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.totals .v.big { font-size: 24px; }
.totals .meta { grid-column: 1 / -1; font-size: 12px; opacity: .8; }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; }
.tabs button { flex: none; padding: 8px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 600; font-size: 13.5px; }
.tabs button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.field { display: grid; gap: 5px; margin: 12px 0; }
.field > span { font-weight: 600; font-size: 14px; }
.field small { color: var(--muted); }
.field input[type=text], .field input[type=number], .field select, .field textarea, .search { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.field textarea { min-height: 90px; }
.check { display: flex; align-items: flex-start; gap: 10px; margin: 12px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--accent); flex: none; }
.check small { display: block; color: var(--muted); }
.range-row { display: flex; align-items: center; gap: 10px; }
.range-row input { flex: 1; accent-color: var(--accent); }
.range-row output { width: 52px; text-align: right; font-variant-numeric: tabular-nums; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.menu-list li { cursor: pointer; }

.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet-bg { position: absolute; inset: 0; background: rgba(10,20,25,.45); }
.sheet-body { position: absolute; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow: auto; background: var(--card); border-radius: 18px 18px 0 0; padding: 16px 16px calc(20px + var(--safe-b)); max-width: 760px; margin: 0 auto; }
.sheet-body h2 { font-size: 18px; margin-bottom: 6px; }
.sheet-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.sheet-actions .btn { flex: 1; }
.pick-list li { cursor: pointer; }

.busy { position: fixed; inset: 0; z-index: 60; background: rgba(10,20,25,.55); display: grid; place-content: center; justify-items: center; gap: 14px; color: #fff; font-weight: 600; padding: 20px; text-align: center; }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 4px solid rgba(255,255,255,.25); border-top-color: #fff; animation: sp 0.9s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(150px + var(--safe-b)); z-index: 70; background: #14212b; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: 90vw; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
@media (min-width: 700px) { .viewer { height: 64vh; } }

.pt-total { display: flex; flex-wrap: wrap; gap: 6px 14px; border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 10px; font-size: 13.5px; color: var(--muted); }
.pt-total b { color: var(--ink); font-variant-numeric: tabular-nums; }

.memo { background: #f1f5f9; border-radius: 10px; padding: 8px 12px; margin-top: 8px; font-size: 13px; color: #334155; }
.memo p { margin: 4px 0; }
.lines li.notours .amt { color: var(--muted); }

/* ---- question cards: one obvious answer, clear choices ---- */
.qhead { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.sheet-body h2 { font-size: 20px; margin: 2px 0 8px; }
.lead { font-size: 15px; margin: 6px 0 10px; }
.label { font-size: 13px; font-weight: 700; color: var(--muted); margin: 14px 2px 2px; text-transform: uppercase; letter-spacing: .4px; }
.crop { width: 100%; border-radius: 12px; background: #fff; border: 2px solid var(--accent); display: block; }
.choices { display: grid; gap: 8px; margin: 8px 0; }
.choice { position: relative; display: block; width: 100%; text-align: left; padding: 14px 40px 14px 16px; border: 1.5px solid #cfd8dc; border-radius: 14px; background: #fff; font-size: 16px; font-weight: 650; color: var(--ink); cursor: pointer; line-height: 1.3; }
.choice span { display: block; font-size: 13px; font-weight: 400; color: var(--muted); margin-top: 3px; }
.choice::after { content: '›'; position: absolute; right: 16px; top: 50%; transform: translateY(-52%); font-size: 26px; color: #94a3b8; font-weight: 400; }
.choice:active { transform: scale(.99); background: #f1f5f9; }
.choice.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-size: 17px; padding-top: 16px; padding-bottom: 16px; margin: 6px 0 4px; }
.choice.primary span, .choice.primary::after { color: #d1f2ee; }
.choice.neutral { margin-top: 14px; border-style: dashed; }
.minor { text-align: center; margin-top: 12px; font-size: 14px; color: var(--muted); }
.minor .link { font-size: 14px; }
.search { font-size: 16px; padding: 13px 14px; border-radius: 12px; margin-top: 10px; }
/* lists in the test picker look tappable too */
.pick-list li { border: 1.5px solid #cfd8dc !important; border-radius: 14px; margin: 8px 0; padding: 12px 14px !important; background: #fff; }
.pick-list li:active { background: #f1f5f9; }

.mode-hint { font-size: 14px; margin: -2px 2px 10px; line-height: 1.4; }
.okmark { display: inline-block; background: #16a34a; color: #fff; border-radius: 50%; width: 18px; height: 18px; line-height: 18px; text-align: center; font-size: 12px; font-weight: 700; }
.seg button { font-size: 15px; }

/* switches: the active choice is unmistakable (solid green + ✓) */
.seg { background: #e3e8ea; }
.seg button.on { background: var(--accent) !important; color: #fff !important; box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.seg button.on::before { content: '✓ '; }
.qblock { background: var(--card); border-radius: var(--r); padding: 10px 12px 4px; margin: 10px 0; }
.qlabel { font-weight: 700; font-size: 14px; margin: 2px 2px 6px; }
.wide-select { width: 100%; margin-bottom: 8px; }
.legend { font-size: 13px; margin: 6px 2px 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lg-line, .lg-mark { display: inline-block; width: 18px; height: 12px; border: 2.5px solid #2563eb; border-radius: 2px; }
.lg-mark { border-color: #f59e0b; } .lg-mark.on { border-color: #16a34a; }
.choice .incl { margin-top: 5px; font-size: 12.5px; }
.choice.primary .incl { color: #e6fbf8; }

/* Teach: the whole group stays pinned on top while its lines are asked */
.pinned { position: sticky; top: -16px; z-index: 2; background: var(--card); margin: -16px -16px 8px; padding: 12px 16px 8px; border-bottom: 1px solid var(--line); box-shadow: 0 4px 10px rgba(15,23,42,.06); }
.overview { width: 100%; max-height: 34vh; object-fit: contain; border-radius: 10px; background: #fff; border: 1px solid var(--line); display: block; }
.crop { max-height: 22vh; object-fit: contain; }

.qhead .back { font-size: 15px; font-weight: 700; margin-right: 6px; padding: 4px 8px 4px 0; }

/* results: picture pinned on top while the list scrolls; the list line in focus is linked to the picture */
#v-results #resultsViewer { position: sticky; top: calc(58px + var(--safe-t)); z-index: 6; box-shadow: 0 6px 14px rgba(15,23,42,.18); }
.lines li.linkable { cursor: pointer; border-radius: 10px; transition: background .15s; }
.lines li.linkable.focus { background: #dbeafe; box-shadow: inset 4px 0 0 #2563eb; padding-left: 10px; }
.warn-card { border: 2px solid #fca5a5; background: #fff7f7; }
.warn-card h3 { color: #b91c1c; }
.btn.sm { padding: 7px 10px; font-size: 13px; }

/* three always-visible actions right under the line picture */
.quick3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 6px; }
.qbtn { border: 1.5px solid #cfd8dc; background: #fff; border-radius: 12px; padding: 10px 6px; font-size: 15px; font-weight: 700; color: var(--ink); cursor: pointer; line-height: 1.2; }
.qbtn span { display: block; font-size: 11.5px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.qbtn:active { background: #f1f5f9; transform: scale(.98); }
#tnot { color: #b91c1c; } #tskip { color: #92400e; }

.area-btns { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; }
.area-btns .btn { flex: 1; }

/* Lucide icons */
.ic { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex: none; }
.icon-btn .ic { width: 24px; height: 24px; }
.big-btn .bi .ic { width: 26px; height: 26px; }
.big-btn small { display: block; font-size: 13px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.btn .ic, .tb .ic { margin-right: 2px; }
.icon-btn { display: inline-grid; place-items: center; }

/* test library & panel builder */
.lib-top { position: sticky; top: calc(58px + var(--safe-t)); z-index: 5; background: var(--bg); padding: 8px 0 4px; }
.searchwrap { position: relative; } .searchwrap .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.searchwrap .search { padding-left: 38px; margin-top: 0; }
.lib-list li { cursor: pointer; padding: 10px 8px; border-radius: 10px; }
.lib-list li .amt small { display: block; font-size: 11.5px; font-weight: 400; color: var(--muted); }
.lib-list li.picked { background: #dcfce7; box-shadow: inset 4px 0 0 #16a34a; }
.lib-list li.picked .nm { color: #166534; }
.lib-list li.inside { background: #fef2f2; }
.lib-list li.inside .nm { color: #b91c1c; text-decoration: line-through; }
.lib-list .incl { display: block; width: 100%; margin-top: 3px; }
.red { color: #b91c1c; }
.builder { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: var(--brand); color: #fff; padding: 10px 16px calc(10px + var(--safe-b)); box-shadow: 0 -4px 16px rgba(0,0,0,.18); max-height: 48vh; overflow: auto; }
.builder .in { max-width: 760px; margin: 0 auto; }
.builder .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { background: rgba(255,255,255,.15); color: #fff; border: 0; border-radius: 999px; padding: 5px 10px; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.builder .bt { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.builder .k { font-size: 11px; opacity: .75; text-transform: uppercase; letter-spacing: .4px; }
.builder .v { font-size: 18px; font-weight: 700; } .builder .v.big { font-size: 22px; }
.builder .meta { font-size: 14px; opacity: .9; }
.memo.dark { background: rgba(255,255,255,.12); color: #e6fbf8; }
.builder .btn { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.25); }
.builder .btn.primary { background: #fff; color: var(--brand); }
#v-lib .spacer { height: 260px; }

/* ---- sign-in: app-style ---- */
body.auth .top { display: none; }
.view.login { max-width: none; padding: 0; min-height: 100vh; background: radial-gradient(120% 80% at 50% -10%, #17716b 0%, #0f3d3e 55%, #0a2a2b 100%); color: #fff; }
.login-wrap { max-width: 420px; margin: 0 auto; padding: calc(48px + var(--safe-t)) 22px calc(32px + var(--safe-b)); display: flex; flex-direction: column; min-height: 100vh; }
.login-hero { text-align: center; margin-bottom: 26px; animation: rise .6s ease both; }
.login-logo { width: 84px; height: 84px; border-radius: 22px; box-shadow: 0 12px 30px rgba(0,0,0,.35); }
.login-hero h1 { font-size: 34px; letter-spacing: .3px; margin: 14px 0 6px; }
.login-hero p { opacity: .85; margin: 0; font-size: 16px; }
.login-card { background: #fff; color: var(--ink); border-radius: 22px; padding: 22px 20px; box-shadow: 0 18px 50px rgba(0,0,0,.35); animation: rise .6s .08s ease both; }
.login-card h2 { font-size: 22px; margin: 0 0 4px; }
.lfield { display: flex; align-items: center; gap: 10px; border: 1.5px solid #cfd8dc; border-radius: 14px; padding: 0 14px; margin: 14px 0; background: #fff; }
.lfield:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(14,124,116,.15); }
.lfield .ic { color: var(--muted); }
.lfield input { border: 0; outline: 0; flex: 1; padding: 15px 0; font-size: 17px; background: transparent; }
.code6 { width: 100%; text-align: center; font-size: 34px; letter-spacing: 14px; font-weight: 700; padding: 14px 0 14px 14px; border: 1.5px solid #cfd8dc; border-radius: 14px; margin: 14px 0; outline: 0; }
.code6:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(14,124,116,.15); }
.login-card .btn.wide { display: flex; gap: 8px; border-radius: 14px; }
.lerr { color: #b91c1c; font-size: 14px; min-height: 1em; margin: 8px 0 0; }
.lrow { display: flex; justify-content: space-between; margin-top: 10px; }
.lchoice { border: 1.5px solid var(--line); border-radius: 16px; padding: 14px; margin: 12px 0; }
.lchoice p { margin: 4px 0 0; }
.login-foot { text-align: center; font-size: 13px; opacity: .8; margin-top: auto; padding-top: 24px; line-height: 1.5; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* the top bar is fixed (always visible while scrolling); the page starts below it */
body { padding-top: calc(58px + var(--safe-t)); }
body.auth { padding-top: 0; }

/* tap a price on the results to change it */
.amt .pr { font: inherit; font-weight: 700; color: var(--ink); background: none; border: 0; border-bottom: 1.5px dashed var(--accent); padding: 0 1px; cursor: pointer; }

/* copy / text list */
.share-preview { white-space: pre-wrap; font: 13px/1.45 ui-monospace, Menlo, monospace; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px; max-height: 42vh; overflow: auto; user-select: text; -webkit-user-select: text; }
.totals .tshare { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 4px; padding: 8px; border-radius: 10px; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.12); color: #fff; font: inherit; font-weight: 600; }

.sexrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0 4px; padding: 10px 12px; border-radius: 12px; background: var(--bg); }
.sexrow .tb { margin-left: 6px; }

/* ---- learn an order form ---- */
.steps { display: flex; gap: 6px; margin: 4px 0 10px; }
.steps span { flex: 1; text-align: center; font-size: 12.5px; font-weight: 600; padding: 7px 4px; border-radius: 999px; background: var(--card); color: var(--muted); border: 1px solid var(--line); }
.steps span.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.steps span.done { color: var(--accent); border-color: var(--accent); }
.setup-pane .btn.wide { margin: 8px 0; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.setup-list { padding-left: 20px; margin: 10px 0; }
.setup-list li { margin: 8px 0; }
.tipbox { display: flex; gap: 10px; align-items: flex-start; background: var(--bg); border-radius: 12px; padding: 10px 12px; font-size: 13.5px; color: var(--muted); }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin: 10px 0; }
.shot { position: relative; aspect-ratio: 3/4; border-radius: 12px; overflow: hidden; background: var(--card); border: 1.5px dashed #cfd8dc; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; }
.shot img { width: 100%; height: 100%; object-fit: cover; }
.shot.filled { border-style: solid; border-color: var(--line); }
.shot .x { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; border: 0; display: flex; align-items: center; justify-content: center; }
.shot .x .ic { width: 16px; height: 16px; }
.shot .st { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 6px; font-size: 11.5px; font-weight: 600; color: #fff; background: rgba(22,163,74,.85); text-align: center; }
.shot .st.warn { background: rgba(217,119,6,.92); }
.shot.busy::after { content: 'Reading…'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.75); color: var(--ink); font-weight: 600; }

.share-img { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; margin: 10px 0; }
.share-img img { display: block; width: 100%; }

/* tap mode: the picture is the main thing */
#v-results #resultsViewer.tall { height: 62vh; }
.note.tapcard { display: grid; gap: 10px; border-color: #0e7c74; background: #f0fdfa; }
.tapbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tapbar .tapcount { font-weight: 700; margin-right: auto; }

.ailine { padding: 8px 10px; border-radius: 8px; background: #eef2ff; line-height: 1.45; }
.ailine.ok { background: #ecfdf5; }
.ailine.warn { background: #fff7ed; }
.ailine .warnt { color: #9a3412; font-size: 13px; }
.ailine .spin { display: inline-block; width: 12px; height: 12px; border: 2px solid #94a3b8; border-top-color: transparent; border-radius: 50%; animation: aispin 0.8s linear infinite; vertical-align: -1px; }
@keyframes aispin { to { transform: rotate(360deg); } }

table.mini { width: 100%; border-collapse: collapse; font-size: 13px; }
table.mini th, table.mini td { text-align: left; padding: 4px 6px; border-bottom: 1px solid #e5e7eb; }

#checkOpts { display: grid; gap: 8px; margin: 8px 0; }
#checkOpts[hidden] { display: none; }
.optrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.optrow > span { font-weight: 600; min-width: 64px; }
.optrow .seg { display: flex; flex: 1; border: 1px solid #cbd5e1; border-radius: 10px; overflow: hidden; }
.optrow .seg button { flex: 1; padding: 10px 8px; border: 0; background: #fff; font: inherit; color: #0f172a; }
.optrow .seg button.on { background: #0e7c74; color: #fff; font-weight: 600; }

/* check screen: photo + options + Read must fit on a phone without scrolling */
#v-adjust.photocheck .viewer { height: 40vh; min-height: 200px; }
#v-adjust.photocheck .hint { font-size: 13px; margin: 6px 0; }
#v-adjust.photocheck .toolbar { margin: 4px 0; }

/* marked twice: orange, on top */
.dupbox { background: #fff7ed; border: 1px solid #fdba74; border-left: 5px solid #f97316; border-radius: 10px; padding: 8px 10px; margin: 6px 0 10px; }
.dupbox .duph { font-weight: 700; color: #9a3412; display: flex; align-items: center; gap: 6px; }
.dupbox .lines li { background: transparent; }
.dupbox .lines li .nm { color: #9a3412; font-weight: 600; }
.dupbox p { color: #7c2d12; margin: 6px 0 0; }

.badge.ncd { background: #eef2ff; color: #3730a3; }
#sopt { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 4px 0 8px; }

.optrow[hidden] { display: none; }

/* report: in-app view (.reportview) and the print page (#printArea) share the same look */
#printArea { display: none; }
.report { color: #000; font: 14px -apple-system, "Segoe UI", Roboto, sans-serif; }
.report .ph { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; border-bottom: 2px solid #0e7c74; padding-bottom: 6px; margin-bottom: 8px; }
.report h1 { font-size: 20px; margin: 0; color: #0e7c74; }
.report h2 { font-size: 16px; margin: 14px 0 4px; }
.report .pnote { font-weight: 700; border: 1px solid #94a3b8; border-radius: 6px; padding: 4px 8px; }
.report table { width: 100%; border-collapse: collapse; margin: 6px 0; }
.report th { text-align: left; background: #e6f4f2; border-bottom: 1px solid #0e7c74; padding: 4px 6px; font-size: 12px; }
.report td { border-bottom: 1px solid #e2e8f0; padding: 4px 6px; vertical-align: top; font-size: 13px; }
.report .r { text-align: right; white-space: nowrap; }
.report .pv { color: #475569; font-size: 11px; }
.report .pdup { background: #fff7ed; border-left: 4px solid #f97316; padding: 6px 8px; margin: 6px 0; font-size: 12px; }
.report table.tot { width: auto; min-width: 60%; margin-left: auto; margin-top: 10px; }
.report .pfoot { margin-top: 16px; color: #64748b; font-size: 10px; }
.reportview { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px; overflow-x: auto; }
@media print {
  body.printing > *:not(#printArea) { display: none !important; }
  body.printing #printArea { display: block; font-size: 11pt; padding: 0 4mm; }
  #printArea tr { break-inside: avoid; }
}
/* who bills it — answered on the test line */
.whobills { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; background: #fff7ed; border: 1px solid #fdba74; border-radius: 8px; padding: 3px 6px; color: #9a3412; font-weight: 600; }
.whobills button { font: inherit; font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 6px; border: 1px solid #0e7c74; background: #fff; color: #0e7c74; }

/* strip of the photo under each test (AI pages) */
.lines li img.strip { grid-column: 1 / -1; width: 100%; max-height: 90px; object-fit: contain; object-position: left center; border-radius: 6px; border: 1px solid #e2e8f0; background: #fff; margin-bottom: 4px; }

#frameBar .tb.on { background: #0e7c74; color: #fff; border-color: #0e7c74; }

/* phones: a compact totals bar (it took a fifth of the screen) — 3 numbers + a small Share button in one row */
@media (max-width: 600px) {
  .totals { padding: 8px 12px calc(8px + var(--safe-b)); }
  .totals .in { grid-template-columns: 1fr 1fr 1fr auto; gap: 2px 8px; align-items: end; }
  .totals .k { font-size: 10px; letter-spacing: .2px; }
  .totals .v, .totals .v.big { font-size: 17px; }
  .totals .meta { font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .totals .tshare { grid-column: 4; grid-row: 1; margin: 0; padding: 8px 10px; font-size: 13px; }
  .totals .tshare span { display: none; }
}

/* a test inside a marked panel: one red line */
.lines li.dupline .nm { color: #991b1b; }
.incl { color: #dc2626; font-weight: 700; }
.report td.incl { color: #dc2626; font-weight: 700; text-align: right; }

.costtag { margin: 0 2px 4px; font-size: 10.5px; color: #94a3b8; letter-spacing: .04em; text-align: right; font-variant-numeric: tabular-nums; }

/* the AI isn't sure a test is marked: decide on the line */
.unsure { grid-column: 1 / -1; background: #fefce8; border: 1px solid #facc15; border-radius: 8px; padding: 6px 8px; font-size: 13px; color: #713f12; margin: 4px 0; }
.unsure span { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.unsure button { font: inherit; font-weight: 700; font-size: 13px; padding: 6px 10px; border-radius: 8px; border: 1px solid #0e7c74; background: #fff; color: #0e7c74; }
.unsure button[data-us="no"] { border-color: #dc2626; color: #dc2626; }

.report h3 { font-size: 13px; margin: 12px 0 4px; }
#skind { margin: 0 0 10px; }
#sprev .report table.tests td { font-size: 12.5px; }
.ailine .pill { display: inline-block; background: #e6f4f2; color: #0e7c74; border-radius: 99px; padding: 1px 8px; font-size: 12px; font-weight: 700; }

/* a panel's tests grouped under a header that stays pinned while scrolling them */
.lines li.pgroup { display: block; padding: 0; border: 0; }
.pghead { position: sticky; top: calc(58px + var(--safe-t)); z-index: 4; background: #fff; padding: 6px 0 6px; border-bottom: 2px solid #0e7c74; box-shadow: 0 4px 8px -6px rgba(15,23,42,.35); }
#v-results.photoOn .pghead { top: calc(58px + var(--safe-t) + max(36vh, 220px)); }
.pghead img.strip { max-height: 70px; width: 100%; object-fit: contain; object-position: left; border-radius: 6px; border: 1px solid #e2e8f0; display: block; }
.pgt { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; }
.pgt span { color: #64748b; font-size: 13px; white-space: nowrap; }
.pgroup > ul.lines { margin: 0; padding-left: 10px; border-left: 3px solid #e6f4f2; }
.btn.missed { margin: 10px 0 4px; border-style: dashed; }

/* the form's ICD-10 vs the tests */
.badge.dxok { background: #dcfce7; color: #166534; }
.badge.dxno { background: #fee2e2; color: #b91c1c; }
.dxsum { border-radius: 10px; padding: 8px 10px; margin: 6px 0 10px; background: #f1f5f9; display: grid; gap: 2px; font-size: 14px; }
.dxsum.good { background: #ecfdf5; } .dxsum.mid { background: #fffbeb; } .dxsum.bad { background: #fef2f2; }
.report td.okc { color: #15803d; font-weight: 600; text-align: right; }
.report td.incl { text-align: right; }

/* report tables: zebra rows + a line under each, dotted leader toward the right-hand value */
.report table tr:nth-child(even) td { background: #f6f8fa; }
.report td { border-bottom: 1px solid #e2e8f0; }
.report td:first-child { background-image: linear-gradient(to right, #94a3b8 33%, transparent 0); background-position: bottom 6px right 0; background-size: 4px 1px; background-repeat: repeat-x; }
.report table.tests td:first-child, .report table.tot td:first-child { background-image: none; }
.report table.tot tr:last-child td { border-top: 2px solid #0e7c74; font-weight: 700; }

/* one table per test: red = not covered, yellow = included in a panel / marked twice */
.report table.tests tr.red td { background: #fee2e2 !important; }
.report table.tests tr.yellow td { background: #fef9c3 !important; }
.report table.tests tr.red td:first-child { color: #991b1b; }
.report .okc { color: #15803d; font-weight: 600; } .report .noc { color: #b91c1c; font-weight: 700; } .report td.nt { color: #a16207; font-weight: 700; }
.report table.tests td { font-size: 12px; vertical-align: top; }
@media print { @page { size: letter; margin: 10mm; } body.printing #printArea { font-size: 9.5pt; } }

/* diagnoses card */
.dxsum .dxh { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.dxchips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.dxchip { background: #fff; border: 1px solid #cbd5e1; border-radius: 99px; padding: 3px 4px 3px 10px; font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.dxchip button { border: 0; background: none; color: #94a3b8; font-size: 14px; padding: 0 4px; }
.dxbtns { display: flex; gap: 6px; flex-wrap: wrap; }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.dxdet { margin-top: 6px; font-size: 13px; } .dxdet summary { cursor: pointer; font-weight: 600; }
.dxdet p { margin: 6px 0; } .dxnot { color: #991b1b; }
.dxadd { font: inherit; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 99px; border: 1px solid #0e7c74; background: #fff; color: #0e7c74; margin: 2px 2px 0 0; }

.accask { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 4px; padding: 10px 12px; background: #fef9c3; border: 1.5px solid #facc15; border-radius: 12px; color: #713f12; font-weight: 700; font-size: 15px; }
.accask .btn { background: #fff; }
.ailine .pill .link { font-size: 11px; margin-left: 4px; }

.report .pdisc, .pdisc { font-size: 11px; font-style: italic; color: #475569; border-top: 1px solid #e2e8f0; padding-top: 6px; margin-top: 12px; }

/* lab setup */
.labtests li { display: flex; align-items: center; gap: 8px; }
.labtests .nm { flex: 1; min-width: 0; } .labtests .nm small { display: block; color: #64748b; font-size: 12px; }
.labtests .labcost { width: 84px; padding: 8px; font-size: 15px; border: 1px solid #cbd5e1; border-radius: 10px; }
.badge.pcr { background: #ede9fe; color: #5b21b6; }

/* printing: plain white paper, no app background / tints */
@media print {
  html, body, body.printing { background: #fff !important; padding: 0 !important; }
  body.printing #printArea, body.printing #printArea * { box-shadow: none !important; }
  body.printing #printArea { background: #fff !important; }
}

.tblwrap { overflow-x: auto; } table.mini tr.off td { opacity: .55; } .link.danger { color: #b91c1c; }

.askimg { display: block; width: 100%; max-height: 220px; object-fit: contain; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; margin: 6px 0 8px; }

/* undo */
.undopill { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + var(--safe-b)); z-index: 60; background: #14212b; color: #fff; border: 0; border-radius: 99px; padding: 10px 18px; font: inherit; font-weight: 700; font-size: 15px; box-shadow: 0 6px 20px rgba(0,0,0,.3); max-width: 90vw; white-space: nowrap; }
.undopill span { font-weight: 400; opacity: .75; margin-left: 6px; font-size: 13px; }
.danger-zone h3 { margin-top: 0; }

/* PCR panel builder */
.tchipsbox { max-height: 260px; overflow-y: auto; margin: 4px 0 10px; } .tchips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 6px; }
.tchips button { font: inherit; font-size: 13px; padding: 6px 10px; border-radius: 99px; border: 1px solid #cbd5e1; background: #fff; }
.cin { width: 74px; padding: 6px; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; } .uin { width: 52px; padding: 6px; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; }
table.mini td.r { text-align: right; white-space: nowrap; }
.pcrnote { display: block; margin: 8px 0 2px; padding: 8px 10px; background: #ede9fe; border-radius: 10px; color: #4c1d95; font-size: 13.5px; }
.rulenote { display: block; margin-top: 4px; padding: 6px 8px; border-radius: 8px; font-size: 12.5px; line-height: 1.35; background: #f1f5f9; color: #334155; }
.rulenote.limited, .rulenote.review { background: #fff7ed; color: #9a3412; } .rulenote.not { background: #fee2e2; color: #991b1b; } .rulenote.ok { background: #ecfdf5; color: #065f46; }
.rulenote.risk { background: #fee2e2; color: #991b1b; }

#billArea .lines > li.duplicate, #billArea .lines > li.included { background: #fef9c3; border-color: #fde047; }

/* medical necessity */
.neccard { margin: 10px 0; padding: 12px; border: 1.5px solid #c7d2fe; background: #eef2ff; border-radius: 14px; }
.neccard .range-row { display: flex; gap: 8px; flex-wrap: wrap; } .neccard .range-row .field { flex: 1; min-width: 140px; }
.nectest { background: #fff; border-radius: 10px; padding: 8px 10px; margin: 6px 0; border-left: 4px solid #16a34a; }
.nectest.weak { border-left-color: #d97706; } .nectest.not_supported { border-left-color: #dc2626; }
.nectest .nt-h { display: flex; justify-content: space-between; gap: 8px; align-items: center; } .nectest p { margin: 4px 0; }
.necimg { max-height: 60vh; overflow: auto; border: 1px solid #e2e8f0; border-radius: 10px; } .necimg canvas { width: 100%; display: block; }

/* accounts */
.kindpick { display: grid; gap: 8px; margin: 8px 0; } .kopt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1.5px solid #cbd5e1; border-radius: 12px; cursor: pointer; }
.kopt input { margin-top: 4px; } .kopt small { display: block; opacity: .8; font-size: 12.5px; } .kopt .kprice { font-weight: 700; opacity: 1; margin-top: 2px; }
.codebig { font-size: 34px; font-weight: 800; letter-spacing: 6px; margin: 4px 0 6px; color: #0f3d3e; font-family: ui-monospace, Menlo, monospace; }
.meter { height: 10px; border-radius: 99px; background: #e2e8f0; overflow: hidden; margin: 6px 0; } .meter i { display: block; height: 100%; background: #0e7c74; } .meter i.hi { background: #dc2626; }
.clinicbar { background: #eef2ff; border: 1px solid #c7d2fe; color: #312e81; border-radius: 12px; padding: 8px 12px; margin: 0 0 12px; font-size: 14px; }

/* ===== desktop / landscape tablet: photo pinned on the left, the list on the right ===== */
@media (min-width: 1100px) {
  .view { max-width: 920px; }
  #v-results { max-width: 1440px; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); column-gap: 28px; align-items: start; }
  #v-results > * { grid-column: 2; min-width: 0; }
  #v-results > #resultsViewer { grid-column: 1; grid-row: 1 / span 40; position: sticky; top: calc(70px + var(--safe-t)); height: calc(100vh - 190px); min-height: 420px; }
  #v-results.photoOn .pghead { top: calc(58px + var(--safe-t)); }
  #v-results #resultsViewer.tall { height: calc(100vh - 190px); }
  .totals .in { max-width: 1440px; margin: 0 auto; }
  #sheet .sheet-body, #sheetBody { max-width: 760px; margin-left: auto; margin-right: auto; }
}
.badge.freq { background: #e0f2fe; color: #075985; white-space: normal; }
.dsrow { border: 1px solid #e2e8f0; border-radius: 10px; padding: 8px 10px; margin: 8px 0; } .dsrow .small { margin-top: 3px; }

.macpick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; font-size: 13px; color: #475569; }
.macpick.ask { background: #fff7ed; border: 1px solid #fdba74; color: #9a3412; border-radius: 10px; padding: 6px 8px; font-weight: 600; }
.macpick button { font: inherit; font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 99px; border: 1px solid #0e7c74; background: #fff; color: #0e7c74; }
.macpick button.on { background: #0e7c74; color: #fff; }
.pcrtg { margin-top: 6px; font-size: 13px; } .pcrtg summary { cursor: pointer; font-weight: 600; color: #4c1d95; }
.pcrtg .tgrp { margin: 6px 0 0; } .pcrtg ul { margin: 2px 0 0 16px; padding: 0; } .pcrtg li { break-inside: avoid; overflow-wrap: anywhere; }
@media (min-width: 700px) { .pcrtg ul { columns: 2; column-gap: 16px; } }

/* billing simulator */
.simcols { display: grid; gap: 12px; } @media (min-width: 900px) { .simcols { grid-template-columns: 1fr 1fr; } }
.simtot { float: right; color: #0e7c74; } .simsugg { background: #fff7ed; border-radius: 10px; padding: 8px 10px; margin: 8px 0; } .simsugg p { margin: 4px 0; }
.simtbl input.cin { width: 74px; } .simchat { display: grid; gap: 8px; margin: 8px 0; max-height: 50vh; overflow-y: auto; }
.simchat .msg { padding: 8px 12px; border-radius: 12px; font-size: 14px; line-height: 1.45; } .simchat .msg.user { background: #e0f2fe; justify-self: end; max-width: 85%; }
.simchat .msg.assistant { background: #f1f5f9; } .prohint { margin-top: 6px; font-size: 12px; color: #6d28d9; }
.thumbs { display: flex; gap: 6px; margin-top: 6px; } .thumbs button { border: 1px solid #cbd5e1; background: #fff; border-radius: 8px; padding: 4px 8px; color: #475569; }

/* until the app knows whether to show sign-in or home: nothing (no flash of the home screen) */
body.booting .view, body.booting .top { visibility: hidden; }
