/* Shared design language.
   Taken from the Lead Sheets dashboard so both of Craig's products feel like
   they came from the same place. Loaded by every page; public.css and
   admin.css add only what is specific to their side. */

:root {
  /* Surfaces. The page is a very pale blue-grey and cards are pure white,
     which is what gives the Lead Sheets look its airiness. A mid-grey page
     would make the same cards look heavy. */
  --bg:        #F2F4F8;
  --surface:   #FFFFFF;
  --line:      #ECEFF4;

  /* Near-black navy rather than a mid navy. Used for headings, the active
     pill and primary buttons. */
  --ink:       #1B2437;
  --ink-soft:  #4A5468;
  --muted:     #8A93A5;

  /* Category colours. These appear as small dots and as pale block fills.
     Nothing is ever distinguished by colour alone; the dot always sits
     beside a word. */
  --blue:      #4A7DFF;
  --coral:     #F2663C;
  --purple:    #A855F7;
  --green:     #2FB37A;
  --amber:     #E0A32E;

  --blue-pale:   #EDF2FF;
  --coral-pale:  #FDEDE8;
  --purple-pale: #F6EDFE;
  --green-pale:  #E7F7EF;
  --amber-pale:  #FDF4E4;

  --radius:    18px;
  --radius-sm: 12px;
  --pill:      999px;

  --rail:      236px;
  --content:   1320px;

  /* The rail sits a shade lighter than the page, as on Lead Sheets, with the
     active row a shade darker so it reads as pressed. */
  --rail-bg:     #F8F9FB;
  --rail-active: #ECEFF4;
  --gap:       20px;

  --shadow:    0 1px 3px rgba(27, 36, 55, .04), 0 10px 30px rgba(27, 36, 55, .05);
  --shadow-sm: 0 1px 2px rgba(27, 36, 55, .05);

  /* Filled blocks: the active pill, buttons, the "next school day" card.
     Kept separate from --ink because in night mode the text goes light but
     a filled button must stay a solid colour with light text on it. */
  --fill:       #1B2437;
  --fill-hover: #121A2A;
  --on-fill:    #FFFFFF;
  --line-strong: #DCE2EB;

  /* Chip text: a darker shade of each category colour, readable on its
     pale fill. */
  --coral-ink:  #C2451F;
  --green-ink:  #1C7A52;
  --amber-ink:  #9A6B10;
  --blue-ink:   #2A55C7;
  --purple-ink: #7B32C4;

  color-scheme: light;
}

/* ------------------------------------------------------------ night mode
   Follows the phone or computer setting by default ("Auto"). A parent can
   force Day or Night with the switch at the top of the page, which sets
   data-theme on <html>. The same values are written twice because CSS has
   no way to say "dark, unless they chose light" in one rule. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F141E; --surface: #182030; --line: #263043; --line-strong: #34405A;
    --ink: #EEF1F7; --ink-soft: #B7C0D1; --muted: #8C96AA;
    --blue-pale: #1C2848; --coral-pale: #3A231F; --purple-pale: #2D2140;
    --green-pale: #15322A; --amber-pale: #352A16;
    --coral-ink: #FF9C7E; --green-ink: #72D9AA; --amber-ink: #F0C36A;
    --blue-ink: #92B2FF; --purple-ink: #CFA3FF;
    --fill: #3B4B6E; --fill-hover: #47597F; --on-fill: #FFFFFF;
    --shadow: 0 1px 3px rgba(0, 0, 0, .25), 0 10px 30px rgba(0, 0, 0, .25);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --rail-bg: #121926; --rail-active: #1F293B;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F141E; --surface: #182030; --line: #263043; --line-strong: #34405A;
  --ink: #EEF1F7; --ink-soft: #B7C0D1; --muted: #8C96AA;
  --blue-pale: #1C2848; --coral-pale: #3A231F; --purple-pale: #2D2140;
  --green-pale: #15322A; --amber-pale: #352A16;
  --coral-ink: #FF9C7E; --green-ink: #72D9AA; --amber-ink: #F0C36A;
  --blue-ink: #92B2FF; --purple-ink: #CFA3FF;
  --fill: #3B4B6E; --fill-hover: #47597F; --on-fill: #FFFFFF;
  --shadow: 0 1px 3px rgba(0, 0, 0, .25), 0 10px 30px rgba(0, 0, 0, .25);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --rail-bg: #121926; --rail-active: #1F293B;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Poppins, system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -.02em; }
h1 { font-size: 30px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }

p { margin: 0; }

/* ------------------------------------------------------------------ shell */

.shell { display: flex; min-height: 100vh; }

/* The rail stays put while the page scrolls, so the class list and the
   jump links are always one click away. It scrolls on its own if a short
   laptop screen cannot fit all of it. */
.rail {
  width: var(--rail);
  flex: none;
  background: var(--rail-bg);
  padding: 22px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky; top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
}

.rail__brand { display: flex; align-items: center; gap: 12px; padding: 0 6px; text-decoration: none; }
.rail__brand > span { min-width: 0; }
.rail__name, .rail__sub { display: block; }
/* A round mark with a soft shadow under it, like the Lead Sheets leaf. */
.rail__mark {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  background: var(--fill);
  border-radius: 50%;
  color: var(--on-fill);
  box-shadow: 0 6px 14px rgba(27, 36, 55, .22);
}
.rail__name { font-size: 15px; font-weight: 600; line-height: 1.2; }
.rail__sub { color: var(--muted); font-size: 11px; }

.rail__label {
  padding: 0 12px 6px;
  color: var(--muted);
  font-size: 10px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
}

.rail__nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.rail__nav a {
  display: flex; align-items: center; gap: 12px;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--ink-soft);
  font-size: 13.5px; font-weight: 500;
  text-decoration: none;
  transition: background-color .12s ease, color .12s ease;
}
.rail__nav a .icon { color: var(--muted); flex: none; transition: color .12s ease; }
.rail__nav a:hover { background: var(--rail-active); color: var(--ink); }
.rail__nav a:hover .icon { color: var(--ink-soft); }
.rail__nav a.is-active { background: var(--rail-active); color: var(--ink); font-weight: 600; }
.rail__nav a.is-active .icon { color: var(--ink); }

.rail__foot { margin-top: auto; padding: 0 12px; color: var(--muted); font-size: 11px; display: grid; gap: 10px; }
.rail__foot a { font-weight: 500; }
.rail__staff {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--ink-soft); font-size: 13px; text-decoration: none;
}
.rail__staff:hover { color: var(--ink); }

/* Outline icons sit on the text baseline and take the text colour. */
.icon { display: block; flex: none; }

/* ------------------------------------------------- round icon button */

.iconbtn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-soft);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  list-style: none;
}
.iconbtn::-webkit-details-marker { display: none; }
.iconbtn:hover { color: var(--ink); }
.iconbtn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* Day / night button: a moon while it is day, a sun while it is night. */
.themetoggle { border: 0; padding: 0; font: inherit; }
.themetoggle__sun { display: none; }
.themetoggle__moon { display: grid; }
:root[data-theme="dark"] .themetoggle__sun { display: grid; }
:root[data-theme="dark"] .themetoggle__moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .themetoggle__sun { display: grid; }
  :root:not([data-theme="light"]) .themetoggle__moon { display: none; }
}

/* Status chip, the "Live" pill on Lead Sheets. */
.status {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 12px;
  border-radius: var(--pill);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 12px; font-weight: 600;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}
.status__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.status--open { background: var(--green-pale); color: var(--green-ink); box-shadow: none; }
.status--open .status__dot { background: var(--green); }
.status--break { background: var(--amber-pale); color: var(--amber-ink); box-shadow: none; }
.status--break .status__dot { background: var(--amber); }

.page { flex: 1; min-width: 0; }
.main { flex: 1; min-width: 0; padding: 28px 32px 72px; }
/* Phone only: the top bar, the strip of page that closes the menu, and
   New update in the menu. */
.tbar, .page__shade, .rail__compose { display: none; }
.main__inner { max-width: 1240px; margin: 0 auto; }

/* ------------------------------------------------------------- page head */

.phead { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.phead__kicker { color: var(--muted); font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.phead__sub { margin-top: 4px; color: var(--muted); font-size: 13px; }

/* Pill toggle group, as used for Director / Sales manager and Week / Month. */
.toggle { display: flex; gap: 6px; flex-wrap: wrap; }
.toggle a, .toggle button {
  border: 1px solid var(--line);
  border-radius: var(--pill);
  background: var(--surface);
  padding: 8px 18px;
  color: var(--ink-soft);
  font: inherit; font-size: 13px; font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}
.toggle a:hover { border-color: var(--line-strong); color: var(--ink); }
.toggle a.is-active, .toggle button.is-active {
  background: var(--fill);
  border-color: var(--fill);
  color: var(--on-fill);
  font-weight: 600;
}

/* ---------------------------------------------------------------- cards */

/* Anything marked hidden stays hidden, whatever display a class gives it. */
[hidden] { display: none !important; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.card__title { display: flex; align-items: center; gap: 8px; }
/* Bigger cards: a small grey line saying when or what, then the title.
   Small stat tiles keep the coloured dot instead. */
.card__titles { min-width: 0; }
.card__kicker { color: var(--muted); font-size: 12px; margin-bottom: 2px; }
.card__titles h3 { font-size: 16px; }
.card__when { color: var(--muted); font-size: 12px; }
.card__link { color: var(--blue); font-size: 13px; font-weight: 500; text-decoration: none; }
.card__link:hover { text-decoration: underline; }

.section { margin-top: 60px; }
.section__label {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 10px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
}

/* align-items: start stops a short card being stretched to match a tall
   neighbour, which is what leaves a slab of empty white under things like
   the maths card. */
.grid { display: grid; gap: var(--gap); align-items: start; }
/* A row of peer tiles reads as one band, so those stay equal height. Only
   mixed-content rows get the start alignment above. */
.grid--even { align-items: stretch; }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------------------------------------------------------------- bits */

/* The small coloured dot used beside a label, as on the stat tiles. */
.dot { width: 8px; height: 8px; flex: none; border-radius: 50%; display: inline-block; }
.dot--blue { background: var(--blue); }
.dot--coral { background: var(--coral); }
.dot--purple { background: var(--purple); }
.dot--green { background: var(--green); }
.dot--amber { background: var(--amber); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: var(--pill);
  padding: 4px 11px;
  font-size: 11px; font-weight: 600;
  white-space: nowrap;
}
.chip--coral  { background: var(--coral-pale);  color: var(--coral-ink); }
.chip--green  { background: var(--green-pale);  color: var(--green-ink); }
.chip--amber  { background: var(--amber-pale);  color: var(--amber-ink); }
.chip--blue   { background: var(--blue-pale);   color: var(--blue-ink); }
.chip--purple { background: var(--purple-pale); color: var(--purple-ink); }
.chip--ink    { background: var(--fill); color: var(--on-fill); }

/* A circular icon badge, like the orange sun on the "This week" card. */
.badge {
  width: 46px; height: 46px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 19px;
}
.badge--coral  { background: var(--coral-pale);  color: var(--coral); }
.badge--blue   { background: var(--blue-pale);   color: var(--blue); }
.badge--green  { background: var(--green-pale);  color: var(--green); }
.badge--purple { background: var(--purple-pale); color: var(--purple); }
.badge--amber  { background: var(--amber-pale);  color: var(--amber); }

/* The full-width strip at the top of the dashboard. */
.strip {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 20px;
  box-shadow: var(--shadow-sm);
  font-size: 14px; font-weight: 500;
}
.strip__spacer { flex: 1; }

/* A thin progress track. */
.meter { height: 7px; border-radius: var(--pill); background: var(--bg); overflow: hidden; }
.meter__fill { height: 100%; border-radius: var(--pill); background: var(--green); }

.flashes { padding: 14px 32px 0; }
.flashes p {
  max-width: 1240px; margin: 0 auto 8px;
  background: var(--surface);
  border-left: 3px solid var(--green);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
  font-size: 13px;
}

/* ------------------------------------------------------------- narrow */

@media (max-width: 1080px) {
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--3 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  /* The menu sits behind the page, full height on the left. The menu
     button slides the page to the right to show it, leaving a strip of
     the page in view, as in the ChatGPT app; a tap on the strip, or a
     swipe back, slides it home again. */
  /* The parent pages' older design (public/class.html, not offered) keeps
     its menu as a strip across the top. */
  .shell:not([data-shell]) { flex-direction: column; }
  .shell:not([data-shell]) .rail {
    width: 100%; flex-direction: row; align-items: center; gap: 16px;
    padding: 12px 16px; overflow-x: auto; position: static; height: auto;
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .shell:not([data-shell]) .rail__label, .shell:not([data-shell]) .rail__foot { display: none; }
  .shell:not([data-shell]) .rail__nav { grid-auto-flow: column; gap: 4px; }
  .shell:not([data-shell]) .rail__nav a { white-space: nowrap; padding: 8px 12px; }
  .rail__group--optional { display: none; }
  [data-shell] { display: block; --drawer: min(82vw, 330px); }
  [data-shell] .rail {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 1;
    width: var(--drawer); height: 100vh; height: 100dvh;
    padding: calc(env(safe-area-inset-top, 0px) + 22px) 16px calc(env(safe-area-inset-bottom, 0px) + 18px);
    border-right: 0; gap: 22px;
    transform: translateX(-24px); opacity: .6;
    transition: transform .3s cubic-bezier(.2, .8, .2, 1), opacity .3s;
    visibility: hidden;
  }
  [data-shell] .rail__nav a { padding: 11px 12px; font-size: 15px; }
  [data-shell] .rail__nav a .icon { width: 20px; height: 20px; }
  [data-shell] .rail__label { padding-left: 12px; }
  /* New update: a pill at the foot of the menu, like ChatGPT's Chat. */
  .rail__compose {
    display: inline-flex; align-items: center; gap: 10px; align-self: flex-start;
    margin: auto 0 0 4px; padding: 13px 22px; border-radius: 999px;
    background: var(--blue); color: #fff; font-weight: 600; font-size: 15px; text-decoration: none;
    box-shadow: 0 8px 20px rgba(74, 125, 255, .35);
  }
  .rail__compose + .rail__foot { margin-top: 0; }
  [data-shell] .page {
    position: relative; z-index: 2; min-height: 100vh;
    background: var(--bg);
    transition: transform .3s cubic-bezier(.2, .8, .2, 1), border-radius .3s, box-shadow .3s;
  }
  /* Open: the page is held where it was (fixed, at its scroll position),
     then slid across; only the part on screen is shown, with rounded
     corners, against the menu's lighter background. */
  [data-shell] .rail { background: var(--surface); }
  [data-shell].is-held .page { position: fixed; left: 0; right: 0; }
  [data-shell].is-open .rail { transform: none; opacity: 1; visibility: visible; }
  [data-shell].is-open .page {
    transform: translateX(var(--drawer));
    clip-path: inset(var(--clip-top, 0px) 0 var(--clip-bottom, 0px) 0 round 28px);
  }
  [data-shell].is-open .page__shade { display: block; position: absolute; inset: 0; z-index: 50; border: 0; padding: 0; margin: 0; background: transparent; border-radius: 0; }
  /* The bar across the top: menu, where you are, new update. */
  .tbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 10px;
    padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 10px;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  }
  .tbar__btn {
    width: 44px; height: 44px; flex: none; margin: 0; padding: 0; display: grid; place-items: center;
    border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
    box-shadow: 0 2px 8px rgba(15, 23, 42, .06); text-decoration: none;
  }
  .tbar__btn:hover { background: var(--surface); }
  .tbar__btn--blank { visibility: hidden; }
  .tbar__title { flex: 1; min-width: 0; text-align: center; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tbar__title b { font-weight: 600; }
  .main { padding: 8px 16px 56px; }
  h1 { font-size: 25px; }
  .flashes { padding: 12px 16px 0; }
}

@media (max-width: 620px) {
  .grid--4, .grid--2 { grid-template-columns: minmax(0, 1fr); }
  .phead { flex-direction: column; }
  /* A long event title such as "Children return after Half Term at 8:40am"
     will not fit on one line in a phone-width card, so the chip wraps here
     rather than running off the edge. */
  .chip { white-space: normal; }
}

/* ------------------------------------------------------------- bento */

/* Twelve columns, so a section can be any width rather than everything
   landing in halves and thirds. A page of equal boxes reads as a
   spreadsheet; varied sizes let the important things look important. */
.bento {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--gap);
  align-items: start;
}
.bento--even { align-items: stretch; }

.c3  { grid-column: span 3; }
.c4  { grid-column: span 4; }
.c5  { grid-column: span 5; }
.c6  { grid-column: span 6; }
.c7  { grid-column: span 7; }
.c8  { grid-column: span 8; }
.c9  { grid-column: span 9; }
.c12 { grid-column: span 12; }

@media (max-width: 1180px) {
  .c3 { grid-column: span 6; }
  .c4, .c5 { grid-column: span 6; }
  .c7, .c8, .c9 { grid-column: span 12; }
}
@media (max-width: 700px) {
  .c3, .c4, .c5, .c6, .c7, .c8, .c9 { grid-column: span 12; }
  /* Half width on a phone: short facts sit two to a row as squares
     instead of each taking a full-width strip. */
  .m6 { grid-column: span 6; }
}

/* --------------------------------------------------------- pop-up notes

   With scripts on, "Saved" style messages appear as a note at the foot of
   the screen and fade after a few seconds, so the page can stay where it
   was. Without scripts they sit at the top as before. */
.flashes--toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 100;
  transform: translateX(-50%);
  width: max-content; max-width: calc(100vw - 32px);
  padding: 0;
  animation: note-in .25s ease-out;
  transition: opacity .3s ease, transform .3s ease;
  cursor: pointer;
}
.flashes--toast p {
  margin: 6px 0 0;
  background: var(--fill); color: var(--on-fill);
  border-left: 0;
  border-radius: 14px;
  padding: 13px 20px;
  font-size: 14px; font-weight: 500;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .25);
}
.flashes--toast.is-gone { opacity: 0; transform: translate(-50%, 12px); pointer-events: none; }
@keyframes note-in { from { opacity: 0; transform: translate(-50%, 12px); } }
@media (prefers-reduced-motion: reduce) { .flashes--toast { animation: none; transition: none; } }
