:root {
  --pool-deep: #38bdf8;   /* bright accent blue for text/borders on dark surfaces */
  --pool-blue: #0ea5e9;
  --pool-light: #7dd3fc;
  --pe-orange: #fb923c;
  --pe-yellow: #fde047;
  --health-red: #fb7185;
  --ink: #eef4fb;
  --ink-soft: #93a5c2;
  --paper: #0a0f1e;
  --card: #131b30;
  --card-soft: #1b2540;
  --line: #283452;
  --good: #22c55e;
  --bad: #f87171;
  --radius: 22px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.04);
  --glow-pe: 0 0 24px rgba(251, 146, 60, 0.35);
  --glow-swim: 0 0 24px rgba(14, 165, 233, 0.35);
  --glow-health: 0 0 24px rgba(251, 113, 133, 0.35);
}

* { box-sizing: border-box; }

html, body {
  font-size: 20px; /* matches hmh-hub's base scale (classroom-display sizing) so text reads the same size across both apps */
  line-height: 1.5;
}

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
}

a { color: inherit; }

.hero {
  position: relative;
  background: linear-gradient(120deg, #0c4a6e, var(--pool-blue) 55%, var(--pool-light));
  color: #fff;
  padding: 28px 32px 46px;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 34px;
  background: var(--paper);
  clip-path: polygon(0 40%, 5% 55%, 10% 40%, 15% 55%, 20% 40%, 25% 55%, 30% 40%, 35% 55%, 40% 40%, 45% 55%, 50% 40%, 55% 55%, 60% 40%, 65% 55%, 70% 40%, 75% 55%, 80% 40%, 85% 55%, 90% 40%, 95% 55%, 100% 40%, 100% 100%, 0 100%);
}
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.hero h1 { margin: 0; font-size: 1.7rem; display: flex; align-items: center; gap: 10px; }
.hero p.tag { margin: 4px 0 0; color: #eaf7ff; opacity: .9; }

.nav-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.nav-user { margin-left: auto; align-self: center; font-size: .82rem; font-weight: 700; color: #eaf7ff; opacity: .9; padding: 6px 4px; white-space: nowrap; }
.nav-pill {
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: .92rem;
  transition: background .15s, transform .15s;
}
.nav-pill:hover { background: rgba(255,255,255,0.28); transform: translateY(-1px); }
.nav-pill.active { background: #fff; color: #0c4a6e; }

main { max-width: 1100px; margin: 0 auto; padding: 8px 24px 60px; }

.page-title { display: flex; align-items: center; gap: 10px; margin: 18px 0 6px; }
.page-title h2 { margin: 0; font-size: 1.3rem; }

.subject-tabs { display: flex; gap: 8px; margin: 14px 0 18px; }
.subject-tab {
  padding: 8px 18px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--card);
  font-weight: 700;
  cursor: pointer;
  font-size: .9rem;
  color: var(--ink-soft);
}
.subject-tab.active { background: var(--pool-deep); border-color: var(--pool-deep); color: #06131f; }
.subject-tab[data-subject="PE"].active { background: var(--pe-orange); border-color: var(--pe-orange); color: #2c1200; }
.subject-tab[data-subject="Swimming"].active { background: var(--pool-blue); border-color: var(--pool-blue); color: #04222f; }
.subject-tab[data-subject="Health"].active { background: var(--health-red); border-color: var(--health-red); color: #2c0510; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.filters select, .filters input {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: var(--card);
  font-size: .9rem;
  color: var(--ink);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 10px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  font-size: .9rem;
}
.btn-primary { background: linear-gradient(120deg, var(--pe-orange), var(--pe-yellow)); color: #341500; box-shadow: var(--glow-pe); }
.btn-secondary { background: var(--card-soft); border: 1.5px solid var(--line); color: var(--ink); }
.btn-danger { background: rgba(248, 113, 113, 0.16); color: var(--bad); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }

.quarter-section { margin-bottom: 24px; }
.quarter-heading {
  font-size: .8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--pool-deep);
  margin: 0 0 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--line);
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 28px;
  border-top: 5px solid var(--pool-blue);
  transition: transform .18s ease, box-shadow .18s ease;
}
a.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.card.subject-PE { border-top-color: var(--pe-orange); }
.card.subject-Swimming { border-top-color: var(--pool-blue); }
.card.subject-Health { border-top-color: var(--health-red); }
.card.subject-PE:hover { box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), var(--glow-pe); }
.card.subject-Swimming:hover { box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), var(--glow-swim); }
.card.subject-Health:hover { box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), var(--glow-health); }

.card-icon {
  width: 68px; height: 68px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.1rem;
  margin-bottom: 16px;
  background: var(--card-soft);
  transition: transform .18s ease;
}
.card:hover .card-icon { transform: scale(1.12) rotate(-4deg); }
.card.subject-PE .card-icon { background: linear-gradient(135deg, var(--pe-orange), var(--pe-yellow)); box-shadow: var(--glow-pe); }
.card.subject-Swimming .card-icon { background: linear-gradient(135deg, var(--pool-blue), var(--pool-light)); box-shadow: var(--glow-swim); }
.card.subject-Health .card-icon { background: linear-gradient(135deg, var(--health-red), #fda4af); box-shadow: var(--glow-health); }

.card h3 { margin: 0 0 6px; font-size: 1.3rem; }
.card .meta { color: var(--ink-soft); font-size: .92rem; margin-bottom: 10px; line-height: 1.5; }
.card .badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--line);
  color: var(--pool-deep);
  margin-right: 6px;
}
.card .row-actions { display: flex; gap: 8px; margin-top: 10px; }

.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--ink-soft);
}

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(2,6,16,0.65);
  display: none; align-items: center; justify-content: center; z-index: 50;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--card); border-radius: var(--radius); padding: 24px;
  width: 92%; max-width: 420px; box-shadow: 0 20px 50px rgba(0,0,0,0.6);
  border: 1px solid var(--line);
  max-height: 90vh; overflow-y: auto;
}
.modal.modal-wide { max-width: 720px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.landscape-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) {
  .field-row, .landscape-grid { grid-template-columns: 1fr; }
}
.modal h3 { margin-top: 0; }
.field { margin-bottom: 12px; display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: .82rem; font-weight: 700; color: var(--ink-soft); }
.field select, .field input, .field textarea {
  padding: 9px 10px; border-radius: 9px; border: 1.5px solid var(--line); font-size: .92rem;
  font-family: inherit; background: var(--card-soft); color: var(--ink);
}
.field textarea { width: 100%; resize: vertical; min-height: 3.2em; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1b2540; color: #eef4fb; padding: 10px 20px; border-radius: 10px;
  border: 1px solid var(--line);
  font-size: .88rem; z-index: 80; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }

@media print {
  .hero, .nav-pills, .filters, .btn, .subject-tabs { display: none !important; }
  /* Paper is always light regardless of the on-screen dark theme - force every surface and
     text color back to a normal light document for physical printing, site-wide, rather than
     patching this per page. Individual pages still handle their own layout (hiding chrome,
     A5/landscape @page rules) - this block only handles color safety. */
  body, .card, .modal, table, th, td, .card-icon { background: #fff !important; color: #111 !important; box-shadow: none !important; }
  * { color: #111 !important; border-color: #ccc !important; }
  .card, table, th, td { border-color: #ccc !important; }
}
