:root {
  color-scheme: light;
  --navy: #1b3a8c;
  --navy-dark: #12285f;
  --gold: #d9a521;
  --bg: #f4f5f8;
  --surface: #ffffff;
  --text: #16181d;
  --muted: #5b5f6a;
  --faint: #8a8e98;
  --border: #e2e4ea;
  --early: #2a78d6;
  --early-bg: #e3eefb;
  --late: #c93a39;
  --late-bg: #fbe5e4;
  --ok: #1e7d3a;
  --ok-bg: #e2f3e6;
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
a { color: var(--navy); }
button, input, select, textarea { font: inherit; }
button {
  cursor: pointer; border: 1px solid var(--navy); background: var(--navy); color: #fff;
  border-radius: 8px; padding: 8px 14px; font-weight: 500;
}
button.secondary { background: var(--surface); color: var(--navy); }
button.small { padding: 4px 10px; font-size: 13px; }
button:disabled { opacity: 0.6; cursor: default; }
input, select, textarea {
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; background: #fff; color: var(--text); width: 100%;
}
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
textarea { min-height: 96px; resize: vertical; }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
.loading { padding: 40px; text-align: center; color: var(--muted); }

/* login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: linear-gradient(180deg, var(--navy) 0 38%, var(--bg) 38%); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 16px; padding: 28px 24px;
  box-shadow: 0 10px 30px rgba(18, 40, 95, 0.18); text-align: center; }
.login-card img { width: 112px; height: 112px; border-radius: 50%; margin: -84px auto 8px; display: block; border: 4px solid #fff; background: #fff; }
.login-card h1 { font-size: 20px; margin: 4px 0 2px; }
.login-card form { text-align: left; margin-top: 12px; }
.login-card button { width: 100%; margin-top: 18px; }
.err { color: var(--late); font-size: 13px; margin-top: 8px; min-height: 1em; }
.ok-msg { color: var(--ok); font-size: 13px; margin-top: 8px; }
.hint { color: var(--muted); font-size: 13px; }

/* shell */
header.top { background: var(--navy); color: #fff; }
.top-inner { max-width: 1100px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.top-inner img { width: 44px; height: 44px; border-radius: 50%; background: #fff; }
.brand { line-height: 1.2; }
.brand b { display: block; font-size: 16px; }
.brand span { font-size: 12px; color: #c8d3f0; }
.who { margin-left: auto; text-align: right; font-size: 13px; }
.who a { color: #fff; margin-left: 10px; }
nav.tabs { background: var(--navy-dark); }
.tabs-inner { max-width: 1100px; margin: 0 auto; padding: 0 8px; display: flex; gap: 2px; overflow-x: auto; }
.tabs-inner a { color: #c8d3f0; text-decoration: none; padding: 10px 12px; white-space: nowrap; border-bottom: 3px solid transparent; font-size: 14px; }
.tabs-inner a.active { color: #fff; border-bottom-color: var(--gold); }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }

h2 { font-size: 20px; margin: 8px 0 4px; }
h3 { font-size: 16px; margin: 0 0 8px; }
.sub { color: var(--muted); margin: 0 0 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.tile .k { font-size: 12px; color: var(--muted); }
.tile .v { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.notice { background: #fff6df; border: 1px solid #f0d78c; color: #6b4e00; border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; font-size: 14px; }
.chart { position: relative; height: 280px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row > select { width: auto; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }

table.data { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
table.data th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; border-bottom: 1px solid var(--border); padding: 6px 8px; }
table.data td { border-bottom: 1px solid var(--border); padding: 7px 8px; }
.scroll { overflow-x: auto; }
.badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; font-weight: 500; }
.b-Early { background: var(--early-bg); color: #164f93; }
.b-Late { background: var(--late-bg); color: #8e2221; }
.b-On { background: var(--ok-bg); color: #155a29; }
.b-role { background: #e8ecf8; color: var(--navy); }
.b-gold { background: #fbefd0; color: #6b4e00; }

/* heat map */
table.heat { border-collapse: separate; border-spacing: 3px; font-size: 13px; width: 100%; font-variant-numeric: tabular-nums; }
table.heat th { color: var(--muted); font-weight: 500; font-size: 12px; }
table.heat td { text-align: center; padding: 6px 4px; border-radius: 5px; min-width: 52px; }
table.heat td.name { text-align: left; background: none; white-space: nowrap; }
table.heat tr.group td { color: var(--faint); font-size: 12px; padding-top: 10px; text-align: left; }

ul.fb { margin: 4px 0 12px; padding-left: 20px; }
ul.fb li { margin: 3px 0; }
.note-meta { font-size: 12px; color: var(--faint); margin-top: 6px; }
.pre { white-space: pre-wrap; }
.temp-pw { font-family: ui-monospace, Consolas, monospace; font-size: 18px; background: #fff6df; padding: 8px 12px; border-radius: 8px; display: inline-block; margin: 6px 0; }
@media (max-width: 600px) {
  .brand span { display: none; }
  .tile .v { font-size: 19px; }
  .chart { height: 240px; }
}
