:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #1f2933;
  --muted: #6b7280;
  --line: #e2e6ea;
  --primary: #2563eb;
  --primary-ink: #ffffff;
  --warn-bg: #fff7ed;
  --warn-ink: #9a3412;
  --ok: #047857;
  --err-bg: #fef2f2;
  --err-ink: #b91c1c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
}

.topbar {
  background: #111827;
  color: #fff;
}
.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar h1 { font-size: 18px; margin: 0; }

.container { max-width: 1280px; margin: 0 auto; padding: 16px; }

.steps {
  display: flex;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 8px 0 16px;
  counter-reset: step;
}
.steps li {
  flex: 1;
  text-align: center;
  padding: 8px;
  border-radius: 8px;
  background: #e5e7eb;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.steps li.active { background: var(--primary); color: #fff; }
.steps li.done { background: #c7d2fe; color: #1e3a8a; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.card h2 { margin-top: 0; font-size: 17px; }

label { display: block; font-weight: 600; font-size: 14px; margin: 10px 0; }
label.checkbox { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
input[type=text], input[type=password], input[type=number], input[type=date], select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
  margin-top: 4px;
  background: #fff;
}
label.checkbox input { width: auto; margin: 0; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.range { border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px 14px; margin: 14px 0; }
.range legend { font-weight: 600; font-size: 13px; color: var(--muted); padding: 0 6px; }

.row { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

button {
  padding: 9px 16px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
button:hover { background: #f3f4f6; }
button.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
button.primary:hover { background: #1d4ed8; }
button:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { background: transparent; color: #fff; border-color: #374151; }
.icon-btn:hover { background: #1f2937; }

.muted { color: var(--muted); font-size: 13px; }
small.muted { display: block; font-weight: 400; margin-top: 2px; }

.banner {
  padding: 10px 14px;
  border-radius: 8px;
  background: #eef2ff;
  color: #1e3a8a;
  font-weight: 600;
  margin: 8px 0;
}
.banner.error { background: var(--err-bg); color: var(--err-ink); }

.notice { padding: 10px 14px; border-radius: 8px; margin: 10px 0; font-weight: 600; }
.notice.warn { background: var(--warn-bg); color: var(--warn-ink); }
.notice.ok { background: #ecfdf5; color: var(--ok); }

.status { font-size: 13px; font-weight: 600; }
.status.ok { color: var(--ok); }
.status.err { color: var(--err-ink); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; table-layout: fixed; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: normal; word-break: break-word; vertical-align: top; }
th { background: #f9fafb; font-size: 12px; color: var(--muted); }
td .amount { font-variant-numeric: tabular-nums; font-weight: 600; }
.placeholder-cell { color: var(--muted); font-style: italic; font-weight: 400; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: #e5e7eb; color: #374151; }

.annot { color: var(--warn-ink); background: var(--warn-bg); padding: 8px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; margin: 8px 0; }

/* 表内の入力コントロール */
td select, td input[type="text"], td input[type="number"], td input[type="date"] {
  margin-top: 0;
  padding: 6px 8px;
  font-size: 13px;
  width: 100%;
  box-sizing: border-box;
}
td input.cell-amount { text-align: right; font-variant-numeric: tabular-nums; }
td.kamoku-desc { font-size: 11px; color: var(--muted); white-space: normal; max-width: 220px; }
.row-ok { color: var(--ok); font-weight: 700; }
.row-err { color: var(--err-ink); font-weight: 700; }
tr.done-row { background: #f0fdf4; }
tr.err-row { background: #fef2f2; }

.foot { text-align: center; padding: 24px 16px; }
.hidden { display: none !important; }
