:root {
  --bg: #f6f5f1; --panel: #ffffff; --ink: #1f2328; --sub: #636c76; --line: #e3e1da;
  --accent: #1f6f5c; --accent-ink: #fff; --warn: #b4540a; --bad: #b42318; --ok: #1a7f37; --chip: #efede6;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.6 "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif; }
header { background: #18332c; color: #fff; padding: 0 20px; display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
header .brand { font-weight: 700; letter-spacing: .05em; padding: 14px 0; }
header nav a { color: #cfe3dc; text-decoration: none; padding: 14px 10px; display: inline-block; }
header nav a.on, header nav a:hover { color: #fff; box-shadow: inset 0 -3px 0 #7fd1b9; }
main { max-width: 1280px; margin: 0 auto; padding: 20px; }
h1 { font-size: 20px; margin: 4px 0 16px; }
h2 { font-size: 16px; margin: 0 0 10px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; text-decoration: none; color: inherit; display: block; }
.stat .n { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--sub); font-size: 12px; }
.stat.warn .n { color: var(--warn); } .stat.bad .n { color: var(--bad); } .stat.ok .n { color: var(--ok); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { white-space: nowrap; background: #faf9f6; font-weight: 600; color: var(--sub); position: sticky; top: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.scroll { overflow: auto; max-height: 70vh; border: 1px solid var(--line); border-radius: 6px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: var(--chip); white-space: nowrap; }
.tag.一致 { background: #dcf3e3; color: var(--ok); }
.tag.不一致 { background: #fde2df; color: var(--bad); }
.tag.memo, .tag.メモで集計（営業所未確認） { background: #e3f0f8; color: #3d6f91; }
.tag.営業所未登録, .tag.照会待ち { background: #fff1d6; color: var(--warn); }
.flag { color: var(--bad); font-size: 12px; display: block; }
.muted { color: var(--sub); font-size: 12px; }
button, .btn { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 6px; padding: 7px 14px;
  font: inherit; cursor: pointer; text-decoration: none; display: inline-block; }
button.sub, .btn.sub { background: #fff; color: var(--ink); border: 1px solid var(--line); }
button.danger { background: var(--bad); }
input, select, textarea { font: inherit; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
input[type=number] { width: 90px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.flash { background: #e8f4ef; border: 1px solid #b9dccd; padding: 8px 12px; border-radius: 6px; margin-bottom: 8px; }
.bar { height: 8px; background: var(--chip); border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }
pre { white-space: pre-wrap; background: #faf9f6; border: 1px solid var(--line); padding: 10px; border-radius: 6px; max-height: 420px; overflow: auto; font-size: 12px; }
.prod { max-width: 340px; }
@media (max-width: 700px) { main { padding: 12px; } header nav a { padding: 10px 6px; } }

/* 行の色分け */
tr.dup td { background: #fdecea; }
tr.dup td:first-child { box-shadow: inset 4px 0 0 #b42318; }
tr.eye td { background: #f1eafc; }
tr.eye td:first-child { box-shadow: inset 4px 0 0 #6e40c9; }
tr.mismatch td { background: #fff4e0; }
tr.mismatch td:first-child { box-shadow: inset 4px 0 0 #b4540a; }
tr.memo td { background: #f2f8fc; }
tr.memo td:first-child { box-shadow: inset 4px 0 0 #9cc3dd; }
tr.approved td { background: #eaf6ee; }
tr.approved td:first-child { box-shadow: inset 4px 0 0 #1a7f37; }
tr.excluded td { background: #f1f1f1; color: #8a8f96; }
tr.excluded td.num { text-decoration: line-through; }
tr.orig td { background: #eef4fb; }
tr.orig td:first-child { box-shadow: inset 4px 0 0 #2f6fb3; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--sub); }
.legend span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -2px; }
.legend .l-dup::before { background: #fdecea; border-left: 4px solid #b42318; }
.legend .l-eye::before { background: #f1eafc; border-left: 4px solid #6e40c9; }
.legend .l-mismatch::before { background: #fff4e0; border-left: 4px solid #b4540a; }
.legend .l-memo::before { background: #f2f8fc; border-left: 4px solid #9cc3dd; }
.legend .l-approved::before { background: #eaf6ee; border-left: 4px solid #1a7f37; }
.legend .l-excluded::before { background: #f1f1f1; border-left: 4px solid #8a8f96; }
.legend .l-orig::before { background: #eef4fb; border-left: 4px solid #2f6fb3; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.dup { background: #b42318; color: #fff; }
.badge.eye { background: #6e40c9; color: #fff; }
.badge.ok { background: #1a7f37; color: #fff; }
.badge.ex { background: #8a8f96; color: #fff; }
.badge.orig { background: #2f6fb3; color: #fff; }
.memo-split { color: #6e40c9; font-weight: 600; font-size: 12px; display: block; }
button.ok { background: #1a7f37; }
button.small, .btn.small { padding: 3px 10px; font-size: 12px; }
.stat.purple .n { color: #6e40c9; }
.big-money { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs a { padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); text-decoration: none; font-size: 13px; }
.tabs a.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.tabs a .cnt { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 8px; background: #b42318; color: #fff; font-size: 11px; }
.group { border: 1px solid #f3c4bf; border-radius: 8px; margin-bottom: 14px; overflow: hidden; background: #fff; }
.group.done { border-color: var(--line); }
.group-head { padding: 10px 14px; background: #fff7f6; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }
.group.done .group-head { background: #fafaf8; }
.hist { display: flex; align-items: flex-end; gap: 3px; height: 28px; }
.hist i { display: block; width: 10px; background: #9cc9bb; border-radius: 2px 2px 0 0; }
a.name { font-weight: 700; color: var(--ink); }

/* チーム */
.teamsel { display: flex; align-items: center; gap: 6px; color: #cfe3dc; font-size: 12px; }
.teamsel select { background: #24463d; color: #fff; border-color: #3b6458; font-weight: 700; }
.teambar { background: #e7f1ed; border: 1px solid #c6ddd4; border-radius: 6px; padding: 6px 12px; margin-bottom: 12px; font-size: 13px; }
.kind-box { display: flex; gap: 16px; flex-wrap: wrap; margin: 6px 0 10px; }
.kind-box label { border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; background: #fff; cursor: pointer; }
.kind-box input:checked + span { font-weight: 700; color: var(--accent); }
tr.sure td { background: #fdecea; }
tr.sure td:first-child { box-shadow: inset 4px 0 0 #b42318; }
tr.maybe td { background: #fff4e0; }
tr.maybe td:first-child { box-shadow: inset 4px 0 0 #b4540a; }
tr.isdouble td { background: #fbe0dc; }
tr.isdouble td:first-child { box-shadow: inset 4px 0 0 #7a1810; }
tr.isok td { background: #eaf6ee; color: #5b6b60; }
.status { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.status.s0 { background: #efede6; } .status.s1 { background: #fff1d6; color: #8a4a0a; } .status.s2 { background: #dcf3e3; color: #1a7f37; }

/* 請求明細（印刷） */
.sheet { background: #fff; max-width: 820px; margin: 0 auto; padding: 40px 48px; border: 1px solid var(--line); }
.sheet h1 { text-align: center; font-size: 22px; letter-spacing: .2em; margin-bottom: 24px; }
.sheet .to { font-size: 18px; border-bottom: 1px solid #333; display: inline-block; padding: 0 40px 4px 0; }
.sheet .total { font-size: 22px; font-weight: 700; border: 2px solid #333; display: inline-block; padding: 8px 18px; margin: 16px 0; }
.sheet table th { position: static; }
@media print {
  .noprint { display: none !important; }
  body { background: #fff; }
  main { padding: 0; max-width: none; }
  .sheet { border: 0; padding: 0; max-width: none; }
}
header nav a .cnt { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 8px; background: #b42318; color: #fff; font-size: 11px; }
header .who { margin-left: auto; display: flex; align-items: center; gap: 10px; color: #cfe3dc; font-size: 12px; }
header .who a { color: #cfe3dc; }
.login-box { max-width: 380px; margin: 60px auto; }
.login-box label { display: block; margin: 12px 0 4px; font-weight: 600; }
.login-box input[type=text], .login-box input[type=password] { width: 100%; box-sizing: border-box; padding: 8px; font-size: 16px; }
.error { background: #fdecea; border: 1px solid #f5c2bc; color: #b42318; padding: 8px 12px; border-radius: 6px; margin: 10px 0; }
.secret { font-family: ui-monospace, monospace; font-size: 20px; background: #fff; border: 2px dashed #1a7f37; padding: 8px 12px; display: inline-block; }
tr.waiting td { background: #fff8e1; }
tr.waiting td:first-child { box-shadow: inset 4px 0 0 #c99a06; }
.badge.wait { background: #c99a06; color: #fff; }
.legend .l-waiting::before { background: #fff8e1; border-left: 4px solid #c99a06; }
