/* Look and layout of RFQ Pilot (static/index.html, app.css), so the two can merge: same colours, fonts,
   sticky bar with underlined tabs, page head, step tabs (.rtabs) with group labels, summary strip
   (.rsum), plain panels, bordered tables with upper-case headers, pills. Additions for this flow at the end. */
:root {
  --bg: #F2F4F6; --surface: #FFFFFF; --sunk: #E9EDF0; --ink: #16202B; --muted: #5A6774; --line: #D3DAE0;
  --accent: #A85F00; --lamp: #F2A20C; --lamp-ink: #1B1300;
  --good: #1D7A4C; --warn: #9A5B00; --crit: #B3261E;
  --f-head: "IBM Plex Sans Condensed", "Arial Narrow", Arial, sans-serif;
  --f-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #10151B; --surface: #18202A; --sunk: #212B36; --ink: #E6EBF0; --muted: #94A1AE; --line: #2D3945;
  --accent: #F5B13D; --lamp: #F2A20C; --lamp-ink: #1B1300;
  --good: #5CC38D; --warn: #F0A848; --crit: #F2857D; color-scheme: dark } }

* { box-sizing: border-box }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 14px; line-height: 1.45 }
h1, h2, h3, h4 { font-family: var(--f-head); font-weight: 600; margin: 0; text-wrap: balance }
h1 { font-size: 19px; letter-spacing: .01em }
h2 { font-size: 22px }
h3 { font-size: 16px }
h4 { font-size: 18px }
p { margin: 0 }
a { color: inherit }
.mono { font-family: var(--f-mono); font-size: 12.5px }
.muted { color: var(--muted) }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap }

.bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line) }
.bar-in { max-width: 1180px; margin: 0 auto; padding: 10px 16px 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px }
.brand { display: flex; align-items: center; gap: 9px; padding-bottom: 10px }
.brand i { width: 10px; height: 18px; border-radius: 2px; background: var(--lamp); display: block }
.tabs { display: flex; gap: 2px; overflow-x: auto; min-width: 0 }
.tabs a { padding: 8px 12px 10px; color: var(--muted); text-decoration: none; font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--lamp) }
.tabs a:hover { color: var(--ink) }
.appbar-who { margin-left: auto; display: flex; align-items: center; gap: 10px; padding-bottom: 10px; font-size: 13px }

main { max-width: 1180px; margin: 0 auto; padding-inline: 16px; padding-block: 20px 56px; display: flex; flex-direction: column; gap: 16px }
.head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 10px 16px }
.head p { max-width: 68ch; color: var(--muted); margin-top: 4px }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0 }
.panel > h3 + p { margin-top: -8px }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px }
.grow { flex: 1 1 auto; min-width: 0 }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px }
@media (max-width: 800px) { .two { grid-template-columns: minmax(0, 1fr) } }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 500; min-width: 0 }
input, select, textarea, button { font: inherit; color: inherit }
select { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 7px 9px; width: 100%; min-width: 0; color: var(--ink) }
input[type=text] { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 7px 9px; width: 100%; min-width: 0; color: var(--ink) }
select:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px }
button, .btn { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 7px 12px; font-weight: 500; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap }
button:hover, .btn:hover { border-color: var(--muted) }
button.primary { background: var(--lamp); border-color: var(--lamp); color: var(--lamp-ink) }
button.small { padding: 3px 8px; font-size: 12.5px }
button:disabled { opacity: .5; cursor: default }
button.link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 500 }

.tw { overflow-x: auto; border: 1px solid var(--line); border-radius: 4px }
table { border-collapse: collapse; width: 100%; font-size: 13px }
th { text-align: left; font-weight: 600; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--sunk); padding: 7px 9px; white-space: nowrap }
td { padding: 7px 9px; border-top: 1px solid var(--line); vertical-align: top }
tr.click { cursor: pointer }
tr.click:hover td { background: var(--sunk) }
tr.pick td { background: var(--sunk) }
tr.tot td { border-top: 2px solid var(--line); font-weight: 600 }
td.sec { background: var(--sunk); font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted) }
td.mono { white-space: nowrap }

.chip { display: inline-block; font-family: var(--f-mono); font-size: 11.5px; padding: 1px 6px; border-radius: 3px; background: var(--sunk); color: var(--ink); white-space: nowrap }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 1px 8px; border-radius: 99px; border: 1px solid currentColor; white-space: nowrap }
.pill.good { color: var(--good) } .pill.warn { color: var(--warn) } .pill.crit { color: var(--crit) } .pill.plain { color: var(--muted) }
.note { border-left: 3px solid var(--lamp); background: var(--sunk); padding: 9px 12px; border-radius: 0 4px 4px 0 }
.note.crit { border-left-color: var(--crit) }
.stats { display: flex; flex-wrap: wrap; gap: 8px 28px }
.stat b { display: block; font-family: var(--f-head); font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums }
.stat span { font-size: 12px; color: var(--muted) }

.rtabs { display: flex; gap: 4px; overflow-x: auto; position: sticky; top: 52px; z-index: 4; background: var(--bg); padding: 6px 0; border-bottom: 1px solid var(--line); margin-bottom: 4px }
.rtabs button { border: 1px solid transparent; background: none; color: var(--muted); padding: 6px 12px; border-radius: 4px; white-space: nowrap }
.rtabs button.on { background: var(--surface); border-color: var(--line); color: var(--ink); box-shadow: inset 0 -2px 0 var(--lamp) }
.rtabs .rtg { align-self: center; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 0 4px 0 10px; white-space: nowrap }
.rtabs .rtg:first-child { padding-left: 0 }
.rtabs .rtm { display: inline-block; min-width: 16px; padding: 0 4px; border-radius: 8px; background: var(--crit); color: #fff; font-size: 11px; line-height: 16px; text-align: center }
.rsum { display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; font-size: 13px }
.rsum .link { font-size: 13px }

.pcard { border: 1px solid var(--line); border-radius: 6px; background: var(--bg); display: flex; flex-direction: column; min-width: 0 }
.pcard > header { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface); border-radius: 6px 6px 0 0; flex-wrap: wrap }
.pmeta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--muted); margin-top: 2px }
.psec { padding: 12px 12px 0; display: flex; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted) }
.nlist { display: flex; flex-direction: column; gap: 8px; padding: 12px; font-size: 12.5px }
.nlist div { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 10px; align-items: baseline }
@media (max-width: 560px) { .nlist div { grid-template-columns: 1fr } }

#toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 4px; max-width: calc(100% - 32px); z-index: 12; opacity: 0; pointer-events: none; transition: opacity .2s }
#toast.show { opacity: 1 }

/* ---- additions for the design flow ---- */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: none }
.dot.good { background: var(--good) } .dot.warn { background: var(--warn) } .dot.crit { background: var(--crit) } .dot.plain { background: var(--line) }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px }
.step b { font-family: var(--f-head); font-size: 17px; font-weight: 600 }
.step span { font-size: 12.5px; color: var(--muted) }
.step.done { border-left: 3px solid var(--good) }
.step.current { border-color: var(--lamp); box-shadow: inset 0 0 0 1px var(--lamp) }
.prog { width: 100%; height: 8px; appearance: none; border: 0; border-radius: 2px; background: var(--sunk); overflow: hidden }
.prog::-webkit-progress-bar { background: var(--sunk); border-radius: 2px }
.prog::-webkit-progress-value { background: var(--lamp); border-radius: 2px }
.prog::-moz-progress-bar { background: var(--lamp) }
.pgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px }
.vlist { display: flex; flex-direction: column; padding: 4px 14px 12px }
.vlist div { display: grid; grid-template-columns: 14px 110px minmax(0, 1fr); gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 13px }
.vlist div:last-child { border-bottom: 0 }
.vlist span:nth-child(2) { color: var(--muted) }
.vlist span:last-child { text-align: right }
.vlist.left span:last-child { text-align: left }
.feed { display: flex; flex-direction: column }
.feed div { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; flex-wrap: wrap }
.feed div:first-child { border-top: 0 }
.feed .grow { min-width: 200px }
.revpick { display: flex; flex-wrap: wrap; gap: 8px }
.revpick button { flex-direction: column; align-items: flex-start; gap: 0; padding: 6px 12px; white-space: normal; text-align: left }
.revpick button span { font-size: 12px; color: var(--muted) }
.revpick button.on { border-color: var(--lamp); box-shadow: inset 0 0 0 1px var(--lamp) }
.revpick button.cmp { border-style: dashed; border-color: var(--lamp) }
.veil { position: fixed; inset: 0; background: rgba(16, 21, 27, .45); z-index: 10 }
.dialog { position: fixed; z-index: 11; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto }
.ilist { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: 13px }
.ilist li { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap }
.ilist li .grow { min-width: 200px }
@media (max-width: 560px) { .rtabs { top: 96px } }
.vlist.left div { grid-template-columns: 14px 170px minmax(0, 1fr) }

/* New input on R01: driver decisions and file reading */
td.acts { white-space: nowrap; text-align: right }
td.acts button + button { margin-left: 6px }
.dform { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--sunk) }
.dform h4 { margin: 0 0 8px }
.opts { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 }
.opt { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 6px 0; border-top: 1px solid var(--line); font-size: 13px }
.opt:first-child { border-top: 0 }
.opt .grow { flex: 1; min-width: 180px }
label.filebtn { position: relative; display: inline-flex; align-items: center; padding: 7px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); font-size: 13px; cursor: pointer }
label.filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer }
details.fold { margin-top: 10px }
details.fold summary { cursor: pointer; font-size: 13px; color: var(--muted) }

/* Required lists */
tr.off td { color: var(--muted) }
tr.off td .chip { opacity: .6 }
label.tog { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap }
.addline { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end }
.addline .grow { flex: 1; min-width: 200px }
.lst table { min-width: 700px }
.lst select { min-width: 110px }

/* Changes */
.cform { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 10px }
.cform label.f { min-width: 160px }
.cform .grow { flex: 1; min-width: 220px }
.cform .opts { flex-basis: 100% }
.opt.on { background: var(--sunk) }
.pcard > h4 { margin: 14px 14px 4px }
.pcard > .ilist, .pcard > details.fold, .pcard > .dform { margin-left: 14px; margin-right: 14px }
.pcard > details.fold { margin-bottom: 12px }
td .muted { font-size: 12px }
ul.dlist { margin: 0; padding-left: 18px; font-size: 13px }
ul.dlist li + li { margin-top: 2px }
td.chg { background: color-mix(in srgb, var(--warn) 16%, transparent); font-weight: 500 }
details.dnotes { margin-top: 4px }
details.dnotes summary { cursor: pointer; font-size: 12.5px }
.warnt { color: var(--warn) }
td .small { font-size: 12px; margin-top: 2px }

/* the agreed frame (docs/screens.md): one card, header with the design and the screen's context, design menu on the left */
.dframe { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden }
.dhead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 16px; padding: 14px 20px; border-bottom: 1px solid var(--line) }
.dhead b { font-size: 17px }
.dctx { color: var(--muted) }
.dbody { display: grid; grid-template-columns: 220px minmax(0, 1fr) }
.dmenu { display: flex; flex-direction: column; gap: 2px; padding: 14px 10px; border-right: 1px solid var(--line); background: var(--surface) }
.dmenu > button { text-align: left; border: 0; background: none; color: var(--muted); padding: 8px 12px; border-radius: 6px; font: inherit }
.dmenu > button.on { background: var(--sel, #e6eefb); color: var(--ink); font-weight: 600 }
.dmenu > button:hover:not(.on) { color: var(--ink) }
.dmenu .dmh { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 4px 12px 6px }
.dmenu .dstep { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 6px; color: var(--muted) }
.dmenu .dstep.on { background: var(--sel, #e6eefb); color: var(--ink); font-weight: 600 }
.dmenu .drev { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; border: 1px solid transparent !important }
.dmenu .drev span { font-size: 12px }
.dmenu .drev.cmp { border: 1px dashed var(--line) !important }
.dmenu .dback { margin-top: auto; padding-top: 16px; text-align: left }
.dmain { padding: 16px 20px; display: flex; flex-direction: column; gap: 16px; min-width: 0 }
.dmain > .panel { border: 0; padding: 0; background: none; box-shadow: none }
.appbar-who { display: flex; align-items: center; gap: 8px }
@media (max-width: 760px) { .dbody { grid-template-columns: 1fr } .dmenu { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line) } .dmenu .dback { margin-top: 0 } }

/* ---- web app (1.0.0): sign-in, home lists, RFQ editor ---- */
body.login { display: grid; place-items: center; min-height: 100vh; padding: 16px }
.loginbox { width: min(420px, 100%); display: flex; flex-direction: column; gap: 12px }
.loginbox .brand { padding: 0 }
.err { color: var(--crit); min-height: 1em }
input.cell { width: 100%; min-width: 64px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--ink) }
td:first-child input.cell, td.mono input.cell { min-width: 120px }
td select { min-width: 110px; padding: 5px 6px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface) }
textarea { width: 100%; border: 1px solid var(--line); border-radius: 4px; padding: 7px 9px; background: var(--surface); color: var(--ink) }
.ro { color: var(--ink); font-size: 14px; padding: 4px 0 }
