/* 月次レポートの体験版。色は common/base.css のトークンだけを使う */
.mr { max-width: 1240px; margin: 0 auto; padding: 20px var(--gutter) 56px; }

/* 作業の流れ（1→2→3） */
.mr-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); }
.mr-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; }
.mr-steps button:disabled { cursor: default; opacity: .55; }
.mr-steps button:not(:disabled):hover { background: var(--sunken); color: var(--ink); }
.mr-steps .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--sunken); font-size: 13px; }
.mr-steps button[aria-current="step"] { background: var(--brand); color: #fff; }
.mr-steps button[aria-current="step"] .n { background: var(--accent); color: #fff; }
.mr-steps button.done .n { background: var(--ok-soft); color: var(--ok); }
.mr-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; }
.note { margin-top: 8px; font-size: 12.5px; color: var(--ink-3); line-height: 1.7; }
.num { font-feature-settings: "tnum"; }
.r { text-align: right; }
.muted { color: var(--ink-3); }
.up { color: var(--ok); }
.down { color: var(--bad); }

/* 1. ファイルを見る */
.store-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.scard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 16px; box-shadow: var(--shadow-s); min-width: 0; display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }
.scard-l { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.raw-wrap { min-width: 0; }
.raw-cap { font-size: 12.5px; font-weight: 700; color: var(--ink-3); margin-bottom: 6px; }
.raw-note { font-size: 11.5px; color: var(--ink-3); margin-top: 5px; }
.scard-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.scard-h h3 { font-size: 18px; font-weight: 800; line-height: 1.3; }
.scard-sub { display: flex; align-items: center; gap: 5px; margin-top: 3px; font-size: 12.5px; color: var(--ink-3); flex-wrap: wrap; }
.scard-sub .ico { width: 15px; height: 15px; }
.scard-sub .nw { white-space: nowrap; }
.scard-sub .nw + .nw { margin-left: 6px; }
.scard-file { display: grid; gap: 4px; font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.scard-file select, .cmp-file select, .rep-sel select {
  width: 100%; min-width: 0; height: 40px; padding: 0 32px 0 10px; border: 1px solid var(--line-2); border-radius: var(--r-s); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2366747d' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center / 16px;
  color: var(--ink); font-size: 14px; appearance: none; -webkit-appearance: none; text-overflow: ellipsis;
}
.raw-box { border: 1px solid var(--line); border-radius: var(--r-m); background: var(--paper); overflow-x: auto; scrollbar-width: thin; }
.raw-table { border-collapse: collapse; font-size: 12.5px; white-space: nowrap; min-width: 100%; }
.raw-table th { position: sticky; top: 0; background: var(--sunken); color: var(--ink-2); font-weight: 700; text-align: left; padding: 6px 9px; border-bottom: 1px solid var(--line-2); }
.raw-table td { padding: 5px 9px; border-top: 1px solid var(--line); }
.raw-table .rn { color: var(--ink-3); text-align: right; font-size: 11.5px; background: var(--sunken); }
.raw-table tr.foot td { background: var(--sunken); color: var(--ink-2); font-weight: 700; }
.raw-table .hl, .cmp-table .chg { background: var(--warn-soft); }
.raw-table .bad, .cmp-table td.bad { background: var(--bad-soft); color: var(--bad); font-weight: 700; }
.diffs { list-style: none; display: grid; gap: 6px; font-size: 13.5px; color: var(--ink-2); line-height: 1.6; }
.diffs li { position: relative; padding-left: 16px; }
.diffs li::before { content: ""; position: absolute; left: 3px; top: .62em; width: 7px; height: 7px; border-radius: 50%; background: var(--warn-line); }
.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; }
.pick-note-m { display: none; }
.btn-big { min-height: 50px; padding: 0 26px; font-size: 16px; border-radius: 12px; }

/* 取り込み中 */
.run { max-width: 620px; margin: 24px auto 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 24px; box-shadow: var(--shadow-s); }
.run h2 { font-size: 20px; font-weight: 800; }
.run-bar { height: 8px; border-radius: 4px; background: var(--sunken); margin-top: 14px; overflow: hidden; }
.run-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .12s linear; }
.run-count { margin-top: 6px; font-size: 13px; color: var(--ink-2); }
.run-steps { list-style: none; margin-top: 16px; display: grid; gap: 8px; }
.run-steps li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-3); }
.run-steps .dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--sunken); font-size: 12px; font-weight: 700; flex: none; }
.run-steps .dot .ico { width: 14px; height: 14px; stroke-width: 2.6; }
.run-steps li.now { color: var(--ink); font-weight: 700; }
.run-steps li.now .dot { background: var(--accent); color: #fff; }
.run-steps li.done { color: var(--ink-2); }
.run-steps li.done .dot { background: var(--ok-soft); color: var(--ok); }
.run.failed { border-color: var(--bad-line); }

/* 2. そろえて確かめる */
.cmp-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 16px; box-shadow: var(--shadow-s); }
.cmp-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--sunken); border-radius: 999px; max-width: 100%; }
.seg button { padding: 7px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 700; color: var(--ink-3); white-space: nowrap; }
.seg button[aria-selected="true"] { background: var(--brand); color: #fff; }
.seg button:not([aria-selected="true"]):hover { background: var(--line); color: var(--ink); }
.cmp-file { display: grid; gap: 4px; font-size: 12.5px; color: var(--ink-3); font-weight: 600; min-width: min(100%, 320px); }
.cmp-enc { margin: 12px 0 8px; font-size: 13px; color: var(--ink-2); }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); }
.table-wrap.tall { max-height: 380px; overflow-y: auto; }
.table-wrap.flat { border: 0; background: none; }
.cmp-table, .small-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.cmp-table th, .small-table th { background: var(--brand); color: #fff; font-weight: 700; text-align: left; padding: 7px 10px; white-space: nowrap; position: sticky; top: 0; }
.cmp-table th.r, .small-table th.r { text-align: right; }
.cmp-table td, .small-table td { padding: 7px 10px; border-top: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
.cmp-table td.r, .small-table td.r { text-align: right; }
.cmp-table .rn { color: var(--ink-3); text-align: right; font-size: 12px; }
.cmp-table small { display: block; margin-top: 1px; font-size: 11px; font-weight: 600; color: var(--accent-deep); }
.cmp-table td.bad small { color: var(--bad); }
.cmp-table tr.foot td { background: var(--sunken); color: var(--ink-2); white-space: normal; }
.cmp-table tr.r-bad td { background: var(--bad-soft); }
.cmp-table tr.r-warn td { background: var(--warn-soft); }
.small-table tr.r-bad td { background: var(--warn-soft); }
.map { margin-top: 14px; }
.map summary, .files-det summary { cursor: pointer; font-weight: 700; font-size: 14px; color: var(--brand-2); padding: 6px 0; }
.map .table-wrap { margin-top: 8px; }
.files-det { margin-top: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 10px 16px 16px; }
.files-det .table-wrap { margin-top: 8px; }

.chk-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; align-items: start; }
.chk-box, .rev-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 16px; box-shadow: var(--shadow-s); min-width: 0; }
.chk-box h3, .rev-box h3 { font-size: 17px; font-weight: 800; line-height: 1.5; }
.chk-list { list-style: none; margin-top: 10px; }
.chk-list li { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: 2px 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.chk-list .k { color: var(--ink-2); }
.chk-list .v { text-align: right; font-weight: 700; }
.chk-list .j { grid-column: 1 / -1; display: flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; justify-content: flex-end; text-align: right; }
.chk-list .j:empty { display: none; }
.chk-list li.ok .j { color: var(--ok); }
.chk-list li.warn .j { color: var(--bad); }
.chk-list li.warn .v { color: var(--bad); }
.chk-list .ico { width: 15px; height: 15px; stroke-width: 2.4; }
.chk-all { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 10px 12px; border-radius: var(--r-m); font-weight: 800; font-size: 14.5px; }
.chk-all.ok { background: var(--ok-soft); color: var(--ok); }
.chk-all.warn { background: var(--bad-soft); color: var(--bad); }
.rv { padding: 12px 0; border-top: 1px solid var(--line); display: grid; gap: 6px; justify-items: start; }
.rv:first-child { margin-top: 8px; }
.rv-h { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: 13.5px; word-break: break-all; }
.rv-h span { color: var(--ink-3); font-size: 12.5px; }
.rv-why { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.rv-act { font-size: 12.5px; color: var(--ink-2); }
.rv-raw { font-size: 12px; color: var(--ink-3); line-height: 1.6; word-break: break-all; background: var(--paper); border-radius: var(--r-s); padding: 6px 8px; width: 100%; }
.planted { margin-top: 12px; font-size: 12.5px; color: var(--ink-2); line-height: 1.8; padding: 10px 12px; background: var(--accent-soft); border-radius: var(--r-m); }

/* 3. 月次レポート */
.rep-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.rep-brand { font-size: 13px; font-weight: 700; color: var(--accent-deep); }
.rep-title h2 { font-size: 26px; font-weight: 800; line-height: 1.35; }
.rep-month { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.rep-sel { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; color: var(--ink-2); }
.rep-sel select { width: 180px; font-weight: 700; background-color: var(--warn-soft); border-color: var(--warn-line); }
.rep-showing { font-size: 14px; font-weight: 700; }
.rep-lead { max-width: 820px; font-size: 14px; }
.rep-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.add-note { max-width: 820px; padding: 8px 12px; background: var(--accent-soft); border-radius: var(--r-s); color: var(--accent-deep); }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 14px 16px; box-shadow: var(--shadow-s); min-width: 0; }
.kpi-l { font-size: 12.5px; color: var(--ink-3); font-weight: 700; }
.kpi-v { display: block; font-size: 28px; line-height: 1.25; font-weight: 800; margin: 2px 0 8px; letter-spacing: -.01em; }
.kpi-r { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: baseline; font-size: 13px; color: var(--ink-2); padding: 1px 0; }
.kpi-r .up, .kpi-r .down { font-weight: 700; text-align: right; }
.kpi-r .muted { text-align: right; }
.dlt { color: var(--ink-3); font-size: 12.5px; text-align: right; min-width: 5.2em; }
.sec-h { font-size: 17px; font-weight: 800; margin: 28px 0 10px; padding-left: 10px; border-left: 4px solid var(--brand); line-height: 1.4; }
.rtable { width: 100%; border-collapse: collapse; font-size: 13.5px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; }
.rtable th { background: var(--brand); color: #fff; font-weight: 700; padding: 8px 10px; text-align: left; white-space: nowrap; font-size: 13px; }
.rtable th.r { text-align: right; }
.rtable td { padding: 8px 10px; border-top: 1px solid var(--line); white-space: nowrap; }
.rtable td.r { text-align: right; }
.rtable tr.total td { font-weight: 800; background: var(--sunken); border-top: 2px solid var(--line-2); }
.rt-name { font-weight: 700; }
.sdot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: -1px; }
.sdot.s0 { background: var(--c3); } .sdot.s1 { background: var(--c1); } .sdot.s2 { background: var(--accent); }
.rtable .chip .ico { width: 13px; height: 13px; stroke-width: 2.6; }
.shr { display: inline-flex; align-items: center; gap: 8px; min-width: 130px; }
.bar { display: inline-block; width: 64px; height: 9px; border-radius: 3px; background: var(--sunken); overflow: hidden; flex: none; }
.bar i { display: block; height: 100%; background: var(--c3); border-radius: 3px; }
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 14px 14px 8px; box-shadow: var(--shadow-s); min-width: 0; margin: 0; }
.chart-card figcaption { font-size: 14.5px; font-weight: 800; text-align: center; margin-bottom: 6px; }
.chart-card svg { width: 100%; height: auto; }
.strip { margin-top: 26px; padding: 14px 16px; border-radius: var(--r-m); border: 1px solid var(--line); background: var(--surface); display: grid; gap: 4px; font-size: 13.5px; color: var(--ink-2); justify-items: start; }
.strip.warn { border-color: var(--bad-line); }
.strip-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 15px; }
.strip-h .ico { width: 18px; height: 18px; stroke-width: 2.4; }
.strip.ok .strip-h { color: var(--ok); }
.strip.warn .strip-h { color: var(--bad); }
.strip-state { font-weight: 800; margin-left: 6px; }
.strip .btn { margin-top: 8px; }

@media (max-width: 1100px) {
  .scard { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chk-grid { grid-template-columns: minmax(0, 1fr); }
  .charts { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .rtable-wide { min-width: 0; }
}
@media (max-width: 640px) {
  .mr { padding-top: 14px; }
  .mr-steps { gap: 2px; padding: 4px; width: 100%; justify-content: space-between; margin-bottom: 18px; }
  .mr-steps button { flex-direction: column; gap: 2px; padding: 5px 4px; font-size: 11.5px; flex: 1; border-radius: 14px; }
  .mr-steps-line { width: 10px; }
  .scr-head h2 { font-size: 20px; }
  .scr-lead { font-size: 14px; line-height: 1.8; }
  .scard { padding: 14px; }
  .scard-file select, .cmp-file select, .rep-sel select { font-size: 16px; height: 44px; }
  .pick-foot { flex-direction: column; align-items: stretch; gap: 8px; padding-top: 10px; }
  .pick-note { display: none; }
  .pick-note-m { display: block; margin-top: 14px; font-size: 12px; color: var(--ink-3); line-height: 1.7; }
  .pick-foot { margin-top: 12px; }
  .btn-big { width: 100%; }
  .run { padding: 18px; margin-top: 8px; }
  .cmp-box, .chk-box, .rev-box { padding: 12px; border-radius: var(--r-m); }
  .seg { display: flex; width: 100%; }
  .seg button { flex: 1; padding: 8px 4px; font-size: 13px; min-width: 0; }
  .cmp-file { min-width: 0; width: 100%; }
  .chk-list li { grid-template-columns: minmax(0, 1fr); }
  .chk-list .v { text-align: left; }
  .chk-list .j { justify-content: flex-start; text-align: left; }
  .rep-title h2 { font-size: 21px; }
  .rep-month { width: 100%; justify-content: space-between; }
  .rep-sel { flex: 1; }
  .rep-sel select { width: 100%; flex: 1; }
  .rep-showing { width: 100%; font-size: 13px; }
  .rep-actions .btn { width: 100%; }
  .kpis { gap: 8px; }
  .kpi { padding: 11px 12px; }
  .kpi-v { font-size: 22px; }
  .kpi-r { grid-template-columns: auto 1fr; font-size: 12px; }
  .kpi-r .dlt { grid-column: 1 / -1; text-align: right; min-width: 0; margin-top: -2px; }
  /* 表は、1行ずつのカードにする */
  .rtable { border: 0; background: none; display: block; }
  .rtable thead { display: none; }
  .rtable tbody { display: grid; gap: 10px; }
  .rtable tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); box-shadow: var(--shadow-s); }
  .rtable td { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; border: 0; padding: 0; text-align: left; white-space: normal; font-size: 14px; }
  .rtable td.r { text-align: left; }
  .rtable td::before { content: attr(data-label); font-size: 11px; font-weight: 600; color: var(--ink-3); }
  .rtable td.rt-name { grid-column: 1 / -1; flex-direction: row; align-items: center; font-size: 16px; }
  .rtable td.rt-name::before { content: none; }
  .rtable td:empty { display: none; }
  .rtable tr.total { background: var(--sunken); border-color: var(--line-2); }
  .rtable tr.total td { background: none; border: 0; }
  .shr { min-width: 0; }
  .chart-card { padding: 12px 8px 6px; }
}

/* スマホで表が右に切れるとき：「左右に動かせます」の合図と、切れている側の影 */
.scroll-hint { display: none; margin: 0 0 6px; font-size: 12.5px; font-weight: 700; color: var(--accent-deep); }
@media (max-width: 640px) {
  .scroll-hint:not([hidden]) { display: block; }
  .table-wrap {
    background:
      linear-gradient(to right, var(--surface) 30%, rgba(255, 255, 255, 0)) 0 0 / 28px 100% no-repeat local,
      linear-gradient(to left, var(--surface) 30%, rgba(255, 255, 255, 0)) 100% 0 / 28px 100% no-repeat local,
      linear-gradient(to right, rgba(23, 57, 74, .22), rgba(23, 57, 74, 0)) 0 0 / 12px 100% no-repeat scroll,
      linear-gradient(to left, rgba(23, 57, 74, .22), rgba(23, 57, 74, 0)) 100% 0 / 12px 100% no-repeat scroll;
    background-color: var(--surface);
  }
  .table-wrap.flat {
    background-color: transparent;
    background-image:
      linear-gradient(to right, var(--paper) 30%, rgba(246, 244, 238, 0)), linear-gradient(to left, var(--paper) 30%, rgba(246, 244, 238, 0)),
      linear-gradient(to right, rgba(23, 57, 74, .22), rgba(23, 57, 74, 0)), linear-gradient(to left, rgba(23, 57, 74, .22), rgba(23, 57, 74, 0));
    background-position: 0 0, 100% 0, 0 0, 100% 0; background-size: 28px 100%, 28px 100%, 12px 100%, 12px 100%; background-repeat: no-repeat;
    background-attachment: local, local, scroll, scroll;
  }
}
