:root {
  --bg: #f4f2ee;
  --card: #ffffff;
  --text: #1f1d1a;
  --muted: #6b665e;
  --line: #e2ded6;
  --accent: #2f5d50;
  --accent-text: #ffffff;
  --ok-bg: #e5f1ec;
  --ok: #1f5c47;
  --err-bg: #fbe9e6;
  --err: #9a2f1f;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161514;
    --card: #211f1d;
    --text: #ece8e1;
    --muted: #a39d93;
    --line: #35322e;
    --accent: #6fb39c;
    --accent-text: #0f1a16;
    --ok-bg: #1d3029;
    --ok: #9fd9c3;
    --err-bg: #3a201b;
    --err: #f0a596;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--card);
}
.brand { font-weight: 700; text-decoration: none; color: var(--text); }
.top nav a { font-size: 14px; }

main { margin: 24px auto; padding: 0 16px; }
main.narrow { max-width: 440px; }
main.wide { max-width: 1000px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 20px; margin-bottom: 16px;
}
h1 { font-size: 22px; margin: 0 0 8px; }
h2 { font-size: 17px; margin: 0 0 8px; }
.lead { color: var(--muted); margin: 0 0 16px; font-size: 14px; }
.note, .hint { color: var(--muted); font-size: 13px; margin: 4px 0 12px; }
.switch { text-align: center; font-size: 14px; }

label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 12px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 11px 12px;
  font-size: 16px;  /* スマホで勝手に拡大されない大きさ */
  color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { font-family: inherit; resize: vertical; }

button {
  width: 100%; padding: 12px; border: 0; border-radius: 8px; cursor: pointer;
  background: var(--accent); color: var(--accent-text); font-size: 16px; font-weight: 700;
}
button.sub { background: transparent; color: var(--text); border: 1px solid var(--line); font-weight: 500; }
button.small { width: auto; padding: 6px 10px; font-size: 13px; }
button.danger { background: var(--err); color: #fff; }
button.link { width: auto; padding: 0; background: none; color: var(--accent); font-size: 14px; font-weight: 500; }
form.inline { display: inline; }

.row { display: flex; flex-wrap: wrap; gap: 8px; }
.row form { flex: 1 1 180px; }

.msg { padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.msg.error { background: var(--err-bg); color: var(--err); }
.msg.ok { background: var(--ok-bg); color: var(--ok); }

.status { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 12px 0 0; font-size: 15px; }
.status dt { color: var(--muted); }
.status dd { margin: 0; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: var(--line); }
.badge.on { background: var(--ok-bg); color: var(--ok); }
.badge.off { background: var(--err-bg); color: var(--err); }

.placeholder {
  border: 2px dashed var(--line); border-radius: 10px; padding: 48px 16px;
  text-align: center; color: var(--muted);
}

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-bottom: 16px; }
.stats div { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.stats span { display: block; font-size: 12px; color: var(--muted); }
.stats b { font-size: 22px; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid .full { grid-column: 1 / -1; }

.issued { border-color: var(--accent); }
.issued textarea { margin-bottom: 8px; }
.sendbox { padding-top: 12px; border-top: 1px solid var(--line); margin-top: 12px; }
.sendbox:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.keyline { margin: 0 0 6px; font-weight: 700; }
code { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 14px; }

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; white-space: nowrap; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 12px; }

/* 会員ページのメニュー */
.menu { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.menu a {
  display: block; padding: 16px; border-radius: 12px; text-decoration: none;
  background: var(--card); border: 1px solid var(--line); color: var(--text);
}
.menu a:hover { border-color: var(--accent); }
.menu b { display: block; font-size: 16px; }
.menu span { display: block; font-size: 13px; color: var(--muted); }

/* お知らせ */
.news { padding: 12px 0; border-top: 1px solid var(--line); }
.news:first-of-type { border-top: 0; }
.news .date { margin: 0; font-size: 12px; color: var(--muted); }
.news h2 { margin: 2px 0 4px; }
.news p { margin: 0; }
