[hidden] { display: none !important; }
:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1f2933;
  --sub: #5b6670;
  --line: #d9dee3;
  --accent: #1d6f42;      /* 表計算らしい緑 */
  --accent-weak: #e7f3ec;
  --red: #c0392b;
  --red-weak: #fdecea;
  --warn: #8a5a00;
  --warn-weak: #fff4d6;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo, system-ui, sans-serif;
  font-size: 15px; line-height: 1.7;
}
a { color: var(--accent); }
header.site, footer.site { max-width: 1200px; margin: 0 auto; padding: 14px 16px; display: flex; gap: 16px; align-items: center; }
header.site .brand { font-weight: 700; text-decoration: none; color: var(--text); font-size: 17px; }
footer.site { justify-content: space-between; color: var(--sub); font-size: 13px; border-top: 1px solid var(--line); margin-top: 40px; }
main { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

.hero h1 { font-size: 26px; line-height: 1.4; margin: 12px 0 8px; }
.hero .lead { margin: 0 0 8px; color: var(--sub); }
.points { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 0; margin: 0 0 18px; list-style: none; font-size: 14px; }
.points li::before { content: "✓ "; color: var(--accent); font-weight: 700; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
h2 { font-size: 17px; margin: 0 0 8px; }

.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 150px; border: 2px dashed #9fb3a6; border-radius: var(--radius); background: var(--accent-weak);
  cursor: pointer; text-align: center; padding: 16px; transition: background .15s;
}
.drop:hover, .drop.over, .drop:focus { background: #d6ecdf; outline: none; border-color: var(--accent); }
.drop.compact { min-height: 64px; flex-direction: row; gap: 12px; }
.drop.compact .drop-main { font-size: 15px; }
.drop-main { font-size: 17px; font-weight: 700; }
.drop-sub { color: var(--sub); }
.load-extra { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 10px; }

button { font: inherit; cursor: pointer; }
button.link { background: none; border: none; padding: 0; color: var(--accent); text-decoration: underline; }
button.primary { background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 8px 18px; font-weight: 700; }
button.primary:hover { filter: brightness(1.1); }
button.primary:disabled { opacity: .5; cursor: default; }
button.big { font-size: 16px; padding: 10px 24px; }

.msg { margin: 10px 0 0; padding: 8px 12px; border-radius: 8px; background: var(--accent-weak); font-size: 14px; }
.msg.error { background: var(--red-weak); color: var(--red); }
.msg.warn { background: var(--warn-weak); color: var(--warn); }

.map-head p { margin: 0 0 10px; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 14px; }
.map-grid select { width: 100%; }
.map-grid label { display: flex; flex-direction: column; font-size: 13px; color: var(--sub); gap: 2px; }
select, input { font: inherit; color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: #fff; min-width: 0; }
select:focus, input:focus { outline: 2px solid #9fd3b3; border-color: var(--accent); }
ul.warn { margin: 10px 0 0; padding-left: 20px; color: var(--warn); font-size: 14px; }
ul.warn:empty { display: none; }

.work { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.work .card { margin-bottom: 0; }
.work-side { position: sticky; top: 12px; grid-column: 2; grid-row: 1 / span 2; }   /* 下の書き出し欄に重ならないよう、右の列を2段ぶん使う */
.work-side form { display: flex; flex-direction: column; gap: 10px; }
.work-side label { display: flex; flex-direction: column; font-size: 13px; color: var(--sub); gap: 2px; }
.work-side .kind { display: flex; gap: 18px; }
.work-side .kind label { flex-direction: row; align-items: center; gap: 4px; font-size: 15px; color: var(--text); }
.hint { font-size: 13px; color: var(--sub); margin: 0; min-height: 1em; }
.export { grid-column: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.push p { margin: 0 0 8px; font-size: 14px; }
.push-btn { display: block; width: 100%; text-align: left; margin-bottom: 8px; background: #fff; border: 1px solid var(--accent); color: var(--accent); border-radius: 8px; padding: 8px 12px; font-weight: 700; }
.push-btn:hover { background: var(--accent-weak); }
.push-btn.done { opacity: .6; }

.tabs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; border-bottom: 1px solid var(--line); margin: -4px 0 10px; padding-bottom: 8px; }
.tabs button { background: none; border: 1px solid transparent; border-radius: 6px; padding: 4px 10px; color: var(--sub); }
.tabs button[aria-selected="true"] { background: var(--accent-weak); color: var(--accent); border-color: #b9dcc7; font-weight: 700; }
.tabs span { font-size: 12px; }
.tabs .badge-red { background: var(--red); color: #fff; border-radius: 10px; padding: 0 6px; }
.tabs input { margin-left: auto; width: 200px; }

.table-wrap { overflow: auto; max-height: 70vh; }
table.grid { border-collapse: collapse; width: 100%; font-size: 14px; }
table.grid th, table.grid td { border: 1px solid var(--line); padding: 4px 8px; white-space: nowrap; }
table.grid th { background: #eef1f4; position: sticky; top: 0; z-index: 1; font-weight: 600; text-align: left; }
table.grid td.n, table.grid th.n { text-align: right; font-variant-numeric: tabular-nums; }
table.grid td.b { font-weight: 700; }
table.grid tbody tr { cursor: default; }
table.grid tbody tr[data-key]:hover { background: #f3f8f5; }
table.grid tr.low td, table.grid tr.minus td { background: var(--red-weak); }
table.grid tr.low td.b, table.grid tr.minus td.b { color: var(--red); }
td.neg { color: var(--red); }
td.pos { color: var(--accent); }
.dim { color: #a0a8b0; }
.tag { display: inline-block; font-size: 11px; border-radius: 4px; padding: 0 6px; background: #eef1f4; color: var(--sub); }
.tag.red { background: var(--red); color: #fff; }
.empty { color: var(--sub); padding: 20px 4px; }
.count-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.count-head p { margin: 0; font-size: 13px; color: var(--sub); }
.count-in { width: 90px; text-align: right; padding: 2px 6px; }

.guide { margin-top: 32px; max-width: 820px; }
.guide h2 { margin-top: 24px; }
.guide dt { font-weight: 700; margin-top: 12px; }
.guide dd { margin: 2px 0 0; color: var(--sub); }
.doc { max-width: 820px; }

@media (max-width: 860px) {
  .work { grid-template-columns: minmax(0, 1fr); }
  .work-side { position: static; grid-column: auto; grid-row: auto; }
  .export { grid-template-columns: minmax(0, 1fr); }
  .tabs input { width: 100%; margin-left: 0; }
  .hero h1 { font-size: 21px; }
}
