/* Editor chrome from the approved compact prototype. No document typography. */
html:has(> body.udoc-editor-shell) { width: 100%; height: 100%; margin: 0; border: 0; border-radius: 0; }
body.udoc-editor-shell {
  --editor-rail-width: 52px; --editor-left: var(--editor-rail-width); --editor-right: 0px;
  width: 100%; height: 100dvh; min-width: 0; max-width: none;
  margin: 0; border: 0; border-radius: 0;
}
body.udoc-editor-shell #ribbon { width: 100%; max-width: none; border-radius: 0; }
body.udoc-editor-shell #ribbon .rb-titlebar {
  height: 52px; padding: 6px 12px 6px 11px; gap: 8px; align-items: center;
}
body.udoc-editor-shell #ribbon :is(.rb-app, .rb-app img) { width: 26px; height: 26px; }
body.udoc-editor-shell #ribbon .rb-app { align-self: center; margin-right: 6px; }
body.udoc-editor-shell #ribbon .rb-product-name { display: none; }
body.udoc-editor-shell #ribbon .rb-document-access-slot { position: absolute; top: 8px; right: 240px; max-width: 180px; }
body.udoc-editor-shell #ribbon .rb-titlebar:has(.rb-document-access-slot:not(:empty)) .rb-doc-name { width: min(42vw, calc(100vw - 440px)); }
body.udoc-editor-shell #ribbon .rb-doc-name {
  left: 52px; top: 2px; transform: none; width: min(42vw, 640px); max-width: min(42vw, 640px);
  height: 24px; padding: 1px 7px; text-align: left; font-size: 14px; font-weight: 600;
}
/* The tab row sits at 27-49px, clear of the title (2-26px) and the bar's 52px hairline;
   every item in it, including 操作说明, keeps the 22px tab height so none pushes the row down. */
body.udoc-editor-shell #ribbon .ribbon-tabs {
  top: 27px; left: 52px; right: 260px; min-height: 22px; gap: 0;
}
body.udoc-editor-shell #ribbon .rb-tab {
  min-height: 22px; height: 22px; padding: 2px 7px; font-size: 12px; line-height: 18px; border-radius: 6px;
}
/* Phones (760px and below) keep their 42px touch targets from app-docs-theme.css. */
@media (min-width: 761px) {
  body.udoc-editor-shell #ribbon .udoc-help-link {
    min-height: 22px; height: 22px; padding: 0 8px; gap: 4px; font-size: 13px; line-height: 18px; border-radius: 6px;
  }
  body.udoc-editor-shell #ribbon .udoc-help-link svg { width: 16px; height: 16px; }
  body.udoc-editor-shell #ribbon #btn-ribbon-toggle { min-width: 22px; width: 22px; height: 22px; }
}
body.udoc-editor-shell #ribbon .rb-titlebar-right { align-self: center; height: 34px; margin-left: auto; gap: 6px; }
body.udoc-editor-shell #ribbon .rb-quick { height: 32px; border-radius: 8px; font-size: 12px; }
body.udoc-editor-shell #ribbon #btn-ai { border-radius: 8px; background: var(--ui-accent-weak); }
body.udoc-editor-shell #ribbon .rb-ai-logo { width: 18px; height: 18px; }
body.udoc-editor-shell #ribbon .ribbon-panels {
  margin: 0; padding: 6px 8px; min-height: 44px; border-radius: 0;
  border-top: .5px solid var(--ui-line-soft); border-bottom: .5px solid var(--ui-line); background: var(--ui-surface);
}
body.udoc-editor-shell #ribbon :is(.rb-group, .rb-home-grid .rb-group) { height: 30px; padding: 0 5px; }
body.udoc-editor-shell #ribbon .rb-home-grid .rb-group-quick { padding-left: 0; }
body.udoc-editor-shell #ribbon :is(.rb-tools button, .rb-home-grid .rb-tools button, .rb-home-grid .fs-step, .rb-home-grid .color-btn, .rb-table-tools button, .rb-object-tools button) {
  flex: 0 0 auto; border-radius: 7px; min-width: 28px; width: auto; height: 30px;
  padding: 0 7px; font-size: 13px; white-space: nowrap; overflow-wrap: normal; word-break: normal;
}
body.udoc-editor-shell #ribbon .rb-tools button .rb-txt { flex: none; white-space: nowrap; line-height: 18px; }
body.udoc-editor-shell #ribbon :is(.rb-tools .ri, .rb-quick .ri) { flex: none; width: 17px; height: 17px; stroke-width: 1.7; }
body.udoc-editor-shell #ribbon .ribbon-panel { min-width: max-content; min-height: 30px; }
body.udoc-editor-shell #ribbon :is(.rb-group, .rb-tools, .page-setup-col) { flex-shrink: 0; }
body.udoc-editor-shell #ribbon .rb-tools :is(select, input, label) { flex-shrink: 0; }
body.udoc-editor-shell #ribbon .rb-home-grid :is(.fs-step, .color-btn) { width: 28px; padding-inline: 4px; }
body.udoc-editor-shell #ribbon .page-grid-controls button { min-width: 42px; }
body.udoc-editor-shell #ribbon .rb-table-style-gallery { grid-template-columns: repeat(4, 34px); }
body.udoc-editor-shell #ribbon .tbl-style-card { width: 34px; height: 28px; }
body.udoc-editor-shell #ribbon :is(select, .fs-num, .fs-caret, .fs-unit) { background-color: var(--ui-fill); font-size: 12px; border-radius: 7px; }
body.udoc-editor-shell #ribbon .rb-font-top #sel-fontfamily { width: 142px; }
body.udoc-editor-shell #ribbon .rb-paragraph-style #sel-block { width: 100px; }
body.udoc-editor-shell #ribbon .fs-box { gap: 0; }
/* 48px fits five-character sizes such as 11.25 and 100.5 at the ribbon's 12px. */
body.udoc-editor-shell #ribbon .rb-home-grid .fs-box .fs-num { width: 48px; }
body.udoc-editor-shell #ribbon .rb-home-grid #btn-numbering { width: 32px; min-width: 32px; }
body.udoc-editor-shell #ribbon .rb-tools button:hover { background: var(--ui-hover); }
body.udoc-editor-shell #ribbon .rb-tools button.active { background: var(--ui-accent-weak); }
#editor-density { display: inline-grid; place-items: center; margin-left: 6px; }
#editor-density svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; }
body.udoc-editor-shell[data-editor-density="full"] #ribbon .ribbon-panels { padding: 7px 8px 3px; }
body.udoc-editor-shell[data-editor-density="full"] #ribbon .rb-home-grid .rb-group { height: 74px; flex-direction: column; align-items: flex-start; gap: 3px; padding-inline: 10px; }
body.udoc-editor-shell[data-editor-density="full"] #ribbon .rb-home-grid :is(.rb-tools-font, .rb-tools-paragraph) { height: 60px; flex-direction: column; align-items: flex-start; gap: 4px; }
body.udoc-editor-shell[data-editor-density="full"] #ribbon .rb-home-grid .rb-glabel { display: block; font-size: 10px; color: var(--ui-ink-2); line-height: 12px; }
/* One rail since 2026-10-17 (the client's app rail is gone): navigation, review, files and
   materials, then the tools at the bottom. A pressed tool is a white card with a blue glyph. */
#editor-rail {
  position: fixed; left: 0; top: var(--ribbon-h); bottom: 28px; width: var(--editor-rail-width); z-index: 35;
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 0 8px;
  background: var(--ui-surface-2); box-shadow: inset -.5px 0 0 var(--ui-line); user-select: none;
}
#editor-rail .editor-rail-group {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding-bottom: 8px; margin-bottom: 6px; border-bottom: .5px solid var(--ui-line);
}
#editor-rail .editor-rail-group:nth-last-of-type(1) { border-bottom: 0; }
#editor-rail button {
  display: grid; place-items: center; flex: 0 0 auto; width: 38px; height: 38px; padding: 9px;
  border: 0; border-radius: 10px; background: transparent; color: var(--ui-ink-2); cursor: pointer;
  transition: background .14s, color .14s, box-shadow .14s;
}
#editor-rail button:hover { background: var(--ui-hover); color: var(--ui-ink); }
#editor-rail button:disabled { opacity: .4; cursor: default; background: transparent; }
#editor-rail button[aria-pressed="true"] {
  background: var(--ui-surface); color: var(--ui-accent);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 .5px rgba(0, 0, 0, .05);
}
#editor-rail button:focus-visible { outline: 2px solid var(--ui-focus); outline-offset: 1px; }
#editor-rail svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#editor-rail .editor-rail-spacer { flex: 1; }
#editor-rail-actions { display: contents; }
/* 最近文件：侧栏常驻，顶部按钮在侧栏旁展开这一栏（与目录共用左侧停靠位）。 */
#files-panel {
  position: fixed; left: var(--editor-rail-width); top: var(--ribbon-h); bottom: 28px; width: 264px; z-index: 34;
  display: flex; flex-direction: column; background: var(--ui-surface-2);
  border-right: .5px solid var(--ui-line); color: var(--ui-ink);
}
#files-panel[hidden] { display: none; }
#files-panel header { display: flex; align-items: center; justify-content: space-between; height: 44px; padding: 0 8px 0 16px; flex: none; }
#files-panel h2 { margin: 0; font-size: 13px; font-weight: 600; }
#files-panel svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#files-panel .files-close {
  display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 7px;
  background: transparent; color: var(--ui-ink-2); cursor: pointer;
}
#files-panel .files-close:hover { background: var(--ui-hover); color: var(--ui-ink); }
#files-panel .files-actions { display: flex; gap: 8px; padding: 0 12px 10px; flex: none; }
#files-panel .files-actions button {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px;
  border: 0; border-radius: 8px; background: var(--ui-surface); color: var(--ui-ink);
  font-family: inherit; font-size: 12.5px; font-weight: 500; line-height: 1; box-shadow: 0 0 0 .5px var(--ui-line); cursor: pointer;
}
#files-panel .files-actions button:hover { background: var(--ui-hover); }
#files-panel .files-actions button[data-files="new"] { background: var(--ui-accent-strong); color: var(--ui-accent-ink); box-shadow: none; }
#files-panel .files-actions button[data-files="new"]:hover { background: var(--ui-accent-strong-hover); }
#files-panel .files-list { flex: 1; overflow-y: auto; padding: 4px 8px 16px; border-top: .5px solid var(--ui-line-soft); }
#files-panel .files-row {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; margin: 1px 0;
  border: 0; border-radius: 8px; background: transparent; color: inherit; text-align: left; cursor: pointer;
}
#files-panel .files-row:hover { background: var(--ui-hover); }
#files-panel .files-row:focus-visible { outline: 2px solid var(--ui-focus); outline-offset: -2px; }
#files-panel .files-kind {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px;
  font-family: inherit; font-size: 9.5px; font-weight: 700; line-height: 1; letter-spacing: .02em; color: #fff; background: #8e8e93;
}
#files-panel .files-kind[data-kind="UDOC"] { background: var(--ui-accent); }
#files-panel .files-kind[data-kind="Word"] { background: #2b579a; }
#files-panel .files-kind[data-kind="PDF"] { background: #e5484d; }
#files-panel .files-kind[data-kind="HTML"] { background: #f08a24; }
#files-panel .files-kind[data-kind="MD"] { background: #5e5ce6; }
#files-panel .files-text { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
#files-panel .files-text strong { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#files-panel .files-text small { font-size: 11px; color: var(--ui-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#files-panel .files-missing { opacity: .55; }
#files-panel .files-empty { margin: 16px 8px; font-size: 12px; line-height: 1.6; color: var(--ui-ink-2); }
@media (max-width: 899px) {
  #files-panel { box-shadow: 0 8px 28px rgba(20, 40, 80, .16); }
}
@media (max-width: 640px) {
  #files-panel { left: 0; width: min(320px, 100vw); z-index: 62; }
}
body.udoc-editor-shell #canvas {
  margin-left: var(--editor-left); margin-right: var(--editor-right) !important;
  padding: 32px 24px 96px; scrollbar-gutter: stable both-edges;
  background: linear-gradient(180deg, #f1f1f5, #e8e8ed);
  min-width: 0;
}
body.udoc-editor-shell #toc-panel {
  left: var(--editor-rail-width); right: auto; top: var(--ribbon-h); bottom: 28px; width: 216px;
  border: 0; border-right: .5px solid var(--ui-line); border-radius: 0; box-shadow: none;
  background: var(--ui-surface-2);
}
body.udoc-editor-shell #toc-panel header { height: 44px; padding: 0 12px; font-size: 13px; }
body.udoc-editor-shell #toc-panel .toc-body { padding: 4px 8px 16px; }
body.udoc-editor-shell #toc-panel .toc-item { border-radius: 7px; font-size: 12px; padding-block: 7px; }
body.udoc-editor-shell #ai-panel:not(.ai-floating):not(.ai-full) {
  top: var(--ribbon-h) !important; bottom: 28px; width: 380px; min-width: 320px;
  border-radius: 0; box-shadow: none; border-left: .5px solid var(--ui-line);
}
body.udoc-editor-shell #ud-comments-panel {
  top: var(--ribbon-h); right: 0; bottom: 28px; width: 296px;
  border: 0; border-left: .5px solid var(--ui-line); border-radius: 0; box-shadow: none;
  background: var(--ui-surface-2); backdrop-filter: none;
}
body.udoc-editor-shell #statusbar { box-shadow: none; padding-inline: 12px; font-size: 11px; }
body.udoc-editor-shell #statusbar button { font-size: 11px; }
body.udoc-editor-shell:is(.udoc-embed-mode, .udoc-html-immersive, [data-document-view="reading"]) #editor-rail { display: none; }
body.udoc-editor-shell:is(.udoc-embed-mode, .udoc-html-immersive, [data-document-view="reading"]) #canvas { margin-left: 0; margin-right: 0 !important; }
@media (max-width: 900px) {
  body.udoc-editor-shell #ribbon .rb-titlebar-right { gap: 2px; }
  body.udoc-editor-shell #ribbon .ribbon-tabs { right: 145px; }
  body.udoc-editor-shell #ribbon #btn-present span { display: none; }
  body.udoc-editor-shell #ribbon .rb-doc-name { width: calc(100vw - 230px); max-width: none; }
}
@media (max-width: 640px) {
  body.udoc-editor-shell { --editor-left: 0px; }
  #editor-rail { display: none; }
  body.udoc-editor-shell #canvas { padding-inline: 8px; padding-top: 16px; }
  body.udoc-editor-shell #toc-panel { left: 0; width: min(216px, 80vw); }
  body.udoc-editor-shell #ribbon .rb-titlebar { height: 54px; }
  body.udoc-editor-shell #ribbon .rb-doc-name { font-size: 13px; }
}
@media print { #editor-rail, #editor-density, #toc-panel, #files-panel { display: none !important; } body.udoc-editor-shell #canvas { margin: 0 !important; padding: 0; } }

/* ===== U AI conversation (Claude / ChatGPT style on UniDoc's iOS tokens) =====
 * The answer reads as a page, not a chat bubble: full width, no avatar column. The user's
 * own turn is a quiet grey bubble on the right. Greeting and suggestions belong to an
 * empty conversation only; the composer is one rounded card. Structure and bindings are
 * unchanged: this layer only restyles. */
body.udoc-editor-shell #ai-panel { background: var(--ui-surface); color: var(--ui-ink); }
body.udoc-editor-shell #ai-panel .ai-head { height: 48px; padding: 0 10px 0 16px; border-bottom: .5px solid var(--ui-line-soft); background: var(--ui-surface); }
body.udoc-editor-shell #ai-panel .ai-head .ai-name { font-size: 14.5px; font-weight: 600; letter-spacing: 0; }
body.udoc-editor-shell #ai-panel .ai-head button { width: 30px; height: 30px; border-radius: 8px; color: var(--ui-ink-2); }
body.udoc-editor-shell #ai-panel .ai-head button:hover { background: var(--ui-hover); color: var(--ui-ink); }
body.udoc-editor-shell #ai-panel .ai-msgs { padding: 20px 20px 8px; scroll-padding-bottom: 24px; }

/* Empty conversation: a centred greeting and a short list of starting points. */
body.udoc-editor-shell #ai-panel .ai-msgs:not(:has(.ai-msg)) { display: flex; flex-direction: column; justify-content: center; }
body.udoc-editor-shell #ai-panel .ai-msgs:has(.ai-msg) :is(.ai-hello, .ai-chips) { display: none; }
body.udoc-editor-shell #ai-panel .ai-hello { align-items: flex-start; gap: 8px; margin: 0 4px 18px; }
body.udoc-editor-shell #ai-panel .ai-hello-logo { width: 36px; height: 36px; margin-bottom: 6px; }
body.udoc-editor-shell #ai-panel .ai-hello-h { font-size: 22px; font-weight: 600; letter-spacing: 0; color: var(--ui-ink); }
body.udoc-editor-shell #ai-panel .ai-hello-sub { font-size: 13px; line-height: 1.6; color: var(--ui-ink-2); }
body.udoc-editor-shell #ai-panel .ai-chips { flex-direction: column; flex-wrap: nowrap; gap: 6px; padding: 0; }
body.udoc-editor-shell #ai-panel .ai-chip {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%;
  padding: 11px 14px; border: .5px solid var(--ui-line); border-radius: 12px;
  background: var(--ui-surface); color: var(--ui-ink); text-align: left; box-shadow: none;
}
body.udoc-editor-shell #ai-panel .ai-chip:hover { background: var(--ui-surface-2); border-color: var(--ui-line); box-shadow: none; }
body.udoc-editor-shell #ai-panel .ai-chip-title { font-size: 13px; font-weight: 600; }
body.udoc-editor-shell #ai-panel .ai-chip-desc { font-size: 12px; color: var(--ui-ink-2); }

/* Turns. */
body.udoc-editor-shell #ai-panel .ai-msg { margin: 0 0 22px; gap: 0; }
body.udoc-editor-shell #ai-panel .ai-user { justify-content: flex-start; }
body.udoc-editor-shell #ai-panel .ai-user .ai-avatar { display: none; }
body.udoc-editor-shell #ai-panel .ai-user .ai-bubble {
  max-width: 86%; padding: 9px 14px; border-radius: 18px 18px 6px 18px;
  background: var(--ui-surface-2); color: var(--ui-ink); font-size: 14px; line-height: 1.6; box-shadow: none; border: 0;
}
body.udoc-editor-shell #ai-panel .ai-assistant { flex-direction: column; align-items: stretch; }
body.udoc-editor-shell #ai-panel .ai-assistant .ai-avatar {
  width: auto; height: 20px; margin: 0 0 6px; border-radius: 0; justify-content: flex-start; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--ui-ink-2); background: transparent;
}
body.udoc-editor-shell #ai-panel .ai-assistant .ai-avatar img { width: 18px; height: 18px; }
body.udoc-editor-shell #ai-panel .ai-assistant .ai-avatar::after { content: "U AI"; }
body.udoc-editor-shell #ai-panel .ai-assistant .ai-bubble {
  max-width: none; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none;
  font-size: 14.5px; line-height: 1.72; color: var(--ui-ink);
}

/* Answer typography. */
body.udoc-editor-shell #ai-panel .ai-md p { margin: 0 0 10px; }
body.udoc-editor-shell #ai-panel .ai-md :is(h1, h2, h3) { margin: 16px 0 8px; font-size: 15.5px; font-weight: 600; line-height: 1.45; }
body.udoc-editor-shell #ai-panel .ai-md > :is(h1, h2, h3):first-child { margin-top: 0; }
body.udoc-editor-shell #ai-panel .ai-md :is(ul, ol) { margin: 0 0 10px; padding-left: 1.4em; }
body.udoc-editor-shell #ai-panel .ai-md li { margin: 4px 0; }
body.udoc-editor-shell #ai-panel .ai-md li::marker { color: var(--ui-ink-2); }
body.udoc-editor-shell #ai-panel .ai-md :not(pre) > code {
  padding: 1px 5px; border-radius: 5px; background: var(--ui-fill); font-size: .9em;
  font-family: "Cascadia Code", Consolas, "SFMono-Regular", monospace;
}
body.udoc-editor-shell #ai-panel .ai-md blockquote { margin: 0 0 10px; padding: 2px 0 2px 12px; border-left: 3px solid var(--ui-line); color: var(--ui-ink-2); }
body.udoc-editor-shell #ai-panel .ai-md pre {
  margin: 8px 0 12px; padding: 14px 14px 14px; border-radius: 12px;
  background: #f6f7f9; color: #1f2329; border: .5px solid var(--ui-line);
  font: 12.5px/1.6 "Cascadia Code", Consolas, "SFMono-Regular", monospace; white-space: pre; overflow-x: auto;
}
body.udoc-editor-shell #ai-panel .ai-md pre[data-ai-copy-ready="1"] { padding-top: 36px; }
body.udoc-editor-shell #ai-panel .ai-code-copy {
  top: 6px; right: 6px; height: 24px; padding: 0 9px; border: 0; border-radius: 6px;
  background: transparent; color: var(--ui-ink-2); font-size: 11.5px; box-shadow: none;
}
body.udoc-editor-shell #ai-panel .ai-code-copy:hover { background: var(--ui-hover); color: var(--ui-ink); }
body.udoc-editor-shell #ai-panel .ai-md table { border-collapse: collapse; margin: 6px 0 12px; font-size: 13px; }
body.udoc-editor-shell #ai-panel .ai-md :is(th, td) { padding: 6px 10px; border-bottom: .5px solid var(--ui-line); text-align: left; }
body.udoc-editor-shell #ai-panel .ai-copy-row { justify-content: flex-start; gap: 2px; margin-top: 2px; opacity: .85; }
body.udoc-editor-shell #ai-panel :is(.ai-copy-answer, .ai-report-answer) { width: 28px; height: 28px; border-radius: 7px; color: var(--ui-ink-3); background: transparent; }
body.udoc-editor-shell #ai-panel :is(.ai-copy-answer, .ai-report-answer):hover { color: var(--ui-ink); background: var(--ui-hover); }
body.udoc-editor-shell #ai-panel .ai-think { border-radius: 10px; background: var(--ui-surface-2); border: 0; font-size: 12.5px; }

/* Waiting: the label shimmers instead of three dots. */
body.udoc-editor-shell #ai-panel .ai-pending { color: var(--ui-ink-2); font-size: 13.5px; }
body.udoc-editor-shell #ai-panel .ai-pending .ai-dots { display: none; }
body.udoc-editor-shell #ai-panel .ai-pending .ai-pending-text {
  background: linear-gradient(90deg, var(--ui-ink-3) 0%, var(--ui-ink) 45%, var(--ui-ink-3) 90%) 0 0 / 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: ai-shimmer 1.6s linear infinite;
}
@keyframes ai-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) {
  body.udoc-editor-shell #ai-panel .ai-pending .ai-pending-text { animation: none; color: var(--ui-ink-2); background: none; }
}

/* Composer: one rounded card, quiet until focused. */
body.udoc-editor-shell #ai-panel .ai-dock { padding: 8px 14px 10px; background: linear-gradient(180deg, rgba(255,255,255,0), var(--ui-surface) 24%); }
body.udoc-editor-shell #ai-panel .ai-composer {
  padding: 10px 10px 8px 14px; border: .5px solid var(--ui-line); border-radius: 22px;
  background: var(--ui-surface); box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 20px rgba(0,0,0,.06);
}
body.udoc-editor-shell #ai-panel .ai-composer:focus-within { border-color: color-mix(in srgb, var(--ui-accent) 55%, var(--ui-line)); box-shadow: 0 0 0 3px var(--ui-accent-weak), 0 6px 20px rgba(0,0,0,.06); }
body.udoc-editor-shell #ai-panel .ai-input { font-size: 14.5px; line-height: 1.55; padding: 2px 2px 8px; color: var(--ui-ink); }
body.udoc-editor-shell #ai-panel .ai-input::placeholder { color: var(--ui-ink-3); }
body.udoc-editor-shell #ai-panel .ai-composer-tools { gap: 4px; }
body.udoc-editor-shell #ai-panel :is(.ai-clip, .ai-shot) { height: 30px; min-width: 30px; border-radius: 15px; color: var(--ui-ink-2); background: transparent; }
body.udoc-editor-shell #ai-panel :is(.ai-clip, .ai-shot):hover { background: var(--ui-hover); color: var(--ui-ink); }
body.udoc-editor-shell #ai-panel .ai-modes { background: var(--ui-fill); border-radius: 15px; padding: 2px; }
body.udoc-editor-shell #ai-panel .ai-modes label { padding: 4px 11px; border-radius: 13px; color: var(--ui-ink-2); font-size: 12px; }
body.udoc-editor-shell #ai-panel .ai-modes label:has(input:checked) { background: var(--ui-surface); color: var(--ui-ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
body.udoc-editor-shell #ai-panel .ai-send { width: 32px; height: 32px; background-color: var(--ui-accent); }
body.udoc-editor-shell #ai-panel .ai-send:hover { transform: none; filter: brightness(1.06); }
body.udoc-editor-shell #ai-panel .ai-send:disabled { background-color: var(--ui-ink-3); }

/* ===== U AI in the 文献 reader's style (2026-10-13) =====
 * Same structure and bindings; this layer follows the papers workspace: the OmniDoc mark in the
 * header, answers on grey cards, the user's turn in system blue, suggestion cards on grey, and a
 * grey composer with a solid blue send button. */
body.udoc-editor-shell #ai-panel .ai-head { height: 50px; background: var(--ui-surface); }
body.udoc-editor-shell #ai-panel .ai-logo { width: 26px; height: 26px; }
body.udoc-editor-shell #ai-panel .ai-logo img { width: 26px; height: 26px; }
body.udoc-editor-shell #ai-panel .ai-head .ai-name { font-size: 15px; font-weight: 700; }
body.udoc-editor-shell #ai-panel .ai-msgs { padding: 16px 14px 8px; }
body.udoc-editor-shell #ai-panel .ai-hello { gap: 6px; margin: 0 2px 14px; }
body.udoc-editor-shell #ai-panel .ai-hello-logo { width: 40px; height: 40px; margin-bottom: 4px; }
body.udoc-editor-shell #ai-panel .ai-hello-logo img { width: 40px; height: 40px; }
body.udoc-editor-shell #ai-panel .ai-hello-h { font-size: 19px; font-weight: 700; }
body.udoc-editor-shell #ai-panel .ai-chips { gap: 8px; }
body.udoc-editor-shell #ai-panel .ai-chip {
  padding: 10px 12px; border: 0; border-radius: 10px; background: var(--ui-surface-2);
}
body.udoc-editor-shell #ai-panel .ai-chip:hover { background: var(--ui-accent-weak); border: 0; }
body.udoc-editor-shell #ai-panel .ai-chip:hover .ai-chip-title { color: var(--ui-accent); }

/* Turns: blue bubble for the user, grey card for U AI. */
body.udoc-editor-shell #ai-panel .ai-msg { margin: 0 0 14px; }
body.udoc-editor-shell #ai-panel .ai-user .ai-bubble {
  max-width: 88%; padding: 8px 12px; border-radius: 12px;
  background: var(--ui-accent); color: #fff; font-size: 14px; line-height: 1.6;
}
body.udoc-editor-shell #ai-panel .ai-user .ai-bubble :is(a, code) { color: #fff; }
body.udoc-editor-shell #ai-panel .ai-assistant .ai-avatar { margin: 0 0 5px 2px; }
body.udoc-editor-shell #ai-panel .ai-assistant .ai-bubble {
  padding: 11px 14px; border-radius: 12px; background: var(--ui-surface-2);
  font-size: 14px; line-height: 1.7;
}
body.udoc-editor-shell #ai-panel .ai-assistant .ai-md :not(pre) > code { background: rgba(118, 118, 128, .16); }
body.udoc-editor-shell #ai-panel .ai-assistant .ai-md pre { background: var(--ui-surface); }
body.udoc-editor-shell #ai-panel .ai-assistant .ai-think { background: var(--ui-surface); }
body.udoc-editor-shell #ai-panel .ai-copy-row { margin: 4px 0 0 2px; }

/* Composer: grey field, blue send. */
body.udoc-editor-shell #ai-panel .ai-dock { padding: 8px 14px 10px; background: var(--ui-surface); border-top: .5px solid var(--ui-line); }
body.udoc-editor-shell #ai-panel .ai-composer {
  padding: 9px 9px 7px 12px; border: 1px solid transparent; border-radius: 12px;
  background: var(--ui-surface-2); box-shadow: none;
}
body.udoc-editor-shell #ai-panel .ai-composer:focus-within {
  border-color: var(--ui-accent); background: var(--ui-surface); box-shadow: 0 0 0 3px var(--ui-accent-weak);
}
body.udoc-editor-shell #ai-panel .ai-input { background: transparent; }
body.udoc-editor-shell #ai-panel .ai-modes { background: var(--ui-fill); border-radius: 9px; }
body.udoc-editor-shell #ai-panel .ai-modes label { border-radius: 7px; }
body.udoc-editor-shell #ai-panel .ai-send { width: 36px; height: 32px; border-radius: 9px; }

/* 文件 menu and sheets (js/editor-shell.js), the approved iOS design: a frosted popover under the
   文件 tab in three groups with icons on the right and ▸ submenus, and centred sheets with a
   取消 / title / action bar over grouped white rows. Save As keeps to .udoc, Export to every
   other format. */
:root {
  --fm-ink: #1d1d1f; --fm-ink-2: #6e6e73; --fm-ink-3: #8e8e93; --fm-sep: rgba(60, 60, 67, .14);
  --fm-blue: #007aff; --fm-green: #34c759; --fm-fill: #f2f2f7;
  --fm-font: -apple-system, "Segoe UI Variable Text", "Segoe UI", "PingFang SC", "Microsoft YaHei UI", sans-serif;
}
.fm-menu {
  position: fixed; z-index: 1300; width: 268px; max-height: calc(100vh - 16px); overflow: auto; padding: 6px 0;
  border-radius: 14px; background: rgba(249, 249, 251, .88);
  -webkit-backdrop-filter: blur(30px) saturate(1.8); backdrop-filter: blur(30px) saturate(1.8);
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .12), 0 12px 40px rgba(0, 0, 0, .18);
  font: 15px/1.3 var(--fm-font); color: var(--fm-ink); animation: fm-in .12s ease-out;
}
.fm-menu[hidden] { display: none; }
.fm-menu:focus { outline: 0; }
#ribbon .rb-tab-file[aria-expanded="true"] { background: rgba(0, 122, 255, .12); color: var(--fm-blue); }
@keyframes fm-in { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
.fm-menu button {
  display: flex; align-items: center; gap: 10px; width: calc(100% - 12px); height: 42px; margin: 0 6px; padding: 0 10px;
  border: 0; border-radius: 8px; background: none; color: inherit; font: inherit; text-align: left; cursor: default;
}
.fm-menu button > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-menu button > small { color: var(--fm-ink-3); font-size: 13px; white-space: nowrap; }
.fm-menu button > svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.fm-menu button > svg.fm-chev { width: 15px; height: 15px; color: #aeaeb2; }
.fm-menu button > svg.fs-file { width: 22px; height: 27px; stroke: none; }
.fm-menu button:is(:focus, [aria-expanded="true"]) { background: var(--fm-blue); color: #fff; outline: 0; }
.fm-menu button:is(:focus, [aria-expanded="true"]) > :is(small, svg.fm-chev) { color: #fff; }
.fm-menu button:disabled { color: var(--fm-ink-3); background: none; }
.fm-menu hr { height: 7px; margin: 5px 0; border: 0; background: rgba(0, 0, 0, .06); }
.fm-menu .fm-note { margin: 0; padding: 10px 16px; color: var(--fm-ink-2); font-size: 13px; line-height: 1.45; }
.fm-menu button.fm-recent { height: auto; min-height: 42px; padding: 6px 10px; }
.fm-menu button.fm-recent > span small { display: block; color: var(--fm-ink-3); font-size: 12px; }
.fm-menu button.fm-recent:focus > span small { color: rgba(255, 255, 255, .8); }

/* Sheets. */
#file-sheet {
  position: fixed; inset: 0; z-index: 1300; display: grid; place-items: start center; padding: 9vh 16px 16px;
  background: rgba(0, 0, 0, .28); font: 15px/1.35 var(--fm-font); color: var(--fm-ink); animation: fm-fade .14s ease-out;
}
#file-sheet[hidden] { display: none; }
@keyframes fm-fade { from { opacity: 0; } to { opacity: 1; } }
#file-sheet .fs-panel {
  width: min(540px, 100%); max-height: 82vh; overflow: auto; border-radius: 14px; background: var(--fm-fill);
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .1), 0 24px 70px rgba(0, 0, 0, .28); animation: fm-rise .2s cubic-bezier(.2, .8, .2, 1);
}
@keyframes fm-rise { from { transform: translateY(14px); opacity: .6; } to { transform: none; opacity: 1; } }
#file-sheet button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
#file-sheet button:focus-visible, #file-sheet input:focus-visible { outline: 2px solid var(--fm-blue); outline-offset: 2px; }
#file-sheet .fs-bar {
  position: sticky; top: 0; z-index: 1; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 52px; padding: 0 8px;
  background: rgba(249, 249, 251, .94); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); border-bottom: .5px solid rgba(60, 60, 67, .18);
}
#file-sheet .fs-bar b { font-size: 16px; font-weight: 600; }
#file-sheet .fs-bar button { justify-self: start; height: 36px; padding: 0 10px; border-radius: 8px; color: var(--fm-blue); }
#file-sheet .fs-bar button.fs-go { justify-self: end; font-weight: 600; }
#file-sheet .fs-bar button:hover { background: rgba(0, 122, 255, .08); }
#file-sheet .fs-bar button:disabled { color: var(--fm-ink-3); background: none; cursor: default; }
#file-sheet .fs-body { padding: 18px 16px 22px; }
#file-sheet .fs-hero { display: flex; align-items: center; gap: 14px; margin: 2px 4px 18px; min-width: 0; }
#file-sheet .fs-hero svg.fs-file { width: 44px; height: 54px; flex: none; filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, .12)); }
#file-sheet .fs-hero > div { min-width: 0; }
#file-sheet .fs-hero b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; font-weight: 600; }
#file-sheet .fs-hero small { color: var(--fm-ink-2); font-size: 13px; }
#file-sheet .fs-cap { margin: 0 16px 6px; font-size: 12.5px; color: var(--fm-ink-2); letter-spacing: .02em; }
#file-sheet .fs-group { margin-bottom: 18px; border-radius: 12px; overflow: hidden; background: #fff; }
#file-sheet .fs-group:last-child { margin-bottom: 0; }
#file-sheet .fs-row { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 6px 16px; box-shadow: 0 .5px 0 var(--fm-sep); }
#file-sheet .fs-row:last-child { box-shadow: none; }
#file-sheet .fs-row > .fs-k { width: 64px; flex: none; }
#file-sheet .fs-row > .fs-v { flex: 1; min-width: 0; }
#file-sheet .fs-row > .fs-m { margin-left: auto; color: var(--fm-ink-3); }
#file-sheet .fs-row input[type="text"] {
  flex: 1; min-width: 0; height: 34px; padding: 0; border: 0; background: none; color: var(--fm-ink); font: inherit; outline: 0;
}
#file-sheet .fs-row input[type="text"]:focus-visible { outline: 0; }
#file-sheet .fs-row:has(input:focus) { box-shadow: inset 0 0 0 2px rgba(0, 122, 255, .35); border-radius: 12px; }
#file-sheet .fs-suffix { color: var(--fm-ink-3); }
#file-sheet .fs-seg { display: inline-flex; flex-wrap: wrap; margin-left: auto; padding: 2px; border-radius: 9px; background: rgba(118, 118, 128, .12); }
#file-sheet .fs-seg button { height: 28px; padding: 0 13px; border-radius: 7px; font-size: 13px; }
#file-sheet .fs-seg button[aria-checked="true"] { background: #fff; font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
#file-sheet .fs-switch { position: relative; flex: none; width: 51px; height: 31px; margin-left: auto; border-radius: 16px; background: #e9e9eb !important; transition: background-color .2s; }
#file-sheet .fs-switch::after {
  content: ""; position: absolute; left: 2px; top: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .15), 0 1px 1px rgba(0, 0, 0, .16); transition: transform .2s;
}
#file-sheet .fs-switch[aria-checked="true"] { background: var(--fm-green) !important; }
#file-sheet .fs-switch[aria-checked="true"]::after { transform: translateX(20px); }
#file-sheet .fs-foot { margin: -10px 16px 0; color: var(--fm-ink-2); font-size: 12.5px; line-height: 1.45; }
#file-sheet .fs-error { margin: 0 4px 14px; padding: 10px 12px; border-radius: 10px; background: #fff1f0; color: #c4291c; font-size: 13px; }
@media (max-width: 560px) {
  #file-sheet { padding: 0; place-items: end stretch; }
  #file-sheet .fs-panel { width: 100%; max-height: 92vh; border-radius: 14px 14px 0 0; }
  #file-sheet .fs-row > .fs-k { width: 56px; }
}
/* 打印: OmniDoc's print dialog as Chrome's, centred in the window. */
#print-sheet {
  --ps-ink: #1f1f1f; --ps-ink-2: #474747; --ps-line: #c7c7c7; --ps-sep: #e3e3e3; --ps-blue: #0b57d0; --ps-pane: #e3e3e3; --ps-red: #b3261e;
  position: fixed; inset: 0; z-index: 1300; display: grid; place-items: center; padding: 24px;
  background: rgba(0, 0, 0, .32); color: var(--ps-ink); animation: fm-fade .14s ease-out;
  font: 13px/1.54 "Segoe UI", system-ui, -apple-system, "Microsoft YaHei UI", "PingFang SC", sans-serif;
}
#print-sheet[hidden] { display: none; }
#print-sheet .ps-dialog {
  display: grid; grid-template-columns: minmax(0, 1fr) 384px; width: min(1240px, 100%); height: min(880px, calc(100vh - 48px));
  overflow: hidden; border-radius: 8px; background: #fff; box-shadow: 0 2px 6px 2px rgba(0, 0, 0, .15), 0 1px 2px rgba(0, 0, 0, .3);
}
#print-sheet .ps-view { position: relative; min-width: 0; min-height: 0; }
#print-sheet .ps-preview { position: relative; height: 100%; min-width: 0; overflow: auto; background: var(--ps-pane); }
#print-sheet .ps-preview iframe { display: block; width: 100%; height: 100%; border: 0; }
#print-sheet .ps-pages { display: flex; flex-direction: column; align-items: safe center; gap: 16px; padding: 16px 24px 72px; width: max-content; min-width: 100%; box-sizing: border-box; }
#print-sheet .ps-page {
  position: relative; flex: none; overflow: hidden; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 1px 3px 1px rgba(0, 0, 0, .15);
  --user-unit: 1; --total-scale-factor: calc(var(--scale-factor) * var(--user-unit)); --scale-round-x: 1px; --scale-round-y: 1px;
}
#print-sheet .ps-pages[data-fit] { width: auto; }
#print-sheet .ps-pages[data-fit] .ps-page { max-width: 100%; }
#print-sheet .ps-page canvas { display: block; width: 100%; height: 100%; }
/* Zoom, floating at the bottom of the preview as in Chrome's PDF viewer. */
#print-sheet .ps-zoom {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; align-items: center; gap: 2px; padding: 4px;
  border-radius: 999px; background: rgba(32, 33, 36, .86); color: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .25); z-index: 2;
}
#print-sheet .ps-zoom[hidden] { display: none; }
#print-sheet .ps-zoom button { width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: inherit; font-size: 18px; line-height: 1; cursor: pointer; }
#print-sheet .ps-zoom button:hover:not(:disabled) { background: rgba(255, 255, 255, .14); }
#print-sheet .ps-zoom button:disabled { opacity: .38; cursor: default; }
#print-sheet .ps-zoom #ps-zoom { -webkit-appearance: none; appearance: none; height: 32px; min-width: 96px; padding: 0 12px; border: 0; border-radius: 16px; background: transparent; color: #fff; font: 500 13px/32px inherit; font-family: inherit; text-align: center; text-align-last: center; cursor: pointer; }
#print-sheet .ps-zoom #ps-zoom:hover { background: rgba(255, 255, 255, .14); }
#print-sheet .ps-zoom #ps-zoom:focus { border: 0; box-shadow: none; }
#print-sheet .ps-zoom option { color: #1f1f1f; background: #fff; }
#print-sheet .ps-zoom :is(button, select):focus-visible { outline: 2px solid #8ab4f8; outline-offset: 1px; }
/* PDF.js 5.6.205's text layer (web/pdf_viewer.css): transparent text over the drawn page, selectable. */
#print-sheet .textLayer {
  position: absolute; inset: 0; overflow: clip; opacity: 1; line-height: 1; text-align: initial; text-size-adjust: none; forced-color-adjust: none;
  transform-origin: 0 0; caret-color: CanvasText; z-index: 0; color-scheme: only light;
  --min-font-size: 1; --text-scale-factor: calc(var(--total-scale-factor) * var(--min-font-size)); --min-font-size-inv: calc(1 / var(--min-font-size));
}
#print-sheet .textLayer :is(span, br) { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; }
#print-sheet .textLayer > :not(.markedContent), #print-sheet .textLayer .markedContent span:not(.markedContent) {
  z-index: 1; --font-height: 0; font-size: calc(var(--text-scale-factor) * var(--font-height));
  --scale-x: 1; --rotate: 0deg; transform: rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv));
}
#print-sheet .textLayer .markedContent { display: contents; }
#print-sheet .textLayer span[role="img"] { user-select: none; cursor: default; }
#print-sheet .textLayer ::selection { background: rgba(0 0 255 / .25); background: color-mix(in srgb, AccentColor, transparent 75%); }
#print-sheet .textLayer br::selection { background: transparent; }
#print-sheet .textLayer .endOfContent { display: block; position: absolute; inset: 100% 0 0; z-index: 0; cursor: default; user-select: none; }
#print-sheet .textLayer.selecting .endOfContent { top: 0; }
#print-sheet .ps-wait { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0; padding: 24px; color: var(--ps-ink-2); text-align: center; }
#print-sheet .ps-spin { width: 20px; height: 20px; flex: none; border: 2px solid #d3e3fd; border-top-color: var(--ps-blue); border-radius: 50%; animation: ps-spin .8s linear infinite; }
@keyframes ps-spin { to { transform: rotate(360deg); } }
#print-sheet .ps-side { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #fff; }
#print-sheet .ps-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; padding: 16px 24px 0; }
#print-sheet .ps-head h2 { margin: 0; font-size: 16px; font-weight: 400; color: var(--ps-ink); }
#print-sheet .ps-count { font-size: 13px; font-weight: 500; color: var(--ps-ink); white-space: nowrap; }
#print-sheet .ps-settings { flex: 1; min-height: 0; overflow: auto; }
#print-sheet .ps-group { padding: 4px 0 12px; }
#print-sheet .ps-more-group { padding: 4px 0; border-top: 1px solid var(--ps-sep); }
#print-sheet .ps-row { display: grid; grid-template-columns: minmax(0, 1fr) 192px; align-items: start; gap: 16px; padding: 9px 24px; }
#print-sheet .ps-label { padding-top: 8px; color: var(--ps-ink); }
#print-sheet .ps-control { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
#print-sheet :is(select, input[type="text"], input[type="number"]) {
  box-sizing: border-box; width: 100%; height: 36px; margin: 0; padding: 0 12px; border: 1px solid var(--ps-line); border-radius: 8px;
  background-color: #fff; color: var(--ps-ink); font: inherit; outline: none;
}
#print-sheet select { appearance: none; padding-right: 32px; cursor: pointer; text-overflow: ellipsis; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M1.5 3.5h7L5 7.5z' fill='%23474747'/%3E%3C/svg%3E") no-repeat right 12px center / 10px; }
#print-sheet select.ps-dest { padding-left: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5.5 2h6l4 4v11a1 1 0 0 1-1 1h-9a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1z' fill='%23474747'/%3E%3Cpath d='M11.5 2v4h4' fill='%23c7c7c7'/%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M1.5 3.5h7L5 7.5z' fill='%23474747'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 10px center, right 12px center; background-size: 20px, 10px; }
#print-sheet select.ps-dest.is-printer { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M6 2.5h8V6H6z' fill='%23474747'/%3E%3Crect x='2.5' y='6.5' width='15' height='7.5' rx='1.5' fill='%23474747'/%3E%3Cpath d='M6 11.5h8v6H6z' fill='%23fff' stroke='%23474747' stroke-width='1.2'/%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M1.5 3.5h7L5 7.5z' fill='%23474747'/%3E%3C/svg%3E"); }
#print-sheet :is(select, input):hover:not(:disabled) { background-color: #f8f8f8; }
#print-sheet :is(select, input[type="text"], input[type="number"]):focus { border-color: var(--ps-blue); box-shadow: 0 0 0 1px var(--ps-blue); }
#print-sheet input[aria-invalid="true"] { border-color: var(--ps-red); box-shadow: 0 0 0 1px var(--ps-red); }
#print-sheet .ps-hint { margin-top: -4px; color: var(--ps-red); font-size: 12px; }
#print-sheet :is(select, input):disabled { color: #8f8f8f; border-color: #e3e3e3; cursor: default; }
#print-sheet .ps-check { display: flex; align-items: center; gap: 10px; min-height: 36px; width: fit-content; cursor: pointer; }
#print-sheet .ps-check input { flex: none; width: 16px; height: 16px; margin: 0; accent-color: var(--ps-blue); cursor: pointer; }
#print-sheet .ps-more { display: flex; align-items: center; justify-content: space-between; width: 100%; height: 56px; padding: 0 24px; border: 0; background: none; color: var(--ps-ink); font: inherit; cursor: pointer; }
#print-sheet .ps-more:hover { background: #f8f8f8; }
#print-sheet .ps-more svg { width: 16px; height: 16px; fill: none; stroke: var(--ps-ink); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
#print-sheet .ps-more[aria-expanded="true"] svg { transform: rotate(180deg); }
#print-sheet .ps-note { margin: 8px 24px 0; padding: 8px 12px; border-radius: 8px; background: #f9dedc; color: #8c1d18; }
#print-sheet .ps-note.ok { background: #c4eed0; color: #0d652d; }
#print-sheet .ps-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px 24px; }
#print-sheet .ps-actions button { min-width: 72px; height: 36px; padding: 0 16px; border-radius: 18px; font: inherit; font-weight: 500; cursor: pointer; }
#print-sheet .ps-primary { border: 0; background: var(--ps-blue); color: #fff; }
#print-sheet .ps-primary:hover:not(:disabled) { background: #0b4fbd; box-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 1px 3px 1px rgba(0, 0, 0, .15); }
#print-sheet .ps-primary:disabled { background: rgba(31, 31, 31, .12); color: rgba(31, 31, 31, .38); cursor: default; }
#print-sheet .ps-secondary { border: 1px solid var(--ps-line); background: #fff; color: var(--ps-blue); }
#print-sheet .ps-secondary:hover { background: rgba(11, 87, 208, .06); }
#print-sheet :is(button, .ps-check input):focus-visible { outline: 2px solid var(--ps-blue); outline-offset: 2px; }
@media (max-width: 760px) {
  #print-sheet { padding: 0; }
  #print-sheet .ps-dialog { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); width: 100%; height: 100%; border-radius: 0; }
  #print-sheet .ps-side { border-top: 1px solid var(--ps-sep); }
}
@media print { #print-sheet { display: none !important; } }
/* The screen's lines kept for the client's print (pinScreenLines in editor-shell.js): present only
   while the PDF is drawn, and only in print media, so the screen's own layout (and its pagination,
   which beforeprint re-checks) never moves. */
#pages .ud-print-strut { display: none; }
@media print {
  #pages .ud-print-pin { white-space: nowrap !important; }
  #pages .ud-print-strut { display: inline-block !important; width: 0; vertical-align: top; }
  #pages .ud-print-pin-lh { line-height: var(--ud-pin-lh) !important; }
  #pages .ud-print-adv { letter-spacing: var(--ud-adv) !important; }
  #pages .ud-print-pin-pre { white-space: pre !important; }
  #pages .ud-print-pin-justify { text-align-last: justify !important; }
  #pages .ud-print-pin-justify br[data-print-pin] { font-size: 0; letter-spacing: 0; }
  #pages .ud-print-pin-justify .ud-tbr-final-line[data-print-pin] {
    display: inline-block; max-inline-size: 100%; white-space: nowrap; text-align: justify; text-align-last: auto; text-indent: 0;
  }
}
@media print { .fm-menu, #file-sheet { display: none !important; } }
