:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --border: #dcdcdc;
  --accent: #2f6f4f;
  --accent-fg: #ffffff;
  --card-bg: #f7f7f5;
  --today-bg: #fff7d6;
  --today-border: #d9b400;
  --warn-border: #c99a00;
  --warn-bg: #fffbeb;
  --warn-label: #8a6d00;
  --danger-border: #c0392b;
  --danger-bg: #fdecea;
  --danger-label: #a5291b;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --fg: #eaeaea;
    --muted: #9a9a9a;
    --border: #33363c;
    --accent: #4fa878;
    --accent-fg: #0c0c0c;
    --card-bg: #1e2126;
    --today-bg: #3a3316;
    --today-border: #c9a400;
    --warn-border: #ab8400;
    --warn-bg: #2a2410;
    --warn-label: #e0c02e;
    --danger-border: #e0554a;
    --danger-bg: #341715;
    --danger-label: #ff8a80;
  }
}

* { box-sizing: border-box; }

/* The browser's own [hidden] { display: none } lives in the UA stylesheet
   at the same specificity as any single-class author rule (0,1,0) - so
   whichever comes later in the cascade wins, and author CSS always comes
   after the UA sheet. Every component here that sets its own `display`
   (flex, in every case so far) was therefore able to silently override
   .hidden = true and stay visible - found independently four times
   (.picker, .printPopover, .printPopoverBtn, .pickerToggle) before
   settling on one global, ahead-of-everything-else fix instead of
   continuing to patch it component by component. !important is the
   standard, MDN-recommended remedy for this exact interaction - nothing
   here has a legitimate reason to need [hidden] overridden. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  padding-bottom: 3rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.topbar h1 {
  font-size: 1.1rem;
  margin: 0;
}

/* A parent-made tool, not a district one - worn like a rubber stamp so
   nobody mistakes it for official communication. */
.unofficialBadge {
  display: inline-block;
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-weight: 700;
  font-size: 0.6rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--danger-label);
  border: 1.5px solid currentColor;
  border-radius: 4px;
  padding: 0.1em 0.45em;
  transform: rotate(-4deg);
  vertical-align: middle;
  margin-left: 0.4rem;
  opacity: 0.8;
}

.disclaimerLink {
  background: none;
  border: none;
  padding: 0;
  margin-left: 0.4rem;
  font-size: 0.65rem;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
  vertical-align: middle;
}

/* No longer a flex child of .topbar (which stays sticky) - a plain row
   of its own right below it, so it scrolls away with the page instead of
   staying pinned along with the title. */
.topbarButtons {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
}

/* Its own row below .topbarButtons rather than a 4th pill in it - same
   subtle-text-link look as .disclaimerLink, just its own centered line
   since this sentence is much longer than "disclaimer". */
.installHint {
  display: block;
  width: 100%;
  background: none;
  border: none;
  margin: 0;
  padding: 0.4rem 1rem;
  font-size: 0.75rem;
  font-style: italic;
  color: var(--muted);
  text-decoration: underline;
  text-align: center;
  cursor: pointer;
}

/* Desktop already has its own discoverable, browser-native install
   affordance (an address-bar icon on Chrome/Edge) - this hint is only
   worth the space on a phone-sized screen. */
@media (min-width: 700px) {
  .installHint {
    display: none;
  }
}

/* Lives inside #languagePicker's pickerBody - the widget fills itself in
   once loaded (see loadTranslateWidget() in app.js). */
#google_translate_element {
  font-size: 0.95rem;
}

.pickerToggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--fg);
  font-size: 0.95rem;
  cursor: pointer;
}

.pickerToggle.pulse {
  animation: pickerPulse 1.8s ease-in-out infinite;
}

@keyframes pickerPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent);
  }
  50% {
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 0%, transparent);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pickerToggle.pulse {
    animation: none;
  }
}

.badge {
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  font-size: 0.8rem;
  min-width: 1.2em;
  text-align: center;
}

.pickerScrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 20;
}

.picker {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(360px, 90vw);
  background: var(--bg);
  border-left: 1px solid var(--border);
  z-index: 30;
  display: flex;
  flex-direction: column;
}

/* Full-height (top:0 to bottom:0) is the right call on a phone regardless
   of which panel it is - Print and Calendar Subscribe stay full-height
   there too, same as Menus/Dietary/Translate, matching the site's one
   consistent "panel slides in from the edge" mobile pattern.
   Content-sized shrinking is a desktop-only concern (see the media query
   below): full-height there is what strands a short panel's footer
   button far below its couple of lines of content - a gap barely
   noticeable on a phone's shorter viewport, a real one on a tall desktop
   window. */
@media (min-width: 800px) {
  /* A content-sized panel anchored to the top-right corner reads as
     slightly adrift on a screen this wide, so it's centered instead - same
     look as .modal (the disclaimer), for consistency with the one other
     dialog-like panel already in the app. */
  .picker--compact {
    bottom: auto;
    max-height: 90vh;
    top: 50%;
    right: auto;
    left: 50%;
    transform: translate(-50%, -50%);
    border-left: none;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  }

  .picker--compact .pickerBody {
    flex: 0 1 auto;
  }
}

.pickerHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.pickerHeader h2 {
  margin: 0;
  font-size: 1.1rem;
}

.iconBtn {
  background: none;
  border: none;
  color: var(--fg);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}

.pickerBody {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 1rem;
}

.pickerGroup h3 {
  margin: 1rem 0 0.25rem;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.pickerSchool h4 {
  margin: 0.6rem 0 0.2rem;
  font-size: 1rem;
}

.pickerSchool h5 {
  margin: 0.5rem 0 0.15rem 0.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.pickerMenuList {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-left: 0.25rem;
}

.pickerCheckbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.15rem 0;
  cursor: pointer;
}

/* Radio-choice rows in the Print and Calendar Subscribe panels - like
   .pickerCheckbox, but top-aligned (rather than centered) and with room
   for a second, muted line of text under the option's own label - see
   .radioOptionText/.printPopoverHint. */
.radioOption {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.5rem 0;
  cursor: pointer;
}

.radioOption input[type="radio"] {
  margin-top: 0.2rem;
}

.radioOptionText {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.pickerFooter {
  padding: 1rem;
  border-top: 1px solid var(--border);
}

.primaryBtn {
  width: 100%;
  padding: 0.7rem;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 1rem;
  cursor: pointer;
}

.primaryBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, 90vw);
  max-height: 85vh;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

.modalBody {
  padding: 0 1rem;
  overflow-y: auto;
  font-size: 0.92rem;
  line-height: 1.5;
}

.modalBody p {
  margin: 0.75rem 0;
}

.modalBody a {
  color: var(--accent);
}

/* Sticks right under .topbar - --topbar-height is kept in sync with its
   actual rendered height by a ResizeObserver in app.js, since that height
   isn't fixed (the title wraps to two lines on narrow screens/large text
   settings). The 3.2rem fallback only matters for the flash before that
   observer runs once on load. */
.dayNav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  flex-wrap: wrap;
  position: sticky;
  top: var(--topbar-height, 3.2rem);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 9;
}

.dayLabel {
  font-size: 1.1rem;
  font-weight: 600;
  min-width: 18ch;
  text-align: center;
}

.dayLabel.isToday {
  color: var(--accent);
}

.viewModeToggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.viewModeBtn {
  background: var(--bg);
  color: var(--fg);
  border: none;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  cursor: pointer;
}

.viewModeBtn[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-fg);
}

.weekScroll {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  /* No scroll-snap: it silently overrode/reverted programmatic scrollLeft
     changes (scrollIntoView, scrollTo, and direct assignment all failed
     to move the row while snap was active), which broke "jump to a day"
     in week view. That's worth more than the swipe-snap nicety. */
}

.weekDayCard {
  flex: 0 0 260px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
}

.weekDayCard.today {
  border-color: var(--today-border);
  box-shadow: 0 0 0 1px var(--today-border);
}

.weekDayHeader {
  font-weight: 700;
  margin-bottom: 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.weekDayHeader .weekDayWeekday {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
}

.weekDayCard.today .weekDayHeader {
  border-color: var(--today-border);
}

.linkBtn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--fg);
  padding: 0.2rem 0.6rem;
  cursor: pointer;
  font-size: 0.8rem;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
}

.emptyState {
  max-width: 40ch;
  margin: 3rem auto;
  text-align: center;
  color: var(--muted);
  padding: 0 1rem;
}

.siteFooter {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 2rem 1rem 1.5rem;
}

.siteFooter img {
  display: block;
  height: 20px;
}

/* Full-width so it gets its own line above the badges; otherwise the same
   quiet underlined-text treatment as .disclaimerLink and .installHint. */
.shareLink {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  background: none;
  border: none;
  margin: 0 0 0.5rem;
  padding: 0.4rem 1rem;
  font-size: 0.75rem;
  font-style: italic;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
}

.shareLinkIcon {
  flex: none;
  opacity: 0.8;
}

.shareBody {
  text-align: center;
}

/* Always dark-on-white, whatever the theme - a QR code on a dark card
   background is much harder for a phone camera to lock onto, so the SVG
   carries its own white background and this just pads it out into a
   small "sticker". */
.shareQr {
  display: block;
  width: 220px;
  max-width: 100%;
  height: auto;
  margin: 1rem auto;
  padding: 0.5rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.shareBody .subscribeUrlHint {
  text-align: left;
}


.menuSection {
  margin-bottom: 0;
  width: 100%;
}

/* Day view: a fixed-ish width per menu so several can sit side by side
   on a wide screen instead of always stacking full-width. Week view
   keeps every row full width (see main's flex-wrap) - its horizontal
   day-scroller needs the room, and cramming it into a narrow column
   would defeat the point. */
body:not(.week-view) .menuSection {
  flex: 1 1 340px;
  max-width: 480px;
  width: auto;
}

/* Docks right under .dayNav (itself docked under .topbar) and stays put
   for as long as its own section is on screen - once that section
   scrolls past, it's pushed off by the next section's h2 taking the same
   spot, since each lives inside its own .menuSection rather than one
   shared bar. --topbar-height/--daynav-height are kept in sync with their
   actual rendered heights by ResizeObservers in app.js. */
.menuSection h2 {
  font-size: 1.15rem;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.4rem;
  margin-bottom: 0.75rem;
  position: sticky;
  top: calc(var(--topbar-height, 3.2rem) + var(--daynav-height, 3.4rem));
  background: var(--bg);
  z-index: 8;
}

.loading, .empty, .error, .notScheduled {
  color: var(--muted);
}

.error { color: #c0392b; }

.sectionBody {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
}

.sectionMeta {
  margin-bottom: 0.5rem;
}

.gradeBadge {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  font-size: 0.75rem;
  white-space: nowrap;
}

.itemName {
  font-weight: inherit;
}

.itemName-excluded {
  text-decoration: line-through;
  text-decoration-color: var(--fg);
  text-decoration-thickness: 2px;
}

.allergenBadge {
  font-size: 0.85em;
  line-height: 1;
  cursor: default;
}

/* Positive badges (vegetarian) - the only .allergenBadge used inline right
   after the item name rather than inside the Allergens box - so the
   spacing lives here, not on the shared base class. */
.allergenBadge-positive {
  margin-left: 0.35rem;
  vertical-align: middle;
}

.allergenBadge-text {
  display: inline-block;
  background: var(--border);
  color: var(--fg);
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
}

/* Tap-to-reveal name for icon-only allergen badges - see the click
   handler in app.js. Positioned above the tapped badge; transform
   handles centering/lifting so the JS only needs the badge's own
   top-left corner. */
.tapTooltip {
  position: fixed;
  transform: translate(-50%, -100%) translateY(-8px);
  background: var(--fg);
  color: var(--bg);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  white-space: nowrap;
  z-index: 50;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ALLERGEN_SHOW_LABELS = true: bordered box with visible chip text instead. */
/* display: flex (not inline-flex) so it's guaranteed onto its own line
   below the item name/vegetarian badge, rather than only wrapping there
   when it happens to run out of horizontal room. width: fit-content keeps
   it sized to its content instead of stretching full width. */
.allergenGroup {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  width: fit-content;
  max-width: 100%;
  border: 1.5px solid var(--warn-border);
  background: var(--warn-bg);
  border-radius: 8px;
  padding: 0.25rem 0.5rem;
  margin-top: 0.3rem;
}

.allergenGroupLabel {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--warn-label);
  white-space: nowrap;
}

/* One of the shown allergens is on the exclude list - red instead of amber. */
.allergenGroup-alert {
  border-color: var(--danger-border);
  background: var(--danger-bg);
}

.allergenGroup-alert .allergenGroupLabel {
  color: var(--danger-label);
}

.allergenRow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.allergenChip {
  display: inline-block;
  background: var(--border);
  color: var(--fg);
  border-radius: 4px;
  padding: 0.05rem 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}

.choiceGroup {
  border: 1.5px solid var(--accent);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.75rem;
}

.choiceLabel {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

/* The (i) beside an inferred station name - see stationNamesFor() in
   station-boundaries.js. Sized to sit on the label's baseline without
   stretching the row. */
.choiceLabelRow {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 0.3rem;
  /* The label can wrap on a narrow screen; keep the (i) on the label's
     first line rather than letting it drop below. */
  flex-wrap: nowrap;
}

.choiceLabelRow .choiceLabel {
  margin-bottom: 0;
}

.stationInfo {
  flex: 0 0 auto;
  width: 0.95rem;
  height: 0.95rem;
  padding: 0;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.stationInfo:hover,
.stationInfo:focus-visible {
  color: var(--accent);
}

.stationInfoPopover {
  display: block;
  /* .printPopover sets min-width: 220px, which alone overflows a narrow
     phone once padding and the 8px edge gap are added. Clamp to the
     viewport so openStationInfo()'s left-edge math has something that
     actually fits to work with. */
  min-width: 0;
  width: max-content;
  max-width: min(17rem, calc(100vw - 1.5rem));
  padding: 0.55rem 0.65rem;
}

.stationInfoTitle {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--fg);
}

.stationInfoBody {
  margin: 0 0 0.4rem;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--muted);
}

.stationInfoBody:last-child {
  margin-bottom: 0;
}

.choiceList {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 1rem;
  font-weight: 600;
}

.choiceList li {
  margin-bottom: 0.15rem;
}

.choiceList li:not(:last-child)::after {
  content: " — or —";
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0.15rem 0;
}

/* Holds every category's .sideGroup for one day's sides. flex-wrap lets
   collapsed groups (shrunk to a small pill - see .sideGroup.collapsed)
   sit side by side instead of always stacking one per row. */
.sideGroups {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.6rem;
  /* .choiceGroup only pushes space below itself, not above whatever
     comes next - fine for the usual one-station case, but with several
     stations (high school lunch) a station's sides ran straight into
     the next station's Entree box with no gap at all. This covers both
     that and the final shared-sides block after the last station. */
  margin-bottom: 0.75rem;
}

.sideGroup {
  font-size: 0.85rem;
  flex: 1 1 100%; /* expanded: full width, one per row - unchanged look */
}

.sideGroup.collapsed {
  flex: 0 0 auto; /* collapsed: shrink to content so it can sit inline */
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem 0.5rem 0.15rem 0.7rem;
}

.sideGroup.collapsed .sideList {
  display: none;
}

.sideLabel {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

/* Small disclosure arrow - rotates to point right when collapsed. */
.sideLabel::after {
  content: "\25BE";
  font-size: 0.7em;
  transition: transform 0.15s ease;
}

.sideGroup.collapsed .sideLabel::after {
  transform: rotate(-90deg);
}

.sideList {
  margin: 0.1rem 0 0;
  padding-left: 1.1rem;
  color: var(--fg);
}

@media (max-width: 480px) {
  .topbar h1 { font-size: 1rem; }
  .dayLabel { font-size: 1rem; min-width: 0; }
}

/* ---------- Actions menu / print ---------- */

/* A small pill, same shape language as .pickerToggle, but quieter (muted
   text, no fill) so it reads as pressable next to each menu's own
   heading without competing with it the way a full-size button would. */
.sectionActionsBtn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1;
  padding: 0.25rem 0.6rem;
  margin-left: 0.5rem;
  cursor: pointer;
  vertical-align: middle;
}

.sectionActionsBtn:hover {
  color: var(--fg);
  border-color: var(--accent);
}

.printPopover {
  position: absolute;
  z-index: 30;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  min-width: 220px;
  overflow: hidden;
}

.printPopoverBtn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  text-align: left;
  background: none;
  border: none;
  padding: 0.6rem 0.8rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--fg);
  cursor: pointer;
}

.printPopoverBtn:hover {
  background: var(--card-bg);
}

.printPopoverBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.printPopoverBtn:disabled:hover {
  background: none;
}

.printPopoverBtn:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.printPopoverHint {
  font-size: 0.75rem;
  color: var(--muted);
}

/* ---------- Calendar subscribe panel ---------- */

/* .primaryBtn is otherwise only ever a <button> (inline-block by default,
   so width: 100% just works) - #subscribeLink is an <a>, which needs an
   explicit block display for that same width to apply, plus the two
   button-only defaults <a> doesn't carry (no underline, centered label). */
#subscribeLink {
  display: block;
  text-align: center;
  text-decoration: none;
  margin: 0.75rem 0;
}

.subscribeUrlHint {
  font-size: 0.85rem;
  color: var(--muted);
}

.subscribeUrlHint code {
  display: block;
  margin-top: 0.35rem;
  padding: 0.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.8rem;
  word-break: break-all;
  user-select: all;
}

/* Built fresh by printWeek()/printMonth() (app.js) right before
   window.print() is called, and cleared right after - kept out of normal
   layout the rest of the time, since it only ever exists for the life of
   one print job. */
#printArea {
  display: none;
}

/* Genuinely on-screen (not just in the render tree, not off-screen) for
   as long as printWeek()/printMonth() (app.js) have it flagged this way -
   only while actively testing whether that makes any difference to
   whether Google's Website Translator picks up freshly-built print
   content. Higher specificity than the bare #printArea rule above, so it
   wins while the class is present. */
#printArea.printPreviewing {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 45;
  background: var(--bg);
  color: var(--fg);
  overflow: auto;
  padding: 3.5rem 1rem 1rem;
}

.printPreparingBanner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 0.9rem;
}

.printSpinner {
  width: 1.2rem;
  height: 1.2rem;
  border: 3px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: printSpin 0.8s linear infinite;
}

@keyframes printSpin {
  to {
    transform: rotate(360deg);
  }
}

@media print {
  /* Interactive-only affordance; the name still prints, just without the
     button that opens its explanation. */
  .stationInfo {
    display: none !important;
  }

  /* Force the light palette regardless of the OS/browser's color scheme -
     paper is white no matter what, and the site's dark-mode variables
     would otherwise leave print output using light text on a background
     the printer never draws. */
  :root {
    color-scheme: light;
    --bg: #ffffff;
    --fg: #1a1a1a;
    --muted: #555555;
    --border: #999999;
    --accent: #2f6f4f;
    --accent-fg: #ffffff;
    --card-bg: #f7f7f5;
    --today-bg: #fff7d6;
    --today-border: #d9b400;
    --warn-border: #c99a00;
    --warn-bg: #fffbeb;
    --warn-label: #8a6d00;
    --danger-border: #c0392b;
    --danger-bg: #fdecea;
    --danger-label: #a5291b;
  }

  body > *:not(#printArea) {
    display: none !important;
  }

  #printArea {
    display: block !important;
  }

  .printMenuSection {
    break-after: page;
  }

  .printMenuSection:last-child {
    break-after: auto;
  }

  .printMenuSection h2 {
    margin-top: 0;
  }

  /* Both print tables share the same plain grid look - one row/column of
     borders, no shading or rounded pills, nothing that reads as
     clickable. */
  .printMonthTable,
  .printWeekTable {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
  }

  .printMonthTable th,
  .printMonthTable td,
  .printWeekTable th,
  .printWeekTable td {
    border: 1px solid var(--border);
    padding: 0.3rem 0.4rem;
    vertical-align: top;
    text-align: left;
    font-size: 0.8rem;
    font-weight: normal;
  }

  .printMonthTable td {
    min-height: 3.4em;
  }

  .printMonthDate {
    font-weight: 600;
    display: block;
    margin-bottom: 0.15rem;
  }

  .printMonthNote,
  .printWeekNote {
    color: var(--muted);
    font-style: italic;
  }

  .printWeekTable thead th {
    text-align: center;
  }

  .printWeekRowLabel {
    white-space: nowrap;
    color: var(--muted);
  }

  .printGradeNote {
    display: block;
    font-weight: normal;
    color: var(--muted);
  }

  /* Strikethrough rather than the on-screen .itemName-excluded's color -
     a black-and-white printer can't show red, but it can show a line
     through text. */
  .printItemName-excluded {
    text-decoration: line-through;
    font-weight: 600;
  }

  .printItemList {
    margin: 0;
    padding-left: 1.1em;
  }

  .printItemList li:not(:last-child) {
    margin-bottom: 0.3rem;
  }

  /* Still labeled "Allergens" like the on-screen box (see
     renderAllergenWarnings()), just plain text instead of a bordered/
     colored chip row. */
  .printItemAllergens {
    display: block;
    font-size: 0.85em;
  }

  .printAllergenLabel {
    color: var(--muted);
  }

  .printFallbackNote {
    color: var(--muted);
    font-style: italic;
    margin-top: 2rem;
    text-align: center;
  }
}
