/* TabinoMemo News。色はここの変数だけで決め、明暗は差し替えるだけにする */
:root {
  --bg: #f1f2f4;
  --surface: #ffffff;
  --surface-2: #f6f7f8;
  --text: #1b1f23;
  --text-2: #3d454c;
  --muted: #5b646d;
  --border: #dcdfe3;
  --border-2: #eef0f2;
  --input-bd: #bcc2c8;
  --rule: #1c2227;
  --accent: #1f7a52;
  --accent-strong: #165c3d;
  --accent-fg: #ffffff;
  --ok-bg: #e7f1eb; --ok-bd: #bdd9ca; --ok-fg: #165c3d;
  --warn-bg: #fbf3e3; --warn-bd: #e6cf9f; --warn-fg: #8a5a06;
  --danger-bg: #fbeceb; --danger-bd: #e8bdb8; --danger-fg: #bb3a2f;
  --info-bg: #eaf1f8; --info-bd: #c6d6e8; --info-fg: #1f5f9e;
  --radius: 6px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15181b; --surface: #1d2125; --surface-2: #23282d; --text: #e6e8ea; --text-2: #c5cacf; --muted: #9aa3ab;
    --border: #2f353b; --border-2: #282d32; --input-bd: #444c54; --rule: #c5cacf;
    --accent: #4cb585; --accent-strong: #6fcb9f; --accent-fg: #0f1a14;
    --ok-bg: #16281f; --ok-bd: #2c5240; --ok-fg: #7fd3a8;
    --warn-bg: #2a2214; --warn-bd: #5a4520; --warn-fg: #e6b65c;
    --danger-bg: #2c1817; --danger-bd: #5e2e2a; --danger-fg: #f08a80;
    --info-bg: #15222f; --info-bd: #2a4561; --info-fg: #8bbcef;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15181b; --surface: #1d2125; --surface-2: #23282d; --text: #e6e8ea; --text-2: #c5cacf; --muted: #9aa3ab;
  --border: #2f353b; --border-2: #282d32; --input-bd: #444c54; --rule: #c5cacf;
  --accent: #4cb585; --accent-strong: #6fcb9f; --accent-fg: #0f1a14;
  --ok-bg: #16281f; --ok-bd: #2c5240; --ok-fg: #7fd3a8;
  --warn-bg: #2a2214; --warn-bd: #5a4520; --warn-fg: #e6b65c;
  --danger-bg: #2c1817; --danger-bd: #5e2e2a; --danger-fg: #f08a80;
  --info-bg: #15222f; --info-bd: #2a4561; --info-fg: #8bbcef;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: 15px; line-height: 1.6;
}
a { color: var(--accent); }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.push { margin-left: auto; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; }
.wrap.narrow { max-width: 760px; }
.wrap.wide { max-width: 1400px; padding-top: 16px; }

/* ヘッダー */
.site-head { background: var(--surface); border-bottom: 1px solid var(--border); }
.head-row { padding-top: 0; padding-bottom: 0; min-height: 56px; display: flex; align-items: center; gap: 4px 16px; flex-wrap: wrap; }
.site-name { font-weight: 700; font-size: 19px; color: var(--text); text-decoration: none; }
.head-nav { display: flex; gap: 2px; flex-wrap: wrap; margin-left: auto; font-size: 14px; }
.head-nav a { padding: 16px 10px 14px; color: var(--text); text-decoration: none; border-bottom: 2px solid transparent; }
.head-nav a.is-current { border-bottom-color: var(--accent); }
.head-search input { min-height: 36px; width: 180px; padding: 0 10px; border: 1px solid var(--input-bd); border-radius: 4px; font-size: 14px; background: var(--surface); color: var(--text); }
.head-main { padding: 16px 4px; color: var(--muted); text-decoration: none; font-size: 14px; }
@media (max-width: 720px) {
  .head-row { padding-top: 8px; padding-bottom: 4px; }
  .head-nav { margin-left: 0; width: 100%; order: 3; }
  .head-nav a { padding: 10px 8px; }
  .head-search { order: 2; margin-left: auto; }
  .head-search input { width: 140px; }
  .head-main { display: none; }
}

.site-foot { border-top: 1px solid var(--border); background: var(--surface); }
.foot-row { padding-top: 20px; padding-bottom: 28px; display: flex; gap: 12px 24px; flex-wrap: wrap; align-items: baseline; }
.foot-nav { display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: 13px; }

/* 一覧 */
.with-aside { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.main-col { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.aside { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.sec-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; padding-bottom: 6px; border-bottom: 2px solid var(--rule); margin-bottom: 12px; }
.sec-head h1, .sec-head h2 { margin: 0; font-size: 18px; line-height: 1.4; }
.sec-head h2 { font-size: 15px; }
.sec-title { margin: 0 0 10px; font-size: 15px; padding-bottom: 6px; border-bottom: 2px solid var(--rule); }
.card .sec-title, .card.pad .sec-title { border-bottom: 0; padding-bottom: 0; font-size: 14px; }
.lead { margin: 0 0 12px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card.pad, .pad { padding: 12px; }
.card.empty { padding: 20px 16px; color: var(--muted); }
.block { margin-top: 24px; }

.featured { display: block; padding: 16px; color: var(--text); text-decoration: none; margin-bottom: 12px; }
.featured:hover .featured-title { color: var(--accent-strong); }
.featured-title { margin: 8px 0 6px; font-size: 21px; line-height: 1.45; }
.featured-summary { margin: 0; color: var(--text-2); font-size: 14px; }
.featured-foot { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }

.rows { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; }
.row:last-child { border-bottom: 0; }
.row:hover .row-title { color: var(--accent-strong); }
.row-date { font-size: 12px; color: var(--muted); padding-top: 3px; }
.row-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; }
.row-title { display: block; font-weight: 700; font-size: 16px; margin-top: 4px; line-height: 1.5; }
@media (max-width: 480px) {
  .row { grid-template-columns: 1fr; gap: 2px; }
}
.more { display: flex; justify-content: center; margin-top: 4px; min-height: 44px; }
.more.is-loading .btn { opacity: .6; pointer-events: none; }
.list-end { text-align: center; font-size: 13px; }

.cat { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 4px; border: 1px solid var(--border); color: var(--text-2); font-size: 12px; white-space: nowrap; }
.cat.is-strong { height: 22px; padding: 0 7px; font-weight: 700; border-color: var(--info-bd); background: var(--info-bg); color: var(--info-fg); }

.links { display: flex; flex-direction: column; margin-top: 10px; }
.links a { display: flex; justify-content: space-between; align-items: center; min-height: 44px; padding: 0 12px; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; font-size: 14px; }
.links a:last-child { border-bottom: 0; }
.link-card { display: flex; justify-content: space-between; align-items: center; min-height: 44px; padding: 0 12px; color: var(--text); text-decoration: none; font-size: 14px; }

.input { box-sizing: border-box; width: 100%; min-height: 40px; padding: 6px 10px; border: 1px solid var(--input-bd); border-radius: 4px; font: inherit; font-size: 14px; background: var(--surface); color: var(--text); }
textarea.input { min-height: 0; line-height: 1.6; }
.input.num { width: 64px; display: inline-block; text-align: center; }
.inline-form { display: flex; gap: 8px; margin-bottom: 8px; max-width: 480px; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 14px; border: 1px solid var(--input-bd); border-radius: 4px; background: var(--surface); color: var(--text); text-decoration: none; font: inherit; font-size: 14px; cursor: pointer; }
.btn:hover { border-color: var(--muted); color: var(--text); }
.btn.primary { background: var(--accent); border-color: var(--accent-strong); color: var(--accent-fg); font-weight: 700; }
.btn.danger { background: var(--danger-bg); border-color: var(--danger-bd); color: var(--danger-fg); }
.btn.icon { min-width: 40px; padding: 0; }
.linklike { border: 0; background: none; padding: 0; color: var(--muted); font: inherit; text-decoration: underline; cursor: pointer; }

/* 記事 */
.crumbs { line-height: 1.5; }
.article { padding: 24px; margin-top: 12px; font-size: 16px; line-height: 1.8; }
@media (max-width: 480px) { .article { padding: 16px; } }
.article-title { margin: 10px 0 0; font-size: 26px; line-height: 1.45; }
@media (max-width: 480px) { .article-title { font-size: 22px; } }
.article .row-meta { font-size: 13px; line-height: 1.5; }
.facts { margin-top: 18px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.facts h2 { margin: 0; padding: 8px 12px; font-size: 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); line-height: 1.5; }
.facts dl { margin: 0; display: grid; grid-template-columns: minmax(84px, 120px) minmax(0, 1fr); font-size: 15px; line-height: 1.6; }
.facts dt, .facts dd { margin: 0; padding: 8px 12px; border-bottom: 1px solid var(--border-2); }
.facts dt { color: var(--muted); }
.facts dl > :nth-last-child(-n+2) { border-bottom: 0; }
.article-body { margin-top: 20px; }
.article-body p { margin: 0 0 14px; }
.ours { margin-top: 8px; border: 1px solid var(--ok-bd); background: var(--ok-bg); border-radius: var(--radius); padding: 12px 14px; font-size: 14px; line-height: 1.7; }
.ours h2 { margin: 0 0 6px; font-size: 14px; color: var(--ok-fg); line-height: 1.5; }
.ours p { margin: 0 0 6px; }
.ours-link { display: inline-flex; align-items: center; min-height: 44px; }
.source { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 14px; line-height: 1.7; }
.source h2 { margin: 0 0 6px; font-size: 14px; }
.source p { margin: 0; }
.source .small { margin-top: 4px; }
.share { margin-top: 16px; display: flex; gap: 6px; flex-wrap: wrap; }
.share .btn { min-height: 40px; padding: 0 12px; font-size: 13px; }
.actions { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.prose ul { padding-left: 1.2em; }

.notice { margin: 0 0 10px; padding: 10px 12px; border: 1px solid var(--ok-bd); background: var(--ok-bg); color: var(--ok-fg); border-radius: var(--radius); font-size: 14px; }
.notice.is-error { border-color: var(--danger-bd); background: var(--danger-bg); color: var(--danger-fg); }

.comment { padding: 12px 16px; border-bottom: 1px solid var(--border); line-height: 1.7; font-size: 15px; overflow-wrap: anywhere; }
.comment p { margin: 4px 0 0; }
.comment-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.comment-meta b { color: var(--text); }
.comment-meta .report { margin-left: auto; }
.comment-form { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.comment-form .input.name { max-width: 280px; min-height: 44px; }
.form-foot { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* 事業者 */
.op-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; }
.op-grid.wide { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.op { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 4px; color: var(--text); text-decoration: none; font-size: 14px; }
.op .small { color: var(--accent-strong); }
.op.is-empty { color: var(--muted); }

/* 管理画面 */
.admin .head-nav b { color: var(--danger-fg); }
.chip { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 4px; border: 1px solid var(--border); font-weight: 700; font-size: 12px; }
.chip.is-ok { border-color: var(--ok-bd); background: var(--ok-bg); color: var(--ok-fg); }
.chip.is-warn { border-color: var(--warn-bd); background: var(--warn-bg); color: var(--warn-fg); }
.chip.is-danger { border-color: var(--danger-bd); background: var(--danger-bg); color: var(--danger-fg); }
.chip.is-muted { color: var(--muted); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-link { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border: 1px solid var(--input-bd); border-radius: 4px; background: var(--surface); color: var(--text); text-decoration: none; }
.chip-link.is-current { border-color: var(--accent); background: var(--ok-bg); color: var(--ok-fg); font-weight: 700; }
.btns { display: flex; gap: 6px; flex-wrap: wrap; }
.btns .btn { min-height: 36px; font-size: 13px; }
.comments-admin { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.side-col { flex: 1 1 360px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack > label, .cols2 > label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.stack > label.check, label.check { flex-direction: row; align-items: center; gap: 6px; font-size: 14px; color: var(--text); }
.radios { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.radios label { display: flex; gap: 6px; align-items: center; min-height: 36px; }
.block-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 12px; border-bottom: 1px solid var(--border-2); }
.block-row .btn { min-height: 32px; font-size: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border-2); vertical-align: top; }
.table th { color: var(--muted); font-weight: 400; font-size: 12px; }

.review-bar { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0; background: var(--bg); }
.review-cols { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.pdf-pane { flex: 1 1 520px; min-width: 0; position: sticky; top: 64px; }
.pdf-pane iframe { width: 100%; height: calc(100vh - 90px); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.fields { flex: 1 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.cols2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.facts-edit { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.fact-row { display: grid; grid-template-columns: minmax(80px, 1fr) minmax(120px, 2fr) auto auto auto auto; gap: 6px; align-items: center; }
.fact-row .input { min-height: 36px; }
@media (max-width: 640px) {
  .fact-row { grid-template-columns: 1fr 1fr; }
  .fact-row .v { grid-column: 1 / -1; order: -1; }
}
.cands { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.cand { text-align: left; min-height: 36px; height: auto; padding: 6px 10px; font-size: 13px; }

/* 集めた発表 */
.notice.is-warn { border-color: var(--warn-bd); background: var(--warn-bg); color: var(--warn-fg); }
.pdf-filter { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; align-items: end; margin-bottom: 10px; }
.pdf-filter > label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.pdfs .chips { margin-bottom: 10px; }
.compose-bar { position: sticky; top: 0; z-index: 2; display: flex; gap: 8px 12px; align-items: center; flex-wrap: wrap; padding: 8px 0; background: var(--bg); }
.compose-bar .btn { min-height: 36px; font-size: 13px; }
.compose-bar .btn[disabled] { opacity: .5; cursor: default; }
.pdf-day { margin-top: 14px; }
.pdf-day-head { margin: 0 0 6px; font-size: 14px; }
.pdf-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 12px; border-bottom: 1px solid var(--border-2); }
.pdf-row:last-child { border-bottom: 0; }
.pdf-row .pick { width: 20px; height: 20px; margin-top: 2px; }
.pdf-row:has(.pick:checked) { background: var(--ok-bg); }
.pdf-title { display: block; margin-top: 2px; font-weight: 700; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.pdf-title:hover { color: var(--accent-strong); text-decoration: underline; }
.pager { justify-content: center; margin-top: 14px; }
.pdf-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.pdf-tabs .chip-link { min-height: 32px; font-size: 12px; cursor: pointer; font: inherit; font-size: 12px; }
.more-source { padding-top: 6px; border-top: 1px dashed var(--border); }

/* 発表を手で足す */
.manual-add > label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.dropzone { position: relative; border: 2px dashed var(--input-bd); border-radius: var(--radius); padding: 18px 14px; background: var(--surface-2); }
.dropzone.is-over { border-color: var(--accent); background: var(--ok-bg); }
.dropzone-label { display: block; font-size: 14px; color: var(--text); cursor: pointer; }
.dropzone-input { margin-top: 8px; max-width: 100%; }
.dropzone-list { margin: 8px 0 0; padding-left: 1.2em; }

/* 発表を1件ずつ見る(分割ビューの右側で使う) */
.preview { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; padding-bottom: 12px; }
.preview-bar { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px 16px; flex-wrap: wrap; }
.preview-meta { min-width: 0; flex: 1 1 320px; }
.preview-title { margin: 4px 0; font-size: 17px; line-height: 1.45; overflow-wrap: anywhere; }
.preview .btns .btn { min-height: 36px; font-size: 13px; }
.preview .btn[aria-disabled="true"] { opacity: .4; cursor: default; }
.preview-frame { width: 100%; height: calc(100vh - 190px); min-height: 420px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }

/* ランニングコスト */
.usage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 12px; }
@media (max-width: 480px) { .usage-grid { grid-template-columns: 1fr; } }
.table .num { text-align: right; white-space: nowrap; }
.table tr.total td { font-weight: 700; border-top: 1px solid var(--border); }
.table-scroll { overflow-x: auto; }
.manual-ops { margin-bottom: 12px; }
.manual-ops .url-cell { overflow-wrap: anywhere; min-width: 220px; }
.manual-ops td { vertical-align: top; }
.op-edit { min-width: 260px; margin-top: 6px; }
.manual-ops .chip, .manual-ops summary, .manual-ops td:first-child { white-space: nowrap; }
.manual-ops summary { cursor: pointer; color: var(--accent); }
