:root {
  --err: #b42318; --err-bg: #fef0ee; --err-bd: #f5c2bb;
  --warn: #8a5700; --warn-bg: #fff6dc; --warn-bd: #efd88a;
  --ok: #17663a; --ok-bg: #e8f6ee; --ok-bd: #b3dfc4;
  --info: #475569; --info-bg: #eef2f6; --info-bd: #d3dbe5;
  --accent: #2563eb; --accent-dk: #1d4ed8; --accent-bg: #eaf1ff;
  --text: #1e293b; --text-2: #475569; --text-3: #64748b;
  --bg: #f3f5f9; --surface: #fff; --line: #e2e8f0; --line-2: #cbd5e1;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font-family: "Noto Sans JP", "Yu Gothic UI", "Meiryo UI", sans-serif; font-size: 14px; line-height: 1.6; }
.topbar { display: flex; gap: 16px; align-items: baseline; padding: 12px 24px; background: var(--surface);
  border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.userbar { margin-left: auto; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.userbar form { margin: 0; }
.container { max-width: 1120px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 22px; margin: 4px 0 12px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.muted { color: var(--text-3); font-weight: 400; }
.mono { font-family: "Cascadia Mono", Consolas, monospace; font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.panel, .card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px;
  margin-bottom: 16px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.card { border-left: 5px solid #b7c2cf; }
.card.tone-err { border-left-color: var(--err); }
.card.tone-warn { border-left-color: #e5c45c; }
.card.tone-ok { border-left-color: #6cc08c; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card-head h2 { margin: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }
.panel-head .row { margin-top: 0; }
.card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 4px; background: var(--info-bg); color: var(--info); font-size: 12px; }
.tag.mine { background: var(--accent-bg); color: var(--accent-dk); font-weight: 700; }
.badge { display: inline-block; min-width: 72px; text-align: center; padding: 2px 8px; border-radius: 4px; font-size: 12px;
  border: 1px solid transparent; }
.badge.err { color: var(--err); background: var(--err-bg); border-color: var(--err-bd); }
.badge.warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-bd); }
.badge.ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-bd); }
.badge.info { color: var(--info); background: var(--info-bg); border-color: var(--info-bd); }
.btn { display: inline-block; padding: 7px 14px; border-radius: 10px; border: 1px solid var(--line-2); background: #fff;
  color: var(--text); text-decoration: none; font: inherit; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn:disabled { color: #a0aec0; cursor: not-allowed; border-color: var(--line); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dk); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--text-2); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 16px; }
.chip { padding: 4px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: #fff; color: var(--text);
  text-decoration: none; font-size: 13px; }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip-groups { margin: 4px 0 16px; }
.chip-groups .chips { margin: 0 0 6px; align-items: center; }
.chip-year { min-width: 76px; color: var(--text-2); font-size: 13px; font-weight: 700; }
.table-wrap { overflow-x: auto; }
table.history { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
table.history th, table.history td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.history thead th { color: var(--text-2); font-weight: 400; font-size: 13px; }
table.history .num { text-align: right; }
table.history tr.fy th { font-weight: 700; background: var(--info-bg); color: var(--text-2); font-size: 13px; }
table.history tr.fy-total th, table.history tr.fy-total td { font-weight: 700; border-bottom: 2px solid var(--line-2); }
table.history td.ops .btn + .btn { margin-left: 6px; }
/* ドロップゾーン: ファイルを持って近づくと、輪が中心へ縮んで吸い込むように見せる */
.dropzone { position: relative; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center;
  padding: 24px 22px 20px; border: 2px dashed var(--line-2); border-radius: 12px; background: #fff; cursor: pointer;
  color: var(--text-2); overflow: hidden; transition: border-color .2s, background-color .3s, box-shadow .3s; }
.dropzone:hover { border-color: #94a3b8; }
.dropzone.armed, .dropzone.over, .dropzone:focus-within { border-color: var(--accent); }
.dropzone:focus-within { outline: 2px solid var(--accent-bg); }
.dropzone.over { background: radial-gradient(circle at 50% 42%, var(--accent-bg), #fff 70%);
  box-shadow: inset 0 0 0 4px var(--accent-bg); }
.dropzone.busy { cursor: progress; color: var(--text-3); }
.dz-well { position: relative; display: grid; place-items: center; width: 64px; height: 64px; }
.dz-ring { position: absolute; inset: 0; border: 2px solid var(--accent); border-radius: 50%; opacity: 0; pointer-events: none; }
.dropzone.armed .dz-ring, .dropzone.over .dz-ring, .dropzone.busy .dz-ring { animation: dz-pull 3.2s cubic-bezier(.5, 0, .9, .6) infinite; }
.dropzone .dz-ring:nth-child(2) { animation-delay: 1.07s; }
.dropzone .dz-ring:nth-child(3) { animation-delay: 2.13s; }
.dropzone.over .dz-ring { animation-duration: 1.8s; }
.dropzone.over .dz-ring:nth-child(2) { animation-delay: .6s; }
.dropzone.over .dz-ring:nth-child(3) { animation-delay: 1.2s; }
@keyframes dz-pull { 0% { transform: scale(3.2); opacity: 0; } 30% { opacity: .35; } 100% { transform: scale(.7); opacity: 0; } }
.dz-text { transition: color .2s; }
.dropzone.over .dz-text { color: var(--accent-dk); font-weight: 700; }
@media (prefers-reduced-motion: reduce) {
  .dropzone .dz-ring { animation: none !important; }
  .dropzone .dz-icon { transition: none; animation: none !important; }
}
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
input[aria-invalid="true"] { border-color: var(--err) !important; background: var(--err-bg) !important; }
.dz-icon { position: relative; display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; font-weight: 700; font-size: 12px; color: var(--accent);
  transform: translate(var(--mx, 0px), var(--my, 0px)) scale(var(--s, 1));
  transition: transform .45s cubic-bezier(.3, 1.6, .5, 1), border-color .2s, box-shadow .2s; }
.dropzone:hover .dz-icon { --s: 1.06; }
.dropzone.over .dz-icon { --s: 1.18; border-color: var(--accent); box-shadow: 0 0 0 6px var(--accent-bg); }
.dropzone .dz-icon.gulp { animation: dz-gulp .7s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes dz-gulp { 0% { transform: scale(.82); } 55% { transform: scale(1.14); } 100% { transform: scale(1); } }
.upload-row { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--line); }
table.files { border-collapse: collapse; width: 100%; margin-top: 12px; }
table.files th, table.files td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.files th { color: var(--text-2); font-weight: 400; font-size: 13px; }
.stats { display: flex; margin-bottom: 12px; }
.stat { min-width: 118px; padding: 0 16px; border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; padding-left: 0; }
.stat b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--text-3); font-size: 12px; }
.stat.err b { color: var(--err); } .stat.warn b { color: var(--warn); } .stat.ok b { color: var(--ok); } .stat.info b { color: var(--info); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tab { padding: 6px 14px; border: 0; border-bottom: 2px solid transparent; background: none; font: inherit; color: var(--text-2); cursor: pointer; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-body { display: none; }
.tab-body.active { display: block; }
.finding { border: 1px solid var(--line); border-left: 5px solid #b7c2cf; border-radius: 8px; padding: 10px 14px; margin-bottom: 8px; }
.finding.sev-error { border-left-color: var(--err); }
.finding.sev-warn { border-left-color: #e5c45c; background: #fffdf5; }
.finding.done { border-left-color: #6cc08c; background: #fff; }
.finding p { margin: 4px 0; }
.f-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.detail { color: var(--text-2); font-size: 13px; }
.excerpts { margin-top: 6px; }
.excerpts summary { cursor: pointer; color: var(--text-2); font-size: 13px; }
.excerpt { margin: 6px 0 0; }
.sheet-wrap { overflow-x: auto; }
.sheet { border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; background: #fff; }
.sheet th, .sheet td { border: 1px solid var(--line-2); padding: 2px 8px; white-space: nowrap; }
.sheet th { background: var(--info-bg); color: var(--text-3); font-weight: 400; text-align: center; }
.sheet tr > th:first-child { text-align: right; min-width: 44px; }
.sheet tr.head td { background: #f8fafc; font-weight: 700; white-space: normal; min-width: 8em; max-width: 200px; }
.sheet td.hit { outline: 2px solid #e5c45c; outline-offset: -2px; background: var(--warn-bg); font-weight: 700; }
.finding.sev-error .sheet td.hit { outline-color: var(--err); background: var(--err-bg); }
.finding.sev-info .sheet td.hit { outline-color: var(--info); background: var(--info-bd); }
.finding.done .sheet td.hit { outline-color: #6cc08c; background: var(--ok-bg); }
.sheet tr.note td { border-style: dashed; color: var(--text-3); text-align: center; }
.sheet tr.note td:first-child { border-style: solid; background: var(--info-bg); }
.f-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.f-actions input { min-width: 200px; }
.f-actions input, textarea, .form input { flex: 1; padding: 6px 10px; border: 1px solid var(--line-2); border-radius: 8px; font: inherit; background: #fff; }
textarea { width: 100%; }
.preview-wrap { overflow-x: auto; }
iframe.preview { display: block; width: 100%; min-width: 800px; height: 760px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.reason { color: var(--err); font-size: 13px; margin: 6px 0 0; }
.notice { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.notice.ok { color: var(--ok); background: var(--ok-bg); border: 1px solid var(--ok-bd); }
.notice.warn { color: var(--warn); background: var(--warn-bg); border: 1px solid var(--warn-bd); }
.notice.err { color: var(--err); background: var(--err-bg); border: 1px solid var(--err-bd); }
.notice ul { margin: 4px 0 0; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-2); margin-bottom: 10px; }
.form h2 { margin-top: 18px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 12px; }
.form.narrow { max-width: 380px; margin: 40px auto; }
.form select { padding: 6px 10px; border: 1px solid var(--line-2); border-radius: 8px; font: inherit; background: #fff; }
.form label.check { flex-direction: row; align-items: center; gap: 6px; color: var(--text); font-size: 14px; }
.form label.check input { flex: none; }
.f-actions input[readonly], textarea[readonly], .form input[readonly] { background: var(--bg); color: var(--text-2); }   /* 読み取り専用(権限がない)と見分ける */
table.history tr.inactive th, table.history tr.inactive td { color: var(--text-3); background: var(--bg); }
table.users th a { color: var(--accent-dk); text-decoration: none; }
table.users td.contracts { white-space: normal; min-width: 12em; }
table.users th a:hover { text-decoration: underline; }
.reason + .panel { margin-top: 10px; }
.mail h2 { margin-bottom: 4px; }
.mail pre { margin: 12px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }
@media (max-width: 640px) { .page-head { flex-direction: column; align-items: flex-start; } .stat { min-width: 70px; padding: 0 10px; } }
[hidden] { display: none !important; }
