/* 入金消込の体験版。色は common/base.css のトークンだけを使う */
.pm { max-width: 1280px; margin: 0 auto; padding: 20px var(--gutter) 56px; }

/* 作業の流れ（1→2→3） */
.pm-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); }
.pm-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; }
.pm-steps button:disabled { cursor: default; opacity: .55; }
.pm-steps button:not(:disabled):hover { background: var(--sunken); color: var(--ink); }
.pm-steps .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--sunken); font-size: 13px; }
.pm-steps button[aria-current="step"] { background: var(--brand); color: #fff; }
.pm-steps button[aria-current="step"] .n { background: var(--accent); color: #fff; }
.pm-steps button.done .n { background: var(--ok-soft); color: var(--ok); }
.pm-steps-line { width: 22px; height: 2px; background: var(--line-2); flex: none; }

.scr-head { max-width: 800px; 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; }

/* 表を入れる箱 */
.box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--shadow-s); min-width: 0; overflow: hidden; }
.box-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 14px 16px 10px; }
.box-head h3 { font-size: 16px; font-weight: 800; }
.box-sub { font-size: 12.5px; color: var(--ink-3); }
.tbl-scroll { overflow: auto; max-height: 460px; border-top: 1px solid var(--line); }
.tbl { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.tbl th { position: sticky; top: 0; z-index: 1; background: var(--sunken); color: var(--ink-2); font-weight: 700; font-size: 12.5px; text-align: left; padding: 8px 12px; white-space: nowrap; border-bottom: 1px solid var(--line); }
.tbl td { padding: 8px 12px; border-top: 1px solid var(--line); vertical-align: top; }
.tbl tbody tr:first-child td { border-top: 0; }
.tbl .r { text-align: right; }
.tbl .nw { white-space: nowrap; }
.tbl .sub { display: block; font-size: 12px; color: var(--ink-3); line-height: 1.4; }
.inv-no { font-size: 12.5px; font-weight: 700; color: var(--brand-2); font-feature-settings: "tnum"; }
.kana { letter-spacing: .02em; font-feature-settings: "palt" 0; }
.bank td.kana { font-size: 14.5px; }
.bank .in { color: var(--ok); font-weight: 700; }
.bank .out { color: var(--ink-3); }
.bank tr.wob td { background: var(--warn-soft); }
.bank tr.wd td { background: var(--sunken); color: var(--ink-3); }
.pm-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.legend { margin-top: 12px; font-size: 12.5px; color: var(--ink-3); line-height: 1.7; }

.run-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);
}
.run-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; }

/* 照合している間 */
.running { position: fixed; inset: 0; z-index: 1050; display: grid; place-items: center; background: rgba(22, 36, 44, .45); padding: 16px; }
.running-card { width: min(380px, 100%); background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-l); padding: 22px 24px 20px; text-align: center; }
.running-title { font-weight: 800; font-size: 17px; }
.running-line { margin-top: 14px; min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 14px; }
.running-line .kana { color: var(--ink-2); font-size: 13.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.running-line .arrow { color: var(--accent); line-height: 1; font-size: 13px; }
.running-line b { color: var(--brand); }
.running-bar { height: 6px; border-radius: 3px; background: var(--sunken); margin-top: 12px; overflow: hidden; }
.running-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .08s linear; }
.running-count { margin-top: 6px; font-size: 13px; color: var(--ink-2); }
.running-note { margin-top: 8px; font-size: 12px; color: var(--ink-3); line-height: 1.6; }

/* 2. 照合の結果 */
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left; padding: 12px 14px; border-radius: var(--r-m); background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--line-2); box-shadow: var(--shadow-s); transition: box-shadow .15s, transform .15s; }
.tile:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.tile .tl { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.tile b { font-size: 30px; line-height: 1.2; font-weight: 800; }
.tile b small { font-size: 14px; font-weight: 700; margin-left: 2px; }
.tile .ta { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.tile .th { font-size: 12px; color: var(--ink-3); line-height: 1.4; margin-top: 2px; }
.tile.ok { border-top-color: var(--ok); } .tile.ok b { color: var(--ok); }
.tile.warn { border-top-color: var(--warn-line); } .tile.warn b { color: var(--warn); }
.tile.accent { border-top-color: var(--accent); } .tile.accent b { color: var(--accent-deep); }
.tile.bad { border-top-color: var(--bad); } .tile.bad b { color: var(--bad); }
.tile.none b { color: var(--ink-3); }

.ribbon { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; padding: 12px 16px; border-radius: var(--r-m); border: 1px solid; }
.ribbon.ok { background: var(--ok-soft); border-color: #b7d6c4; color: var(--ok); }
.ribbon.ng { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }
.rb-mark { width: 28px; height: 28px; border-radius: 50%; background: var(--ok); display: grid; place-items: center; flex: none; }
.ribbon.ng .rb-mark { background: var(--bad); }
.rb-mark .ico { width: 17px; height: 17px; stroke: #fff; stroke-width: 2.6; }
.rb-text { display: grid; line-height: 1.5; flex: 1; min-width: 200px; }
.rb-text b { font-size: 15px; }
.rb-text small { font-size: 12.5px; color: var(--ink-2); }
.rb-pend { display: flex; align-items: center; gap: 10px; color: var(--bad); font-weight: 700; font-size: 13.5px; flex-wrap: wrap; }

.tabs { display: flex; gap: 4px; margin-top: 20px; padding: 4px; background: var(--sunken); border-radius: var(--r-m); width: fit-content; max-width: 100%; }
.tabs button { padding: 8px 16px; border-radius: var(--r-s); font-size: 14px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-s); }
.tabs button:not([aria-selected="true"]):hover { color: var(--ink); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 12px; }
.fchip { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line-2); background: var(--surface); font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.fchip .num { font-size: 12px; background: var(--sunken); border-radius: 999px; padding: 0 7px; line-height: 20px; }
.fchip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.fchip[aria-pressed="true"] .num { background: rgba(255, 255, 255, .2); color: #fff; }

/* 入金の1件ずつ */
.res-list { display: grid; gap: 8px; }
.res { background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--line-2); border-radius: var(--r-m); box-shadow: var(--shadow-s); overflow: hidden; }
.res.k-ok { border-left-color: var(--ok); }
.res.k-over { border-left-color: var(--accent); }
.res.k-pend { border-left-color: var(--bad); }
.res.flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: var(--accent-soft); } }
.res-head { display: grid; grid-template-columns: 76px minmax(0, 1.7fr) 124px minmax(0, 1fr) 20px; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; }
.res-head:hover { background: var(--paper); }
.res-head small { display: block; font-size: 12px; color: var(--ink-3); line-height: 1.45; }
.c-id b { font-size: 14px; }
.c-payer { min-width: 0; display: grid; gap: 1px; }
.c-payer .kana { font-weight: 700; font-size: 14.5px; overflow-wrap: anywhere; }
.c-amt { font-weight: 800; font-size: 15px; text-align: right; white-space: nowrap; }
.c-res { display: grid; gap: 3px; justify-items: start; min-width: 0; }
.unk { color: var(--bad); }
.chev { color: var(--ink-3); transition: transform .15s; }
.res-head[aria-expanded="true"] .chev { transform: rotate(180deg); }
.res-body { padding: 4px 16px 16px; border-top: 1px dashed var(--line); background: var(--paper); }
.body-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px 24px; padding-top: 12px; }
.body-grid h4, .pend h4 { font-size: 12.5px; font-weight: 800; color: var(--ink-3); letter-spacing: .04em; margin-bottom: 4px; }
.why p { line-height: 1.8; font-size: 14px; }
.rawread { margin: 10px 0 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; font-size: 12.5px; }
.rawread dt { color: var(--ink-3); }
.rawread dd { margin: 0; overflow-wrap: anywhere; }
.allocs { list-style: none; display: grid; gap: 6px; }
.allocs li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 10px; align-items: baseline; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-s); font-size: 13px; }
.allocs li > span:nth-child(2) { min-width: 0; color: var(--ink-2); }
.allocs .num { font-weight: 700; text-align: right; }
.allocs .fee { display: block; font-weight: 600; font-size: 11.5px; color: var(--accent-deep); }
.excess { margin-top: 8px; font-weight: 700; color: var(--accent-deep); font-size: 13.5px; }
.muted { color: var(--ink-3); font-size: 13.5px; }
.pend { margin-top: 14px; padding: 14px; border-radius: var(--r-m); background: var(--bad-soft); border: 1px solid var(--bad-line); }
.pend h4 { color: var(--bad); font-size: 13.5px; }
.pend p { font-size: 13px; line-height: 1.75; color: var(--ink-2); }
.cands { display: grid; gap: 8px; margin-top: 10px; }
.cand-btn { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; padding: 10px 12px; border-radius: var(--r-m); background: var(--surface); border: 1.5px solid var(--line-2); transition: border-color .15s, box-shadow .15s; }
.cand-btn:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cb-main { display: grid; gap: 1px; min-width: 0; font-size: 13.5px; }
.cb-main small { font-size: 12.5px; color: var(--ink-3); overflow-wrap: anywhere; }
.cb-go { flex: none; padding: 6px 12px; border-radius: var(--r-s); background: var(--accent); color: #fff; font-weight: 700; font-size: 13px; white-space: nowrap; }
.cand-btn.both .cb-go { background: var(--brand); }
.undo { margin-top: 12px; }
.wd-note { margin-top: 12px; font-size: 12.5px; color: var(--ink-3); }

/* 未入金・取引先ごとの残高 */
.pane-head { margin: 18px 0 10px; }
.pane-head h3 { font-size: 18px; font-weight: 800; }
.pane-head p { margin-top: 2px; font-size: 13.5px; color: var(--ink-2); }
.tbl-scroll:has(.card-tbl) { max-height: none; }
.card-tbl td.rel { font-size: 12.5px; color: var(--ink-2); min-width: 160px; }
.card-tbl td .days { display: block; font-size: 12px; color: var(--bad); font-weight: 700; margin-top: 2px; }
.card-tbl td.bad { color: var(--bad); font-weight: 700; }
.card-tbl tr.sum td { font-weight: 800; background: var(--paper); border-top: 2px solid var(--line-2); }

/* 3. Excelにまとめる */
.ex-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 20px; box-shadow: var(--shadow-s); }
.ex-box h3 { font-size: 17px; font-weight: 800; }
.ex-note { margin-top: 4px; font-size: 13px; color: var(--ink-2); line-height: 1.7; }
.checks { display: grid; gap: 8px; margin-top: 14px; }
.check { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; align-items: center; gap: 8px 16px; padding: 10px 14px; border-radius: var(--r-m); background: var(--paper); border: 1px solid var(--line); }
.check.ng { background: var(--bad-soft); border-color: var(--bad-line); }
.ck-name { font-size: 14px; }
.ck-eq { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.ck-side { display: grid; min-width: 0; line-height: 1.4; }
.ck-side small { font-size: 12px; color: var(--ink-3); }
.ck-side i { font-style: normal; font-weight: 800; font-size: 15px; }
.ck-eq em { font-style: normal; font-weight: 800; color: var(--ok); }
.ex-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.sheets { margin-top: 24px; }
.sheets h3 { font-size: 16px; font-weight: 800; }
.sheet-list { list-style: none; margin-top: 10px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sheet-list li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 0 10px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); font-size: 12.5px; color: var(--ink-2); line-height: 1.55; }
.sheet-list .sn { grid-row: 1 / 3; width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); font-weight: 800; font-size: 12px; }
.sheet-list b { font-size: 13.5px; color: var(--ink); }

@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sheet-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .pm-two { grid-template-columns: minmax(0, 1fr); }
  .body-grid { grid-template-columns: minmax(0, 1fr); }
  .check { grid-template-columns: minmax(0, 1fr) auto; }
  .ck-eq { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 640px) {
  .pm { padding-top: 14px; }
  .pm-steps { gap: 2px; padding: 4px; width: 100%; }
  .pm-steps button { flex: 1; justify-content: center; padding: 8px 6px; font-size: 13px; }
  .pm-steps .n { display: none; }
  .pm-steps-line { display: none; }
  .scr-head h2 { font-size: 20px; }
  .tbl-scroll { max-height: 340px; }
  .hide-sp { display: none; }
  .tbl th, .tbl td { padding: 7px 9px; }
  .run-foot { flex-direction: column; align-items: stretch; gap: 8px; padding-top: 10px; }
  .run-note { font-size: 12px; }
  .run-foot .btn { width: 100%; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile { padding: 10px 12px; }
  .tile b { font-size: 26px; }
  .tabs { width: 100%; overflow-x: auto; }
  .tabs { gap: 2px; padding: 3px; }
  .tabs button { padding: 8px 2px; font-size: 12px; flex: 1; }
  .ck-eq { flex-direction: column; align-items: flex-start; gap: 2px; }
  .ck-eq em { line-height: 1; }
  .res-head { grid-template-columns: minmax(0, 1fr) auto 18px; grid-template-areas: "id amt chev" "payer payer chev" "res res res"; gap: 4px 10px; padding: 11px 12px; }
  .c-id { grid-area: id; display: flex; gap: 8px; align-items: baseline; }
  .c-id small { display: inline; }
  .c-amt { grid-area: amt; }
  .c-payer { grid-area: payer; }
  .c-res { grid-area: res; display: flex; align-items: center; gap: 8px; }
  .res-head .chev { grid-area: chev; align-self: start; margin-top: 3px; }
  .res-body { padding: 2px 12px 14px; }
  .cand-btn { flex-direction: column; align-items: stretch; }
  .cb-go { text-align: center; }
  .ex-box { padding: 16px; }
  .ex-btns .btn { width: 100%; }
  .sheet-list { grid-template-columns: minmax(0, 1fr); }
  /* 表を、1行ずつのカードにする */
  .card-tbl thead { display: none; }
  .card-tbl, .card-tbl tbody, .card-tbl tr, .card-tbl td { display: block; width: 100%; }
  .card-tbl tr { padding: 10px 12px; border-top: 1px solid var(--line); }
  .card-tbl tbody tr:first-child { border-top: 0; }
  .card-tbl td { border: 0; padding: 2px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .card-tbl td::before { content: attr(data-l); color: var(--ink-3); font-size: 12px; text-align: left; flex: none; }
  .card-tbl td[colspan] { display: none; }
  .card-tbl td.rel { min-width: 0; }
  .card-tbl td.rel:empty { display: none; }
  .card-tbl tr.sum td:first-child { display: block; text-align: left; }
  .card-tbl tr.sum td:first-child::before { content: none; }
}

.rel-none { color: var(--ink-3); }
.rel-note { margin-top: 10px; font-size: 12.5px; color: var(--ink-3); line-height: 1.75; }
.cand-btn.both .cb-main small { color: var(--warn-ink, var(--ink-2)); }
