:root {
  --bg: #f5f6f8; --panel: #fff; --line: #e2e5ea; --ink: #1f2733; --muted: #8a93a0;
  --accent: #2f6df0; --ok: #1a8f4c; --warn: #c47f00; --err: #c43d3d; --review: #b06a00;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar { display: flex; align-items: center; gap: 24px; background: #1f2733; color: #fff; padding: 0 20px; }
.brand { font-weight: 700; padding: 14px 0; }
.brand span { color: #9fb4e0; font-weight: 400; margin-left: 4px; }
.topbar nav { display: flex; gap: 4px; }
.topbar nav a { color: #c7cedb; padding: 14px 14px; }
.topbar nav a.active { color: #fff; box-shadow: inset 0 -3px 0 var(--accent); }

main { max-width: 1080px; margin: 0 auto; padding: 24px 20px 80px; }
h1 { font-size: 22px; margin: 0 0 18px; }
h2 { font-size: 15px; margin: 0 0 10px; color: #334; }
.muted { color: var(--muted); font-weight: 400; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.flash.ok { background: #e7f6ec; color: var(--ok); }
.flash.err { background: #fdeaea; color: var(--err); }

.cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 24px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; text-align: center; color: var(--ink); }
.card .num { font-size: 26px; font-weight: 700; }
.card .lbl { color: var(--muted); font-size: 12px; margin-top: 4px; }
.card.big .num { font-size: 30px; }
.card.accent { background: #fff6e9; border-color: #f0d9af; }
.card.accent .num { color: var(--review); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }

table { border-collapse: collapse; width: 100%; }
table.mini td, table.mini th { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: left; }
table.data { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
table.data th, table.data td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.data th { background: #fafbfc; font-size: 12px; color: #556; }
.r { text-align: right; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; }
.s-needs_review { background: #fff0d6; color: var(--review); }
.s-approved { background: #e2f5e9; color: var(--ok); }
.s-rejected { background: #fdeaea; color: var(--err); }
.s-pending { background: #eef1f5; color: #667; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; align-items: center; }
.filters select, .filters input, .edit input, .edit select, .edit textarea, .upload select, .upload input,
.closure-form input, .closure-form select {
  padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: #fff; font: inherit; }
button, .btn-clear, .b-run { padding: 7px 14px; border: 1px solid var(--line); border-radius: 7px; background: #fff;
  cursor: pointer; font: inherit; color: var(--ink); }
button:hover { background: #f2f4f7; }
.btn-clear { color: var(--muted); }

.pager { display: flex; gap: 16px; align-items: center; justify-content: center; margin-top: 18px; }

/* detail */
.detail-head { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }
.detail-head h1 { margin: 0; }
.back { color: var(--muted); }
.meta-line { margin-bottom: 16px; font-size: 13px; }
.status-bar { display: flex; gap: 8px; margin-bottom: 18px; }
.b-approve { background: var(--ok); color: #fff; border-color: var(--ok); }
.b-review { background: #fff6e9; color: var(--review); border-color: #f0d9af; }
.b-reject { background: var(--err); color: #fff; border-color: var(--err); }
.b-pending { background: #eef1f5; }
.b-save { background: var(--accent); color: #fff; border-color: var(--accent); padding: 9px 22px; }
.b-run { background: var(--accent); color: #fff; border-color: var(--accent); }

.edit .fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.edit label { display: flex; flex-direction: column; gap: 4px; }
.edit label.wide { grid-column: 1 / -1; }
.edit .k { font-size: 12px; color: #667; }
.edit textarea { resize: vertical; }
.edit textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.edit-actions { margin-top: 14px; }
.src { font-size: 11px; color: #7a8; background: #eef6f0; padding: 1px 5px; border-radius: 4px; }
.prov { font-size: 11px; color: var(--warn); }

.raw { margin-top: 22px; }
.raw pre { background: #1f2733; color: #d6e0f0; padding: 12px; border-radius: 8px; overflow: auto; font-size: 12px; }

/* pipeline */
.tasks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 24px; }
.task { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; }
.task.danger { border-color: #f0c9c9; background: #fff8f8; }
.task-label { font-weight: 600; flex: 1; }
.task-opts { display: flex; gap: 8px; align-items: center; }
.task-opts input { padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; }
.log { background: #11151c; color: #cfe; padding: 12px; border-radius: 8px; max-height: 460px; overflow: auto; font-size: 12px; }
.logbar { display: flex; justify-content: space-between; margin-bottom: 8px; }

.upload { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* 閉館・休館レビュー */
.closure { border: 1px solid #d9534f33; background: #fff8f6; border-radius: 8px; padding: 12px 16px; margin: 16px 0; }
.closure h2 { font-size: 1.05rem; margin: 0 0 8px; display: flex; gap: 10px; align-items: center; }
.closure .closed-note { background: #fff; border-left: 3px solid #d9534f; padding: 8px 10px; margin: 8px 0; border-radius: 4px; }
.closure .hint { font-size: .85rem; margin: 6px 0 0; }
.closure-form .fields { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.closure-form .fields .wide { grid-column: 1 / -1; }
.closure-form label { display: flex; flex-direction: column; gap: 4px; }
.closure-form .k { font-size: 12px; color: #667; }

/* 画像登録レビュー */
.images { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 12px 16px; margin: 16px 0; }
.images h2 { font-size: 1.05rem; margin: 0 0 10px; }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 14px; }
.img-card { border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: #fff; }
.img-card img { width: 100%; height: 120px; object-fit: cover; border-radius: 6px; background: #f0f2f5; }
.img-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.img-card .small { font-size: 11px; margin-top: 2px; }
.img-actions { display: flex; gap: 6px; margin-top: 8px; }
.img-actions button { padding: 4px 10px; font-size: 12px; }
.img-upload .fields { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.img-upload .fields .wide { grid-column: 1 / -1; }
.img-upload label { display: flex; flex-direction: column; gap: 4px; }
.img-upload .k { font-size: 12px; color: #667; }
.img-upload .hint { font-size: .85rem; margin: 8px 0 0; }

/* 名寄せ（Wikidata QID）レビュー */
.qidmatch { border: 1px solid #cfe0f5; background: #f6f9ff; border-radius: 8px; padding: 12px 16px; margin: 16px 0; }
.qidmatch h2 { font-size: 1.05rem; margin: 0 0 10px; display: flex; gap: 10px; align-items: baseline; }
.qidmatch table.mini { width: 100%; }
.qidmatch .hint { font-size: .85rem; margin: 8px 0 0; }
.qidmatch button { padding: 4px 10px; font-size: 12px; }

/* 分割 */
.split { border: 1px solid var(--line); background: #fbfbfd; border-radius: 8px; padding: 12px 16px; margin: 16px 0; }
.split h2 { font-size: 1.05rem; margin: 0 0 8px; display: flex; gap: 10px; align-items: baseline; }
.split .hint { font-size: .85rem; margin: 6px 0 10px; }
.split-form label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; max-width: 520px; }
.split-form .k { font-size: 12px; color: #667; }
.split-form textarea, .split-form select { padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: #fff; font: inherit; }

.img-edit { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.img-edit input[type=text] { padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; }
.img-edit .cb { font-size: 12px; display: flex; align-items: center; gap: 4px; }

.data .nowrap { white-space: nowrap; }
.data .nowrap form { display: inline; }
.data .nowrap button { padding: 3px 8px; font-size: 12px; }
