/* =========================================================
   Lemba — visual identity
   Emerald on clean white. Tokens first, then components.
   ========================================================= */
:root {
  --brand: #0f6b4f;
  --brand-600: #138a63;
  --brand-50: #eefaf4;
  --brand-100: #d5f0e4;
  --accent: #f59e0b;
  --brand-ink: #0f6b4f;   /* brand colour used for text/icons */

  --bg: #f5f7fb;           /* app background (warm) */
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --canvas: #e8edf4;       /* behind the page */
  --paper: #ffffff;
  --ink: #1f2937;
  --ink-soft: #4b5563;
  --muted: #8a8f98;
  --line: #dde3ec;
  --hover: #ecf7f1;
  --on: #d3eee2;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 6px 24px rgba(15,23,42,.08);
  --radius: 8px;
  --ui-font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
:root[data-lemba-theme="dark"] {
  --bg: #15181c; --surface: #1d2126; --surface-2: #23282e; --canvas: #101215;
  --ink: #e5e7eb; --ink-soft: #b6bcc5; --muted: #8b939e; --line: #2f353d;
  --hover: #1a2e28; --on: #21473a; --brand-50: #12302a; --brand-100: #1a4538;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 24px rgba(0,0,0,.35);
  --brand-ink: #7fd6b0; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--ui-font); font-size: 14px; color: var(--ink); background: var(--bg); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
a { color: var(--brand-600); }

.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; letter-spacing: -.01em; color: var(--ink); text-decoration: none; }
.brand img { width: 28px; height: 28px; }
.brand-lg { font-size: 30px; justify-content: center; }
.brand-lg img { width: 48px; height: 48px; }

.btn { border: 1px solid transparent; border-radius: var(--radius); padding: 9px 16px; font-weight: 600; background: var(--surface-2); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-ghost:hover { background: var(--hover); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #1f2937; display: inline-grid; place-items: center; font-weight: 700; flex: none; }

/* ---------------- Auth ---------------- */
.auth-page { display: grid; place-items: center; min-height: 100%; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 10% -10%, var(--brand-100), transparent), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 32px 28px; }
.auth-tag { text-align: center; color: var(--ink-soft); margin: 8px 0 24px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: var(--radius); padding: 4px; margin-bottom: 20px; }
.auth-tabs button { border: 0; background: none; padding: 8px; border-radius: 6px; font-weight: 600; color: var(--ink-soft); }
.auth-tabs button.active { background: var(--surface); color: var(--brand-ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.auth-form { display: grid; gap: 14px; }
.auth-form label { display: grid; gap: 6px; font-weight: 500; font-size: 13px; }
.auth-form input { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.auth-form input:focus { outline: 2px solid var(--brand-600); outline-offset: -1px; }
.form-error { color: #dc2626; min-height: 1.2em; margin: 12px 0 0; font-size: 13px; }

/* ---------------- Dashboard ---------------- */
.topbar { display: flex; align-items: center; gap: 16px; padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.search { flex: 1; max-width: 560px; margin: 0 auto; padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); }
.user-menu { display: flex; align-items: center; gap: 10px; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 24px; }
.new-strip { background: var(--surface-2); border-bottom: 1px solid var(--line); padding: 20px 0 28px; }
.new-strip h2, .list-head h2 { font-size: 15px; font-weight: 600; margin: 0 0 14px; }
.templates { display: flex; gap: 18px; flex-wrap: wrap; }
.tpl { border: 0; background: none; padding: 0; display: grid; gap: 8px; text-align: left; font-size: 13px; font-weight: 500; }
.tpl-page { width: 132px; height: 170px; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,.06); transition: .15s; padding: 18px 14px; display: flex; flex-direction: column; gap: 7px; }
.tpl:hover .tpl-page { border-color: var(--brand-600); box-shadow: 0 0 0 3px var(--brand-100); }
.tpl-page i { display: block; height: 5px; background: #e5e7eb; border-radius: 3px; }
.tpl-page i:nth-child(2n) { width: 70%; }
.tpl-page b { display: block; height: 9px; width: 60%; background: #7fd6b0; border-radius: 3px; }
.tpl-up { align-items: center; justify-content: center; font-size: 36px; color: var(--brand); background: var(--brand-50); }
.tpl-import { cursor: pointer; }
.list-head { display: flex; justify-content: space-between; align-items: baseline; margin-top: 28px; }
.doc-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin-bottom: 40px; }
.doc-table th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); }
.doc-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.doc-table tr:last-child td { border-bottom: 0; }
.doc-table tbody tr:hover { background: var(--hover); }
.doc-link { color: var(--ink); text-decoration: none; font-weight: 500; display: flex; align-items: center; gap: 10px; }
.doc-ico { color: var(--brand); font-size: 18px; }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions button { border: 0; background: none; padding: 4px 8px; border-radius: 6px; opacity: .55; }
.row-actions button:hover { opacity: 1; background: var(--on); }
.empty { text-align: center; color: var(--muted); padding: 32px !important; }
@media (max-width: 640px) {
  .topbar { padding: 10px 16px; flex-wrap: wrap; } .search { order: 3; max-width: none; flex-basis: 100%; }
  .wrap { padding: 0 16px; } .tpl-page { width: 96px; height: 124px; }
  .doc-table th:nth-child(2), .doc-table td:nth-child(2) { display: none; }
}

/* ---------------- Editor shell ---------------- */
.editor-page { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.titlebar { display: flex; align-items: center; gap: 12px; padding: 6px 14px; background: var(--brand); color: #fff; flex: none; }
.titlebar .brand { color: #fff; font-size: 16px; }
.titlebar .brand img { width: 24px; height: 24px; filter: drop-shadow(0 0 0 #fff); }
.titlebar .icon-btn { color: #fff; }
.titlebar .icon-btn:hover { background: rgba(255,255,255,.16); }
.qat { display: flex; gap: 2px; }
.doc-title { background: transparent; border: 1px solid transparent; color: #fff; font-weight: 600; padding: 4px 8px; border-radius: 6px; min-width: 120px; max-width: 360px; flex: 0 1 360px; }
.doc-title:hover, .doc-title:focus { border-color: rgba(255,255,255,.5); outline: none; background: rgba(255,255,255,.08); }
.save-state { font-size: 12px; opacity: .85; white-space: nowrap; }
.save-state[data-state="Not saved"] { color: #fde68a; opacity: 1; font-weight: 600; }
.titlebar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.ribbon-tabs { display: flex; gap: 2px; padding: 0 10px; background: var(--surface); flex: none; overflow-x: auto; scrollbar-width: none; }
.rtab { border: 0; background: none; padding: 9px 14px 8px; font-weight: 500; color: var(--ink-soft); border-bottom: 3px solid transparent; white-space: nowrap; }
.rtab:hover { color: var(--ink); background: var(--hover); }
.rtab.active { color: var(--brand-ink); border-bottom-color: var(--brand-ink); font-weight: 600; }
.rtab-file { color: var(--brand-ink); font-weight: 600; }
.rtab-context { color: #b45309; }
.rtab-context.active { color: #b45309; border-bottom-color: var(--accent); }

.ribbon { background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: 0 2px 6px rgba(0,0,0,.04); flex: none; position: relative; z-index: 3; }
.rpanel { display: none; padding: 6px 8px 0; gap: 0; overflow-x: auto; scrollbar-width: thin; }
.rpanel.active { display: flex; }
.group { display: flex; flex-direction: column; padding: 0 10px; border-right: 1px solid var(--line); flex: none; }
.group:last-child { border-right: 0; }
.group-body { display: flex; align-items: center; gap: 4px; min-height: 74px; }
.group-body.col { flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; }
.group-label { font-size: 11px; color: var(--muted); text-align: center; padding: 2px 0 5px; }
.row { display: flex; align-items: center; gap: 2px; }
.stack { display: flex; flex-direction: column; gap: 1px; }

.icon-btn, .sm-btn, .big-btn { border: 1px solid transparent; background: none; border-radius: 5px; color: var(--ink); }
.icon-btn { min-width: 28px; height: 28px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; line-height: 1; }
.icon-btn sup, .icon-btn sub { font-size: 9px; line-height: 0; }
#caseSel { width: 64px; }
#themeBtn { font-size: 18px; }
.sm-btn { padding: 3px 8px; text-align: left; font-size: 12.5px; white-space: nowrap; }
.big-btn { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 8px; font-size: 12px; min-width: 56px; white-space: nowrap; }
.big-btn .ico { font-size: 22px; line-height: 1; height: 26px; display: grid; place-items: center; color: var(--brand-ink); }
.icon-btn:hover, .sm-btn:hover, .big-btn:hover { background: var(--hover); border-color: var(--line); }
.icon-btn.on, .sm-btn.on, .big-btn.on { background: var(--on); border-color: var(--brand-600); }
.ribbon select { height: 28px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); padding: 0 6px; font-size: 13px; }
#fontName { width: 160px; } #fontSize { width: 58px; }
.lbl { display: flex; align-items: center; gap: 6px; font-size: 12.5px; white-space: nowrap; }

.color-btn { position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 28px; height: 28px; padding: 0 5px; border-radius: 5px; cursor: pointer; border: 1px solid transparent; }
.color-btn:hover { background: var(--hover); border-color: var(--line); }
.color-btn .swatch-ico { font-weight: 700; font-size: 13px; line-height: 1; }
.color-btn .bar { width: 18px; height: 4px; border-radius: 1px; margin-top: 2px; }
.color-btn input[type=color] { position: absolute; inset: auto 0 -4px auto; width: 12px; height: 12px; opacity: 0; cursor: pointer; }
.color-btn::after { content: '▾'; position: absolute; right: -1px; bottom: 0; font-size: 8px; color: var(--muted); pointer-events: none; }
.color-btn input[type=color] { inset: 0; width: 100%; height: 100%; }
.color-btn .bar { position: relative; z-index: 1; }

.styles { display: grid; grid-template-columns: repeat(4, 92px); grid-auto-rows: 34px; gap: 4px; }
.sty { border: 1px solid var(--line); background: var(--surface); border-radius: 5px; padding: 0 8px; text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--ink); }
.sty:hover { border-color: var(--brand-600); }
.sty.on { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: var(--brand-50); }
.sty-normal { font-size: 13px; }
.sty-h1 { font-size: 15px; color: var(--brand-ink); font-weight: 600; }
.sty-h2 { font-size: 14px; color: var(--brand-ink); opacity: .85; font-weight: 600; }
.sty-h3 { font-size: 13px; color: var(--ink); font-weight: 600; }
.sty-title { font-size: 16px; font-weight: 700; }
.sty-sub { color: var(--muted); }
.sty-quote { font-style: italic; color: var(--ink-soft); }
.sty-code { font-family: 'Roboto Mono', monospace; font-size: 12px; }
:root[data-lemba-theme="dark"] .sty-h1, :root[data-lemba-theme="dark"] .sty-h2, :root[data-lemba-theme="dark"] .sty-h3 { color: #7fd6b0; }

.table-picker-wrap, .symbol-wrap { position: relative; }
.table-picker, .symbol-picker { position: absolute; top: 100%; left: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; z-index: 20; }
.tp-grid { display: grid; grid-template-columns: repeat(10, 18px); gap: 3px; }
.tp-grid span { width: 18px; height: 18px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 2px; cursor: pointer; }
.tp-grid span.hl { background: var(--brand-100); border-color: var(--brand-600); }
.tp-label { font-size: 12px; text-align: center; margin-top: 6px; color: var(--ink-soft); }
.symbol-picker { display: grid; grid-template-columns: repeat(10, 30px); gap: 2px; }
.symbol-picker button { width: 30px; height: 30px; border: 1px solid transparent; background: none; border-radius: 4px; font-size: 16px; }
.symbol-picker button:hover { background: var(--hover); border-color: var(--line); }

/* ---------------- Workspace & page ---------------- */
.workspace { flex: 1; display: flex; min-height: 0; }
.nav-pane { width: 240px; flex: none; background: var(--surface); border-right: 1px solid var(--line); padding: 12px; overflow-y: auto; }
.nav-pane h4 { margin: 0 0 10px; font-size: 13px; }
.nav-list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 5px 8px; border-radius: 5px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-list button:hover { background: var(--hover); }
.nav-list .nav-h1 { font-weight: 600; } .nav-list .nav-h2 { padding-left: 20px; } .nav-list .nav-h3 { padding-left: 34px; color: var(--ink-soft); }
.canvas { flex: 1; overflow: auto; background: var(--canvas); padding: 0 24px 48px; position: relative; }
.ruler { position: sticky; top: 0; z-index: 2; height: 22px; display: flex; justify-content: center; background: var(--canvas); padding-top: 2px; margin: 0 -24px 16px; }
.ruler-inner { position: relative; height: 18px; background: var(--paper); border-bottom: 1px solid #d0d8e3; }
.ruler-inner span { position: absolute; bottom: 0; width: 1px; background: #8a8f98; }
.ruler-inner .r-in { height: 8px; } .ruler-inner .r-half { height: 6px; } .ruler-inner .r-eighth { height: 3px; }
.ruler-inner b { position: absolute; top: 0; transform: translateX(-50%); font-size: 9px; font-weight: 500; color: #6b7280; }
.ruler-inner .r-margin { position: absolute; top: 0; bottom: 0; background: #d9e0ea; }
.zoomer { width: max-content; margin: 0 auto; }

.page {
  --page-w: 8.5in; --page-h: 11in; --m-v: 1in; --m-h: 1in; --gap: 14px;
  position: relative; width: var(--page-w); min-height: var(--page-h);
  padding: var(--m-v) var(--m-h); color: #1f2937;
  background: repeating-linear-gradient(to bottom, var(--paper) 0, var(--paper) calc(var(--page-h) - var(--gap)), var(--canvas) calc(var(--page-h) - var(--gap)), var(--canvas) var(--page-h));
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.18));
}
.page.web { width: min(100%, 980px); min-height: 70vh; background: var(--paper); padding: 40px 56px; }
:root[data-lemba-theme="dark"] .page { --paper: #ffffff; }
.page-header, .page-footer { display: none; position: absolute; left: var(--m-h); right: var(--m-h); font-size: 9pt; color: #6b7280; min-height: 18px; outline: none; border: 1px dashed transparent; padding: 2px 4px; }
.page-header { top: calc(var(--m-v) / 2 - 10px); }
.page-footer { bottom: calc(var(--m-v) / 2 - 10px); }
.page.show-hf .page-header, .page.show-hf .page-footer { display: block; }
.page-header:hover, .page-footer:hover, .page-header:focus, .page-footer:focus { border-color: #7fd6b0; }
.page-header:empty::before, .page-footer:empty::before { content: attr(data-placeholder); color: #b6bcc5; }

/* Document body typography (mirrors export CSS) */
.doc-body { outline: none; font-family: Calibri, Carlito, 'Segoe UI', Arial, sans-serif; font-size: 11pt; line-height: 1.15; min-height: 3in; caret-color: var(--brand); word-wrap: break-word; }
.doc-body p { margin: 0 0 8pt; }
.doc-body h1 { font-size: 20pt; font-weight: 600; color: #0a4f3a; margin: 18pt 0 6pt; }
.doc-body h2 { font-size: 15pt; font-weight: 600; color: #0f6b4f; margin: 14pt 0 4pt; }
.doc-body h3 { font-size: 12.5pt; font-weight: 600; color: #0b3f30; margin: 12pt 0 4pt; }
.doc-body h1.doc-title { font-size: 28pt; font-weight: 700; color: #111827; border-bottom: 2px solid #22a77a; padding-bottom: 4pt; margin-top: 0; }
.doc-body .doc-subtitle { font-size: 14pt; color: #6b7280; }
.doc-body blockquote { margin: 8pt 24pt; padding-left: 12pt; border-left: 3px solid #22a77a; color: #4b5563; font-style: italic; }
.doc-body pre { font-family: 'Roboto Mono', 'Courier New', monospace; font-size: 10pt; background: #f3f4f6; padding: 8pt; border-radius: 4px; white-space: pre-wrap; }
.doc-body ul, .doc-body ol { margin: 0 0 8pt; padding-left: 28pt; }
.doc-body table { border-collapse: collapse; width: 100%; margin: 6pt 0; table-layout: fixed; }
.doc-body td, .doc-body th { border: 1px solid #9ca3af; padding: 4pt 6pt; vertical-align: top; min-width: 30px; }
.doc-body th { background: #d5f0e4; text-align: left; }
.doc-body .tbl-plain td, .doc-body .tbl-plain th { border: 1px dashed #e5e7eb; }
.doc-body .tbl-striped tr:nth-child(even) td { background: #eefaf4; }
.doc-body .tbl-header td { border-left: 0; border-right: 0; }
.doc-body img { max-width: 100%; height: auto; cursor: default; }
.doc-body img.selected { outline: 2px solid var(--brand-600); outline-offset: 1px; }
.doc-body hr { border: 0; border-top: 1px solid #d1d5db; margin: 12pt 0; }
.doc-body hr.page-break { border-top: 1px dashed #22a77a; margin: 18pt 0; position: relative; overflow: visible; }
.doc-body hr.page-break::after { content: 'Page break'; position: absolute; left: 50%; top: -8px; transform: translateX(-50%); background: #fff; color: #138a63; font: 600 10px var(--ui-font); padding: 0 8px; }
.doc-body a { color: #138a63; }
.doc-body .toc { border: 1px solid #e5e7eb; border-radius: 4px; padding: 8pt 12pt; margin: 8pt 0 16pt; background: #fafbfd; }
.doc-body .toc p { margin: 2pt 0; } .doc-body .toc-title { font-size: 14pt; font-weight: 700; color: #0a4f3a; }
.doc-body .toc-h2 { padding-left: 18pt; } .doc-body .toc-h3 { padding-left: 36pt; }
.doc-body.show-marks p::after, .doc-body.show-marks h1::after, .doc-body.show-marks h2::after, .doc-body.show-marks h3::after, .doc-body.show-marks li::after { content: '¶'; color: #7fd6b0; margin-left: 2px; }
::highlight(lemba-find) { background: #fde68a; }
::highlight(lemba-current) { background: #f59e0b; color: #000; }
body.painting .doc-body { cursor: copy; }
.img-handle { display: none; position: absolute; width: 14px; height: 14px; background: var(--brand); border: 2px solid #fff; border-radius: 3px; cursor: nwse-resize; z-index: 4; box-shadow: 0 1px 3px rgba(0,0,0,.3); }

/* ---------------- Status bar ---------------- */
.statusbar { display: flex; align-items: center; gap: 16px; padding: 3px 14px; background: var(--surface); border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-soft); flex: none; }
.statusbar .spacer { flex: 1; }
.statusbar input[type=range] { width: 120px; accent-color: var(--brand); }
#zoomLabel { width: 38px; text-align: right; }

/* ---------------- Backstage ---------------- */
.backstage { position: fixed; inset: 0; z-index: 50; display: flex; background: var(--surface); }
.bs-nav { width: 220px; background: var(--brand); color: #fff; display: flex; flex-direction: column; padding: 16px 0; }
.bs-nav button { border: 0; background: none; color: #fff; text-align: left; padding: 11px 24px; font-size: 14px; }
.bs-nav button:hover, .bs-nav button.active { background: rgba(255,255,255,.14); }
.bs-nav .bs-back { font-weight: 600; margin-bottom: 12px; }
.bs-main { flex: 1; padding: 40px 48px; overflow: auto; }
.bs-main h2 { margin: 0 0 4px; font-size: 26px; font-weight: 600; }
.export-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-top: 24px; max-width: 900px; }
.export-card { border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 18px; text-align: left; display: grid; gap: 4px; }
.export-card:hover { border-color: var(--brand-600); box-shadow: 0 0 0 3px var(--brand-100); }
.export-card .ext { font-weight: 700; font-size: 12px; color: #fff; background: var(--brand); border-radius: 4px; padding: 2px 6px; justify-self: start; margin-bottom: 8px; }
.export-card small { color: var(--muted); }

/* ---------------- Find bar, modal, toast ---------------- */
.find-bar { position: fixed; top: 150px; right: 24px; z-index: 30; display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 8px; flex-wrap: wrap; max-width: calc(100vw - 32px); }
.find-bar input:not([type]) { border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; width: 180px; background: var(--surface); }
dialog { border: 0; border-radius: 14px; box-shadow: var(--shadow); padding: 0; background: var(--surface); color: var(--ink); width: min(560px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(15,23,42,.4); }
.modal-body { padding: 22px 24px; }
.modal-body h3 { margin: 0 0 14px; font-size: 18px; }
.modal-field { display: grid; gap: 6px; font-size: 13px; }
.modal-field input { padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.info-table { width: 100%; border-collapse: collapse; } .info-table td { padding: 7px 0; border-bottom: 1px solid var(--line); } .info-table td:last-child { text-align: right; font-weight: 600; }
.version-list { display: grid; gap: 4px; max-height: 180px; overflow: auto; margin: 10px 0; }
.version-list button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 6px; padding: 7px 10px; text-align: left; display: flex; justify-content: space-between; gap: 12px; }
.version-list button.on { border-color: var(--brand); background: var(--brand-50); }
.version-list span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.version-preview { max-height: 240px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; background: #fff; color: #1f2937; font-size: 12px; }
.version-preview:empty { display: none; }
.toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px); background: #111827; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13px; opacity: 0; pointer-events: none; transition: .2s; z-index: 100; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%); }

/* ---------------- Focus mode ---------------- */
body.focus-mode .titlebar, body.focus-mode .ribbon-tabs, body.focus-mode .ribbon, body.focus-mode .statusbar, body.focus-mode .ruler, body.focus-mode .nav-pane { display: none !important; }
body.focus-mode .canvas { padding-top: 40px; }

/* ---------------- Small screens ---------------- */
@media (max-width: 760px) {
  .titlebar .brand span, .save-state, .hide-sm { display: none; }
  .canvas { padding: 0 8px 32px; }
  .ruler { display: none; }
  .bs-nav { width: 150px; } .bs-main { padding: 24px 16px; }
  .find-bar { left: 16px; right: 16px; top: auto; bottom: 40px; }
}

/* ---------------- Print ---------------- */
@media print {
  body, .editor-page { background: #fff !important; height: auto; overflow: visible; display: block; }
  .titlebar, .ribbon-tabs, .ribbon, .statusbar, .ruler, .nav-pane, .backstage, .find-bar, .toast, .img-handle, dialog { display: none !important; }
  .workspace, .canvas { display: block; overflow: visible; padding: 0; background: #fff; }
  .zoomer { zoom: 1 !important; width: auto; }
  .page { width: auto; min-height: 0 !important; padding: 0; background: #fff; filter: none; }
  .page-header, .page-footer { position: static; border: 0; }
  .page-header:empty, .page-footer:empty { display: none !important; }
  .doc-body hr.page-break { break-after: page; border: 0; margin: 0; }
  .doc-body hr.page-break::after { display: none; }
  .doc-body img.selected { outline: 0; }
}

/* =========================================================
   Pagination, track changes, comments
   ========================================================= */
.pg-layer { position: absolute; inset: 0; pointer-events: none; }
.pg-layer .pg-copy { display: block; position: absolute; border-color: transparent; }
.pg-sheet-label { position: absolute; right: 10px; font: 500 10px var(--ui-font); color: #b6bcc5; }
.page:not(.show-hf) .pg-layer .pg-copy { display: none; }
.pg-num, .pg-total { background: #ffffff; border-radius: 3px; padding: 0 2px; }
.pg-copy .pg-num, .pg-copy .pg-total { background: none; }

.doc-body ins.tc-ins { --tc: #0f6b4f; color: var(--tc); text-decoration: underline; text-decoration-color: var(--tc); text-underline-offset: 2px; background: color-mix(in srgb, var(--tc) 8%, transparent); }
.doc-body del.tc-del { --tc: #be123c; color: var(--tc); text-decoration: line-through; text-decoration-color: var(--tc); opacity: .85; }
.doc-body.tc-simple ins.tc-ins { color: inherit; text-decoration: none; background: none; border-left: 2px solid var(--tc); }
.doc-body.tc-simple del.tc-del { display: none; }
.doc-body.tc-final ins.tc-ins { color: inherit; text-decoration: none; background: none; }
.doc-body.tc-final del.tc-del { display: none; }
.doc-body.tc-original ins.tc-ins { display: none; }
.doc-body.tc-original del.tc-del { color: inherit; text-decoration: none; opacity: 1; }
.st-track { color: #b45309; font-weight: 600; }

.doc-body .cm-anchor { background: #fef3c7; border-bottom: 2px solid #f59e0b; cursor: pointer; }
.doc-body .cm-anchor.cm-focus { background: #fde68a; }
.doc-body .cm-anchor.resolved { background: none; border-bottom: 1px dotted #d1d5db; }

.review-pane { width: 300px; flex: none; background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.rp-head { display: flex; align-items: center; gap: 2px; padding: 6px 6px 0; border-bottom: 1px solid var(--line); }
.rp-tab { border: 0; background: none; padding: 8px 10px; font-weight: 500; color: var(--ink-soft); border-bottom: 2px solid transparent; }
.rp-tab.active { color: var(--brand-ink); border-bottom-color: var(--brand-ink); font-weight: 600; }
.rp-head .icon-btn { margin-left: auto; }
.rp-count { display: inline-block; min-width: 18px; font-size: 11px; background: var(--brand-50); color: var(--brand-ink); border-radius: 999px; padding: 0 5px; }
.rp-count:empty { display: none; }
.rp-body { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.rp-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 24px 8px; }
.rp-actions { display: flex; gap: 6px; }
.rp-card, .cm-card { --tc: #0f6b4f; border: 1px solid var(--line); border-left: 3px solid var(--tc); border-radius: 6px; padding: 8px 10px; background: var(--surface-2); cursor: pointer; display: grid; gap: 4px; font-size: 13px; }
.cm-card.focus { box-shadow: 0 0 0 2px var(--brand-100); border-color: var(--brand-600); border-left-color: var(--tc); }
.cm-card.resolved { opacity: .6; }
.rp-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.rp-meta span { color: var(--muted); white-space: nowrap; }
.rp-text, .cm-text { word-break: break-word; white-space: pre-wrap; }
.rp-ins { color: #0f6b4f; text-decoration: underline; }
.rp-del { color: #be123c; text-decoration: line-through; }
.cm-quote { color: var(--muted); font-size: 12px; font-style: italic; }
.cm-reply { --tc: #0f6b4f; border-left: 2px solid var(--tc); padding-left: 8px; margin-left: 4px; display: grid; gap: 2px; }
.rp-row { display: flex; flex-wrap: wrap; gap: 2px; }
.rp-row .sm-btn { font-size: 12px; padding: 2px 6px; }
@media (max-width: 760px) { .review-pane { position: fixed; right: 0; top: 0; bottom: 0; z-index: 40; width: min(320px, 90vw); box-shadow: var(--shadow); } }
@media print { .review-pane, .pg-layer { display: none !important; } .doc-body .cm-anchor { background: none; border: 0; } }

/* ---------------- References ---------------- */
.doc-body sup.fn-ref { color: #138a63; font-weight: 600; cursor: pointer; padding: 0 1px; }
.doc-body section.footnotes { margin-top: 24pt; font-size: 9.5pt; color: #374151; }
.doc-body section.footnotes hr.fn-sep { width: 2in; margin: 0 0 6pt; border-top: 1px solid #9ca3af; }
.doc-body section.footnotes ol { padding-left: 18pt; margin: 0; }
.doc-body section.footnotes li { margin-bottom: 3pt; }
.doc-body .fn-back { color: #138a63; cursor: pointer; font-size: 9pt; user-select: none; }
.doc-body .flash { animation: lemba-flash 1.2s ease-out; }
@keyframes lemba-flash { 0% { background: #fde68a; } 100% { background: transparent; } }
.doc-body span.cite { color: #0a4f3a; background: #eefaf4; border-radius: 3px; padding: 0 2px; cursor: default; }
.doc-body span.cite.missing { color: #be123c; background: #fff1f2; }
.doc-body div.bibliography { border: 1px dashed #b4e4cf; border-radius: 4px; padding: 4pt 8pt; margin: 8pt 0; }
.doc-body div.bibliography h2 { margin-top: 4pt; }
.doc-body .bib-entry { padding-left: 0.5in; text-indent: -0.5in; }
.cite-wrap, .mf-wrap { position: relative; }
.cite-menu { position: absolute; top: 100%; left: 0; z-index: 20; min-width: 280px; max-width: 380px; max-height: 320px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 4px; display: grid; }
.cite-menu button { border: 0; background: none; text-align: left; padding: 7px 10px; border-radius: 5px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cite-menu button:hover { background: var(--hover); }
.cite-menu .cm-new { color: var(--brand-ink); font-weight: 600; border-top: 1px solid var(--line); border-radius: 0 0 5px 5px; }
.src-form { display: grid; gap: 10px; }
.src-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-field select { padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.src-list { display: grid; gap: 8px; max-height: 50vh; overflow-y: auto; margin: 10px 0 14px; }
.src-item { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; background: var(--surface-2); display: grid; gap: 4px; font-size: 13px; }
.src-entry { padding-left: 24px; text-indent: -24px; }
.sm-btn.arm { background: #fee2e2; color: #991b1b; }
.mf-rec { min-width: 70px; text-align: center; font-size: 12px; color: var(--ink-soft); }

/* ---------------- Equations, shapes, charts ---------------- */
.doc-body span.eq { display: inline-block; vertical-align: middle; padding: 0 2px; border-radius: 3px; cursor: pointer; }
.doc-body span.eq:hover { background: #eefaf4; outline: 1px dashed #7fd6b0; }
.doc-body span.eq-block { display: block; text-align: center; margin: 8pt 0; }
.doc-body math { font-size: 1.1em; }
.eq-raw { font-family: 'Roboto Mono', monospace; background: #f3f4f6; padding: 0 4px; }
.eq-samples { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.eq-samples .sm-btn { border: 1px solid var(--line); }
#eqInput, #chData { font-family: 'Roboto Mono', monospace; font-size: 13px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); resize: vertical; }
.eq-preview { min-height: 56px; margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: #111827; text-align: center; font-size: 18px; overflow-x: auto; }
.eq-err { color: #be123c; font-size: 13px; }
.doc-body .shape { display: inline-block; vertical-align: middle; line-height: 0; cursor: pointer; }
.doc-body .shape svg { display: block; height: auto; aspect-ratio: 3 / 2; overflow: visible; }
.doc-body .shape.selected { outline: 2px solid var(--brand-600); outline-offset: 2px; }
.doc-body .textbox { border: 1px solid #9ca3af; border-radius: 4px; padding: 6pt 8pt; margin: 6pt 0; background: #fff; }
.doc-body figure.chart { margin: 8pt auto; max-width: 560px; cursor: pointer; }
.doc-body figure.chart:hover { outline: 1px dashed #7fd6b0; outline-offset: 2px; }
.shape-wrap { position: relative; }
.shape-menu { position: absolute; top: 100%; left: 0; z-index: 20; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; display: grid; grid-template-columns: repeat(5, 48px); gap: 4px; }
.shape-menu button { border: 1px solid transparent; background: none; border-radius: 5px; height: 40px; display: grid; place-items: center; }
.shape-menu button:hover { background: var(--hover); border-color: var(--line); }
.shape-menu .tb-btn { grid-column: span 5; font-size: 12.5px; height: 30px; }
.chart-preview { margin-top: 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; padding: 6px; max-height: 300px; overflow: auto; }
.num-in { width: 70px; height: 28px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); padding: 0 6px; }

/* ---------------- Proofing, mail merge, macros ---------------- */
::highlight(lemba-grammar) { text-decoration: underline wavy #2563eb; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
::highlight(lemba-style) { text-decoration: underline dotted #7c3aed; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.rp-card.pf-grammar { border-left-color: #2563eb; }
.rp-card.pf-style { border-left-color: #7c3aed; }
.pf-ctx { font-size: 12px; color: var(--ink-soft); }
.pf-ctx mark { background: #dbeafe; color: #1e3a8a; border-radius: 2px; padding: 0 1px; }
.pf-fix { font-weight: 600; color: var(--brand-ink); border: 1px solid var(--line) !important; }
.pf-sum { margin: 2px 0; font-size: 12.5px; }
.doc-body span.mf { background: #ede9fe; color: #5b21b6; border-radius: 3px; padding: 0 2px; font-size: .95em; }
.doc-body span.mf.mf-live { background: #f5f3ff; color: inherit; border-bottom: 1px dashed #a78bfa; }
body.recording #recordMacroBtn { background: #fee2e2; border-color: #fca5a5; }
body.recording #recordMacroBtn .rec-label::after { content: ' (stop)'; }
#recordMacroBtn .rec-dot { color: #dc2626; }
body.recording .rec-dot { animation: lemba-blink 1s infinite; }
@keyframes lemba-blink { 50% { opacity: .2; } }
@media (prefers-reduced-motion: reduce) { body.recording .rec-dot, .doc-body .flash { animation: none; } }
.mc-count { font-size: 12px; align-self: center; }
.mc-steps { font-size: 12px; }

/* ---------------- Live editing & sharing ---------------- */
.presence { display: flex; align-items: center; }
.pr-chip { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-weight: 700; font-size: 12px; border: 2px solid var(--brand); margin-left: -6px; flex: none; }
.share-list .pr-chip { border-color: var(--surface); margin-left: 0; }
.pr-more { background: #475569; }
.share-btn { border: 1px solid rgba(255,255,255,.5); background: rgba(255,255,255,.12); color: #fff; border-radius: 999px; padding: 4px 12px; font-weight: 600; font-size: 13px; }
.share-btn:hover { background: rgba(255,255,255,.22); }
.presence-layer { position: absolute; inset: 0; pointer-events: none; }
.pr-mark { position: absolute; left: calc(var(--m-h) - 14px); width: 3px; background: var(--pc); border-radius: 2px; transition: top .2s, height .2s; }
.pr-mark span { position: absolute; left: -2px; top: -16px; background: var(--pc); color: #fff; font: 600 10px var(--ui-font); padding: 1px 5px; border-radius: 3px 3px 3px 0; white-space: nowrap; }
.share-list { display: grid; gap: 6px; margin: 12px 0; }
.share-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.share-row div { display: grid; min-width: 0; } .share-row small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.share-row select, .share-add select { height: 32px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); padding: 0 6px; }
.share-add { display: flex; gap: 6px; flex-wrap: wrap; }
.share-add input { flex: 1; min-width: 160px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
body.view-only .ribbon { opacity: .55; pointer-events: none; }
@media print { .presence-layer { display: none !important; } }
@media (max-width: 760px) { .share-btn { padding: 4px 8px; } .share-btn .share-label { display: none; } }
.shared-badge { font-size: 11px; font-weight: 500; color: var(--brand-ink); background: var(--brand-50); border-radius: 999px; padding: 1px 8px; margin-left: 4px; white-space: nowrap; }

/* open access (no sign-up) */
.auth-note { margin: 18px 0 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.auth-note a { color: var(--brand-ink); font-weight: 600; display: inline-block; margin-top: 4px; }
.guest-note { font-size: 12px; color: var(--muted); background: var(--brand-50); border-radius: 999px; padding: 2px 10px; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; }

/* Google Material Symbols (Rounded) */
.mi { font-family: 'Material Symbols Rounded'; font-weight: normal; font-style: normal; font-size: 18px; line-height: 1;
  letter-spacing: normal; text-transform: none; display: inline-block; white-space: nowrap; word-wrap: normal; direction: ltr;
  font-feature-settings: 'liga'; -webkit-font-smoothing: antialiased; vertical-align: -4px; user-select: none;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20; overflow: hidden; width: 1em; }
.big-btn .ico .mi { font-size: 24px; vertical-align: 0; font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; }
.icon-btn .mi { font-size: 20px; vertical-align: 0; }
.sm-btn .mi { font-size: 17px; margin-right: 2px; color: var(--brand-ink); }
.color-btn .swatch-ico .mi { font-size: 18px; vertical-align: -3px; }
.mi.mi-caret { font-size: 18px; vertical-align: -5px; margin-left: -3px; width: auto; }
.big-btn .mi.mi-caret { margin: -6px 0 -4px; font-size: 16px; color: var(--ink-soft); }
.icon-btn.on .mi, .big-btn.on .ico .mi { font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 20; }
.titlebar .icon-btn .mi { color: #fff; }
.share-btn { display: inline-flex; align-items: center; gap: 6px; }
.share-btn .mi { font-size: 18px; vertical-align: 0; }
#recordMacroBtn .rec-dot .mi { color: #dc2626; }
.doc-ico .mi { font-size: 20px; color: var(--brand-ink); vertical-align: -5px; }
.row-actions button .mi { font-size: 18px; vertical-align: -3px; }
.tpl-up .mi { font-size: 34px; color: var(--brand-ink); width: auto; }

/* footnotes at the foot of each page (print layout) */
.page.fn-paged .doc-body > section.footnotes { display: none; }
.pg-note-layer { position: absolute; inset: 0; pointer-events: none; }
.pg-notes { position: absolute; left: var(--m-h); right: var(--m-h); pointer-events: auto; font-size: 9.5pt; color: #374151; line-height: 1.3; }
.pg-measure { visibility: hidden; top: 0; pointer-events: none; }
.pg-note-sep { width: 2in; margin: 0 0 6px; border: 0; border-top: 1px solid #9ca3af; }
.pg-note { display: flex; gap: 4px; align-items: baseline; padding: 0 0 2px; border-radius: 3px; }
.pg-note sup { font-size: 7pt; color: #138a63; font-weight: 600; cursor: pointer; flex: none; }
.pg-note-text { flex: 1; outline: none; min-width: 2em; }
.pg-note-text:focus { background: #eefaf4; box-shadow: 0 0 0 2px #eefaf4; }
.pg-note.flash { animation: lemba-flash 1.2s; }
@media print { .page.fn-paged .doc-body > section.footnotes { display: block !important; } .pg-note-layer, .pg-measure { display: none !important; } }

/* page design: watermark, border, line numbers, drop cap */
.pg-design-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.pg-watermark { position: absolute; left: 0; right: 0; display: grid; place-items: center; }
.pg-watermark span { transform: rotate(-45deg); font: 700 96px/1 var(--ui-font); color: var(--wm, #c0c0c0); opacity: .28; white-space: nowrap; letter-spacing: 2px; }
.pg-border { position: absolute; left: calc(var(--m-h) - 24px); right: calc(var(--m-h) - 24px); border: 1.5px solid #0f6b4f; }
.ln-num { position: absolute; left: calc(var(--m-h) - 40px); width: 28px; text-align: right; font: 9pt/1 var(--ui-font); color: #9ca3af; display: flex; align-items: center; justify-content: flex-end; }
.doc-body p.drop-cap::first-letter { float: left; font-size: 3.6em; line-height: .82; padding: 4px 8px 0 0; font-weight: 700; color: #0f6b4f; }
.lbl.chk { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.lbl .mi { font-size: 17px; color: var(--brand-ink); vertical-align: -4px; }
.muted-note { color: var(--muted); font-size: 11px; }
.print-decor { display: none; }
@media print {
  .pg-design-layer { display: none !important; }
  .print-decor { display: block; }
  .print-watermark { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 0; }
  .print-watermark span { transform: rotate(-45deg); font: 700 96px/1 Arial, sans-serif; color: #c0c0c0; opacity: .35; white-space: nowrap; }
  .print-border { position: fixed; inset: -0.33in; border: 1.5pt solid #0f6b4f; pointer-events: none; }
}

/* captions, cross-references, contents with page numbers, figure lists, index */
.doc-body p.caption { font-style: italic; font-size: 9pt; color: #4b5563; margin: 4pt 0 10pt; }
.doc-body p.caption .cap-label { font-style: normal; font-weight: 600; color: #0a4f3a; }
.doc-body a.xref { color: #138a63; text-decoration: none; border-bottom: 1px dotted #138a63; cursor: pointer; }
.doc-body a.xref.xref-broken { color: #b91c1c; border-color: #b91c1c; }
.doc-body .toc p, .doc-body .tof p.tof-item { display: flex; align-items: baseline; }
.doc-body .toc p::after, .doc-body .tof p.tof-item::after { content: ''; order: 1; flex: 1; min-width: 12px; border-bottom: 1.5px dotted #9ca3af; margin: 0 4px 3px; }
.doc-body .toc p.toc-title::after { display: none; }
.doc-body .toc a, .doc-body .tof a { color: inherit; text-decoration: none; }
.doc-body .toc-pg { order: 2; min-width: 1.2em; text-align: right; }
.doc-body .tof { border: 1px solid #e5e7eb; border-radius: 4px; padding: 8pt 12pt; margin: 8pt 0 16pt; background: #fafbfd; }
.doc-body .tof p { margin: 2pt 0; }
.doc-body .index { column-count: 2; column-gap: 24pt; margin: 8pt 0 16pt; }
.doc-body .index .toc-title { column-span: all; }
.doc-body .index p { margin: 1pt 0; } .doc-body .index .idx-letter { font-weight: 700; color: #0a4f3a; margin-top: 8pt; }
.doc-body .index .idx-pages:not(:empty)::before { content: ', '; }
.doc-body.show-marks span.idx { border-bottom: 1px dashed #b45309; }
@media print { .doc-body .toc, .doc-body .tof { border: 0; background: none; padding: 0; } }

/* sheets drawn one by one (sections can differ in size and orientation) */
.page.sheet-mode { background: none; isolation: isolate; }
.pg-sheet-layer { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.pg-sheet { position: absolute; background: var(--paper); }
.pg-hf-layer { position: absolute; inset: 0; pointer-events: none; }
.pg-hf-layer .pg-copy { display: block; position: absolute; pointer-events: auto; }
.pg-hf-layer .pg-own { outline: none; border: 1px dashed transparent; }
.pg-hf-layer .pg-own:hover, .pg-hf-layer .pg-own:focus { border-color: #7fd6b0; }
.page:not(.show-hf) .pg-hf-layer { display: none; }
.doc-body hr.section-break { border: 0; border-top: 3px double #9ca3af; margin: 10pt 0; height: 0; overflow: visible; position: relative; }
.doc-body hr.section-break::after { content: 'Section break (next page)'; position: absolute; left: 50%; top: -9px; transform: translateX(-50%); background: #fff; color: #6b7280; font: 600 10px var(--ui-font); padding: 0 8px; }
.doc-body hr.section-break[data-kind="continuous"]::after { content: 'Section break (continuous)'; }
@media print { .doc-body hr.section-break { border: 0; margin: 0; } .doc-body hr.section-break::after { display: none; } .pg-sheet-layer, .pg-hf-layer { display: none !important; } }

/* sign-in extras: forgot password, reset, account */
.link-btn { background: none; border: 0; padding: 2px 0; color: var(--brand-ink); font-weight: 500; cursor: pointer; justify-self: start; font-size: 13px; }
.link-btn:hover { text-decoration: underline; }
.auth-help { margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.5; }
.form-ok { margin: 12px 0 0; padding: 10px 12px; border-radius: var(--radius); background: var(--brand-50); color: var(--brand-ink); font-size: 13px; line-height: 1.5; }
.account-page { min-height: 100%; background: var(--bg); }
.account-wrap { max-width: 640px; margin: 0 auto; padding: 28px 16px 64px; display: grid; gap: 18px; }
.account-card { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); padding: 22px 24px; }
.account-card h2 { margin: 0 0 4px; font-size: 17px; }
.account-card > p { margin: 0 0 14px; color: var(--ink-soft); font-size: 13px; line-height: 1.5; }
.account-card.danger { border: 1px solid #fecaca; }
.account-card.danger h2 { color: #b91c1c; }
.btn-danger { background: #b91c1c; color: #fff; }
.btn-danger:hover { background: #991b1b; }
.avatar-link { text-decoration: none; }

/* header/footer variants */
.page.hf-real-hidden > .page-header, .page.hf-real-hidden > .page-footer { display: none !important; }
.pg-hf-layer .pg-own[data-label]:empty::before { content: attr(data-label); color: #b6bcc5; }
.pg-hf-layer .pg-own[data-label]:focus::after, .pg-hf-layer .pg-own[data-label]:hover::after { content: attr(data-label); position: absolute; right: 0; top: -16px; font: 600 10px var(--ui-font); color: #138a63; background: #eefaf4; padding: 1px 6px; border-radius: 4px; }

/* where a paragraph continues on the next page (display only) */
.doc-body span.pg-split { display: block; width: 100%; pointer-events: none; user-select: none; }
@media print { .doc-body span.pg-split { display: none; } }

/* form fields */
.doc-body span.ff { display: inline-block; min-width: 1.2em; padding: 0 4px; border-radius: 3px; background: #eefaf4; border-bottom: 1.5px solid #22a77a; cursor: pointer; line-height: 1.3; }
.doc-body span.ff[data-ff="check"] { background: none; border: 0; padding: 0 2px; font-size: 1.15em; cursor: pointer; }
.doc-body span.ff[data-ff="drop"]::after { content: ' ▾'; color: #138a63; font-size: .8em; }
.doc-body span.ff[data-ff="drop"]:not(.ff-filled), .doc-body span.ff[data-ff="date"]:not(.ff-filled) { color: #6b7280; font-style: italic; }
.doc-body span.ff[data-ff="text"] { cursor: text; min-width: 8em; }
.doc-body .ff-val { outline: none; display: inline-block; min-width: 7.5em; }
.doc-body .ff-val:empty::before { content: attr(data-ph); color: #9ca3af; font-style: italic; }
body.form-locked .doc-body span.ff { box-shadow: 0 0 0 1px #7fd6b0; }
body.form-locked .ribbon .rpanel:not([data-panel="review"]) .big-btn, body.form-locked .ribbon .rpanel:not([data-panel="review"]) .sm-btn, body.form-locked .ribbon .rpanel:not([data-panel="review"]) .icon-btn { opacity: .45; pointer-events: none; }
.ff-pop { position: fixed; z-index: 60; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 4px; display: grid; gap: 2px; min-width: 160px; max-height: 260px; overflow: auto; }
.ff-pop button { text-align: left; background: none; border: 0; padding: 6px 10px; border-radius: 5px; cursor: pointer; font: inherit; color: var(--ink); }
.ff-pop button:hover, .ff-pop button.on { background: var(--hover); }
.ff-pop input[type=date] { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
@media print { .doc-body span.ff { background: none; border-bottom: 1px solid #000; } .doc-body span.ff[data-ff="drop"]::after { content: ''; } .doc-body .ff-val:empty::before { content: ''; } }

.doc-body span.ff:focus { outline: 2px solid #22a77a; outline-offset: 1px; }
