/* ===== RSBV design system =====
   Tokens (colors, type, radius, shadow) live in tokens.css, loaded before
   this file — see partials/head.ejs. Everything below references them by
   var(--name); no new hardcoded values should be added here. */

* { box-sizing: border-box; }

/* A deliberate, visible keyboard-focus ring in the site's own palette —
   previously relied entirely on the browser default, which is inconsistent
   against this site's custom ink-bordered components. Only shows for
   keyboard/programmatic focus (:focus-visible), not mouse clicks. */
a, button, input, select, textarea, [tabindex] {
  outline-offset: 2px;
}
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--forest);
  outline-offset: 2px;
}

html, body { margin: 0; padding: 0; }

/* Visually hidden but still reachable by screen readers/keyboard — for
   accessible names/hints that don't need a visible on-page presence. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* First focusable element on every page — invisible until a keyboard user
   tabs to it, then jumps straight past the header/nav into <main id="main">. */
.skip-link {
  position: absolute;
  top: -3rem;
  left: 1rem;
  z-index: 200;
  background: var(--forest);
  color: var(--paper);
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 700;
  transition: top 0.15s;
}
.skip-link:focus { top: 1rem; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.5;
}

h1, h2, h3, .price {
  font-family: var(--font-display);
  font-weight: 700;
  margin: 0 0 0.5em;
}

h1 { font-size: 2.2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }

p { margin: 0 0 0.75em; }

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

img, svg { max-width: 100%; display: block; }

/* ===== layout primitives ===== */

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

.card {
  background: var(--paper-alt);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
}

.gate-card, .pay-card, .order-card {
  max-width: 560px;
  margin: 2rem auto;
}

.gate-card--denied { border-color: var(--terracotta); }

.school-orders__sub { color: var(--ink-muted); }
.school-orders__order { margin-bottom: var(--space-5); }
.school-orders__order-title { font-size: var(--text-lg); }
.school-orders__order-actions { display: flex; gap: var(--space-2); margin-top: var(--space-3); }

/* ===== header / footer ===== */

.site-header {
  border-bottom: var(--border-w) solid var(--ink);
  background: var(--paper-alt);
}

.site-header__inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-search {
  flex: 1 1 240px;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface-sunken);
  border-radius: var(--radius-button);
  padding: 0.45rem 0.9rem;
}
.header-search__icon { display: flex; color: var(--ink-muted); flex-shrink: 0; }
.header-search input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--ink);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--ink);
}

.brand__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
}

.site-nav, .site-header__auth {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.site-header__auth { gap: 1rem; }
.site-nav a:not(.button), .site-header__auth a:not(.button) {
  text-decoration: none;
  font-weight: 600;
  color: var(--ink);
  border-bottom: var(--border-w) solid transparent;
  font-size: var(--text-sm);
}
.site-nav a:not(.button):hover, .site-header__auth a:not(.button):hover { border-bottom-color: var(--marigold); }
.link-button {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
  cursor: pointer;
  border-bottom: var(--border-w) solid transparent;
}
.link-button:hover { border-bottom-color: var(--marigold); }

.site-footer { margin-top: 2rem; }
.site-footer--dark {
  background: var(--rsbv-navy);
  color: rgba(255, 255, 255, 0.85);
  padding: 2.5rem 1.25rem 1.5rem;
}

.site-footer__inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2rem;
}

.site-footer__brand { max-width: 260px; }
.site-footer__logo { display: block; margin-bottom: 0.5rem; }
.site-footer__wordmark { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; color: var(--paper); display: block; margin-bottom: 0.4rem; }
.site-footer__tagline { font-size: 0.85rem; color: rgba(255, 255, 255, 0.7); margin: 0; }

.site-footer__columns { display: flex; gap: 2.5rem; flex-wrap: wrap; }
.site-footer__col { display: flex; flex-direction: column; gap: 0.5rem; }
.site-footer__col h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: rgba(255, 255, 255, 0.55); margin: 0 0 0.15rem; }
.site-footer__col a { color: rgba(255, 255, 255, 0.85); text-decoration: none; font-size: 0.9rem; }
.site-footer__col a:hover { color: var(--rsbv-orange); }

.site-footer__copyright {
  max-width: 1080px;
  margin: 2rem auto 0;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
}

/* ===== buttons ===== */

/* Soft pill/shadow language, sitewide — was previously only applied via a
   separate .button--pill modifier on homepage/catalogue marketing CTAs,
   with every other page (checkout, forms, basket, order-status, school
   pages) on the older hard-offset "sticker" style. That split is gone:
   this is the one button language now. .button--pill/-sm stay as SIZE
   modifiers only (their shape properties are redundant against this base
   and have been removed) — a hero CTA is deliberately bigger than a
   "Cancel order" button, but both share the same shape/shadow/radius. */
.button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.6rem 1.1rem;
  border: none;
  border-radius: var(--radius-button);
  background: var(--paper-alt);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.1s, box-shadow 0.1s, opacity 0.1s;
}
.button:hover { box-shadow: var(--shadow-md); }
.button:active { box-shadow: none; transform: scale(0.97); }
.button--primary { background: var(--forest); color: var(--paper); }
.button--accent { background: var(--marigold); color: var(--ink); }
.button--alert { background: var(--terracotta); color: var(--paper); }
.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.button--pill { padding: 0.75rem 1.75rem; }
.button--pill-sm { padding: 0.45rem 1.1rem; font-size: 0.85rem; }

.button--pill-outline {
  background: transparent;
  color: var(--paper);
  border: 2px solid var(--paper);
  box-shadow: none;
  padding: 0.75rem 1.75rem;
  transition: background-color 0.1s;
}
.button--pill-outline:hover { background: rgba(255, 255, 255, 0.12); }
.button--pill-outline:active { box-shadow: none; transform: none; }
/* Same ghost-pill shape as .button--pill-outline, but for use on the plain
   page background (e.g. the For Schools CTA row) rather than the hero's
   solid orange — white-on-white would be invisible there. */
.button--pill-outline--light { color: var(--forest); border-color: var(--forest); }
.button--pill-outline--light:hover { background: rgba(var(--ink-rgb), 0.05); }

/* ===== forms ===== */

.field { margin-bottom: 1rem; display: flex; flex-direction: column; gap: 0.35rem; }
.field label { font-weight: 600; font-size: 0.9rem; }

.register-form__section {
  border: none;
  padding: 0;
  margin: 0 0 var(--space-6);
}
.register-form__section legend {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-base);
  color: var(--forest);
  padding: 0;
  margin-bottom: var(--space-3);
}
.register-form__signin { margin-top: var(--space-4); }
.register-card { max-width: 640px; }

input[type="text"], input[type="tel"], input[type="email"], input[type="password"], input[type="search"], input[type="number"], textarea, select {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.55rem 0.75rem;
  border: var(--border-w) solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper-alt);
  color: var(--ink);
}
textarea { resize: vertical; font-family: var(--font-body); }

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='14' height='14' stroke='%232B3A2F' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
}

input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border: var(--border-w) solid var(--ink);
  border-radius: 3px;
  position: relative;
  background: var(--paper-alt);
  cursor: pointer;
  vertical-align: middle;
}
input[type="checkbox"]:checked { background: var(--forest); }
input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 0px;
  width: 6px;
  height: 11px;
  border: solid var(--paper);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* segmented toggle */

.segmented {
  display: inline-flex;
  border: var(--border-w) solid var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1rem;
}
.segmented__option {
  font-family: var(--font-body);
  font-weight: 600;
  padding: 0.5rem 1rem;
  border: none;
  background: var(--paper-alt);
  color: var(--ink);
  cursor: pointer;
}
.segmented__option + .segmented__option { border-left: var(--border-w) solid var(--ink); }
.segmented__option--active { background: var(--forest); color: var(--paper); }

/* ===== status pills ===== */

.pill {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: var(--border-w) solid var(--ink);
  margin-bottom: 1rem;
}
.pill--pending { background: var(--marigold); color: var(--ink); }
.pill--approved { background: var(--blue); color: #fff; }
.pill--paid { background: var(--forest); color: #fff; }
.pill--fulfilled { background: var(--teal); color: #fff; }
.pill--rejected { background: var(--terracotta); color: #fff; }
.pill--packed { background: var(--blue); color: #fff; }
.pill--out_for_delivery { background: var(--teal); color: #fff; }
.pill--delivered { background: var(--forest); color: #fff; }
.pill--delayed { background: var(--terracotta); color: #fff; }
.pill--returned { background: #8a8074; color: #fff; }
.pill--cancelled { background: var(--ink-muted); color: #fff; }

/* ===== flash messages ===== */

.flash {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border: var(--border-w) solid var(--ink);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  background: var(--paper-alt);
}
.flash--success { border-color: var(--forest); }
.flash--error { border-color: var(--terracotta); }

/* ===== hero / category tabs ===== */

/* Logo lives only in the header now — the hero used to repeat it in a large
   animated form directly below, which read as a duplicated lockup. */
.hero { animation: hero-fade-up 0.5s ease-out both; }

.hero--redesigned {
  position: relative;
  background: var(--rsbv-orange);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  margin: 1.25rem 0 0;
  overflow: hidden;
}

/* Soft wave divider — the hero is a contained, rounded block rather than
   full-bleed (avoids viewport-overflow risk at the 360-390px floor), so
   this accents the block's own bottom edge instead of a full-width page
   transition. Same currentColor-var() pattern icons.js uses. */
.hero__wave {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  line-height: 0;
  color: var(--paper);
  pointer-events: none;
}
.hero__wave svg { display: block; width: 100%; height: 42px; }

.hero__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.hero__content { flex: 1 1 420px; min-width: 0; }

.hero__location-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.15);
  color: var(--paper);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 0.85rem;
}

.hero__headline {
  font-family: var(--font-display-marketing);
  font-weight: 700;
  font-size: 2.1rem;
  line-height: 1.15;
  color: var(--paper);
  margin: 0 0 0.75rem;
  max-width: 16ch;
}
.hero__headline-accent { color: var(--hero-accent-gold); display: block; }

.hero__value-prop {
  color: var(--paper);
  max-width: 42ch;
  margin: 0 0 1.5rem;
}

.hero__search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--paper);
  border-radius: var(--radius-button);
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
  box-shadow: var(--shadow-md);
  max-width: 480px;
  margin-bottom: var(--space-5);
}
.hero__search-icon { display: flex; color: var(--ink-muted); flex-shrink: 0; }
.hero__search input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--ink);
}
.hero__search input:focus { outline: none; }
.hero__search .button { flex-shrink: 0; padding: 0.55rem 1.25rem; }

.hero__cta-row { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1.75rem; }

.hero__stats { display: flex; gap: 1rem 1.75rem; flex-wrap: wrap; }
.hero__stat strong { display: block; font-family: var(--font-display-marketing); font-size: 1.5rem; color: var(--paper); line-height: 1; }
.hero__stat span { font-size: 0.78rem; font-weight: 700; color: var(--paper); }

.hero__illustration {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
}
.hero__illustration-card {
  width: 96px;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  position: relative;
  margin-left: -32px;
  border: 3px solid var(--paper);
}
.hero__illustration-card:first-child { margin-left: 0; }
.hero__illustration-card img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: block; }
.hero__illustration-card:nth-child(1) { transform: rotate(-8deg); z-index: 5; }
.hero__illustration-card:nth-child(2) { transform: rotate(-4deg) translateY(-8px); z-index: 4; }
.hero__illustration-card:nth-child(3) { transform: translateY(-12px); z-index: 3; }
.hero__illustration-card:nth-child(4) { transform: rotate(4deg) translateY(-8px); z-index: 2; }
.hero__illustration-card:nth-child(5) { transform: rotate(8deg); z-index: 1; }
.hero__illustration-badge {
  position: absolute;
  top: 0.4rem;
  left: 0.4rem;
  background: var(--marigold);
  color: var(--ink);
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
}

.why-rsbv { margin: var(--space-7) 0 var(--space-6); }
.why-rsbv__eyebrow {
  display: block;
  font-weight: 800;
  font-size: var(--text-sm);
  color: var(--forest);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-2);
}
.why-rsbv h2 { font-size: var(--text-2xl); line-height: var(--text-2xl-lh); margin: 0; }

.how-it-works { margin: var(--space-7) 0 var(--space-6); }
.how-it-works h2 { font-size: var(--text-2xl); line-height: var(--text-2xl-lh); margin: 0 0 var(--space-5); }
.how-it-works__row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-5);
}
.how-it-works__step { display: flex; flex-direction: column; gap: var(--space-1); }
.how-it-works__number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--forest);
  color: var(--paper);
  font-weight: 800;
  font-size: var(--text-sm);
  margin-bottom: var(--space-2);
}
.how-it-works__step strong { font-size: var(--text-lg); }
.how-it-works__step span { color: var(--ink-muted); font-size: var(--text-sm); line-height: 1.5; }

.register-cta {
  text-align: center;
  background: var(--surface-sunken);
  border-radius: var(--radius-lg);
  padding: var(--space-7) var(--space-5);
  margin: var(--space-7) 0 var(--space-6);
}
.register-cta h2 { font-size: var(--text-2xl); line-height: var(--text-2xl-lh); margin: 0 0 var(--space-2); }
.register-cta p { color: var(--ink-muted); max-width: 46ch; margin: 0 auto var(--space-5); }
.register-cta__row { display: flex; align-items: center; justify-content: center; gap: var(--space-4); flex-wrap: wrap; }
.register-cta__signin { font-weight: 700; color: var(--forest); text-decoration: none; border-bottom: var(--border-w) solid transparent; }
.register-cta__signin:hover { border-bottom-color: var(--marigold); }

/* ===== Browse by class ===== */

.browse-by-class { margin-bottom: 2rem; }
.browse-by-class h2 { font-size: 1.15rem; margin: 0 0 0.85rem; }
.browse-by-class__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}
.browse-by-class__tile {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem 0.75rem;
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  transition: transform 0.1s;
}
.browse-by-class__tile:hover { transform: translateY(-2px); }
.browse-by-class__tile[data-hue="blue"] { background: var(--hue-blue-tint); }
.browse-by-class__tile[data-hue="gold"] { background: var(--hue-gold-tint); }
.browse-by-class__tile[data-hue="teal"] { background: var(--hue-teal-tint); }
.browse-by-class__tile[data-hue="green"] { background: var(--hue-green-tint); }
.browse-by-class__tile[data-hue="orange"] { background: var(--hue-orange-tint); }
.browse-by-class__tile[data-hue="purple"] { background: var(--hue-purple-tint); }

.shop-by-subject { margin-bottom: 2rem; }
.shop-by-subject h2 { font-size: 1.15rem; margin: 0 0 0.85rem; }
.shop-by-subject__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}
.shop-by-subject__tile {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem 0.75rem;
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  transition: transform 0.1s;
}
.shop-by-subject__tile:hover { transform: translateY(-2px); }

.hero__trust {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
  margin-top: 1.5rem;
}

.hero__trust-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  background: var(--paper-alt);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
}

.hero__trust-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  color: var(--forest);
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero__trust-item strong { display: block; font-size: 0.9rem; margin-bottom: 0.15rem; }
.hero__trust-item span { font-size: 0.8rem; color: var(--ink-muted); line-height: 1.4; }

/* Reorder entry point — homepage surface for the existing single-order
   reorder feature (?reorder=<id>, handled in site.js), only shown to a
   logged-in school with a past order to reorder from. */
.reorder-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: var(--surface-sunken);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1.1rem;
  margin: 1.25rem 0;
}

.reorder-card__icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--paper-alt);
  color: var(--forest);
  display: flex;
  align-items: center;
  justify-content: center;
}

.reorder-card__body { flex: 1; display: flex; flex-direction: column; }
.reorder-card__body strong { font-size: 0.9rem; }
.reorder-card__body span { font-size: 0.78rem; color: var(--ink-muted); }

/* Merchandising shelves */
.shelf { margin-bottom: 1.75rem; }

.shelf__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.shelf__head h2 { font-size: 1.15rem; margin: 0; }
.shelf__sub { font-size: 0.78rem; color: var(--ink-muted); flex-shrink: 0; }
.shelf__view-all {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--rsbv-orange);
  text-decoration: none;
}
.shelf__view-all:hover { text-decoration: underline; }

.shelf__row {
  display: flex;
  gap: 0.85rem;
  overflow-x: auto;
  padding-bottom: 0.4rem;
  -webkit-overflow-scrolling: touch;
}

.shelf-card {
  flex-shrink: 0;
  width: 132px;
  background: var(--paper-alt);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 0.6rem;
  position: relative;
}

.shelf-card__cover-frame {
  position: relative;
  border-radius: var(--radius-sm);
  padding: 0.3rem;
  margin-bottom: 0.5rem;
  background: var(--surface-sunken);
}

.shelf-card__cover {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 8px;
  background: #dce8dd;
  display: block;
}

.shelf-card__cover--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  opacity: 0.4;
}

.shelf-card__badge {
  position: absolute;
  top: 0.85rem;
  left: 0.85rem;
  background: var(--marigold);
  color: var(--ink);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
}

.shelf-card__title { font-size: 0.78rem; font-weight: 700; line-height: 1.3; margin-bottom: 0.2rem; }
.shelf-card__price { font-size: 0.82rem; font-weight: 800; }
.shelf-card .stock-note { font-size: 0.72rem; }
.shelf-card[data-state="low-stock"] .stock-note { color: var(--terracotta); }
.shelf-card[data-state="out-of-stock"] { filter: grayscale(1); opacity: 0.7; }
.shelf-card[data-state="out-of-stock"] .stock-note { color: var(--ink); }

@keyframes hero-fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

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

/* ===== catalogue page ===== */

.catalogue-header { margin-bottom: var(--space-5); }
.catalogue-header h1 { font-size: var(--text-2xl); line-height: var(--text-2xl-lh); margin: 0 0 var(--space-1); }
.catalogue-header p { color: var(--ink-muted); margin: 0; }

/* Single, page-level pricing message — replaces the old per-card "Login
   to see price" lock. Shown once, not repeated on every card. */
.pricing-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  background: var(--surface-sunken);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-5);
  font-weight: 600;
  font-size: var(--text-sm);
}
.pricing-banner a { color: var(--forest); font-weight: 700; text-decoration: none; border-bottom: var(--border-w) solid transparent; }
.pricing-banner a:hover { border-bottom-color: var(--marigold); }

.quick-order-toggle-row { margin-bottom: var(--space-5); }
.quick-order-view__head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-2); }
.quick-order-view__head h2 { font-size: var(--text-lg); margin-bottom: var(--space-1); }
.quick-order-view__head p { color: var(--ink-muted); font-size: var(--text-sm); margin: 0; }
.quick-order-view__table { margin-top: var(--space-4); }
.quick-order-view__submit { margin-top: var(--space-4); }
#quick-order-table .quick-order-qty { width: 4rem; }

/* ===== catalogue filters ===== */

.catalogue-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-hairline);
}
.catalogue-filters .field { margin-bottom: 0; min-width: 160px; }
.catalogue-filters select { width: 100%; }

.category-tabs {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.3rem;
  -webkit-overflow-scrolling: touch;
}
.category-tab {
  flex-shrink: 0;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-hairline-strong);
  border-radius: 999px;
  background: var(--paper-alt);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.12s, background-color 0.12s, color 0.12s;
}
.category-tab:hover { border-color: var(--forest); }
/* Active state uses forest (not marigold) — marigold already means
   "pending" on order-status pills elsewhere in the app; reusing it here
   would blur that meaning. */
.category-tab--active { background: var(--forest); color: var(--paper); border-color: var(--forest); }

.category-group { margin-bottom: 2rem; }
.category-group__title { border-bottom: 1px solid rgba(var(--ink-rgb), 0.14); padding-bottom: 0.4rem; }

/* ===== AI search ===== */

.ai-search {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
  background: var(--paper-alt);
  border-radius: var(--radius-lg);
  padding: 0.6rem;
  box-shadow: var(--shadow-sm);
}
.ai-search input {
  flex: 1;
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  color: var(--ink);
  transition: background-color 0.12s, border-color 0.12s;
}
.ai-search input:focus { background: var(--paper-alt); border-color: var(--forest); }

/* ===== book cards ===== */

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
}

.search-status {
  grid-column: 1 / -1;
  color: var(--ink-muted);
}
.search-status--count {
  font-weight: 600;
  color: var(--ink);
  margin-bottom: -0.5rem;
}

.book-card {
  background: var(--paper-alt);
  border: 1px solid rgba(var(--ink-rgb), 0.08);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: box-shadow 0.15s, transform 0.15s;
}
.book-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.book-card__cover-frame {
  position: relative;
  border-radius: var(--radius-md);
  padding: 0.4rem;
  margin-bottom: 0.75rem;
  background: var(--surface-sunken);
}

/* Class-level "photo-in-frame" hues — keeps real cover photography while
   still reading as organized/colorful by class level, per the Figma
   reference's card system. "neutral" (untagged books) falls back to the
   plain --surface-sunken set above. */
.book-card__cover-frame[data-hue="blue"], .shelf-card__cover-frame[data-hue="blue"], .book-detail__cover-frame[data-hue="blue"] { background: var(--hue-blue-tint); }
.book-card__cover-frame[data-hue="gold"], .shelf-card__cover-frame[data-hue="gold"], .book-detail__cover-frame[data-hue="gold"] { background: var(--hue-gold-tint); }
.book-card__cover-frame[data-hue="teal"], .shelf-card__cover-frame[data-hue="teal"], .book-detail__cover-frame[data-hue="teal"] { background: var(--hue-teal-tint); }
.book-card__cover-frame[data-hue="green"], .shelf-card__cover-frame[data-hue="green"], .book-detail__cover-frame[data-hue="green"] { background: var(--hue-green-tint); }
.book-card__cover-frame[data-hue="orange"], .shelf-card__cover-frame[data-hue="orange"], .book-detail__cover-frame[data-hue="orange"] { background: var(--hue-orange-tint); }
.book-card__cover-frame[data-hue="purple"], .shelf-card__cover-frame[data-hue="purple"], .book-detail__cover-frame[data-hue="purple"] { background: var(--hue-purple-tint); }

.book-card__wishlist {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.book-card__wishlist[data-wishlisted="true"] { color: var(--terracotta); }
.book-card__wishlist[data-wishlisted="true"] svg { fill: currentColor; }
.book-card__wishlist:disabled { opacity: 0.6; cursor: wait; }

.book-card__cover {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--paper);
  display: block;
}
/* Shimmer sits behind the image as its own CSS background — a decoded
   <img> always paints over its own background, so this reads as a loading
   skeleton pre-decode and is fully covered once the real cover renders.
   No JS/onload handling needed. Scoped to the element (img.*), not the
   --placeholder span below, which is a deliberate "no cover" state, not
   a loading one. */
img.book-card__cover {
  background-image: linear-gradient(90deg, #f0ead6 0%, #faf5e6 50%, #f0ead6 100%);
  background-size: 400px 100%;
  animation: cover-shimmer 1.4s ease-in-out infinite;
}
@keyframes cover-shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: 200px 0; }
}
@media (prefers-reduced-motion: reduce) {
  img.book-card__cover { animation: none; }
}
.book-card__cover--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(var(--ink-rgb), 0.3);
  color: var(--ink);
  opacity: 0.4;
}
.book-card__cover--placeholder svg { width: 32%; height: 32%; }
.book-card__cover-link { display: block; }
.book-card__title { font-size: 1rem; margin-bottom: 0.1em; }
.book-card__title-link { color: inherit; text-decoration: none; }
.book-card__title-link:hover { text-decoration: underline; }
.book-card__author { color: var(--ink-muted); font-size: 0.85rem; margin-bottom: 0.5em; }
.book-card__description {
  color: var(--ink-muted);
  font-size: 0.8rem;
  margin-bottom: 0.5em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.book-card .price { font-size: 1.1rem; font-weight: 800; margin-bottom: 0.25em; }
.stock-note { font-size: 0.85rem; font-weight: 600; }

.book-card[data-state="low-stock"] .stock-note { color: var(--terracotta); }

.book-card[data-state="out-of-stock"] { filter: grayscale(1); opacity: 0.7; }
.book-card[data-state="out-of-stock"] .book-card__add { pointer-events: none; }
.book-card[data-state="out-of-stock"] .stock-note { color: var(--ink); }

/* No grayscale here, deliberately — the book is in stock and orderable in
   principle, just missing a price. Visually distinct from out-of-stock so
   the two don't read as the same "can't buy this" state. */
.book-card[data-state="no-price"] .price { color: var(--ink-muted); font-style: italic; font-weight: 700; }
.book-card[data-state="no-price"] .book-card__add { pointer-events: none; opacity: 0.55; }

.book-card__class { color: var(--ink-muted); font-size: var(--text-sm); font-weight: 700; margin-bottom: 0.5em; }

.book-card__badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background: var(--marigold);
  color: var(--ink);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}

.book-card__actions { display: flex; gap: var(--space-2); align-items: stretch; }
.book-card__qty-input {
  width: 3.25rem;
  flex-shrink: 0;
  border: 1px solid var(--border-hairline-strong);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  text-align: center;
  padding: 0 var(--space-1);
}
.book-card__actions .book-card__add { flex: 1; justify-content: center; }

.book-card__view { width: 100%; justify-content: center; }

/* ===== book detail page ===== */

.book-detail__breadcrumb { display: flex; align-items: center; gap: 0.4rem; font-size: var(--text-sm); color: var(--ink-muted); margin: 0 0 var(--space-4); }
.book-detail__breadcrumb a { color: var(--ink-muted); text-decoration: none; }
.book-detail__breadcrumb a:hover { color: var(--forest); text-decoration: underline; }

.book-detail__layout {
  display: flex;
  gap: 2.5rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.book-detail__related { margin-top: var(--space-7); }
.shelf-card--link { text-decoration: none; color: inherit; display: block; }

.book-detail__cover-frame {
  position: relative;
  flex: 0 0 280px;
  border-radius: var(--radius-lg);
  padding: 1rem;
  background: var(--surface-sunken);
}
.book-detail__cover {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: var(--radius-md);
  background: var(--paper);
  display: block;
}
.book-detail__cover--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(var(--ink-rgb), 0.3);
  color: var(--ink);
  opacity: 0.4;
}
.book-detail__cover--placeholder svg { width: 32%; height: 32%; }

.book-detail__info { flex: 1 1 320px; min-width: 0; }
.book-detail__author { color: var(--ink-muted); font-size: 1rem; margin-bottom: 1rem; }

.book-detail__meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem 1.5rem;
  margin: 0 0 1.25rem;
  padding: 1rem;
  background: var(--paper-alt);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
}
.book-detail__meta dt { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-muted); margin-bottom: 0.15rem; }
.book-detail__meta dd { margin: 0; font-weight: 600; }

.book-detail__price { font-size: 1.5rem; margin-bottom: 0.25rem; }
.book-detail__description { color: var(--ink-muted); margin: 1rem 0 1.5rem; max-width: 60ch; }
.book-detail__register-note { color: var(--ink-muted); font-weight: 600; margin: 0 0 var(--space-4); }
.book-detail__actions { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-top: 1rem; }
.book-detail__actions .book-card__qty-input { width: 3.5rem; height: 2.5rem; border: 1px solid var(--border-hairline-strong); border-radius: var(--radius-sm); background: var(--paper); color: var(--ink); font-family: var(--font-body); font-size: var(--text-sm); text-align: center; }

/* ===== basket ===== */

.basket-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  background: var(--forest);
  color: var(--paper);
  border: none;
  border-radius: 999px;
  padding: 0.55rem 0.85rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}
.basket-toggle__count {
  display: inline-block;
  background: var(--marigold);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  font-size: 0.8rem;
}

.basket-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(420px, 100%);
  background: var(--paper);
  border-left: var(--border-w) solid var(--ink);
  transform: translateX(100%);
  transition: transform 0.2s ease;
  z-index: 30;
  overflow-y: auto;
}
.basket-drawer--open { transform: translateX(0); }
.basket-drawer__inner { padding: 1.5rem; }
.basket-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.basket-items { margin: 1rem 0; }
.basket-empty { color: var(--ink-muted); }
.basket-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #ddd0aa;
}
.basket-item__title { flex: 1; font-size: 0.9rem; }
.basket-item__qty { display: flex; align-items: center; gap: 0.4rem; }
.qty-btn {
  width: 1.6rem;
  height: 1.6rem;
  border: var(--border-w) solid var(--ink);
  border-radius: 4px;
  background: var(--paper-alt);
  cursor: pointer;
  font-weight: 700;
}

.basket-summary { margin: 1rem 0; border-top: var(--border-w) solid var(--ink); padding-top: 0.75rem; }
.basket-summary__line { display: flex; justify-content: space-between; padding: 0.2rem 0; font-size: 0.9rem; }
.basket-summary__line--total { font-weight: 700; font-size: 1.1rem; border-top: 1px solid #ddd0aa; margin-top: 0.4rem; padding-top: 0.5rem; }

.checkout-form { margin-top: 1rem; }
.checkout-error {
  color: var(--terracotta);
  font-weight: 600;
  font-size: 0.9rem;
}
.checkout-success .button { margin-right: 0.5rem; margin-top: 0.5rem; }

.checkout-success__status {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  background: #fcf1da;
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  margin-bottom: 0.85rem;
}
.checkout-success__status-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--marigold);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
}
.checkout-success__status p { margin: 0.3rem 0 0; font-size: 0.85rem; color: #55503f; line-height: 1.45; }

.checkout-success__trail {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.75rem;
  font-weight: 700;
}
.checkout-success__step {
  color: var(--ink-muted);
  padding-bottom: 0.3rem;
  border-bottom: 2px solid rgba(var(--ink-rgb), 0.14);
  flex: 1;
  text-align: center;
}
.checkout-success__step--done { color: var(--forest); border-color: var(--forest); }
.checkout-success__step--current { color: var(--ink); border-color: var(--marigold); }

/* ===== onboarding tour ===== */

.tour-welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(var(--ink-rgb), 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.tour-welcome-card {
  max-width: 400px;
  text-align: center;
}
.tour-welcome-card h2 { font-size: 1.3rem; margin-bottom: 0.6rem; }
.tour-welcome-card p { color: var(--ink-muted); margin-bottom: 1.25rem; }
.tour-welcome-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

/* The overlay captures clicks everywhere in the viewport, including over
   the spotlighted element — the tour is a guided walkthrough, not a live
   sandbox, so nothing on the page underneath should be actionable while
   it's showing (matches the spec's "do not actually add a book to the
   basket during the tour" step). Only the tooltip itself (pointer-events:
   auto) is interactive. The page stays visually recognizable through the
   dimming; it just isn't clickable. */
.tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  pointer-events: auto;
}
.tour-spotlight {
  position: absolute;
  border-radius: var(--radius-md);
  box-shadow: 0 0 0 9999px rgba(var(--ink-rgb), 0.72);
  transition: top 0.3s ease, left 0.3s ease, width 0.3s ease, height 0.3s ease;
}
.tour-tooltip {
  position: absolute;
  max-width: 320px;
  background: var(--paper-alt);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.25rem;
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.tour-tooltip__close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 999px;
  background: none;
  color: var(--ink-muted);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.tour-tooltip__close:hover { background: var(--surface-sunken); }
.tour-tooltip__progress { font-size: 0.75rem; font-weight: 700; color: var(--rsbv-orange); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.4rem; }
.tour-tooltip__title { font-size: 1.05rem; margin: 0 0 0.4rem; }
.tour-tooltip__desc { color: var(--ink-muted); font-size: 0.9rem; margin: 0 0 1rem; }
.tour-tooltip__actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.tour-tooltip__actions [data-tour-skip] { font-size: 0.8rem; margin-right: auto; }
.tour-tooltip__actions [data-tour-back] { font-size: 0.85rem; }

@media (prefers-reduced-motion: reduce) {
  .tour-spotlight, .tour-tooltip { transition: none; }
}

@media (max-width: 640px) {
  .tour-tooltip { padding: 1rem; }
  .tour-tooltip__actions { justify-content: space-between; }
  .tour-tooltip__actions [data-tour-skip] { width: 100%; order: 3; margin-right: 0; text-align: center; }
}

/* ===== AI chat widget ===== */

.ai-chat-toggle {
  position: fixed;
  right: 1.5rem;
  bottom: 5.5rem;
  z-index: 20;
  background: var(--marigold);
  color: var(--ink);
  border: none;
  border-radius: 999px;
  width: 3.2rem;
  height: 3.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}

.ai-chat-panel {
  position: fixed;
  right: 1.5rem;
  bottom: 9.5rem;
  z-index: 30;
  width: min(340px, calc(100vw - 3rem));
  max-height: min(480px, calc(100vh - 12rem));
  background: var(--paper);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}
.ai-chat-panel[hidden] { display: none; }
.ai-chat-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: var(--border-w) solid var(--ink);
}
.ai-chat-panel__header h2 { font-size: 1rem; margin: 0; }

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.ai-chat-message {
  font-size: 0.9rem;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius);
  max-width: 85%;
}
.ai-chat-message--assistant {
  background: var(--paper-alt);
  border: 1px solid #ddd0aa;
  align-self: flex-start;
}
.ai-chat-message--user {
  background: var(--marigold);
  align-self: flex-end;
}

.ai-chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: var(--border-w) solid var(--ink);
}
.ai-chat-form input {
  flex: 1;
  font-family: var(--font-body);
  padding: 0.5rem 0.7rem;
  border: var(--border-w) solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper-alt);
}

/* ===== order status / timeline ===== */

.line-items { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.line-items th, .line-items td { text-align: left; padding: 0.4rem 0.3rem; border-bottom: 1px solid #ddd0aa; }
.line-items tfoot td { border-bottom: none; font-weight: 600; }
.line-items__total td { font-size: 1.1rem; border-top: var(--border-w) solid var(--ink); padding-top: 0.6rem; }

.payment-area { margin-top: 1.5rem; }
.paid-confirmation { display: flex; align-items: center; gap: 0.4rem; color: var(--forest); font-weight: 700; }
.rejected-note { color: var(--terracotta); font-weight: 600; }

.timeline {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
  gap: 0.5rem;
}
.timeline__step {
  flex: 1;
  text-align: center;
  position: relative;
}
.timeline__dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  margin: 0 auto 0.4rem;
  border: 1px solid var(--border-hairline-strong);
  border-radius: 50%;
  background: var(--paper-alt);
}
.timeline__step--done .timeline__dot { background: var(--forest); color: var(--paper); }
/* Current step isn't color-only — a ring around the dot (a shape change,
   not just a hue change) and a bolder label both still read without color. */
.timeline__step--current .timeline__dot { background: var(--marigold); box-shadow: 0 0 0 3px rgba(var(--ink-rgb), 0.15); }
.timeline__step--current .timeline__label { font-weight: 800; }
.timeline__step--rejected .timeline__dot { background: var(--terracotta); border-color: var(--terracotta); }
.timeline__label { font-size: 0.8rem; font-weight: 600; }
.timeline--rejected .timeline__step--rejected .timeline__label { color: var(--terracotta); }

.pay-card__test-note { color: var(--ink-muted); font-size: 0.85rem; }

/* ===== admin ===== */

.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 220px;
  background: var(--paper-alt);
  border-right: var(--border-w) solid var(--ink);
  padding: 1.5rem 1rem;
  flex-shrink: 0;
}
.admin-sidebar__brand { display: flex; align-items: center; gap: 0.5rem; }
.admin-sidebar h2 { font-size: 1.1rem; margin: 0; }
.admin-sidebar nav { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 1.5rem; }
.admin-sidebar nav a {
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
}
.admin-sidebar nav a:hover { background: var(--paper); }
.admin-main { flex: 1; padding: 1.5rem 2rem 3rem; max-width: 1000px; }

.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.kpi-card { padding: 1rem; }
.kpi-card__label { font-size: 0.85rem; color: var(--ink-muted); }
.kpi-card__value { font-family: var(--font-display); font-size: 1.8rem; font-weight: 600; }

.status-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.status-tabs a {
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  padding: 0.35rem 0.8rem;
  border: var(--border-w) solid var(--ink);
  border-radius: 999px;
}
.status-tabs a.status-tabs__active { background: var(--marigold); }

.bulk-save-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
  padding: 0.6rem 0.9rem;
  border: var(--border-w) solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper-alt);
}
.bulk-save-bar #bulk-save-count { font-size: 0.9rem; color: var(--ink-muted); }
.bulk-save-bar[data-dirty="true"] #bulk-save-count { color: var(--ink); font-weight: 600; }

table.admin-table { width: 100%; border-collapse: collapse; }
table.admin-table th, table.admin-table td { text-align: left; padding: 0.5rem 0.5rem; border-bottom: 1px solid #ddd0aa; }
table.admin-table tr:hover { background: var(--paper-alt); }
table.admin-table a { text-decoration: none; font-weight: 600; }

.stock-check-table td.insufficient { color: var(--terracotta); font-weight: 700; }

.order-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; }
.order-actions form { display: inline; }

.reject-details summary { cursor: pointer; font-weight: 600; color: var(--terracotta); }
.reject-details textarea { margin-top: 0.5rem; width: 100%; }

.inline-form { display: flex; gap: 0.5rem; align-items: center; }
.inline-form input, .inline-form select { padding: 0.35rem 0.5rem; }

/* ===== customer site: tablet pass =====
   The header row now carries four groups — brand, primary nav (5 items),
   search, and the auth block (up to 5 items when logged in) — plus the
   basket icon. That's too much for one row well before mobile width.
   Dropping search to its own row first leaves nav+auth+basket room on the
   first row; each group's own flex-wrap already handles further squeeze. */
@media (max-width: 1024px) {
  .site-header__inner { flex-wrap: wrap; }
  .header-search { order: 3; flex: 1 1 100%; max-width: none; }
}

/* ===== customer site: mobile pass ===== */

@media (max-width: 640px) {
  .page { padding: 1rem 1rem 3rem; }
  .card { padding: 1.1rem; }
  .book-detail__cover-frame { flex-basis: 100%; max-width: 220px; margin: 0 auto; }

  /* Header/nav had no narrow-width handling at all — brand + nav forced
     into one row with justify-content:space-between left the nav squeezed
     into whatever space remained, wrapping awkwardly instead of getting
     its own row to wrap within. */
  .site-header__inner { flex-direction: column; align-items: flex-start; gap: 0.75rem; padding: 0.85rem 1.1rem; }
  .site-nav, .site-header__auth { width: 100%; gap: 0.6rem 1rem; }
  .header-search { width: 100%; max-width: none; }

  .hero--redesigned { padding: 1.5rem 1.25rem; margin-top: 0.5rem; }
  .hero__inner { flex-direction: column; align-items: flex-start; gap: 1.25rem; }
  .hero__headline { font-size: 1.5rem; }
  /* Fanned 5-card illustration needs more width than a 360-390px viewport
     has to spare alongside real headline/CTA/stat content — hidden rather
     than cramped, per the redesign brief's allowance for a simplified
     mobile treatment. */
  .hero__illustration { display: none; }
  .for-schools__grid { grid-template-columns: 1fr; }
  .zone-strip__row { gap: 0.6rem; }
  .zone-strip__item { flex: 1 1 40%; min-width: 0; padding: 0.7rem 0.75rem; }
  .shelf-card { width: 112px; }

  /* Search + Quick order stack instead of cramming into one row. */
  .ai-search { flex-wrap: wrap; }
  .ai-search input { flex-basis: 100%; }
  .ai-search #quick-order-toggle, .ai-search #ai-search-clear { flex: 1; justify-content: center; }

  /* Category tabs scroll horizontally rather than wrapping to many lines. */
  .category-tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 0.25rem; -webkit-overflow-scrolling: touch; }
  .category-tab { flex-shrink: 0; }

  .book-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.85rem; }

  /* Quick order table: tighter so it's usable, not just horizontally scrollable. */
  #quick-order-table { font-size: 0.85rem; }
  #quick-order-table th, #quick-order-table td { padding: 0.4rem 0.5rem; }
  .quick-order-qty { width: 3.2rem !important; }

  .basket-drawer__inner { padding: 1.1rem; }
  .segmented { flex-wrap: wrap; }

  .ai-chat-toggle { right: 1rem; bottom: 4.5rem; }
  .ai-chat-panel { right: 0.75rem; left: 0.75rem; width: auto; bottom: 7.5rem; }
}

/* ===== modal (confirm + quick actions) ===== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(var(--ink-rgb), 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.modal-overlay[hidden] { display: none; }
.modal-card {
  max-width: 420px;
  width: 100%;
}
.modal-card h2 { margin-top: 0; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

/* ===== KPI groups ===== */

.kpi-group { margin-bottom: 1.5rem; }
.kpi-group__title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  margin-bottom: 0.5rem;
}

/* ===== inventory status badges ===== */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: var(--border-w) solid var(--ink);
}
.status-badge--in-stock { background: var(--forest); color: #fff; }
.status-badge--low { background: var(--terracotta); color: #fff; }
.status-badge--out { background: var(--terracotta); color: #fff; }
.status-badge--inactive { background: #ddd0aa; color: var(--ink); }

/* ===== inventory table extras ===== */

.book-thumb {
  width: 40px;
  height: 52px;
  object-fit: cover;
  border: var(--border-w) solid var(--ink);
  border-radius: 3px;
  background: var(--paper);
}
.book-thumb-placeholder {
  width: 40px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: var(--border-w) dashed var(--ink);
  border-radius: 3px;
  color: var(--ink);
  opacity: 0.5;
}

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.actions-menu { position: relative; display: inline-block; }
.actions-menu__toggle {
  width: 2rem;
  height: 2rem;
  border: var(--border-w) solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper-alt);
  cursor: pointer;
  font-weight: 700;
}
.actions-menu__list {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--paper-alt);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 160px;
  z-index: 30;
  display: none;
  flex-direction: column;
}
.actions-menu.actions-menu--open .actions-menu__list { display: flex; }
.actions-menu__list button,
.actions-menu__list a {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.75rem;
  background: none;
  border: none;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 0.9rem;
  cursor: pointer;
}
.actions-menu__list button:hover,
.actions-menu__list a:hover { background: var(--paper); }
.actions-menu__list .danger { color: var(--terracotta); }

.quick-stock-form { display: flex; align-items: center; gap: 0.3rem; }
.quick-stock-form input { width: 3.5rem; padding: 0.25rem 0.4rem; }

.pagination { display: flex; gap: 0.5rem; align-items: center; margin-top: 1rem; }
.pagination a, .pagination span {
  padding: 0.35rem 0.7rem;
  border: var(--border-w) solid var(--ink);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
}
.pagination .pagination__current { background: var(--marigold); }

.filter-bar { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; margin-bottom: 1rem; }
.filter-bar .field { margin-bottom: 0; }

.activity-feed { list-style: none; padding: 0; margin: 0; }
.activity-feed li {
  padding: 0.5rem 0;
  border-bottom: 1px solid #ddd0aa;
  font-size: 0.9rem;
}
.activity-feed li:last-child { border-bottom: none; }

@media print {
  .site-header, .site-footer, .admin-sidebar, .rs-sidebar, .rs-topbar, .basket-toggle, .no-print { display: none !important; }
}

/* ===== A4 delivery note ===== */

@page { size: A4; margin: 1.5cm; }

.delivery-note-page { max-width: 720px; margin: 0 auto; }

.delivery-note {
  background: var(--paper-alt);
  border: var(--border-w) solid var(--ink);
  border-radius: var(--radius);
  padding: 2rem;
}

.delivery-note__letterhead {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: var(--border-w) solid var(--ink);
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  gap: 1rem;
}
.delivery-note__contact {
  text-align: right;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.delivery-note__meta {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0;
}
.delivery-note__meta td { padding: 0.25rem 0.5rem 0.25rem 0; }

.delivery-note__signoff {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.5rem;
  margin-top: 2.5rem;
}
.delivery-note__line {
  border-bottom: 1px solid var(--ink);
  height: 2rem;
}

/* ===== school order builder ===== */

.order-builder-header { margin-bottom: var(--space-5); }
.order-builder-header h1 { font-size: var(--text-2xl); line-height: var(--text-2xl-lh); margin: 0 0 var(--space-1); }
.order-builder-header p { color: var(--ink-muted); margin: 0; }

.order-builder {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-5);
  align-items: start;
}
@media (max-width: 800px) {
  .order-builder { grid-template-columns: 1fr; }
}

.order-builder__picker, .order-builder__summary { padding: var(--space-5); }
.order-builder__summary { position: sticky; top: var(--space-4); }
.order-builder__summary h2 { font-size: var(--text-lg); margin: 0 0 var(--space-3); }

.order-builder__hint { color: var(--ink-muted); font-size: var(--text-sm); margin: 0; }

.order-builder__books { margin: var(--space-4) 0; display: flex; flex-direction: column; gap: var(--space-2); }
.order-builder__row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-hairline);
}
.order-builder__row-title { flex: 1; min-width: 0; font-weight: 600; font-size: var(--text-sm); }
.order-builder__row-price { color: var(--ink-muted); font-size: var(--text-sm); flex-shrink: 0; }
.order-builder__row-qty {
  width: 3.5rem;
  flex-shrink: 0;
  border: 1px solid var(--border-hairline-strong);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  text-align: center;
  padding: 0.3rem;
}

.order-builder__summary-class { margin-bottom: var(--space-4); padding-bottom: var(--space-3); border-bottom: 1px solid var(--border-hairline); }
.order-builder__summary-class-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-2); }
.order-builder__summary-class-head strong { font-size: var(--text-sm); }
.order-builder__summary-class-head .link-button { font-size: var(--text-sm); color: var(--terracotta); font-weight: 600; }
.order-builder__summary-row { display: flex; align-items: center; justify-content: space-between; font-size: var(--text-sm); color: var(--ink-muted); padding: 0.15rem 0; }

.order-builder__totals { margin: var(--space-4) 0; padding-top: var(--space-3); border-top: 1px solid var(--border-hairline); }
.order-builder__totals-line { display: flex; align-items: center; justify-content: space-between; font-size: var(--text-sm); padding: 0.2rem 0; }
.order-builder__totals-line--price { font-size: var(--text-base); font-weight: 800; margin-top: var(--space-1); }

@media print {
  .delivery-note { border: none; box-shadow: none; padding: 0; }
}
