/* Word editor: app chrome uses the design tokens (light and dark); the paper is always white with black text */

/* ---------- start screen ---------- */
.we-start { padding: 48px 24px 64px; display: grid; place-items: start center; }
.we-start-inner { width: min(640px, 100%); text-align: center; }
.we-start h1 { margin-bottom: 8px; }
.we-lead { font-size: 15px; margin-bottom: 24px; }
.we-start .dropzone { padding: 52px 20px; }
.we-start-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.we-start-feats { display: flex; justify-content: center; gap: 10px 22px; flex-wrap: wrap; margin-top: 22px; color: var(--muted); font-size: 13px; font-weight: 500; }
.we-start-feats span { display: inline-flex; align-items: center; gap: 7px; }

/* ---------- editing layout: header, bars, scrolling canvas, status bar ---------- */
body.we-editing { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
body.we-editing #app { flex: 1; min-height: 0; display: flex; flex-direction: column; }
body.we-editing .footer { display: none; }
.we-shell { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }

.we-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--surface); border-bottom: 1px solid var(--border); flex: none; min-width: 0; }
.we-docicon { color: var(--accent-text); display: inline-flex; }
.we-name { flex: 0 1 340px; min-width: 60px; height: 32px; border: 1px solid transparent !important; background: transparent !important; font-weight: 600; font-size: 15px; padding: 0 8px !important; color: var(--text); box-shadow: none !important; text-overflow: ellipsis; }
.we-name:hover { border-color: var(--border) !important; }
.we-name:focus { border-color: var(--accent) !important; background: var(--surface) !important; }
.we-savestate { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.we-bar-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex: none; }
.we-save { min-width: 92px; }

.we-toolbar { display: flex; flex-direction: column; background: var(--surface); border-bottom: 1px solid var(--border); flex: none; position: relative; z-index: 5; }
.we-group { display: flex; align-items: center; gap: 2px; flex: none; }
.we-sep { width: 1px; height: 22px; background: var(--border); margin: 0 5px; flex: none; }
.we-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; flex-direction: column; width: 32px; height: 32px; border: 0; border-radius: 6px; background: none; color: var(--text-2); cursor: pointer; padding: 0; flex: none; }
.we-btn:hover { background: var(--surface-2); color: var(--text); }
.we-btn.on { background: var(--accent-soft); color: var(--accent-text); }
.we-btn:disabled { opacity: .35; cursor: default; background: none; }
.we-btn .i { width: 17px; height: 17px; }
.we-color .i { width: 15px; height: 15px; margin-top: -2px; }
.we-color-bar { width: 16px; height: 3px; border-radius: 1px; margin-top: 1px; box-shadow: 0 0 0 1px var(--border); }
.we-color input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.we-sel { height: 30px !important; padding: 0 24px 0 8px !important; font-size: 13px !important; border-radius: 6px !important; min-width: 0; }
.we-style { width: 126px; }
.we-font { width: 138px; }
.we-size { width: 74px; }

/* find and replace */
.we-findbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 8px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); flex: none; }
.we-find-row { display: flex; gap: 6px; align-items: center; }
.we-find-row input[type=search], .we-find-row input[type=text] { width: 190px; height: 32px; }
.we-find-row .btn { height: 32px; padding: 0 10px; font-size: 13px; }
.we-find-row.opts { margin-left: auto; gap: 12px; }
.we-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.we-find-status { font-size: 12.5px; min-width: 70px; }

/* canvas and sheet */
.we-canvas { flex: 1; min-height: 0; overflow: auto; background: var(--canvas-bg); padding: 24px 24px 64px; -webkit-overflow-scrolling: touch; }
.we-zoom { width: max-content; margin: 0 auto; }
.we-sheet { position: relative; box-sizing: border-box; background: #ffffff; color: #000000; box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 1px rgba(0, 0, 0, .04); color-scheme: light; }
.we-hf { position: absolute; color: #000000; opacity: .45; pointer-events: none; user-select: none; -webkit-user-select: none; font-family: 'Calibri', sans-serif; font-size: 11pt; line-height: 1.15; }
.we-hf .p { margin: 0; }

.doc { outline: none; min-height: 100pt; color: #000000; caret-color: #000000; font-feature-settings: normal; -webkit-font-smoothing: auto; word-wrap: break-word; overflow-wrap: break-word; }
.doc :is(h1, h2, h3, h4, h5, h6) { color: inherit; letter-spacing: normal; line-height: inherit; margin: 0; font-size: inherit; }
.doc p { margin: 0; }
.doc a { color: #0563c1; }
.doc img { max-width: 100%; height: auto; }
.doc table { border-collapse: collapse; }
.doc td, .doc th { vertical-align: top; }
.doc table.tbl:not([style*="width"]) { width: 100%; }
.doc ::selection { background: #b4d3fb; color: inherit; }
.doc .sdt { outline: 1px dotted rgba(0, 0, 0, .18); outline-offset: 2px; cursor: default; }
.doc .num { user-select: none; -webkit-user-select: none; }

/* page breaks: a dashed line with a label */
.doc div.page-break, .doc span.page-break { display: block; position: relative; height: 0; margin: 14pt 0; border-top: 1px dashed #9a9c94; user-select: none; -webkit-user-select: none; }
.doc div.page-break::after, .doc span.page-break::after { content: 'Page break'; position: absolute; left: 50%; top: 0; transform: translate(-50%, -50%); padding: 0 8px; background: #ffffff; color: #6b6d66; font: 500 11px/1.6 var(--font); letter-spacing: .02em; }

/* table toolbar */
.we-tabletools { position: fixed; z-index: 60; display: flex; align-items: center; gap: 2px; padding: 3px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-lg); }
.we-tt-btn { display: inline-flex; align-items: center; gap: 4px; height: 28px; min-width: 28px; padding: 0 6px; border: 0; border-radius: 5px; background: none; color: var(--text-2); cursor: pointer; font: 500 12px var(--font); }
.we-tt-btn:hover { background: var(--surface-2); color: var(--text); }
.we-tabletools .we-sep { height: 18px; margin: 0 3px; }

/* popovers: table picker, more menu */
.we-pop { position: fixed; z-index: 70; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 8px; }
.we-tp-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin: 0 2px 6px; }
.we-tp-grid { display: grid; grid-template-columns: repeat(var(--n), 20px); gap: 3px; }
.we-tp-cell { width: 20px; height: 20px; border: 1px solid var(--border-strong); border-radius: 3px; background: var(--surface); padding: 0; cursor: pointer; }
.we-tp-cell.on { background: var(--accent-soft); border-color: var(--accent); }
.we-menu { display: grid; min-width: 220px; }
.we-menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.we-menu-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; color: var(--text); font: 500 13.5px var(--font); text-align: left; }
.we-menu-item:hover { background: var(--surface-2); }

/* status bar */
.we-status { display: flex; align-items: center; gap: 14px; padding: 4px 12px; padding-bottom: calc(4px + var(--safe-b)); background: var(--surface); border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); flex: none; min-height: 36px; }
.we-counts { white-space: nowrap; }
.we-drive { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.we-zoomctl { margin-left: auto; display: flex; align-items: center; gap: 2px; flex: none; }
.we-zoomctl .btn { height: 28px; }
.we-zoomctl .btn.icon { width: 28px; }
.we-zoomctl .btn:not(.ghost), .we-zoomctl .btn.ghost { border-bottom-width: 1px; }
.we-fit { padding: 0 8px; font-size: 12.5px; }
.we-zoomlabel { min-width: 42px; text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- phones and small tablets ---------- */
@media (max-width: 760px) {
  .we-start { padding: 22px 16px 40px; }
  .we-start h1 { font-size: 24px; }
  .we-bar { padding: 6px 10px; gap: 6px; }
  .we-savestate { display: none; }
  .we-docicon { display: none; }
  .we-name { font-size: 14px; }
  /* one row that scrolls sideways */
  .we-toolbar { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; padding: 4px 6px; }
  .we-toolbar::-webkit-scrollbar { display: none; }
  .we-btn { width: 38px; height: 38px; }
  .we-sel { height: 34px !important; }
  .we-canvas { padding: 8px 8px 40px; }
  .we-findbar { padding: 8px 10px; gap: 6px; }
  .we-find-row { width: 100%; }
  .we-find-row input[type=search], .we-find-row input[type=text] { flex: 1; width: auto; min-width: 0; }
  .we-find-row.opts { margin-left: 0; justify-content: space-between; }
  .we-status { gap: 8px; padding-left: 10px; padding-right: 6px; }
  .we-drive { display: none; }
}

/* ---------- page view: separate sheets drawn behind the editable page (see pages.js) ---------- */
.we-sheet.we-paged { background: transparent; box-shadow: none; }
.we-sheet.we-paged > .we-hf { display: none; }
.we-pages-bg { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.we-sheet:not(.we-paged) > .we-pages-bg { display: none; }
.we-pagesheet { position: absolute; left: 0; background: #ffffff; box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 1px rgba(0, 0, 0, .04); }
.we-sheet.we-paged .doc { position: relative; z-index: 1; box-sizing: border-box; min-height: 0; }
.we-paged .doc div.page-break { margin: 0; border-top: 0; height: 0; }
.we-paged .doc div.page-break::after { top: -2px; transform: translate(-50%, -100%); background: transparent; color: #9a9c94; font-size: 10px; }
.we-paged .doc span.page-break { display: inline; margin: 0; border: 0; }
.we-paged .doc span.page-break::after { content: ''; }
.we-pagecount { white-space: nowrap; }

/* ---------- mobile view: one column at the screen width, full size text ---------- */
.we-zoom:has(> .we-flow) { width: auto; }
.we-sheet.we-flow { width: auto; max-width: 860px; margin: 0 auto; padding: 32px 40px 48px; box-sizing: border-box; min-height: 60vh; }
.we-sheet.we-flow > .we-hf { position: static; margin: 0 0 14px; }
.we-sheet.we-flow > .we-footer { margin: 18px 0 0; }
.we-flow .doc table { max-width: 100%; width: auto !important; table-layout: auto; margin-left: 0 !important; }
.we-flow .doc col, .we-flow .doc td, .we-flow .doc th { width: auto !important; }
.we-flow .doc td, .we-flow .doc th { overflow-wrap: anywhere; }
.we-flow .doc img { max-width: 100% !important; height: auto !important; }
.we-view { height: 28px; padding: 0 8px; font-size: 12.5px; gap: 5px; flex: none; }
@media (max-width: 760px) {
  .we-sheet.we-flow { padding: 18px 16px 32px; }
  .we-pagecount { display: none; }
}
.we-status { overflow: hidden; }
.we-shell:has(.we-flow) .we-zoomctl > :not(.we-fit) { display: none; }
.we-shell:has(.we-flow) .we-fit { display: none; }
@media (max-width: 760px) { .we-counts { overflow: hidden; text-overflow: ellipsis; min-width: 0; } .we-view { margin-left: auto; } }

/* ---------- ribbon: tabs with quick buttons, then the open tab's buttons ---------- */
/* The file name bar and both ribbon rows share one centred column on wide screens */
.we-bar, .we-tabrow, .we-panel { padding-left: max(14px, calc((100% - 1240px) / 2)); padding-right: max(14px, calc((100% - 1240px) / 2)); }
.we-tabrow { display: flex; align-items: center; gap: 6px; min-height: 36px; border-bottom: 1px solid var(--border); }
.we-quick { display: flex; gap: 2px; flex: none; padding-right: 6px; margin-right: 2px; border-right: 1px solid var(--border); }
.we-quick .we-btn { width: 30px; height: 30px; }
.we-tabs { display: flex; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
.we-tabs::-webkit-scrollbar { display: none; }
.we-tab { flex: none; height: 36px; padding: 0 12px; border: 0; background: none; color: var(--text-2); font: 500 13px var(--font); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.we-tab:hover { color: var(--text); }
.we-tab.on { color: var(--accent-text); border-bottom-color: var(--accent); font-weight: 600; }
.we-panels { min-width: 0; }
.we-panel { display: flex; align-items: center; gap: 2px; min-height: 44px; padding-top: 6px; padding-bottom: 6px; box-sizing: border-box; flex-wrap: wrap; row-gap: 4px; }
.we-panel[hidden] { display: none; }
.we-panel .we-sel { height: 32px !important; }
.we-btn.we-wide { width: auto; flex-direction: row; gap: 6px; padding: 0 9px; font: 500 12.5px var(--font); white-space: nowrap; }
.we-btn-label { line-height: 1; }
.we-caret { width: 0; height: 0; border-left: 3.5px solid transparent; border-right: 3.5px solid transparent; border-top: 4px solid currentColor; opacity: .7; }
.we-btn:not(.we-wide) > .we-caret { position: absolute; right: 3px; bottom: 6px; }
.we-sep { align-self: center; }
.we-menu-head { font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 6px 10px 2px; text-transform: uppercase; letter-spacing: .03em; }
.we-menu-item.on { color: var(--accent-text); }
.we-menu-check { width: 16px; display: inline-flex; }
.we-menu-hint { margin-left: auto; padding-left: 14px; color: var(--muted); font-size: 12px; }
.we-pop .we-menu { max-height: min(70vh, 520px); overflow: auto; }

/* notices (tracked changes) */
.we-notice { display: flex; align-items: center; gap: 10px; padding: 7px 14px; background: var(--accent-soft); color: var(--text); font-size: 13px; border-bottom: 1px solid var(--border); flex: none; }
.we-notice.hidden { display: none; }
.we-notice > span:not(.i) { flex: 1; min-width: 0; }
.we-notice a { color: var(--accent-text); font-weight: 600; }
.we-notice .btn.icon { width: 28px; height: 28px; flex: none; }

/* ---------- main area: navigation pane, page, comments and footnotes ---------- */
.we-main { flex: 1; min-height: 0; display: flex; position: relative; }
.we-main > .we-canvas { flex: 1; min-width: 0; }
.we-nav, .we-side { flex: none; background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.we-nav { width: 240px; border-right: 1px solid var(--border); }
.we-side { width: 310px; border-left: 1px solid var(--border); }
.we-nav.hidden, .we-side.hidden { display: none; }
.we-side-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
.we-side-head .btn.icon { width: 30px; height: 30px; }
.we-side-tools { padding: 10px 12px 0; }
.we-side-add { width: 100%; justify-content: center; height: 34px; }
.we-side-sec { flex: 1; min-height: 0; overflow: auto; padding: 10px 12px 16px; }
.we-side-sec[hidden], .we-side-add[hidden] { display: none; }
.we-side-empty { font-size: 13px; padding: 8px 4px; }
.we-nav-list { overflow: auto; padding: 6px; }
.we-nav-item { display: block; width: 100%; text-align: left; border: 0; background: none; border-radius: 6px; padding: 7px 10px; color: var(--text); font: 500 13px/1.35 var(--font); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.we-nav-item:hover { background: var(--surface-2); }
.we-nav-item.on { background: var(--accent-soft); color: var(--accent-text); }

/* comments */
.we-cm { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; background: var(--surface); cursor: pointer; }
.we-cm:hover { border-color: var(--border-strong); }
.we-cm.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.we-cm-head { display: flex; align-items: center; gap: 8px; }
.we-cm-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; font: 600 11.5px var(--font); flex: none; }
.we-cm-who { display: grid; min-width: 0; flex: 1; font-size: 13px; line-height: 1.3; }
.we-cm-who small { font-size: 11.5px; }
.we-cm-del { width: 28px; height: 28px; opacity: .7; }
.we-cm-del:hover { opacity: 1; }
.we-cm-text { margin-top: 6px; font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.we-cm-draft { cursor: default; }
.we-cm-draft textarea { width: 100%; margin-top: 8px; resize: vertical; min-height: 64px; box-sizing: border-box; }
.we-cm-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px; }
.we-cm-actions .btn { height: 32px; }
::highlight(we-comment) { background-color: #fff1b8; }
::highlight(we-comment-on) { background-color: #ffd966; }

/* footnotes */
.we-sheet { counter-reset: we-fn we-en; }
.doc sup.we-fn { font-size: 0.65em; line-height: 0; vertical-align: super; color: #000000; cursor: default; }
.doc sup.we-fn[data-fn]::after { counter-increment: we-fn; content: counter(we-fn); }
.doc sup.we-fn[data-en]::after { counter-increment: we-en; content: counter(we-en, lower-roman); }
.we-fn-item { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 10px; }
.we-fn-num { flex: none; width: 26px; height: 26px; margin-top: 4px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: 600 12px var(--font); cursor: pointer; }
.we-fn-text { flex: 1; min-width: 0; min-height: 34px; padding: 6px 9px; border: 1px solid var(--border-strong); border-radius: 8px; background: #ffffff; color: #000000; font: 10pt/1.35 'Calibri', 'Carlito', sans-serif; outline: none; overflow-wrap: anywhere; }
.we-fn-text:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.we-fn-text p { margin: 0; }
.we-fn-del { width: 28px; height: 28px; flex: none; margin-top: 3px; }

/* comment marks and fields inside the page */
.doc .we-cs, .doc .we-ce { display: inline; }
.doc .we-field, .we-hf .we-field { font: inherit; }

/* table of contents */
.doc .we-toc { margin: 6pt 0 12pt; cursor: default; outline: 1px dotted rgba(0, 0, 0, .18); outline-offset: 3px; }
.doc .we-toc-title { font-size: 14pt; color: #2f5496; margin: 0 0 6pt; font-weight: bold; }
.doc .we-toc-e { display: flex; align-items: baseline; gap: 4pt; margin: 0 0 5pt; cursor: pointer; }
.doc .we-toc-e[data-level="2"] { padding-left: 11pt; }
.doc .we-toc-e[data-level="3"] { padding-left: 22pt; }
.doc .we-toc-t { order: 0; }
.doc .we-toc-e::after { content: ''; order: 1; flex: 1; border-bottom: 1.2pt dotted #555555; transform: translateY(-3pt); }
.doc .we-toc-pg { order: 2; min-width: 12pt; text-align: right; }
.doc .we-toc-e:hover .we-toc-t { color: #0563c1; text-decoration: underline; }
.doc .sdt[data-toc] p { cursor: pointer; }

/* formatting marks */
.we-marks .doc :is(p, h1, h2, h3, h4, h5, h6):not(:has(> br:only-child))::after { content: '\00b6'; color: #4a7bd0; font-family: Arial, sans-serif; font-weight: normal; font-style: normal; text-decoration: none; padding-left: 1px; }
.we-marks .doc :is(p, h1, h2, h3, h4, h5, h6):not([data-list]):has(> br:only-child)::before { content: '\00b6'; color: #4a7bd0; font-family: Arial, sans-serif; font-weight: normal; }
.we-marks .doc .tab { position: relative; }
.we-marks .doc .tab::before { content: '\2192'; position: absolute; left: 0; color: #4a7bd0; font-size: 9pt; }
.we-marks .doc div.page-break::after, .we-marks .doc span.page-break::after { color: #4a7bd0; }

/* header and footer in the page: double click to edit */
.we-paged .we-pagesheet .we-hf { transition: opacity .15s; }
.we-sheet.we-flow > .we-hf { pointer-events: auto; cursor: default; }
.we-sheet.we-flow > .we-hf:empty::before { content: ''; display: block; height: 8px; }

/* header and footer dialog */
.we-hf-dialog { display: grid; gap: 16px; }
.we-hf-sec h4 { margin: 0 0 6px; font-size: 13px; color: var(--text-2); }
.we-hf-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin-bottom: 6px; }
.we-hf-paper { background: #ffffff; border: 1px solid var(--border-strong); border-radius: 8px; padding: 10px 14px; color-scheme: light; }
.we-hf-edit { min-height: 44px; outline: none; color: #000000; font-family: 'Calibri', sans-serif; font-size: 11pt; line-height: 1.15; overflow-wrap: anywhere; }
.we-hf-edit p, .we-hf-edit .p { margin: 0; }
.we-hf-edit img { max-width: 100%; height: auto; }
.we-field[contenteditable="false"] { display: inline-block; padding: 0 5px; margin: 0 1px; border-radius: 4px; background: #dbe7fb; color: #1f4f9c; font-size: 0.9em; line-height: 1.3; user-select: all; }
.we-hf .we-field { background: none; color: inherit; padding: 0; margin: 0; font-size: inherit; }
.we-small { font-size: 12.5px; margin: 0; }

/* pictures */
.we-picsel { position: fixed; z-index: 55; pointer-events: none; outline: 2px solid var(--accent); outline-offset: 0; }
.we-picsel.hidden, .we-pictools.hidden { display: none; }
.we-pic-h { position: absolute; width: 12px; height: 12px; background: #ffffff; border: 2px solid var(--accent); border-radius: 3px; pointer-events: auto; touch-action: none; box-sizing: border-box; }
.we-pic-nw { left: -7px; top: -7px; cursor: nwse-resize; }
.we-pic-ne { right: -7px; top: -7px; cursor: nesw-resize; }
.we-pic-sw { left: -7px; bottom: -7px; cursor: nesw-resize; }
.we-pic-se { right: -7px; bottom: -7px; cursor: nwse-resize; }
.we-pic-size { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); background: rgba(0, 0, 0, .7); color: #ffffff; font: 500 11px var(--font); padding: 2px 6px; border-radius: 4px; white-space: nowrap; }
.we-pic-size:empty { display: none; }
@media (pointer: coarse) { .we-pic-h { width: 20px; height: 20px; } .we-pic-nw, .we-pic-sw { left: -11px; } .we-pic-ne, .we-pic-se { right: -11px; } .we-pic-nw, .we-pic-ne { top: -11px; } .we-pic-sw, .we-pic-se { bottom: -11px; } }
.we-pictools { position: fixed; z-index: 60; display: flex; align-items: center; gap: 2px; padding: 3px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-lg); }
.we-pictools .we-sep { height: 18px; margin: 0 3px; }
.we-tabletools { flex-wrap: wrap; max-width: calc(100vw - 16px); }
.we-tt-btn.we-color { position: relative; flex-direction: column; justify-content: center; gap: 1px; }
.we-tt-btn.we-color .we-color-bar { width: 14px; }
.doc table[data-borders="none"] td { outline: 1px dashed #c9cdd4; outline-offset: -1px; }

/* right click menu */
.we-ctx { position: fixed; z-index: 90; min-width: 220px; max-width: calc(100vw - 8px); max-height: calc(100vh - 8px); overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 5px; outline: none; }
.we-ctx hr { border: 0; border-top: 1px solid var(--border); margin: 4px 2px; }
.we-ctx-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 9px; border: 0; background: none; border-radius: 6px; color: var(--text); font: 500 13.5px var(--font); text-align: left; cursor: pointer; }
.we-ctx-item:hover:not(:disabled), .we-ctx-item:focus-visible { background: var(--surface-2); outline: none; }
.we-ctx-item:disabled { opacity: .45; cursor: default; }
.we-ctx-ic { width: 16px; flex: none; }
.we-ctx-label { flex: 1; white-space: nowrap; }
.we-ctx-hint { color: var(--muted); font-size: 12px; padding-left: 12px; }
@media (pointer: coarse) { .we-ctx-item { padding: 10px 10px; } }

/* dialogs */
.we-ps { display: flex; gap: 18px; align-items: flex-start; }
.we-ps-main { flex: 1; display: grid; gap: 10px; min-width: 0; }
.we-ps-main .field { margin: 0; }
.we-segs { display: flex; gap: 6px; }
.we-seg { flex: 1; justify-content: center; height: 36px; }
.we-ps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 8px; }
.we-ps-num input, .we-ps-num select { width: 100%; }
.we-ps-preview { flex: none; width: 130px; height: 130px; display: grid; place-items: center; background: var(--surface-2); border-radius: 10px; }
.we-ps-paper { position: relative; background: #ffffff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.we-ps-text { position: absolute; background: repeating-linear-gradient(#c9d3e3 0 2px, transparent 2px 5px); }
.we-ps-err { color: var(--danger, #c0392b); font-size: 13px; margin: 8px 0 0; }
.we-props { display: grid; gap: 10px; }
.we-props .field { margin: 0; }
.we-wc { width: 100%; border-collapse: collapse; font-size: 14px; }
.we-wc th { text-align: left; font-weight: 500; color: var(--text-2); padding: 7px 0; }
.we-wc td { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.we-wc tr + tr { border-top: 1px solid var(--border); }
.we-symbols { width: min(330px, calc(100vw - 32px)); }
.we-sym-tabs { display: flex; gap: 2px; overflow-x: auto; margin-bottom: 8px; scrollbar-width: none; }
.we-sym-tab { flex: none; border: 0; background: none; padding: 5px 9px; border-radius: 6px; font: 500 12.5px var(--font); color: var(--text-2); cursor: pointer; }
.we-sym-tab.on { background: var(--accent-soft); color: var(--accent-text); }
.we-sym-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 3px; max-height: 240px; overflow: auto; }
.we-sym { height: 34px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); font-size: 17px; cursor: pointer; }
.we-sym:hover { border-color: var(--accent); background: var(--accent-soft); }
.we-counts { cursor: pointer; }

/* ---------- phones ---------- */
@media (max-width: 760px) {
  .we-bar, .we-tabrow, .we-panel { padding-left: 8px; padding-right: 8px; }
  .we-panel { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; min-height: 48px; }
  .we-panel::-webkit-scrollbar { display: none; }
  .we-tab { padding: 0 10px; }
  .we-quick .we-btn { width: 34px; height: 34px; }
  .we-nav, .we-side { position: absolute; top: 0; bottom: 0; z-index: 30; width: min(320px, 88vw); box-shadow: var(--shadow-lg); }
  .we-nav { left: 0; }
  .we-side { right: 0; }
  .we-ps { flex-direction: column-reverse; align-items: stretch; }
  .we-ps-preview { width: 100%; height: 110px; }
  .we-notice { font-size: 12.5px; padding: 6px 10px; }
}

/* ---------- printing: only the pages, one sheet per printed page ---------- */
@media print {
  body.we-printing > *:not(#app), body.we-printing #app > *:not(.we-shell), body.we-printing .we-shell > *:not(.we-main), body.we-printing .we-main > *:not(.we-canvas) { display: none !important; }
  body.we-printing, body.we-printing #app, body.we-printing .we-shell, body.we-printing .we-main { display: block !important; height: auto !important; overflow: visible !important; background: #ffffff !important; margin: 0 !important; padding: 0 !important; }
  body.we-printing .we-canvas { padding: 0 !important; overflow: visible !important; background: #ffffff !important; }
  body.we-printing .we-zoom { zoom: 1 !important; margin: 0 !important; }
  body.we-printing .we-sheet { overflow: hidden; }
  body.we-printing .we-pagesheet { box-shadow: none !important; }
  body.we-printing .we-hf { opacity: 1 !important; }
  body.we-printing .doc div.page-break::after, body.we-printing .doc .we-toc, body.we-printing .doc .sdt { outline: none !important; }
  body.we-printing .doc div.page-break::after { content: none !important; }
  body.we-printing .we-tabletools, body.we-printing .we-pictools, body.we-printing .we-picsel, body.we-printing .toasts, body.we-printing .we-ctx { display: none !important; }
  ::highlight(we-comment), ::highlight(we-comment-on) { background-color: transparent; }
}
/* compact ribbon buttons: 32px tall, 30px wide, so the Home tab fits one row from 1200px wide */
@media (min-width: 761px) {
  .we-panel .we-btn:not(.we-wide) { width: 30px; height: 32px; }
  .we-panel .we-btn.we-wide { height: 32px; }
  .we-panel .we-style { width: 118px; }
  .we-panel .we-font { width: 124px; }
  .we-panel .we-sep { margin: 0 4px; }
}
.we-notice { padding-left: max(14px, calc((100% - 1240px) / 2)); padding-right: max(14px, calc((100% - 1240px) / 2)); }
/* a page break inside a paragraph: a small label in page view, so it can be found and deleted */
.we-paged .doc span.page-break { display: inline-block; position: relative; height: 1em; min-width: 60px; vertical-align: baseline; cursor: default; }
.we-paged .doc span.page-break::after { content: 'Page break'; position: absolute; left: 0; top: 50%; transform: translateY(-50%); background: transparent; color: #9a9c94; font: 500 10px/1 var(--font); white-space: nowrap; }
@media print { body.we-printing .doc span.page-break::after { content: none !important; } }
