:root {
  --ink: #1f2f2a;
  --navy: #173a6c;
  --blue: #176da0;
  --red: #cf452f;
  --green: #4b8c3c;
  --purple: #75509b;
  --gold: #e5a915;
  --orange: #dc6f20;
  --cream: #fff7df;
  --paper: #fffdf5;
  --muted: #5e6b63;
  --panel: #ffffff;
  --screen: #edf1ec;
  --page-width: 816px;
  --page-height: 1056px;
  --preview-scale: 1;
  --shadow: 0 24px 70px rgba(35, 48, 41, 0.18);
  color: var(--ink);
  background: var(--screen);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 8% 4%, rgba(229, 169, 21, 0.15), transparent 28rem),
    radial-gradient(circle at 95% 12%, rgba(23, 109, 160, 0.12), transparent 30rem),
    var(--screen);
}

button,
input,
select,
textarea { font: inherit; }

button { cursor: pointer; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(23, 109, 160, 0.3);
  outline-offset: 2px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.1rem clamp(1rem, 4vw, 3.5rem);
  border-bottom: 1px solid #d7ded7;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 780px;
}

.brand-block h1 {
  margin: 0.08rem 0 0.2rem;
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  line-height: 1.05;
}

.brand-block p {
  margin: 0;
  color: #56665d;
  line-height: 1.45;
}

.brand-mark {
  flex: 0 0 auto;
  width: 3.5rem;
  height: 3.5rem;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(145deg, var(--red), #ed725b);
  border: 3px solid var(--ink);
  border-radius: 1rem;
  transform: rotate(-4deg);
}

.brand-mark span {
  font-size: 1.75rem;
  transform: rotate(4deg);
}

.eyebrow,
.step-label {
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.button {
  padding: 0.8rem 1rem;
  border: 2px solid var(--ink);
  border-radius: 0.8rem;
  box-shadow: 0 4px 0 var(--ink);
  font-weight: 800;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 0 var(--ink);
}

.button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ink);
}

.button.primary {
  color: white;
  background: var(--blue);
}

.button.secondary {
  color: var(--ink);
  background: white;
}

.privacy-banner {
  margin: 1rem clamp(1rem, 4vw, 3.5rem) 0;
  padding: 0.85rem 1rem;
  color: #2d5139;
  background: #e7f4ea;
  border: 1px solid #b7d5bf;
  border-left: 5px solid var(--green);
  border-radius: 0.8rem;
  line-height: 1.45;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(330px, 440px) minmax(0, 1fr);
  align-items: start;
  gap: 1.25rem;
  padding: 1.25rem clamp(1rem, 4vw, 3.5rem) 3rem;
}

.editor-panel,
.preview-panel {
  border: 1px solid #d7ded7;
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 40px rgba(35, 48, 41, 0.08);
}

.editor-panel {
  position: sticky;
  top: 7rem;
  max-height: calc(100vh - 8.25rem);
  overflow: auto;
  padding: 1.15rem;
}

.panel-heading,
.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.panel-heading h2,
.preview-toolbar h2 { margin: 0.1rem 0 0; }

.panel-heading p,
.preview-toolbar p { margin: 0; }

.memory-pill {
  padding: 0.4rem 0.65rem;
  color: #275d38;
  background: #e4f2e7;
  border: 1px solid #b4d5bc;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.page-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  margin: 1rem 0;
}

.page-tab {
  min-height: 3.1rem;
  padding: 0.5rem 0.4rem;
  color: #4d5c53;
  background: #f7f8f6;
  border: 1px solid #c9d2ca;
  border-radius: 0.65rem;
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.15;
}

.page-tab.active {
  color: white;
  background: var(--blue);
  border-color: var(--blue);
}

.editor-fields {
  display: grid;
  gap: 0.95rem;
  margin: 0;
}

.field-group {
  display: grid;
  gap: 0.4rem;
}

.field-group > label,
.field-label {
  color: #293c32;
  font-size: 0.84rem;
  font-weight: 850;
}

.field-hint,
.field-counter {
  margin: 0;
  color: #5f6d64;
  font-size: 0.75rem;
  line-height: 1.4;
}

.field-meta {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.75rem;
}

.field-counter {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.field-group input[type="text"],
.field-group input[type="tel"],
.field-group input[type="email"],
.field-group input[type="date"],
.field-group input[type="file"],
.field-group select,
.field-group textarea {
  width: 100%;
  padding: 0.72rem 0.78rem;
  color: var(--ink);
  background: white;
  border: 1px solid #b9c5bc;
  border-radius: 0.65rem;
}

.field-group textarea {
  min-height: 7rem;
  resize: vertical;
  line-height: 1.5;
}

.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(23, 109, 160, 0.14);
}

.photo-workspace {
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem;
  background: #f8faf7;
  border: 1px solid #cbd5cc;
  border-radius: 0.9rem;
}

.photo-workspace h3 {
  margin: 0;
  font-size: 0.95rem;
}

.photo-library {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.photo-slot {
  position: relative;
  min-width: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  color: #506057;
  background: white;
  border: 1px dashed #9eaea3;
  border-radius: 0.7rem;
}

.photo-slot.has-photo { border-style: solid; }

.photo-slot img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.photo-slot input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.photo-slot-label {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 0.45rem;
  text-align: center;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 800;
}

.photo-slot.has-photo .photo-slot-label {
  top: auto;
  color: white;
  background: rgba(26, 42, 34, 0.78);
}

.remove-photo {
  position: absolute;
  z-index: 3;
  top: 0.28rem;
  right: 0.28rem;
  width: 1.55rem;
  height: 1.55rem;
  display: grid;
  place-items: center;
  padding: 0;
  color: #702017;
  background: #fff0ed;
  border: 1px solid #d8a29a;
  border-radius: 50%;
  font-weight: 900;
}

.contact-photo-workspace {
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem;
  background: #f8faf7;
  border: 1px solid #cbd5cc;
  border-radius: 0.9rem;
}

.contact-photo-workspace h3 {
  margin: 0;
  font-size: 0.95rem;
}

.contact-photo-library {
  display: grid;
  gap: 0.6rem;
}

.contact-upload-card {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: 3.75rem minmax(0, 1fr);
  grid-template-areas:
    "preview copy"
    "preview button"
    "preview remove";
  align-items: center;
  gap: 0.25rem 0.7rem;
  padding: 0.55rem;
  background: white;
  border: 1px solid #c4cec6;
  border-radius: 0.75rem;
}

.contact-upload-preview {
  grid-area: preview;
  width: 3.5rem;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #65736b;
  background: #eef2ee;
  border: 1px dashed #9eaea3;
  border-radius: 0.65rem;
  font-size: 0.68rem;
  font-weight: 800;
}

.contact-upload-card.has-photo .contact-upload-preview { border-style: solid; }

.contact-upload-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: 50% 35%;
}

.contact-upload-preview .contact-upload-placeholder-art {
  object-fit: contain;
  object-position: center bottom;
  padding: 0.18rem 0.12rem 0;
  background: linear-gradient(180deg, #fffdf5 0%, #f4ead2 100%);
}

.contact-upload-copy {
  grid-area: copy;
  min-width: 0;
  display: grid;
  gap: 0.12rem;
}

.contact-upload-copy strong {
  color: #293c32;
  font-size: 0.82rem;
}

.contact-upload-copy span {
  color: #647169;
  font-size: 0.7rem;
}

.contact-upload-card input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.contact-upload-button {
  grid-area: button;
  width: fit-content;
  max-width: 100%;
  align-self: start;
  justify-self: start;
  cursor: pointer;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
}

.remove-contact-photo {
  grid-area: remove;
  justify-self: start;
  padding: 0;
  color: #8b3025;
  background: transparent;
  border: 0;
  font-size: 0.7rem;
  font-weight: 800;
  text-decoration: underline;
}

.crop-controls {
  display: grid;
  gap: 0.65rem;
  padding-top: 0.15rem;
}

.crop-row {
  display: grid;
  grid-template-columns: 6.3rem 1fr 3rem;
  align-items: center;
  gap: 0.55rem;
}

.crop-row label {
  font-size: 0.77rem;
  font-weight: 800;
}

.crop-row output {
  color: #536159;
  font-size: 0.73rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.crop-row input[type="range"] {
  width: 100%;
  accent-color: var(--blue);
}

.small-button {
  justify-self: start;
  padding: 0.48rem 0.68rem;
  color: #34473c;
  background: white;
  border: 1px solid #aebbb2;
  border-radius: 0.55rem;
  font-size: 0.76rem;
  font-weight: 800;
}

.print-tip {
  margin-top: 1rem;
  padding: 0.8rem;
  color: #534921;
  background: #fff5ce;
  border: 1px solid #e2ce86;
  border-radius: 0.75rem;
  font-size: 0.78rem;
  line-height: 1.45;
}

.print-tip strong {
  display: block;
  color: #3f3719;
}

.preview-panel {
  min-width: 0;
  padding: 1rem;
}

.preview-toolbar { padding: 0.15rem 0.25rem 0.9rem; }

.preview-arrows {
  display: flex;
  gap: 0.45rem;
}

.icon-button {
  width: 2.4rem;
  height: 2.4rem;
  color: var(--ink);
  background: white;
  border: 1px solid #c7d0c8;
  border-radius: 0.65rem;
  font-size: 1.15rem;
  font-weight: 900;
}

.icon-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.page-stage {
  display: grid;
  place-items: start center;
  min-width: 0;
  min-height: 16rem;
  overflow: auto;
  padding: 1rem;
  background: #dce3dc;
  border-radius: 1rem;
}

.page-preview-shell {
  display: none;
  width: calc(var(--page-width) * var(--preview-scale));
  height: calc(var(--page-height) * var(--preview-scale));
  flex: 0 0 auto;
}

.page-preview-shell.active { display: block; }

/* Printable page system -------------------------------------------------- */
.binder-page {
  --accent: var(--blue);
  position: relative;
  width: var(--page-width);
  height: var(--page-height);
  overflow: hidden;
  color: var(--ink);
  background-color: var(--cream);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(229, 169, 21, 0.08), transparent 22%),
    repeating-linear-gradient(7deg, rgba(90, 70, 35, 0.012) 0 1px, transparent 1px 5px);
  box-shadow: var(--shadow);
  transform: scale(var(--preview-scale));
  transform-origin: top left;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
  font-family: "Trebuchet MS", Arial, sans-serif;
  break-inside: avoid;
}

.binder-page::before,
.binder-page::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: 18px;
}

.binder-page::before {
  inset: 27px;
  z-index: 30;
  border: 7px solid var(--accent);
}

.binder-page::after {
  inset: 40px;
  z-index: 30;
  border: 2px dashed var(--accent);
  border-radius: 13px;
}

.page-safe {
  position: absolute;
  inset: 58px;
  z-index: 2;
  min-width: 0;
  min-height: 0;
}

.interior-layout {
  height: 100%;
  display: grid;
  grid-template-rows: 116px minmax(0, 1fr) 188px;
  gap: 10px;
}

.page-header-zone {
  position: relative;
  z-index: 4;
  min-width: 0;
  display: grid;
  place-items: center;
  padding: 6px 44px 5px;
  text-align: center;
  isolation: isolate;
  overflow: hidden;
  background:
    repeating-linear-gradient(13deg, rgba(255, 255, 255, 0.055) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(103deg, rgba(8, 43, 74, 0.11) 0 1px, transparent 1px 6px),
    linear-gradient(135deg, #397fa7 0%, #286c98 42%, #1f5b86 72%, #347aa4 100%);
  border: 4px solid #174b72;
  border-radius: 13px 10px 15px 11px;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.16),
    inset 0 0 18px rgba(9, 39, 64, 0.2),
    2px 3px 0 rgba(29, 55, 71, 0.16);
}

.page-header-zone::before,
.cover-title::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 7px;
  pointer-events: none;
  border: 2px dashed rgba(255, 236, 191, 0.92);
  border-radius: 9px 7px 11px 8px;
  filter: drop-shadow(0 1px 0 rgba(21, 58, 83, 0.8));
}

.page-header-zone::after,
.cover-title::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(90deg, transparent 0 7px, rgba(226, 234, 229, 0.72) 7px 8px, transparent 8px 12px) top / 100% 5px no-repeat,
    repeating-linear-gradient(90deg, transparent 0 5px, rgba(226, 234, 229, 0.6) 5px 7px, transparent 7px 13px) bottom / 100% 6px no-repeat,
    repeating-linear-gradient(0deg, transparent 0 6px, rgba(226, 234, 229, 0.62) 6px 8px, transparent 8px 13px) left / 5px 100% no-repeat,
    repeating-linear-gradient(0deg, transparent 0 8px, rgba(226, 234, 229, 0.58) 8px 9px, transparent 9px 14px) right / 5px 100% no-repeat;
}

.page-title {
  position: relative;
  z-index: 2;
  min-width: 0;
  color: var(--navy);
  line-height: 0.94;
}

.page-title .title-line {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 45px;
  font-weight: 900;
  letter-spacing: 2px;
}

.page-title .title-line + .title-line {
  margin-top: 7px;
  font-size: 39px;
}

.communication-page .page-title .title-line:first-child { font-size: 39px; }

.rainbow-letter {
  display: inline-block;
  color: var(--letter-color, var(--navy));
  -webkit-text-stroke: 1.25px var(--ink);
  paint-order: stroke fill;
  text-shadow: 1px 2px 0 rgba(255, 255, 255, 0.7);
}

.page-header-zone .rainbow-letter,
.cover-title .rainbow-letter {
  -webkit-text-stroke: 2.8px #fffdf5;
  paint-order: stroke fill;
  text-shadow: 0 3px 0 rgba(23, 53, 70, 0.9);
}

.header-heart {
  position: absolute;
  z-index: 2;
  top: 38px;
  color: #ffd96a;
  font-size: 25px;
  line-height: 1;
  -webkit-text-stroke: 1px #fffdf5;
  paint-order: stroke fill;
  text-shadow: 1px 2px 0 #173a5a;
}

.header-heart.left { left: 0; }
.header-heart.right { right: 0; color: #ff765f; }

.puzzle {
  position: absolute;
  z-index: 35;
  width: 42px;
  height: 42px;
  color: var(--red);
  background: currentColor;
  border: 2px solid var(--ink);
  border-radius: 9px;
  transform: rotate(var(--turn, -8deg));
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.puzzle::before,
.puzzle::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  background: currentColor;
  border: 2px solid var(--ink);
  border-radius: 50%;
}

.puzzle::before {
  top: -9px;
  left: 11px;
  border-bottom: 0;
}

.puzzle::after {
  top: 11px;
  right: -9px;
  border-left: 0;
}

.puzzle.tl { top: 31px; left: 33px; color: var(--red); }
.puzzle.tr { top: 31px; right: 33px; color: var(--blue); --turn: 8deg; }
.puzzle.bl { bottom: 31px; left: 33px; color: var(--green); --turn: -5deg; }
.puzzle.br { right: 33px; bottom: 31px; color: var(--purple); --turn: 6deg; }

.page-main,
.page-art-band {
  position: relative;
  z-index: 3;
  min-width: 0;
  min-height: 0;
}

.page-art-band {
  overflow: hidden;
  border-top: 2px dashed color-mix(in srgb, var(--accent) 65%, #ffffff);
}

.page-art {
  position: absolute;
  z-index: 3;
  display: block;
  object-fit: contain;
  pointer-events: none;
}

.photo-frame {
  position: absolute;
  z-index: 5;
  overflow: hidden;
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 18px;
  box-shadow: 0 0 0 4px var(--paper), 0 0 0 7px var(--accent);
}

.photo-frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: 50% 35%;
  transform: scale(1);
  transform-origin: 50% 35%;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.photo-frame img:active { cursor: grabbing; }

.photo-frame .photo-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  color: #685f46;
  text-align: center;
  font-size: 15px;
  font-weight: 850;
}

.photo-frame.has-photo .photo-placeholder { display: none; }

.patch-heart {
  position: absolute;
  z-index: 2;
  clip-path: polygon(50% 100%, 5% 57%, 0 35%, 5% 17%, 20% 5%, 35% 5%, 50% 20%, 65% 5%, 80% 5%, 95% 17%, 100% 35%, 95% 57%);
}

.patch-heart {
  background: conic-gradient(from 30deg, var(--red), var(--blue), var(--green), var(--gold), var(--purple), var(--orange), var(--red));
  filter: drop-shadow(2px 3px 0 var(--ink));
}

.patch-heart::after {
  content: "";
  position: absolute;
  inset: 30% 0 0;
  background:
    linear-gradient(90deg, transparent 48%, rgba(31, 47, 42, 0.7) 49% 51%, transparent 52%),
    linear-gradient(transparent 48%, rgba(31, 47, 42, 0.7) 49% 51%, transparent 52%);
  background-size: 34% 34%;
}

.story-heart {
  position: absolute;
  z-index: 5;
  display: block;
  overflow: visible;
  filter: drop-shadow(2px 3px 0 rgba(31, 47, 42, 0.92));
  pointer-events: none;
}

.story-heart .heart-shadow { fill: var(--ink); }

.story-heart .heart-fill {
  fill: #176da0;
  stroke: #fffdf5;
  stroke-width: 5.5;
  stroke-linejoin: round;
}

.story-heart .heart-stitch {
  fill: none;
  stroke: #f8efd2;
  stroke-width: 2;
  stroke-dasharray: 4.5 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.92;
}

.story-heart .heart-copy {
  fill: #fffdf5;
  stroke: rgba(31, 47, 42, 0.78);
  stroke-width: 0.55;
  paint-order: stroke fill;
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-size: 16px;
  font-weight: 850;
  letter-spacing: 0.15px;
}

.story-heart .heart-emphasis {
  fill: #fff3bd;
  stroke: var(--ink);
  stroke-width: 0.8;
  font-size: 21px;
  font-weight: 900;
  letter-spacing: 1px;
}

.story-heart.kindness .heart-copy { font-size: 14.5px; }
.story-heart.kindness .heart-compact { font-size: 13.2px; letter-spacing: 0; }
.story-heart.kindness .heart-emphasis { font-size: 20px; }

.form-section {
  --section: var(--blue);
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  color: var(--ink);
  background: var(--paper);
  border: 2.5px solid var(--section);
  border-radius: 13px;
}

.section-heading {
  min-height: 38px;
  display: grid;
  place-items: center;
  padding: 11px 10px 5px;
  color: #17314d;
  background: var(--paper);
  border-bottom: 2px solid var(--section);
  box-shadow: inset 0 6px 0 var(--section);
  text-align: center;
  text-transform: uppercase;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.03;
}

.section-heading small {
  display: block;
  margin-top: 2px;
  color: #2d453b;
  font-size: 9px;
  font-weight: 750;
  text-transform: none;
}

.section-body {
  min-height: 0;
  overflow: hidden;
  padding: 8px 12px 10px;
}

.line-row {
  min-width: 0;
  min-height: 30px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: end;
  gap: 6px;
  font-size: 13px;
  line-height: 1.1;
}

.line-label {
  padding-bottom: 4px;
  font-weight: 900;
  white-space: nowrap;
}

.line-value {
  min-width: 0;
  min-height: 24px;
  max-height: 34px;
  overflow: hidden;
  padding: 2px 3px 3px;
  border-bottom: 1.5px solid #687269;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.1;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.line-value.tight { font-size: 12.5px; }

/* Allergies may intentionally use two lines in the compact identity panel. */
.identity-fields [data-bind="allergies"] {
  font-size: 13px;
  line-height: 1.03;
}

.print-list {
  height: 100%;
  display: grid;
  grid-template-rows: repeat(var(--line-count, 5), minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.print-list li {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 2px 3px 2px 21px;
  border-bottom: 1.25px solid #7e857e;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.06;
  overflow-wrap: anywhere;
}

.print-list li::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 50%;
  width: 7px;
  height: 7px;
  background: var(--section);
  border: 1px solid var(--ink);
  border-radius: 50%;
  transform: translateY(-50%);
}

.print-list.no-bullets li { padding-left: 3px; }
.print-list.no-bullets li::before { display: none; }
.print-list li.small-text { font-size: 12px; }

/* Cover ---------------------------------------------------------------- */
.cover-page { --accent: var(--blue); }

.cover-layout {
  height: 100%;
  display: grid;
  grid-template-rows: 245px 438px 92px 74px;
  align-content: center;
  gap: 9px;
}

.cover-title {
  position: relative;
  min-width: 0;
  display: grid;
  align-content: center;
  padding: 6px 20px;
  text-align: center;
  isolation: isolate;
  overflow: hidden;
  background:
    repeating-linear-gradient(13deg, rgba(255, 255, 255, 0.055) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(103deg, rgba(8, 43, 74, 0.11) 0 1px, transparent 1px 6px),
    linear-gradient(135deg, #397fa7 0%, #286c98 42%, #1f5b86 72%, #347aa4 100%);
  border: 4px solid #174b72;
  border-radius: 15px 11px 17px 12px;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.16),
    inset 0 0 22px rgba(9, 39, 64, 0.23),
    2px 3px 0 rgba(29, 55, 71, 0.16);
}

.cover-title > * {
  position: relative;
  z-index: 2;
}

.cover-title .autism {
  font: 900 70px/0.94 Georgia, "Times New Roman", serif;
  letter-spacing: 0.5px;
}

.cover-title .emergency {
  margin-top: 13px;
  color: #fffdf5;
  font: 900 51px/0.95 Georgia, "Times New Roman", serif;
  letter-spacing: 0.5px;
  -webkit-text-stroke: 1.8px #173a5a;
  paint-order: stroke fill;
  text-shadow: 0 3px 0 rgba(13, 44, 68, 0.88);
}

.binder-flags {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 17px;
}

.binder-flag {
  width: 61px;
  height: 62px;
  display: grid;
  place-items: center;
  padding-bottom: 8px;
  color: white;
  background: var(--flag);
  border: 3px solid var(--ink);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.34);
  clip-path: polygon(0 0, 100% 0, 100% 78%, 50% 100%, 0 78%);
  font: 900 38px/1 Georgia, "Times New Roman", serif;
  text-shadow: 1px 2px 0 rgba(31, 47, 42, 0.82);
  -webkit-text-stroke: 1px var(--ink);
  paint-order: stroke fill;
}

.cover-hero {
  position: relative;
  min-width: 0;
  min-height: 0;
}

.cover-page .cover-family {
  left: -4px;
  bottom: 0;
  z-index: 3;
  width: 235px;
  height: 390px;
}

.cover-page .cover-cubs {
  right: -1px;
  bottom: 2px;
  z-index: 6;
  width: 210px;
  height: 205px;
}

.cover-photo {
  left: 50%;
  bottom: 11px;
  width: 274px;
  height: 405px;
  transform: translateX(-50%);
  --accent: var(--blue);
}

.cover-page .patch-heart {
  left: 4px;
  top: 8px;
  width: 105px;
  height: 105px;
}

.cover-page .ability {
  right: -2px;
  top: 7px;
  width: 160px;
  height: 144px;
}

.name-ribbon {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 9px 22px;
  color: var(--ink);
  background: var(--paper);
  border: 4px solid var(--blue);
  border-radius: 12px;
  box-shadow: 0 0 0 3px var(--paper);
  text-align: center;
  font: 900 47px/0.95 Georgia, "Times New Roman", serif;
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
}

.name-ribbon .name-medium { font-size: 38px; }
.name-ribbon .name-small { font-size: 29px; }
.name-ribbon .empty-name { color: #625b49; font-size: 27px; }

.cover-tagline {
  align-self: center;
  color: var(--navy);
  text-align: center;
  font-size: 17px;
  font-weight: 900;
  line-height: 1.45;
}

/* Emergency contact ---------------------------------------------------- */
.contact-page { --accent: var(--blue); }

.contact-main {
  display: grid;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.contact-page .section-body { padding: 7px 11px 9px; }
.contact-page .line-row { min-height: 31px; }

.contact-card-layout {
  min-width: 0;
  height: 100%;
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.contact-reference-photo {
  position: relative;
  width: 96px;
  height: 118px;
  overflow: hidden;
  color: #625b49;
  background: #f7f1df;
  border: 2px solid var(--section);
  border-radius: 12px;
  box-shadow: inset 0 0 0 3px var(--paper);
}

.contact-reference-photo > img[data-contact-photo-page] {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: 50% 35%;
}

.contact-reference-placeholder-art {
  position: absolute;
  inset: 3px 3px 18px;
  width: calc(100% - 6px);
  height: calc(100% - 21px);
  display: block;
  object-fit: contain;
  object-position: center bottom;
}

.contact-reference-placeholder {
  position: absolute;
  z-index: 2;
  left: 6px;
  right: 6px;
  bottom: 5px;
  display: grid;
  place-items: center;
  min-height: 17px;
  padding: 2px 4px;
  text-align: center;
  color: #344e42;
  background: rgba(255, 253, 245, 0.94);
  border: 1px dashed rgba(72, 91, 78, 0.6);
  border-radius: 6px;
  font-size: 7.8px;
  font-weight: 850;
  line-height: 1.05;
}

.contact-reference-photo.has-photo .contact-reference-placeholder,
.contact-reference-photo.has-photo .contact-reference-placeholder-art { display: none; }

.contact-details {
  min-width: 0;
  align-self: stretch;
  display: grid;
  align-content: center;
}

.contact-page .contact-family {
  left: 105px;
  bottom: -1px;
  z-index: 4;
  width: 215px;
  height: 187px;
}

.contact-page .page-photo {
  right: 7px;
  bottom: 7px;
  width: 145px;
  height: 169px;
  --accent: var(--red);
}

.contact-page .kindness {
  left: -1px;
  bottom: 16px;
  z-index: 5;
  width: 150px;
  height: 135px;
}

.contact-page .patch-heart {
  left: 330px;
  top: 27px;
  width: 92px;
  height: 92px;
}

/* Medical -------------------------------------------------------------- */
.medical-page { --accent: var(--red); }

.medical-page .interior-layout {
  grid-template-rows: 116px minmax(0, 1fr) 140px;
}

.medical-main {
  display: grid;
  grid-template-rows: 98px 254px 134px 148px;
  gap: 10px;
}

.identity-fields {
  min-width: 0;
  display: grid;
  align-content: center;
  padding: 4px 15px;
  background: rgba(255, 253, 245, 0.88);
  border: 2px solid #c8a495;
  border-radius: 13px;
}

.identity-fields .line-row {
  min-height: 29px;
  font-size: 13px;
}

.medical-two-column {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.medical-page .physician .section-body { padding-top: 4px; }
.medical-page .physician .line-row { min-height: 27px; }
.medical-page .notes .section-body { padding-top: 5px; }
.medical-page .notes .print-list li { font-size: 13.5px; }

.medical-page .doctor {
  right: 15px;
  bottom: -5px;
  width: 102px;
  height: 142px;
}

.medical-page .page-photo {
  left: 8px;
  bottom: 6px;
  width: 132px;
  height: 126px;
  --accent: var(--blue);
}

.medical-page .patch-heart {
  left: 50%;
  top: 25px;
  width: 85px;
  height: 85px;
  transform: translateX(-50%);
}

/* Sensory -------------------------------------------------------------- */
.sensory-page { --accent: var(--green); }

.sensory-main {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.sensory-page .page-photo {
  left: 8px;
  bottom: 7px;
  width: 133px;
  height: 168px;
  --accent: var(--green);
}

.sensory-page .sensory-art {
  right: 8px;
  bottom: -1px;
  width: 155px;
  height: 184px;
}

.sensory-page .patch-heart {
  left: 50%;
  bottom: 26px;
  width: 92px;
  height: 92px;
  transform: translateX(-50%);
}

/* Communication -------------------------------------------------------- */
.communication-page { --accent: var(--purple); }

.communication-main {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: 225px 190px 181px;
  gap: 10px;
}

.communication-page .other { grid-column: 1 / -1; }

.communication-page .page-photo {
  left: 8px;
  bottom: 7px;
  width: 135px;
  height: 168px;
  --accent: var(--blue);
}

.communication-page .comm-art {
  right: 4px;
  bottom: 4px;
  z-index: 4;
  width: 230px;
  height: 175px;
}

.communication-page .patch-heart {
  left: 50%;
  top: 31px;
  width: 83px;
  height: 83px;
  transform: translateX(-50%);
}

/* Safety --------------------------------------------------------------- */
.safety-page { --accent: var(--blue); }

.safety-main {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.safety-page .safety-art {
  left: 151px;
  bottom: -2px;
  z-index: 4;
  width: 365px;
  height: 176px;
}

.safety-page .page-photo {
  right: 8px;
  bottom: 7px;
  width: 132px;
  height: 168px;
  --accent: var(--blue);
}

.safety-badge {
  position: absolute;
  z-index: 5;
  left: 23px;
  bottom: 36px;
  width: 104px;
  height: 104px;
  display: grid;
  place-content: center;
  padding: 19px;
  color: var(--ink);
  background: #fff2b5;
  border: 4px solid var(--ink);
  outline: 3px solid var(--red);
  outline-offset: -10px;
  transform: rotate(45deg);
  text-align: center;
  font-size: 9.5px;
  font-weight: 900;
  line-height: 1.18;
}

.safety-badge span { transform: rotate(-45deg); }

.noscript {
  margin: 2rem;
  padding: 1rem;
  background: white;
  border: 2px solid var(--red);
}

@media (max-width: 1120px) {
  .workspace { grid-template-columns: 1fr; }
  .editor-panel { position: static; max-height: none; }
}

@media (max-width: 700px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-actions { width: 100%; }
  .header-actions .button { flex: 1; }
  .privacy-banner { font-size: 0.86rem; }
  .page-nav { grid-template-columns: repeat(2, 1fr); }
  .photo-library { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .crop-row { grid-template-columns: 5.6rem 1fr 2.7rem; }
  .contact-upload-card {
    grid-template-columns: 3.75rem minmax(0, 1fr);
    grid-template-areas:
      "preview copy"
      "preview button"
      "preview remove";
  }
  .contact-upload-button,
  .remove-contact-photo {
    justify-self: start;
  }
  .preview-panel { padding: 0.55rem; }
  .page-stage { padding: 0.5rem; }
}

@page {
  size: Letter portrait;
  margin: 0;
}

@media print {
  html,
  body {
    width: 8.5in !important;
    margin: 0 !important;
    padding: 0 !important;
    background: white !important;
  }

  .app-header,
  .privacy-banner,
  .editor-panel,
  .preview-toolbar,
  noscript {
    display: none !important;
  }

  .workspace,
  .preview-panel,
  .page-stage {
    display: block !important;
    width: 8.5in !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: white !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  .page-preview-shell,
  .page-preview-shell.active {
    display: block !important;
    width: 8.5in !important;
    height: 11in !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .page-preview-shell:not(:last-child) {
    break-after: page !important;
    page-break-after: always !important;
  }

  .binder-page {
    width: 8.5in !important;
    height: 11in !important;
    margin: 0 !important;
    overflow: hidden !important;
    box-shadow: none !important;
    transform: none !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .photo-frame img {
    cursor: default !important;
    pointer-events: none !important;
  }

  .section-heading,
  .binder-flag,
  .story-heart,
  .page-header-zone,
  .cover-title,
  .contact-reference-photo,
  .line-value,
  .line-label,
  .print-list li,
  .safety-badge {
    color-adjust: exact;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}
