/* Toga Hub: mobile-first styles in Falcon red & blue.
   Light/dark: index.html sets <html data-theme="light|dark"> from the
   saved choice or the device setting. */

/* ---------- Color tokens ---------- */
:root {
  --navy: #16337a;
  --blue: #1f4fb0;
  --red: #c8102e;
  --accent: #c8102e;
  --on-brand: #ffffff;

  --bg: #f3f5fa;
  --surface: #ffffff;
  --surface-2: #eef1f8;
  --text: #141b2d;
  --muted: #5d6680;
  --border: #dfe4ef;
  --link: #1f4fb0;
  --focus: #2563eb;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 6px 18px rgba(16, 24, 40, 0.06);

  --red-day: #c8102e;   --red-day-bg: #fde7ea;
  --blue-day: #1f4fb0;  --blue-day-bg: #e3ebfb;
  --off-day: #667085;   --off-day-bg: #eceff4;

  --activities: #6d36b3; --activities-bg: #efe7fa;
  --clubs: #0f766e;      --clubs-bg: #dcf3ef;
  --arts: #b0306e;       --arts-bg: #fbe6f0;
  --academics: #17774e;  --academics-bg: #e2f3ea;
  --college: #0e7490;    --college-bg: #dff2f7;
  --athletics: #1f4fb0;  --athletics-bg: #e3ebfb;
  --community: #a64f00;  --community-bg: #fcefe2;
  --mine: #a16207;       --mine-bg: #fdf3d8;

  --deadline: #b42318;   --deadline-bg: #fde8e6;
  --parents: #5b4bb7;    --parents-bg: #ecebfb;
  --now: #17774e;        --now-bg: #e2f3ea;
  --type: #344054;       --type-bg: #eaecf0;

  --radius: 16px;
  --gutter: 16px;
  --tab-h: 64px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --navy: #0f2257;
  --accent: #ff7a8c;

  --bg: #0b1120;
  --surface: #151c2e;
  --surface-2: #1d2640;
  --text: #eef1f8;
  --muted: #9aa4bd;
  --border: #2a3450;
  --link: #8fb4ff;
  --focus: #8fb4ff;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 18px rgba(0, 0, 0, 0.25);

  --red-day: #ff8a98;   --red-day-bg: #3a1520;
  --blue-day: #8fb4ff;  --blue-day-bg: #162750;
  --off-day: #9aa4bd;   --off-day-bg: #1d2640;

  --activities: #c5a3f2; --activities-bg: #2a1f3b;
  --clubs: #5fd4c4;      --clubs-bg: #10302c;
  --arts: #f29cc4;       --arts-bg: #3a1a2a;
  --academics: #7fd3a8;  --academics-bg: #14302a;
  --college: #7fd4e6;    --college-bg: #12303a;
  --athletics: #8fb4ff;  --athletics-bg: #162750;
  --community: #f5b26f;  --community-bg: #3a2614;
  --mine: #f5cf6b;       --mine-bg: #3a2f10;

  --deadline: #ff9b8f;   --deadline-bg: #3a1c19;
  --parents: #b9b0f5;    --parents-bg: #25213d;
  --now: #7fd3a8;        --now-bg: #14302a;
  --type: #d0d5dd;       --type-bg: #2a3450;
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
}

a { color: var(--link); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

main {
  max-width: 780px;
  margin: 0 auto;
  padding: 16px var(--gutter) 28px;
  outline: none;
}

h1, h2, h3 { line-height: 1.25; }

.muted { color: var(--muted); font-size: 0.92rem; }
.small { font-size: 0.86rem; }
.empty { color: var(--muted); text-align: center; padding: 18px 8px; margin: 0; }

/* ---------- Header & navigation ---------- */
.app-header {
  background: linear-gradient(120deg, var(--navy) 0%, var(--blue) 75%, #2a63d6 100%);
  color: var(--on-brand);
  padding-top: env(safe-area-inset-top);
  border-bottom: 4px solid var(--red);
}
.header-inner {
  max-width: 780px;
  margin: 0 auto;
  padding: 10px var(--gutter);
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  margin-right: auto;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 12px;
  background: #fff;
  color: var(--red);
  font-weight: 900;
  font-size: 1.35rem;
  box-shadow: inset 0 -3px 0 var(--blue);
}
.brand-name { display: block; font-weight: 800; font-size: 1.15rem; letter-spacing: 0.01em; }
.brand-sub { display: block; font-size: 0.78rem; opacity: 0.85; }

.header-tools { display: flex; gap: 6px; }
.header-btn {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 1.15rem;
  text-decoration: none;
  cursor: pointer;
}
.header-btn:hover, .header-btn[aria-current="page"] { background: rgba(255, 255, 255, 0.26); }

.top-nav { display: none; }

.tab-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(16, 24, 40, 0.06);
}
.tab-bar a {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.66rem;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}
.tab-icon { font-size: 1.25rem; line-height: 1; }
.tab-bar a[aria-current="page"] { color: var(--accent); }
.tab-bar a[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: 0; left: 25%; right: 25%;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--accent);
}

@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .tab-bar { display: none; }
  .header-inner { max-width: 1040px; }
  .top-nav { display: flex; gap: 2px; }
  .top-nav a {
    padding: 8px 12px;
    border-radius: 999px;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    opacity: 0.85;
  }
  .top-nav a:hover { opacity: 1; background: rgba(255, 255, 255, 0.14); }
  .top-nav a[aria-current="page"] { opacity: 1; background: rgba(255, 255, 255, 0.24); }
}

/* ---------- Cards & headings ---------- */
.page-title { font-size: 1.65rem; margin: 4px 0 10px; }
.page-sub { margin: 0 0 12px; color: var(--muted); font-size: 0.92rem; }
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.12rem;
  margin: 26px 0 10px;
}
.section-title::before {
  content: "";
  width: 6px; height: 20px;
  border-radius: 3px;
  background: linear-gradient(var(--red), var(--blue));
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card-title { font-size: 1.05rem; margin: 0 0 12px; }
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.card-alert { border-left: 5px solid var(--deadline); }
.mini-head {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 16px 0 8px;
}
.plain-list { margin: 0; padding-left: 20px; }
.plain-list li { margin-bottom: 6px; }
.signature { font-weight: 700; margin-bottom: 4px; }

.text-link { font-weight: 600; text-decoration: none; white-space: nowrap; }
.text-link.small { display: inline-block; margin-top: 10px; font-size: 0.88rem; }
.source-link { display: inline-block; margin: 18px 0 0; }
.text-btn {
  padding: 4px 2px;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}
.icon-btn {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.icon-btn:disabled { opacity: 0.35; cursor: default; }

/* Segmented tabs (Events/Clubs, School/My calendar, theme) */
.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 12px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.seg-btn {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.seg-btn[aria-selected="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

/* ---------- Home ---------- */
.hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 14px;
  padding: 20px 18px 18px;
  border-radius: 20px;
  color: #fff;
  background: linear-gradient(135deg, var(--navy), var(--red));
  box-shadow: var(--shadow);
}
.hero::after {
  content: "";
  position: absolute;
  right: -40px; top: -40px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.09);
}
.hero-red  { background: linear-gradient(135deg, #e0283f, #8e0b21); }
.hero-blue { background: linear-gradient(135deg, #2a63d6, #16337a); }
.hero-greet { margin: 0; font-weight: 600; opacity: 0.9; }
.hero-date { margin: 2px 0 10px; font-size: 1.6rem; }
.hero-day { margin: 0; }
.hero-pill {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--navy);
  font-weight: 800;
  letter-spacing: 0.02em;
}
.hero-red .hero-pill { color: #b00d27; }

.week-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.week-title { text-align: center; }
.week-title .card-title { margin: 0; }

.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.day-chip {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 7px 0 6px;
  min-width: 0;
  border-radius: 12px;
  border: 2px solid transparent;
  font: inherit;
  line-height: 1.15;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.day-chip.day-red  { background: var(--red-day-bg);  color: var(--red-day); }
.day-chip.day-blue { background: var(--blue-day-bg); color: var(--blue-day); }
.day-chip.day-off  { background: var(--off-day-bg);  color: var(--off-day); }
.day-chip.is-today .day-num { text-decoration: underline; text-underline-offset: 3px; }
.day-chip.is-selected { border-color: currentColor; box-shadow: var(--shadow); }
.day-name { font-size: 0.7rem; font-weight: 700; }
.day-num { font-size: 1.3rem; font-weight: 800; }
.day-color { font-size: 0.62rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.02em; }
.day-count {
  position: absolute;
  top: -6px; right: -4px;
  min-width: 18px; height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 18px;
}
.day-count:empty { display: none; }
:root[data-theme="dark"] .day-count { color: #1b0a0e; }
.week-day { margin-top: 14px; }

.deadline-list { list-style: none; margin: 0; padding: 0; }
.deadline-list li + li { border-top: 1px solid var(--border); }
.deadline-list a { display: block; padding: 10px 0; color: inherit; text-decoration: none; }
.deadline-list strong { color: var(--deadline); margin-right: 6px; }

.letter summary { cursor: pointer; list-style: none; }
.letter summary::-webkit-details-marker { display: none; }
.letter summary .card-title { margin: 0; }
.letter summary::after { content: " +"; color: var(--muted); }
.letter[open] summary::after { content: " –"; }

/* ---------- Event rows ---------- */
.event-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.event-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 12px 12px 12px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s ease, box-shadow 0.15s ease;
}
.event-row:hover { box-shadow: var(--shadow); }
.event-row:active { transform: scale(0.99); }
.card .event-row { background: var(--bg); }
.cat-bar { align-self: stretch; width: 5px; margin: -12px 0; flex: 0 0 5px; }
.event-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.event-title { font-weight: 700; line-height: 1.3; }
.event-meta { color: var(--muted); font-size: 0.88rem; }
.chevron { color: var(--muted); font-size: 1.5rem; line-height: 1; }

.badge-line { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.chip, .badge {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
}
.chip.cat-activities { color: var(--activities); background: var(--activities-bg); }
.chip.cat-arts       { color: var(--arts);       background: var(--arts-bg); }
.chip.cat-academics  { color: var(--academics);  background: var(--academics-bg); }
.chip.cat-college    { color: var(--college);    background: var(--college-bg); }
.chip.cat-athletics  { color: var(--athletics);  background: var(--athletics-bg); }
.chip.cat-community  { color: var(--community);  background: var(--community-bg); }
.chip.cat-mine       { color: var(--mine);       background: var(--mine-bg); }
.chip.cat-clubs      { color: var(--clubs);      background: var(--clubs-bg); }
.cat-bar.cat-activities, .dot.cat-activities { background: var(--activities); }
.cat-bar.cat-arts,       .dot.cat-arts       { background: var(--arts); }
.cat-bar.cat-academics,  .dot.cat-academics  { background: var(--academics); }
.cat-bar.cat-college,    .dot.cat-college    { background: var(--college); }
.cat-bar.cat-athletics,  .dot.cat-athletics  { background: var(--athletics); }
.cat-bar.cat-community,  .dot.cat-community  { background: var(--community); }
.cat-bar.cat-mine,       .dot.cat-mine       { background: var(--mine); }
.cat-bar.cat-clubs,      .dot.cat-clubs      { background: var(--clubs); }

.badge-deadline { color: var(--deadline); background: var(--deadline-bg); }
.badge-parents  { color: var(--parents);  background: var(--parents-bg); }
.badge-now      { color: var(--now);      background: var(--now-bg); }
.badge-type     { color: var(--type);     background: var(--type-bg); }
.badge-result   { color: var(--now);      background: var(--now-bg); }
.badge-saved    { color: var(--mine);     background: var(--mine-bg); }
.day-badge.day-red  { color: var(--red-day);  background: var(--red-day-bg); }
.day-badge.day-blue { color: var(--blue-day); background: var(--blue-day-bg); }
.day-badge.day-off  { color: var(--off-day);  background: var(--off-day-bg); }

/* ---------- Activities ---------- */
.filters {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px var(--gutter);
  margin: 0 calc(-1 * var(--gutter));
  background: var(--bg);
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.filter-btn {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 16px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
}
.filter-btn[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
:root[data-theme="dark"] .filter-btn[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.filter-btn.cat-activities[aria-pressed="true"] { background: var(--activities); border-color: var(--activities); color: var(--surface); }
.filter-btn.cat-clubs[aria-pressed="true"]      { background: var(--clubs);      border-color: var(--clubs);      color: var(--surface); }
.filter-btn.cat-arts[aria-pressed="true"]       { background: var(--arts);       border-color: var(--arts);       color: var(--surface); }
.filter-btn.cat-academics[aria-pressed="true"]  { background: var(--academics);  border-color: var(--academics);  color: var(--surface); }
.filter-btn.cat-college[aria-pressed="true"]    { background: var(--college);    border-color: var(--college);    color: var(--surface); }
.filter-btn.cat-athletics[aria-pressed="true"]  { background: var(--athletics);  border-color: var(--athletics);  color: var(--surface); }
.filter-btn.cat-community[aria-pressed="true"]  { background: var(--community);  border-color: var(--community);  color: var(--surface); }

.cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0 0;
}
.count { margin: 0; color: var(--muted); font-size: 0.88rem; }
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.toggle input { width: 20px; height: 20px; accent-color: var(--blue); }

.day-group { margin-top: 14px; }
.day-group.is-past { opacity: 0.6; }
.day-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  margin: 0 0 8px;
}

.club-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.club { margin: 0; border-top: 4px solid var(--blue); }
.club:nth-child(even) { border-top-color: var(--red); }
.club-name { font-size: 1.05rem; margin: 0 0 6px; }
.club p { margin: 0 0 6px; }
.club[hidden] { display: none; }
.club-dir { display: flex; flex-direction: column; border-top-color: var(--clubs); }
.club-dir:nth-child(even) { border-top-color: var(--clubs); }
.club-dir .link-row { margin-top: auto; padding-top: 6px; }
.club-name a { color: inherit; text-decoration: none; }
.club-name a:hover { text-decoration: underline; }
.club-when { display: grid; gap: 6px; margin: 2px 0 6px; font-weight: 600; }
.meet { display: flex; align-items: flex-start; gap: 8px; }
.meet > span:last-child { min-width: 0; padding-top: 1px; }
.meet .day-badge { flex: none; min-width: 52px; text-align: center; font-weight: 800; }
.meet .day-badge.day-red  { background: var(--red-day);  color: #fff; }
.meet .day-badge.day-blue { background: var(--blue-day); color: #fff; }
:root[data-theme="dark"] .meet .day-badge.day-red,
:root[data-theme="dark"] .meet .day-badge.day-blue { color: #14091f; }
.sport-picks { position: static; flex-wrap: wrap; overflow: visible; margin: 4px 0 8px; padding: 0; background: none; }
.club-next a { font-weight: 600; }
.link-btn.is-on { border-color: var(--mine); color: var(--mine); }
.link-btn.primary.is-on { background: var(--mine); border-color: var(--mine); color: #fff; }
.leader-list { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 6px; }
.leader-list li { display: grid; grid-template-columns: 110px 1fr; gap: 8px; align-items: baseline; }

/* Folded group of club meetings in day lists */
.club-group {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.club-group > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  font-weight: 700;
  cursor: pointer;
  color: var(--clubs);
}
.club-group[open] > summary { border-bottom: 1px solid var(--border); }
.club-group .event-list { padding: 8px; }
.club-group > .text-link { display: inline-block; margin: 0 14px 12px; }

/* Counselor finder, bell schedule, footer credit */
#counselor-list .contact[hidden] { display: none; }
#counselor-list .contact.is-match { border-color: var(--clubs); box-shadow: 0 0 0 2px var(--clubs-bg); }
.finals-col.bell-red h3 { color: var(--red-day); }
.finals-col.bell-blue h3 { color: var(--blue-day); }
.hero-bell { margin: 10px 0 0; font-size: 0.9rem; font-weight: 600; opacity: 0.92; }
.app-footer .credit { font-weight: 600; }

/* ---------- Contacts ---------- */
.contact-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.contact {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
}
.contact-name { font-weight: 700; font-size: 0.92rem; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Month calendar ---------- */
.cal-card { padding: 12px; }
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.cal-head-mid { text-align: center; }
.cal-month { margin: 0; font-size: 1.1rem; }

.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-weekdays span {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  padding-bottom: 2px;
}
.cal-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-height: 52px;
  min-width: 0;
  padding: 5px 2px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cal-cell.is-blank { background: none; cursor: default; }
.cal-cell.day-red  { background: var(--red-day-bg); }
.cal-cell.day-blue { background: var(--blue-day-bg); }
.cal-cell.is-past { opacity: 0.55; }
.cal-cell.is-today .cal-num { background: var(--red); color: #fff; }
.cal-cell.is-selected { border-color: var(--text); opacity: 1; }
.cal-num {
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 4px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}
.cal-off { font-size: 0.55rem; font-weight: 700; color: var(--off-day); text-transform: uppercase; line-height: 1; }
.cal-dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; min-height: 7px; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }
.dot-more { font-size: 0.65rem; line-height: 7px; font-weight: 700; color: var(--muted); }
.cal-titles { display: none; }

.cal-legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 12px 0 0;
  padding: 0;
  font-size: 0.78rem;
  color: var(--muted);
}
.cal-legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.swatch.day-red  { background: var(--red-day-bg);  border: 1px solid var(--red-day); }
.swatch.day-blue { background: var(--blue-day-bg); border: 1px solid var(--blue-day); }

.cal-day-panel { margin-top: 6px; }
.cal-day-panel > .link-btn { margin-top: 10px; }

@media (min-width: 1000px) {
  body[data-page="calendar"] main,
  body[data-page="calendar"] .app-footer { max-width: 1120px; }
}
/* Wide screens: show event names inside the day boxes */
@media (min-width: 700px) {
  .cal-cell { align-items: stretch; min-height: 96px; padding: 6px; }
  .cal-num { align-self: flex-start; }
  .cal-off { text-align: left; padding-left: 4px; }
  .cal-dots { display: none; }
  .cal-titles { display: flex; flex-direction: column; gap: 2px; }
  .cal-title {
    display: block;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .cal-title.cat-activities { color: var(--activities); background: var(--activities-bg); }
  .cal-title.cat-clubs      { color: var(--clubs);      background: var(--clubs-bg); }
  .cal-title.cat-arts       { color: var(--arts);       background: var(--arts-bg); }
  .cal-title.cat-academics  { color: var(--academics);  background: var(--academics-bg); }
  .cal-title.cat-college    { color: var(--college);    background: var(--college-bg); }
  .cal-title.cat-athletics  { color: var(--athletics);  background: var(--athletics-bg); }
  .cal-title.cat-community  { color: var(--community);  background: var(--community-bg); }
  .cal-title.cat-mine       { color: var(--mine);       background: var(--mine-bg); }
  .cal-more { font-size: 0.68rem; color: var(--muted); text-align: left; padding-left: 5px; }
}

/* ---------- Event detail & forms ---------- */
.back-btn {
  min-height: 44px;
  margin: 0 0 6px -6px;
  padding: 0 8px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.detail-title { font-size: 1.45rem; margin: 10px 0 14px; outline: none; }
.detail-list { margin: 0; }
.detail-list > div { padding: 10px 0; border-top: 1px solid var(--border); }
.detail-list dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.detail-list dd { margin: 2px 0 0; }
.detail-note { padding-top: 12px; border-top: 1px solid var(--border); margin: 0; }
.action-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.hide-line { margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.9rem; }

@media (min-width: 560px) {
  .detail-list > div { display: grid; grid-template-columns: 130px 1fr; gap: 12px; }
  .detail-list dd { margin: 0; }
}

.form .field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; font-weight: 600; font-size: 0.92rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form input, .form textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-weight: 400;
}
.form textarea { resize: vertical; }
.form-error { color: var(--deadline); font-weight: 600; margin: 0; min-height: 1.2em; }

/* ---------- Buttons ---------- */
.link-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.link-row.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.link-btn.small { min-height: 38px; padding: 6px 12px; font-size: 0.84rem; }
.card .link-btn { background: var(--bg); }
.contact .link-btn { background: var(--surface); }
.link-btn:hover { border-color: var(--muted); }
.link-btn.primary, .card .link-btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.link-btn.primary[aria-pressed="true"] { background: var(--mine); border-color: var(--mine); }
:root[data-theme="dark"] .link-btn.primary { background: #2a63d6; border-color: #2a63d6; }
.link-btn.danger { color: var(--deadline); border-color: var(--deadline); }
.ext { color: var(--muted); font-size: 0.8em; }

/* ---------- News ---------- */
.search-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  margin-bottom: 4px;
}
.search-bar input[type="search"] {
  flex: 1 1 220px;
  min-height: 46px;
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.news-item, .recap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 8px;
  scroll-margin-top: 12px;
}
.news-item summary,
.recap summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  min-height: 52px;
  padding: 12px 40px 12px 14px;
  position: relative;
  cursor: pointer;
  list-style: none;
}
.news-item summary::-webkit-details-marker,
.recap summary::-webkit-details-marker { display: none; }
.news-item summary::after,
.recap summary::after {
  content: "+";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 1.3rem;
}
.news-item[open] summary::after,
.recap[open] summary::after { content: "–"; }
.news-title { font-weight: 700; }
.news-body { padding: 0 14px 14px; }
.news-body p { margin: 0 0 10px; }
.news-body ul { margin: 0 0 10px; padding-left: 20px; }
.news-body li { margin-bottom: 4px; }

/* ---------- Sports ---------- */
.winter-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.winter-card {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.winter-card h3 { margin: 0 0 6px; font-size: 1rem; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.winter-card p { margin: 0 0 4px; font-size: 0.92rem; }
.winter-card .contact-list { margin-top: 8px; }

.recap-list { display: grid; gap: 0; }
.recap summary { flex-wrap: nowrap; align-items: flex-start; }
.recap-emoji { font-size: 1.6rem; line-height: 1.2; }
.recap-head { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.recap-sport { font-weight: 800; }
.recap-record { font-size: 0.85rem; font-weight: 700; color: var(--red-day); }
.recap-line { font-size: 0.9rem; color: var(--muted); }

.coach-list { list-style: none; margin: 0; padding: 0 14px 12px; }
.coach-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
}

/* ---------- Resources ---------- */
.card-crisis { border-left: 5px solid var(--deadline); }
.crisis-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.crisis-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 52px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--deadline-bg);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}
.crisis-btn strong { color: var(--deadline); white-space: nowrap; }
.teacher-card { border-left: 5px solid var(--blue); }

.finals-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.finals-col {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.finals-col h3 { margin: 0 0 6px; font-size: 0.95rem; }
.finals-col dl { margin: 0; }
.finals-col dl > div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  border-top: 1px solid var(--border);
  font-size: 0.86rem;
}
.finals-col dt { font-weight: 600; }
.finals-col dd { margin: 0; color: var(--muted); white-space: nowrap; }

/* ---------- Settings ---------- */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 12px; margin-top: 8px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--blue); }
.hidden-list { list-style: none; margin: 0; padding: 0; }
.hidden-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

/* ---------- Announcements screen (for projecting in class) ---------- */
body[data-page="announce"] .tab-bar,
body[data-page="announce"] .app-footer { display: none; }
body[data-page="announce"] { padding-bottom: 0; }
body[data-page="announce"] main { max-width: 1200px; }
.announce {
  min-height: 70vh;
  padding: 20px 24px 32px;
  border-radius: 24px;
  color: #fff;
  background: linear-gradient(135deg, var(--navy), var(--red));
}
.announce-red  { background: linear-gradient(135deg, #e0283f, #7d0a1d); }
.announce-blue { background: linear-gradient(135deg, #2a63d6, #10265e); }
.announce .text-link { color: #fff; }
.announce-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.announce-nav { display: flex; align-items: center; gap: 8px; }
.announce .icon-btn, .announce .link-btn { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.35); color: #fff; }
.announce .text-btn { color: #fff; }
.announce-date { margin: 18px 0 0; font-size: clamp(1.3rem, 3vw, 2.2rem); font-weight: 700; opacity: 0.95; }
.announce-day {
  display: inline-block;
  margin: 8px 0 0;
  padding: 6px 18px;
  border-radius: 999px;
  background: #fff;
  color: var(--navy);
  font-size: clamp(1.2rem, 3vw, 2rem);
  font-weight: 900;
}
.announce-red .announce-day { color: #b00d27; }
.announce-head { margin: 26px 0 10px; font-size: clamp(1.6rem, 4vw, 3rem); }
.announce-head.small { font-size: clamp(1.2rem, 3vw, 2rem); }
.announce-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.announce-list li {
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.14);
  font-size: clamp(1.05rem, 2.4vw, 1.7rem);
}
.announce-list span { opacity: 0.85; font-size: 0.8em; }
.announce-empty { font-size: clamp(1.1rem, 2.6vw, 1.8rem); opacity: 0.85; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  z-index: 50;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  font-size: 0.92rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 900px) { .toast { bottom: 24px; } }

/* ---------- Footer ---------- */
.app-footer {
  max-width: 780px;
  margin: 0 auto;
  padding: 18px var(--gutter) 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}
.app-footer p { margin: 4px 0; }
