:root {
  --navy: #1a2a4a;
  --navy-deep: #0f1c36;
  --navy-soft: #2a3d63;
  --gold: #d4a72c;
  --gold-light: #e8c465;
  --gold-pale: #faf3dc;
  --cream: #fbf8f1;
  --cream-warm: #f5efe2;
  --ink: #2a2a35;
  --ink-soft: #5a5a6a;
  --line: #e7e0d0;
  --white: #ffffff;
  --error: #b34646;
  --success: #2e7d4f;

  --font-display: 'Cormorant Garamond', 'Times New Roman', serif;
  --font-body: 'Nunito Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --shadow-soft: 0 4px 20px rgba(26, 42, 74, 0.06);
  --shadow-card: 0 10px 40px rgba(26, 42, 74, 0.08);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--navy);
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
}

em { font-style: italic; color: var(--gold); font-weight: 500; }

/* ===== Header ===== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(251, 248, 241, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.app-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  transition: opacity 0.2s ease;
}
.brand:hover { opacity: 0.85; }
.brand-logo {
  height: 92px;
  width: auto;
  display: block;
}
@media (max-width: 640px) {
  .brand-logo { height: 68px; }
}
.header-meta {
  font-size: 12px;
  color: var(--ink-soft);
}
.save-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--success);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.save-indicator::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}
.save-indicator.visible { opacity: 1; }

.progress-bar {
  height: 3px;
  background: var(--line);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  transition: width 0.5s ease;
}

/* ===== Main ===== */
.app-main {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.step-inner {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: clamp(28px, 5vw, 48px);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--line);
}

.step-meta {
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 12px;
}

.step h2 {
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 500;
  margin-bottom: 12px;
}

.step-lead {
  color: var(--ink-soft);
  margin: 0 0 32px;
  font-size: 17px;
  line-height: 1.6;
}

.sub-heading {
  font-size: 20px;
  font-weight: 600;
  margin: 32px 0 16px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

/* ===== Welcome ===== */
.welcome {
  text-align: center;
}
.welcome-icon {
  color: var(--gold);
  width: 72px;
  height: 72px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gold-pale);
  border-radius: 50%;
  padding: 16px;
}
.welcome-icon svg {
  width: 100%;
  height: 100%;
}
.welcome h1 {
  font-size: clamp(28px, 4.5vw, 42px);
  font-weight: 500;
  margin-bottom: 16px;
}
.welcome-tagline {
  font-family: var(--font-display, 'Cormorant Garamond', serif);
  font-style: italic;
  font-size: 22px;
  color: #9a7515;
  margin: -4px 0 14px;
}
.welcome-lead {
  font-size: 18px;
  color: var(--ink-soft);
  line-height: 1.65;
  max-width: 520px;
  margin: 0 auto 32px;
}
.welcome-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 420px;
  margin: 0 auto 40px;
  text-align: left;
}
.welcome-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-size: 15px;
}
.welcome-feature svg { color: var(--gold); flex-shrink: 0; }

/* ===== Form fields ===== */
.field {
  margin-bottom: 20px;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
@media (min-width: 640px) {
  .field-row { grid-template-columns: 1fr 1fr; }
}
.field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}
.req { color: var(--gold); }
.field-label-strong {
  display: block;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 4px;
  letter-spacing: 0;
}
.field-hint {
  display: block;
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 400;
  font-style: italic;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  background: var(--cream);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s ease, background 0.2s ease;
  line-height: 1.5;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--gold);
  background: var(--white);
}
.field textarea {
  resize: vertical;
  min-height: 60px;
  font-family: var(--font-body);
}

.highlight-field {
  background: var(--gold-pale);
  padding: 20px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}
.highlight-field textarea {
  background: var(--white);
}

/* ===== Tone & length grids ===== */
.tone-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 32px;
}
@media (min-width: 640px) {
  .tone-grid { grid-template-columns: 1fr 1fr; }
}
.tone-option { cursor: pointer; }
.tone-option input { position: absolute; opacity: 0; pointer-events: none; }
.tone-card {
  padding: 18px;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  transition: all 0.2s ease;
}
.tone-option input:checked + .tone-card {
  border-color: var(--gold);
  background: var(--gold-pale);
}
.tone-option:hover .tone-card {
  border-color: var(--gold-light);
}
.tone-card-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 4px;
}
.tone-card-desc {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
}

.length-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.length-option { cursor: pointer; }
.length-option input { position: absolute; opacity: 0; pointer-events: none; }
.length-card {
  padding: 14px 10px;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  text-align: center;
  transition: all 0.2s ease;
}
.length-option input:checked + .length-card {
  border-color: var(--gold);
  background: var(--gold-pale);
}
.length-option:hover .length-card { border-color: var(--gold-light); }
.length-card-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 2px;
}
.length-card-desc {
  font-size: 12px;
  color: var(--ink-soft);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  white-space: nowrap;
}
.btn-lg { padding: 14px 32px; font-size: 16px; }
.btn-primary {
  background: var(--gold);
  color: var(--navy);
  border-color: var(--gold);
}
.btn-primary:hover {
  background: var(--gold-light);
  border-color: var(--gold-light);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(212, 167, 44, 0.25);
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn-secondary {
  background: var(--white);
  color: var(--navy);
  border-color: var(--navy);
}
.btn-secondary:hover {
  background: var(--navy);
  color: var(--cream);
}
.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: transparent;
}
.btn-ghost:hover {
  color: var(--navy);
  background: var(--cream-warm);
}

.step-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
  gap: 12px;
}
.welcome .step-actions {
  border-top: none;
  padding-top: 0;
  justify-content: center;
}

/* ===== Result step ===== */
.result-step h2 em { font-style: italic; color: var(--gold); }

.loading-state {
  text-align: center;
  padding: 60px 20px;
}
.loading-spinner {
  width: 56px;
  height: 56px;
  border: 4px solid var(--line);
  border-top-color: var(--gold);
  border-radius: 50%;
  margin: 0 auto 24px;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.obituary-paper {
  background: var(--cream);
  border-radius: var(--radius-md);
  padding: clamp(28px, 5vw, 48px);
  margin: 32px 0;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  position: relative;
}
.obituary-paper-header {
  text-align: center;
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.obituary-paper-label {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 10px;
}
.obituary-paper h3 {
  font-size: clamp(24px, 3.5vw, 32px);
  font-weight: 500;
  margin-bottom: 4px;
}
.obituary-paper-dates {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--ink-soft);
  font-size: 17px;
}
.obituary-text {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--ink);
  line-height: 1.8;
  white-space: pre-wrap;
  min-height: 200px;
  outline: none;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: background 0.2s ease;
}
.obituary-text:focus {
  background: var(--white);
  box-shadow: inset 0 0 0 1px var(--gold);
}
.obituary-text:empty::before {
  content: "Your obituary will appear here...";
  color: var(--ink-soft);
  font-style: italic;
}
.obituary-meta {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
}
.obituary-meta .dot { margin: 0 8px; color: var(--gold); }

/* ===== Quick edits ===== */
.quick-edits {
  background: var(--cream-warm);
  padding: 24px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}
.quick-edits-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--navy);
  margin-bottom: 12px;
}
.quick-edits-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.chip {
  font-family: var(--font-body);
  font-size: 13px;
  padding: 8px 14px;
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: 100px;
  color: var(--navy);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.chip:hover {
  border-color: var(--gold);
  background: var(--gold-pale);
}
.chip:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.custom-edit {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.custom-edit input {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
}
.custom-edit input:focus {
  outline: none;
  border-color: var(--gold);
}

/* ===== Result actions ===== */
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}
.result-actions .btn { flex: 1; min-width: 160px; }
.upgrade-btn {
  background: var(--navy) !important;
  color: var(--gold) !important;
  border-color: var(--navy) !important;
  flex: 1.5 !important;
  min-width: 240px !important;
}
.upgrade-btn:hover {
  background: var(--navy-deep) !important;
  border-color: var(--navy-deep) !important;
  color: var(--gold-light) !important;
}

.result-footer {
  display: flex;
  justify-content: space-between;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
  gap: 12px;
}

/* ===== Error ===== */
.error-box {
  text-align: center;
  padding: 40px 20px;
  background: rgba(179, 70, 70, 0.05);
  border: 1px solid rgba(179, 70, 70, 0.2);
  border-radius: var(--radius-md);
}
.error-box h2 { color: var(--error); margin-bottom: 12px; }
.error-box p { color: var(--ink-soft); margin-bottom: 24px; }

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 28, 54, 0.7);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadein 0.2s ease;
}
@keyframes fadein {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 40px;
  max-width: 520px;
  width: 100%;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: none;
  background: var(--cream);
  border-radius: 50%;
  font-size: 24px;
  color: var(--ink-soft);
  cursor: pointer;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover {
  background: var(--cream-warm);
  color: var(--navy);
}
.modal-eyebrow {
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 8px;
}
.modal h3 {
  font-size: 28px;
  font-weight: 500;
  margin-bottom: 12px;
}
.modal p {
  color: var(--ink-soft);
  margin: 0 0 20px;
}
.upgrade-list {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.upgrade-list li {
  padding: 16px;
  background: var(--cream);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--gold);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.upgrade-list strong {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--navy);
}
.upgrade-list span {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
}
.modal-note {
  font-size: 13px;
  color: var(--ink-soft);
  font-style: italic;
  text-align: center;
}

/* ===== Program Builder ===== */
.template-picker .tone-card {
  padding: 0;
  overflow: hidden;
}
.template-swatch {
  width: 100%;
  aspect-ratio: 3 / 4;
  background-size: cover;
  background-position: center;
  margin-bottom: 0;
}
.template-card .tone-card-title,
.template-card .tone-card-desc {
  padding: 0 12px;
}
.template-card .tone-card-title {
  padding-top: 12px;
  padding-bottom: 2px;
}
.template-card .tone-card-desc {
  padding-bottom: 14px;
  min-height: 32px;
}
.template-swatch[data-template="blue_roses"] {
  background-image: url('templates/blue-roses-bg.jpg');
}
.template-swatch[data-template="pink_floral"] {
  background-image: url('templates/pink-floral-bg.jpg');
}
.template-swatch[data-template="watercolor"] {
  background-image: url('templates/watercolor-bg.jpg');
}

/* Photo upload */
.photo-upload {
  margin-bottom: 24px;
}
.photo-upload-label {
  display: block;
  cursor: pointer;
}
.photo-preview {
  border: 2px dashed var(--line);
  border-radius: var(--radius-md);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--cream);
  color: var(--ink-soft);
  transition: all 0.2s ease;
  min-height: 160px;
  text-align: center;
}
.photo-preview:hover {
  border-color: var(--gold);
  background: var(--gold-pale);
  color: var(--navy);
}
.photo-preview.has-photo {
  padding: 12px;
  border-style: solid;
  border-color: var(--gold);
  background: var(--white);
  min-height: auto;
}
.photo-preview img {
  max-width: 100%;
  max-height: 280px;
  border-radius: var(--radius-sm);
  display: block;
  box-shadow: 0 4px 12px rgba(26, 42, 74, 0.15);
}
.photo-upload-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.photo-upload-text strong {
  font-size: 16px;
  color: var(--navy);
  font-weight: 600;
}
.photo-upload-text span {
  font-size: 13px;
  color: var(--ink-soft);
}
#photo-clear {
  margin-top: 8px;
  font-size: 13px;
}

/* PDF preview iframe */
.pdf-preview-frame {
  background: var(--cream-warm);
  border-radius: var(--radius-md);
  padding: 12px;
  margin: 24px 0;
  box-shadow: 0 4px 16px rgba(26, 42, 74, 0.10);
}
.pdf-preview-frame iframe {
  width: 100%;
  height: 600px;
  border: none;
  border-radius: var(--radius-sm);
  background: white;
  display: block;
}
@media (max-width: 640px) {
  .pdf-preview-frame iframe {
    height: 450px;
  }
}

.program-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.program-actions .btn { flex: 1; min-width: 200px; }

.program-note {
  background: var(--gold-pale);
  border-left: 3px solid var(--gold);
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--navy);
  line-height: 1.55;
}
.program-note strong {
  color: var(--navy);
  font-weight: 700;
}

/* Upgrade list active item */
.upgrade-list li.upgrade-active {
  cursor: pointer;
  border-left-width: 4px;
  background: var(--gold-pale);
  position: relative;
  transition: transform 0.15s ease;
}
.upgrade-list li.upgrade-active:hover {
  transform: translateX(2px);
}
.upgrade-cta {
  display: block;
  margin-top: 8px;
  font-style: normal;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  color: var(--gold);
  letter-spacing: 0.04em;
}

/* ===== Print ===== */
@media print {
  .app-header, .step-meta, .step-lead, .quick-edits, .result-actions, .result-footer, h2 { display: none !important; }
  body { background: white; }
  .step-inner, .obituary-paper {
    box-shadow: none;
    border: none;
    padding: 0;
  }
  .obituary-text { font-size: 14px; line-height: 1.7; }
}

/* ===== Payments ===== */
.payment-note {
  max-width: 620px; margin: 14px auto 0; text-align: center;
  font-size: 14px; line-height: 1.55; color: var(--ink-soft, #5a5a6a);
}
.soon-tag {
  display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: #9a7515; background: #faf3dc; border: 1px solid #ecd9a0; vertical-align: middle;
}
.app-banner {
  position: fixed; left: 50%; top: 16px; transform: translateX(-50%); z-index: 200;
  width: min(640px, calc(100% - 32px));
  display: flex; gap: 14px; align-items: flex-start;
  background: #1a2a4a; color: #fbf8f1; padding: 16px 18px; border-radius: 12px;
  box-shadow: 0 18px 50px rgba(15, 28, 54, .3); font-size: 15px; line-height: 1.5;
}
.app-banner span { flex: 1; }
.app-banner button { background: none; border: 0; color: #e8c465; font-size: 22px; line-height: 1; cursor: pointer; }

/* ===== Accounts ===== */
.header-meta { display: flex; align-items: center; gap: 14px; }
.save-indicator.saving { color: var(--ink-soft); }
.save-indicator.saving::before { background: var(--gold); }
.save-indicator.error { color: #a5462f; }
.save-indicator.error::before { background: #a5462f; }
.account-btn {
  font-family: var(--font-body, 'Nunito Sans', sans-serif);
  font-size: 14px; font-weight: 700; letter-spacing: .02em;
  color: var(--navy); background: #fff; border: 1.5px solid var(--navy);
  padding: 9px 16px; border-radius: 6px; cursor: pointer; white-space: nowrap;
  transition: background .2s ease, color .2s ease;
}
.account-btn:hover { background: var(--navy); color: #fbf8f1; }
.account-btn.is-signed-in { border-color: var(--gold); background: var(--gold-pale); }
.account-btn.is-signed-in:hover { background: var(--gold); color: var(--navy); }
@media (max-width: 640px) { .account-btn { padding: 8px 12px; font-size: 13px; } .save-indicator { display: none; } }

.welcome-signin { margin-top: 18px; font-size: 15px; color: var(--ink-soft); text-align: center; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--navy); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-btn:hover { color: #9a7515; }
.welcome-resume { margin-top: 28px; text-align: left; border-top: 1px solid var(--line); padding-top: 22px; }
.welcome-resume-label { font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #9a7515; margin-bottom: 12px; text-align: center; }

.memorial-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.memorial-item {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.memorial-item-text { display: flex; flex-direction: column; min-width: 0; }
.memorial-item-text strong { font-family: var(--font-display, 'Cormorant Garamond', serif); font-size: 20px; color: var(--navy); font-weight: 600; }
.memorial-item-text span { font-size: 13px; color: var(--ink-soft); }
.memorial-item-actions { display: flex; gap: 8px; }
.btn-sm { padding: 8px 14px !important; font-size: 14px !important; min-width: 0 !important; }
.memorial-empty { padding: 18px; text-align: center; color: var(--ink-soft); font-size: 15px; border: 1px dashed var(--line); border-radius: 10px; }

.account-modal { max-width: 560px; }
.signin-form { display: grid; gap: 10px; margin-top: 18px; text-align: left; }
.signin-form label { font-size: 14px; font-weight: 700; color: var(--navy); }
.signin-form input {
  font: inherit; font-size: 16px; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 8px; background: #fff;
}
.signin-form input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212,167,44,.2); }
.signin-sent { margin-top: 18px; padding: 18px; border-radius: 10px; background: var(--gold-pale); text-align: left; }
.signin-sent h4 { margin: 0 0 6px; font-family: var(--font-display, 'Cormorant Garamond', serif); font-size: 22px; color: var(--navy); }
.account-email-line { font-size: 14px; color: var(--ink-soft); margin-bottom: 14px; }
.account-actions { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

.save-nudge { align-items: center; }
.save-nudge-actions { display: flex; align-items: center; gap: 8px; }
.save-nudge .nudge-yes {
  background: #d4a72c; color: #1a2a4a; border: 0; font-weight: 700; font-size: 14px;
  padding: 8px 14px; border-radius: 6px; cursor: pointer; white-space: nowrap;
}
.account-modal { max-height: calc(100vh - 40px); overflow-y: auto; }

/* ===== Memorial Design Library ===== */
.design-current {
  display: flex;
  gap: 22px;
  align-items: center;
  padding: 18px;
  background: var(--white);
  border: 2px solid var(--gold);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  margin-bottom: 20px;
}
.design-current img {
  width: 150px;
  height: auto;
  aspect-ratio: 360 / 466;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(26, 42, 74, 0.16);
  flex-shrink: 0;
  background: var(--cream-warm);
}
.design-current-cat {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8a6a1c;
}
.design-current-name {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  line-height: 1.15;
  color: var(--navy);
  margin: 4px 0 6px;
}
.design-current-desc {
  font-size: 16px;
  color: var(--ink-soft);
  margin: 0 0 14px;
  line-height: 1.5;
}
@media (max-width: 560px) {
  .design-current { flex-direction: column; text-align: center; }
  .design-current img { width: 190px; }
}

.design-picker {
  margin: 0 0 28px;
  padding: 18px;
  background: var(--cream-warm);
  border-radius: var(--radius-md);
}
.design-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.design-chip { font-size: 14px; }
.design-chip.active {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}
.design-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
@media (min-width: 640px) {
  .design-grid { grid-template-columns: repeat(3, 1fr); }
}
.design-option { cursor: pointer; display: block; }
.design-option input { position: absolute; opacity: 0; pointer-events: none; }
.design-card {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  height: 100%;
}
.design-card img {
  width: 100%;
  height: auto;
  aspect-ratio: 360 / 466;
  object-fit: cover;
  display: block;
  background: var(--cream-warm);
}
.design-card-name {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  color: var(--navy);
  padding: 10px 12px 0;
  line-height: 1.2;
}
.design-card-cat {
  font-size: 13px;
  color: var(--ink-soft);
  padding: 2px 12px 12px;
}
.design-option:hover .design-card { border-color: var(--gold-light); }
.design-option input:checked + .design-card {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-pale);
}
.design-option input:focus-visible + .design-card { outline: 3px solid var(--navy); outline-offset: 2px; }
.design-group-title {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  color: var(--navy);
  margin: 8px 0 12px;
}
.design-group-title span { font-family: var(--font-body); font-size: 14px; font-weight: 400; color: var(--ink-soft); }
.design-program-grid { margin-bottom: 0; }

.design-welcome {
  display: flex;
  gap: 16px;
  align-items: center;
  text-align: left;
  max-width: 560px;
  margin: 0 auto 28px;
  padding: 14px 16px;
  background: var(--white);
  border: 1.5px solid var(--gold);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}
.design-welcome img {
  width: 84px;
  height: auto;
  aspect-ratio: 360 / 466;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(26, 42, 74, 0.14);
}
.design-welcome-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8a6a1c;
}
.design-welcome-name {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.2;
}
.design-welcome p { margin: 4px 0 0; font-size: 15px; color: var(--ink-soft); line-height: 1.5; }
@media (max-width: 640px) {
  .design-filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
  .design-chip { flex-shrink: 0; }
}
.pdf-preview-frame img {
  width: 100%;
  max-width: 640px;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: var(--radius-sm);
  background: white;
  box-shadow: 0 2px 10px rgba(26, 42, 74, 0.12);
}

/* Sign-in code */
.signin-code-form { margin-top: 12px; }
.signin-code-form input { font-size: 24px; letter-spacing: .3em; text-align: center; font-weight: 700; }
.signin-code-error { margin: 0; color: #a3341f; font-weight: 700; font-size: 15px; }
.welcome-signin-hint { display: inline-block; margin-top: 4px; font-size: 15px; color: var(--ink-soft, #595966); }
.signin-sent .modal-note { font-size: 15px; font-style: normal; color: var(--ink-soft, #595966); text-align: left; }
.signin-code-form input::placeholder { font-size: 18px; letter-spacing: normal; font-weight: 400; }
.signin-code-error.is-info { color: #2e6b47; }

/* ===== Position the photo ===== */
.photo-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.photo-actions #photo-clear { margin-top: 0; font-size: 15px; }
#photo-adjust { font-size: 16px; padding: 12px 22px; }
.pc-thumb { position: relative; overflow: hidden; border: 2px solid var(--gold); background: var(--cream-warm); box-shadow: 0 4px 12px rgba(26, 42, 74, 0.15); max-width: 100%; }
.pc-thumb img { position: absolute; max-width: none !important; max-height: none !important; border-radius: 0 !important; box-shadow: none !important; }
.pc-thumb.pc-faded { border-style: dashed; }
.photo-preview.has-photo .photo-upload-text span { font-size: 15px; }
body.pc-open { overflow: hidden; }
.pc-backdrop[hidden] { display: none; }
.pc-modal { max-width: 560px; padding: 28px 28px 24px; max-height: calc(100vh - 24px); overflow-y: auto; }
.pc-modal h3 { font-family: var(--font-display); font-size: 30px; color: var(--navy); margin: 0 0 6px; }
.pc-lead { font-size: 17px; color: var(--ink); margin: 0 0 14px; }
.pc-stage { position: relative; height: 380px; overflow: hidden; border-radius: var(--radius-md); background: #2a3348; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; outline: none; }
.pc-stage:active { cursor: grabbing; }
.pc-stage:focus-visible { box-shadow: 0 0 0 3px var(--gold-light); }
.pc-stage img { position: absolute; max-width: none; pointer-events: none; -webkit-user-drag: none; }
.pc-window { position: absolute; pointer-events: none; border: 2px solid var(--gold-light); box-shadow: 0 0 0 2000px rgba(15, 28, 54, 0.7); }
.pc-window.pc-faded { border-style: dashed; }
.pc-note { font-size: 15px; color: var(--ink-soft); margin: 12px 0 8px; }
.pc-zoom { display: flex; align-items: center; gap: 14px; margin: 6px 0 10px; }
.pc-zoom input[type=range] { flex: 1; accent-color: var(--navy); height: 32px; }
.pc-round { width: 48px; height: 48px; flex: none; border-radius: 50%; border: 2px solid var(--navy); background: var(--white); color: var(--navy); font-size: 26px; line-height: 1; cursor: pointer; }
.pc-round:hover { background: var(--navy); color: var(--cream); }
.pc-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.pc-tools .btn { font-size: 16px; }
.pc-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 16px; }
.pc-actions .btn { font-size: 17px; padding: 14px 24px; }
@media (max-width: 640px) {
  .pc-backdrop { padding: 10px; }
  .pc-modal { padding: 20px 16px 16px; }
  .pc-modal h3 { font-size: 26px; }
  .pc-stage { height: 320px; }
  .pc-actions .btn { flex: 1; }
}
