:root {
  --eras-red: #E52E2B;
  --eras-blue: #000EE1;
  --ink: #18203a;
  --muted: #5b6480;
  --line: #dfe3ee;
  --bg: #f4f6fb;
  --card: #ffffff;
  --accent: #1b2a6b;
  --accent-soft: #eef1fb;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.5; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
input[type=file] { display: none !important; }
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 18px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-logo { height: 34px; cursor: pointer; }
.topbar-title { font-weight: 650; font-size: 1.02rem; }
.spacer { flex: 1; }
.badge-free { background: #e9f8ef; color: #17693a; font-weight: 600; font-size: .82rem; padding: 5px 10px; border-radius: 99px; }
.save-state { color: var(--muted); font-size: .82rem; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 550; text-decoration: none; }
.btn:hover { border-color: #b9c1d8; }
.btn.primary { background: var(--eras-blue); border-color: var(--eras-blue); color: #fff; }
.btn.primary:hover { filter: brightness(1.12); }
.btn.big { padding: 13px 22px; font-size: 1.05rem; }
.btn.small { padding: 5px 10px; font-size: .85rem; }
.btn.link { background: none; border: none; color: var(--eras-blue); padding: 6px 8px; }
.btn.link.danger { color: #b3261e; }
.btn.block { width: 100%; margin-top: 10px; }
.btn[disabled] { opacity: .55; cursor: progress; }

/* ---------- start ---------- */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; max-width: 1150px; margin: 0 auto; padding: 56px 24px 30px; flex: 1; }
.hero h1 { font-size: clamp(1.9rem, 3.4vw, 2.9rem); line-height: 1.12; margin: 0 0 14px; letter-spacing: -.01em; }
.lede { font-size: 1.1rem; color: var(--muted); max-width: 56ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 22px 0 0; }
.hero-actions.small { margin-top: 10px; gap: 4px; }
.ticks { list-style: none; padding: 0; margin: 22px 0 0; color: var(--muted); }
.ticks li { padding-left: 26px; position: relative; margin: 6px 0; }
.ticks li::before { content: ""; position: absolute; left: 4px; top: .5em; width: 10px; height: 6px; border-left: 2px solid #17a34a; border-bottom: 2px solid #17a34a; transform: rotate(-45deg); }
.hero-art svg { width: 100%; height: auto; filter: drop-shadow(0 18px 40px rgba(20,30,80,.12)); }
.site-foot { max-width: 1150px; margin: 0 auto; padding: 20px 24px 36px; color: var(--muted); font-size: .85rem; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; padding-top: 28px; } .hero-art { order: -1; } }

/* ---------- builder ---------- */
.workspace { display: grid; grid-template-columns: 380px 1fr; flex: 1; min-height: 0; }
.panel { background: #fff; border-right: 1px solid var(--line); overflow-y: auto; height: calc(100vh - 57px); position: sticky; top: 57px; }
.steps { display: grid; grid-template-columns: repeat(5, 1fr); border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 2; }
.steps button { border: none; background: none; padding: 10px 2px 9px; font-size: .74rem; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.steps button span { width: 24px; height: 24px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; font-weight: 700; font-size: .8rem; }
.steps button.active { color: var(--ink); border-bottom-color: var(--eras-blue); }
.steps button.active span { background: var(--eras-blue); color: #fff; }
.step-body { padding: 16px 18px 40px; }
.step-body h2 { margin: 4px 0 4px; font-size: 1.15rem; }
.hint { color: var(--muted); font-size: .84rem; margin: 4px 0 10px; display: block; font-weight: 400; }
label { display: block; font-weight: 600; font-size: .88rem; margin: 12px 0; }
label input:not([type=checkbox]):not([type=color]), label textarea, label select { display: block; width: 100%; margin-top: 5px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font-weight: 400; }
label textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid #c7cdff; border-color: var(--eras-blue); }
label.check { display: flex; gap: 9px; align-items: flex-start; font-weight: 550; margin-top: 16px; }
label.check input { margin-top: 4px; width: 17px; height: 17px; }
label.sub { margin-left: 26px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.color-row { display: flex; align-items: center; gap: 10px; margin-top: 5px; }
.color-row input[type=color] { width: 46px; height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: #fff; }
.upload-row { display: grid; gap: 10px; margin: 14px 0; }
.upload { display: flex; gap: 12px; border: 1px dashed #c6cce0; border-radius: 12px; padding: 10px; align-items: center; }
.upload p { margin: 2px 0 6px; }
.upload-prev { width: 74px; height: 74px; border-radius: 10px; background: var(--bg) center/contain no-repeat; flex: none; display: grid; place-items: center; color: var(--muted); font-size: .7rem; text-align: center; }
.notice { background: #fff8e6; border: 1px solid #f3dc9e; border-radius: 12px; padding: 12px 14px; margin: 18px 0; font-size: .9rem; }
.notice p { margin: 4px 0 0; }

.sec-list { list-style: none; padding: 0; margin: 10px 0 14px; }
.sec-list li { display: flex; align-items: center; gap: 8px; padding: 8px 6px; border-bottom: 1px solid var(--line); font-size: .9rem; }
.sec-list li.off .sec-name { color: #9aa1b5; text-decoration: line-through; }
.sec-list .sec-name { flex: 1; cursor: pointer; }
.sec-list .sec-name small { color: var(--muted); display: block; font-size: .75rem; }
.sec-list .mini { border: 1px solid var(--line); background: #fff; border-radius: 7px; width: 28px; height: 28px; cursor: pointer; font-size: .8rem; }
.switch { position: relative; width: 36px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cfd4e2; border-radius: 99px; transition: .15s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: #17a34a; }
.switch input:checked + span::after { left: 18px; }

.preview-wrap { overflow: auto; padding: 18px 26px 80px; height: calc(100vh - 57px); }
.preview-tools { max-width: 8.5in; margin: 0 auto 10px; }
@media (max-width: 980px) {
  .workspace { grid-template-columns: 1fr; }
  .panel, .preview-wrap { height: auto; position: static; }
  .preview-wrap { padding: 14px 10px 60px; }
}

/* ---------- drawer / modal ---------- */
.drawer { position: fixed; inset: 0 0 0 auto; width: min(480px, 100vw); background: #fff; box-shadow: -18px 0 50px rgba(15,20,50,.18); transform: translateX(105%); transition: transform .22s ease; z-index: 50; overflow-y: auto; }
.drawer.open { transform: none; }
.drawer:not(.open) { box-shadow: none; visibility: hidden; transition: transform .22s ease, visibility 0s .22s; }
.drawer-inner { padding: 14px 20px 40px; }
.drawer header { display: flex; align-items: center; justify-content: space-between; }
.drawer h2 { margin: 6px 0; }
.ai-tabs { display: flex; gap: 6px; margin: 8px 0 6px; border-bottom: 1px solid var(--line); }
.ai-tabs button { border: none; background: none; padding: 8px 10px; cursor: pointer; color: var(--muted); border-bottom: 3px solid transparent; font-weight: 600; }
.ai-tabs button.active { color: var(--ink); border-bottom-color: var(--eras-blue); }
.drop { border: 2px dashed #c6cce0; border-radius: 14px; padding: 22px; text-align: center; cursor: pointer; font-weight: 400; background: #fafbff; }
.drop.over { border-color: var(--eras-blue); background: #f0f2ff; }
.file-list { list-style: none; padding: 0; margin: 6px 0; font-size: .86rem; }
.file-list li { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid var(--line); }
.ai-status { margin-top: 12px; font-size: .9rem; color: var(--muted); min-height: 1.2em; }
.ai-status.err { color: #b3261e; }
.review { border: 1px solid var(--line); border-radius: 12px; margin-top: 14px; overflow: hidden; }
.review h3 { margin: 0; padding: 10px 12px; background: var(--bg); font-size: .95rem; }
.review .rrow { display: grid; grid-template-columns: 22px 1fr; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line); font-size: .88rem; }
.review .rrow b { display: block; font-size: .78rem; color: var(--muted); font-weight: 600; }
.review .note { padding: 8px 12px; font-size: .85rem; background: #fff8e6; border-top: 1px solid var(--line); }
.spinner { display: inline-block; width: 15px; height: 15px; border: 2px solid #c7cdff; border-top-color: var(--eras-blue); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

.modal { position: fixed; inset: 0; background: rgba(15,20,45,.45); display: none; align-items: center; justify-content: center; z-index: 60; padding: 16px; }
.modal.open { display: flex; }
.modal-card { background: #fff; border-radius: 16px; padding: 20px; width: min(560px, 100%); max-height: 90vh; overflow: auto; }
.modal-card h3 { margin-top: 0; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.chips button { border: 1px solid var(--line); background: var(--bg); border-radius: 99px; padding: 5px 10px; cursor: pointer; font-size: .82rem; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(30px); background: #18203a; color: #fff; padding: 10px 16px; border-radius: 10px; opacity: 0; transition: .2s; z-index: 70; pointer-events: none; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%); }

/* =================================================================
   BOOKLET (screen preview and print)
   ================================================================= */
.booklet { --accent: #1b2a6b; max-width: 8.5in; margin: 0 auto; font-size: 11.5pt; line-height: 1.5; color: #1c2133; }
.booklet.a4 { max-width: 210mm; }
.page { background: #fff; box-shadow: 0 4px 24px rgba(20,30,70,.10); border-radius: 6px; padding: 0.7in 0.75in 0.6in; margin-bottom: 22px; position: relative; }
.b-cover { min-height: 10.4in; display: flex; flex-direction: column; padding: 0.55in 0.65in; }
.booklet.a4 .b-cover { min-height: 280mm; }
.cover-logos { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 70px; }
.cover-logos .prog-logo { max-height: 80px; max-width: 55%; object-fit: contain; }
.cover-logos .eras-logo { height: 78px; margin-left: auto; }
.cover-title { margin-top: 32px; }
.cover-title .kicker { color: var(--accent); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: 10.5pt; }
.cover-title h1 { font-size: 31pt; line-height: 1.08; margin: 8px 0 10px; color: #121a3a; }
.cover-title p { font-size: 13pt; color: #4b5470; margin: 0; }
.cover-art { margin: 26px 0 18px; flex: 1; display: flex; align-items: center; }
.cover-art img { width: 100%; max-height: 3.8in; object-fit: cover; border-radius: 18px; }
.cover-art svg { width: 100%; height: auto; }
.cover-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; border-top: 3px solid var(--accent); padding-top: 14px; font-size: 10.5pt; }
.cover-foot .who strong { display: block; font-size: 12.5pt; }
.cover-foot .name-line { color: #4b5470; }
.name-box { border-bottom: 1px solid #9aa1b5; min-width: 2.6in; height: 22px; margin-top: 6px; }

.toc h2, .b-section h2, .b-sources h2, .b-back h2 { font-size: 17pt; margin: 0 0 4px; color: #121a3a; line-height: 1.2; }
.toc ol { padding-left: 0; list-style: none; columns: 2; column-gap: 28px; margin: 16px 0 0; }
.toc li { display: flex; gap: 10px; align-items: center; padding: 7px 0; break-inside: avoid; border-bottom: 1px dotted #ccd2e2; }
.toc li .ico { width: 20px; height: 20px; color: var(--accent); flex: none; }
.toc .tnum { color: var(--accent); font-weight: 700; min-width: 1.4em; }

.b-section { break-before: page; }
.sec-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 3px solid var(--accent); }
.sec-badge { width: 52px; height: 52px; border-radius: 14px; background: var(--accent-soft, #eef1fb); color: var(--accent); display: grid; place-items: center; flex: none; }
.sec-badge .ico { width: 30px; height: 30px; }
.sec-head .sub { color: #4b5470; margin: 2px 0 0; font-size: 11pt; }
.sec-num { font-size: 9.5pt; font-weight: 700; color: var(--accent); letter-spacing: .06em; text-transform: uppercase; }
.sec-photo { width: 100%; max-height: 3.3in; object-fit: cover; border-radius: 12px; margin: 6px 0 12px; display: block; }
.b-section p { margin: 0 0 9px; }
.b-section ul { margin: 0 0 10px; padding-left: 1.2em; }
.b-section li { margin: 3px 0; }
ul.checklist { list-style: none; padding-left: 0; }
ul.checklist li { position: relative; padding-left: 28px; }
ul.checklist li::before { content: ""; position: absolute; left: 2px; top: .22em; width: 15px; height: 15px; border: 1.6px solid var(--accent); border-radius: 4px; }
.callout { border-radius: 12px; padding: 11px 14px; margin: 10px 0 12px; break-inside: avoid; border-left: 5px solid var(--accent); background: var(--accent-soft, #eef1fb); }
.callout .ct { font-weight: 700; margin-bottom: 3px; display: block; }
.callout.tip { border-left-color: #17a34a; background: #ecf8f0; }
.callout.warn { border-left-color: #d98a00; background: #fff6e2; }
.callout.urgent { border-left-color: #c62828; background: #fdecea; }
.callout.family { border-left-color: #7b3fbf; background: #f4edfb; }
.steps-tl { list-style: none; padding: 0 !important; margin: 4px 0 12px; position: relative; }
.steps-tl li { position: relative; padding: 0 0 12px 26px; break-inside: avoid; }
.steps-tl li::before { content: ""; position: absolute; left: 5px; top: .45em; width: 11px; height: 11px; border-radius: 50%; background: var(--accent); }
.steps-tl li::after { content: ""; position: absolute; left: 10px; top: 1.3em; bottom: -.1em; width: 2px; background: #cfd5ea; }
.steps-tl li:last-child::after { display: none; }
.steps-tl .lbl { font-weight: 700; display: block; color: var(--accent); }
.booklet sup { font-size: .68em; line-height: 0; color: #4b5470; }
.booklet .var-empty { }

.b-sources { break-before: page; }
.b-sources ol { padding-left: 1.4em; font-size: 9.5pt; color: #333a52; }
.b-sources li { margin: 4px 0; }
.b-sources .disclaimer { font-size: 9.5pt; color: #4b5470; border-top: 1px solid var(--line); margin-top: 14px; padding-top: 10px; }
.b-back { break-before: page; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 6in; }
.b-back .eras-big { width: 2.4in; margin: 0 auto 16px; }
.b-back p { max-width: 5.6in; margin: 6px auto; }
.b-back .learn-h { margin-top: 22px; }
.b-back .learn-row { display: flex; gap: 14px; margin-top: 10px; max-width: 6.8in; flex-wrap: wrap; justify-content: center; }
.b-back .learn { flex: 1 1 3in; border: 2px solid var(--accent); border-radius: 16px; padding: 14px 16px; display: flex; align-items: center; gap: 14px; text-align: left; break-inside: avoid; }
.b-back .learn p { margin: 4px 0; font-size: .92em; }
.toc-learn { margin-top: 18px; padding: 10px 14px; border-left: 4px solid var(--accent); background: #f3f5fb; font-size: .95em; }
.toc-learn a { color: var(--accent); }
.home-learn { margin-top: 18px; font-size: 1rem; }
.home-learn a { color: var(--eras-blue); font-weight: 700; }
.home-learn-sm { margin-top: 6px; font-size: .85rem; color: #5a6480; }
.home-learn-sm a { color: var(--eras-blue); }
.toc-learn-sm { display: block; margin-top: 5px; font-size: .82em; color: #5a6480; }
.b-back .qr svg, .b-back .qr img { width: 0.95in; height: 0.95in; display: block; }
.b-back a { color: var(--accent); word-break: break-all; }
.b-back .contact-card { margin-top: 18px; text-align: left; border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; min-width: 4.5in; }
.b-back .contact-card div { display: flex; justify-content: space-between; gap: 20px; padding: 4px 0; border-bottom: 1px dotted #d3d8e6; }

.page-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 8.5pt; color: #6a728c; }
.page-foot img { height: 26px; }
.print-foot { display: none; }

/* editing affordances (screen only) */
.editable [data-edit] { border-radius: 4px; transition: background .12s; }
.editable [data-edit]:hover { background: #fffbe0; outline: 1px dashed #e0c860; cursor: text; }
.editable [data-edit]:focus { background: #fffbe0; outline: 2px solid #e0c860; }
.sec-tools { position: absolute; top: 10px; right: 12px; display: flex; gap: 4px; opacity: .85; transition: .15s; }
.page:hover .sec-tools { opacity: 1; }
.sec-tools button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 4px 8px; font-size: .78rem; cursor: pointer; }
.customized-flag { font-size: .7rem; color: #9a6b00; background: #fff3cf; border-radius: 6px; padding: 1px 6px; margin-left: 6px; vertical-align: middle; }

/* ---------- print ---------- */
@page { size: letter; margin: 0.6in 0.65in 0.75in; }
html, body, body * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; color-adjust: exact !important; }
@media print {
  body { background: #fff; }
  .topbar, .panel, .preview-tools, .drawer, .modal, .toast, .sec-tools, .customized-flag, #screen-start { display: none !important; }
  #screen-build { display: block !important; }
  .workspace { display: block; }
  .preview-wrap { padding: 0; height: auto; overflow: visible; }
  .booklet { max-width: none; font-size: 11pt; }
  .page { box-shadow: none; border-radius: 0; padding: 0; margin: 0; }
  .b-cover { min-height: 9.5in; break-after: page; padding: 0; }
  .booklet.a4 .b-cover { min-height: 255mm; }
  .toc { break-after: page; }
  .page-foot { display: none; }
  .print-foot { display: flex; position: fixed; bottom: -0.5in; left: 0; right: 0; align-items: center; justify-content: space-between; font-size: 8pt; color: #6a728c; border-top: 1px solid #dfe3ee; padding-top: 4px; }
  .print-foot img { height: 22px; }
  .editable [data-edit]:hover { background: none; outline: none; }
  a { text-decoration: underline; }
  .callout, .steps-tl li, ul.checklist li { break-inside: avoid; }
  h2, .sec-head { break-after: avoid; }
}

/* ---------- simple wizard ---------- */
.btn.huge { padding: 16px 34px; font-size: 1.25rem; border-radius: 14px; }
.wz-count { color: var(--muted); font-weight: 600; }
.wz-bar { height: 6px; background: #e3e7f2; }
.wz-bar div { height: 100%; background: var(--eras-blue); width: 20%; transition: width .25s; }
.wizard { max-width: 640px; width: 100%; margin: 0 auto; padding: 36px 20px 60px; }
.wz-card { display: none; background: #fff; border-radius: 18px; padding: 28px 26px; box-shadow: 0 6px 30px rgba(20,30,80,.08); }
.wz-card.on { display: block; }
.wz-card h2 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 12px; }
.wz-help { color: var(--muted); font-size: 1.05rem; margin: 0 0 16px; }
.wz-card label { font-size: 1rem; }
input.wz-big { font-size: 1.2rem !important; padding: 14px 14px !important; }
.wz-upload { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.upload-prev.big { width: 140px; height: 140px; font-size: .85rem; }
.wz-nav { display: flex; justify-content: space-between; margin-top: 22px; }
.ready { background: #e9f8ef; border: 1px solid #b7e3c6; border-radius: 14px; padding: 14px 16px; margin-bottom: 6px; }
.ready strong { display: block; font-size: 1.15rem; margin-bottom: 2px; }
.ready-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
@media print { .ready { display: none !important; } }
input.wz-big { display: block; width: 100%; margin-top: 6px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
@media (max-width: 980px) { .preview-wrap { order: -1; } }
.more-box { display: flex; align-items: center; gap: 14px; margin-top: 16px; padding: 12px 16px; border: 1.5px solid var(--accent); border-radius: 14px; background: #f6f8fd; break-inside: avoid; }
.more-box .qr svg { width: 0.8in; height: 0.8in; display: block; }
.more-box strong { color: var(--accent); }
.more-box p { margin: 2px 0 0; font-size: .92em; }
.more-box a { color: var(--accent); word-break: break-all; }
.b-fig { position: relative; margin: 12px auto 10px; break-inside: avoid; text-align: center; }
.b-fig img { max-width: 100%; max-height: 3.3in; display: block; margin: 0 auto; border-radius: 10px; }
.b-fig figcaption { font-size: .86em; color: #4a5272; margin-top: 5px; font-style: italic; }
.b-fig.side { float: right; width: 36%; margin: 4px 0 10px 18px; }
.b-fig.side img { max-height: 4.2in; }
.b-fig.tall img { max-height: 4.5in; }
.b-section[data-id="going-home"] .b-fig.tall img { max-height: 4.2in; }
.fig-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 14px; align-items: start; margin: 10px 0; break-inside: avoid; }
.fig-row .b-fig { margin: 0; }
.fig-row .b-fig img { max-height: 3.5in; }
.clearfix { clear: both; }
.b-section .callout, .b-section .b-tablewrap, .b-section .more-box, .b-section .steps-tl { overflow: hidden; }
.fig-hide { position: absolute; top: 6px; right: 6px; opacity: 0; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 4px 8px; font-size: .78rem; cursor: pointer; transition: .15s; }
.b-fig:hover .fig-hide { opacity: 1; }
@media print { .fig-hide { display: none !important; } }
.wz-skip { text-align: center; margin-top: 14px; }
@media (max-width: 700px) {
  #screen-build .topbar { flex-wrap: wrap; gap: 6px 8px; padding: 8px 12px; }
  #screen-build .save-state { display: none; }
  #screen-build .topbar .btn { padding: 8px 12px; font-size: .9rem; white-space: nowrap; }
  .topbar-title { font-size: .95rem; }
  .booklet .page { padding: 22px 18px; }
  .b-cover h1 { font-size: 1.7rem; line-height: 1.15; }
  .b-back .learn-row { flex-direction: column; }
  .b-back .contact-card { min-width: 0; width: 100%; }
}
.b-tablewrap, .glance { margin: 10px 0 14px; }
.tcap { break-after: avoid; }
.b-table thead { display: table-header-group; }
.tcap { font-weight: 700; color: var(--accent); margin-bottom: 5px; }
.b-table { width: 100%; border-collapse: collapse; font-size: .93em; line-height: 1.35; }
.b-table th { background: var(--accent); color: #fff; text-align: left; padding: 6px 9px; font-weight: 600; border: 1px solid var(--accent); }
.b-table td { border: 1px solid #c9cfe2; padding: 6px 9px; vertical-align: top; }
.b-table tbody tr:nth-child(even) td { background: var(--accent-soft, #eef1fb); }
.b-table td.w { background: #fff !important; min-width: 1.1in; height: .36in; }
.b-table.log td.w { height: .42in; }
.b-table tr { break-inside: avoid; }
.b-table.plain th { background: var(--accent-soft, #eef1fb); color: #121a3a; border-color: #c9cfe2; width: 34%; vertical-align: top; }
.b-table.plain tbody tr:nth-child(even) td { background: #fff; }
.glance { border-left: 5px solid var(--accent); padding-left: 12px; }
.b-back .contact-card div > span { display: flex; flex-direction: column; }
.b-back .contact-card small { color: #5b637d; font-size: .82em; }
.b-back .contact-card strong { text-align: right; }
details.more-q { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin: 10px 0; background: #fafbfe; }
details.more-q summary { cursor: pointer; font-weight: 600; }
@media (max-width: 700px) { .b-fig.side { float: none; width: 100%; margin: 12px 0; } .fig-row { grid-auto-flow: row; } .b-table { font-size: .85em; } }
.sample-tag { align-self: center; margin-top: 12px; background: #fff3cf; color: #7a5200; font-size: 9pt; font-weight: 600; padding: 3px 14px; border-radius: 10px; }
.b-cover { position: relative; }
.cover-art img { max-height: 5.1in; }
.b-section[data-id="journey"] .b-fig img { max-height: 3.2in; }
.b-back .eras-big { width: 1.8in; margin-bottom: 8px; }
.b-back .contact-card { margin-top: 10px; padding: 10px 16px; }
.b-back .contact-card h2 { margin-bottom: 4px; }
.b-back .contact-card.many { width: 100%; max-width: 6.9in; display: grid; grid-template-columns: 1fr 1fr; column-gap: 26px; }
.b-back .contact-card.many h2 { grid-column: 1 / -1; }
.b-back .contact-card.many div { font-size: .93em; align-items: baseline; }
.b-back .learn-h { margin-top: 14px; }
.b-back { justify-content: flex-start; }
@media (max-width: 700px) { .b-back .contact-card.many { grid-template-columns: 1fr; } }
.b-table { font-size: .9em; }
.b-table th, .b-table td { padding: 4px 8px; }
.toc .glance { margin-top: 20px; }
.b-tablewrap.keep { break-inside: avoid; }
.b-section[data-id="going-home"] .b-fig.side { width: 26%; }

.b-section[data-id="heart-condition"] .b-fig.tall img { max-height: 5in; }
.b-section[data-id="heart-condition"] .b-fig.wide img { max-height: 2.9in; }

.hero-pages { position: relative; width: 100%; aspect-ratio: 1 / 0.86; }
.hero-pages img { position: absolute; width: 52%; border-radius: 8px; border: 1px solid #e3e7f2; box-shadow: 0 14px 34px rgba(20,30,80,.22); }
.hero-pages .hp1 { left: 0; top: 0; transform: rotate(-6deg); }
.hero-pages .hp2 { left: 24%; top: 5%; transform: rotate(1deg); }
.hero-pages .hp3 { right: 0; top: 9%; transform: rotate(7deg); }

.lede-custom { margin: -6px 0 18px; font-size: 1.05rem; font-weight: 600; color: #1f2a5c; max-width: 34em; }

.stock-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 10px; }
.stock-item { border: 2px solid #e3e7f2; border-radius: 10px; padding: 0; background: #fff; cursor: pointer; overflow: hidden; text-align: left; font: inherit; }
.stock-item:hover, .stock-item:focus { border-color: #1a1ad6; outline: none; }
.stock-item img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.stock-item span { display: block; padding: 6px 8px; font-size: .8rem; color: #1f2a5c; }

.cover-art { position: relative; }
.cover-change { position: absolute; right: 12px; bottom: 12px; border: 0; border-radius: 10px; padding: 9px 14px; font: inherit; font-weight: 700; font-size: .9rem; color: #fff; background: #1a1ad6; box-shadow: 0 4px 14px rgba(0,0,0,.3); cursor: pointer; }
.cover-change:hover { background: #1010a8; }
.sec-tools button[data-sec-act="photo"] { border-color: #1a1ad6; color: #1a1ad6; font-weight: 700; }
.wz-or { margin: 18px 0 0; }
#wz-stock { grid-template-columns: repeat(3, 1fr); margin-bottom: 12px; }
@media print { .cover-change { display: none !important; } }

/* language switch */
.lang-pick { position: relative; display: inline-block; }
.lang-pick.hidden { display: none; }
.lang-btn { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 7px 12px 7px 10px; border-radius: 99px; border: 1px solid var(--line); background: #fff; cursor: pointer; font: inherit; font-size: .95rem; font-weight: 600; color: #1b2a6b; white-space: nowrap; }
.lang-btn:hover, .lang-pick.open .lang-btn, .lang-btn:focus-visible { border-color: #9aa3c2; box-shadow: 0 0 0 3px rgba(27,42,107,.12); outline: none; }
.lang-pick svg { flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.lang-btn .globe { width: 19px; height: 19px; }
.lang-btn .caret { width: 12px; height: 12px; stroke-width: 1.8; color: #6a728c; transition: transform .15s; }
.lang-pick.open .caret { transform: rotate(180deg); }
.lang-list { display: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 270px; max-height: 70vh; overflow-y: auto; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(20,30,70,.18); }
.lang-pick.open .lang-list { display: block; }
.lang-head { white-space: nowrap; padding: 8px 12px 6px; font-size: .78rem; font-weight: 700; letter-spacing: .02em; color: #6a728c; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.lang-items { margin: 0; padding: 0; list-style: none; }
.lang-list button { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 14px; min-height: 44px; padding: 8px 12px; border: 0; border-radius: 8px; background: none; cursor: pointer; font: inherit; font-size: 1rem; color: #1f2740; text-align: left; }
.lang-list button:hover, .lang-list button:focus-visible { background: #eef1f9; outline: none; }
.lang-list button.on { font-weight: 700; color: #1b2a6b; }
.lang-list button svg { width: 16px; height: 16px; stroke-width: 2.2; visibility: hidden; color: #1b2a6b; }
.lang-list button.on svg { visibility: visible; }
.lang-btn .lang-word { font-weight: 500; color: #6a728c; }
@media (max-width: 560px) { .lang-btn .lang-word { display: none; } .lang-btn { padding: 7px 10px; gap: 5px; font-size: .9rem; } .badge-free { display: none; } }
/* Wide screens: every language name shows in one bar. Phones, or more than 6 languages: the dropdown button. */
.lang-row { display: flex; align-items: center; padding: 6px 18px; background: #f5f7fc; border-bottom: 1px solid var(--line); }
.lang-row .lang-pick { display: block; width: 100%; }
.lang-row .lang-pick.hidden { display: none; }
.lang-row .lang-list { left: 0; right: auto; }
.lang-bar { display: none; flex-wrap: wrap; align-items: center; gap: 2px 4px; }
.lang-bar-lbl { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 600; color: #6a728c; margin-right: 4px; white-space: nowrap; }
.lang-bar-lbl .globe { width: 18px; height: 18px; }
.lang-bar button { border: 0; background: none; font: inherit; font-size: .92rem; font-weight: 600; color: #1b2a6b; padding: 5px 11px; border-radius: 99px; cursor: pointer; white-space: nowrap; }
.lang-bar button:hover, .lang-bar button:focus-visible { background: #e6eaf5; outline: none; }
.lang-bar button.on { background: #1b2a6b; color: #fff; }
/* Wide screens: every language is listed by name in its own row under the header, wrapping neatly as more are added.
   Phones: one button with the current language and how many there are; it opens the full list. */
@media (min-width: 700px) { .lang-row .lang-bar { display: flex; } .lang-row .lang-btn, .lang-row .lang-list { display: none !important; } }
.lang-cnt { display: inline-block; font-size: .75rem; font-weight: 700; color: #fff; background: #1b2a6b; border-radius: 99px; padding: 1px 7px; }
@media (max-width: 699px) { .lang-row { padding: 6px 12px; } .lang-row .lang-btn .lang-word { display: inline; } }
@media print { .lang-pick, .lang-row { display: none !important; } }

/* terms of use */
.terms-list { padding-left: 1.3em; font-size: .95rem; line-height: 1.45; }
.terms-list li { margin: 7px 0; }
.terms-check { display: flex; gap: 10px; align-items: flex-start; font-weight: 700; margin-top: 12px; padding: 12px; border: 2px solid var(--eras-blue); border-radius: 10px; cursor: pointer; }
.terms-check input { width: 20px; height: 20px; margin-top: 2px; flex: none; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.terms-link { padding: 0; font-size: .85rem; }
.b-sources .terms-line { font-size: 8.5pt; color: #4b5470; margin-top: 8px; }
.terms-short { font-size: 1.05rem; line-height: 1.5; }
.terms-more { margin: 8px 0 0; }
.terms-more .btn.link { padding: 0; font-size: .9rem; }
.home-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; font-size: .9rem; font-weight: 700; white-space: nowrap; }
.home-btn i { font-style: normal; }

/* write-in spaces for the patient (workbook) */
.fill { border: 1.6px solid var(--accent); border-radius: 12px; padding: 10px 14px 12px; margin: 10px 0 12px; break-inside: avoid; background: #fff; }
.fill .ct { font-weight: 700; color: var(--accent); display: block; margin-bottom: 1px; }
.fill-hint { font-size: .92em; color: #4a5270; margin-bottom: 2px; }
.fill-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0 8px; margin-top: 9px; }
.fill-lab { font-weight: 600; }
.fill-line { flex: 1 1 1.6in; min-width: 1.2in; height: 1.35em; border-bottom: 1.3px solid #7c849e; }
.fill-line.full { flex: 0 0 100%; height: 1.9em; }
.fill.one { padding: 8px 14px 12px; }
.fill.one .fill-row { margin-top: 2px; }
.b-table.grid th, .b-table.grid td { text-align: center; padding: 5px 4px; }
.b-table.grid th:first-child, .b-table.grid td:first-child { text-align: left; padding-left: 9px; width: 36%; }
.b-table.grid th:first-child { font-weight: 500; }
.b-table.grid td.w { min-width: 0; height: auto; }
.b-table.grid .tick { display: inline-block; width: 16px; height: 16px; border: 1.6px solid var(--accent); border-radius: 4px; vertical-align: middle; }
