/* 書類読み取りの体験版。色は common/base.css のトークンだけを使う */
.rr { max-width: 1280px; margin: 0 auto; padding: 20px var(--gutter) 56px; }

/* 作業の流れ（1→2→3） */
.rr-steps { display: flex; align-items: center; gap: 10px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; width: fit-content; max-width: 100%; margin: 0 auto 22px; box-shadow: var(--shadow-s); }
.rr-steps button { display: flex; align-items: center; gap: 8px; padding: 7px 16px 7px 8px; border-radius: 999px; font-size: 14px; font-weight: 700; color: var(--ink-3); white-space: nowrap; }
.rr-steps button:disabled { cursor: default; opacity: .55; }
.rr-steps button:not(:disabled):hover { background: var(--sunken); color: var(--ink); }
.rr-steps .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--sunken); font-size: 13px; }
.rr-steps button[aria-current="step"] { background: var(--brand); color: #fff; }
.rr-steps button[aria-current="step"] .n { background: var(--accent); color: #fff; }
.rr-steps button.done .n { background: var(--ok-soft); color: var(--ok); }
.rr-steps-line { width: 22px; height: 2px; background: var(--line-2); flex: none; }

.scr-head { max-width: 760px; margin-bottom: 18px; }
.scr-head h2 { font-size: 24px; font-weight: 800; line-height: 1.4; }
.scr-lead { margin-top: 6px; color: var(--ink-2); line-height: 1.85; }

/* 1. 書類を選ぶ */
.pick-tools { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.pick-count { font-weight: 700; margin-right: auto; }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
.doc-card {
  position: relative; display: flex; flex-direction: column; text-align: left; background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--r-m); overflow: hidden; transition: border-color .15s, box-shadow .15s, transform .15s;
}
.doc-card:hover { border-color: var(--line-2); box-shadow: var(--shadow-s); }
.doc-card[aria-pressed="true"] { border-color: var(--brand-2); box-shadow: 0 0 0 2px var(--brand-soft); }
.doc-card .thumb { aspect-ratio: 4 / 3; background: var(--sunken); overflow: hidden; }
.doc-card .thumb img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.doc-card[aria-pressed="false"] .thumb img { opacity: .45; filter: grayscale(.6); }
.doc-card .check { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .92); border: 1.5px solid var(--line-2); }
.doc-card[aria-pressed="true"] .check { background: var(--brand); border-color: var(--brand); }
.doc-card .check svg { width: 15px; height: 15px; stroke: #fff; fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.doc-card[aria-pressed="false"] .check svg { display: none; }
.doc-card .meta { padding: 9px 11px 11px; }
.doc-card .kind { font-size: 11.5px; color: var(--ink-3); }
.doc-card .ttl { font-size: 14px; font-weight: 700; line-height: 1.4; margin-top: 1px; }
.doc-card .pt { display: inline-block; margin-top: 6px; font-size: 11.5px; line-height: 1.45; padding: 2px 7px; border-radius: 4px; background: var(--accent-soft); color: var(--accent-deep); }
.pick-foot {
  position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 16px; margin: 20px calc(var(--gutter) * -1) 0; padding: 14px var(--gutter) calc(14px + env(safe-area-inset-bottom));
  background: rgba(246, 244, 238, .94); backdrop-filter: blur(6px); border-top: 1px solid var(--line);
}
.pick-note { font-size: 12.5px; color: var(--ink-3); line-height: 1.6; flex: 1; }
.btn-big { min-height: 50px; padding: 0 26px; font-size: 16px; border-radius: 12px; }

/* 読み取り中 */
.reading { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; background: rgba(22, 36, 44, .45); padding: 16px; }
.reading-card { width: min(360px, 100%); background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-l); padding: 22px 24px 20px; text-align: center; }
.reading-thumb { position: relative; width: 120px; height: 150px; margin: 0 auto; border-radius: 8px; overflow: hidden; background: var(--sunken); }
.reading-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.scan { position: absolute; left: 0; right: 0; height: 26px; background: linear-gradient(rgba(194, 106, 23, 0), rgba(194, 106, 23, .45), rgba(194, 106, 23, 0)); animation: scan 1s ease-in-out infinite alternate; }
@keyframes scan { from { top: -10px; } to { top: 134px; } }
.reading-title { margin-top: 14px; font-weight: 700; font-size: 16px; }
.reading-bar { height: 6px; border-radius: 3px; background: var(--sunken); margin-top: 12px; overflow: hidden; }
.reading-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .12s linear; }
.reading-count { margin-top: 6px; font-size: 13px; color: var(--ink-2); }
.reading-note { margin-top: 8px; font-size: 12px; color: var(--ink-3); line-height: 1.6; }

/* 確認のひと言 */
.ask { position: fixed; inset: 0; z-index: 950; display: grid; place-items: center; background: rgba(22, 36, 44, .5); padding: 16px; }
.ask-card { width: min(460px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-l); padding: 22px 24px 20px; }
.ask-title { font-size: 18px; font-weight: 800; line-height: 1.5; }
.ask-list { list-style: none; margin: 12px 0 0; display: grid; gap: 4px; font-size: 13.5px; }
.ask-list li { padding: 6px 10px; border-radius: 6px; background: var(--bad-soft); color: var(--bad); font-weight: 600; line-height: 1.5; }
.ask-list li.neutral { background: var(--sunken); color: var(--ink-2); }
.ask-list:empty { display: none; }
.ask-body { margin-top: 12px; font-size: 14px; color: var(--ink-2); line-height: 1.8; }
.ask-btns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.ask-btns .btn { min-height: 46px; }

/* 2. 確かめて直す */
.strip-wrap { margin: 0 calc(var(--gutter) * -1) 16px; padding: 0 var(--gutter); overflow-x: auto; scrollbar-width: thin; }
.strip { display: flex; gap: 8px; padding: 2px 0 8px; width: max-content; }
.strip button { position: relative; width: 62px; flex: none; border-radius: 8px; border: 2px solid transparent; padding: 0; background: var(--surface); box-shadow: var(--shadow-s); }
.strip button img { width: 100%; height: 62px; object-fit: cover; object-position: top; border-radius: 6px 6px 0 0; }
.strip button .sdot { display: block; font-size: 10.5px; font-weight: 700; line-height: 18px; text-align: center; border-radius: 0 0 6px 6px; background: var(--sunken); color: var(--ink-3); }
.strip button[aria-current="true"] { border-color: var(--accent); }
.strip .s-確定 .sdot { background: var(--ok-soft); color: var(--ok); }
.strip .s-要確認 .sdot { background: var(--warn-soft); color: var(--warn); }
.strip .s-除外 .sdot { background: var(--bad-soft); color: var(--bad); }

.review-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 16px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 14px; min-width: 0; box-shadow: var(--shadow-s); }
.img-panel { position: sticky; top: 12px; }
.img-wrap { background: #e7e9ec; border-radius: var(--r-m); height: min(640px, calc(100vh - 200px)); overflow: auto; display: flex; align-items: center; justify-content: center; cursor: zoom-in; }
.img-wrap img { max-width: 100%; max-height: 100%; object-fit: contain; }
.img-wrap.zoom { display: block; cursor: zoom-out; }
.img-wrap.zoom img { max-width: none; max-height: none; width: 170%; }
.img-cap { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; font-size: 13px; color: var(--ink-2); }
.img-cap span:first-child { font-weight: 600; }
.img-hint { color: var(--ink-3); font-size: 12px; white-space: nowrap; }
.statusline { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; font-size: 13.5px; margin-bottom: 10px; }
.doc-pos { margin-left: auto; color: var(--ink-3); font-size: 12.5px; }
.st { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.st.未確認 { background: var(--sunken); color: var(--ink-3); }
.st.確定 { background: var(--ok-soft); color: var(--ok); }
.st.要確認 { background: var(--warn-soft); color: var(--warn); }
.st.除外 { background: var(--bad-soft); color: var(--bad); }
.issues { list-style: none; margin: 0 0 12px; display: grid; gap: 4px; font-size: 13px; }
.issues li { padding: 5px 10px; border-radius: 6px; line-height: 1.5; }
.issues li.error { background: var(--bad-soft); color: var(--bad); font-weight: 600; }
.issues li.warn { background: var(--warn-soft); color: var(--warn); }
.issues li.info { background: var(--sunken); color: var(--ink-3); }

.field { display: grid; grid-template-columns: 116px minmax(0, 1fr); align-items: start; gap: 8px; margin-bottom: 8px; border-radius: 8px; }
.field > label { color: var(--ink-2); font-size: 13px; padding-top: 8px; line-height: 1.4; }
.field input, .field select, .field textarea {
  width: 100%; min-width: 0; height: 38px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--surface); color: var(--ink); font-size: 14.5px;
}
.field textarea { height: auto; min-height: 58px; padding: 7px 10px; resize: vertical; line-height: 1.55; }
.field.low input, .field.low select { background: var(--warn-soft); border-color: var(--warn-line); }
.field.ng input, .field.ng select { background: var(--bad-soft); border-color: var(--bad-line); }
.fbadge { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 0 6px; border-radius: 999px; margin-top: 3px; white-space: nowrap; }
.fbadge.low { background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn-line); }
.fbadge.ng { background: var(--bad-soft); color: var(--bad); border: 1px solid var(--bad-line); }
.sub { display: grid; gap: 5px; }
.sub .row { display: grid; gap: 5px; align-items: center; }
.sub .tax { grid-template-columns: 78px minmax(0, 1fr) 72px minmax(0, 1fr) 30px; }
.sub .item { grid-template-columns: minmax(0, 1fr) 108px 30px; }
.sub .head { font-size: 11.5px; color: var(--ink-3); }
.r { text-align: right; }
.mini { height: 30px; min-width: 30px; padding: 0 8px; font-size: 12.5px; border-radius: 6px; background: var(--sunken); color: var(--ink-2); }
.mini:hover { background: var(--line); }
.actions {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 14px -14px -14px; padding: 12px 14px; border-top: 1px solid var(--line);
  background: var(--surface); border-radius: 0 0 var(--r-l) var(--r-l); position: sticky; bottom: 0; z-index: 4;
}
.actions .nav { margin-left: auto; display: flex; gap: 6px; }
.b-ok { background: var(--ok); border-color: var(--ok); color: #fff; min-width: 96px; }
.b-ok:hover { background: #22553c; }
.b-check { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.b-check:hover { background: #fbe9b8; }
.b-ex { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }
.b-ex:hover { background: #f5d0c8; }
.legend { margin-top: 26px; font-size: 12.5px; color: var(--ink-3); line-height: 1.7; }
.empty-msg { padding: 48px 20px; text-align: center; color: var(--ink-3); background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--r-l); }

/* 3. Excelにまとめる */
.ex-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 20px; box-shadow: var(--shadow-s); }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tile { padding: 12px 14px; border-radius: var(--r-m); background: var(--paper); border: 1px solid var(--line); }
.tile b { display: block; font-size: 26px; line-height: 1.2; font-weight: 800; }
.tile span { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.tile.ok b { color: var(--ok); } .tile.warn b { color: var(--warn); } .tile.bad b { color: var(--bad); } .tile.none b { color: var(--ink-3); }
.ex-warn { margin-top: 12px; padding: 9px 12px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); font-size: 13.5px; font-weight: 600; }
.ex-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.ex-note { margin-top: 10px; font-size: 12.5px; color: var(--ink-3); line-height: 1.7; }
.preview { margin-top: 24px; }
.preview h3 { font-size: 16px; font-weight: 800; }
.table-wrap { margin-top: 10px; overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); }
.table-wrap table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.table-wrap th { background: #1f4e78; color: #fff; font-weight: 700; text-align: left; padding: 7px 9px; white-space: nowrap; }
.table-wrap td { padding: 6px 9px; border-top: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
.table-wrap td.wrap { white-space: normal; min-width: 220px; max-width: 360px; }
.table-wrap td.r { text-align: right; }
.table-wrap tr.y td { background: #fff2cc; }
.table-wrap tr.g td { background: #ededed; }
.table-wrap tr.sum td { font-weight: 800; border-top: 2px solid var(--line-2); }

@media (max-width: 900px) {
  .review-grid { grid-template-columns: minmax(0, 1fr); }
  .img-panel { position: static; }
  .img-wrap { height: 300px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .rr { padding-top: 14px; }
  .rr-steps { gap: 2px; padding: 4px; width: 100%; justify-content: space-between; margin-bottom: 18px; }
  .rr-steps button { flex-direction: column; gap: 2px; padding: 5px 4px; font-size: 11.5px; flex: 1; border-radius: 14px; }
  .rr-steps-line { width: 10px; }
  .scr-head h2 { font-size: 20px; }
  .scr-lead { font-size: 14px; line-height: 1.8; }
  .doc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .doc-card .ttl { font-size: 13px; }
  .pick-foot { flex-direction: column; align-items: stretch; gap: 8px; padding-top: 10px; }
  .pick-note { font-size: 11.5px; }
  .btn-big { width: 100%; }
  .panel { padding: 12px; border-radius: var(--r-m); }
  .img-wrap { height: 260px; }
  .field { grid-template-columns: minmax(0, 1fr); gap: 3px; margin-bottom: 10px; }
  .field > label { padding-top: 0; display: flex; align-items: center; gap: 6px; }
  .fbadge { margin-top: 0; }
  .field input, .field select, .field textarea { font-size: 16px; height: 42px; }
  .field textarea { height: auto; }
  .sub .tax { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 34px; grid-template-areas: "rate incl del" "base tax ."; }
  .sub .tax > :nth-child(1) { grid-area: rate; } .sub .tax > :nth-child(2) { grid-area: base; } .sub .tax > :nth-child(3) { grid-area: incl; }
  .sub .tax > :nth-child(4) { grid-area: tax; } .sub .tax > :nth-child(5) { grid-area: del; }
  .sub .tax.head { display: none; }
  .sub .item { grid-template-columns: minmax(0, 1fr) 96px 34px; }
  .actions { margin: 14px -12px -12px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); gap: 6px; border-radius: 0 0 var(--r-m) var(--r-m); }
  .actions { flex-wrap: nowrap; }
  .actions .btn { padding: 0 6px; flex: 1; min-width: 0; font-size: 14px; }
  .actions .nav { margin-left: 0; flex: 0 0 auto; gap: 4px; }
  .actions .nav .btn { flex: none; width: 36px; padding: 0; }
  .ask-card { padding: 18px 16px 16px; }
  .ask-btns .btn { flex: 1 1 100%; white-space: normal; }
  .ex-box { padding: 14px; }
  .tile b { font-size: 22px; }
  .ex-btns .btn { width: 100%; }
}
