/* RDW ITPs – single phone column. Light by default, dark follows the phone. */
:root {
  --bg: #eef0f2; --surface: #ffffff; --ink: #15191e; --muted: #5b6571; --line: #d6dbe1;
  --accent: #1d4f8f; --accent-ink: #ffffff; --hold: #b93f0a; --hold-bg: #fff2ea;
  --ok: #167a3a; --ok-bg: #e9f6ee; --no: #b42318; --no-bg: #fdeceb; --logo-filter: none;
  --display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111519; --surface: #1a2027; --ink: #e8ecf0; --muted: #9aa4af; --line: #2c3540;
    --accent: #6aa6ec; --accent-ink: #0b1420; --hold: #fb923c; --hold-bg: #2b1b10;
    --ok: #4ade80; --ok-bg: #11261a; --no: #f87171; --no-bg: #2b1414; --logo-filter: invert(1);
    color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.45;
  padding-top: env(safe-area-inset-top, 0px); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
.wrap { max-width: 600px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 16px 110px; display: flex; flex-direction: column; gap: 14px; }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: .01em; text-wrap: balance; font-weight: 700; }
h1 { font-size: 30px; } h2 { font-size: 25px; } h3 { font-size: 19px; }
p { margin: 0; }
.logo { height: 34px; width: auto; filter: var(--logo-filter); align-self: flex-start; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); font-size: 14px; }
.banner { font-size: 13px; color: var(--hold); background: var(--hold-bg); border-radius: 8px; padding: 8px 12px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.between { justify-content: space-between; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }

button { font-family: var(--body); }
.btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 9px; padding: 10px 14px;
  font-size: 15px; font-weight: 600; cursor: pointer; min-height: 44px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--no); }
.btn.small { min-height: 34px; padding: 6px 10px; font-size: 13px; }
.btn.link { border: 0; background: none; color: var(--accent); padding: 6px 0; min-height: 0; }
.btn:disabled { opacity: .5; cursor: default; }
input, textarea { font: 16px var(--body); color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px; width: 100%; }
textarea { min-height: 70px; resize: vertical; }
input:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; min-width: 0; }

.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: transparent; color: var(--ink); font-size: 15px; font-weight: 600; padding: 10px; border-radius: 7px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

.list { display: flex; flex-direction: column; gap: 8px; }
.tpl { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px; color: var(--ink); font: inherit; cursor: pointer; }
.tpl .code { font-family: var(--display); font-size: 20px; font-weight: 700; color: var(--accent); min-width: 46px; }
.tpl .t { flex: 1; min-width: 0; font-weight: 600; }
.tpl .n { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.tpl .badge { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 8px; background: var(--ok-bg); color: var(--ok); }
.section-label { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-top: 6px; }

.bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bg); padding-block: 8px;
  display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.progress { flex: 1; min-width: 0; }
.track { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.fill { height: 100%; background: var(--ok); }
.lbl { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

fieldset { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 12px; margin: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; min-width: 0; }
legend { font-family: var(--display); font-size: 19px; font-weight: 700; padding: 0 6px; }
.full { grid-column: 1 / -1; }

.sec { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.sec-h { display: flex; gap: 10px; align-items: baseline; padding: 12px; }
.sec-h .no { font-family: var(--display); font-size: 19px; font-weight: 700; color: var(--accent); }
.chk { border-top: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.chk.hold { background: var(--hold-bg); } .chk.yes { background: var(--ok-bg); } .chk.no { background: var(--no-bg); }
.top { display: flex; gap: 8px; align-items: flex-start; }
.top .txt { flex: 1; min-width: 0; font-weight: 500; }
.cno { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 3px; min-width: 28px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--muted); align-items: center; }
.pill { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.pill.H { border-color: var(--hold); color: var(--hold); }
.ans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ans button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 15px; font-weight: 600;
  border-radius: 8px; padding: 10px 0; cursor: pointer; }
.ans.wrap { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.ans button[aria-pressed="true"][data-tone="good"] { background: var(--ok); border-color: var(--ok); color: var(--accent-ink); }
.ans button[aria-pressed="true"][data-tone="bad"] { background: var(--no); border-color: var(--no); color: var(--accent-ink); }
.ans button[aria-pressed="true"][data-tone="na"] { background: var(--muted); border-color: var(--muted); color: var(--surface); }
.ans button[aria-pressed="true"][data-tone="pick"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 6px; }
.fields input { font-size: 15px; padding: 8px 10px; }
.tools { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.thumb { position: relative; width: 64px; height: 64px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.65); color: #fff; font-size: 13px; line-height: 1; cursor: pointer; }
.locked { font-size: 13px; color: var(--hold); font-weight: 600; }
.signed { font-size: 12px; color: var(--muted); }

.sig { position: relative; border: 1px dashed var(--muted); border-radius: 8px; background: #fff; touch-action: none; }
.sig canvas { width: 100%; height: 160px; display: block; }
.sig .clear { position: absolute; top: 6px; right: 6px; }
.sig .hint { position: absolute; left: 10px; bottom: 6px; font-size: 12px; color: #8a939d; pointer-events: none; }
.sig-img { max-width: 220px; background: #fff; border-radius: 6px; border: 1px solid var(--line); }

.foot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--surface); border-top: 1px solid var(--line);
  padding-top: 10px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; gap: 8px; justify-content: center; }
.foot .btn { flex: 1; max-width: 290px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 20;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px; max-width: calc(100% - 32px); }
.code-input { font-size: 26px; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: no-preference) { .fill { transition: width .25s; } }
.tpl .badge.wait { background: var(--hold-bg); color: var(--hold); }
.ok-line { color: var(--ok); font-weight: 600; }
.wait-line { color: var(--hold); font-weight: 600; }
.q { font-size: 15px; color: var(--ink); font-weight: 600; }
.cap-list { display: flex; flex-direction: column; gap: 8px; }
.cap-row { display: flex; gap: 10px; align-items: center; }
.cap-row input { flex: 1; min-width: 0; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); }
label.check input { width: 20px; height: 20px; }

/* materials docket */
.mat-entry .code { font-size: 17px; }
.mat-scan { display: flex; align-items: center; justify-content: center; text-align: center; color: var(--accent-ink); font-size: 15px; }
select { font: 16px var(--body); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; width: 100%; }
.mat-line { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.mat-name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.mat-name .n { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.mat-step { display: flex; align-items: center; gap: 4px; }
.mat-step input { width: 56px; text-align: center; padding: 6px; font-variant-numeric: tabular-nums; }
.mat-step .btn.small { width: 36px; padding: 0; font-size: 18px; }
.mat-x { grid-column: 1 / -1; justify-self: start; font-size: 13px; }
.mat-sheet-bg { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; }
.mat-sheet { width: 100%; max-width: 600px; border-radius: 14px 14px 0 0; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
.mat-step.big { justify-content: center; }
.mat-step.big .btn { width: 56px; font-size: 24px; }
.mat-step.big input { width: 90px; font-size: 22px; padding: 10px; }
.tpl .badge { white-space: nowrap; }
.mat-cc { display: flex; flex-wrap: wrap; gap: 6px; }
.mat-cc .eyebrow { width: 100%; }
.mat-chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 8px 12px; font: 600 14px var(--body); cursor: pointer; min-height: 40px; }
.mat-chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.mat-err { color: var(--no); }
