/* 管理画面ロボットの体験版。色は common/base.css のトークンだけを使う */
.br { max-width: 1280px; margin: 0 auto; padding: 20px var(--gutter) 56px; }

/* 作業の流れ（1→2→3） */
.br-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); }
.br-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; }
.br-steps button:disabled { cursor: default; opacity: .55; }
.br-steps button:not(:disabled):hover { background: var(--sunken); color: var(--ink); }
.br-steps .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--sunken); font-size: 13px; }
.br-steps button[aria-current="step"] { background: var(--brand); color: #fff; }
.br-steps button[aria-current="step"] .n { background: var(--accent); color: #fff; }
.br-steps button.done .n { background: var(--ok-soft); color: var(--ok); }
.br-steps-line { width: 22px; height: 2px; background: var(--line-2); flex: none; }

.scr-head { max-width: 780px; 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; }
.btn-big { min-height: 50px; padding: 0 26px; font-size: 16px; border-radius: 12px; }

/* ───── 1. 条件を決める ───── */
.state-note { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; padding: 10px 14px; border-radius: var(--r-m); background: var(--brand-soft); color: var(--brand); font-size: 13.5px; font-weight: 600; line-height: 1.6; }
.cond-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.cond-col { display: grid; gap: 14px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 16px 18px 18px; box-shadow: var(--shadow-s); min-width: 0; }
.card h3 { font-size: 16px; font-weight: 800; }
.card-note { margin-top: 3px; font-size: 12.5px; color: var(--ink-3); line-height: 1.7; }
.sub-note { margin-top: 14px; font-weight: 600; color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tg {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px 0 10px; border-radius: 999px; border: 1.5px solid var(--line-2);
  background: var(--surface); color: var(--ink-3); font-size: 14.5px; font-weight: 600; transition: background .15s, border-color .15s, color .15s;
}
.tg:hover { background: var(--sunken); }
.tg .tick { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-2); background: var(--surface); display: grid; place-items: center; flex: none; }
.tg[aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand-2); color: var(--brand); }
.tg[aria-pressed="true"] .tick { background: var(--brand); border-color: var(--brand); }
.tg[aria-pressed="true"] .tick::after { content: ""; width: 9px; height: 5px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translate(1px, -1px); }
.tg.wide { margin-top: 12px; }
.add-form { display: flex; gap: 8px; margin-top: 12px; }
.add-form input { flex: 1; min-width: 0; height: 38px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--surface); font-size: 16px; }
.price-row { display: flex; align-items: flex-end; gap: 10px; margin-top: 12px; }
.price-row label { flex: 1; min-width: 0; display: grid; gap: 4px; font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.price-row input { width: 100%; min-width: 0; height: 42px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--surface); font-size: 16px; font-feature-settings: "tnum"; }
.price-row .tilde { padding-bottom: 10px; color: var(--ink-3); }

.mode-card { margin-top: 14px; }
.modes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.mode { display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 12px 12px 13px; border-radius: var(--r-m); border: 1.5px solid var(--line); background: var(--surface); transition: border-color .15s, background .15s; }
.mode:hover { border-color: var(--line-2); background: var(--paper); }
.mode .radio { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-2); flex: none; margin-top: 2px; display: grid; place-items: center; }
.mode .mt { display: grid; gap: 3px; min-width: 0; }
.mode .mt b { font-size: 14.5px; font-weight: 800; color: var(--ink); }
.mode .mt span { font-size: 12.5px; color: var(--ink-3); line-height: 1.65; }
.mode[aria-checked="true"] { border-color: var(--brand-2); background: var(--brand-soft); box-shadow: 0 0 0 2px var(--brand-soft); }
.mode[aria-checked="true"] .radio { border-color: var(--brand); }
.mode[aria-checked="true"] .radio::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.mode[aria-checked="true"] .mt span { color: var(--ink-2); }

.preview { margin-top: 14px; padding: 16px 20px 18px; border-radius: var(--r-l); background: var(--brand); color: var(--on-brand); box-shadow: var(--shadow); }
.pv-head { font-size: 12.5px; font-weight: 700; color: var(--on-brand-2); letter-spacing: .06em; }
.pv-main { margin-top: 4px; font-size: 19px; font-weight: 700; line-height: 1.7; color: #fff; }
.pv-main b { font-size: 28px; font-weight: 800; margin: 0 1px; }
.pv-sub { margin-top: 2px; font-size: 13.5px; color: var(--on-brand); }
.pv-why { margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 12.5px; color: var(--on-brand-2); }
.pv-why > span:first-child { margin-right: 4px; }
.cond-foot {
  position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; margin: 18px calc(var(--gutter) * -1) 0; padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
  background: rgba(246, 244, 238, .94); backdrop-filter: blur(6px); border-top: 1px solid var(--line);
}

/* ───── 2. ロボットを動かす ───── */
.run-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 20px; margin-bottom: 14px; }
.tally { display: grid; grid-template-columns: repeat(4, minmax(104px, 1fr)); gap: 8px; flex: 1 1 440px; }
.run-top .tile { display: flex; align-items: baseline; gap: 8px; padding: 6px 14px; }
.run-top .tile b { font-size: 22px; }
.tile { padding: 10px 14px; border-radius: var(--r-m); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-s); }
.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.bad b { color: var(--bad); } .tile.brand b { color: var(--brand-2); } .tile.skip b { color: var(--ink-2); } .tile.fail b { color: var(--bad); } .tile.none b { color: var(--ink-3); }
.tile.bump b { animation: bump .5s ease-out; }
@keyframes bump { 0% { transform: scale(1.35); transform-origin: left; } 100% { transform: scale(1); } }
.ctrl { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.run-state { margin-left: 4px; height: 28px; font-size: 13px; }
.seg { display: inline-flex; border: 1.5px solid var(--line-2); border-radius: var(--r-m); overflow: hidden; background: var(--surface); }
.seg button { min-height: 40px; padding: 0 13px; font-size: 13.5px; font-weight: 600; color: var(--ink-3); border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--brand); color: #fff; }

.run-grid { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.win { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-l); overflow: hidden; box-shadow: var(--shadow); min-width: 0; }
.win-bar { display: flex; align-items: center; gap: 6px; padding: 9px 12px; background: var(--sunken); border-bottom: 1px solid var(--line); }
.win-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); }
.win-url { margin-left: 8px; flex: 1; min-width: 0; padding: 3px 12px; border-radius: 999px; background: var(--surface); font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.robot-cap { display: flex; align-items: center; gap: 10px; padding: 9px 14px; background: var(--accent-soft); color: var(--accent-deep); font-size: 13.5px; font-weight: 700; line-height: 1.5; border-bottom: 1px solid var(--line); min-height: 42px; }
.robot-cap .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex: none; animation: blink 1.2s ease-in-out infinite; }
.robot-cap[data-k="done"] { background: var(--ok-soft); color: var(--ok); }
.robot-cap[data-k="done"] .dot { background: var(--ok); animation: none; }
.robot-cap[data-k="stop"] { background: var(--bad-soft); color: var(--bad); }
.robot-cap[data-k="stop"] .dot { background: var(--bad); animation: none; }
.robot-cap[data-k="idle"] .dot { animation: none; opacity: .4; }
@keyframes blink { 50% { opacity: .35; } }

/* 架空の管理画面 */
.admin { position: relative; min-height: 560px; background: var(--paper); }
.a-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--brand-2); color: #fff; }
.a-logo { font-weight: 800; font-size: 15px; }
.a-logo span { font-weight: 400; font-size: 12.5px; margin-left: 8px; opacity: .85; }
.a-user { font-size: 12.5px; opacity: .9; }
.a-login { padding: 28px 16px; }
.login-card { max-width: 320px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 16px 18px 18px; display: grid; gap: 10px; }
.login-card b { font-size: 17px; }
.login-card label { display: grid; gap: 3px; font-size: 12.5px; color: var(--ink-3); }
.login-card input, .a-bar input { height: 36px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--surface); font-size: 16px; pointer-events: none; min-width: 0; }
.a-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: 0 14px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; user-select: none; }
.a-btn.primary { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.a-btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.a-btn.pulse, .pg.pulse { animation: press .9s ease-in-out infinite; }
@keyframes press { 0%, 100% { box-shadow: 0 0 0 0 rgba(194, 106, 23, .0); } 50% { box-shadow: 0 0 0 5px rgba(194, 106, 23, .38); } }
.a-app { padding: 12px 14px 14px; }
.a-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); }
.a-bar label { font-size: 13px; color: var(--ink-2); font-weight: 600; flex: none; }
.a-bar input { flex: 1; }
.a-alert { margin-top: 10px; padding: 8px 12px; border-radius: var(--r-s); font-size: 13px; font-weight: 600; line-height: 1.55; }
.a-alert.err { background: var(--bad-soft); color: var(--bad); border: 1px solid var(--bad-line); }
.a-alert.ok { background: var(--ok-soft); color: var(--ok); }
.a-result { margin-top: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; }
.a-rhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; font-size: 13.5px; font-weight: 700; border-bottom: 1px solid var(--line); }
.arow { display: grid; grid-template-columns: 24px 52px minmax(0, 1fr) 88px 60px 62px 68px; align-items: center; column-gap: 8px; padding: 5px 12px; font-size: 13px; border-bottom: 1px solid var(--line); transition: background .25s; }
.arow:last-child { border-bottom: 0; }
.arow.ahead { background: var(--sunken); font-size: 12px; font-weight: 700; color: var(--ink-3); padding-top: 6px; padding-bottom: 6px; }
.arow .r { text-align: right; }
.arow.reserved { background: var(--ok-soft); }
.arow.cur { background: var(--accent-soft); }
.arow:not(.ahead) .cb { grid-column: 1; grid-row: 1; } .arow .c-meta { display: contents; }
.arow:not(.ahead) > .c-name, .arow:not(.ahead) > .c-st, .arow .c-meta > span { grid-row: 1; }
.arow .c-id { grid-column: 2; color: var(--ink-3); font-size: 12px; }
.arow .c-name { grid-column: 3; } .arow .c-brand { grid-column: 4; } .arow .c-price { grid-column: 5; } .arow .c-stock { grid-column: 6; } .arow .c-st { grid-column: 7; }
.arow .c-name { min-width: 0; line-height: 1.45; }
.arow .c-brand { color: var(--ink-2); font-size: 12.5px; }
.arow .c-price, .arow .c-stock { text-align: right; white-space: nowrap; }
.arow .sl { display: none; font-style: normal; }
.cb { width: 18px; height: 18px; border-radius: 4px; border: 1.5px solid var(--line-2); background: var(--surface); display: grid; place-items: center; transition: background .2s, border-color .2s; }
.cb.on { background: var(--brand-2); border-color: var(--brand-2); }
.cb.on::after { content: ""; width: 9px; height: 5px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translate(1px, -1px); }
.st { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.st.opn { background: var(--sunken); color: var(--ink-3); }
.st.rsv { background: var(--ok); color: #fff; }
.rnote { display: inline-block; margin-top: 3px; padding: 0 8px; border-radius: 4px; font-size: 11.5px; font-weight: 700; line-height: 1.7; animation: note-in .3s ease-out; }
.rnote.bad { background: var(--bad-soft); color: var(--bad); }
.rnote.ok { background: var(--ok-soft); color: var(--ok); }
.rnote.brand { background: var(--brand-soft); color: var(--brand-2); }
@keyframes note-in { from { opacity: 0; transform: translateY(-3px); } }
.a-pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 8px 12px; font-size: 13px; border-top: 1px solid var(--line); color: var(--ink-2); }
.a-pager .pg { padding: 4px 10px; border-radius: 6px; color: var(--brand-2); font-weight: 600; }
.a-pager .pg.off { color: var(--line-2); }
.a-note { padding: 0 12px 10px; font-size: 12px; color: var(--ink-3); }
.a-loading { position: absolute; left: 50%; top: 96px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 13px; z-index: 3; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.a-modal { position: absolute; inset: 0; z-index: 4; display: grid; place-items: start center; background: rgba(22, 36, 44, .42); padding: 110px 16px 16px; }
.modal-box { width: min(330px, 100%); background: var(--surface); border-radius: var(--r-m); padding: 16px 18px 14px; box-shadow: var(--shadow-l); display: grid; gap: 8px; }
.modal-box b { font-size: 16px; }
.modal-box p { font-size: 14px; line-height: 1.7; }
.modal-act { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

.side { display: grid; gap: 12px; min-width: 0; position: sticky; top: 12px; }
.prog { display: flex; flex-wrap: wrap; gap: 8px; }
.pk { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; background: var(--surface); border: 1.5px solid var(--line); color: var(--ink-3); font-size: 13px; font-weight: 700; }
.pk.now { border-color: var(--accent); color: var(--accent-deep); background: var(--accent-soft); }
.pk.done { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.logbox { height: 440px; overflow-y: auto; background: var(--ink); border-radius: var(--r-l); padding: 8px 6px; box-shadow: var(--shadow-s); scrollbar-width: thin; }
.logbox ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.logbox li { display: grid; grid-template-columns: 62px auto minmax(0, 1fr); column-gap: 6px; padding: 4px 8px; border-radius: 6px; font-size: 12.5px; line-height: 1.6; color: #d6e1e6; }
.logbox li.new { animation: log-in .35s ease-out; }
@keyframes log-in { from { opacity: 0; transform: translateX(-6px); } }
.logbox li time { color: #8ea4af; }
.logbox li .lvl:empty { display: none; }
.logbox li:has(.lvl:empty) { grid-template-columns: 62px minmax(0, 1fr); }
.logbox li .lvl { font-weight: 800; }
.logbox li.lv-WARNING { background: rgba(227, 191, 98, .16); color: #f6d58a; }
.logbox li.lv-ERROR { background: rgba(226, 160, 146, .18); color: #f4b9ac; }
.logbox li .tx { overflow-wrap: anywhere; }

/* ───── 3. 結果を受け取る ───── */
.res-empty { padding: 48px 20px; text-align: center; color: var(--ink-3); background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--r-l); }
.banner { display: grid; gap: 4px; padding: 14px 18px; border-radius: var(--r-l); line-height: 1.75; font-size: 14px; }
.banner b { font-size: 16px; }
.banner.ok { background: var(--ok-soft); color: var(--ok); }
.banner.brand { background: var(--brand-soft); color: var(--brand); }
.banner.bad { background: var(--bad-soft); color: var(--bad); border: 1px solid var(--bad-line); }
.banner.bad span { color: var(--ink); }
#resTiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 190px)); gap: 10px; margin-top: 14px; }
.callout { margin-top: 14px; padding: 11px 14px; border-radius: var(--r-m); background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn-line); font-size: 13.5px; font-weight: 600; line-height: 1.75; }
.ex-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.notify { margin-top: 14px; padding: 12px 16px; border-radius: var(--r-m); background: var(--surface); border: 1px solid var(--line); font-size: 13.5px; line-height: 1.7; }
.notify p { margin-top: 3px; color: var(--ink-2); }
.notify .sm { font-size: 12.5px; color: var(--ink-3); }
.preview-t { margin-top: 24px; }
.preview-t h3 { font-size: 16px; font-weight: 800; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.filters .tg { min-height: 34px; padding: 0 12px; font-size: 13.5px; }
.table-wrap { margin-top: 10px; overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); max-height: 520px; overflow-y: auto; }
.table-wrap table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.table-wrap th { position: sticky; top: 0; background: var(--brand); 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; }
.table-wrap td.nw { white-space: nowrap; }
.table-wrap td.name { min-width: 230px; }
.table-wrap td.why { min-width: 240px; }
.table-wrap td.r { text-align: right; }
.table-wrap td.empty { text-align: center; color: var(--ink-3); padding: 24px; }

@media (max-width: 900px) {
  .cond-grid { grid-template-columns: minmax(0, 1fr); }
  .modes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .run-grid { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; }
  .logbox { height: 320px; }
}
@media (max-width: 640px) {
  .br { padding-top: 14px; }
  .br-steps { gap: 2px; padding: 4px; width: 100%; justify-content: space-between; margin-bottom: 18px; }
  .br-steps button { flex-direction: column; gap: 2px; padding: 5px 4px; font-size: 11.5px; flex: 1; border-radius: 14px; }
  .br-steps-line { width: 10px; }
  .scr-head h2 { font-size: 20px; }
  .scr-lead { font-size: 14px; line-height: 1.8; }
  .card { padding: 14px 14px 16px; }
  .modes { grid-template-columns: minmax(0, 1fr); }
  .preview { padding: 14px 16px 16px; }
  .pv-main { font-size: 16px; }
  .pv-main b { font-size: 24px; }
  .cond-foot .btn-big { width: 100%; }
  .tally { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; flex-basis: 100%; }
  .run-top .tile { display: block; padding: 7px 8px 7px 10px; }
  .run-top .tile b { font-size: 20px; }
  .tile span { font-size: 11px; white-space: nowrap; }
  .ctrl { gap: 8px; }
  .ctrl > .btn { flex: 1 1 auto; min-width: 0; padding: 0 10px; }
  .seg { order: 3; width: 100%; }
  .seg button { flex: 1; }
  .run-state { display: none; }
  .admin { min-height: 640px; }
  .a-rhead { flex-direction: column; align-items: stretch; }
  .a-rhead .a-btn { width: 100%; }
  .arow.ahead { display: none; }
  .arow { grid-template-columns: 26px minmax(0, 1fr) auto; grid-template-areas: "cb name st" "cb meta meta"; row-gap: 3px; column-gap: 10px; padding: 8px 10px; align-items: start; }
  .arow:not(.ahead) .cb { grid-area: cb; margin-top: 2px; }
  .arow .c-name { grid-area: name; }
  .arow .c-st { grid-area: st; justify-self: end; }
  .arow .c-meta { display: flex; grid-area: meta; flex-wrap: wrap; gap: 0 12px; }
  .arow .c-id, .arow .c-brand, .arow .c-price, .arow .c-stock { font-size: 11.5px; color: var(--ink-3); text-align: left; }
  .arow .c-stock .sl { display: inline; }
  .a-app { padding: 10px 10px 12px; }
  .a-loading { top: 120px; }
  .logbox { height: 300px; }
  .logbox li { grid-template-columns: 54px auto minmax(0, 1fr); font-size: 12px; }
  .logbox li:has(.lvl:empty) { grid-template-columns: 54px minmax(0, 1fr); }
  #resTiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ex-btns .btn { width: 100%; }
  .banner { padding: 12px 14px; }
}
