:root {
  --navy: #12324a; --navy-2: #1d4a6b; --teal: #0e7c86; --teal-soft: #e0f2f3;
  --ink: #1f2933; --muted: #5f6b76; --line: #d9e0e6; --bg: #f3f6f8; --card: #ffffff;
  --ok: #15803d; --ok-soft: #e6f4ea; --warn: #b45309; --warn-soft: #fdf1e0; --bad: #b91c1c; --bad-soft: #fde8e8;
  --queued: #cbd5df; --running: #f59e0b; --done: #16a34a; --error: #dc2626;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 14px rgba(16,24,40,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Noto Sans JP", "Yu Gothic UI", "Hiragino Sans", "Segoe UI", sans-serif; font-size: 14px; line-height: 1.6; }
h1 { font-size: 22px; margin: 0 0 4px; font-weight: 700; letter-spacing: .01em; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 700; color: var(--navy); }
h2.mt { margin-top: 22px; }
p { margin: 0 0 10px; }
b { font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: "Consolas", "SFMono-Regular", Menlo, monospace; }
main { max-width: 1440px; margin: 0 auto; padding: 22px 24px 40px; }

/* top bar */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 24px; background: var(--navy); color: #fff; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 40px; height: 40px; border-radius: 9px; background: #fff; color: var(--navy); display: grid; place-items: center; font-weight: 700; font-size: 15px; letter-spacing: .02em; }
.brand-title { font-weight: 700; font-size: 17px; }
.brand-sub { font-size: 12px; opacity: .85; }
.brand-client { font-size: 12px; opacity: .9; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.tag { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 999px; vertical-align: middle; font-weight: 500; }
.tag-proto { background: #f59e0b; color: #1f2933; }
.status { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: rgba(255,255,255,.12); }
.status-ok { background: rgba(22,163,74,.35); }
.status-bad { background: rgba(220,38,38,.45); }

/* home */
.hero { margin: 4px 0 18px; max-width: 980px; }
.hero p { color: #34404b; }
.home-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.dropzone { border: 2px dashed #9fb3c4; border-radius: var(--radius); padding: 26px; text-align: center; color: #34404b; cursor: pointer; transition: .15s; background: #fbfdff; }
.dropzone:hover, .dropzone.drag { border-color: var(--teal); background: var(--teal-soft); }
.dz-icon { font-size: 30px; line-height: 1; color: var(--teal); margin-bottom: 6px; }
.or { text-align: center; color: var(--muted); margin: 16px 0 10px; font-size: 12px; }
.samples { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.sample { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: #fff; display: flex; flex-direction: column; gap: 6px; }
.sample-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sample-name { font-weight: 700; color: var(--navy); }
.sample-desc { font-size: 12px; color: var(--muted); min-height: 36px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: #eef2f5; color: #34404b; border: 1px solid #e1e7ec; }
.chip-easy { background: var(--ok-soft); color: var(--ok); border-color: #cfe9d6; }
.chip-mid { background: #fff7e6; color: #92400e; border-color: #fde3b3; }
.chip-hard { background: var(--bad-soft); color: var(--bad); border-color: #f5c2c2; }
.sample-actions { display: flex; gap: 8px; margin-top: 4px; }
.btn { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 8px; padding: 8px 14px; font: inherit; font-size: 13px; cursor: pointer; transition: .12s; }
.btn:hover { border-color: #9fb3c4; background: #f7fafc; }
.btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 700; }
.btn-primary:hover { background: #0b6a73; }
.btn-ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: default; }
.file-btn { display: inline-block; }
.file-btn span { display: inline-block; border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; cursor: pointer; background: #fff; font-size: 13px; }
.file-btn span:hover { border-color: #9fb3c4; }
.steps { padding-left: 20px; margin: 0; color: #34404b; }
.steps li { margin-bottom: 6px; }

/* run */
.run-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 10px; }
.run-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.progress { height: 8px; background: #e3e9ee; border-radius: 999px; overflow: hidden; margin: 8px 0 16px; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--teal), #3fb6bf); transition: width .4s; }
.run-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; align-items: start; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-bottom: 10px; flex-wrap: wrap; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -2px; }
.sw-queued { background: var(--queued); } .sw-running { background: var(--running); } .sw-done { background: var(--done); } .sw-error { background: var(--error); }
.pages { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-start; }
.page-wrap { position: relative; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #fff; }
.page-wrap img { display: block; }
.page-label { position: absolute; top: 6px; left: 6px; font-size: 11px; background: rgba(18,50,74,.85); color: #fff; padding: 1px 7px; border-radius: 999px; }
.band { position: absolute; border: 1.5px solid; border-radius: 3px; opacity: .85; transition: .2s; }
.band.queued { border-color: var(--queued); background: rgba(203,213,223,.15); }
.band.running { border-color: var(--running); background: rgba(245,158,11,.18); animation: pulse 1.2s infinite; }
.band.done { border-color: var(--done); background: rgba(22,163,74,.10); }
.band.error { border-color: var(--error); background: rgba(220,38,38,.18); }
.band .bl { position: absolute; left: 2px; top: 1px; font-size: 10px; color: #1f2933; background: rgba(255,255,255,.85); padding: 0 4px; border-radius: 3px; white-space: nowrap; }
@keyframes pulse { 0%,100% { opacity: .85; } 50% { opacity: .45; } }
.log { font-family: "Consolas", Menlo, monospace; font-size: 12px; background: #0f1b26; color: #d5e2ee; border-radius: 8px; padding: 12px; height: 520px; overflow: auto; white-space: pre-wrap; }
.log .t { color: #7fb1d3; }

/* result */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 6px 0 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.kpi .k { font-size: 11px; color: var(--muted); }
.kpi .v { font-size: 20px; font-weight: 700; color: var(--navy); }
.kpi .v small { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 3px; }
.kpi.warn .v { color: var(--warn); }
.kpi.ok .v { color: var(--ok); }
.result-grid { display: grid; grid-template-columns: 420px 1fr; gap: 18px; align-items: start; }
.viewer-card { position: sticky; top: 16px; }
.viewer { max-height: calc(100vh - 140px); overflow: auto; border: 1px solid var(--line); border-radius: 6px; background: #eef2f5; padding: 8px; }
.viewer .page-wrap { margin: 0 auto 10px; }
.marker { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid #e11d48; box-shadow: 0 0 0 2px rgba(225,29,72,.25); }
.marker::after { content: attr(data-label); position: absolute; right: 4px; top: -18px; font-size: 11px; background: #e11d48; color: #fff; padding: 0 6px; border-radius: 3px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { border: 0; background: transparent; padding: 8px 12px; font: inherit; font-size: 13px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--navy); font-weight: 700; border-bottom-color: var(--teal); }
table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
th, td { border-bottom: 1px solid #e6ebf0; padding: 5px 8px; text-align: left; vertical-align: top; white-space: nowrap; }
th { background: #f5f8fa; color: #34404b; font-weight: 700; position: sticky; top: 0; z-index: 1; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.wrap { white-space: normal; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f3f9fa; }
tr.sel td { background: #e0f2f3 !important; }
.tbl-scroll { max-height: 560px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
.badge { display: inline-block; font-size: 11px; padding: 0 7px; border-radius: 999px; font-weight: 500; }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-bad { background: var(--bad-soft); color: var(--bad); }
.b-ref { background: #eef2f5; color: #34404b; }
.b-gray { background: #eef2f5; color: var(--muted); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.excel-box { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.excel-box .hd { background: #f5f8fa; padding: 6px 10px; font-weight: 700; font-size: 12.5px; color: #34404b; border-bottom: 1px solid var(--line); }
.yellow { background: #fff9c4 !important; }
.note { background: var(--teal-soft); border-left: 3px solid var(--teal); padding: 8px 12px; border-radius: 4px; margin: 8px 0 12px; font-size: 12.5px; }
.note.warn { background: var(--warn-soft); border-left-color: var(--warn); }
.summary-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 12px; }
.summary-chips .chip { font-size: 12px; padding: 3px 10px; }
.error-banner { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--bad); color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow); max-width: 800px; z-index: 50; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 16px; }
details summary { cursor: pointer; color: var(--navy); font-weight: 500; }
pre.json { background: #0f1b26; color: #d5e2ee; padding: 10px; border-radius: 6px; font-size: 11px; max-height: 400px; overflow: auto; }
.abs { font-size: 11px; color: var(--muted); }
.reason { font-size: 11px; color: var(--muted); }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 3px 10px; font-size: 12.5px; margin-bottom: 12px; }
.kv .k { color: var(--muted); }
@media (max-width: 1100px) {
  .home-grid, .run-grid, .result-grid, .two-col { grid-template-columns: 1fr; }
  .viewer-card { position: static; }
}
