:root {
  --ink: #14212b; --muted: #5b6b77; --line: #d9e1e7; --bg: #f4f7f9; --card: #fff;
  --brand: #0f3d5e; --brand2: #1d6fa5; --ok: #1e7b43; --warn: #9a5b00; --warnbg: #fff4e0;
  --bad: #b3261e; --badbg: #fdecea; --rec: #d0312d; --radius: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; padding-bottom: calc(96px + var(--safe-b)); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 10px; background: var(--brand); color: #fff; }
.brand { font-weight: 700; flex: 1; }
.who { font-size: 14px; opacity: .9; }
.top .link { color: #fff; }
.banner { padding: 8px 14px; background: var(--warnbg); color: var(--warn); font-size: 14px; }
.banner.test { background: #e8f0fe; color: #174ea6; }
main { max-width: 560px; margin: 0 auto; padding: 12px; }
.pad { padding: 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
h1 { font-size: 22px; margin: 6px 0 12px; }
h2 { font-size: 18px; margin: 18px 0 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 10px 0; }
.card.pick { border: 2px solid var(--brand2); box-shadow: 0 1px 6px rgba(15, 61, 94, .15); }
.card.choice { cursor: pointer; }
.card.choice:active { background: #eef4f8; }
.jobno { font-size: 20px; font-weight: 700; }
.addr { margin-top: 4px; }
.why { margin-top: 6px; color: var(--brand2); font-weight: 600; font-size: 15px; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 13px; background: #e7edf2; color: var(--muted); margin-left: 6px; }
.badge.bad { background: var(--badbg); color: var(--bad); }
.btn { display: block; width: 100%; min-height: 50px; padding: 12px 16px; border-radius: var(--radius); border: 1px solid var(--line);
  background: #fff; font-weight: 600; text-align: center; margin: 8px 0; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary[disabled] { background: #9db2c2; border-color: #9db2c2; }
.btn.danger { color: var(--bad); }
.btn.inline { display: inline-block; width: auto; min-height: 40px; padding: 8px 14px; margin: 4px 4px 4px 0; }
.link { background: none; border: 0; color: var(--brand2); padding: 6px 0; font-weight: 600; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.branch { min-height: 64px; padding: 10px; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; text-align: left; }
.branch b { display: block; }
.branch.on { border: 2px solid var(--brand2); background: #eef5fb; }
.branch .small { color: var(--muted); }
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--brand2); border-radius: var(--radius); overflow: hidden; margin: 8px 0; }
.seg button { min-height: 52px; border: 0; background: #fff; font-weight: 700; color: var(--brand2); }
.seg button.on { background: var(--brand2); color: #fff; }
.strip { position: sticky; top: 52px; z-index: 4; background: #e9f1f7; border: 1px solid #cddbe6; border-radius: var(--radius);
  padding: 8px 12px; margin: 0 0 10px; font-size: 14px; display: flex; gap: 8px; align-items: center; }
.strip b { font-size: 15px; }
.strip .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mic { display: flex; flex-direction: column; align-items: center; padding: 16px 0 8px; }
.mic button.big { width: 100%; min-height: 84px; border-radius: 18px; border: 0; background: var(--brand); color: #fff; font-size: 20px; font-weight: 700; }
.mic button.stop { background: var(--rec); }
.recdot { width: 14px; height: 14px; border-radius: 50%; background: var(--rec); display: inline-block; margin-right: 8px; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.rec-state { margin: 10px 0 0; font-weight: 700; color: var(--rec); display: flex; align-items: center; }
textarea, input[type=text], input[type=search], input[type=number], input[type=date], input[inputmode], select {
  width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; min-height: 48px; font-size: 16px; }
textarea { min-height: 90px; resize: vertical; }
.lines { margin: 8px 0; }
.line { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin: 8px 0; }
.line.flag { border-color: #e5b35c; background: #fffaf0; }
.line.block { border-color: #e59b95; background: #fff7f6; }
.line-head { display: flex; gap: 10px; padding: 12px; align-items: flex-start; width: 100%; background: none; border: 0; text-align: left; }
.line-head .d { flex: 1; min-width: 0; }
.line-head .d b { display: block; overflow-wrap: anywhere; }
.line-head .q { font-weight: 700; white-space: nowrap; }
.flags { padding: 0 12px 10px; }
.flagq { font-size: 14px; margin: 6px 0 2px; color: var(--bad); font-weight: 600; }
.flagq.check { color: var(--warn); }
.opts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.opts button { min-height: 40px; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--brand2); background: #fff; color: var(--brand2); font-weight: 600; font-size: 15px; }
.editor { border-top: 1px dashed var(--line); padding: 12px; }
.editor label { display: block; font-size: 13px; color: var(--muted); margin: 8px 0 4px; }
.stepper { display: grid; grid-template-columns: 52px 1fr 52px; gap: 6px; }
.stepper button { min-height: 48px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-size: 22px; font-weight: 700; }
.question { background: var(--warnbg); border: 1px solid #e5b35c; border-radius: var(--radius); padding: 12px; margin: 8px 0; }
.question p { margin: 0 0 6px; font-weight: 600; }
.info { background: #eef5fb; border: 1px solid #cddbe6; border-radius: var(--radius); padding: 10px 12px; margin: 8px 0; font-size: 15px; }
.problems { background: var(--badbg); border: 1px solid #e59b95; border-radius: var(--radius); padding: 10px 12px; margin: 8px 0; }
.problems li { margin: 4px 0; }
pre.preview { white-space: pre-wrap; overflow-wrap: anywhere; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px;
  font: 14px/1.45 ui-monospace, Menlo, Consolas, monospace; max-height: 50vh; overflow-y: auto; }
.bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: rgba(244, 247, 249, .96); border-top: 1px solid var(--line);
  padding: 10px 12px calc(10px + var(--safe-b)); }
.bottom .inner { max-width: 560px; margin: 0 auto; }
.bottom .btn { margin: 0; }
.bottom .under { text-align: center; font-size: 14px; color: var(--muted); margin-top: 6px; }
.status { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.status:last-child { border-bottom: 0; }
.status .ic { font-size: 20px; width: 26px; text-align: center; }
.status.good .ic { color: var(--ok); }
.status.bad .ic { color: var(--bad); }
.status.wait .ic { color: var(--warn); }
.toast { position: fixed; left: 12px; right: 12px; bottom: calc(92px + var(--safe-b)); z-index: 9; max-width: 540px; margin: 0 auto;
  background: #14212b; color: #fff; padding: 12px 14px; border-radius: 10px; font-size: 15px; }
.results button { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line); background: #fff; min-height: 48px; }
.results { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 6px 0; }
details summary { cursor: pointer; color: var(--brand2); font-weight: 600; padding: 6px 0; }
.hist li { margin: 4px 0; font-size: 14px; }
[hidden] { display: none !important; }
@media (max-width: 360px) { .grid2 { grid-template-columns: 1fr; } }
/* the job and supplier headings are scroll targets: keep them clear of the sticky header */
h2[id] { scroll-margin-top: calc(env(safe-area-inset-top, 0px) + 64px); }
h2.flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: #fff3b0; } to { background: transparent; } }
h2[tabindex]:focus { outline: none; }
.change-job > summary { margin: 4px 0 8px; }
