/* 討議会集計システム 共通スタイル(スマホファースト)
   v2: 表サイト(rinentokeiei.com)とブランド統一 — ダーク#17151a×えんじ#8b1f2f×金#c9a95c */
* { box-sizing: border-box; }
:root {
  --rk-enji: #8b1f2f;
  --rk-enji-deep: #5e1520;
  --rk-enji-bright: #a3273a;
  --rk-gold: #c9a95c;
  --rk-dark: #17151a;
  --rk-cream: #f7f4ee;
  --rk-line: #e8e2d5;
  --rk-serif: "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Noto Serif JP", serif;
}
body {
  margin: 0; font-family: -apple-system, "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
  font-size: 15px; color: #2b2b2b; background: var(--rk-cream);
}
a { color: var(--rk-enji); }
select, input, button, textarea { font: inherit; }
select, input[type="date"], input[type="text"], input[type="number"], input[type="password"], textarea {
  border: 1px solid #ccc; border-radius: 8px; padding: 8px 10px; background: #fff;
}
button { cursor: pointer; }

/* ヘッダ */
.topbar { background: var(--rk-dark); color: #fff; border-bottom: 2px solid var(--rk-gold); }
.topbar-in { max-width: 1080px; margin: 0 auto; padding: 10px 14px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.brand { font-weight: 600; font-family: var(--rk-serif); letter-spacing: .06em; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: #cfc9c0; text-decoration: none; padding: 6px 12px; border-radius: 8px; }
.nav a.on, .nav a:hover { background: var(--rk-enji); color: #fff; }
.logout { margin-left: auto; color: #cfc9c0; font-size: 13px; }
.main { max-width: 1080px; margin: 0 auto; padding: 16px 14px 60px; }

/* ページ見出し・セレクタ */
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pagehead h1 { font-size: 20px; margin: 8px 0; font-family: var(--rk-serif); color: var(--rk-enji-deep); letter-spacing: .05em; }
.ym-form, .sel-form { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 12px; }

/* 集計バー */
.sumbar { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px;
  background: #fff; border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; border: 1px solid var(--rk-line);
  border-top: 3px solid var(--rk-gold);
  position: sticky; top: 0; z-index: 5; }
.sum { display: flex; flex-direction: column; }
.sl { font-size: 12px; color: #777; }
.sv { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--rk-enji-deep); }
.ss { font-size: 11px; color: #999; }

.inputer-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 13px; color: #555; }
.inputer-row input { width: 180px; }

/* 支部カード */
.bcard { background: #fff; border: 1px solid var(--rk-line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.bcard.skip { opacity: .55; }
.bcard.inactive { opacity: .5; background: #fafaf8; }
.bhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bname { font-weight: 600; }
.bleader { font-size: 12px; color: #888; margin-left: 8px; }
.binfo { font-size: 13px; color: #999; margin: 8px 0 0; }
.chip { font-size: 12px; padding: 3px 10px; border-radius: 8px; white-space: nowrap; }
.st-ok    { background: #eaf3de; color: #3b6d11; }
.st-none  { background: #f1efe8; color: #888; }
.st-dirty { background: #faeeda; color: #854f0b; }

.brow { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 10px; }
.seg { display: inline-flex; border: 1px solid #ccc; border-radius: 8px; overflow: hidden; }
.seg button { border: none; background: #fff; padding: 8px 12px; font-size: 13px; color: #666; }
.seg button.on { background: #f6e9ea; color: var(--rk-enji); font-weight: 600; }
.fld { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: #666; }
.fld input { width: 82px; text-align: right; }
.fld input[type="date"] { width: 150px; text-align: left; }
.grp { border: 1px dashed #ddd; border-radius: 8px; margin: 0; padding: 6px 10px 8px; display: flex; gap: 8px; }
.grp legend { font-size: 11px; color: #999; padding: 0 4px; }
.actions { justify-content: flex-end; }
.err { color: #a32d2d; font-size: 13px; flex: 1; }
.save { background: var(--rk-enji); color: #fff; border: none; border-radius: 8px; padding: 9px 22px; }
.save:hover { background: var(--rk-enji-bright); }
.save:disabled { opacity: .5; }
.empty, .pagenote { color: #888; font-size: 13px; }

/* ダッシュボード */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 12px 0 18px; }
.card { background: #fff; border: 1px solid var(--rk-line); border-radius: 12px; padding: 12px 14px; border-top: 3px solid var(--rk-gold); }
.card .l { font-size: 12px; color: #777; }
.card .v { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--rk-enji-deep); }
.card .v small { font-size: 12px; color: #999; font-weight: 400; }
.delta { font-size: 12px; }
.delta.up { color: #3b6d11; }
.delta.dn { color: #a32d2d; }
.sec { font-size: 14px; font-weight: 600; color: var(--rk-enji-deep); margin: 20px 0 10px; font-family: var(--rk-serif); letter-spacing: .05em; }
.rrow { display: grid; grid-template-columns: minmax(90px, 140px) 1fr 56px; align-items: center; gap: 10px; margin-bottom: 8px; }
.rrow a { font-size: 13px; color: var(--rk-enji); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track { display: block; height: 14px; background: #eceae3; border-radius: 7px; overflow: hidden; }
.fillbar { display: block; height: 100%; background: var(--rk-enji-bright); border-radius: 7px; }
.rv { font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.hl2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.panel { background: #fff; border: 1px solid var(--rk-line); border-radius: 12px; padding: 12px 14px; }
.panel h3 { font-size: 13px; margin: 0 0 8px; }
.panel.good h3 { color: #3b6d11; }
.panel.warn h3 { color: #854f0b; }
.li { display: flex; justify-content: space-between; font-size: 13px; padding: 5px 0; border-top: 1px solid #f0eee8; }
.li:first-of-type { border-top: none; }
.li .lv { color: #777; font-variant-numeric: tabular-nums; }

/* コメント */
.cbox { background: #fff; border: 1px solid var(--rk-line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.cbox h3 { font-size: 13px; margin: 0 0 8px; color: #555; }
.cmt { border-left: 3px solid var(--rk-gold); padding: 4px 10px; margin: 8px 0; }
.cmt.reply { border-left-color: var(--rk-enji-bright); margin-left: 18px; }
.cmt .meta { font-size: 12px; color: #888; }
.cmt p { margin: 4px 0 0; white-space: pre-wrap; }
.cform { display: grid; gap: 6px; margin-top: 10px; }
.cform .row2 { display: flex; gap: 8px; }
.cform input { flex: 1; }
.cform textarea { min-height: 60px; }
.cform button { background: var(--rk-enji); color: #fff; border: none; border-radius: 8px; padding: 8px 18px; justify-self: end; }

/* 一覧テーブル */
.scrollx { overflow-x: auto; background: #fff; border: 1px solid var(--rk-line); border-radius: 12px; }
table.g { border-collapse: collapse; width: 100%; min-width: 860px; font-variant-numeric: tabular-nums; font-size: 13px; }
.g thead th { position: sticky; top: 0; background: #fff; text-align: right; font-weight: 600; color: #777;
  padding: 9px 10px; border-bottom: 2px solid var(--rk-gold); white-space: nowrap; }
.g thead th.l { text-align: left; }
.g td { padding: 8px 10px; border-bottom: 1px solid #f0eee8; text-align: right; white-space: nowrap; }
.g td.l { text-align: left; }
.g .sub { font-size: 11px; color: #aaa; }
.g tr.grp-row td { background: var(--rk-cream); font-weight: 600; color: #555; text-align: left; }
.g tr.tot td { background: #faf9f6; font-weight: 600; }
.g tr.dtot td { background: #f6e9ea; color: var(--rk-enji-deep); font-weight: 600; }
.k { font-size: 12px; padding: 2px 8px; border-radius: 8px; }
.k-held { background: #eaf3de; color: #3b6d11; }
.k-not  { background: #fcebeb; color: #a32d2d; }
.k-skip { background: #f1efe8; color: #999; }
.pct-warn { background: #faeeda; color: #854f0b; border-radius: 6px; padding: 2px 6px; }
.pct-good { background: #eaf3de; color: #3b6d11; border-radius: 6px; padding: 2px 6px; }
.muted { color: #aaa; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: 12px; color: #777; }

/* ログイン */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--rk-dark); margin: 0;
  font-family: -apple-system, "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif; }
.login-box { background: #fff; border: 1px solid var(--rk-line); border-top: 3px solid var(--rk-gold); border-radius: 14px;
  padding: 28px 26px; width: 92%; max-width: 380px; box-shadow: 0 18px 50px rgba(0,0,0,.4); }
.login-box h1 { font-size: 17px; margin: 0 0 16px; font-family: var(--rk-serif); color: var(--rk-enji-deep); letter-spacing: .05em; }
.login-box form { display: grid; gap: 10px; }
.login-box button { background: var(--rk-enji); color: #fff; border: none; border-radius: 8px; padding: 11px; }
.login-box button:hover { background: var(--rk-enji-bright); }
.login-error { color: #a32d2d; font-size: 13px; }
.login-note { font-size: 12px; color: #999; }

/* 事務局 */
.admin-sec { background: #fff; border: 1px solid var(--rk-line); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; }
.admin-sec h2 { font-size: 15px; margin: 0 0 8px; font-family: var(--rk-serif); color: var(--rk-enji-deep); }
.admin-sec p { font-size: 13px; color: #666; }

@media (min-width: 700px) {
  .pagehead h1 { font-size: 22px; }
  .fld input { width: 92px; }
}
