/* Canonical paper geometry: header + footer + the selected number of rows. */
.book-spread,.book-spread .book-half,.book-spread .turn-sheet,.turn-preparation,.paper-strip,.strip-content { height:var(--book-height,640px); }
.book-spread .paper-table { height:calc(var(--book-height,640px) - 60px); }
.book-zoom { position:relative; flex:none; transform-origin:center; }
.book-scroll { display:grid; justify-items:center; }
.book-spread .paper-table tbody tr.edited td { background:#edcf7e66; }
[data-theme="dark"] .book-spread .paper-table tbody tr.edited td { background:#e5c17177; }
.book-spread .paper-table tbody tr.edited.is-highlight td { background:#eac77388; }
.book-spread .paper-table .blank-row td { cursor:pointer; background:repeating-linear-gradient(135deg,transparent,transparent 12px,#76806c08 12px,#76806c08 13px); }
.blank-row span { font:12px "Segoe UI",Arial,sans-serif; color:var(--muted); }
.book-spread .paper-table .provisional-totals .cell-content { text-decoration:underline dotted; text-underline-offset:5px; }
.book-spread .paper-table .provisional-totals .sum-label { color:#8a661c; }
[data-theme="dark"] .book-spread .paper-table .provisional-totals .sum-label { color:#795618; }
.provisional-note { display:block; width:100%; text-align:left; color:var(--ink); background:var(--green-soft); border:1px dashed var(--line); border-radius:8px; padding:12px 15px; margin:12px 0; font-size:11px; line-height:1.7; cursor:pointer; }
.provisional-button { display:flex; align-items:center; gap:6px; width:100%; height:100%; background:transparent; color:inherit; border:0; padding:0; font:inherit; text-align:left; cursor:pointer; }
.provisional-button span { font:15px "Segoe UI",Arial,sans-serif; }
.provisional-button:focus-visible { outline:2px solid var(--green); outline-offset:1px; }
.book-place-actions { display:flex; flex-direction:column; align-items:flex-start; gap:6px; }
.vf-export-guide { margin:0 0 16px; border:1px solid var(--line); border-radius:9px; background:var(--green-soft); color:var(--ink); }
.vf-export-guide summary { display:flex; align-items:center; gap:8px; cursor:pointer; padding:11px 13px; font-size:12px; font-weight:600; list-style:none; }
.vf-export-guide summary::-webkit-details-marker { display:none; }
.vf-export-guide summary::after { content:'+'; margin-left:auto; font-size:16px; font-weight:400; color:var(--muted); }
.vf-export-guide[open] summary::after { content:'−'; }
.vf-export-guide summary svg { width:16px; height:16px; flex:none; stroke:currentColor; fill:none; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.vf-export-guide ol { margin:0; padding:0 18px 0 34px; font-size:11px; line-height:1.65; }
.vf-export-guide li { padding:3px 0; }
.vf-export-guide p { margin:9px 13px 13px 34px; color:var(--muted); font-size:10px; line-height:1.6; }
[data-theme="dark"] .vf-export-guide { background:#293e32; border-color:#526854; }
[data-theme="dark"] .vf-export-guide p { color:#b4c0b4; }
.book-place-actions:empty { display:none; }
.book-place-actions .text-button { padding:0; font-size:11px; }
.book-place-actions small,.book-place-hint { font-size:10px; line-height:1.7; color:var(--muted); font-weight:400; }
.book-place-custom input { border-style:dashed; }
.place-cell { position:relative; }
.place-tip { position:absolute; top:1px; right:0; width:13px; height:13px; border:1px solid #8a9a7a; border-radius:50%; padding:0; background:var(--paper); color:#547246; font:10px Georgia,serif; cursor:pointer; z-index:1; }
[data-theme="dark"] .place-tip { color:#c1d7ad; border-color:#a0b58c; }
.field-edited>input,.field-edited>select,.field-edited>textarea { background:#f5e8bd !important; border-color:#bb9444 !important; }
[data-theme="dark"] .field-edited>input,[data-theme="dark"] .field-edited>select,[data-theme="dark"] .field-edited>textarea { background:#443922 !important; border-color:#b69a59 !important; }
.source-field-hint { display:flex; gap:8px; flex-wrap:wrap; align-items:center; font-size:10px; font-weight:400; line-height:1.6; color:var(--muted); overflow-wrap:anywhere; }
.source-field-hint button { font-size:10px; padding:0; }
.restore-flight { margin:0 0 18px; text-align:left; white-space:normal; }
.restore-confirm { display:flex; gap:10px; align-items:flex-start; line-height:1.7; font-size:12px; margin:20px 0 5px; }
.restore-confirm input { flex:none; margin-top:4px; }
.flight-pagination { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; padding:18px; border-top:1px solid var(--line); font-size:11px; }
.flight-pagination>div { display:flex; gap:10px; align-items:center; }
.flight-pagination label { display:flex; gap:8px; align-items:center; }
.flight-pagination select { width:auto; font-size:12px; padding:6px 8px; }
dialog[open] { display:flex; flex-direction:column; max-height:calc(100dvh - 32px); }
.dialog-header,.dialog-footer { flex:none; position:static; }
.dialog-header>div { min-width:0; }
.dialog-header h2 { overflow-wrap:anywhere; }
.dialog-content { min-height:0; overflow-y:auto; overscroll-behavior:contain; }
.dialog-footer { flex-wrap:wrap; }
.dialog-footer .button { white-space:normal; text-align:center; }
dialog .field { min-width:0; }
dialog .field input,dialog .field select,dialog .field textarea { min-width:0; max-width:100%; width:100%; box-sizing:border-box; }
dialog .toggle-line>label.field { display:flex; flex-direction:column; align-items:stretch; }
dialog .toggle-line>label.field input { width:100%; }
dialog .toggle-line>label.field small { margin:0; }
.gap-policy-options label { align-items:flex-start; }
.gap-policy-options input { flex:none; margin-top:3px; }
.gap-policy-options span { min-width:0; }
.info-popover [role="tooltip"] { max-width:calc(100vw - 56px); }

/* The fullscreen book occupies the available viewport, without document scroll. */
body.focus-mode { height:100dvh; overflow:hidden; overscroll-behavior:none; }
.focus-mode .app-shell { min-height:0; height:100dvh; }
.focus-mode .main { position:fixed; inset:0; height:100dvh; width:100%; max-width:none; margin:0; padding:max(6px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) max(6px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left)); overflow:hidden; }
.focus-mode .main>section { height:100%; display:grid; grid-template-rows:auto minmax(0,1fr) auto auto; gap:4px; }
.focus-mode .guest-banner,.focus-mode .provisional-note,.focus-mode .book-notes,.focus-mode .landscape-hint,.focus-mode .print-only { display:none; }
.focus-mode .section-heading { grid-row:1; margin:0; min-height:32px; }
.focus-mode .section-title { display:none; }
.focus-mode .book-controls { width:100%; justify-content:flex-end; gap:8px; }
.focus-mode .add-blank,.focus-mode [data-action="print"] { display:none; }
.focus-mode .book-scroll { grid-row:2; width:100%; height:100%; min-height:0; margin:0; padding:0; overflow:hidden; grid-template-columns:minmax(0,1fr); grid-template-rows:minmax(0,1fr); align-items:center; touch-action:none; overscroll-behavior:none; }
.focus-mode .book-zoom { will-change:auto; }
.focus-mode .half-controls { grid-row:3; margin:0; }
.focus-mode .book-navigation { grid-row:4; margin:0; min-height:27px; }
.focus-mode .half-caption { margin:1px 0; }
.focus-mode #book-jump { max-width:100px; font-size:10px; padding:2px; }

@media(max-width:650px) {
  dialog[open] { width:calc(100vw - 16px); max-width:none; max-height:calc(100dvh - 16px); padding:0; }
  .dialog-header { padding:17px 16px; align-items:flex-start; gap:10px; }
  .dialog-header h2 { font-size:24px; }
  .dialog-header p { line-height:1.6; }
  .dialog-content { padding:16px; }
  .dialog-footer { padding:12px 16px max(12px,env(safe-area-inset-bottom)); gap:8px; }
  .dialog-footer .button { flex:1 1 auto; justify-content:center; }
  dialog .form-grid,dialog .time-grid,dialog .place-row,dialog .model-row { grid-template-columns:minmax(0,1fr); }
  dialog .form-grid>.wide { grid-column:auto; }
  dialog .model-row { gap:9px; }
  dialog .model-row input { width:100%; }
  dialog .place-row { gap:12px; padding:18px 0; }
  dialog .field,dialog .field input,dialog .field select,dialog .field textarea { font-size:14px; }
  dialog .field input,dialog .field select,dialog .field textarea { font-size:16px; }
  dialog .account-actions { flex-direction:column; align-items:stretch; }
  dialog .account-actions .button { justify-content:center; }
  .info-popover [role="tooltip"] { right:0; left:auto; width:250px; }
  .section-heading .book-controls { flex-wrap:wrap; justify-content:flex-end; }
  .section-heading .book-controls .button { font-size:10px; }
  .flight-pagination { padding:12px; }
  .flight-pagination>div { gap:6px; width:100%; justify-content:space-between; }
  .flight-pagination label { gap:4px; }
  .flight-pagination select { font-size:12px; }
  .focus-mode .book-controls .button { padding:6px 9px; }
  .focus-mode .book-controls .icon-button { width:30px; height:30px; }
  .focus-mode .page-center { min-width:0; }
  .focus-mode .half-controls button { padding:5px; font-size:10px; }
  .focus-mode .half-controls small { display:none; }
}
@media(prefers-reduced-motion:reduce) { .book-spread { transition:none !important; } }
@media print { .provisional-note { display:block; font-size:9px; } .place-tip { display:none; } .blank-row span { visibility:hidden; } }

/* Sort controls are native buttons, usable by touch and keyboard. */
.column-sort { display:inline-flex; gap:7px; align-items:center; border:0; padding:10px 0; background:transparent; color:inherit; font:inherit; font-weight:600; white-space:nowrap; }
.column-sort span { opacity:.55; }
[aria-sort="ascending"] .column-sort span,[aria-sort="descending"] .column-sort span { opacity:1; color:var(--green); }
.manual-warning { margin-bottom:18px; }
.reset-confirm { display:flex; gap:10px; align-items:flex-start; margin:24px 0; font-size:12px; line-height:1.7; }
.reset-confirm input { margin-top:4px; flex:none; }
.book-capacity { margin-top:18px; max-width:420px; }
.book-status[hidden] { display:none; }
.cover-open-hint { color:var(--muted); font-size:11px; text-align:center; margin-top:20px; }
.book-spread .cover-endpaper { background:linear-gradient(90deg,#ded6c21a,transparent 80%,#8073571c); }
.cover-inside { height:100%; display:flex; flex-direction:column; justify-content:center; align-items:center; text-align:center; padding:25px; color:#575443; }
.cover-kicker { font:12px "Segoe UI",sans-serif; letter-spacing:3px; text-transform:uppercase; }
.cover-inside h2 { font:48px/1.2 Georgia,serif; color:#354e43; margin:30px 0; }
.cover-owner { display:grid; gap:10px; }
.cover-owner small,.cover-inside>small,.cover-inside p,.cover-carry small { font:15px/1.6 "Segoe UI",sans-serif; color:#66614f; }
.cover-owner strong { font:28px "Segoe Print",cursive; color:#244768; }
.cover-carry { display:grid; gap:8px; margin-top:35px; padding-top:20px; border-top:1px solid #bdb39c; }
.cover-carry strong { font:19px "Segoe Print",cursive; color:#244768; }
.book-spread .cover-front { padding:30px; background:radial-gradient(ellipse at 75% 15%,#426a55,transparent 80%),repeating-linear-gradient(25deg,#ffffff03 0,#ffffff03 1px,transparent 1px,transparent 4px),#25483b; box-shadow:inset 6px 0 10px #122b25aa,inset -3px -3px 5px #10251c88; color:#e8d7aa; }
.cover-border { height:100%; border:2px solid #b6a3788a; outline:1px solid #b6a37850; outline-offset:-9px; display:flex; flex-direction:column; justify-content:center; align-items:center; padding:25px; text-align:center; border-radius:2px; }
.cover-border img { width:120px; height:120px; object-fit:contain; filter:brightness(0) invert(.85) sepia(.4); }
.cover-brand { font:66px Georgia,serif; letter-spacing:2px; margin-top:6px; }
.cover-title { font:18px "Segoe UI",sans-serif; letter-spacing:8px; margin-top:22px; }
.cover-rule { width:90px; height:1px; background:#bda36c; margin:28px 0; }
.cover-name { font:25px "Segoe Print",cursive; line-height:1.5; }
.cover-border>small { font:16px "Segoe UI",sans-serif; letter-spacing:2px; margin-top:24px; }
.book-spread .hardcover-turn .paper-strip { box-shadow:0 5px 20px #142b2566; border:2px solid #25483b; }
[data-theme="dark"] .book-spread .paper-table .new-row td { background:#71936c13; }
[data-theme="dark"] .book-spread .paper-table tbody tr.is-highlight td,[data-theme="dark"] .book-spread .paper-table tbody tr:hover td { background:#66886922; }
[data-theme="dark"] .book-spread .paper-table .jump-target td { background:#e6bb6288; box-shadow:inset 0 1px #a68642,inset 0 -1px #a68642; }
[data-theme="dark"] .place-tip { color:#435a35; border-color:#697f55; }
.focus-mode .add-row { display:none; }
@media(max-width:650px) { .section-heading .book-controls { max-width:100%; } .manual-warning { font-size:11px; } .reset-confirm { font-size:11px; } }

.provisional-button { display:inline-flex; align-items:center; gap:10px; }
.provisional-button svg { width:19px; height:19px; flex:none; fill:none; stroke:currentColor; stroke-width:1.65; stroke-linecap:round; stroke-linejoin:round; }
.book-spread .blank-row span { color:#68634f; }
[data-theme="dark"] .book-spread .cover-front,[data-theme="dark"] .strip-content .cover-front { background:radial-gradient(ellipse at 75% 15%,#426a55,transparent 80%),repeating-linear-gradient(25deg,#ffffff03 0,#ffffff03 1px,transparent 1px,transparent 4px),#25483b; }

/* Cover artwork fits the same physical height as the configured paper pages. */
.book-stage { transition:none; --cover-scale:1; }
.cover-inside-content,.cover-face { display:flex; flex-direction:column; justify-content:center; align-items:center; width:100%; flex:none; transform:scale(var(--cover-scale)); }
.cover-inside-content>small,.cover-inside-content p { font:15px/1.6 "Segoe UI",sans-serif; color:#66614f; }
.book-spread .cover-front { padding:calc(30px * var(--cover-scale)); }
.cover-border,.cover-inside { padding:calc(25px * var(--cover-scale)); }
.cover-face>small { font:16px "Segoe UI",sans-serif; letter-spacing:2px; margin-top:24px; }
