:root {
  --ps-green: #01411c;
  --ps-green-dark: #003314;
  --ps-green-soft: #e8f0ea;
  --ps-gold: #fbbf24;
  --ps-gold-dark: #d97706;
  --ps-ink: #14231a;
  --ps-muted: #5b6b61;
  --ps-line: #d9e2dc;
  --ps-card: #ffffff;
  --ps-surface: #f4f6f2;
  --ps-danger: #b91c1c;
  --ps-warning: #b45309;
  --ps-success: #15803d;
  --ps-shadow: 0 18px 45px rgba(1, 65, 28, 0.08);
  --ps-shadow-soft: 0 8px 22px rgba(20, 35, 26, 0.06);
  --ps-radius: 18px;
  --ps-radius-sm: 12px;
  --ps-max: 1380px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ps-ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(251, 191, 36, 0.12), transparent 32%),
    radial-gradient(circle at 90% 10%, rgba(1, 65, 28, 0.10), transparent 34%),
    var(--ps-surface);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid rgba(251, 191, 36, 0.75); outline-offset: 2px; }
.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; }

.icon { width: 18px; height: 18px; display: inline-block; vertical-align: middle; }

/* ── Top bar ── */
.ps-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px clamp(18px, 4vw, 42px);
  background: linear-gradient(135deg, rgba(1, 65, 28, 0.96), rgba(0, 51, 20, 0.96));
  color: #fff;
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 30px rgba(1, 65, 28, 0.18);
}
.ps-brand { display: flex; align-items: center; gap: 12px; color: #fff; }
.ps-brand-mark {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--ps-gold); color: var(--ps-green-dark);
  font-weight: 800; letter-spacing: -0.04em;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.12);
}
.ps-brand-text { font-size: 1.05rem; font-weight: 700; }
.ps-brand-text em { font-style: normal; color: var(--ps-gold); font-weight: 600; }
.ps-topnav { display: flex; gap: 6px; margin-left: 14px; flex-wrap: wrap; }
.ps-topnav a {
  padding: 8px 12px; border-radius: 999px; color: rgba(255,255,255,0.82);
  font-size: 0.9rem; font-weight: 500; transition: background .18s, color .18s;
}
.ps-topnav a:hover { background: rgba(255,255,255,0.10); color: #fff; }
.ps-topnav a.is-active { background: rgba(251, 191, 36, 0.18); color: var(--ps-gold); }
.ps-topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.ps-icon-button {
  width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.18); background: rgba(255,255,255,0.08);
  color: #fff; display: grid; place-items: center;
}
.ps-icon-button:hover { background: rgba(255,255,255,0.16); }

/* ── Buttons ── */
.ps-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 12px;
  padding: 10px 16px; font-size: 0.92rem; font-weight: 600;
  transition: transform .12s, box-shadow .18s, background .18s, border-color .18s;
}
.ps-button:hover { transform: translateY(-1px); }
.ps-button:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.ps-button-primary { background: var(--ps-green); color: #fff; box-shadow: 0 10px 22px rgba(1,65,28,0.18); }
.ps-button-primary:hover { background: var(--ps-green-dark); }
.ps-button-secondary { background: #fff; color: var(--ps-ink); border-color: var(--ps-line); }
.ps-button-secondary:hover { border-color: var(--ps-green); }
.ps-button-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,0.22); }
.ps-button-small { padding: 7px 11px; font-size: 0.82rem; border-radius: 10px; }
.ps-button-large { padding: 15px 22px; font-size: 1rem; border-radius: 14px; }
.ps-link { background: none; border: 0; color: var(--ps-green); font-weight: 600; padding: 4px 2px; }
.ps-link:hover { text-decoration: underline; }

/* ── Page layout ── */
.ps-page { max-width: var(--ps-max); margin: 0 auto; padding: 28px clamp(16px, 4vw, 40px) 120px; }
.ps-hero { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.ps-eyebrow { margin: 0 0 6px; color: var(--ps-green); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; }
.ps-hero h1 { margin: 0; font-size: clamp(2rem, 4vw, 2.7rem); line-height: 1.05; letter-spacing: -0.03em; }
.ps-hero-copy { margin: 10px 0 0; max-width: 720px; color: var(--ps-muted); font-size: 1rem; }
.ps-hero-meta { display: flex; gap: 10px; flex-wrap: wrap; }
.ps-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 13px; border-radius: 999px; background: #fff;
  border: 1px solid var(--ps-line); font-size: 0.86rem; font-weight: 600;
  box-shadow: var(--ps-shadow-soft);
}
.ps-pill-soft { background: var(--ps-green-soft); color: var(--ps-green); border-color: transparent; }

.ps-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; margin-bottom: 18px; border-radius: var(--ps-radius-sm);
  background: #fff7e6; border: 1px solid #f3d38a; color: #7a5a10;
}
.ps-banner[hidden] { display: none; }

/* Steps */
.ps-steps { list-style: none; padding: 0; margin: 0 0 24px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.ps-steps li button {
  width: 100%; border: 1px solid var(--ps-line); background: #fff; border-radius: var(--ps-radius-sm);
  padding: 12px 14px; display: flex; align-items: center; gap: 10px; font-weight: 600;
  color: var(--ps-muted); transition: border-color .18s, background .18s, color .18s;
}
.ps-steps li button span {
  width: 28px; height: 28px; border-radius: 999px; display: grid; place-items: center;
  background: var(--ps-green-soft); color: var(--ps-green); font-size: 0.85rem;
}
.ps-steps li button.is-active { border-color: var(--ps-green); color: var(--ps-ink); background: #fff; }
.ps-steps li button.is-active span { background: var(--ps-green); color: #fff; }
.ps-steps li button:disabled { opacity: .55; }
.ps-steps li button.is-complete span { background: var(--ps-success); color: #fff; }

.ps-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.ps-main { min-width: 0; }
.ps-panel {
  background: var(--ps-card); border: 1px solid var(--ps-line); border-radius: var(--ps-radius);
  padding: clamp(18px, 3vw, 30px); box-shadow: var(--ps-shadow-soft);
  margin-bottom: 20px;
}
.ps-panel[hidden] { display: none; }
.ps-panel-head h2 { margin: 0 0 4px; font-size: 1.25rem; letter-spacing: -0.02em; }
.ps-panel-head p { margin: 0; color: var(--ps-muted); font-size: 0.92rem; }
.ps-subcard {
  border: 1px solid var(--ps-line);
  border-radius: var(--ps-radius-sm);
  background: #fbfcfa;
  padding: 18px 18px 6px;
  margin-bottom: 18px;
}
.ps-subcard-head { margin-bottom: 14px; }
.ps-subcard-head h3 { margin: 0 0 2px; font-size: 1rem; color: var(--ps-green); }
.ps-subcard-head p { margin: 0; color: var(--ps-muted); font-size: 0.85rem; }
.ps-panel-subhead h3 { margin: 0 0 2px; font-size: 1rem; }
.ps-panel-subhead p { margin: 0; color: var(--ps-muted); font-size: 0.88rem; }

.ps-field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.ps-label { font-size: 0.86rem; font-weight: 600; color: var(--ps-ink); }
.ps-field label { font-size: 0.86rem; font-weight: 600; }
.ps-optional, .ps-help-inline { color: var(--ps-muted); font-weight: 400; font-size: 0.8rem; }
.ps-help { margin: 6px 0 0; color: var(--ps-muted); font-size: 0.82rem; }
.ps-help.is-bad { color: var(--ps-danger); }
input, select, textarea {
  width: 100%; border: 1px solid var(--ps-line); border-radius: 12px; padding: 11px 13px;
  background: #fff; color: var(--ps-ink); transition: border-color .16s, box-shadow .16s;
}
input:focus, select:focus, textarea:focus { border-color: var(--ps-green); box-shadow: 0 0 0 4px rgba(1,65,28,0.08); }
textarea { resize: vertical; min-height: 78px; }
.ps-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ps-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }

/* Class grid */
.ps-class-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.ps-class-card {
  border: 1px solid var(--ps-line); background: #fff; border-radius: 14px;
  padding: 14px 8px; text-align: center; cursor: pointer; transition: all .16s;
}
.ps-class-card strong { display: block; font-size: 1.05rem; }
.ps-class-card span { display: block; margin-top: 3px; font-size: 0.75rem; color: var(--ps-muted); }
.ps-class-card:hover { border-color: var(--ps-green); transform: translateY(-1px); }
.ps-class-card.is-selected { background: var(--ps-green); color: #fff; border-color: var(--ps-green); box-shadow: 0 10px 20px rgba(1,65,28,0.18); }
.ps-class-card.is-selected span { color: rgba(255,255,255,0.78); }
.ps-class-card.is-disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* Subject + book */
.ps-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ps-book-chip {
  display: flex; align-items: center; gap: 10px; min-height: 44px;
  padding: 11px 13px; border-radius: 12px; border: 1px solid var(--ps-line);
  background: var(--ps-green-soft); color: var(--ps-green); font-weight: 600; font-size: 0.88rem;
}
.ps-book-chip .icon { color: var(--ps-green); }

/* Scope */
.ps-scope-card { border: 1px solid var(--ps-line); border-radius: var(--ps-radius-sm); padding: 16px; margin: 10px 0 18px; background: #fbfcfa; }
.ps-scope-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.ps-segmented { display: inline-flex; border: 1px solid var(--ps-line); border-radius: 999px; overflow: hidden; background: #fff; }
.ps-segmented label { position: relative; }
.ps-segmented input { position: absolute; opacity: 0; pointer-events: none; }
.ps-segmented span { display: block; padding: 8px 14px; font-size: 0.86rem; font-weight: 600; color: var(--ps-muted); cursor: pointer; }
.ps-segmented input:checked + span { background: var(--ps-green); color: #fff; }
.ps-chapter-scope { margin-top: 12px; }
.ps-chapter-scope[hidden] { display: none; }
.ps-scope-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.ps-scope-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ps-scope-count { font-size: 0.82rem; color: var(--ps-muted); font-weight: 600; }
.ps-search { position: relative; }
.ps-search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ps-muted); }
.ps-search input { padding-left: 36px; }
.ps-check-list { max-height: 260px; overflow: auto; border: 1px solid var(--ps-line); border-radius: 12px; background: #fff; }
.ps-check-list-compact { max-height: 220px; }
.ps-check-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-bottom: 1px solid #eef2ee; }
.ps-check-item:last-child { border-bottom: 0; }
.ps-check-item input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--ps-green); }
.ps-check-item label { flex: 1; min-width: 0; }
.ps-check-item strong { display: block; font-size: 0.88rem; line-height: 1.25; }
.ps-check-item small { display: block; color: var(--ps-muted); font-size: 0.76rem; margin-top: 3px; }
.ps-check-item .ps-count { color: var(--ps-green); font-weight: 700; font-size: 0.76rem; white-space: nowrap; }
.ps-check-item.is-disabled { opacity: .45; }
.ps-details { margin-top: 12px; border: 1px solid var(--ps-line); border-radius: 12px; padding: 10px 12px; background: #fff; }
.ps-details summary { cursor: pointer; font-weight: 600; color: var(--ps-green); }
.ps-details[open] .ps-search { margin-top: 10px; }

/* Duration */
.ps-duration { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.ps-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.ps-chip {
  border: 1px solid var(--ps-line); background: #fff; border-radius: 999px;
  padding: 8px 13px; font-size: 0.84rem; font-weight: 600; color: var(--ps-muted);
}
.ps-chip.is-selected { background: var(--ps-green); color: #fff; border-color: var(--ps-green); }
.ps-duration-custom { display: flex; align-items: center; gap: 8px; font-size: 0.84rem; color: var(--ps-muted); }
.ps-duration-custom input { width: 96px; }
.ps-duration-selects { display: flex; align-items: center; gap: 6px; }
.ps-duration-selects select { width: auto; min-width: 104px; padding: 9px 30px 9px 12px; }
.ps-duration-sep { font-weight: 700; color: var(--ps-muted); }
.ps-duration .ps-help { margin-top: 6px; }

/* Sections */
.ps-quick-layouts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.ps-layout {
  border: 1px solid var(--ps-line); background: #fff; border-radius: 999px;
  padding: 8px 13px; font-size: 0.84rem; font-weight: 600; color: var(--ps-ink);
}
.ps-layout:hover { border-color: var(--ps-green); color: var(--ps-green); }
.ps-section-list { display: flex; flex-direction: column; gap: 14px; }
.ps-section-card {
  border: 1px solid var(--ps-line); border-radius: var(--ps-radius-sm); background: #fff;
  overflow: hidden; box-shadow: var(--ps-shadow-soft);
}
.ps-section-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: #f8faf8; border-bottom: 1px solid var(--ps-line);
}
.ps-section-index {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--ps-green); color: #fff; font-weight: 700; font-size: 0.85rem; flex: none;
}
.ps-section-title-input { flex: 1; min-width: 0; border-color: transparent; background: transparent; padding: 8px 10px; font-weight: 600; }
.ps-section-title-input:focus { background: #fff; border-color: var(--ps-green); }
.ps-availability-pill {
  font-size: 0.78rem; font-weight: 700; padding: 5px 9px; border-radius: 999px;
  background: var(--ps-green-soft); color: var(--ps-green); white-space: nowrap;
}
.ps-availability-pill.is-warning { background: #fff4e5; color: var(--ps-warning); }
.ps-availability-pill.is-danger { background: #fde8e8; color: var(--ps-danger); }
.ps-icon-action { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--ps-line); background: #fff; display: grid; place-items: center; color: var(--ps-muted); }
.ps-icon-action:hover { color: var(--ps-green); border-color: var(--ps-green); }
.ps-section-body { padding: 14px; display: grid; grid-template-columns: 1.2fr 0.8fr 0.8fr 0.9fr; gap: 12px; }
.ps-section-body .ps-field { margin: 0; }
.ps-section-instructions { padding: 0 14px 14px; }
.ps-section-instructions summary { cursor: pointer; color: var(--ps-muted); font-size: 0.84rem; font-weight: 600; }
.ps-section-instructions textarea { margin-top: 8px; }
.ps-add-section { display: flex; gap: 10px; margin-top: 16px; }
.ps-add-section select { max-width: 260px; }
.ps-totals {
  margin-top: 18px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.ps-totals > div { background: #f8faf8; border: 1px solid var(--ps-line); border-radius: 12px; padding: 12px 14px; }
.ps-totals span { display: block; color: var(--ps-muted); font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.ps-totals strong { display: block; margin-top: 4px; font-size: 1.2rem; }
.ps-empty { padding: 28px 16px; text-align: center; color: var(--ps-muted); border: 1px dashed var(--ps-line); border-radius: 12px; background: #fff; }

/* Review */
.ps-review { display: grid; gap: 12px; }
.ps-review-card { border: 1px solid var(--ps-line); border-radius: 12px; background: #fff; padding: 14px; }
.ps-review-card h4 { margin: 0 0 8px; font-size: 0.95rem; }
.ps-review-list { margin: 0; padding-left: 18px; color: var(--ps-muted); font-size: 0.88rem; }
.ps-review-list li { margin-bottom: 4px; }
.ps-option-row { margin: 18px 0; }
.ps-toggle { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.ps-toggle input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--ps-green); }
.ps-toggle span { display: flex; flex-direction: column; gap: 2px; }
.ps-toggle small { color: var(--ps-muted); font-size: 0.82rem; }
.ps-availability {
  border: 1px solid var(--ps-line); border-radius: 12px; background: #fff; padding: 14px;
  margin: 16px 0;
}
.ps-availability h4 { margin: 0 0 8px; font-size: 0.95rem; }
.ps-availability ul { margin: 0; padding-left: 18px; color: var(--ps-muted); font-size: 0.86rem; }
.ps-availability li { margin-bottom: 4px; }
.ps-availability .is-ok { color: var(--ps-success); }
.ps-generation-error { border-color: #f2b8b8; background: #fff5f5; }
.ps-generation-error .is-bad { color: var(--ps-danger); }
.ps-generate-cta { text-align: center; padding: 10px 0 4px; }

/* Aside */
.ps-aside { position: sticky; top: 96px; display: flex; flex-direction: column; gap: 18px; }
.ps-blueprint, .ps-bank-status {
  background: var(--ps-card); border: 1px solid var(--ps-line); border-radius: var(--ps-radius);
  padding: 16px; box-shadow: var(--ps-shadow-soft);
}
.ps-blueprint-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.ps-blueprint-head h3 { margin: 0; font-size: 1rem; }
.ps-paper {
  background: #fff; border: 1px solid #cfd8d2; border-radius: 10px;
  padding: 16px 14px; min-height: 360px; font-size: 0.72rem; line-height: 1.35;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.03);
  font-family: "Georgia", "Times New Roman", serif;
}
.ps-paper-school { text-align: center; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; color: #555; margin-bottom: 4px; }
.ps-paper h4 { text-align: center; margin: 0 0 4px; font-size: 0.9rem; }
.ps-paper-subtitle { text-align: center; font-size: 0.75rem; font-weight: 600; margin-bottom: 8px; }
.ps-paper-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 10px; font-size: 0.68rem; color: #555; margin-bottom: 8px; }
.ps-paper-fields { display: flex; align-items: baseline; gap: 6px; flex-wrap: nowrap; border-top: 1px dashed #aaa; border-bottom: 1px dashed #aaa; padding: 6px 0; margin-bottom: 8px; font-size: 0.66rem; }
.ps-paper-fields .sf-item { display: flex; align-items: baseline; gap: 3px; min-width: 0; }
.ps-paper-fields .sf-label { white-space: nowrap; }
.ps-paper-fields .sf-blank { flex: 1 1 auto; min-width: 1.2em; height: 1.1em; border-bottom: 1px solid #333; }
.ps-paper-fields .sf-name { flex: 3 1 0; }
.ps-paper-fields .sf-roll { flex: 1.6 1 0; }
.ps-paper-fields .sf-section { flex: 1 1 0; }
.ps-paper-instructions { background: #f9fafb; border: 1px solid #eee; border-radius: 4px; padding: 5px 7px; font-size: 0.66rem; color: #444; margin-bottom: 8px; }
.ps-paper-section { margin-top: 8px; }
.ps-paper-section-title { font-weight: 700; font-size: 0.72rem; border-bottom: 1px solid #ddd; padding-bottom: 3px; margin-bottom: 4px; }
.ps-paper-q { margin: 4px 0; font-size: 0.68rem; }
.ps-paper-group { font-weight: 700; margin-top: 7px; }
.ps-paper-part { margin-left: 16px; font-size: 0.65rem; }
.ps-paper-footer { text-align: center; margin-top: 10px; font-size: 0.62rem; color: #888; border-top: 1px solid #ddd; padding-top: 6px; }
.ps-bank-body { font-size: 0.86rem; color: var(--ps-muted); }

/* Live header preview — mirrors the printed paper header */
.ps-header-card { position: relative; }
.ps-header-preview {
  background: #fff;
  border: 1px solid #cfd8d2;
  border-radius: 8px;
  padding: 16px 14px;
  text-align: center;
  font-family: Georgia, "Times New Roman", serif;
  color: #1a1a1a;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.03);
}
/* School monogram picker */
.ps-logo-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ps-file-input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.ps-logo-preview {
  width: 52px; height: 52px; border-radius: 10px; border: 1px solid var(--ps-line);
  background: #fff; display: grid; place-items: center; overflow: hidden; flex: none;
}
.ps-logo-preview[hidden] { display: none; }
.ps-logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }

.ps-header-preview .school-line {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 4px;
}
.ps-header-preview .school-line[hidden] { display: none; }
.ps-header-preview .school-monogram { width: 34px; height: 34px; object-fit: contain; flex: none; }
.ps-header-preview .school-name {
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; margin-bottom: 4px; color: #1a1a1a;
}
.ps-header-preview .school-name[hidden] { display: none; }
.ps-header-preview h4 {
  margin: 0; font-size: 1rem; font-weight: 700; line-height: 1.25;
  border-bottom: 2px solid #1f2937; padding-bottom: 8px;
}
.ps-header-preview .paper-subtitle {
  font-size: 0.8rem; font-weight: 600; margin-top: 6px; color: #374151;
}
.ps-header-preview .meta-grid {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 3px 14px;
  margin-top: 9px; font-size: 0.72rem; color: #374151;
}
.ps-header-preview .meta-grid b { color: #111827; }
.ps-header-preview .student-fields {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: nowrap;
  margin-top: 12px; padding-top: 8px; border-top: 1px dashed #9ca3af;
  font-size: 0.68rem; text-align: left;
}
.ps-header-preview .student-fields[hidden] { display: none; }
.ps-header-preview .sf-item { display: flex; align-items: baseline; gap: 4px; min-width: 0; }
.ps-header-preview .sf-label { white-space: nowrap; }
.ps-header-preview .sf-blank { flex: 1 1 auto; min-width: 1.5em; height: 1.1em; border-bottom: 1px solid #333; }
.ps-header-preview .sf-name { flex: 3 1 0; }
.ps-header-preview .sf-roll { flex: 1.6 1 0; }
.ps-header-preview .sf-section { flex: 1 1 0; }
.ps-header-preview .general-instructions {
  margin-top: 9px; padding: 7px 9px; background: #f9fafb;
  border: 1px solid #e5e7eb; border-radius: 4px;
  font-size: 0.7rem; line-height: 1.45; color: #374151; text-align: left;
}
.ps-header-preview .general-instructions[hidden] { display: none; }
.ps-header-hint { margin: 9px 0 0; font-size: 0.74rem; }
[hidden] { display: none !important; }
.ps-bank-row { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid #eef2ee; }
.ps-bank-row:last-child { border-bottom: 0; }
.ps-bank-row strong { color: var(--ps-ink); }

/* Action bar */
.ps-action-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px;
  width: min(var(--ps-max), calc(100% - 32px)); z-index: 40;
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  padding: 12px 16px; border-radius: 18px; background: rgba(255,255,255,0.92);
  border: 1px solid var(--ps-line); box-shadow: 0 18px 40px rgba(20,35,26,0.14);
  backdrop-filter: blur(12px);
}
.ps-action-progress { display: flex; flex-direction: column; gap: 4px; }
.ps-action-progress span { font-size: 0.78rem; color: var(--ps-muted); font-weight: 600; }
.ps-progress { height: 7px; border-radius: 999px; background: #e8efe9; overflow: hidden; }
.ps-progress > div { height: 100%; width: 33%; background: var(--ps-green); border-radius: 999px; transition: width .25s; }

/* Modal */
.ps-modal-backdrop {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center;
  padding: 20px; background: rgba(10, 24, 16, 0.55); backdrop-filter: blur(6px);
}
.ps-modal-backdrop[hidden] { display: none; }
.ps-modal {
  width: min(560px, 100%); background: #fff; border-radius: 24px; padding: 26px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.28); position: relative;
  max-height: calc(100vh - 40px); overflow-y: auto; overscroll-behavior: contain;
}
.ps-modal-close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--ps-line); background: #fff; display: grid; place-items: center; color: var(--ps-muted); }
.ps-modal-icon { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; background: var(--ps-green-soft); color: var(--ps-green); margin-bottom: 14px; }
.ps-modal-icon .icon { width: 28px; height: 28px; }
.ps-modal h2 { margin: 0 0 6px; }
.ps-modal-copy { margin: 0 0 16px; color: var(--ps-muted); }
.ps-modal-meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.ps-modal-meta > div { background: #f8faf8; border: 1px solid var(--ps-line); border-radius: 12px; padding: 10px 12px; }
.ps-modal-meta span { display: block; font-size: 0.75rem; color: var(--ps-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.ps-modal-meta strong { display: block; margin-top: 3px; font-size: 1rem; }
.ps-share-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--ps-line); border-radius: 12px; background: #f8faf8; margin-bottom: 16px; }
.ps-share-box strong { font-size: 1.35rem; letter-spacing: 0.18em; color: var(--ps-green); }
.ps-modal-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.ps-modal-secondary { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* Toast */
.ps-toast {
  position: fixed; top: 20px; right: 20px; z-index: 90; max-width: 360px;
  background: #fff; border: 1px solid var(--ps-line); border-radius: 14px;
  box-shadow: 0 18px 40px rgba(20,35,26,0.16); padding: 14px 16px;
  font-size: 0.9rem; color: var(--ps-ink);
}
.ps-toast[hidden] { display: none; }
.ps-toast.is-error { border-color: #f2b8b8; background: #fff5f5; }
.ps-toast.is-success { border-color: #b7e0c2; background: #f2faf4; }

/* ── Public demo mode ── */
body:not(.ps-teacher-mode) .ps-teacher-only { display: none !important; }
body:not(.ps-demo-mode) .ps-guest-only { display: none !important; }
.ps-auth-actions { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.ps-pill-demo { background: #fff7e6; border-color: #f3d38a; color: #7a5a10; }
.ps-demo-banner {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; margin: -6px 0 20px;
  background: linear-gradient(135deg, #fffaf0, #fff);
  border: 1px solid #f3d38a; border-radius: var(--ps-radius-sm);
  box-shadow: var(--ps-shadow-soft);
}
.ps-demo-icon {
  width: 44px; height: 44px; flex: none; border-radius: 12px;
  display: grid; place-items: center; background: #fff3d6; color: #b45309;
}
.ps-demo-copy { min-width: 0; }
.ps-demo-copy strong { display: block; color: #5f430b; }
.ps-demo-copy p { margin: 3px 0 0; color: #7a5a10; font-size: 0.88rem; line-height: 1.45; }
.ps-demo-banner > .ps-button { margin-left: auto; flex: none; }
.ps-demo-gate-note {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ps-warning); font-weight: 600;
}
.ps-demo-gate-note .icon { width: 15px; height: 15px; }
.ps-modal-icon-gold { background: #fff7e6; color: #b45309; }
.ps-auth-modal h2 { font-size: 1.35rem; line-height: 1.2; padding-right: 24px; }
.ps-auth-benefits {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px;
}
.ps-auth-benefits span {
  background: var(--ps-green-soft); color: var(--ps-green);
  border-radius: 999px; padding: 6px 10px; font-size: 0.8rem; font-weight: 600;
}
.ps-auth-modal-actions { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 18px 0 10px; }
.ps-auth-modal-actions .ps-button { width: 100%; }
.ps-auth-note { text-align: center; margin: 0 0 14px; }

/* Responsive */
@media (max-width: 1180px) {
  .ps-grid { grid-template-columns: 1fr; }
  .ps-aside { position: static; }
  .ps-class-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .ps-hero { flex-direction: column; align-items: flex-start; }
  .ps-grid-2, .ps-grid-3, .ps-two-col { grid-template-columns: 1fr; }
  .ps-class-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ps-section-body { grid-template-columns: 1fr 1fr; }
  .ps-totals { grid-template-columns: 1fr; }
  .ps-modal-meta { grid-template-columns: 1fr; }
  .ps-demo-banner { flex-wrap: wrap; align-items: flex-start; }
  .ps-demo-banner > .ps-button { margin-left: 58px; }
  .ps-topbar { gap: 10px; }
  .ps-topnav { display: none; }
  .ps-brand-text { font-size: 0.95rem; }
  .ps-topbar .ps-auth-actions .ps-button { padding: 8px 10px; font-size: 0.82rem; }
}
@media (max-width: 620px) {
  .ps-topbar { flex-wrap: wrap; }
  .ps-topbar-actions { width: 100%; justify-content: flex-end; }
  .ps-topnav { display: none; }
  .ps-class-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ps-section-body { grid-template-columns: 1fr; }
  .ps-action-bar { grid-template-columns: 1fr; gap: 8px; }
  .ps-action-progress { order: -1; }
  .ps-steps { grid-template-columns: 1fr; }
  .ps-demo-banner > .ps-button { margin-left: 0; width: 100%; }
  .ps-auth-actions .ps-button { padding: 8px 10px; font-size: 0.82rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto; }
}
