:root {
  --ink: #0e1726;
  --ink-2: #2b3645;
  --muted: #5d6878;
  --faint: #8a94a3;
  --line: #e4e7ec;
  --line-2: #eef0f3;
  --bg: #f6f7f9;
  --white: #fff;
  --brand: #0e7c5a;
  --brand-d: #0a6448;
  --brand-l: #e7f5ef;
  --brand-ll: #f3faf7;
  --csv: #16a34a;
  --pdf: #e5484d;
  --warn: #c2410c;
  --warn-l: #fff4ec;
  --r: 12px;
  --sh-1: 0 1px 2px rgba(14, 23, 38, .06);
  --sh-2: 0 1px 2px rgba(14, 23, 38, .05), 0 8px 24px rgba(14, 23, 38, .07);
  --sh-paper: 0 1px 1px rgba(14, 23, 38, .06), 0 10px 30px rgba(14, 23, 38, .12);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Noto Sans JP", "Hiragino Sans", system-ui, sans-serif;
  color: var(--ink); background: var(--bg); font-size: 14.5px; line-height: 1.65;
  -webkit-font-smoothing: antialiased; touch-action: manipulation;
  font-feature-settings: "palt" 1;
}
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { font-size: 16px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .92em; letter-spacing: -.01em; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  height: 38px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--white);
  font-weight: 700; font-size: 14px; cursor: pointer; white-space: nowrap; color: var(--ink-2);
  box-shadow: var(--sh-1); transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { background: #fafbfc; border-color: #d3d8df; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(14,124,90,.3), inset 0 1px 0 rgba(255,255,255,.12); }
.btn.primary:hover { background: var(--brand-d); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn.ghost:hover { background: rgba(14,23,38,.05); color: var(--ink); }
.btn.lg { height: 44px; padding: 0 20px; font-size: 15px; border-radius: 10px; }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.link { background: none; border: none; color: var(--brand); font-weight: 700; cursor: pointer; padding: 4px; font-size: 13.5px; }
.link:hover { text-decoration: underline; }
.icon-btn { width: 36px; height: 36px; border-radius: 9px; border: none; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: rgba(14,23,38,.06); }

.badge { display: inline-grid; place-items: center; font-size: 10.5px; font-weight: 800; letter-spacing: .04em; color: #fff; height: 20px; padding: 0 6px; border-radius: 5px; }
.badge.csv { background: var(--csv); }
.badge.pdf { background: var(--pdf); }

/* ---------- アプリバー ---------- */
.appbar { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); }
.appbar-in { max-width: 1320px; margin: 0 auto; height: 58px; padding: 0 20px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); }
.logo svg { width: 28px; height: 28px; display: block; }
.brand-name { font-weight: 800; font-size: 16.5px; letter-spacing: .02em; }
.demo-pill { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; color: var(--brand); background: var(--brand-l); padding: 2px 7px; border-radius: 99px; }
.stepper { list-style: none; display: flex; align-items: center; gap: 10px; margin: 0 auto; padding: 0; }
.stepper li[data-step] { display: flex; align-items: center; gap: 8px; color: var(--faint); font-size: 13px; font-weight: 700; }
.stepper .dot { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid #cfd5dd; display: grid; place-items: center; font-size: 11px; background: #fff; }
.stepper .dot::before { content: attr(data-n); }
.stepper li.on { color: var(--ink); }
.stepper li.on .dot { border-color: var(--brand); background: var(--brand); color: #fff; box-shadow: 0 0 0 4px var(--brand-l); }
.stepper li.done { color: var(--ink-2); }
.stepper li.done .dot { border-color: var(--brand); color: var(--brand); }
.stepper .sep { width: 36px; height: 1.5px; background: #dfe3e8; }
.appbar-actions { display: flex; gap: 6px; }
@media (max-width: 860px) { .stepper .lbl { display: none; } .stepper .sep { width: 16px; } .hide-sp { display: none; } }

main { max-width: 1120px; margin: 0 auto; padding: 0 20px 120px; }
.screen.wide { max-width: none; }
main:has(#s3:not([hidden])) { max-width: 1320px; }

/* ---------- STEP 1 ---------- */
.hero { display: grid; grid-template-columns: 1fr 1.05fr; gap: 48px; align-items: center; padding: 56px 0 40px; }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; gap: 28px; padding-top: 32px; } }
.kicker { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 700; margin: 0 0 14px; }
.kicker-arrow svg { width: 14px; height: 14px; color: var(--faint); }
.hero h1 { font-size: 40px; line-height: 1.32; letter-spacing: -.01em; margin: 0; font-weight: 800; }
.hero h1 em { white-space: nowrap; font-style: normal; color: var(--brand); background: linear-gradient(transparent 68%, #c9eedd 68%); }
@media (max-width: 600px) { .hero h1 { font-size: 29px; } }
.sub { color: var(--muted); font-size: 15.5px; margin: 16px 0 22px; max-width: 520px; }
.checks { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; }
.checks li { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
.checks svg { width: 17px; height: 17px; color: #fff; background: var(--brand); border-radius: 50%; padding: 3px; stroke-width: 3; }
@media (max-width: 600px) { .checks { grid-template-columns: 1fr; } }

.drop {
  display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 30px 24px 30px;
  border-radius: 18px; background: var(--brand-ll); border: 2px dashed #9fd6bf; cursor: pointer;
  transition: background .15s, border-color .15s, transform .15s;
}
.drop:hover { background: var(--brand-l); border-color: var(--brand); }
.drop.over { background: #dcf2e7; border-color: var(--brand); transform: scale(1.01); }
.drop-art svg { width: 100%; max-width: 380px; height: auto; display: block; }
.drop-hint { color: var(--muted); font-size: 13px; }
.sample-link { display: flex; align-items: center; gap: 6px; margin: 14px auto 0; background: none; border: none; color: var(--muted); font-size: 14px; cursor: pointer; }
.sample-link b { color: var(--brand); }
.sample-link:hover b { text-decoration: underline; }
.sample-link svg { color: #e2a400; }

.flow { display: flex; align-items: stretch; gap: 10px; padding: 26px 0 0; border-top: 1px solid var(--line); margin-top: 18px; }
.flow-step { flex: 1; display: flex; gap: 12px; align-items: flex-start; }
.flow-step b { display: block; font-size: 14.5px; }
.flow-step span:not(.flow-ic) { display: block; color: var(--muted); font-size: 13px; line-height: 1.55; }
.flow-ic { width: 40px; height: 40px; border-radius: 11px; background: #eef1f5; color: var(--ink-2); display: grid; place-items: center; flex: none; }
.flow-ic svg { width: 20px; height: 20px; }
.flow-ic.green { background: var(--brand-l); color: var(--brand); }
.flow-ic.red { background: #fdecec; color: var(--pdf); }
.flow-arrow { align-self: center; color: #c3cad3; }
@media (max-width: 760px) { .flow { flex-direction: column; } .flow-arrow { transform: rotate(90deg); margin-left: 10px; } }

/* ---------- STEP 2 ---------- */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 28px 0 16px; flex-wrap: wrap; }
.file-chip { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; box-shadow: var(--sh-1); }
.file-chip b { display: block; font-size: 14.5px; }
.file-chip span:not(.badge) { display: block; font-size: 12.5px; color: var(--muted); }
.notice { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; padding: 9px 14px; border-radius: 10px; }
.notice.ok { color: var(--brand-d); background: var(--brand-l); }
.notice.warn { color: var(--warn); background: var(--warn-l); }
.notice svg { width: 17px; height: 17px; }
.map-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sh-1); overflow: hidden; }
.map-head, .map-row { display: grid; grid-template-columns: 230px 32px minmax(180px, 280px) 1fr; align-items: center; gap: 12px; padding: 0 18px; }
.map-head { height: 40px; background: #fafbfc; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 700; color: var(--muted); }
.map-group { padding: 12px 18px 4px; font-size: 11.5px; font-weight: 800; color: var(--faint); letter-spacing: .06em; }
.map-row { min-height: 54px; border-bottom: 1px solid var(--line-2); }
.map-row:last-child { border-bottom: none; }
.map-name { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14px; }
.map-name .ic { width: 30px; height: 30px; border-radius: 8px; background: #f0f2f5; color: var(--muted); display: grid; place-items: center; flex: none; }
.map-name .ic svg { width: 16px; height: 16px; }
.map-name small { display: block; font-weight: 400; font-size: 11.5px; color: var(--faint); line-height: 1.3; }
.req { font-size: 10px; font-weight: 800; color: var(--warn); background: var(--warn-l); padding: 1px 5px; border-radius: 4px; margin-left: 4px; vertical-align: 1px; }
.map-arrow { color: #c3cad3; display: grid; place-items: center; }
.map-row.ok .map-arrow { color: var(--brand); }
.map-row.ok .map-name .ic { background: var(--brand-l); color: var(--brand); }
.map-row.miss .map-name .ic { background: var(--warn-l); color: var(--warn); }
.sel { position: relative; }
.sel select {
  width: 100%; appearance: none; -webkit-appearance: none; height: 38px; padding: 0 34px 0 12px; border-radius: 9px;
  border: 1px solid var(--line); background: #fff; font-size: 14px; font-weight: 500; cursor: pointer;
}
.sel select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-l); }
.map-row.ok .sel select { border-color: #b7e2cf; background: var(--brand-ll); }
.map-row.miss .sel select { border-color: #f5c9ad; background: var(--warn-l); }
.sel::after { content: ""; position: absolute; right: 13px; top: 50%; width: 7px; height: 7px; border-right: 1.8px solid var(--faint); border-bottom: 1.8px solid var(--faint); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.examples { display: flex; gap: 6px; overflow: hidden; }
.ex { font-size: 12.5px; color: var(--ink-2); background: #f3f5f8; border-radius: 6px; padding: 2px 8px; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.ex.none { color: var(--faint); background: none; padding: 0; }
@media (max-width: 820px) {
  .map-head { display: none; }
  .map-row { grid-template-columns: 1fr; gap: 6px; padding: 12px 16px; }
  .map-arrow { display: none; }
}
.sec { font-size: 15px; margin: 28px 0 10px; display: flex; align-items: baseline; gap: 10px; }
.sec .muted { font-size: 12.5px; font-weight: 400; }
.grid-wrap { overflow: auto; max-height: 340px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--sh-1); }
table.grid { border-collapse: separate; border-spacing: 0; font-size: 13px; white-space: nowrap; min-width: 100%; }
table.grid th { position: sticky; top: 0; background: #fafbfc; text-align: left; font-weight: 700; padding: 8px 12px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line-2); color: var(--ink-2); }
table.grid th.on { background: #e9f6f0; color: var(--brand-d); box-shadow: inset 0 -2px 0 var(--brand); }
table.grid th small { display: block; font-size: 10.5px; font-weight: 700; color: var(--brand); }
table.grid td { padding: 7px 12px; border-bottom: 1px solid var(--line-2); border-right: 1px solid var(--line-2); }
table.grid td.on { background: #f7fcfa; }
table.grid .rn { color: var(--faint); background: #fafbfc; text-align: right; font-size: 11.5px; position: sticky; left: 0; }

/* ---------- アクションバー ---------- */
.actionbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: rgba(255,255,255,.97); border-top: 1px solid var(--line); box-shadow: 0 -6px 24px rgba(14,23,38,.06); }
.actionbar-in { max-width: 1320px; margin: 0 auto; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 8px; }
.spacer { flex: 1; }
.selcount { font-size: 13.5px; color: var(--muted); margin-right: 4px; }
.selcount b { color: var(--ink); }

/* ---------- STEP 3 ---------- */
.stats { display: flex; background: #fff; border: 1px solid var(--line); border-radius: 14px; margin: 22px 0 14px; box-shadow: var(--sh-1); overflow: hidden; }
.stat { flex: 1; padding: 14px 20px; border-right: 1px solid var(--line-2); }
.stat:last-child { border-right: none; background: var(--brand-ll); }
.stat .l { font-size: 12px; color: var(--muted); font-weight: 700; display: flex; align-items: center; gap: 6px; }
.stat .l svg { width: 15px; height: 15px; }
.stat .v { font-size: 24px; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.stat:last-child .v { color: var(--brand-d); }
@media (max-width: 760px) { .stats { flex-wrap: wrap; } .stat { flex: 1 1 50%; border-bottom: 1px solid var(--line-2); } }

.work { display: grid; grid-template-columns: 340px 1fr; gap: 14px; align-items: start; }
@media (max-width: 980px) { .work { grid-template-columns: 1fr; } }
.side { background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sh-1); position: sticky; top: 72px; max-height: calc(100vh - 170px); display: flex; flex-direction: column; overflow: hidden; }
@media (max-width: 980px) { .side { position: static; max-height: 420px; } }
.side-top { padding: 12px; border-bottom: 1px solid var(--line-2); display: grid; gap: 10px; }
.search { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--faint); }
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-l); }
.search input { border: none; outline: none; flex: 1; min-width: 0; font-size: 14px; color: var(--ink); background: none; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 28px; padding: 0 10px; border-radius: 99px; border: 1px solid var(--line); background: #fff; font-size: 12.5px; font-weight: 700; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.chip span { font-weight: 500; color: var(--faint); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.on span { color: #c9cfd8; }
.selall { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--brand); cursor: pointer; margin: 0; }
.list { overflow: auto; padding: 6px; }
.item { display: grid; grid-template-columns: 20px 36px 1fr auto; gap: 10px; align-items: center; padding: 10px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.item:hover { background: #f6f8fa; }
.item.cur { background: var(--brand-ll); border-color: #bfe5d4; }
.avatar { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 15px; color: #fff; flex: none; }
.item .t b { display: block; font-size: 14px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .t span { font-size: 12px; color: var(--muted); display: flex; gap: 8px; }
.item .amt { text-align: right; font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; }
.item .amt small { display: block; font-weight: 500; font-size: 11.5px; color: var(--faint); }
.pg { font-size: 10.5px; font-weight: 800; color: var(--warn); background: var(--warn-l); padding: 0 5px; border-radius: 4px; }
.empty { padding: 30px 10px; text-align: center; color: var(--muted); font-size: 13.5px; }

.viewer { background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sh-1); overflow: hidden; min-width: 0; }
.viewer-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.vb-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.vb-title b { display: block; font-size: 15px; }
.vb-title span:not(.avatar) { display: block; font-size: 12.5px; color: var(--muted); }
.vb-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.note-edit { display: flex; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); background: #fffdf5; align-items: flex-start; }
.note-edit textarea { flex: 1; resize: vertical; border: 1px solid #ecdcae; border-radius: 9px; padding: 8px 10px; font-size: 14px; background: #fff; outline: none; }
.paper-desk { position: relative; background: #eceff3; background-image: radial-gradient(#dde2e8 1px, transparent 1px); background-size: 18px 18px; padding: 28px; min-height: 640px; }
.pages { display: grid; gap: 22px; justify-items: center; }
.page { background: #fff; box-shadow: var(--sh-paper); border-radius: 3px; width: 100%; max-width: 760px; }
.page canvas { display: block; width: 100%; height: auto; border-radius: 3px; }
.desk-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-weight: 700; background: rgba(236,239,243,.7); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid #c9d0d8; border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 600px) { .paper-desk { padding: 12px; min-height: 0; } }

/* ---------- 設定ドロワー ---------- */
.drawer-back { position: fixed; inset: 0; background: rgba(14,23,38,.28); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); background: #fff; z-index: 41; box-shadow: -10px 0 40px rgba(14,23,38,.15); transform: translateX(105%); transition: transform .22s ease; display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 18px 20px; border-bottom: 1px solid var(--line-2); }
.drawer-head b { display: block; font-size: 16px; }
.drawer-head span { font-size: 12.5px; color: var(--muted); }
.drawer-body { padding: 18px 20px 30px; overflow: auto; display: grid; gap: 16px; align-content: start; }
.field { display: grid; gap: 6px; }
.flabel { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.field input { height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; outline: none; font-size: 15px; }
.field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-l); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: flex; background: #f1f3f6; border-radius: 10px; padding: 3px; }
.seg button { flex: 1; height: 32px; border: none; background: none; border-radius: 8px; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: var(--sh-1); }
.swatches { display: flex; gap: 10px; }
.sw { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.sw.on { box-shadow: 0 0 0 2px var(--ink); }
.logo-up { display: flex; align-items: center; gap: 12px; }
.logo-prev { width: 140px; height: 54px; border: 1px dashed #cdd3db; border-radius: 9px; display: grid; place-items: center; font-size: 12px; color: var(--faint); overflow: hidden; background: #fafbfc; }
.logo-prev img { max-width: 120px; max-height: 40px; }
.logo-btns { display: grid; gap: 4px; justify-items: start; }

.toast { position: fixed; left: 50%; bottom: 86px; transform: translateX(-50%); z-index: 60; background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 8px; box-shadow: var(--sh-2); animation: tin .2s ease; }
.toast svg { color: #4ade9b; }
@keyframes tin { from { transform: translate(-50%, 8px); opacity: 0; } }
.foot { max-width: 1120px; margin: 0 auto; padding: 0 20px 100px; color: var(--faint); font-size: 12px; }
body.has-bar .foot { padding-bottom: 110px; }
.print-frame { position: fixed; right: 0; bottom: 0; width: 1px; height: 1px; border: 0; opacity: 0; pointer-events: none; }
.stepper .dot svg { width: 13px; height: 13px; stroke-width: 3; }
.btn .spinner { width: 15px; height: 15px; border-width: 2px; border-color: rgba(255,255,255,.4); border-top-color: #fff; }
.btn:not(.primary) .spinner { border-color: #d5dbe2; border-top-color: var(--brand); }

.brand-name, .selcount { white-space: nowrap; }
@media (max-width: 600px) {
  .demo-pill { display: none; }
  .appbar-in { gap: 10px; padding: 0 12px; }
  .stepper { gap: 6px; }
  .selcount { font-size: 12.5px; }
  .actionbar-in { padding-left: 12px; padding-right: 12px; gap: 6px; }
  .actionbar .btn.lg { padding: 0 14px; }
}
