/* app.css — Word chrome: title bar, ribbon, backstage, status bar, dialogs */
@font-face {
  font-family: 'Selawik';
  src: url('../fonts/Selawik-Regular.woff') format('woff');
  font-weight: 400;
}
@font-face {
  font-family: 'Selawik';
  src: url('../fonts/Selawik-Bold.woff') format('woff');
  font-weight: 700;
}

:root {
  --word-blue: #2B579A;
  --word-blue-dark: #1E4478;
  --word-blue-hover: #3A6BB0;
  --ribbon-bg: #F3F3F3;
  --group-bg: #FFFFFF;
  --group-label: #666666;
  --hover: #E5F1FB;
  --pressed: #CCE4F7;
  --checked: #D6E8F7;
  --border: #D4D4D4;
  --border-soft: #E1DFDD;
  --text: #201F1E;
  --text-dim: #605E5C;
  --ui-font: 'Segoe UI', 'Selawik', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  --focus-ring: 1px solid #2B579A;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; }
body {
  font-family: var(--ui-font);
  font-size: 12.5px;
  color: var(--text);
  background: #E1E1E1;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
#word-app { display: flex; flex-direction: column; height: 100vh; min-width: 760px; }
button { font-family: inherit; font-size: inherit; color: inherit; background: none; border: none; padding: 0; cursor: default; }
:focus { outline: none; }
button:focus-visible, .menu-item:focus-visible, .tab:focus-visible, .nav-tab:focus-visible, .dlg-btn:focus-visible,
.toc-row:focus-visible, .swatch:focus-visible, .sym:focus-visible, .opt-tab:focus-visible, .shape-tile:focus-visible,
.stock-tile:focus-visible, .style-tile:focus-visible, [role="menuitem"]:focus-visible, .ruler-mark:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible, [contenteditable="true"]:focus-visible, .sel:focus-visible,
.tg-cell:focus-visible, .bs-tpl:focus-visible, .bs-nav-item:focus-visible, .bs-back:focus-visible, .bs-pill:focus-visible,
.bs-recent:focus-visible, .bs-save-opt:focus-visible, .qat-btn:focus-visible, .tb-btn:focus-visible, .st-views button:focus-visible,
.st-zoom-pct:focus-visible, .wc:focus-visible, .hf-close:focus-visible, .balloon-x:focus-visible, .sg-more:focus-visible,
.theme-tile:focus-visible, .table-style-tile:focus-visible, .pen-tile:focus-visible, .mini-toolbar .mt-btn:focus-visible, .dd-caret-btn:focus-visible {
  outline: 2px solid #2B579A;
  outline-offset: 1px;
}
input[type="range"]:focus-visible { outline-offset: 3px; }

/* ============ title bar ============ */
#titlebar {
  height: 34px;
  background: var(--word-blue);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 0 0 2px;
  gap: 2px;
  flex: none;
}
#titlebar::before {
  content: '';
  width: 16px; height: 16px;
  margin: 0 6px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect width='24' height='24' rx='3' fill='%23ffffff' fill-opacity='.15'/%3E%3Ctext x='12' y='17' font-family='Segoe UI' font-weight='700' font-size='14' fill='white' text-anchor='middle'%3EW%3C/text%3E%3C/svg%3E") center/contain no-repeat;
}
#qat { display: flex; align-items: center; gap: 0; }
.qat-btn {
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 2px;
  color: #fff;
}
.qat-btn:hover { background: rgba(255,255,255,.16); }
.qat-btn:active { background: rgba(255,255,255,.28); }
.qat-btn.disabled { opacity: .4; }
.qat-btn .ic svg { width: 15px; height: 15px; }
#titlebar-center { flex: 1; display: flex; align-items: center; justify-content: center; gap: 14px; min-width: 0; }
#doc-title { color: #fff; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }
#titlebar-search {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.14);
  height: 22px; min-width: 200px; max-width: 320px; flex: 1;
  border-radius: 2px; padding: 0 8px;
}
#titlebar-search:focus-within { background: #fff; }
#titlebar-search:focus-within input { color: var(--text); }
#titlebar-search:focus-within .tb-search-icon { filter: none; }
.tb-search-icon {
  width: 12px; height: 12px; flex: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='6.5' cy='6.5' r='4.5' fill='none' stroke='white' stroke-width='1.4'/%3E%3Cpath d='M10 10l4 4' stroke='white' stroke-width='1.4'/%3E%3C/svg%3E") center/contain no-repeat;
}
#titlebar-search:focus-within .tb-search-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='6.5' cy='6.5' r='4.5' fill='none' stroke='%232B579A' stroke-width='1.4'/%3E%3Cpath d='M10 10l4 4' stroke='%232B579A' stroke-width='1.4'/%3E%3C/svg%3E");
}
#search-box { background: none; border: none; color: #fff; font-family: inherit; font-size: 12px; flex: 1; outline: none; }
#search-box::placeholder { color: rgba(255,255,255,.75); }
#titlebar-search:focus-within #search-box::placeholder { color: #999; }
.tb-search-hint { color: rgba(255,255,255,.6); font-size: 10px; }
#titlebar-right { display: flex; align-items: center; gap: 4px; padding-right: 2px; }
.tb-btn {
  height: 26px; padding: 0 9px; border-radius: 2px;
  display: inline-flex; align-items: center; gap: 6px;
  color: #fff; font-size: 12px;
  border: 1px solid rgba(255,255,255,.32);
}
.tb-btn.sq { width: 28px; padding: 0; justify-content: center; }
.tb-btn:hover { background: rgba(255,255,255,.22); border-color: rgba(255,255,255,.45); }
.tb-btn:active { background: rgba(255,255,255,.32); }
.tb-btn .ic svg { width: 14px; height: 14px; }
.tb-badge { background: #C74005; font-size: 9px; border-radius: 8px; padding: 0 4px; line-height: 14px; }
#btn-autosave { opacity: .95; }
#btn-autosave .as-toggle {
  width: 24px; height: 12px; border-radius: 6px; background: rgba(255,255,255,.4);
  position: relative; transition: background .15s;
}
#btn-autosave .as-toggle::after {
  content: ''; position: absolute; top: 1px; left: 1px; width: 10px; height: 10px;
  border-radius: 50%; background: #fff; transition: left .15s;
}
#btn-autosave.on .as-toggle { background: #6BB700; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
#btn-autosave.on .as-toggle::after { left: 13px; }
.win-controls { display: flex; height: 34px; margin-left: 4px; }
.wc { width: 44px; height: 100%; display: inline-flex; align-items: center; justify-content: center; }
.wc:hover { background: rgba(255,255,255,.18); }
.wc.close:hover { background: #E81123; }
.wc span { display: block; width: 10px; height: 10px; opacity: .9; }
#wc-min span { background: linear-gradient(to bottom, transparent 4px, #fff 4px, #fff 6px, transparent 6px); }
#wc-max span { border: 1px solid #fff; border-top-width: 2px; width: 9px; height: 8px; }
#wc-close span { position: relative; }
#wc-close span::before, #wc-close span::after {
  content: ''; position: absolute; width: 11px; height: 1.2px; background: #fff; top: 4px; left: -1px;
}
#wc-close span::before { transform: rotate(45deg); }
#wc-close span::after { transform: rotate(-45deg); }

/* ============ ribbon tabs ============ */
#ribbon-tabs {
  height: 30px;
  background: #fff;
  display: flex; align-items: stretch;
  padding: 0 0 0 4px;
  border-bottom: 1px solid #d9d9d9;
  flex: none;
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none;
}
#ribbon-tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 0 11px;
  font-size: 12.5px;
  color: #444;
  display: inline-flex; align-items: center;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  position: relative;
}
.tab:hover { color: #000; background: #F5F5F5; }
.tab.active { color: #000; border-bottom-color: var(--word-blue); }
.tab:focus-visible { box-shadow: inset 0 0 0 1px var(--word-blue); }
.file-tab {
  background: var(--word-blue);
  color: #fff;
  margin: 0 6px 0 0;
  border-radius: 0 0 3px 3px;
  height: 100%;
}
.file-tab:hover { background: var(--word-blue-hover); color: #fff; }
.tab-help { margin-left: auto; color: #2B579A; padding: 0 10px; }
.tabs-spring { flex: 1; }

/* ============ ribbon ============ */
#ribbon { background: var(--ribbon-bg); border-bottom: 1px solid #D9D9D9; flex: none; position: relative; }
#ribbon-scroll { overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
#ribbon.collapsed #ribbon-strip { display: none; }
#ribbon.collapsed { border-bottom: none; }
/* Real Word: ~96px ribbon content = three 22-24px control rows + 14px group-label strip */
#ribbon-strip { display: flex; align-items: stretch; padding: 3px 6px 0; min-height: 96px; }
.group { display: flex; flex-direction: column; padding: 0 1px; flex: 0 1 auto; }
.group-content {
  flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 1px;
  background: var(--group-bg); border: 1px solid #E9E9E9; border-radius: 3px;
  padding: 3px 6px 2px; margin: 2px 1px 0;
}
.rrow { display: flex; align-items: center; gap: 1px; height: 24px; flex: none; }
.rrow.wide { gap: 2px; }
.rcol { display: flex; flex-direction: column; gap: 0; justify-content: center; }
.group-label {
  font-size: 10px; color: #666;
  text-align: center; padding: 2px 12px 0; height: 14px; line-height: 12px;
  position: relative;
  white-space: nowrap; overflow: visible;
}
.dialog-launcher {
  position: absolute; right: 1px; top: 1px;
  width: 11px; height: 11px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 8'%3E%3Cpath d='M0 2 L5 7 L10 2' fill='none' stroke='%23777' stroke-width='1.2' transform='rotate(-45 5 4)' /%3E%3C/svg%3E") center/8px no-repeat;
}
.dialog-launcher:hover { background-color: var(--hover); border-radius: 2px; }
.group-sep { width: 1px; background: #D4D4D4; margin: 5px 4px; flex: none; }

/* buttons */
.btn { border-radius: 2px; display: inline-flex; align-items: center; justify-content: center; position: relative; }
.btn:hover:not(.disabled) { background: var(--hover); }
.btn:active:not(.disabled) { background: var(--pressed); }
.btn.checked { background: var(--checked); box-shadow: inset 0 0 0 1px #9CC3E5; }
.btn.disabled { opacity: .4; cursor: default; }
.btn:focus-visible { box-shadow: 0 0 0 1px var(--word-blue); }
.ic svg { shape-rendering: geometricPrecision; }
/* vertical icon-over-label button (Insert/Draw/etc. big-small) */
.small-btn { flex-direction: column; gap: 1px; padding: 3px 5px 1px; min-width: 44px; max-width: 84px; flex: 0 1 auto; }
.small-btn .btn-label {
  font-size: 10px; line-height: 1.08; text-align: center; color: #333;
  white-space: normal; overflow: hidden; max-width: 72px;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow-wrap: break-word;
}
.small-btn .ic { width: 23px; height: 23px; flex: none; }
.small-btn .ic svg { width: 23px; height: 23px; }
/* horizontal icon-left label-right button for Home stacks (Word Clipboard/Editing) */
.stack-btn { flex-direction: row; gap: 5px; height: 22px; padding: 0 7px 0 4px; min-width: 74px; max-width: 118px; justify-content: flex-start; }
.stack-btn .ic { width: 16px; height: 16px; flex: none; }
.stack-btn .ic svg { width: 16px; height: 16px; }
.stack-btn .btn-label { font-size: 11px; color: #333; white-space: nowrap; }
.stack-btn .dd-caret { margin-left: auto; }
/* icon-only 22px control (Font/Paragraph rows) */
.tiny-btn { width: 22px; height: 22px; margin: 0; flex: none; }
.tiny-btn .ic { width: 16px; height: 16px; }
.tiny-btn .ic svg { width: 16px; height: 16px; }
.glyph { font-size: 12.5px; line-height: 1; font-family: Georgia, 'Times New Roman', serif; }
.tiny-btn.underline .glyph { text-decoration: underline; }
.tiny-btn.bold .glyph { font-weight: 700; font-family: var(--ui-font); font-size: 13px; }
.tiny-btn.italic .glyph { font-style: italic; font-family: var(--ui-font); font-size: 13px; }
.pilcrow-btn .glyph { font-family: var(--ui-font); font-size: 13px; }
.split { display: inline-flex; align-items: stretch; height: 22px; flex: none; }
.split .tiny-btn { border-radius: 2px 0 0 2px; }
.split .tiny-btn .glyph { padding-right: 1px; }
.split-arrow {
  width: 12px; border-radius: 0 2px 2px 0;
  display: inline-flex; align-items: center; justify-content: center;
  position: relative; border-left: 1px solid transparent;
}
.split:hover .split-arrow { border-left-color: #E0E0E0; }
.split-arrow:hover { background: var(--hover); }
.split-arrow .dd-caret { border-color: #555; }
.split-big { flex-direction: row; align-items: stretch; height: auto; }
.split-big .big-main { flex-direction: column; gap: 1px; padding: 3px 7px 2px; border-radius: 2px 0 0 2px; min-width: 46px; }
.split-big .big-main .ic { width: 27px; height: 27px; }
.split-big .big-main .ic svg { width: 27px; height: 27px; }
.split-big .big-main .btn-label { font-size: 10.5px; color: #333; }
.split-big .split-arrow { width: 12px; height: auto; border-left: 1px solid #E0E0E0; }
.split .tiny-btn:hover:not(.disabled), .split-big .big-main:hover:not(.disabled) { background: transparent; }
.split:hover { background: var(--hover); border-radius: 2px; }
.split.checked { background: var(--checked); box-shadow: inset 0 0 0 1px #9CC3E5; }
.color-strip { position: absolute; bottom: 1px; left: 2px; right: 2px; height: 3px; border: 1px solid rgba(0,0,0,.2); }
.split:not(.split-big) .color-strip { bottom: 1px; }
.dd-caret {
  width: 0; height: 0; display: inline-block; flex: none;
  border-left: 3px solid transparent; border-right: 3px solid transparent;
  border-top: 3.5px solid #666;
}
.dd-caret.white { border-top-color: #fff; }
.dropdown-btn { gap: 1px; }
.dropdown-btn .dd-caret { position: absolute; right: 4px; top: 50%; margin-top: 7px; }
.combo { display: inline-flex; background: #fff; border: 1px solid #C8C8C8; border-radius: 2px; height: 22px; flex: none; }
.combo input {
  border: none; outline: none; font-family: inherit; font-size: 11.5px;
  padding: 0 3px 0 5px; min-width: 0; background: none; color: var(--text);
  user-select: text;
}
.combo-btn { width: 16px; display: inline-flex; align-items: center; justify-content: center; border-left: 1px solid #E6E6E6; height: 20px; align-self: center; margin: 0 1px 0 0; }
.combo-btn .dd-caret { border-top-width: 3px; }
.combo-btn:hover { background: var(--hover); }
.font-combo { width: 138px; }
.size-combo { width: 45px; }

/* styles gallery — Word-size chips, ~7 visible then clipped (more dropdown) */
.styles-gallery { display: flex; align-items: stretch; gap: 2px; max-width: 555px; }
.sg-row { display: flex; gap: 1px; overflow: hidden; max-width: 536px; }
.style-tile {
  width: 75px; height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  border: 1px solid #D6D6D6; border-radius: 2px; padding: 4px 2px 2px; gap: 1px;
  background: #fff; flex: none;
}
.style-tile:hover { border-color: #2B579A; background: #F3F8FD; }
.st-demo { line-height: 1.15; max-width: 70px; overflow: hidden; }
.st-box { width: 88%; border-top: 1px solid #C8C8C8; height: 0; margin: 2px 0 1px; }
.style-tile .st-box { border-top-color: transparent; }
.st-name { font-size: 9.5px; color: #444; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 71px; }
.sg-more { width: 14px; display: flex; align-items: center; justify-content: center; border-radius: 2px; border: 1px solid #E0E0E0; }
.sg-more:hover { background: var(--hover); }
.theme-tile { width: 74px; display: flex; flex-direction: column; align-items: center; gap: 0; padding: 5px 2px 2px; border: 1px solid #D6D6D6; border-radius: 2px; background: #fff; }
.theme-tile:hover { border-color: #2B579A; background: #F3F8FD; }
.tt-h { font-size: 15px; font-weight: 600; color: #0F4761; }
.tt-t { font-size: 11px; color: #333; }
.pen-tile { flex-direction: column; gap: 0; padding: 3px 6px 2px; min-width: 52px; }
.pen-swatch { width: 26px; height: 16px; border-radius: 2px; border: 1px solid rgba(0,0,0,.25); }
.pen-label { font-size: 10px; color: #333; margin-top: 2px; }
.table-style-tile { flex-direction: column; padding: 4px 5px 2px; gap: 2px; border: 1px solid transparent; border-radius: 2px; }
.table-style-tile:hover { border-color: #9CC3E5; background: var(--hover); }
.ts-prev { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; }
.ts-prev i { width: 16px; height: 7px; background: #fff; border: 1px solid #999; display: block; }
.ts-prev i.light { background: #DEEBF7; }
.ts-prev i.banded { background: #BDD7EE; border-color: #7FA8CC; }
.ts-prev i.none { border-color: transparent; }

/* ============ subchrome (ruler row) ============ */
#subchrome { background: #F3F3F3; flex: none; border-bottom: 1px solid #D9D9D9; }
#ruler-row { display: flex; align-items: stretch; height: 22px; }
#tab-select {
  width: 16px; border-right: 1px solid #D5D5D5; color: #666; font-size: 8px;
  display: flex; align-items: center; justify-content: center; flex: none;
}
#tab-select:hover { background: var(--hover); }
#ruler {
  flex: 1; position: relative; overflow: hidden;
  background: linear-gradient(to right, #C9C9C9 0, #C9C9C9 var(--ruler-mleft, 999px), #FFFFFF var(--ruler-mleft, 999px), #FFFFFF var(--ruler-mright, 0px), #C9C9C9 var(--ruler-mright, 0px));
  border-bottom: 1px solid #B8B8B8;
}
.ruler-ticks { position: absolute; inset: 0; }
.rt { position: absolute; top: 0; width: 1px; background: #8C8C8C; }
.rt-i { height: 10px; }
.rt-h { height: 7px; }
.rt-q { height: 4px; background: #ABABAB; }
.rn { position: absolute; top: 10px; font-size: 8.5px; color: #555; transform: translateX(-50%); }
.ruler-mark {
  position: absolute; top: 12px; width: 9px; height: 10px; z-index: 2;
  background: #EDEDED; border: 1px solid #888;
  clip-path: polygon(50% 0, 100% 45%, 100% 100%, 0 100%, 0 45%);
}
.ruler-mark.rm-first { transform: translateX(-50%); top: 2px; clip-path: polygon(50% 100%, 100% 0, 0 0); background: #CFCFCF; }
.ruler-mark.rm-hang { transform: translateX(-100%); background: #EDEDED; }
.ruler-mark.rm-left { width: 12px; transform: translateX(-4px); clip-path: polygon(0 45%, 34% 45%, 42% 100%, 100% 100%, 100% 60%, 42% 60%, 34% 100%, 0 100%); }
.ruler-mark.rm-right { transform: translateX(-100%); }
.ruler-mark:hover { background: #D6E8F7; border-color: #2B579A; }
body.ruler-dragging { cursor: ew-resize; }

/* ============ document area ============ */
#doc-area { flex: 1; display: flex; min-height: 0; position: relative; }
#doc-scroll {
  flex: 1; overflow: auto; position: relative;
  background: #E1E1E1;
  scrollbar-width: thin;
}
#doc-scroll::-webkit-scrollbar { width: 14px; height: 14px; }
#doc-scroll::-webkit-scrollbar-track { background: #F0F0F0; }
#doc-scroll::-webkit-scrollbar-thumb { background: #C1C1C1; border: 3px solid #F0F0F0; border-radius: 7px; }
#doc-scroll::-webkit-scrollbar-thumb:hover { background: #A8A8A8; }
#page-stack { position: relative; width: 100%; min-height: 100%; display: flex; justify-content: center; }
.pages-inner { position: relative; transform-origin: 0 0; }
#ghost-input {
  position: absolute; left: -9999px; top: 0; width: 2px; height: 2px;
  opacity: 0.01; border: none; resize: none; outline: none; overflow: hidden;
}
#nav-pane {
  width: 250px; flex: none; background: #FAFAFA; border-right: 1px solid #E0E0E0;
  display: flex; flex-direction: column; overflow: hidden;
}
.nav-tabs { display: flex; border-bottom: 1px solid #E0E0E0; }
.nav-tab { flex: 1; padding: 7px 0; font-size: 11.5px; color: #555; text-align: center; border-bottom: 2px solid transparent; }
.nav-tab.active { color: var(--word-blue); border-bottom-color: var(--word-blue); }
.nav-find { display: flex; align-items: center; gap: 4px; padding: 8px 10px; border-bottom: 1px solid #EDEDED; }
.nav-find input {
  flex: 1; border: 1px solid #C8C8C8; border-radius: 2px; height: 22px; padding: 0 6px;
  font-family: inherit; font-size: 12px; outline: none; user-select: text;
}
.nav-find input:focus { border-color: var(--word-blue); }
#nav-find-count { font-size: 10.5px; color: #777; white-space: nowrap; }
.nav-body { flex: 1; overflow-y: auto; }
.nav-list { padding: 4px 0 20px; }
.nav-item { padding: 4px 12px; font-size: 12px; color: #333; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item:hover { background: #EFF4FA; }
.nav-item.active { background: #D6E8F7; }
.nav-item.h1 { font-weight: 600; padding-left: 8px; }
.nav-item.h2 { padding-left: 18px; }
.nav-item.h3 { padding-left: 28px; color: #555; }
.nav-item.find-item b { color: var(--word-blue); background: #FFF3B0; font-weight: 400; }
.nav-empty { padding: 14px; color: #888; font-size: 11.5px; line-height: 1.4; }

/* ============ status bar ============ */
#statusbar {
  height: 24px; flex: none;
  background: var(--word-blue);
  color: #fff;
  display: flex; align-items: center;
  padding: 0 10px 0 14px;
  gap: 18px;
  font-size: 11.5px;
}
.st-item { white-space: nowrap; }
.st-click { cursor: default; }
.st-click:hover { text-decoration: underline; }
.st-spacer { flex: 1; }
#st-spell .book { display: inline-block; width: 14px; height: 11px; position: relative; }
#st-spell .book::before {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 12'%3E%3Cpath d='M1 1h5c1 0 2 .5 2 1.5C8 1.5 9 1 10 1h5v10h-5c-1 0-2 .5-2 1.5 0-1-1-1.5-2-1.5H1z' fill='none' stroke='white' stroke-width='1.1'/%3E%3Cpath d='M8 2.5v10' stroke='white' stroke-width='1.1'/%3E%3C/svg%3E") center/contain no-repeat;
}
#st-spell.off .book { opacity: .45; }
.st-views { display: flex; align-items: center; gap: 6px; }
.st-views button { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: 2px; }
.st-views button:hover { background: rgba(255,255,255,.15); }
.st-views button[aria-pressed="true"] { background: rgba(255,255,255,.25); }
#vw-read::after { content: '\1F4D6'; font-size: 12px; line-height: 1; }
#vw-print::after { content: ''; width: 11px; height: 13px; border: 1.4px solid #fff; display: block; }
#vw-web::after { content: ''; width: 12px; height: 12px; border: 1.4px solid #fff; border-radius: 50%; display: block; }
.st-vsep { width: 1px; height: 13px; background: rgba(255,255,255,.4); margin: 0 2px; }
#vw-minus::after, #vw-plus::after { font-size: 13px; line-height: 1; }
#vw-minus::after { content: '\2212'; }
#vw-plus::after { content: '+'; }
#zoom-slider {
  -webkit-appearance: none; appearance: none;
  width: 110px; height: 2px; background: rgba(255,255,255,.55);
  border-radius: 1px; outline: none;
}
#zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 8px; height: 15px; border-radius: 2px;
  background: #fff; border: 1px solid rgba(0,0,0,.25);
  cursor: default;
}
.st-zoom-pct { color: #fff; font-size: 11.5px; min-width: 36px; text-align: center; border-radius: 2px; padding: 2px 4px; }
.st-zoom-pct:hover { background: rgba(255,255,255,.15); }

/* ============ screentips ============ */
.screentip {
  position: fixed; z-index: 900;
  background: #fff; border: 1px solid #D4D4D4; border-radius: 3px;
  box-shadow: 0 3.2px 7.2px rgba(0,0,0,.14);
  padding: 6px 9px; max-width: 290px;
  pointer-events: none;
}
.st-title { font-size: 12px; font-weight: 600; color: #201F1E; }
.st-desc { font-size: 11.5px; color: #605E5C; margin-top: 2px; line-height: 1.35; }

/* ============ popups / menus ============ */
.popup {
  position: fixed; z-index: 800;
  background: #fff; border: 1px solid #D4D4D4; border-radius: 4px;
  box-shadow: 0 3.2px 7.2px rgba(0,0,0,.13), 0 0.4px 1.6px rgba(0,0,0,.1);
  padding: 3px;
  min-width: 160px;
  animation: popIn .14s cubic-bezier(.1,.9,.2,1);
}
@keyframes popIn { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
.menu-item {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 6px; border-radius: 3px;
  font-size: 12.5px; color: #201F1E;
}
.menu-item:hover:not(.disabled), .menu-item:focus { background: #EFF6FC; outline: none; }
.menu-item.disabled { color: #A9A9A9; }
.menu-item.danger:hover { background: #FDF3F4; }
.mi-ic { width: 18px; display: flex; align-items: center; justify-content: center; }
.mi-ic .ic svg { width: 16px; height: 16px; }
.mi-ic .ic { display: flex; }
.mi-check { font-size: 12px; color: var(--word-blue); font-weight: 700; }
.mi-swatch { width: 13px; height: 13px; border: 1px solid #bbb; border-radius: 2px; }
.mi-label { flex: 1; white-space: nowrap; }
.mi-right { color: #8A8886; font-size: 11px; margin-left: 22px; white-space: nowrap; }
.menu-sep { height: 1px; background: var(--border-soft); margin: 3px 8px; }
.menu-header { font-size: 10.5px; color: #757575; padding: 5px 10px 2px; font-weight: 600; }
.font-list, .size-list { max-height: 320px; overflow-y: auto; }
.font-row .mi-label { overflow: hidden; text-overflow: ellipsis; }
.gallery { padding: 4px; min-width: 200px; }
.gallery-title { font-size: 10.5px; color: #757575; padding: 4px 6px 3px; font-weight: 600; }
.color-cols { display: flex; gap: 1px; }
.color-col { display: flex; flex-direction: column; gap: 1px; }
.color-row { display: flex; gap: 1px; margin: 2px 0; }
.swatch {
  width: 15px; height: 15px; border: 1px solid rgba(0,0,0,.22); border-radius: 2px;
  outline: none;
}
.swatch:hover { transform: scale(1.14); box-shadow: 0 0 0 1px #2B579A; z-index: 2; position: relative; }
.swatch.active { box-shadow: 0 0 0 1.6px #2B579A, 0 0 0 2.6px #fff inset; }
.list-preview {
  display: flex; align-items: center; gap: 8px; padding: 3px 6px;
  min-width: 120px;
}
.lp-glyph { font-size: 15px; width: 16px; }
.lp-lines { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.lp-lines i { display: block; height: 2px; background: #999; border-radius: 1px; width: 100%; }
.lp-lines i:first-child { width: 92%; }
.list-preview.nums { flex-direction: column; align-items: stretch; padding: 2px 6px; }
.lp-row { display: flex; gap: 6px; align-items: center; padding: 1px 0; }
.lp-num { font-size: 11px; width: 16px; color: #333; }
.lp-line { height: 2px; background: #999; flex: 1; border-radius: 1px; }
.table-grid-gallery { min-width: 0; }
.table-grid { display: grid; grid-template-columns: repeat(10, 20px); gap: 1px; margin: 4px 6px; }
.tg-cell { width: 20px; height: 16px; border: 1px solid #C8C8C8; background: #fff; }
.tg-cell.on { background: var(--hover); border-color: var(--word-blue); }
.tg-label { text-align: center; font-size: 11px; color: #555; padding: 3px 0 5px; }
.shape-grid, .stock-grid { display: grid; grid-template-columns: repeat(4, 54px); gap: 4px; padding: 4px; }
.shape-tile { width: 54px; height: 44px; border: 1px solid transparent; border-radius: 3px; display: flex; align-items: center; justify-content: center; }
.shape-tile svg { width: 34px; height: 30px; }
.shape-tile:hover { border-color: #9CC3E5; background: var(--hover); }
.stock-tile { width: 54px; height: 46px; border: 1px solid transparent; border-radius: 3px; overflow: hidden; }
.stock-tile svg { width: 100%; height: 100%; }
.stock-tile:hover { border-color: #9CC3E5; }
.search-menu { padding: 6px; }
.search-hint { font-size: 12px; color: #444; padding: 8px 10px; line-height: 1.4; max-width: 320px; }
.search-sub { font-size: 11px; color: #888; padding: 4px 10px 6px; }
.ghost-caret { position: fixed; width: 2px; background: #2B579A; z-index: 600; pointer-events: none; }

/* ============ dialogs ============ */
.dlg-overlay {
  position: fixed; inset: 0; z-index: 850;
  background: rgba(0,0,0,.18);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 10vh;
}
.dlg {
  background: #fff; border-radius: 4px;
  box-shadow: 0 10px 34px rgba(0,0,0,.24);
  max-width: 92vw; max-height: 80vh; overflow: auto;
  animation: dlgIn .16s cubic-bezier(.1,.9,.2,1);
}
@keyframes dlgIn { from { opacity: 0; transform: translateY(6px) scale(.985); } to { opacity: 1; transform: none; } }
.dlg-title {
  background: #fff; color: var(--text); font-size: 13.5px; font-weight: 600;
  padding: 12px 16px 8px;
  border-bottom: none;
}
.dlg-body { padding: 6px 16px 12px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px 14px; }
.dlg-btn {
  min-width: 78px; height: 26px; border-radius: 2px;
  border: 1px solid #C8C8C8; background: #fff; font-size: 12.5px;
}
.dlg-btn:hover { background: #F3F9FE; border-color: #7EB4EA; }
.dlg-btn.primary { background: var(--word-blue); border-color: var(--word-blue); color: #fff; }
.dlg-btn.primary:hover { background: #3265B5; }
.dlg-error { color: #C42B1C; font-size: 11.5px; padding: 2px 0 6px; }
.dlg-group { border: 1px solid #E3E3E3; border-radius: 3px; margin: 0 0 10px; padding: 8px 12px 10px; }
.dlg-group legend { font-size: 11.5px; color: #555; padding: 0 4px; }
.fld { display: flex; align-items: center; gap: 8px; margin: 5px 0; }
.fld > label { width: 108px; text-align: right; color: #444; font-size: 12px; flex: none; }
.txt {
  flex: 1; height: 24px; border: 1px solid #C8C8C8; border-radius: 2px;
  padding: 0 6px; font-family: inherit; font-size: 12.5px; outline: none; user-select: text; min-width: 0;
}
.txt:focus { border-color: var(--word-blue); }
.txt.small { width: 70px; flex: none; }
.sel {
  flex: 1; height: 24px; border: 1px solid #C8C8C8; border-radius: 2px;
  font-family: inherit; font-size: 12.5px; background: #fff; outline: none; min-width: 0;
}
.ck { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #333; margin: 4px 0; }
.ck input { accent-color: var(--word-blue); }
.ck-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.dlg-note { font-size: 11.5px; color: #777; margin: 6px 0; line-height: 1.4; }
.font-preview {
  border: 1px solid #E3E3E3; border-radius: 3px; height: 64px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.wc-table { border-collapse: collapse; }
.wc-table td { font-size: 12.5px; padding: 4px 18px 4px 0; }
.wc-table td.wc-num { text-align: right; font-variant-numeric: tabular-nums; }
.symbol-grid { display: grid; grid-template-columns: repeat(12, 30px); gap: 2px; max-width: 400px; }
.sym { width: 30px; height: 30px; font-size: 15px; border: 1px solid transparent; border-radius: 2px; }
.sym:hover { border-color: #9CC3E5; background: var(--hover); }
.sym.active { border-color: var(--word-blue); background: var(--checked); }
.border-prev { display: flex; justify-content: center; padding: 8px; }
.bp-box { border: 1.5px solid #444; padding: 10px 24px; font-size: 14px; }
.options-dlg { display: flex; min-height: 320px; }
.opt-tabs { display: flex; flex-direction: column; border-right: 1px solid #E6E6E6; padding: 8px 4px; min-width: 110px; }
.opt-tab { text-align: left; padding: 6px 12px; border-radius: 2px; font-size: 12.5px; color: #444; }
.opt-tab:hover { background: #F3F3F3; }
.opt-tab.active { background: #EFF6FC; color: var(--word-blue); font-weight: 600; }
.opt-body { padding: 10px 16px; flex: 1; }

/* ============ mini toolbar ============ */
.mini-toolbar {
  position: fixed; z-index: 820;
  background: #fff; border: 1px solid #D4D4D4; border-radius: 4px;
  box-shadow: 0 3.2px 7.2px rgba(0,0,0,.16);
  padding: 3px 5px; display: flex; align-items: center; gap: 1px;
  opacity: 0; transition: opacity .18s ease;
}
.mt-btn { width: 24px; height: 24px; border-radius: 2px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; }
.mt-btn:hover { background: var(--hover); }
.mt-hl { background: #FFFF00; border-radius: 2px; font-size: 11px; }
.mt-sep { width: 1px; height: 16px; background: #E0E0E0; margin: 0 3px; }

/* ============ backstage ============ */
#backstage {
  position: fixed; inset: 0; z-index: 700;
  background: var(--word-blue);
  display: flex;
  animation: bsIn .18s ease;
}
#backstage[hidden] { display: none; }
@keyframes bsIn { from { opacity: .4; } to { opacity: 1; } }
.bs-nav {
  width: 200px; flex: none; padding: 10px 0 16px;
  display: flex; flex-direction: column;
  background: rgba(0,0,0,.14);
}
.bs-back {
  display: flex; align-items: center; gap: 10px;
  color: #fff; font-size: 15px; padding: 8px 16px; margin: 4px 0 12px;
}
.bs-back:hover { background: rgba(255,255,255,.12); }
.bs-back-arrow { font-size: 19px; line-height: 1; }
.bs-nav-item {
  display: flex; align-items: center; gap: 12px;
  color: #fff; font-size: 13px; padding: 8px 20px;
  text-align: left;
}
.bs-nav-item:hover { background: rgba(255,255,255,.12); }
.bs-nav-item.active { background: var(--word-blue-dark); box-shadow: inset 3px 0 0 #fff; }
.bs-nav-item .ic svg { width: 15px; height: 15px; }
.bs-nav-foot { margin-top: auto; color: rgba(255,255,255,.55); font-size: 10.5px; padding: 10px 20px; }
.bs-content { flex: 1; overflow: auto; color: #fff; }
.bs-page { padding: 26px 40px 40px; max-width: 1000px; }
.bs-h { font-size: 26px; font-weight: 400; margin: 0 0 20px; color: #fff; }
.bs-search input {
  width: 340px; height: 28px; border: none; border-radius: 2px;
  padding: 0 10px; font-family: inherit; font-size: 13px; outline: none; user-select: text;
}
.bs-section-title { font-size: 14px; font-weight: 600; color: #fff; margin: 22px 0 10px; }
.bs-section-title2 { font-size: 13px; font-weight: 600; color: #fff; margin: 18px 0 8px; }
.bs-tpl-grid { display: flex; flex-wrap: wrap; gap: 14px; }
.bs-tpl { display: flex; flex-direction: column; gap: 6px; width: 150px; }
.bs-tpl-thumb {
  width: 150px; height: 190px; background: #fff; border-radius: 2px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
  padding: 20px 16px;
}
.bs-tpl:hover .bs-tpl-thumb { outline: 2px solid #fff; }
.bs-tpl-name { font-size: 12.5px; color: #fff; }
.bs-tpl-blank { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #2B579A; font-size: 13px; }
.bs-tpl-blank::after { content: 'Type something\u2026'; color: #999; font-style: italic; }
.bs-tpl-lines { width: 100%; display: flex; flex-direction: column; gap: 7px; }
.bs-tpl-lines i { display: block; height: 4px; background: #DEDEDE; border-radius: 2px; width: 100%; }
.bs-tpl-lines i.h { width: 55%; background: #BDD7EE; height: 9px; margin-bottom: 4px; }
.bs-tpl-resume { width: 100%; display: flex; flex-direction: column; gap: 5px; align-items: center; }
.bs-tpl-resume b { width: 50%; height: 10px; background: #2B579A; }
.bs-tpl-resume i { width: 80%; height: 4px; background: #DDD; }
.bs-recent { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: 2px; width: 420px; }
.bs-recent:hover { background: rgba(255,255,255,.12); }
.bs-recent .ic svg { width: 26px; height: 26px; }
.bs-recent-meta { text-align: left; }
.bs-recent-name { font-size: 13.5px; color: #fff; }
.bs-recent-path { font-size: 11px; color: rgba(255,255,255,.7); }
.bs-cols { display: flex; gap: 30px; }
.bs-info-grid { display: flex; gap: 40px; }
.bs-info-card { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.bs-doc-thumb {
  width: 200px; height: 250px; background: #fff; border-radius: 2px;
  display: flex; align-items: center; padding: 30px 22px;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.bs-pill {
  background: rgba(255,255,255,.14); color: #fff;
  border: 1px solid rgba(255,255,255,.35); border-radius: 2px;
  padding: 5px 14px; font-size: 12.5px;
}
.bs-pill:hover { background: rgba(255,255,255,.24); }
.bs-info-right { flex: 1; max-width: 460px; }
.bs-prop { display: flex; padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,.14); gap: 10px; }
.bs-prop-k { width: 170px; color: rgba(255,255,255,.8); font-size: 12.5px; flex: none; }
.bs-prop-v { color: #fff; font-size: 12.5px; }
.bs-prop-v.muted { color: rgba(255,255,255,.55); }
.bs-save-grid { display: flex; gap: 40px; align-items: flex-start; }
.bs-save-side { min-width: 340px; }
.bs-save-opt {
  display: block; text-align: left; padding: 10px 14px; border-radius: 2px;
  margin-bottom: 4px;
}
.bs-save-opt:hover { background: rgba(255,255,255,.12); }
.bs-save-name { color: #fff; font-size: 13.5px; }
.bs-save-desc { color: rgba(255,255,255,.7); font-size: 11.5px; margin-top: 2px; }
.bs-save-box { background: rgba(255,255,255,.97); border-radius: 3px; padding: 18px; color: var(--text); width: 340px; }
.bs-save-box .txt { width: 100%; }
.bs-print-grid { display: flex; gap: 50px; align-items: flex-start; }
.bs-print-left { width: 250px; }
.bs-print-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 0; }
.bs-print-k { color: rgba(255,255,255,.85); font-size: 12.5px; }
.bs-print-left .txt.small, .bs-print-left .sel { width: 120px; }
.bs-print-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; color: var(--word-blue);
  border-radius: 2px; padding: 8px 22px; font-size: 14px; font-weight: 600;
}
.bs-print-btn:hover { background: #F0F6FF; }
.bs-print-btn .ic svg { width: 18px; height: 18px; }
.bs-print-preview { flex: 1; position: relative; }
.bs-print-nav {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 10px; justify-content: center;
  padding: 8px; background: var(--word-blue);
}
.bs-nav-arrow {
  width: 26px; height: 26px; border-radius: 2px; color: #fff; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center;
}
.bs-nav-arrow:hover { background: rgba(255,255,255,.15); }
.bs-zoom-label { color: #fff; font-size: 12px; min-width: 54px; text-align: center; }
.bs-print-frame { overflow: auto; max-height: calc(100vh - 120px); padding: 10px 0 30px; }
.preview-page { transform-origin: top center; }
.bs-note { color: rgba(255,255,255,.9); font-size: 13px; line-height: 1.5; max-width: 560px; }
.bs-pills { display: flex; gap: 10px; margin-top: 8px; }
.bs-account { display: flex; align-items: center; gap: 16px; background: rgba(255,255,255,.1); padding: 16px; border-radius: 3px; max-width: 460px; }
.bs-avatar {
  width: 56px; height: 56px; border-radius: 50%; background: #fff; color: var(--word-blue);
  display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 600;
}
.bs-acc-name { color: #fff; font-size: 15px; }
.bs-acc-mail { color: rgba(255,255,255,.75); font-size: 12px; }

/* ============ toasts ============ */
#toasts {
  position: fixed; bottom: 34px; left: 50%; transform: translateX(-50%);
  z-index: 950; display: flex; flex-direction: column; align-items: center; gap: 6px;
  pointer-events: none;
}
.toast {
  background: #2E2E2E; color: #fff; font-size: 12.5px;
  padding: 8px 18px; border-radius: 3px;
  opacity: 0; transform: translateY(8px);
  transition: all .22s ease;
  box-shadow: 0 4px 14px rgba(0,0,0,.3);
}
.toast.show { opacity: 1; transform: none; }

/* misc */
.ic { display: inline-flex; align-items: center; justify-content: center; }
.ic svg { display: block; width: 100%; height: 100%; }
.ic-missing { background: #F2C4C4; border-radius: 2px; }
body.dragging-text { cursor: move; }
body.read-mode #doc-area { position: fixed; inset: 34px 0 24px 0; background: #F4F4F4; z-index: 50; }
#layers { position: fixed; inset: 0; pointer-events: none; z-index: 800; }
#layers > * { pointer-events: auto; }

@media print {
  body > #word-app > *:not(#doc-area) { display: none !important; }
  #doc-area { position: static; }
  #nav-pane { display: none !important; }
  #doc-scroll { overflow: visible; }
  .pages-inner { transform: none !important; }
  .pg-deco, .caret, .page-gap { display: none !important; }
}
