/* Shared foundation for the order-reader pages. Tokens come from parsemo-web (tokens.css); header, buttons, and footer match the scope tool. */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* Reserve the scrollbar so nothing moves when a result makes the page scroll (classic scrollbars: Windows, or macOS set to always show). */
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
body { min-height: 100dvh; display: flex; flex-direction: column; margin: 0; background: var(--canvas); color: var(--ink); font: 400 1rem/1.7 var(--ui); word-break: keep-all; overflow-wrap: anywhere; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-underline-offset: .2em; text-decoration-thickness: 1px; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, p, ol, ul, fieldset { margin: 0; }
ol, ul { padding: 0; list-style: none; }
fieldset { border: 0; padding: 0; min-width: 0; }
h1, h2, h3 { text-wrap: balance; }
main { flex: 1 0 auto; }
::selection { background: var(--cobalt-tint); color: var(--ink); }
textarea, input { caret-color: var(--cobalt); }
:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 3px; border-radius: 6px; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; z-index: 30; background: var(--ink); color: #fff; padding: .6rem 1rem; }
.skip:focus { left: 1rem; top: 1rem; }
.wrap { max-width: 76rem; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2.5rem); }
.num { font-variant-numeric: tabular-nums; }
.ico { width: 1.05rem; height: 1.05rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* app header */
.top { position: sticky; top: 0; z-index: 20; background: rgba(245, 247, 251, .92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; gap: .9rem; height: 3.75rem; }
.logo { display: inline-flex; align-items: center; gap: .5rem; font: 700 1.1rem/1 var(--display); letter-spacing: -.02em; text-decoration: none; }
.mark { width: 1.25rem; height: 1.25rem; border-radius: 4px; background: linear-gradient(var(--cobalt) 0 0) 0 0 / 100% 30% no-repeat, linear-gradient(var(--cobalt) 0 0) 0 50% / 100% 30% no-repeat, linear-gradient(var(--cobalt-tint) 0 0) 0 100% / 100% 30% no-repeat; }
.top-sep { width: 1px; height: 1.1rem; background: var(--line-strong); }
.tool-name { font-weight: 700; font-size: .9375rem; }
.ver { font-size: .75rem; font-weight: 700; color: var(--ink-3); padding: .1rem .5rem; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line); }
.logo, .tool-name, .ver, .top-link { white-space: nowrap; }
.top-link { margin-left: auto; font-size: .875rem; font-weight: 600; color: var(--ink-2); text-decoration: none; }
.top-link:hover { color: var(--ink); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 2.5rem; padding: 0 1rem; border: 0; border-radius: 10px; font: 600 .9375rem/1 var(--ui); text-decoration: none; white-space: nowrap; cursor: pointer; transition: background-color .2s ease, transform .2s ease, box-shadow .2s ease, color .2s ease; }
.btn-lg { min-height: 3rem; padding: 0 1.35rem; font-size: 1rem; border-radius: var(--radius); }
.btn-primary { background: var(--cobalt); color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 6px 16px -8px rgba(36, 75, 214, .8); }
.btn-primary:hover { background: var(--cobalt-2); }
.btn-primary:disabled { background: var(--line-strong); box-shadow: none; cursor: progress; }
.btn-ghost { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn-ghost:hover { box-shadow: inset 0 0 0 1px var(--ink-3); }
.btn-quiet { background: transparent; color: var(--ink-2); padding: 0 .7rem; }
.btn-quiet:hover { background: var(--surface); color: var(--ink); }
.btn:active { transform: translateY(1px); }
kbd { font: 600 .75rem/1 var(--ui); padding: .2rem .35rem; border-radius: 5px; background: rgba(255, 255, 255, .18); }
.btn-ghost kbd, .hint kbd { background: var(--canvas); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-3); }

/* choice chips: real checkboxes and radios, styled */
.choices { display: flex; flex-wrap: wrap; gap: .4rem; }
.choice { position: relative; display: inline-flex; }
.choice input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.choice span { display: inline-flex; align-items: center; gap: .35rem; min-height: 2.1rem; padding: 0 .8rem; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font-size: .875rem; font-weight: 500; color: var(--ink-2); transition: box-shadow .15s ease, background-color .15s ease, color .15s ease; }
.choice:hover span { box-shadow: inset 0 0 0 1px var(--ink-3); color: var(--ink); }
.choice input:checked + span { background: var(--cobalt-soft); color: var(--cobalt-2); box-shadow: inset 0 0 0 1.5px var(--cobalt); font-weight: 600; }
.choice input:focus-visible + span { outline: 3px solid var(--cobalt); outline-offset: 2px; }
.field-label { display: block; font-size: .8125rem; font-weight: 700; color: var(--ink-2); margin-bottom: .45rem; }
.hint { font-size: .8125rem; color: var(--ink-3); }

/* notices */
.notice { margin: 0; padding: .7rem .9rem; border-radius: 10px; font-size: .875rem; background: var(--cobalt-soft); color: var(--cobalt-2); }
.notice[data-kind="warn"] { background: var(--amber-soft); color: var(--amber); }
.notice[data-kind="error"] { background: var(--red-soft); color: var(--red-text); }

/* actions */
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* footer */
.foot { border-top: 1px solid var(--line); background: var(--surface); font-size: .8125rem; color: var(--ink-3); }
.foot-in { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; padding-top: 1.2rem; padding-bottom: 1.4rem; }
.foot a { color: var(--ink-2); }
.foot b { color: var(--ink-2); font-weight: 600; }

@media (max-width: 560px) {
  .top-in { gap: .6rem; }
  .top-link { display: none; }
  .actions { flex-wrap: nowrap; }
  .actions .btn-ghost { flex: 0 0 2.75rem; width: 2.75rem; padding: 0; }
  .actions .btn-ghost .label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .actions .btn-primary { flex: 1 1 auto; margin-left: 0 !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  body { background: #fff; }
  .top, .foot, form, .actions, .notice, .no-print { display: none !important; }
  #result { box-shadow: none !important; padding: 0 !important; }
}

/* ---------- order reader: shared pieces ---------- */
html:not(.js) .js-only { display: none !important; }
.js .go-nojs { display: none; }
.intro { padding-top: clamp(2rem, 5vw, 3.25rem); padding-bottom: clamp(1.25rem, 3vw, 2rem); }
.intro h1 { font: 800 clamp(1.7rem, 3.2vw, 2.5rem)/1.25 var(--display); letter-spacing: -.03em; }
.intro p { margin-top: .7rem; max-width: 44em; color: var(--ink-2); font-size: clamp(1rem, 1.3vw, 1.0625rem); }
.wrap-wide { max-width: 90rem; margin: 0 auto; padding: 0 clamp(1rem, 3vw, 2rem); }

/* upload */
.drop { position: relative; display: grid; justify-items: center; align-content: center; gap: .35rem; min-height: 11rem; padding: 1.5rem 1rem; border-radius: 14px; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line-strong); text-align: center; cursor: pointer; transition: box-shadow .15s ease, background-color .15s ease; }
.drop:hover, .drop.is-over { background: var(--cobalt-soft); box-shadow: inset 0 0 0 2px var(--cobalt); }
.drop:focus-within { outline: 3px solid var(--cobalt); outline-offset: 3px; }
.drop-ico { width: 1.6rem; height: 1.6rem; color: var(--cobalt); margin-bottom: .25rem; }
.drop-title { font-weight: 700; }
.drop-hint { font-size: .8125rem; color: var(--ink-3); }
.drop input[type="file"] { max-width: 100%; margin-top: .6rem; font-size: .8125rem; color: var(--ink-2); }
.js .drop input[type="file"] { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.samples { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.samples-label { margin-right: .15rem; font-size: .8125rem; font-weight: 600; color: var(--ink-3); }
.ex { display: inline-flex; align-items: center; gap: .35rem; border: 0; min-height: 2.1rem; padding: 0 .75rem; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font-size: .8125rem; font-weight: 500; color: var(--ink-2); cursor: pointer; transition: box-shadow .15s ease, color .15s ease; }
.ex .ico { width: .95rem; height: .95rem; color: var(--ink-3); }
.ex:hover { color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink-3); }
.privacy { font-size: .8125rem; color: var(--ink-3); }
.cam { display: none !important; }
@media (max-width: 560px) { .js .cam { display: inline-flex !important; width: 100%; } }

/* state pills (body[data-state] picks one) */
.st { display: none; align-items: center; gap: .4rem; font-size: .75rem; font-weight: 700; padding: .2rem .6rem; border-radius: 999px; white-space: nowrap; }
.st::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; }
body[data-state="idle"] .st-idle, body[data-state="loading"] .st-loading, body[data-state="streaming"] .st-streaming, body[data-state="done"] .st-done, body[data-state="clear"] .st-clear, body[data-state="manual"] .st-manual, body[data-state="unclear"] .st-unclear, body[data-state="error"] .st-error { display: inline-flex; }
.st-idle { background: var(--canvas); color: var(--ink-3); }
.st-loading, .st-streaming, .st-done, .st-manual, .st-unclear { background: var(--amber-soft); color: var(--amber); }
.st-loading::before, .st-streaming::before { animation: pulse .8s var(--ease-out) infinite alternate; }
.st-clear { background: var(--green-soft); color: var(--green-text); }
.st-error { background: var(--red-soft); color: var(--red-text); }
@keyframes pulse { from { opacity: .25; transform: scale(.8); } to { opacity: 1; transform: scale(1); } }
.reading { display: inline-flex; align-items: center; gap: .5rem; font-size: .8125rem; color: var(--ink-3); }
.reading::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: var(--pink); animation: pulse .8s var(--ease-out) infinite alternate; }

/* role pills: AI reads (pink), rules check (violet), a person confirms (amber) */
.role { display: inline-flex; align-items: center; gap: .35rem; padding: .18rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.role b { font-weight: 600; font-variant-numeric: tabular-nums; }
.role-ai { background: var(--pink-soft); color: var(--pink); }
.role-rule { background: var(--violet-soft); color: var(--violet); }
.role-human { background: var(--amber-soft); color: var(--amber); }

/* editable grid (grid.js) */
.grid { width: 100%; min-width: 46rem; table-layout: fixed; border-collapse: separate; border-spacing: 0; font-size: .9375rem; }
.grid .w-no { width: 2.2rem; } .grid .w-spec { width: 17%; } .grid .w-qty { width: 4.5rem; } .grid .w-unit { width: 3.5rem; }
.grid .w-price { width: 5.75rem; } .grid .w-amount { width: 6.75rem; } .grid .w-st { width: 4.75rem; } .grid .w-del { width: 2.5rem; }
.grid th { font-size: .75rem; font-weight: 700; color: var(--ink-3); text-align: left; padding: .45rem .5rem; white-space: nowrap; }
.grid thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); box-shadow: inset 0 -1px 0 var(--line); }
.grid .g-num { text-align: right; }
.grid td { padding: 0; border-bottom: 1px solid var(--line); }
.grid td input { display: block; width: 100%; min-width: 0; height: 2.5rem; padding: 0 .5rem; border: 0; background: transparent; font-size: .9375rem; }
.grid td.g-num input { text-align: right; font-variant-numeric: tabular-nums; }
.grid td input:focus { outline: none; background: var(--surface); box-shadow: inset 0 0 0 2px var(--cobalt); border-radius: 6px; }
.grid td input[readonly] { color: var(--ink-2); }
.grid .g-no { text-align: right; color: var(--ink-3); font-weight: 600; font-size: .75rem; padding-right: .4rem; border-bottom: 1px solid var(--line); }
.grid td.is-flag { background: var(--amber-soft); }
.grid td.is-flag input { color: var(--amber); font-weight: 600; }
.grid .is-ok td.is-flag { background: transparent; }
.grid .is-ok td.is-flag input { color: inherit; font-weight: inherit; }
.g-st { text-align: center; white-space: nowrap; }
.st-pass { font-size: .75rem; color: var(--ink-3); }
.st-box { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; font-weight: 700; color: var(--amber); cursor: pointer; }
.is-ok .st-box { color: var(--green-text); }
input[type="checkbox"] { width: 1.05rem; height: 1.05rem; margin: 0; accent-color: var(--green); cursor: pointer; }
.g-x { display: grid; place-items: center; width: 2rem; height: 2rem; border: 0; border-radius: 8px; background: transparent; color: var(--ink-3); cursor: pointer; }
.g-x:hover { background: var(--canvas); color: var(--ink); }
.g-x .ico { width: .9rem; height: .9rem; }
.g-wait td { padding: .6rem .5rem; }
.fld { display: grid; gap: .2rem; min-width: 0; }
.fld span { font-size: .75rem; font-weight: 700; color: var(--ink-3); }
.fld input { width: 100%; height: 2.4rem; padding: 0 .65rem; border: 0; border-radius: 10px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font-size: .9375rem; }
.fld input[inputmode="decimal"] { text-align: right; font-variant-numeric: tabular-nums; }
.fld input:hover { box-shadow: inset 0 0 0 1px var(--line-strong); }
.fld input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--cobalt); }
.fld.is-flag input { background: var(--amber-soft); box-shadow: inset 0 0 0 1px var(--amber-line); color: var(--amber); font-weight: 600; }
.rc { display: grid; gap: .3rem; font-size: .875rem; }
.rc li { display: flex; align-items: center; gap: .45rem; }
.rc .ico { width: .95rem; height: .95rem; }
.rc-ok { color: var(--ink-2); }
.rc-ok .ico { color: var(--green); }
.rc-flag { color: var(--amber); font-weight: 600; }
.rc b { font-weight: 700; color: inherit; }

/* no-JS result (form-render.js) */
.sheet { display: grid; gap: 1.1rem; }
.sheet fieldset { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: .6rem; }
.sheet legend { font-size: .8125rem; font-weight: 700; color: var(--ink-2); margin-bottom: .4rem; }
.sheet .ff { display: grid; gap: .2rem; font-size: .75rem; font-weight: 700; color: var(--ink-3); }
.sheet th, .sheet td:first-child { white-space: nowrap; }
.sheet td:first-child { width: 2rem; font-size: .75rem; color: var(--ink-3); text-align: right; padding-right: .4rem; }
.sheet input[inputmode="decimal"] { text-align: right; font-variant-numeric: tabular-nums; }
.sheet .c-del { width: 2.5rem; text-align: center; }
.sheet .ff input, .sheet td input { width: 100%; height: 2.3rem; padding: 0 .5rem; border: 0; border-radius: 8px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font-size: .9375rem; font-weight: 400; color: var(--ink); }
.sheet .is-flag input { background: var(--amber-soft); }
.sheet .tbl-wrap { overflow-x: auto; }
.sheet table { width: 100%; min-width: 44rem; border-collapse: collapse; }
.sheet th { font-size: .75rem; color: var(--ink-3); text-align: left; padding: .3rem; }
.sheet td { padding: .2rem; }
.sheet .row-note td { padding-bottom: .5rem; }
.chk { display: inline-block; margin: 0 .4rem .2rem 0; padding: .1rem .5rem; border-radius: 999px; background: var(--amber-soft); color: var(--amber); font-size: .75rem; font-weight: 700; font-style: normal; }
.source-note, .review-count, .memo { font-size: .875rem; color: var(--ink-2); }
.review-count { display: grid; gap: .45rem; padding: .8rem .9rem; border-radius: 14px; background: var(--canvas); }
.review-count .always { display: grid; gap: .3rem; }
.review-count .always li { display: flex; align-items: center; gap: .45rem; }
.source-note b, .review-count b { color: var(--ink); margin-right: .3rem; }
.export .hint { margin-top: .4rem; }
