:root {
  --bg: #fafafa;
  --fg: #1a1a1a;
  --muted: #666;
  --accent: #2563eb;
  --border: #d4d4d4;
  --danger: #b91c1c;
}

* { box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; margin: 0; background: var(--bg); color: var(--fg); }

/* ---------------- Login page ---------------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { background: white; padding: 32px; border-radius: 12px; border: 1px solid var(--border); width: 100%; max-width: 420px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.login-card h1 { margin: 0 0 4px; }
.login-card .muted { color: var(--muted); margin: 0 0 20px; }
.login-card input { width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; margin-bottom: 12px; }
.login-card button { width: 100%; font: inherit; font-size: 15px; font-weight: 600; padding: 10px; background: var(--accent); color: white; border: none; border-radius: 6px; cursor: pointer; }
.login-card button:hover:not(:disabled) { opacity: 0.92; }
.login-card button:disabled { opacity: 0.6; cursor: wait; }
.login-card .error { color: var(--danger); background: #fee2e2; padding: 8px 12px; border-radius: 6px; font-size: 14px; margin: 12px 0 0; }

/* ---------------- Viewer ---------------- */
.site-header { background: white; border-bottom: 1px solid var(--border); padding: 12px 24px; }
.site-header-inner { max-width: 800px; margin: 0 auto; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.header-id { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.header-id strong { font-size: 16px; }
.header-id .muted { color: var(--muted); font-size: 14px; }
.year-summary { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.year-chip { display: flex; flex-direction: column; align-items: center; line-height: 1.1; padding: 4px 14px; background: #e0e7ff; color: #3730a3; border-radius: 8px; font-size: 12px; }
.year-chip-label { font-weight: 500; opacity: 0.85; }
.year-chip-value { font-size: 18px; font-weight: 700; }
.year-chip-value small { font-size: 11px; font-weight: 400; opacity: 0.7; margin-left: 1px; }
.logout-btn { font: inherit; font-size: 13px; padding: 6px 12px; background: white; border: 1px solid var(--border); border-radius: 4px; cursor: pointer; color: var(--muted); }
.logout-btn:hover { color: var(--fg); border-color: #999; }
@media (max-width: 540px) {
  .year-summary { margin-left: 0; }
}

main { max-width: 800px; margin: 24px auto; padding: 0 16px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.error { color: var(--danger); padding: 12px; background: #fee2e2; border-radius: 6px; }

/* Trimester navigation */
.tri-nav { display: flex; align-items: center; gap: 10px; margin: 16px 0 20px; flex-wrap: wrap; }
.nav-btn { display: inline-block; padding: 4px 12px; background: var(--accent); color: white; text-decoration: none; border-radius: 4px; font-size: 13px; font-weight: 500; }
.nav-btn:hover { opacity: 0.88; }
.nav-btn.disabled { background: #e5e7eb; color: #9ca3af; cursor: default; padding: 4px 10px; }
.tri-label { flex: 1; text-align: center; }
.tri-name { display: block; font-weight: 600; font-size: 15px; }
.tri-score { display: block; font-size: 2rem; font-weight: 700; line-height: 1.2; }
.tri-score small { font-size: 1rem; font-weight: 400; color: var(--muted); margin-left: 2px; }
.grade-total { font-size: 2.6rem; font-weight: 700; margin: 0 0 20px; }
.grade-total small { font-size: 1.3rem; font-weight: 400; color: var(--muted); margin-left: 4px; }

.bucket { background: white; border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.bucket h2 { margin: 0 0 8px; font-size: 1.2rem; }
.bucket h2 small { color: var(--muted); font-weight: normal; font-size: 0.85em; }

.activity { padding: 10px 0; border-bottom: 1px solid #eee; }
.activity:last-child { border-bottom: none; }
.activity h3 { margin: 4px 0 6px; }
.activity h3 small { color: var(--muted); font-weight: normal; }

.criteria { width: 100%; border-collapse: collapse; margin: 6px 0; font-size: 14px; }
.criteria th { text-align: left; padding: 4px 6px; background: #f3f4f6; }
.criteria td { padding: 4px 6px; border-bottom: 1px solid #eee; }
.criteria td.num { text-align: right; width: 90px; font-variant-numeric: tabular-nums; }
.criteria td.flags { text-align: right; width: 80px; }
.flag { background: #fef3c7; color: #92400e; padding: 1px 6px; border-radius: 3px; font-size: 11px; }

.badge { background: #fde68a; color: #78350f; padding: 1px 6px; border-radius: 3px; font-size: 11px; margin-left: 6px; }

.comment { background: #f9fafb; border-left: 3px solid var(--accent); padding: 6px 10px; margin: 6px 0; font-style: italic; }
