/* Victory Christian School — Parent App
   Thesis: Victory's torch on royal blue, worn like a letterman jacket — proud, calm, built for a tired parent's thumb.
   School colors are blue and white. Signature: the royal header with the white torch and two white "jersey stripes"
   along its base. Everything else stays quiet. */

:root {
  --royal: #004abd;
  --royal-deep: #00318a;
  --royal-ink: #0b1f45;
  --on-royal: #ffffff;
  --on-royal-soft: #c9dbff;
  --paper: #f7f9fd;
  --card: #ffffff;
  --ink: #1a1a1a;
  --muted: #5b6474;
  --line: #e2e8f2;
  --focus: #4d8dff;
  --sky: #eaf1fd;

  --font-display: "DM Serif Display", Georgia, "Times New Roman", serif;
  --font-body: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --r-card: 18px;
  --r-btn: 14px;
  --gutter: 20px;
  --tap: 52px;
  --shadow: 0 1px 2px rgba(11, 31, 69, .06), 0 6px 18px rgba(11, 31, 69, .06);

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--royal); }
button { font: inherit; }
svg { display: block; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
.masthead :focus-visible { outline-color: #fff; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.shell { width: 100%; max-width: 560px; margin: 0 auto; }

/* ---- Header (the signature) ---------------------------------------------------------------------------------- */

.masthead {
  position: relative;
  background: var(--royal);
  color: #fff;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) var(--gutter) 34px;
  overflow: hidden;
}
/* A soft glow behind the torch; static, no animation. */
.masthead::before {
  content: "";
  position: absolute;
  inset: -40% -30% auto auto;
  width: 360px; height: 360px;
  background: radial-gradient(closest-side, rgba(255, 255, 255, .14), rgba(255, 255, 255, 0));
  pointer-events: none;
}
/* Jersey stripes: white, navy gap, white. */
.masthead::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 12px;
  background: linear-gradient(to bottom,
    var(--on-royal) 0 4px, var(--royal-deep) 4px 7px, var(--on-royal) 7px 9px, var(--royal-deep) 9px 12px);
}

.brand { position: relative; display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 44px; height: 48px; color: var(--on-royal); flex: none; }
.brand-words { display: flex; flex-direction: column; line-height: 1; }
.brand-name { font-family: var(--font-display); font-size: 27px; letter-spacing: .03em; text-transform: uppercase; }
.brand-sub {
  margin-top: 5px; font-size: 11px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--on-royal-soft);
}
/* Preview banner: on until launch (data-preview="on", filled in by the server), friendly and clearly not an error. */
.preview-banner {
  position: relative;
  display: flex; align-items: center; gap: 9px;
  width: fit-content; max-width: 100%;
  margin: 18px 0 0; padding: 7px 14px 7px 11px;
  border: 1px solid rgba(255, 255, 255, .38); border-radius: 14px;
  background: rgba(255, 255, 255, .1);
  color: #fff; font-size: 13px; font-weight: 500; line-height: 1.35; text-wrap: balance;
}
.preview-banner[data-preview="off"] { display: none; }
.preview-dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; flex: none; box-shadow: 0 0 0 3px rgba(255, 255, 255, .22); }
.preview-banner + .greeting { margin-top: 20px; }
.page-title + .preview-banner { margin-top: 14px; }

.greeting { position: relative; margin: 26px 0 0; font-family: var(--font-display); font-size: 32px; line-height: 1.1; font-weight: 400; }
.greeting-sub { position: relative; margin: 8px 0 20px; color: rgba(255, 255, 255, .82); font-size: 15px; }

.btn-signin {
  position: relative;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-height: 58px; padding: 0 18px 0 20px;
  border: 0; border-radius: var(--r-btn);
  background: var(--on-royal); color: var(--royal);
  font-size: 17px; font-weight: 600; text-decoration: none; cursor: pointer;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .22);
}
.btn-signin:active { transform: translateY(1px); box-shadow: none; }
.btn-signin svg { width: 22px; height: 22px; flex: none; }
.btn-signin small { display: block; font-size: 12px; font-weight: 500; opacity: .75; }

/* ---- Body ---------------------------------------------------------------------------------------------------- */

.content { padding: 26px var(--gutter) calc(env(safe-area-inset-bottom, 0px) + 28px); }

.section-label {
  margin: 0 0 12px; font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
}
.section-label + .tiles { margin-bottom: 30px; }

.tiles { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }

.tile {
  display: flex; flex-direction: column; justify-content: space-between; gap: 18px;
  width: 100%; min-height: 128px; padding: 16px;
  border: 1px solid var(--line); border-radius: var(--r-card);
  background: var(--card); color: var(--ink);
  text-align: left; text-decoration: none; cursor: pointer;
  box-shadow: var(--shadow);
}
.tile:active { background: var(--sky); }
.tile-icon {
  display: grid; place-items: center;
  width: 46px; height: 46px; border-radius: 13px;
  background: var(--sky); color: var(--royal);
}
.tile-icon svg { width: 24px; height: 24px; }
.tile-label { display: flex; align-items: center; justify-content: space-between; font-size: 17px; font-weight: 600; line-height: 1.2; }
.tile-label svg { width: 18px; height: 18px; color: var(--royal); flex: none; }

/* A long name ("Announcements" on a 390pt phone) breaks at a syllable with a hyphen, never mid-letters. */
.tile-label { min-width: 0; gap: 6px; }
.tile-label { hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word; }

/* Install card */
.install-card {
  display: flex; align-items: center; gap: 14px;
  margin: 0 0 30px; padding: 16px;
  border-radius: var(--r-card); background: var(--royal-ink); color: #fff; text-decoration: none;
}
.install-card img { width: 48px; height: 48px; border-radius: 12px; flex: none; }
.install-card strong { display: block; font-size: 16px; font-weight: 600; }
.install-card span { display: block; font-size: 13px; color: rgba(255, 255, 255, .78); }
.install-card svg { width: 20px; height: 20px; margin-left: auto; color: var(--on-royal); flex: none; }

/* Footer */
.footer { border-top: 1px solid var(--line); padding-top: 18px; display: grid; gap: 10px; }
.footer-link {
  display: flex; align-items: center; gap: 12px; min-height: var(--tap);
  color: var(--ink); text-decoration: none; font-weight: 500;
}
.footer-link svg { width: 20px; height: 20px; color: var(--royal); }
.fineprint { margin: 18px 0 0; font-size: 12px; color: var(--muted); }

.notice {
  margin: 0 0 20px; padding: 14px 16px; border-radius: 12px;
  background: var(--sky); color: var(--royal-ink); font-size: 14px;
}

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
  transform: translateX(-50%);
  max-width: calc(100% - 40px); padding: 12px 16px; border-radius: 12px;
  background: var(--royal-ink); color: #fff; font-size: 14px; text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}

/* ---- Install guide -------------------------------------------------------------------------------------------- */

.masthead.slim { padding-bottom: 26px; }
.back {
  position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 44px;
  color: #fff; text-decoration: none; font-weight: 500;
}
.back svg { width: 18px; height: 18px; transform: rotate(180deg); }
.page-title { position: relative; margin: 10px 0 0; font-family: var(--font-display); font-size: 30px; line-height: 1.1; font-weight: 400; }

.steps { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 12px; counter-reset: step; }
.step {
  display: grid; grid-template-columns: 40px 1fr; gap: 14px; align-items: center;
  padding: 16px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--card); box-shadow: var(--shadow);
  font-size: 17px; line-height: 1.35;
}
.step::before {
  counter-increment: step; content: counter(step);
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--royal); color: #fff; font-weight: 600; font-size: 18px;
}
.step b { font-weight: 600; }
.glyph {
  display: inline-grid; place-items: center; vertical-align: middle;
  width: 30px; height: 30px; margin: -4px 2px 0; border-radius: 8px;
  background: var(--sky); color: var(--royal);
}
.glyph svg { width: 18px; height: 18px; }
.step-note { margin: 0 0 22px; color: var(--muted); font-size: 14px; }
/* The last line of every guide: what "done" looks like, so nobody wonders whether it worked. */
.step-done {
  display: flex; align-items: center; gap: 12px; margin: 0 0 22px; padding: 14px 16px;
  border-radius: var(--r-card); background: var(--sky); color: var(--royal-ink); font-size: 15px; line-height: 1.4;
}
.step-done img { width: 40px; height: 40px; border-radius: 10px; flex: none; }

.btn-royal {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 56px; border: 0; border-radius: var(--r-btn);
  background: var(--royal); color: #fff; font-size: 17px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn-quiet {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: 52px;
  border: 1px solid var(--line); border-radius: var(--r-btn); background: var(--card); color: var(--ink);
  font-size: 16px; font-weight: 500; cursor: pointer;
}
.other-phones { margin: 26px 0 0; font-size: 14px; color: var(--muted); text-align: center; }
.other-phones p { margin: 0; }
.other-phones a { display: inline-block; padding: 10px 6px; }

[hidden] { display: none !important; }

/* Uploaded logo (Manager can replace the torch): sits where the torch does, never taller than the wordmark. */
.brand-logo { height: 48px; width: auto; max-width: 120px; object-fit: contain; flex: none; }

/* ---- From the school (announcements) ---- */
.news { list-style: none; margin: 0 0 30px; padding: 0; display: grid; gap: 12px; }
.news-item {
  padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-card);
  background: var(--card); box-shadow: var(--shadow);
}
.news-item.is-pinned { border-left: 4px solid var(--royal); }
.news-meta { margin: 0 0 4px; font-size: 12px; font-weight: 600; letter-spacing: .04em; color: var(--muted); }
.news-title { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.3; }
.news-body { margin: 6px 0 0; font-size: 15px; white-space: pre-line; overflow-wrap: anywhere; }
.news-link {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin-top: 4px;
  font-weight: 600; text-decoration: none; color: var(--royal);
}
.news-link svg { width: 16px; height: 16px; }

/* ---- School alerts card ---- */
.alerts-card {
  display: flex; align-items: center; gap: 14px; margin: 0 0 30px; padding: 16px;
  border-radius: var(--r-card); background: var(--sky); color: var(--royal-ink);
}
.alerts-text { flex: 1; min-width: 0; }
.alerts-text strong { display: block; font-size: 16px; font-weight: 600; }
.alerts-text span { display: block; font-size: 13px; }
.btn-small { width: auto; min-height: 44px; padding: 0 18px; font-size: 15px; flex: none; }
.btn-royal[disabled] { opacity: .6; cursor: progress; }

/* Inside a phone-sized frame (our desktop preview, or another site's phone frame): no desktop scrollbar, like a real
   phone. A wide frame on another site keeps its scrollbar, as a page on a computer would. */
.in-frame:not(.embedded) { scrollbar-width: none; }
.in-frame:not(.embedded)::-webkit-scrollbar { display: none; }
@media (max-width: 767px) {
  .embedded { scrollbar-width: none; }
  .embedded::-webkit-scrollbar { display: none; }
}

/* ---- Taps feel instant -----------------------------------------------------------------------------------------
   No double-tap-to-zoom wait on anything tappable, and a pressed look on the very first frame (transform only, so it
   never re-lays out the page). */
a, button, .tile { touch-action: manipulation; }
.tile, .btn-signin, .install-card, .btn-royal, .btn-quiet, .footer-link, .news-link { transition: transform .12s ease-out; }
.tile:active, .install-card:active, .btn-royal:active, .btn-quiet:active { transform: scale(.97); }
.btn-signin:active { transform: translateY(1px) scale(.985); }

/* The Home Screen app is already installed: no install card, from the first paint. */
@media (display-mode: standalone) { .install-card { display: none; } }
/* The Home Screen app draws under the status bar, and newer iOS lays a soft fade below it that reaches past the
   reported safe area. Give the masthead clear room there (and a floor, for when the inset reads 0). */
@media (display-mode: standalone) {
  .masthead { padding-top: calc(max(env(safe-area-inset-top, 0px), 44px) + 30px); }
}

/* ---- The hand-off to FACTS: the school's blue with the torch, faded in on the tap (opacity + transform only, under
   200ms), held until FACTS paints so there's never a white flash. Reduced motion: it simply appears. */
.opening {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: var(--royal); color: #fff;
  opacity: 0; transition: opacity .16s ease-out;
}
.opening.is-on { opacity: 1; }
.opening-inner { display: grid; justify-items: center; gap: 14px; transform: scale(.96); transition: transform .18s ease-out; }
.opening.is-on .opening-inner { transform: none; }
.opening-mark { width: 56px; height: 62px; color: #fff; }
.opening-text { margin: 0; font-size: 17px; font-weight: 500; letter-spacing: .01em; }

/* Computer-only pieces, hidden on phones (the tablet and desktop rules below show them). */
.phone-panel { display: none; }
.variant-label { display: none; }
.for-touch { display: none; }
@media (pointer: coarse) {
  .for-touch { display: inline; }
  .for-pointer { display: none; }
}

/* The install page on a computer at any width: the code to scan, then both phones' steps. */
.qr-card {
  margin: 0 0 26px; padding: 22px; border: 1px solid var(--line); border-radius: var(--r-card);
  background: var(--card); box-shadow: var(--shadow); text-align: center;
}
.qr-title { margin: 0 0 14px; font-family: var(--font-display); font-weight: 400; font-size: 26px; line-height: 1.15; color: var(--royal-ink); }
.qr { display: block; width: 200px; height: 200px; margin: 0 auto 14px; border-radius: 12px; }
.qr-text { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.qr-url { margin: 0 0 12px; font-weight: 600; color: var(--royal-ink); overflow-wrap: anywhere; }
.is-desktop .variant-label {
  display: block; margin: 0 0 12px; font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
}
.is-desktop section[data-variant="android"] { margin-top: 10px; }

/* ---- The app's own screens: Calendar and Announcements ----------------------------------------------------------- */
.empty-state { margin: 0 0 24px; padding: 18px; border: 1px dashed var(--line); border-radius: var(--r-card); color: var(--muted); font-size: 15px; text-align: center; }
.news.earlier .news-item { box-shadow: none; }

.cal-month { margin: 0 0 26px; }
.events { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.event {
  display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 14px; align-items: start;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--card); box-shadow: var(--shadow);
}
.event-date {
  display: grid; justify-items: center; align-content: center; width: 56px; height: 60px; border-radius: 12px;
  background: var(--sky); color: var(--royal); line-height: 1;
}
.event-dow { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.event-day { margin-top: 4px; font-family: var(--font-display); font-size: 26px; }
.event-title { margin: 2px 0 2px; font-size: 17px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.event-meta { margin: 0; font-size: 14px; color: var(--muted); }
.event-details { margin: 6px 0 0; font-size: 15px; white-space: pre-line; overflow-wrap: anywhere; }

.feed-card { margin: 0 0 24px; padding: 18px; border-radius: var(--r-card); background: var(--sky); color: var(--royal-ink); }
.feed-title { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.feed-card p { margin: 0 0 14px; font-size: 14px; }
.feed-download { display: inline-block; margin-top: 10px; padding: 8px 0; font-size: 14px; font-weight: 500; }

/* ---- Send an Excuse: one card, big boxes for a thumb, every message under its own box ---------------------------- */
.excuse-form, .sent-card {
  padding: 20px 18px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--card); box-shadow: var(--shadow);
}
.form-intro { margin: 0 0 20px; font-size: 15px; color: var(--muted); }
.form-intro b { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.form-alert { margin: 0 0 18px; padding: 12px 14px; border-radius: 12px; background: #fdecea; color: #8a1c12; font-size: 15px; font-weight: 500; }
/* Empty, it takes no room but stays in place, so the screen reader is already listening when a message arrives. */
.form-alert:empty { margin: 0; padding: 0; }

.field { margin: 0 0 18px; }
.field > label:not(.file-pick), .field-title { display: block; margin: 0 0 6px; font-size: 15px; font-weight: 600; color: var(--ink); }
.optional { font-weight: 400; color: var(--muted); }
.field-hint { margin: -2px 0 8px; font-size: 13px; color: var(--muted); }
.field-hint.after { margin: 8px 0 0; }
/* 17px type: iPhones zoom into any box under 16px. The edge passes 3:1 on white (WCAG non-text contrast). */
.field input, .field textarea {
  display: block; width: 100%; min-height: var(--tap); margin: 0; padding: 12px 14px;
  border: 1px solid #858fa1; border-radius: 12px; background: #fff; color: var(--ink);
  font: inherit; font-size: 17px; line-height: 1.4;
  -webkit-appearance: none; appearance: none;
}
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--royal); }
.field [aria-invalid="true"] { border-color: #b42318; }
.field-error { margin: 6px 0 0; font-size: 14px; font-weight: 500; color: #b42318; }
.field-error:empty { display: none; }

/* The file box itself is hidden (iPhone's own is plain grey); its label is the button, and opens the same menu:
   Photo Library, Take Photo, Choose File. Keyboard focus on the box shows on the button. */
.field .file-input {
  position: absolute; width: 1px; height: 1px; min-height: 0; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); opacity: 0;
}
.file-pick {
  display: flex; align-items: center; justify-content: center; gap: 10px; min-height: var(--tap); padding: 0 16px;
  border: 1.5px dashed var(--royal); border-radius: 12px; background: var(--sky); color: var(--royal);
  font-size: 16px; font-weight: 600; cursor: pointer;
}
.file-pick svg, .file-chosen svg { width: 20px; height: 20px; flex: none; }
.file-input:focus-visible + .file-pick, .file-input:focus-visible ~ .file-chosen { outline: 3px solid var(--focus); outline-offset: 3px; }
.file-input[aria-invalid="true"] + .file-pick { border-color: #b42318; }
.file-chosen {
  display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 4px 4px 4px 14px;
  border-radius: 12px; background: var(--sky); color: var(--royal-ink);
}
.file-chosen svg { color: var(--royal); }
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 500; }
.file-size { flex: none; font-size: 13px; color: var(--muted); }
.file-remove {
  flex: none; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px;
  background: none; color: var(--royal); font-size: 15px; font-weight: 600; cursor: pointer;
}

.form-section { margin: 24px 0 14px; padding-top: 20px; border-top: 1px solid var(--line); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.excuse-form .btn-royal { margin-top: 24px; }
.form-sample { margin: 12px 0 0; font-size: 14px; color: var(--muted); text-align: center; }

.sent-card { display: grid; justify-items: center; gap: 10px; padding: 28px 20px 20px; text-align: center; }
.sent-card:focus { outline: none; }
.sent-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--royal); color: #fff; }
.sent-icon svg { width: 28px; height: 28px; }
.sent-title { margin: 6px 0 0; font-family: var(--font-display); font-size: 27px; font-weight: 400; line-height: 1.15; color: var(--royal-ink); }
.sent-text { margin: 0; font-size: 15px; }
.sent-text b { font-weight: 600; overflow-wrap: anywhere; }
.sent-card .btn-royal { margin-top: 12px; }
.sent-card a.btn-quiet { text-decoration: none; }
.nowrap { white-space: nowrap; }
.excuse-page .footer { margin-top: 26px; border-top: 0; padding-top: 0; }
.file-remove, .file-pick { transition: transform .12s ease-out; }
.file-pick:active { transform: scale(.98); }

/* Smallest phones (320pt): a little less padding. */
@media (max-width: 359px) {
  :root { --gutter: 16px; }
  .greeting { font-size: 28px; }
}

@media (min-width: 420px) {
  .greeting { font-size: 36px; }
}

/* Large phones held sideways and small windows: the phone layout sits as one card, so it reads as an app rather than
   a stretched page. */
@media (min-width: 640px) {
  .shell {
    margin: 32px auto; border-radius: 28px; overflow: hidden; background: var(--paper);
    box-shadow: 0 0 0 1px var(--line), 0 24px 60px rgba(11, 31, 69, .12);
  }
  body:not(.preview-page):not(.flyer-page) { background: var(--sky); }
}

/* ---- Tablets and computers (768px and up): a page of its own, not a stretched phone ----------------------------------
   A full-width top bar (brand, preview pill, Sign in to FACTS) over a welcome band, both on royal with the jersey
   stripes underneath, then a wide content area. Everything lines up on one centred column of at most 1200px. */
@media (min-width: 768px) {
  :root { --max: 1200px; --wide-gutter: 32px; --bar-h: 84px; }

  body.app-page:not(.preview-page):not(.flyer-page) { background: var(--paper); }
  .app-page .shell { max-width: none; margin: 0; border-radius: 0; overflow: visible; box-shadow: none; background: none; }

  .app-page .masthead {
    padding: env(safe-area-inset-top, 0px) 0 12px;
    background: linear-gradient(to bottom, var(--royal-deep) 0 var(--bar-h), var(--royal) var(--bar-h));
  }
  .app-page .masthead::before { inset: -120px 6% auto auto; width: 560px; height: 560px; }
  .masthead-inner {
    position: relative; max-width: var(--max); margin: 0 auto; padding: 0 var(--wide-gutter) 46px;
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: var(--bar-h) auto auto auto;
    column-gap: 24px; align-items: center;
  }
  .app-page .brand { grid-area: 1 / 1; }
  .app-page .brand-mark { width: 40px; height: 44px; }
  .app-page .brand-name { font-size: 25px; }
  .app-page .btn-signin {
    grid-area: 1 / 3; width: auto; min-height: 54px; padding: 0 16px 0 20px; gap: 16px; font-size: 16px;
    box-shadow: 0 1px 0 rgba(0, 0, 0, .25); transition: background-color .15s, transform .15s;
  }
  .app-page .btn-signin small { font-size: 11.5px; }
  .app-page .btn-signin:hover { background: var(--sky); }
  .app-page .btn-signin:focus-visible { outline-color: #fff; outline-offset: 4px; }
  /* Tablets: the pill gets its own line under the bar; computers fit it in the bar (below). */
  .app-page .masthead .preview-banner { grid-area: 2 / 1 / 3 / 4; margin: 30px 0 0; }
  .app-page .masthead .greeting { grid-area: 3 / 1 / 4 / 4; margin: 22px 0 0; font-size: 46px; }
  .app-page .greeting-sub { grid-area: 4 / 1 / 5 / 4; margin: 10px 0 0; font-size: 18px; }

  .app-page .content { max-width: 800px; margin: 0 auto; padding: 40px var(--wide-gutter) 56px; }
  .app-page .section-label { margin-bottom: 14px; }
  .app-page .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .app-page .tile { min-height: 150px; padding: 20px; transition: border-color .15s, box-shadow .15s, transform .15s; }
  .app-page .tile:hover { border-color: var(--royal); box-shadow: 0 2px 4px rgba(11, 31, 69, .06), 0 14px 30px rgba(11, 31, 69, .1); transform: translateY(-2px); }
  .app-page .tile-label { font-size: 18px; }

  .app-page .alerts-card { padding: 18px 20px; border: 1px solid #d6e3fb; }
  .app-page .footer-link:hover { color: var(--royal); }

  /* The install guide, Calendar and Announcements: back link in the bar, the page's name in the band, then one
     comfortable reading column. */
  .sub-page .back:hover { text-decoration: underline; }
  .sub-page .masthead-inner { grid-template-rows: var(--bar-h) auto auto; }
  .sub-page .back { grid-area: 1 / 1; }
  .sub-page .page-title { grid-area: 2 / 1 / 3 / 4; margin: 26px 0 0; font-size: 42px; }
  .sub-page .masthead .preview-banner { grid-area: 3 / 1 / 4 / 4; margin-top: 16px; }
  /* Same left edge as the bar and the page's name; the reading column itself stays at most 760px. */
  .sub-page .content { max-width: var(--max); }
  .sub-page .content > * { max-width: 760px; }
  .event { padding: 16px 20px; }
  .excuse-page .content > * { max-width: 640px; }
  .excuse-form, .sent-card { padding: 28px; }
}

/* Computers (1024px and up): the pill joins the top bar, and the content becomes two columns: the Family Portal on
   the left, the school's details and the way onto a phone on the right. */
@media (min-width: 1024px) {
  .app-page .masthead .preview-banner { grid-area: 1 / 2; margin: 0; justify-self: start; }
  .app-page .masthead .greeting { grid-area: 2 / 1 / 3 / 4; margin-top: 46px; font-size: 52px; }
  .app-page .greeting-sub { grid-area: 3 / 1 / 4 / 4; }
  .masthead-inner { padding-bottom: 54px; }

  .app-page .content { padding: 48px var(--wide-gutter) 72px; }
  /* Home and Calendar: the main column beside a side column. */
  .home-page .content, .calendar-page .content {
    max-width: var(--max);
    display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 56px; align-items: start;
  }
  .calendar-page .content { grid-template-columns: minmax(0, 760px) 320px; justify-content: start; }
  .calendar-page .content > * { max-width: none; }
  .col-side { position: sticky; top: 24px; display: grid; gap: 18px; }
  .col-side > * { margin: 0; }

  /* On a computer the install card would shout; the side panel offers the phone instead. */
  .col-main .install-card { display: none !important; }
  .phone-panel {
    display: flex; align-items: center; gap: 14px; padding: 14px 18px 14px 12px;
    border: 1px solid var(--line); border-radius: var(--r-card); background: var(--card); box-shadow: var(--shadow);
  }
  .phone-qr { width: 104px; height: 104px; flex: none; border-radius: 8px; }
  .phone-panel-title { margin: 0 0 4px; font-size: 16px; font-weight: 600; color: var(--royal-ink); }
  .phone-panel-text p { margin: 0 0 8px; font-size: 13px; line-height: 1.45; color: var(--muted); }
  .phone-panel-link { font-size: 13px; font-weight: 600; text-decoration: none; }
  .phone-panel-link:hover { text-decoration: underline; }
  @media (pointer: coarse) { .phone-qr { display: none; } }

  .app-page .footer {
    padding: 8px 20px 18px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--card); gap: 0;
  }
  .app-page .footer-link { min-height: 48px; border-bottom: 1px solid var(--line); }
  .app-page .footer-link:last-of-type { border-bottom: 0; }
  .app-page .fineprint { margin-top: 10px; }

  .sub-page .page-title { font-size: 46px; }
  .is-desktop .install-page .content {
    max-width: var(--max);
    display: grid; grid-template-columns: 360px minmax(0, 1fr); column-gap: 56px; align-items: start;
    grid-template-areas: "qr iphone" "qr android" "qr .";
    grid-template-rows: auto auto 1fr;
  }
  .is-desktop .install-page .content > * { max-width: none; }
  .is-desktop .qr-card { grid-area: qr; position: sticky; top: 24px; margin: 0; }
  .is-desktop section[data-variant="iphone"] { grid-area: iphone; }
  .is-desktop section[data-variant="android"] { grid-area: android; margin-top: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
