:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --surface: #fff;
  --text: #16192b;
  --muted: #5b6380;
  --line: #dfe3ee;
  --primary: #116dff;
  --danger: #d6453d;
  --win: #fff7dc;
  font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.6; }
h1, h2, p { margin: 0; }
a { color: var(--primary); }
button { font: inherit; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 18px;
  border: 1.5px solid transparent;
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn:disabled { opacity: .6; cursor: progress; }

/* ログイン */
.login { width: min(100% - 32px, 400px); margin: 12vh auto 0; padding: 32px 24px; border-radius: 16px; background: var(--surface); box-shadow: 0 8px 30px #1a23441a; }
.login h1 { font-size: 1.5rem; }
.login .sub { margin: 4px 0 24px; color: var(--muted); font-size: .875rem; }
.login form { display: grid; gap: 8px; }
.login label { margin-top: 8px; font-weight: 700; font-size: .875rem; }
.login input { min-height: 48px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; font: inherit; font-size: 16px; }
.login button { margin-top: 20px; min-height: 50px; border: 0; border-radius: 10px; background: var(--primary); color: #fff; font-weight: 700; cursor: pointer; }
.status { min-height: 1.5em; color: var(--danger); font-size: .875rem; font-weight: 700; }
.status:empty { display: none; }

/* ダッシュボード */
.bar { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: #16192b; color: #fff; }
.bar h1 { font-size: 1.0625rem; }
.bar-actions { display: flex; gap: 8px; }
.bar .btn.ghost { min-height: 38px; padding: 6px 12px; }
.dash { width: min(100% - 32px, 1120px); margin: 20px auto 48px; display: grid; gap: 20px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.card { padding: 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.card .k { color: var(--muted); font-size: .8125rem; font-weight: 700; }
.card .v { margin-top: 4px; font-size: 1.75rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.card .note { color: var(--muted); font-size: .8125rem; }

.panel { padding: 18px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.panel h2 { margin-bottom: 12px; font-size: 1.0625rem; }
.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.filters { display: flex; gap: 14px; font-size: .875rem; font-weight: 700; }
.filters a[aria-current="page"] { color: var(--text); text-decoration: none; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: .75rem; font-weight: 700; white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.strong { font-weight: 800; }
.nowrap { white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.win td { background: var(--win); }
.empty { color: var(--muted); text-align: center; }

.toggles { display: grid; gap: 4px; }
.toggle { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.toggle:last-child { border-bottom: 0; }
.toggle .t { font-weight: 800; }
.toggle .d { color: var(--muted); font-size: .8125rem; }

.pager { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; font-size: .875rem; }

.warn { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: #fff4d6; color: #6b4a00; font-size: .875rem; font-weight: 700; }
.danger-zone { border-color: #f1b8b4; }
.danger-zone h2 { color: var(--danger); }
.reset-list { margin: 0 0 8px; padding-left: 1.2em; color: var(--muted); font-size: .875rem; }
.reset-form { display: grid; gap: 6px; max-width: 360px; margin-top: 12px; }
.reset-form label { margin-top: 6px; font-size: .8125rem; font-weight: 700; }
.reset-form input { min-height: 44px; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 10px; font: inherit; font-size: 16px; }
.reset-form .btn { margin-top: 12px; }
