:root {
  --shu: #c8102e;
  --shu-dark: #9e0c24;
  --sakura: #fdecee;
  --sakura-2: #f9d5da;
  --ink: #2b2226;
  --muted: #7a6d71;
  --line: #eadfe1;
  --bg: #fbf8f8;
  --card: #fff;
  --gray: #eceaea;
  font-family: "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", "IPAPGothic", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f1e9eb;
    --muted: #b3a5a9;
    --line: #3b3034;
    --bg: #1b1618;
    --card: #251e21;
    --sakura: #3a2328;
    --sakura-2: #4a2a31;
    --gray: #3a3336;
  }
}

* { box-sizing: border-box; }
body { margin: 0; line-height: 1.6; background: var(--bg); }
a { color: var(--shu); text-decoration: none; }
a:hover { text-decoration: underline; }
main { max-width: 1120px; margin: 0 auto; padding: 20px 16px 48px; }
h1 { font-size: 1.5rem; margin: 8px 0 16px; }
h1 small { font-size: .9rem; color: var(--muted); font-weight: normal; }
h2 { font-size: 1.05rem; margin: 0 0 12px; border-left: 4px solid var(--shu); padding-left: 8px; }
small { color: var(--muted); }
.mono { font-family: ui-monospace, monospace; font-size: .9em; }

/* ヘッダー */
.top {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 10px 20px; background: var(--card); border-bottom: 3px solid var(--shu);
}
.brand { font-weight: bold; color: var(--ink); font-size: 1.1rem; }
.brand small { margin-left: 6px; font-weight: normal; }
.torii { color: var(--shu); }
.top nav { display: flex; gap: 4px; flex: 1; }
.top nav a { padding: 6px 12px; border-radius: 6px; color: var(--ink); white-space: nowrap; }
.top nav a.on, .top nav a:hover { background: var(--sakura); text-decoration: none; }
.me { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.me img { border-radius: 50%; }
.me span { display: flex; flex-direction: column; line-height: 1.2; }
button.link { background: none; border: none; color: var(--shu); cursor: pointer; font: inherit; padding: 4px; }

/* ログイン */
.login { max-width: 420px; margin: 12vh auto 0; text-align: center; background: var(--card); padding: 40px 24px; border-radius: 16px; border: 1px solid var(--line); }
.login h1 { margin: 4px 0; }
.login .sub { color: var(--muted); margin-top: 0; }
.torii.big { font-size: 56px; line-height: 1; }
.error { background: var(--sakura); color: var(--shu-dark); padding: 10px; border-radius: 8px; }
.note { color: var(--muted); font-size: .85rem; }
.button { display: inline-block; padding: 10px 20px; border-radius: 8px; font-weight: bold; }
.button.primary { background: #5865f2; color: #fff; margin: 12px 0; }
.button.primary:hover { background: #4752c4; text-decoration: none; }

/* 数字 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stat .label { color: var(--muted); font-size: .85rem; }
.stat .value { font-size: 1.8rem; font-weight: bold; }
.stat .value small { font-size: .9rem; margin-left: 4px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 800px) { .grid2 { grid-template-columns: 1fr; } }
.more { text-align: right; margin: 8px 0 0; }
.empty { color: var(--muted); }
.crumbs { color: var(--muted); font-size: .9rem; margin: 0; }

/* 絞り込み */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filters input, .filters select, .filters button {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink);
}
.filters input[type=search] { flex: 1 1 240px; }
.count { color: var(--muted); margin: 4px 0 8px; }

/* 表 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th { font-size: .85rem; color: var(--muted); font-weight: normal; background: var(--sakura); }
td.num, th.num { text-align: right; }
table.members { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
tr.left td { color: var(--muted); }
tr.revoked td { color: var(--muted); text-decoration: line-through; }
table.compact td, table.compact th { padding: 6px 8px; font-size: .9rem; }
.reason { display: block; white-space: normal; }
.who { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.who span { display: flex; flex-direction: column; line-height: 1.25; }
.avatar { border-radius: 50%; flex: none; }
.avatar.blank { display: inline-block; background: var(--gray); }
.avatar.s28 { width: 28px; height: 28px; }
.avatar.s32 { width: 32px; height: 32px; }
.avatar.s64 { width: 64px; height: 64px; }
.pager { display: flex; gap: 16px; justify-content: center; align-items: center; margin-top: 12px; }

.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .8rem; margin-left: 6px; }
.tag.gray { background: var(--gray); color: var(--muted); margin-left: 0; }
.tag.red { background: var(--sakura-2); color: var(--shu-dark); }

/* メンバー詳細 */
.profile { display: flex; gap: 16px; align-items: flex-start; }
.profile > div { flex: 1; min-width: 0; }
.profile h1 { margin: 0; }
.profile .rank { margin: 4px 0 12px; font-size: 1.05rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 20px; margin: 0; }
.facts dt { color: var(--muted); font-size: .8rem; }
.facts dd { margin: 0; }
.facts dd strong { font-size: 1.3rem; color: var(--shu); }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: flex; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: .9rem; }
.timeline time { color: var(--muted); white-space: nowrap; }

@media (max-width: 640px) {
  .top { gap: 8px; padding: 10px 12px; }
  .top nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  .profile { flex-direction: column; }
}

/* 操作 */
a.stat { color: var(--ink); }
a.stat:hover { border-color: var(--shu); text-decoration: none; }
.flash { padding: 10px 14px; border-radius: 8px; margin: 8px 0 12px; }
.flash.ok { background: #e7f5ea; color: #1f5f2e; }
.flash.warn { background: var(--sakura-2); color: var(--shu-dark); }
@media (prefers-color-scheme: dark) {
  .flash.ok { background: #1f3a26; color: #bfe6c8; }
}
.actions { display: grid; gap: 14px; }
.actions form, .memo-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.actions h3 { flex-basis: 100%; margin: 0; font-size: .95rem; }
h3 { font-size: .95rem; margin: 14px 0 6px; }
.actions input, .actions select, .memo-form textarea, .confirm button, .actions button, .memo-form button {
  font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink);
}
.actions input[type=text] { flex: 1 1 200px; }
.memo-form textarea { flex: 1 1 100%; resize: vertical; }
button { cursor: pointer; }
button.danger { background: var(--shu); color: #fff; border-color: var(--shu); }
button.danger:hover { background: var(--shu-dark); }
.confirm { max-width: 560px; margin: 24px auto; }
.confirm form { display: flex; gap: 12px; align-items: center; margin-top: 16px; }
.confirm .cancel { padding: 7px 10px; }
strong.big { font-size: 1.6rem; color: var(--shu); }

/* 申請・相談・設定 */
.application .who { flex-wrap: wrap; margin-bottom: 8px; }
.facts .wide { grid-column: 1 / -1; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.inline-actions input[type=text] { flex: 1 1 220px; }
.inline-actions input, .inline-actions select, .inline-actions button, .settings input {
  font: inherit; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink);
}
button.ok { background: #2f7d45; color: #fff; border-color: #2f7d45; }
button.ok:hover { background: #256437; }
td.wrap { white-space: normal; }
.tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.tabs a { padding: 6px 12px; border-radius: 6px; color: var(--ink); border: 1px solid var(--line); }
.tabs a.on { background: var(--sakura); border-color: var(--sakura-2); }
.chat { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; }
.chat li { padding: 10px 12px; border-radius: 10px; max-width: 85%; }
.chat li.sender { background: var(--gray); }
.chat li.staff { background: var(--sakura); margin-left: auto; }
.chat .meta { font-size: .8rem; color: var(--muted); }
.chat .body { white-space: pre-wrap; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field span { font-size: .9rem; }
.field.check { flex-direction: row; align-items: center; gap: 8px; }
.settings table input { width: 110px; }
.settings > p { margin: 16px 0 8px; }
.todo { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.todo a { display: flex; justify-content: space-between; padding: 8px 12px; border-radius: 8px; background: var(--sakura); color: var(--ink); }
.todo a.zero { background: var(--gray); color: var(--muted); }

main button { font: inherit; padding: 7px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); }
main button:hover { border-color: var(--shu); }
main button.link { border: none; background: none; color: var(--shu); padding: 4px; }
main button.danger { background: var(--shu); color: #fff; border-color: var(--shu); }
main button.danger:hover { background: var(--shu-dark); }
main button.ok { background: #2f7d45; color: #fff; border-color: #2f7d45; }
main button.ok:hover { background: #256437; }

/* 掲示 */
a.button-link, a.danger-link { display: inline-block; padding: 7px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); }
a.button-link:hover { border-color: var(--shu); text-decoration: none; }
a.danger-link { color: var(--shu); }
ol.notices { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
ol.notices > li { border-top: 1px solid var(--line); padding-top: 12px; }
ol.notices > li:first-child { border-top: none; padding-top: 0; }
.notice-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline; }
.notice-head small { color: var(--muted); }
.notice-head small.over, .over { color: var(--shu); font-weight: bold; }
.status { font-size: .8rem; padding: 2px 8px; border-radius: 999px; }
.status.st-draft { background: var(--gray); color: var(--muted); }
.status.st-posted { background: #e7f5ea; color: #1f5f2e; }
.status.st-changed { background: var(--sakura-2); color: var(--shu-dark); }
pre.notice-preview { white-space: pre-wrap; word-break: break-word; font: inherit; font-size: .9rem; background: var(--gray); padding: 10px 12px; border-radius: 8px; max-height: 320px; overflow: auto; margin: 8px 0; }
.notice-edit { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.notice-edit pre.notice-preview { max-height: 560px; }
.notice-form { display: grid; gap: 12px; }
.notice-form input, .notice-form select, .notice-form textarea { font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); }
.notice-form textarea { resize: vertical; min-height: 320px; font-size: .9rem; line-height: 1.5; }
code { background: var(--gray); padding: 1px 5px; border-radius: 4px; font-size: .85em; }
@media (max-width: 800px) { .notice-edit { grid-template-columns: 1fr; } }
@media (prefers-color-scheme: dark) {
  .status.st-posted { background: #1f3a26; color: #bfe6c8; }
}
