:root {
  --bg: #f6f7fb; --card: #fff; --text: #263238; --muted: #718096; --line: #e8edf3; --accent: #2563eb;
}
* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text); line-height: 1.65; margin: 0; background: var(--bg);
}
.header {
  background: linear-gradient(135deg, #111827, #374151); color: #fff;
  padding: 28px 16px;
}
.header-inner { max-width: 980px; margin: 0 auto; }
.header h1 { font-size: 28px; margin: 0 0 6px; }
.header p { margin: 0; color: #d1d5db; }
.wrap { max-width: 980px; margin: 0 auto; padding: 18px 14px 48px; }
.toolbar {
  position: sticky; top: 0; z-index: 2;
  background: rgba(246, 247, 251, .94); backdrop-filter: blur(8px);
  padding: 12px 0; display: flex; gap: 8px; flex-wrap: wrap;
  align-items: center;
}
.search {
  flex: 1; min-width: 220px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 12px; font-size: 15px;
}
.pill {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 9px 12px; cursor: pointer;
}
.pill.active { background: #111827; color: #fff; border-color: #111827; }
.meta { color: var(--muted); font-size: 13px; margin: 4px 2px 14px; }
.group {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  margin: 16px 0; overflow: hidden; box-shadow: 0 8px 22px rgba(15, 23, 42, .06);
}
.group-head {
  display: flex; align-items: center; gap: 10px; color: #fff;
  padding: 14px 16px; font-weight: 700; font-size: 18px;
}
.group-logo { height: 30px; background: #fff; padding: 3px; border-radius: 6px; }
.item { padding: 16px; border-top: 1px solid var(--line); }
.item:first-of-type { border-top: none; }
.item-date { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.item-title { font-weight: 700; font-size: 16px; color: #111827; text-decoration: none; }
.item-title:hover { text-decoration: underline; }
.item-desc {
  font-size: 14px; color: #4b5563; background: #f9fafb;
  border-left: 4px solid #d1d5db; border-radius: 8px;
  padding: 10px; margin-top: 9px; white-space: pre-line;
}
.item-link { display: inline-block; margin-top: 8px; font-size: 12px; color: var(--accent); word-break: break-all; }
.empty {
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 24px; text-align: center; color: var(--muted);
}
.footer { color: var(--muted); font-size: 12px; text-align: center; margin-top: 24px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}
@media (max-width: 640px) {
  .header h1 { font-size: 23px; }
  .group { border-radius: 14px; }
  .item { padding: 14px; }
}
.upcoming-section {
  margin: 16px 0 18px; padding: 16px; background: #fff;
  border: 1px solid #e5e7eb; border-radius: 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .06);
}
.upcoming-section .section-heading {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.upcoming-section .section-title { font-size: 18px; font-weight: 800; color: #111827; }
.cal-toggle {
  background: none; border: 1px solid var(--line); border-radius: 6px;
  width: 28px; height: 28px; cursor: pointer; font-size: 14px; line-height: 1;
  display: flex; align-items: center; justify-content: center; color: var(--muted);
  flex-shrink: 0;
}
.cal-toggle:hover { background: #f1f5f9; }
.upcoming-section:has(.cal-toggle[aria-expanded="false"]) .cal-body { display: none; }
.cal-nav {
  display: flex; align-items: center; justify-content: center;
  gap: 16px; padding: 6px 0 12px;
}
.cal-nav-btn {
  background: none; border: 1px solid var(--line); border-radius: 8px;
  padding: 4px 12px; cursor: pointer; font-size: 14px; color: var(--text);
}
.cal-nav-btn:hover { background: #f1f5f9; }
.cal-title { font-size: 16px; font-weight: 700; min-width: 120px; text-align: center; }
.cal-grid {
  width: 100%; border-collapse: collapse; table-layout: fixed;
}
.cal-grid th {
  font-size: 11px; font-weight: 700; color: var(--muted);
  padding: 6px 2px; text-align: center; border-bottom: 1px solid var(--line);
}
.cal-day {
  vertical-align: top; padding: 4px; height: 80px;
  border: 1px solid var(--line); position: relative;
}
.cal-day.out { background: #f9fafb; }
.cal-day.past { opacity: 0.45; }
.cal-day.today .cal-day-num {
  background: var(--accent); color: #fff; border-radius: 999px;
  display: inline-block; min-width: 22px; text-align: center;
}
.cal-day-num { font-size: 12px; font-weight: 600; color: var(--text); padding: 1px 3px; }
.cal-events { display: flex; flex-direction: column; gap: 2px; margin-top: 3px; }
.cal-event {
  display: block; font-size: 10px; line-height: 1.3; color: #fff;
  border-radius: 4px; padding: 1px 4px; text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal-event:hover { opacity: .85; }
@media (max-width: 560px) {
  .upcoming-section { padding: 12px; margin: 12px 0 16px; }
  .cal-day { height: 56px; padding: 2px; }
  .cal-day-num { font-size: 10px; }
  .cal-event { font-size: 8px; padding: 1px 2px; }
}
.item-new {
  display: inline-block;
  background: #ef4444; color: #fff; font-size: 10px; font-weight: 700;
  padding: 1px 5px; border-radius: 4px; margin-left: 6px; vertical-align: middle;
  line-height: 1.4;
}
/* Scroll-to-top button */
.scroll-top {
  position: fixed; right: 16px; bottom: 16px; z-index: 10;
  width: 44px; height: 44px; border-radius: 50%;
  background: #111827; color: #fff; border: none;
  font-size: 18px; cursor: pointer; opacity: 0; visibility: hidden;
  transform: translateY(8px); transition: opacity .25s, transform .25s, visibility .25s;
  box-shadow: 0 4px 12px rgba(15,23,42,.25);
  display: flex; align-items: center; justify-content: center;
}
.scroll-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.scroll-top:hover { background: #374151; }
/* Calendar transition */
.cal-body { transition: opacity .25s ease, transform .25s ease; }
.cal-body.cal-fade { opacity: .35; transform: scale(.985); }
[hidden] { display: none !important; }