/* 売上・KPIダッシュボードの体験版。色は common/base.css のトークンだけを使う */
.sd { max-width: 1240px; margin: 0 auto; padding: 20px var(--gutter) 56px; display: grid; gap: 16px; min-width: 0; }
.sd > * { min-width: 0; }
.sd h2 { font-size: var(--fs-xl); font-weight: 800; line-height: 1.4; }
.btn-big { min-height: 50px; padding: 0 26px; font-size: 16px; border-radius: 12px; }

/* ───── CSVを置く ───── */
.imp {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); grid-template-areas: "text folder" "act folder"; gap: 14px 28px; align-items: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 22px 24px; box-shadow: var(--shadow-s);
}
.imp-text { grid-area: text; }
.imp-lead { margin-top: 8px; color: var(--ink-2); line-height: 1.85; font-size: 14.5px; }
.imp-folder { grid-area: folder; background: var(--paper); border: 1.5px dashed var(--line-2); border-radius: var(--r-m); padding: 14px 16px; align-self: start; }
.folder-head { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 14px; margin-bottom: 10px; }
.folder-head .ico { color: var(--accent); }
.folder-list { list-style: none; display: grid; gap: 8px; }
.folder-list li { display: flex; align-items: center; gap: 10px; font-size: 13.5px; line-height: 1.5; min-width: 0; flex-wrap: wrap; }
.ftag { flex: none; display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-2); font-size: 12.5px; font-weight: 700; }
.ftag.new { background: var(--accent); color: #fff; padding: 0 8px; }
.fnew { background: var(--accent-soft); border-radius: 8px; padding: 7px 10px; animation: fin .5s ease-out; }
.fnew .fname { font-weight: 700; color: var(--accent-deep); overflow-wrap: anywhere; }
.fnew .frows { margin-left: auto; color: var(--ink-3); font-size: 12.5px; }
.fdup { color: var(--ink-3); font-size: 12.5px !important; }
@keyframes fin { from { opacity: 0; transform: translateY(-6px); } }
.imp-act { grid-area: act; display: grid; gap: 10px; justify-items: start; }
.imp-steps { list-style: none; display: grid; gap: 6px; width: 100%; }
.imp-steps li { position: relative; padding-left: 28px; font-size: 14px; color: var(--ink-3); line-height: 1.6; }
.imp-steps li::before { content: ""; position: absolute; left: 3px; top: 5px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); background: var(--surface); }
.imp-steps li.now { color: var(--ink); font-weight: 700; }
.imp-steps li.now::before { border-color: var(--accent); border-top-color: transparent; animation: spin .8s linear infinite; }
.imp-steps li.done { color: var(--ok); }
.imp-steps li.done::before { content: "✓"; display: grid; place-items: center; left: 2px; top: 3px; width: 17px; height: 17px; border: 0; background: var(--ok); color: #fff; font-size: 11px; font-weight: 800; line-height: 1; }
.imp-steps li.doneMsg { margin-top: 4px; padding: 9px 12px 9px 12px; border-radius: var(--r-s); background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.imp-steps li.doneMsg::before { display: none; }
.imp-steps li.doneGo { margin-top: 0; background: var(--accent-soft); color: var(--accent-deep); }
.tile { position: relative; }
.tile.changed { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow-s); animation: chg 1.6s ease-out; }
.tile.changed .label { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.chg-mark { flex: none; padding: 1px 8px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 700; line-height: 1.6; }
.dash-stamp.flash { color: var(--accent-deep); font-weight: 700; animation: chg 1.6s ease-out; }
@keyframes chg { from { background: var(--accent-soft); } }
@keyframes spin { to { transform: rotate(360deg); } }
.imp-note { font-size: 12.5px; color: var(--ink-3); line-height: 1.7; }
.imp-samples { font-size: 12.5px; color: var(--ink-2); line-height: 1.9; }
.imp-samples a { margin-right: 10px; font-weight: 600; overflow-wrap: anywhere; }
.imp-samples .hint { color: var(--ink-3); }

/* ファイルの中身を見る窓 */
.peek { position: fixed; inset: 0; z-index: 950; display: grid; place-items: center; background: rgba(22, 36, 44, .5); padding: 16px; }
.peek-box { width: min(880px, 100%); max-height: min(86vh, 640px); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-l); overflow: hidden; }
.peek-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.peek-head b { font-size: 16px; overflow-wrap: anywhere; }
.peek-x { flex: none; width: 40px; height: 40px; border-radius: 8px; font-size: 24px; line-height: 1; color: var(--ink-3); }
.peek-x:hover { background: var(--sunken); }
.peek-body { padding: 12px 18px 6px; overflow: auto; min-height: 0; }
.peek-lead { font-size: 13px; color: var(--ink-3); line-height: 1.7; margin-bottom: 8px; }
.peek-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-s); }
.peek-wrap table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.peek-wrap th { background: var(--brand-soft); color: var(--brand); text-align: left; font-weight: 700; padding: 6px 10px; white-space: nowrap; }
.peek-wrap td { padding: 5px 10px; border-top: 1px solid var(--line); white-space: nowrap; }
.peek-foot { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding: 12px 18px 14px; border-top: 1px solid var(--line); }
.peek-foot .btn { min-height: 44px; text-decoration: none; }
@media (max-width: 640px) {
  .peek { place-items: end center; padding: 0; }
  .peek-box { border-radius: var(--r-l) var(--r-l) 0 0; max-height: 88vh; }
  .peek-foot .btn { flex: 1 1 100%; }
}

/* ───── 置く前と置いた後 ───── */
.ba { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 18px 22px; box-shadow: var(--shadow-s); animation: fin .5s ease-out; }
.ba-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.ba-basis { font-size: 12.5px; color: var(--ink-3); }
.ba-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 14px; align-items: stretch; margin-top: 12px; }
.ba-arrow { align-self: center; font-size: 26px; color: var(--accent); font-weight: 700; }
.ba-col { border-radius: var(--r-m); padding: 12px 16px 14px; background: var(--paper); border: 1px solid var(--line); min-width: 0; }
.ba-col.after { background: var(--accent-soft); border-color: var(--warn-line); }
.ba-col h3 { font-size: 13.5px; font-weight: 700; color: var(--ink-2); }
.ba-col dl { margin: 6px 0 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 14px; align-items: baseline; }
.ba-col dt { font-size: 12.5px; color: var(--ink-3); }
.ba-col dd { margin: 0; text-align: right; font-weight: 700; font-size: 15px; font-feature-settings: "tnum"; }
.ba-col dd.big { font-size: 22px; }
.ba-col .unit { font-size: .6em; margin-left: 2px; color: var(--ink-2); font-weight: 600; }
.achv { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.ba-note { margin-top: 12px; font-size: 13px; color: var(--ink-2); line-height: 1.7; }

/* ───── ダッシュボード ───── */
.dash-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 4px 16px; margin-top: 6px; }
.dash-chain { color: var(--ink-3); font-size: 13.5px; }
.dash-stamp { color: var(--ink-3); font-size: 12.5px; }

.filters { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 12px 16px; box-shadow: var(--shadow-s); }
.fgrp { display: flex; align-items: center; gap: 8px; min-width: 0; }
.flbl { font-size: 12.5px; color: var(--ink-2); font-weight: 700; flex: none; }
.frow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.tilde { color: var(--ink-3); }
.sd select {
  height: 38px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--r-s); background: var(--surface); color: var(--ink); font-size: 14px; max-width: 100%;
}
#preset { width: 124px; } #from, #to { width: 184px; } #cat { width: 150px; } #prod { width: 172px; }
.fchip { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 36px; padding: 0 14px; border: 1.5px solid var(--line-2); border-radius: 999px; background: var(--surface); font-size: 13.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; transition: background .15s, color .15s, border-color .15s; }
.fchip:hover { background: var(--sunken); }
.fchip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.fchip .n { font-feature-settings: "tnum"; opacity: .85; font-weight: 700; }

.notice { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 10px 14px; border-radius: var(--r-m); background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--warn-line); font-size: 14px; }
.notice.ok { border-left-color: var(--ok); }
.notice .mk { font-weight: 800; }
.notice .n2 { color: var(--ink-2); }
.notice a { color: var(--brand-2); font-weight: 600; }

.kpis { display: grid; grid-template-columns: 1.5fr repeat(5, minmax(0, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 14px 16px; box-shadow: var(--shadow-s); min-width: 0; }
.tile .label { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.tile .value { font-size: 26px; font-weight: 800; margin-top: 2px; white-space: nowrap; line-height: 1.35; font-feature-settings: "tnum"; }
.tile.hero .value { font-size: 36px; line-height: 1.25; }
.tile .unit { font-size: .55em; font-weight: 600; margin-left: 2px; color: var(--ink-2); }
.tile .sub { font-size: 12px; color: var(--ink-2); margin-top: 4px; line-height: 1.55; }
.tile .sub + .sub { margin-top: 0; }
.up { color: var(--ok); font-weight: 700; }
.down { color: var(--bad); font-weight: 700; }
.st { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 1px 9px 1px 4px; border-radius: 999px; white-space: nowrap; }
.st i { font-style: normal; display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; font-size: 11px; color: #fff; }
.st.good { background: var(--ok-soft); color: var(--ok); } .st.good i { background: var(--ok); }
.st.warn { background: var(--warn-soft); color: var(--warn); } .st.warn i { background: var(--warn-line); color: var(--ink); }
.st.bad { background: var(--bad-soft); color: var(--bad); } .st.bad i { background: var(--bad); }
.st.na { color: var(--ink-3); font-weight: 400; padding: 0; background: none; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 16px 20px 18px; box-shadow: var(--shadow-s); min-width: 0; }
.card .head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-bottom: 10px; }
.card h2 { font-size: 17px; }
.card .note { font-size: 12.5px; color: var(--ink-3); line-height: 1.6; }
.card .tools { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; color: var(--ink-2); margin: 2px 0 6px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.key-rect { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.key-line { width: 16px; height: 0; border-top: 2px solid; display: inline-block; }
svg text { font-family: inherit; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .hit { touch-action: pan-y; }

.sd table { border-collapse: collapse; width: 100%; }
.sd th, .sd td { padding: 8px 8px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 13.5px; }
.sd th { font-size: 12px; color: var(--ink-3); font-weight: 700; white-space: nowrap; }
.sd td.num, .sd th.num { text-align: right; font-feature-settings: "tnum"; white-space: nowrap; }
.scroll-x { overflow-x: auto; }
.barcell { min-width: 160px; }
.hbar { display: flex; align-items: center; gap: 8px; }
.hbar .track { flex: 1; height: 14px; position: relative; background: var(--paper); border-radius: 0 4px 4px 0; }
.hbar .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--brand-2); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar .v { font-feature-settings: "tnum"; white-space: nowrap; min-width: 96px; text-align: right; font-weight: 600; }
.ach { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.meter { width: 84px; height: 8px; border-radius: 4px; background: var(--sunken); position: relative; overflow: hidden; display: inline-block; }
.meter > span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; }
.rank { width: 28px; color: var(--ink-3); font-feature-settings: "tnum"; }
.pname { white-space: nowrap; font-weight: 600; }
.pcat { font-size: 11px; color: var(--ink-3); margin-left: 6px; font-weight: 400; }
.seg { display: inline-flex; border: 1.5px solid var(--line-2); border-radius: var(--r-s); overflow: hidden; }
.seg button { background: var(--surface); padding: 0 12px; min-height: 32px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--brand); color: #fff; }
.stack-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; align-items: center; margin: 9px 0; }
.stack-row .nm { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.stack { display: flex; gap: 2px; height: 28px; }
.stack > div { height: 100%; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; cursor: default; min-width: 0; }
.stack > div:first-child { border-radius: 4px 0 0 4px; } .stack > div:last-child { border-radius: 0 4px 4px 0; }
.stack > div.dim { opacity: .28; }
details.tv { margin-top: 10px; }
details.tv summary { cursor: pointer; font-size: 13px; color: var(--ink-2); font-weight: 600; }
details.tv table { margin-top: 6px; }
details.tv th, details.tv td { font-size: 12.5px; }

.issue-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 8px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.scope { margin-left: auto; font-size: 13px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.scope input { width: 17px; height: 17px; accent-color: var(--brand); }
.issue-type { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 1px 9px; border-radius: 4px; background: var(--sunken); color: var(--ink-2); white-space: nowrap; }
.act-ex { color: var(--bad); font-weight: 700; white-space: nowrap; }
.act-in { color: var(--ink-2); white-space: nowrap; }
.sd td.detail { min-width: 280px; }
.sd td.src { font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.empty { color: var(--ink-3); padding: 14px 0; text-align: center; }
.checks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.check { border: 1px solid var(--line); border-radius: var(--r-m); padding: 11px 14px; background: var(--paper); }
.check .t { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.check .v { font-size: 15px; font-weight: 800; margin-top: 2px; line-height: 1.5; }
.check .f { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; line-height: 1.6; }
.ok-mark { color: var(--ok); font-weight: 800; }
.ng-mark { color: var(--bad); font-weight: 800; }
#tip { position: fixed; z-index: 1000; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); box-shadow: var(--shadow); border-radius: var(--r-s); padding: 8px 10px; font-size: 12px; min-width: 150px; display: none; }
#tip .tt { color: var(--ink-2); margin-bottom: 4px; }
#tip .row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
#tip .row .k { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.foot { font-size: 12px; color: var(--ink-3); line-height: 1.7; }

@media (max-width: 1080px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tile.hero { grid-column: span 3; }
}
@media (max-width: 900px) {
  .imp { grid-template-columns: minmax(0, 1fr); grid-template-areas: "text" "folder" "act"; padding: 18px 18px 20px; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .checks { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  /* 押せる物は高さ44px以上 */
  .sd select { height: 44px; }
  .fchip { min-height: 44px; }
  #filters .btn, .issue-tools .btn { min-height: 44px; }
  .notice a { display: inline-flex; align-items: center; min-height: 44px; }
  .seg button { min-height: 44px; padding: 0 16px; }
  details.tv summary { display: flex; align-items: center; min-height: 44px; }
  .scope { min-height: 44px; font-size: 14px; }
  .scope input { width: 22px; height: 22px; }
  .imp-samples a { display: inline-flex; align-items: center; min-height: 44px; }
  .sd { padding-top: 14px; gap: 14px; }
  .sd h2 { font-size: 19px; }
  .imp-lead { font-size: 14px; line-height: 1.8; }
  .imp-act { justify-items: stretch; }
  .imp-act .btn { width: 100%; }
  .ba { padding: 14px 14px 16px; }
  .ba-grid { grid-template-columns: minmax(0, 1fr) 20px minmax(0, 1fr); gap: 4px; }
  .ba-arrow { font-size: 20px; text-align: center; }
  .ba-col { padding: 10px 10px 12px; }
  .ba-col dl { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .ba-col dt { margin-top: 6px; }
  .ba-col dd { text-align: left; font-size: 15px; }
  .ba-col dd.big { font-size: 19px; }
  .achv { justify-content: flex-start; }
  .filters { gap: 12px; padding: 12px; }
  .fgrp { width: 100%; align-items: flex-start; flex-direction: column; gap: 4px; }
  .frow { width: 100%; }
  .frow select { flex: 1 1 0; min-width: 0; width: auto !important; }
  #preset { flex: 1 1 100% !important; }
  #from, #to { flex: 1 1 100% !important; }
  .tilde { display: none; }
  .sd select, .sd input { font-size: 16px; }
  .fchip { flex: 1 1 calc(50% - 6px); padding: 0 8px; }
  .issue-tools .fchip { flex: 0 1 auto; padding: 0 12px; }
  #filters .btn { width: 100%; }
  .notice { font-size: 13px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile.hero { grid-column: span 2; }
  .tile { padding: 12px 12px; }
  .tile .value { font-size: 22px; }
  .tile.hero .value { font-size: 30px; }
  .card { padding: 14px 14px 16px; border-radius: var(--r-m); }
  .scope { margin-left: 0; }
  .issue-tools .btn { width: 100%; }
  .stack-row { grid-template-columns: 78px minmax(0, 1fr); }

  /* 表はスマホではカードに並べ替える */
  .rt { display: block; }
  .rt thead { display: none; }
  .rt tbody { display: grid; gap: 10px; }
  .rt tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2px 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--paper); }
  .rt td { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; border: 0; padding: 3px 0; min-width: 0; white-space: normal !important; }
  .rt td::before { content: attr(data-label); font-size: 12px; color: var(--ink-3); flex: none; }
  .rt td.full { grid-column: 1 / -1; }
  .rt td.pname { font-size: 15px; }
  .rt td.barcell { min-width: 0; }
  .rt td.barcell .hbar { flex: 1; }
  .rt td.barcell::before, .rt td.pname::before, .rt-issue td::before { display: none; }
  .rt td[colspan] { grid-column: 1 / -1; }
  .rt-rank tr { grid-template-columns: 24px minmax(0, 1fr) minmax(0, 1fr); }
  .rt-rank td:nth-child(1) { grid-column: 1; }
  .rt-rank td:nth-child(2) { grid-column: 2 / 4; }
  .rt-rank td:nth-child(3) { grid-column: 1 / 4; }
  .rt-rank td:nth-child(4) { grid-column: 1 / 3; }
  .rt-rank td:nth-child(5) { grid-column: 3; }
  .rt-rank td.rank::before { display: none; }
  .rt-issue tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
  .rt-issue td { display: block; padding: 0; }
  .rt-issue td.detail { flex: 1 1 100%; min-width: 0; order: 5; font-size: 13.5px; line-height: 1.6; }
  .rt-issue td.src { flex: 1 1 100%; order: 6; }
  .rt-issue td.act-ex, .rt-issue td.act-in { order: 7; }
  .hbar .v { min-width: 0; }
  .barcell .hbar .track { min-width: 40px; }
}
