/* The journal editor: three columns on a wide screen, tabs on a phone. */
.is-editor .footer { margin-top: 60px; }
.editor-root { max-width: 2400px; margin: 0 auto; padding: 18px 20px 0; min-height: 70vh; }
.editor-root:has(.st-grid), .editor-root:has(.st-wizard) { max-width: 1220px; }
.ed-loading { display: grid; place-items: center; gap: 14px; padding: 120px 0; color: var(--muted); font-weight: 550; }
.ed-loading-mark .logo-mark { width: 54px; height: 54px; animation: pulse-soft 1.6s ease-in-out infinite; }
@keyframes pulse-soft { 50% { transform: scale(0.92); opacity: 0.7; } }
.ed-noscript, .ed-fail { max-width: 640px; margin: 60px auto; padding: 0 20px; }
.ed-fail { padding: 18px 20px; border-radius: var(--radius); background: var(--clay); color: var(--clay-ink); }

/* Bar: name, saving, undo, menus, print. */
.ed-bar { position: sticky; top: 78px; z-index: 30; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 10px 10px 16px; border-radius: var(--radius-l); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-s); }
.ed-bar-name { display: flex; align-items: center; gap: 10px; flex: 1 1 280px; min-width: 0; color: var(--accent); }
.ed-name { flex: 1; min-width: 0; font: 500 23px/1.2 var(--display); font-variant-numeric: lining-nums; letter-spacing: -0.005em; color: var(--ink); border: 1.5px solid transparent; background: transparent; border-radius: var(--radius-s); padding: 6px 8px; margin-left: -4px; text-overflow: ellipsis; }
.ed-name:hover { border-color: var(--line); }
.ed-name:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--sage); }
.ed-save { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 550; color: var(--muted); white-space: nowrap; }
.ed-save.is-saved .icon { color: var(--leaf-ink); }
.ed-save.is-error { color: var(--clay-ink); }
.ed-bar-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ed-sep { width: 1px; height: 26px; background: var(--line2); margin: 0 4px; }
.ed-icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: var(--radius); border: 0; background: transparent; color: var(--ink2); cursor: pointer; transition: background 0.2s, color 0.2s, transform 0.2s; }
.ed-icon-btn:hover:not(:disabled) { background: var(--sage); color: var(--ink); }
.ed-icon-btn:active:not(:disabled) { transform: scale(0.94); }
.ed-icon-btn:disabled { opacity: 0.3; cursor: default; }
.ed-tool { display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--line2); background: var(--surface); color: var(--ink); font: 600 14px var(--sans); cursor: pointer; transition: background 0.2s, box-shadow 0.2s; }
.ed-tool:hover { background: var(--bg); box-shadow: var(--shadow-s); }
.ed-print { min-height: 42px; }
.spin { animation: spin 1s linear infinite; }

.ed-problems { margin-top: 10px; display: grid; gap: 6px; }
.ed-problems p { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; padding: 10px 14px; border-radius: var(--radius); background: var(--butter); color: var(--gold-ink); font-size: 14px; }
.ed-link { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; font-weight: 650; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

.ed-main { display: grid; grid-template-columns: 370px minmax(0, 1fr) 340px; gap: 18px; margin-top: 16px; align-items: start; }
.ed-col { min-width: 0; }
.ed-col-structure, .ed-col-style { position: sticky; top: 154px; max-height: calc(100vh - 170px); overflow-y: auto; overscroll-behavior: contain; padding: 4px 4px 24px; scrollbar-width: thin; }
.ed-col-title { display: flex; align-items: center; gap: 8px; font: 500 21px/1.1 var(--display); font-variant-numeric: lining-nums; letter-spacing: 0; margin: 4px 4px 12px; color: var(--ink); }
.ed-col-title .icon { color: var(--accent); }
.ed-count { margin-left: auto; font-size: 12.5px; font-weight: 600; color: var(--sage-ink); background: var(--sage); padding: 5px 10px; border-radius: var(--round); }

/* Structure. */
.ed-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ed-card { position: relative; display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 10px 8px 10px 4px; border-radius: var(--radius); background: var(--surface); border: 1.5px solid var(--line); box-shadow: var(--shadow-s); transition: border-color 0.2s, box-shadow 0.2s, opacity 0.2s; cursor: default; }
.ed-card:hover { border-color: var(--line2); box-shadow: var(--shadow); }
.ed-card.is-selected { border-color: var(--accent); box-shadow: 0 0 0 4px var(--sage); }
.ed-card.is-dragging, .ed-group.is-dragging { opacity: 0.35; }
.ed-grip { display: grid; place-items: center; width: 26px; height: 40px; border: 0; background: transparent; color: var(--muted); border-radius: 5px; cursor: grab; touch-action: none; }
.ed-grip:hover { background: var(--bg); color: var(--ink); }
.ed-grip:active { cursor: grabbing; }
.ed-card-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: var(--radius-s); background: var(--grad-soft); color: var(--sage-ink); flex: none; }
.ed-card-text { display: grid; min-width: 0; }
.ed-card-name { font-weight: 650; font-size: 14.5px; }
.ed-card-sub { font-size: 12.5px; color: var(--muted); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ed-stepper { display: inline-flex; align-items: center; gap: 1px; padding: 3px; border-radius: var(--round); background: var(--bg); border: 1px solid var(--line); }
.ed-stepper button { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 0; background: var(--surface); color: var(--sage-ink); cursor: pointer; box-shadow: var(--shadow-s); transition: transform 0.15s, background 0.2s; }
.ed-stepper button:hover:not(:disabled) { background: var(--sage); }
.ed-stepper button:active:not(:disabled) { transform: scale(0.9); }
.ed-stepper button:disabled { opacity: 0.35; cursor: default; }
.ed-stepper input { width: 2.6em; border: 0; background: transparent; text-align: center; font: 700 15px var(--sans); color: var(--ink); -moz-appearance: textfield; padding: 0; }
.ed-stepper input::-webkit-outer-spin-button, .ed-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ed-stepper input:focus { outline: none; }
.ed-stepper:focus-within { border-color: var(--accent); }
.ed-group { position: relative; padding: 10px; border-radius: var(--radius-l); background: var(--leaf); border: 1.5px dashed var(--leaf-2); }
.ed-group-head { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto auto; align-items: center; gap: 8px; padding: 2px 0 8px; }
.ed-group-icon { background: var(--surface); }
.ed-times { font-size: 13px; color: var(--ink2); font-weight: 550; }
.ed-sublist { padding: 4px 0 2px; min-height: 40px; }
.ed-drop-hint { padding: 14px; border-radius: var(--radius); border: 1.5px dashed var(--sage-2); color: var(--sage-ink); font-size: 13px; text-align: center; }
.ed-empty { color: var(--muted); font-size: 14px; padding: 18px; border-radius: var(--radius); border: 1.5px dashed var(--line2); text-align: center; }
.ed-add { position: relative; margin-top: 12px; }
.ed-add-small { margin-top: 8px; }
.ed-add-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 46px; border-radius: var(--radius); border: 1.5px dashed var(--line2); background: rgba(255, 255, 255, 0.6); color: var(--sage-ink); font: 650 14.5px var(--sans); cursor: pointer; transition: background 0.2s, border-color 0.2s; }
.ed-add-small .ed-add-btn { min-height: 38px; font-size: 13px; }
.ed-add-btn:hover { background: var(--surface); border-color: var(--accent); }
.ed-picker-group { display: grid; gap: 6px; }
.ed-picker-head { margin: 10px 8px 0; font-size: 13px; font-weight: 650; color: var(--ink2); }
.ed-picker-group:first-child .ed-picker-head { margin-top: 2px; }
.ed-picker { display: grid; gap: 6px; margin-top: 8px; padding: 8px; border-radius: var(--radius-l); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); animation: pop 0.25s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(0.98); } }
.ed-tile { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: center; text-align: left; padding: 8px; border-radius: var(--radius); border: 0; background: transparent; font: inherit; color: var(--ink); cursor: grab; touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.ed-tile:hover { background: var(--bg); }

/* Menus. */
.ed-menu-wrap { position: relative; }
.ed-menu { overflow-y: auto; overscroll-behavior: contain; position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 220px; display: grid; padding: 6px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-l); animation: pop 0.2s var(--ease); }
.ed-menu.is-up { top: auto; bottom: calc(100% + 6px); transform-origin: bottom right; }
.ed-menu button { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-s); border: 0; background: transparent; font: 550 14px var(--sans); color: var(--ink); text-align: left; cursor: pointer; }
.ed-menu button:hover { background: var(--bg); }
.ed-menu button.is-danger { color: #b3261e; }
.ed-scrim { position: fixed; inset: 0; z-index: 35; }

/* Drag and drop. */
.dnd-ghost { position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; box-shadow: var(--shadow-l) !important; background: var(--surface) !important; border-color: var(--accent) !important; }
.dnd-marker { position: fixed; left: 0; top: 0; z-index: 99; height: 4px; border-radius: 4px; background: var(--grad); pointer-events: none; transition: transform 0.12s var(--ease), opacity 0.15s; box-shadow: 0 0 0 3px rgba(70, 80, 46, 0.15); }
body.is-dnd { user-select: none; -webkit-user-select: none; cursor: grabbing; }

/* Pages. */
.ed-col-pages { padding: 4px 0 40px; overflow-x: clip; }
.ed-pages-box { min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; padding: 6px 16px 30px; }
.ed-zoom { position: sticky; top: 154px; z-index: 5; display: flex; align-items: center; gap: 6px; width: fit-content; margin: 0 auto 14px; padding: 4px 10px; border-radius: var(--round); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-s); }
.ed-zoom input { width: 120px; accent-color: var(--accent); }
.ed-pages { display: grid; justify-items: safe center; gap: 26px; padding-bottom: 8px; }
.ed-spread { display: flex; gap: 2px; filter: drop-shadow(0 18px 30px rgba(60, 50, 20, 0.12)); }
.ed-page { position: relative; width: var(--pw); flex: none; aspect-ratio: var(--ratio); padding: 0; border: 0; background: var(--surface); cursor: pointer; border-radius: 3px; transition: box-shadow 0.25s; }
.ed-page-none { background: transparent; cursor: default; }
.ed-page:hover { box-shadow: 0 0 0 3px var(--sage-2); }
.ed-page.is-on { box-shadow: 0 0 0 3px var(--accent); }
.ed-svg { display: block; width: 100%; height: 100%; }
.ed-page-wait { display: block; width: 100%; height: 100%; background: linear-gradient(90deg, var(--surface) 0%, var(--bg) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.ed-page.is-fill { cursor: default; opacity: 0.55; outline: 1.5px dashed var(--line2); outline-offset: 4px; }
.ed-page.is-fill:hover { box-shadow: none; }
.ed-fill-badge { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); padding: 3px 10px; border-radius: var(--radius); background: var(--ink); color: var(--surface); font-size: 11px; font-weight: 650; white-space: nowrap; }
.ed-hint.ed-fill-hint { max-width: 520px; margin: 34px auto 0; }
.ed-pages-empty { display: grid; justify-items: center; gap: 10px; max-width: 360px; margin: 60px auto; text-align: center; color: var(--muted); }
.ed-pages-empty .icon { width: 36px; height: 36px; color: var(--accent); }
.ed-pages-empty p { margin: 0; }
.ed-page-num { position: absolute; bottom: -22px; left: 50%; transform: translateX(-50%); font-size: 11.5px; color: var(--muted); font-weight: 600; }

/* Style panel. */
.ed-style { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.ed-style > * { min-width: 0; }
.ed-section { padding: 16px; border-radius: var(--radius-l); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-s); display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.ed-section h3 { display: flex; align-items: center; gap: 8px; font: 700 15px/1.2 var(--sans); letter-spacing: 0; margin: 0; }
.ed-section h3 .icon { color: var(--accent); }
.ed-seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; padding: 4px; border-radius: var(--radius); background: var(--tint); border: 1px solid var(--line); }
.ed-seg-item { position: relative; display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 0; padding: 4px 6px; text-align: center; line-height: 1.2; min-height: 44px; border-radius: var(--radius-s); font-weight: 650; font-size: 14px; color: var(--ink2); cursor: pointer; transition: background 0.25s, color 0.25s, box-shadow 0.25s; }
.ed-seg-item input, .ed-pattern input, .ed-colour input, .ed-tone input, .ed-font input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.ed-seg-item.is-on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-s); }
.ed-seg-item.is-off { opacity: 0.4; cursor: not-allowed; }
.ed-paper { display: inline-block; border: 1.5px solid currentColor; border-radius: 2px; opacity: 0.6; }
.ed-paper-a4 { width: 12px; height: 17px; } .ed-paper-a5 { width: 10px; height: 14px; } .ed-paper-a6 { width: 8px; height: 11px; }
.ed-patterns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.ed-pattern { position: relative; display: grid; justify-items: center; gap: 4px; padding: 8px 2px 6px; border-radius: var(--radius); border: 1.5px solid transparent; font-size: 12px; font-weight: 550; text-align: center; line-height: 1.2; cursor: pointer; background: var(--bg); transition: border-color 0.2s, background 0.2s, transform 0.25s var(--ease); }
.ed-pattern:hover { transform: translateY(-2px); background: var(--surface); }
.ed-pattern.is-on { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--sage); }
.ed-pattern-icon { width: 34px; height: 42px; }
.ed-colours { display: flex; flex-wrap: wrap; gap: 6px; }
.ed-colour { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px 4px 4px; border-radius: var(--round); border: 1.5px solid transparent; background: var(--bg); font-size: 13px; font-weight: 550; cursor: pointer; transition: border-color 0.2s, background 0.2s; }
.ed-colour svg { width: 24px; height: 24px; transition: transform 0.3s var(--ease); }
.ed-colour.is-on { border-color: var(--accent); background: var(--surface); }
.ed-colour.is-on svg { transform: scale(1.12); }
.ed-tones { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); padding: 3px; gap: 2px; border-radius: var(--round); background: var(--tint); border: 1px solid var(--line); }
.ed-tone { position: relative; text-align: center; padding: 8px 6px; border-radius: var(--round); font-size: 13px; font-weight: 600; color: var(--ink2); cursor: pointer; transition: background 0.25s, color 0.25s; }
.ed-tone.is-on { background: var(--accent); color: var(--surface); }
.ed-hint { display: flex; gap: 8px; align-items: flex-start; margin: 0; color: var(--muted); font-size: 13px; }
.ed-hint .icon { color: var(--accent); margin-top: 2px; }
.ed-sublabel { margin: 4px 0 6px; font-weight: 650; font-size: 13px; color: var(--ink2); }
.ed-fonts { position: relative; max-height: 250px; overflow-y: auto; padding: 0 6px 6px; border-radius: var(--radius); background: var(--bg); border: 1px solid var(--line); overscroll-behavior: contain; scrollbar-width: thin; }
.ed-font-group { position: sticky; top: 0; z-index: 1; margin: 0 -6px; padding: 9px 12px 6px; background: var(--bg); font-size: 12.5px; font-weight: 650; color: var(--accent); }
.ed-font { position: relative; display: grid; padding: 8px 10px; border-radius: var(--radius-s); border: 1.5px solid transparent; cursor: pointer; }
.ed-font:hover { background: var(--surface); }
.ed-font.is-on { border-color: var(--accent); background: var(--surface); }
.ed-font-sample { font-size: calc(17px * var(--fs, 1)); line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-font-sample.is-head { font-size: calc(22px * var(--fs, 1)); }
.ed-font-name { font-size: 11.5px; color: var(--muted); font-weight: 550; }
.ed-field { display: grid; gap: 6px; font-size: 13.5px; font-weight: 600; }
.ed-field input[type=text], .ed-unit input { font: 500 15px var(--sans); color: var(--ink); background: var(--bg); border: 1.5px solid var(--line2); border-radius: var(--radius); padding: 9px 12px; min-width: 0; }
.ed-field input:focus, .ed-unit input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--sage); }
.ed-field-row { grid-template-columns: 1fr auto; align-items: center; }
.ed-unit { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.ed-unit input { width: 4.5em; }
.ed-switch { position: relative; display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.ed-switch input { position: absolute; opacity: 0; width: 44px; height: 26px; margin: 0; cursor: pointer; }
.ed-switch-ui { position: relative; width: 42px; height: 24px; border-radius: var(--radius); background: var(--line2); transition: background 0.3s; flex: none; }
.ed-switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: transform 0.35s var(--ease); }
.ed-switch input:checked + .ed-switch-ui { background: var(--accent); }
.ed-switch input:checked + .ed-switch-ui::after { transform: translateX(18px); }
.ed-switch input:focus-visible + .ed-switch-ui { outline: 2.5px solid var(--accent); outline-offset: 2px; }

/* Dialogs. */
.ed-dialog { width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); padding: 0; border: 0; border-radius: var(--radius-l); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-l); }
.ed-dialog.is-wide { width: min(920px, calc(100vw - 24px)); }
.ed-dialog::backdrop { background: rgba(52, 44, 20, 0.4); }
.ed-dialog[open] { animation: rise 0.35s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(0.98); } }
.ed-dialog-body { padding: 22px 24px 26px; display: grid; gap: 16px; }
.ed-dialog-head { display: flex; align-items: center; gap: 12px; }
.ed-dialog-head h2 { font-size: 24px; flex: 1; }
.ed-dialog-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--radius); background: var(--sage); color: var(--sage-ink); }
.ed-figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ed-figures > div { padding: 14px; border-radius: var(--radius); background: var(--sage); display: grid; gap: 4px; }
.ed-figures > div:nth-child(2) { background: var(--wheat); }
.ed-figures > div:nth-child(3) { background: var(--leaf); }
.ed-figures b { font: 500 32px/1 var(--display); font-variant-numeric: lining-nums; letter-spacing: -0.005em; }
.ed-figures span { font-size: 12.5px; color: var(--ink2); }
.ed-actions { display: grid; gap: 8px; }
.ed-actions .btn { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: wait; transform: none; }
.ed-error { display: flex; gap: 8px; margin: 0; padding: 12px 14px; border-radius: var(--radius); background: var(--clay); color: var(--clay-ink); font-size: 14px; }
.ed-h3 { display: flex; align-items: center; gap: 8px; font: 700 15px var(--sans); letter-spacing: 0; }
.ed-h3 .icon { color: var(--accent); }
.ed-journals { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.ed-journal { position: relative; display: grid; border-radius: var(--radius); background: var(--bg); border: 1.5px solid transparent; transition: transform 0.3s var(--ease), box-shadow 0.3s; }
.ed-journal:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.ed-journal.is-on { border-color: var(--accent); }
.ed-journal-open { display: grid; gap: 4px; padding: 12px; border: 0; background: transparent; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.ed-thumb { width: 100%; aspect-ratio: 148.5 / 210; border-radius: 4px; box-shadow: var(--shadow-s); background: var(--surface); margin-bottom: 6px; }
.ed-journal-name { font-weight: 650; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-journal-date { font-size: 12px; color: var(--muted); }
.ed-journal-actions { position: absolute; top: 16px; right: 16px; display: flex; gap: 2px; padding: 2px; border-radius: var(--radius); background: rgba(255, 255, 255, 0.92); box-shadow: var(--shadow-s); opacity: 0; transition: opacity 0.2s; }
.ed-journal:hover .ed-journal-actions, .ed-journal:focus-within .ed-journal-actions { opacity: 1; }
.ed-journal-new { display: grid; place-items: center; align-content: center; gap: 10px; min-height: 240px; border: 1.5px dashed var(--line2); background: transparent; font: 650 14px var(--sans); color: var(--sage-ink); cursor: pointer; }
.ed-journal-plus { display: grid; place-items: center; width: 48px; height: 48px; border-radius: var(--radius); background: var(--sage); color: var(--sage-ink); }
.ed-inline-form { display: flex; gap: 8px; }
.ed-inline-form input { flex: 1; min-width: 0; font: 500 15px var(--sans); background: var(--bg); border: 1.5px solid var(--line2); border-radius: var(--radius); padding: 9px 12px; }
.ed-versions { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 50vh; overflow-y: auto; }
.ed-versions li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius); background: var(--bg); }
.ed-versions span { display: grid; }
.ed-versions small { color: var(--muted); }

.ed-toast { position: fixed; z-index: 120; left: 50%; bottom: 26px; transform: translateX(-50%); display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 24px); padding: 12px 14px 12px 18px; border-radius: var(--radius); background: var(--ink); color: var(--surface); font-size: 14.5px; box-shadow: var(--shadow-l); animation: toast 0.35s var(--ease); }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 14px); } }
.ed-toast button { border: 0; border-radius: var(--radius-s); padding: 7px 12px; background: rgba(255, 255, 255, 0.14); color: var(--surface); font: 650 13.5px var(--sans); cursor: pointer; white-space: nowrap; }
.ed-toast button:hover { background: rgba(255, 255, 255, 0.24); }
.ed-dropfile { position: fixed; inset: 12px; z-index: 130; display: grid; place-items: center; align-content: center; gap: 10px; border-radius: var(--radius); border: 3px dashed var(--accent); background: rgba(238, 240, 224, 0.95); color: var(--sage-ink); font: 600 20px var(--display); font-variant-numeric: lining-nums; pointer-events: none; }
.ed-tabs { display: none; border-radius: var(--radius-l); }

/* Below the width where the three columns fit side by side, the editor
   shows one column at a time, chosen with the tab bar at the bottom. */
@media (max-width: 1280px) {
  .is-editor .pillbar { display: none; }
  .ed-main { grid-template-columns: minmax(0, 1fr); margin-top: 12px; }
  .ed-col-structure, .ed-col-style { position: static; max-height: none; overflow: visible; padding: 0; }
  .ed[data-tab="structure"] .ed-col-pages, .ed[data-tab="structure"] .ed-col-style,
  .ed[data-tab="pages"] .ed-col-structure, .ed[data-tab="pages"] .ed-col-style,
  .ed[data-tab="style"] .ed-col-structure, .ed[data-tab="style"] .ed-col-pages { display: none; }
  .ed-style { grid-template-columns: minmax(0, 1fr); }
  .ed-tabs { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: max(10px, calc(env(safe-area-inset-bottom) - 14px)); display: flex; gap: 4px; padding: 5px; width: min(22rem, calc(100vw - 24px)); border-radius: var(--radius-l); background: var(--surface); border: 1px solid var(--line2); box-shadow: 0 12px 34px -10px rgba(60, 50, 20, 0.3); }
  .ed-tabs button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px; height: 48px; border: 0; border-radius: var(--radius); background: transparent; color: var(--ink2); font: 650 14px var(--sans); transition: background 0.35s var(--ease), color 0.35s, flex 0.45s var(--ease); }
  .ed-tabs .icon { width: 21px; height: 21px; }
  .ed-tabs button:not([aria-current]) span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .ed-tabs button[aria-current] { flex: 2; background: var(--ink); color: var(--surface); }
  .ed-toast { bottom: 84px; }
  .ed-col-pages { padding-bottom: 90px; }
  .ed-col-structure, .ed-col-style { max-width: 640px; width: 100%; justify-self: center; }
}
@media (max-width: 860px) {
  .editor-root { padding: 6px 12px 0; }
  .ed-zoom { top: 8px; border-radius: var(--round); }
  .ed-bar { top: 8px; padding: 8px 8px 8px 12px; border-radius: var(--radius-l); }
  .ed-bar-name { flex-basis: 100%; }
  .ed-bar-tools { width: 100%; justify-content: space-between; }
  .ed-tool span { display: none; }
  .ed-tool { padding: 0 11px; }
  .ed-sep { display: none; }
  .ed-print { flex: 1; }
  .ed-card { grid-template-columns: auto auto minmax(0, 1fr) auto; }
  .ed-card .ed-stepper { grid-column: 3; justify-self: start; }
  .ed-card .ed-menu-wrap { grid-column: 4; grid-row: 1; }
  .ed-card-sub { display: none; }
  .ed-group-head { grid-template-columns: auto auto minmax(0, 1fr) auto; }
  .ed-group-head .ed-stepper { grid-column: 3; justify-self: start; }
  .ed-group-head .ed-times { display: none; }
  .ed-group-head .ed-menu-wrap { grid-column: 4; grid-row: 1; }
  .ed-dialog { border-radius: var(--radius-l) var(--radius-l) 0 0; margin: auto 0 0; width: 100vw; max-width: 100vw; max-height: 88vh; }
  .ed-journals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ed-journal-actions { opacity: 1; }
}

/* Beginning: ready-made journals, three questions, or empty. */
.st { padding: 10px 0 30px; }
.st-head { max-width: 760px; margin: 30px 0 34px; }
.st-head .page-title { margin-bottom: 14px; }
.st-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.st-card { position: relative; display: grid; align-content: start; gap: 8px; padding: 18px; border-radius: var(--radius-l); border: 1px solid var(--line2); background: var(--surface); box-shadow: var(--shadow-s); text-align: left; font: inherit; color: var(--ink); cursor: pointer; transition: transform 0.45s var(--ease), box-shadow 0.45s var(--ease), border-color 0.3s; }
.st-card:hover { border-color: var(--gold); transform: translateY(-4px); box-shadow: var(--shadow-l); }
.st-card:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 3px; }
.st-name { display: flex; align-items: center; gap: 8px; font: 600 22px/1.2 var(--display); font-variant-numeric: lining-nums; }
.st-name .icon { color: var(--accent); }
.st-text { color: var(--ink2); font: 400 15px/1.5 var(--serif); }
.st-facts { font-size: 12.5px; font-weight: 600; color: var(--sage-ink); background: var(--sage); padding: 5px 10px; border-radius: var(--round); width: fit-content; margin-top: 4px; }
.st-go { display: inline-flex; align-items: center; gap: 6px; margin-top: auto; font-weight: 650; color: var(--accent); }
.st-help { background: var(--sage); border-color: transparent; }
.st-help .st-help-icon { background: var(--surface); }
.st-empty { background: transparent; border-style: dashed; box-shadow: none; }
.st-help-icon { display: grid; place-items: center; width: 58px; height: 58px; border-radius: var(--radius); background: var(--sage); color: var(--sage-ink); margin-bottom: 6px; }
.st-plain { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-s); }
.st-preview { position: relative; display: block; height: 190px; margin: -4px -4px 8px; border-radius: var(--radius); background: var(--tint); overflow: hidden; }
.st-page { position: absolute; height: 158px; width: auto; aspect-ratio: auto; top: 16px; border-radius: 3px; box-shadow: 0 10px 24px -8px rgba(60, 50, 20, 0.3); background: var(--surface); transition: transform 0.6s var(--ease); }
.st-page-back { left: calc(50% - 98px); transform: rotate(-5deg); }
.st-page-front { left: calc(50% - 8px); transform: rotate(4deg); }
.st-card:hover .st-page-back { transform: rotate(-8deg) translateX(-8px); }
.st-card:hover .st-page-front { transform: rotate(7deg) translateX(8px) translateY(-4px); }
.st-wizard { max-width: 760px; margin: 30px auto; display: grid; justify-items: start; gap: 14px; }
.st-steps { display: flex; gap: 6px; }
.st-steps span { width: 40px; height: 6px; border-radius: 4px; background: var(--line2); transition: background 0.4s; }
.st-steps span.is-on { background: var(--grad); }
.st-count { margin: 0; font-size: 13px; font-weight: 650; color: var(--accent); }
.st-q { font-size: clamp(30px, 4vw, 44px); margin: 0 0 6px; animation: rise 0.5s var(--ease); }
.st-options { width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 8px; }
.st-option { display: grid; align-content: start; gap: 6px; padding: 20px; border-radius: var(--radius-l); border: 1.5px solid var(--line); background: var(--surface); text-align: left; font: inherit; color: var(--ink); cursor: pointer; box-shadow: var(--shadow-s); transition: transform 0.4s var(--ease), border-color 0.25s, box-shadow 0.4s; animation: rise 0.5s var(--ease) backwards; }
.st-option:nth-child(2) { animation-delay: 0.06s; }
.st-option:nth-child(3) { animation-delay: 0.12s; }
.st-option:hover, .st-option.is-on { transform: translateY(-4px); border-color: var(--accent); box-shadow: 0 0 0 4px var(--sage), var(--shadow); }
.st-option-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: var(--radius); background: var(--grad-soft); color: var(--sage-ink); margin-bottom: 6px; }
.flip { transform: rotate(180deg); }
.ed-dialog .st { padding: 0; }
.ed-dialog .st-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
@media (max-width: 860px) {
  .st-head { margin: 14px 0 22px; }
  .st-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Page designer. */
.ds-bar { position: sticky; top: 78px; z-index: 30; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px; border-radius: var(--radius-l); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-s); }
.ds-name { flex: 1 1 200px; }
.ds-bar-tools { display: flex; align-items: center; gap: 6px; }
.ds-side { width: 180px; }
.ds-main { display: grid; grid-template-columns: 220px minmax(0, 1fr) 320px; gap: 18px; margin-top: 16px; align-items: start; }
.ds-library, .ds-inspector { position: sticky; top: 154px; max-height: calc(100vh - 170px); overflow-y: auto; display: grid; gap: 12px; padding: 2px; scrollbar-width: thin; }
.ds-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ds-tile { display: grid; justify-items: center; gap: 6px; padding: 14px 6px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-s); color: var(--ink); font: 600 13px var(--sans); cursor: grab; touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; transition: transform 0.3s var(--ease), border-color 0.2s; }
.ds-tile .icon { width: 22px; height: 22px; color: var(--accent); }
.ds-tile:hover { transform: translateY(-2px); border-color: var(--sage-2); }
.ds-keys { font-size: 12px; }
.ds-stage { position: sticky; top: 154px; display: grid; place-items: start center; padding: 10px 0 40px; }
.ds-page { position: relative; height: calc(100vh - 200px); max-height: 980px; min-height: 420px; aspect-ratio: var(--ratio); max-width: 100%; background: var(--surface); box-shadow: 0 26px 60px -24px rgba(60, 50, 20, 0.35); border-radius: 4px; }
.ds-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ds-margin { position: absolute; outline: 1px dashed rgba(70, 80, 46, 0.35); pointer-events: none; }
.ds-spine { position: absolute; top: 50%; font-size: 10px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); opacity: 0.6; pointer-events: none; writing-mode: vertical-rl; transform: translateY(-50%); }
.ds-spine.is-left { left: 4px; }
.ds-spine.is-right { right: 4px; }
.ds-content { position: absolute; touch-action: none; }
.ds-block { position: absolute; min-height: 6px; border-radius: 3px; outline: 1px dashed transparent; cursor: move; touch-action: none; transition: outline-color 0.15s, background 0.15s; }
.ds-block:hover { outline-color: rgba(70, 80, 46, 0.55); background: rgba(238, 240, 224, 0.18); }
.ds-block.is-sel { outline: 2px solid var(--accent); background: rgba(238, 240, 224, 0.22); }
.ds-block.is-rule { height: 10px !important; transform: translateY(-5px); }
.ds-block:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ds-handle { position: absolute; width: 11px; height: 11px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); box-shadow: var(--shadow-s); touch-action: none; }
.ds-h-nw { left: -6px; top: -6px; cursor: nwse-resize; } .ds-h-n { left: calc(50% - 6px); top: -6px; cursor: ns-resize; } .ds-h-ne { right: -6px; top: -6px; cursor: nesw-resize; }
.ds-h-e { right: -6px; top: calc(50% - 6px); cursor: ew-resize; } .ds-h-se { right: -6px; bottom: -6px; cursor: nwse-resize; } .ds-h-s { left: calc(50% - 6px); bottom: -6px; cursor: ns-resize; }
.ds-h-sw { left: -6px; bottom: -6px; cursor: nesw-resize; } .ds-h-w { left: -6px; top: calc(50% - 6px); cursor: ew-resize; }
.ds-guide { position: absolute; pointer-events: none; background: #e0607e; }
.ds-guide-x { top: -20px; bottom: -20px; width: 1px; }
.ds-guide-y { left: -20px; right: -20px; height: 1px; }
.ds-box { position: absolute; border: 1.5px solid var(--accent); background: rgba(70, 80, 46, 0.08); border-radius: 3px; pointer-events: none; }
.ds-num { display: grid; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--ink2); }
.ds-num input { width: 5.8em; }
.ds-grid4 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ds-choice { display: grid; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink2); }
.ds-choice .ed-seg-item { min-height: 36px; font-size: 13px; }
.ds-choice select { font: 500 14px var(--sans); padding: 8px 10px; border-radius: var(--radius-s); border: 1.5px solid var(--line2); background: var(--bg); }
.ds-actions, .ds-align { display: flex; flex-wrap: wrap; gap: 6px; }
.ds-actions .ed-tool, .ds-align .ed-tool { height: 36px; padding: 0 10px; font-size: 13px; }
.ed-tool.is-danger, .btn.is-danger { color: #b3261e; }
.ds-sub { font-size: 12.5px; font-weight: 650; color: var(--ink2); }
.ds-columns { display: grid; gap: 8px; }
.ds-col-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; align-items: center; }
.ds-col-row input[type=text] { min-width: 0; font: 500 14px var(--sans); padding: 7px 10px; border-radius: var(--radius-s); border: 1.5px solid var(--line2); background: var(--bg); }
.ds-col-row .ed-unit input { width: 3.6em; }
.ds-template .btn { justify-self: start; }
.ed-tile-new { border-top: 1px solid var(--line); border-radius: 0 0 12px 12px; padding-top: 12px; }
@media (max-width: 1100px) {
  .ds-main { grid-template-columns: minmax(0, 1fr); }
  .ds-library, .ds-inspector, .ds-stage { position: static; max-height: none; }
  .ds-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ds-page { height: auto; width: min(100%, 560px); min-height: 0; }
  .ds-bar { top: 8px; border-radius: var(--radius-l); }
}
@media (max-width: 560px) {
  .ds-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ds-bar .ed-tool span { display: none; }
}
body.is-designing .footer { display: none; }
@media (min-width: 1101px) {
  body.is-designing { overflow: hidden; }
  body.is-designing .ds-page { height: calc(100vh - 215px); }
}
.ed-dates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: end; }
.ed-field input[type=date], .ed-field select { font: 500 15px var(--sans); color: var(--ink); background: var(--bg); border: 1.5px solid var(--line2); border-radius: var(--radius); padding: 8px 10px; min-height: 42px; width: 100%; min-width: 0; }
.ds-tokens { display: flex; flex-wrap: wrap; gap: 4px; margin-top: -4px; }
.ds-token { border: 1px dashed var(--sage-2); background: var(--sage); color: var(--sage-ink); border-radius: 5px; padding: 3px 8px; font: 600 12px var(--sans); cursor: pointer; }
.ds-token:hover { background: var(--surface); }
.ds-ornament-list { max-height: 340px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding-right: 4px; }
.ds-ornaments { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.ds-ornament { position: relative; display: grid; justify-items: center; gap: 2px; padding: 8px 2px 6px; border-radius: var(--radius); border: 1.5px solid transparent; background: var(--bg); font-size: 10.5px; font-weight: 550; color: var(--ink2); cursor: pointer; text-align: center; }
.ds-ornament input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.ds-ornament svg { width: 34px; height: 34px; color: var(--sage-ink); }
.ds-ornament.is-on { border-color: var(--accent); background: var(--surface); }
.ds-tiles { grid-auto-rows: 1fr; }
.pl-list { display: grid; gap: 6px; padding: 6px; border-radius: var(--radius); background: var(--bg); }
.pl-item { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: center; padding: 10px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); text-align: left; font: inherit; color: var(--ink); cursor: pointer; }
.pl-item:hover { border-color: var(--accent); }
.pl-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-s); background: var(--leaf); color: var(--leaf-ink); }
.ds-verse { display: grid; gap: 10px; }
.ds-verse .btn { justify-self: start; }
.st-reading { background: var(--leaf); }
.st-reading .st-help-icon { background: var(--surface); color: var(--leaf-ink); }
.sh-row { display: flex; gap: 8px; }
.sh-link { flex: 1; min-width: 0; font: 500 14px var(--sans); color: var(--ink); background: var(--bg); border: 1.5px solid var(--line2); border-radius: var(--radius); padding: 10px 12px; }
.ed-save.is-offline { color: var(--clay-ink); }

@media (max-width: 1100px) {
  .ds-stage { order: -1; }
  .ds-library { gap: 8px; }
  .ds-library > .ed-hint { display: none; }
  .ds-tiles { display: flex; overflow-x: auto; gap: 8px; padding: 2px 2px 8px; scroll-snap-type: x proximity; scrollbar-width: thin; }
  .ds-tile { flex: 0 0 86px; scroll-snap-align: start; padding: 12px 4px; }
}
@media (max-width: 560px) {
  .ds-bar { gap: 8px; border-radius: var(--radius-l); }
  .ds-name { flex-basis: calc(100% - 60px); }
  .ds-bar-tools { width: 100%; flex-wrap: wrap; justify-content: space-between; }
  .ds-side { width: auto; flex: 1; }
  .ds-bar-tools .btn { padding: 0 14px; }
}
.st-help .st-go { color: var(--sage-ink); }
.st-reading .st-go { color: var(--leaf-ink); }

/* Decorations of a part. */
.ed-decor-badge { display: inline-grid; place-items: center; margin-left: 6px; vertical-align: -2px; color: var(--accent); }
.ed-decor-badge .icon { width: 14px; height: 14px; }
.dc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.dc-list li { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 8px 8px 10px; border-radius: var(--radius); background: var(--bg); border: 1px solid var(--line); font-size: 14px; }
.dc-list .icon, .dc-icon { width: 26px; height: 26px; color: var(--sage-ink); }
.dc-add { display: grid; gap: 14px; padding-top: 4px; border-top: 1px solid var(--line); }
.dc-add .ed-seg { margin-top: 12px; }
.dc-passage { margin: 0; font: 400 14px/1.5 var(--serif); color: var(--ink2); }
.ed-patterns-part { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ed-pattern-same { display: grid; place-items: center; width: 34px; height: 42px; border-radius: 5px; border: 1px dashed var(--line2); background: var(--surface); color: var(--muted); }
.dc-mini { margin: 0; padding-left: 1.1em; display: grid; gap: 4px; font-size: 13.5px; color: var(--ink2); }
.ed-group-head.is-selected .ed-card-name { color: var(--accent); }
@media (min-width: 1281px) { .ed-col-structure { min-height: calc(100vh - 170px); } }

/* Books of a chapter tracker, in the part's style section. */
.ed-book-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ed-books { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 10px; max-height: 280px; overflow: auto; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius); }
.ed-book { display: flex; align-items: center; gap: 7px; font-size: 13.5px; min-height: 28px; cursor: pointer; min-width: 0; }
.ed-book span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-book input { accent-color: var(--accent); margin: 0; flex: none; }

/* Visitors without a subscription: what is open and what is not. */
.ed-access { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 10px 0 0; padding: 10px 14px; border-radius: var(--radius); background: var(--tint); color: var(--ink2); font-size: 14px; border: 1px solid var(--line2); }
.ed-access > .icon { color: var(--accent); flex: none; }
.ed-access > span:first-of-type { flex: 1 1 260px; }
.ed-access-links { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.ed-access a { color: var(--accent); font-weight: 650; }
.ed-locked { display: grid; gap: 10px; padding: 16px; border-radius: var(--radius); background: var(--butter); }
.ed-locked h3 { display: flex; align-items: center; gap: 8px; margin: 0; font: 700 16px var(--sans); letter-spacing: 0; color: var(--gold-ink); }
.ed-locked p { margin: 0; font-size: 14.5px; color: var(--ink2); }
.ed-locked .btn { text-decoration: none; justify-content: center; }
.ed-mark { font-family: var(--sans); font-weight: 800; fill: #353e21; opacity: 0.09; pointer-events: none; user-select: none; }

/* The browser's own print gives the screen, not the sheets: the print
   file comes from the Printen button. */
@media print {
  body > * { display: none !important; }
  body::before { content: "Printen gaat met de knop Printen in de editor. Daar haal je het printbestand op, op A4 en in de goede volgorde."; display: block; padding: 30mm 20mm; font: 14pt/1.5 sans-serif; color: #000; }
}

/* The picture of the print guide stays in sight while the reader goes down
   the steps. */
@media (min-height: 620px) {
  .ed-dialog .pg-stage { position: sticky; top: 12px; z-index: 3; box-shadow: 0 -13px 0 0 var(--surface); }
}
.ed-made { display: grid; gap: 10px; padding: 16px; border-radius: var(--radius); background: var(--wheat); }
.ed-made h3 { display: flex; align-items: center; gap: 8px; margin: 0; font: 700 16px var(--sans); letter-spacing: 0; color: var(--wheat-ink); }
.ed-made p { margin: 0; font-size: 14.5px; color: var(--ink2); }
.ed-made .btn-ghost { background: var(--surface); }
.ed-access .ed-link { font-size: inherit; }
@media (max-width: 560px) {
  .ed-toast { width: calc(100vw - 24px); }
}
