/* Neon Sparks Write — application chrome. */

:root {
  --accent: #6d28d9;
  --accent-2: #a21caf;
  --accent-soft: #ede9fe;
  --accent-ink: #4c1d95;
  --spark: #22d3ee;
  --bg: #eceaf2;
  --chrome: #ffffff;
  --chrome-2: #f7f6fb;
  --line: #dedbe8;
  --line-2: #cbc6da;
  --ink: #23212b;
  --ink-2: #5c5870;
  --hover: #efedf6;
  --pressed: #e2dcf7;
  --sheet-shadow: 0 1px 3px rgba(30, 20, 60, 0.18), 0 6px 18px rgba(30, 20, 60, 0.08);
  --radius: 6px;
  --font-ui: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}

body.dark {
  --accent: #a78bfa;
  --accent-2: #e879f9;
  --accent-soft: #2e2645;
  --accent-ink: #ddd6fe;
  --bg: #17151d;
  --chrome: #22202a;
  --chrome-2: #1c1a23;
  --line: #34313f;
  --line-2: #474357;
  --ink: #ece9f5;
  --ink-2: #a9a4bd;
  --hover: #2d2a37;
  --pressed: #3a3354;
  --sheet-shadow: 0 1px 3px rgba(0, 0, 0, 0.6), 0 8px 24px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
/* Before scripts run (and without them) follow the system theme, so there is no white flash. */
html { background: #eceaf2; }
@media (prefers-color-scheme: dark) { html { background: #17151d; } }
body {
  font: 13px/1.35 var(--font-ui);
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.ico { width: 18px; height: 18px; flex: none; display: block; }

.app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.app.booting .workspace { visibility: hidden; }

/* ------------------------------------------------------------------ title bar */
.titlebar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 10px;
  color: #fff;
  background: linear-gradient(100deg, #2e1065 0%, #4c1d95 38%, #6d28d9 72%, #a21caf 100%);
  position: relative;
  flex: none;
}
.titlebar::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--spark), #f0abfc, transparent);
  opacity: 0.85;
}
.brand { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.logo-mark {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  font: 800 15px/1 var(--font-ui);
  color: #fff;
  background: linear-gradient(135deg, #22d3ee, #a855f7 55%, #ec4899);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.brand-name { font-size: 13px; letter-spacing: 0.01em; opacity: 0.95; }
.brand-name b { font-weight: 700; }
.qa { display: flex; gap: 2px; margin-left: 6px; }
.qa-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 28px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: #fff;
}
.qa-btn:hover { background: rgba(255, 255, 255, 0.16); }
.qa-btn:disabled { opacity: 0.45; }
.doc-name { flex: 1; display: flex; align-items: center; justify-content: center; gap: 10px; min-width: 0; }
.doc-title {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  color: #fff;
  padding: 3px 8px;
  text-align: center;
  font-weight: 600;
  width: min(360px, 42vw);
  text-overflow: ellipsis;
}
.doc-title:hover { border-color: rgba(255, 255, 255, 0.35); }
.doc-title:focus { outline: none; background: rgba(255, 255, 255, 0.95); color: #222; }
.save-state { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; opacity: 0.85; white-space: nowrap; min-width: 0; }
.save-state .ss-ico { width: 15px; height: 15px; }
.save-state .ss-text { overflow: hidden; text-overflow: ellipsis; }
.save-error {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  padding: 3px 10px 3px 8px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: #b91c1c;
  white-space: nowrap;
}
.save-error:hover { background: #991b1b; }
.save-error .ico { width: 15px; height: 15px; }
.save-error .se-short { display: none; }
.title-right { display: flex; gap: 4px; }
body.ribbon-collapsed #collapse-ribbon svg { transform: rotate(180deg); }

/* ------------------------------------------------------------------ tabs & ribbon */
/* Horizontal strips that can scroll on small screens: faded edges and arrows show there is more. */
.scroller { position: relative; flex: none; background: var(--chrome); }
.scroll-cue {
  position: absolute;
  top: 0;
  bottom: 1px;
  z-index: 2;
  width: 30px;
  display: none;
  place-items: center;
  border: none;
  padding: 0;
  color: var(--accent);
}
.scroll-cue.l { left: 0; background: linear-gradient(90deg, var(--chrome) 55%, transparent); justify-content: start; padding-left: 4px; }
.scroll-cue.r { right: 0; background: linear-gradient(270deg, var(--chrome) 55%, transparent); justify-content: end; padding-right: 4px; }
.scroll-cue .ico { width: 16px; height: 16px; }
.scroller.can-l > .scroll-cue.l, .scroller.can-r > .scroll-cue.r { display: grid; }
body.ribbon-collapsed .ribbon-wrap { display: none; }
.tabs {
  display: flex;
  gap: 2px;
  padding: 0 8px;
  background: var(--chrome);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
  flex: none;
}
.tab {
  flex: none;
  border: none;
  background: transparent;
  padding: 8px 12px 7px;
  font-size: 13px;
  color: var(--ink-2);
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.tab:hover { color: var(--ink); background: var(--hover); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab.file-tab { color: var(--accent); font-weight: 600; }
.tab.contextual { color: var(--accent-2); }
.tab.contextual.active { border-bottom-color: var(--accent-2); }

.ribbon {
  background: var(--chrome);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  overflow-y: hidden;
  flex: none;
  scrollbar-width: thin;
}
body.ribbon-collapsed .ribbon { display: none; }
.panel { display: flex; align-items: stretch; padding: 4px 6px 0; min-height: 104px; }
.group {
  display: flex;
  flex-direction: column;
  padding: 0 6px;
  border-right: 1px solid var(--line);
  flex: none;
}
.group:last-child { border-right: none; }
.group-body { display: flex; align-items: flex-start; gap: 2px; flex: 1; padding-top: 2px; }
.group-label { text-align: center; font-size: 11px; color: var(--ink-2); padding: 3px 0 4px; white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: 1px; justify-content: flex-start; }
.row { display: flex; align-items: center; gap: 1px; }
.font-stack { gap: 4px; }
.vsep { width: 1px; background: var(--line); margin: 4px 3px; align-self: stretch; }
/* Adaptive ribbon (see Ribbon.fit): shrink in steps, then fold groups into dropdowns. */
.group:not(.folded) > .group-fold { display: none !important; }
.group.folded > .group-body { display: none; }
.group.folded > .group-fold { display: flex; }
.group.folded > .group-label { visibility: hidden; }
.panel.fit-1 .gallery { max-width: 226px; }
.panel.fit-1 .rb.big { min-width: 48px; padding-left: 3px; padding-right: 3px; }
.panel.fit-2 .stack .rb-label, .panel.fit-2 .row > .rb .rb-label { display: none; }
.panel.fit-2 .gallery { max-width: 151px; }
.pop.pop-fold { padding: 6px; }
.fold-pop .group-body { padding: 0; flex-wrap: wrap; max-width: min(560px, 92vw); }

.rb {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  min-width: 28px;
  padding: 3px 6px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  white-space: nowrap;
}
.rb:hover:not(:disabled) { background: var(--hover); border-color: var(--line); }
.rb:active:not(:disabled), .rb.on { background: var(--pressed); border-color: var(--line-2); }
.rb.on { color: var(--accent-ink); }
.rb:disabled { opacity: 0.4; cursor: default; }
/* One focus ring everywhere (keyboard focus only). */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.titlebar :focus-visible, .bs-side :focus-visible { outline-color: #fff; }
.menu-item:focus-visible, .nav-item:focus-visible, .recent-open:focus-visible { outline-offset: -2px; }
.doc:focus-visible, .bs-main:focus-visible { outline: none; }
.sw:focus-visible, .tg:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; position: relative; z-index: 1; }
.rb-glyph { font: 15px/1 Georgia, 'Times New Roman', serif; min-width: 16px; text-align: center; }
.rb-glyph b, .rb-glyph i, .rb-glyph u, .rb-glyph s { font-family: Georgia, serif; }
.rb-glyph sup, .rb-glyph sub { font-size: 9px; line-height: 0; }
.big-glyph { font: 600 16px/1 var(--font-ui); }
.rb-label { font-size: 12px; }
.rb-caret .ico { width: 12px; height: 12px; }
.rb.big {
  flex-direction: column;
  justify-content: flex-start;
  min-width: 52px;
  max-width: 76px;
  height: 76px;
  padding: 6px 4px 4px;
  gap: 4px;
}
.rb.big .rb-ico .ico { width: 28px; height: 28px; stroke-width: 1.5; }
.rb.big .rb-label { white-space: normal; text-align: center; line-height: 1.15; }
.rb.big .rb-glyph { font-size: 22px; height: 28px; display: grid; place-items: center; }
.split { display: inline-flex; align-items: stretch; }
.split > .rb:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; padding-right: 3px; }
.rb-split-caret { min-width: 16px; padding: 0 2px; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.rb-split-caret .ico { width: 11px; height: 11px; }
.split.big { flex-direction: column; }
.split.big > .rb:first-child { border-radius: var(--radius) var(--radius) 0 0; height: 58px; padding-right: 4px; }
.split.big .rb-split-caret { border-radius: 0 0 var(--radius) var(--radius); height: 18px; min-height: 18px; justify-content: center; }
.rb-ico.with-bar { display: grid; place-items: center; height: 16px; }
.glyph-a { font: 700 15px/1 Georgia, serif; }
.colorbar { position: absolute; }
.split > .rb { position: relative; }
.split > .rb .colorbar { left: 6px; right: 4px; bottom: 3px; height: 4px; border-radius: 1px; }

/* comboboxes */
.combo {
  display: inline-flex;
  align-items: stretch;
  height: 26px;
  border: 1px solid var(--line-2);
  border-radius: 5px;
  background: var(--chrome);
  overflow: hidden;
}
.combo:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.combo input { border: none; outline: none; background: transparent; padding: 0 6px; min-width: 0; }
.font-combo input { width: 128px; }
.size-combo input { width: 38px; text-align: center; }
.combo-caret { border: none; background: transparent; width: 20px; display: grid; place-items: center; border-left: 1px solid var(--line); }
.combo-caret:hover { background: var(--hover); }
.combo-caret .ico { width: 12px; height: 12px; }

/* style gallery */
.gallery {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(1, 72px);
  gap: 3px;
  max-width: 451px; /* six whole tiles: a tile is never cut in half */
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 2px;
  scrollbar-width: thin;
}
.tile {
  width: 72px;
  height: 70px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px;
}
.tile:hover { border-color: var(--accent); }
.tile { scroll-snap-align: start; }
.tile.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft) inset; }
.tile-sample { font: 13px Calibri, Carlito, sans-serif; white-space: nowrap; max-width: 64px; overflow: hidden; }
.tile-name { font-size: 10.5px; color: #555; }

/* number fields in Layout tab */
.fields { gap: 3px; padding-top: 2px; }
.fields + .fields { margin-left: 14px; }
.field-head { font-size: 11px; color: var(--ink-2); font-weight: 600; }
.numfield { display: grid; grid-template-columns: 50px 70px auto; align-items: center; gap: 4px; font-size: 12px; }
.numfield .num { height: 24px; border: 1px solid var(--line-2); border-radius: 4px; padding: 0 4px; background: var(--chrome); }
.numfield small { color: var(--ink-2); }

/* ------------------------------------------------------------------ ruler */
.ruler {
  position: relative;
  height: 22px;
  background: var(--chrome-2);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  flex: none;
}
.ruler-track { position: absolute; top: 3px; height: 16px; background: #e4e1ee; border-radius: 2px; }
body.dark .ruler-track { background: #2f2c3a; }
.ruler-scale {
  position: absolute;
  top: 0;
  bottom: 0;
  background-color: #fff;
  background-image:
    repeating-linear-gradient(90deg, #7d7896 0 1px, transparent 1px var(--u)),
    repeating-linear-gradient(90deg, #a9a4bd 0 1px, transparent 1px calc(var(--u) / 4));
  background-size: 100% 9px, 100% 4px;
  background-position: 0 bottom, 0 bottom;
  background-repeat: no-repeat;
}
body.dark .ruler-scale { background-color: #3a3647; }
.rm { position: absolute; width: 11px; height: 8px; margin-left: -5.5px; cursor: ew-resize; background: var(--accent); }
.rm-first { top: 0; clip-path: polygon(0 0, 100% 0, 50% 100%); }
.rm-left { bottom: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.rm-right { bottom: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); }

/* ------------------------------------------------------------------ workspace */
.workspace { flex: 1; display: flex; min-height: 0; }
.canvas {
  flex: 1;
  overflow: auto;
  position: relative;
  padding: 24px 24px 60px;
  scroll-padding: 40px;
}
.zoom-outer { position: relative; margin: 0 auto; }
.zoom-inner { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.sheet {
  position: relative;
  background: #fff;
  box-shadow: var(--sheet-shadow);
  color: #000;
  box-sizing: border-box;
}
.page-overlay { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.page-gap {
  position: absolute;
  left: -2px;
  right: -2px;
  background: var(--bg);
  box-shadow: inset 0 7px 7px -7px rgba(30, 20, 60, 0.35), inset 0 -7px 7px -7px rgba(30, 20, 60, 0.35);
}
.hf {
  position: absolute;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  font: 11pt/20px Calibri, Carlito, sans-serif;
  color: #595959;
  white-space: nowrap;
}
.hf > span { overflow: hidden; text-overflow: ellipsis; }
.hf .hf-l { text-align: left; }
.hf .hf-c { text-align: center; }
.hf .hf-r { text-align: right; }
.img-tools {
  position: absolute;
  z-index: 3;
  outline: 1.5px solid var(--accent);
  pointer-events: none;
}
.img-handle {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 12px;
  height: 12px;
  background: #fff;
  border: 2px solid var(--accent);
  border-radius: 2px;
  cursor: nwse-resize;
  pointer-events: auto;
}
body.painting .doc { cursor: copy; }

/* web layout */
body.web-layout .zoom-outer { width: auto !important; height: auto !important; max-width: 1100px; }
body.web-layout .zoom-inner { position: static; transform: none !important; }
body.web-layout .sheet { width: auto !important; min-height: calc(100vh - 260px) !important; padding: 32px 48px !important; }
body.web-layout .ruler { display: none; }

/* focus mode */
body.focus-mode .titlebar, body.focus-mode .scroller, body.focus-mode .tabs, body.focus-mode .ribbon, body.focus-mode .ruler,
body.focus-mode .statusbar, body.focus-mode .pane { display: none !important; }
body.focus-mode .canvas { background: var(--bg); padding-top: 40px; }

/* ------------------------------------------------------------------ panes */
.pane {
  width: 300px;
  flex: none;
  background: var(--chrome);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.navpane { border-left: none; border-right: 1px solid var(--line); width: 250px; }
.pane-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 6px 14px; }
.pane-head h2 { font-size: 15px; margin: 0; font-weight: 600; }
.pane-body, .nav-list { overflow: auto; padding: 4px 12px 16px; flex: 1; }
.pane-empty { color: var(--ink-2); font-size: 12.5px; padding: 6px 2px; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-2);
  flex: none;
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn .ico { width: 16px; height: 16px; }
.nav-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 5px 8px;
  border-radius: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-item:hover { background: var(--hover); }
.nav-item.lvl-1 { font-weight: 600; }
.nav-item.lvl-2 { padding-left: 20px; }
.nav-item.lvl-3 { padding-left: 32px; }
.nav-item.lvl-4, .nav-item.lvl-5, .nav-item.lvl-6 { padding-left: 44px; color: var(--ink-2); }

.find-box { display: flex; flex-direction: column; gap: 8px; }
.find-row { display: flex; gap: 2px; align-items: center; }
.find-row .inp { flex: 1; }
.find-count { font-size: 12px; color: var(--ink-2); min-height: 16px; }
.find-opts { display: flex; flex-direction: column; gap: 4px; }
.replace-box { display: flex; flex-direction: column; gap: 6px; padding-top: 4px; border-top: 1px solid var(--line); }
.link-btn { border: none; background: none; color: var(--accent); padding: 0; text-align: left; }
.link-btn:hover { text-decoration: underline; }

.c-card {
  border: 1px solid var(--line);
  border-left: 3px solid #f2b705;
  border-radius: var(--radius);
  padding: 8px;
  margin-bottom: 8px;
  background: var(--chrome);
  cursor: pointer;
}
.c-card.active { border-color: var(--accent); border-left-color: var(--accent); box-shadow: 0 2px 8px rgba(76, 29, 149, 0.15); }
.c-card.resolved { opacity: 0.6; }
.c-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.c-avatar {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  flex: none;
}
.c-meta { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.c-meta small { color: var(--ink-2); font-size: 11px; }
.c-text { width: 100%; resize: vertical; border: 1px solid var(--line); border-radius: 4px; padding: 5px 6px; background: var(--chrome-2); }

/* ------------------------------------------------------------------ status bar */
.statusbar {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding: 0 8px;
  background: var(--chrome-2);
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-2);
  flex: none;
}
.sb-item { padding: 0 6px; white-space: nowrap; }
.sb-btn { border: none; background: transparent; padding: 3px 6px; min-height: 24px; border-radius: 4px; color: inherit; white-space: nowrap; }
.sb-btn:hover { background: var(--hover); color: var(--ink); }
.sb-btn.on { color: var(--accent); }
#status-track.on { color: #fff; background: var(--accent); }
.sb-ico { width: 26px; height: 24px; display: grid; place-items: center; padding: 0; font-size: 16px; }
.sb-offline { display: inline-flex; align-items: center; gap: 5px; color: #b45309; font-weight: 600; }
body.dark .sb-offline { color: #fbbf24; }
.sb-offline .ico { width: 15px; height: 15px; }
.sb-ico .ico { width: 15px; height: 15px; }
.sb-msg { padding-left: 8px; color: var(--accent); }
.sb-spacer { flex: 1; }
.zoom-range { width: 110px; height: 24px; margin: 0 2px; accent-color: var(--accent); }
.zoom-label { min-width: 44px; }

/* ------------------------------------------------------------------ popovers & menus */
.pop {
  position: fixed;
  z-index: 50;
  background: var(--chrome);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(20, 10, 50, 0.22);
  padding: 4px;
  overflow: auto;
  min-width: 180px;
  max-width: 360px;
}
.menu { display: flex; flex-direction: column; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 6px 10px 6px 6px;
  border-radius: 5px;
  text-align: left;
  white-space: nowrap;
}
.menu-item:hover:not(:disabled) { background: var(--hover); }
.menu-item:disabled { opacity: 0.45; }
.mi-ico { width: 18px; display: grid; place-items: center; color: var(--accent); }
.mi-ico .ico { width: 15px; height: 15px; }
.mi-label { flex: 1; }
.mi-key { color: var(--ink-2); font-size: 11px; padding-left: 14px; }
.menu-sep { height: 1px; background: var(--line); margin: 4px 2px; }
.menu-head { font-size: 11px; font-weight: 600; color: var(--ink-2); padding: 6px 8px 4px; }
.font-menu { max-height: 360px; }
.font-menu .mi-label { font-size: 14px; }

.colours { width: 248px; padding: 2px; }
.sw-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; padding: 2px 6px 4px; }
.sw-grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
.sw { width: 100%; aspect-ratio: 1; border: 1px solid rgba(0, 0, 0, 0.18); border-radius: 2px; padding: 0; }
.sw:hover { outline: 2px solid var(--accent); outline-offset: 1px; }
.sw-auto { display: inline-block; width: 16px; height: 16px; border: 1px solid #999; }
.menu-item.more { position: relative; }
.menu-item.more input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.tgrid-wrap { padding: 4px; }
.tgrid-label { font-size: 12px; font-weight: 600; padding: 2px 4px 6px; }
.tgrid { display: grid; grid-template-columns: repeat(10, 18px); gap: 2px; padding: 0 4px 6px; }
.tg { width: 18px; height: 18px; border: 1px solid var(--line-2); background: var(--chrome); padding: 0; border-radius: 2px; }
.tg.on { background: var(--accent-soft); border-color: var(--accent); }

/* ------------------------------------------------------------------ dialogs */
.dlg {
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 0;
  width: 420px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 40px);
  background: var(--chrome);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(20, 10, 50, 0.35);
}
.dlg::backdrop { background: rgba(20, 14, 40, 0.38); }
.dlg-form { display: flex; flex-direction: column; max-height: calc(100vh - 42px); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 6px 18px; }
.dlg-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.dlg-x { border: none; background: none; width: 30px; height: 30px; border-radius: 5px; display: grid; place-items: center; color: var(--ink-2); }
.dlg-x:hover { background: var(--hover); }
.dlg-body { padding: 6px 18px 12px; overflow: auto; }
.dlg-body h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-2); margin: 14px 0 6px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 18px 16px; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line-2);
  background: var(--chrome);
  border-radius: 6px;
  padding: 6px 14px;
  min-height: 32px;
}
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
body.dark .btn.primary { color: #17151d; }
.btn.primary:hover { filter: brightness(1.08); }
.btn .ico { width: 15px; height: 15px; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.btn-row .inp { flex: 1; min-width: 120px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field > span { font-size: 12px; color: var(--ink-2); }
.field small { color: var(--ink-2); font-size: 11.5px; }
.inp {
  width: 100%;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  padding: 6px 8px;
  background: var(--chrome);
  min-height: 32px;
}
.inp:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.inp { resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.chk { display: flex; align-items: center; gap: 7px; padding: 3px 0; cursor: pointer; }
.chk input { accent-color: var(--accent); width: 15px; height: 15px; }
.chk-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px 8px; margin: 6px 0 10px; }
.choice-list { display: flex; flex-direction: column; gap: 2px; }
.choice-list.inline { flex-direction: row; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 10px; }
.choice { border: 1px solid transparent; background: transparent; text-align: left; padding: 7px 10px; border-radius: 6px; }
.choice:hover { background: var(--hover); border-color: var(--line); }
.sym-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 3px; margin-bottom: 10px; }
.sym { height: 34px; border: 1px solid var(--line); border-radius: 5px; background: var(--chrome); font-size: 17px; }
.sym:hover { border-color: var(--accent); background: var(--accent-soft); }
table.stats { border-collapse: collapse; width: 100%; }
table.stats th { text-align: left; font-weight: 500; color: var(--ink-2); padding: 6px 12px 6px 0; white-space: nowrap; }
table.stats td { padding: 6px 0; text-align: right; font-variant-numeric: tabular-nums; }
table.stats.props td { text-align: left; }
table.stats tr + tr { border-top: 1px solid var(--line); }
table.keys td { text-align: left; }
kbd {
  font: 11.5px/1 var(--font-ui);
  padding: 3px 6px;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--chrome-2);
}
.about { text-align: center; }
.about-logo svg { display: block; margin: 4px auto 6px; }
.about p { margin: 8px 0; }
.about-name { font-size: 15px; }
.about-links a, .about-credits a { color: var(--accent); }
.about h3 { text-align: left; }
.about-credits { text-align: left; margin: 0; padding-left: 18px; font-size: 12.5px; }
.about-credits li { margin: 4px 0; }
.about-copy { font-size: 12px; margin-top: 14px !important; }
.gs { display: flex; flex-direction: column; gap: 12px; }
.gs-sec { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: start; }
.gs-ico { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: var(--accent); background: var(--accent-soft); }
.gs-ico .ico { width: 19px; height: 19px; }
.gs-sec h3 { margin: 4px 0 2px !important; font-size: 14px !important; text-transform: none !important; letter-spacing: 0 !important; color: var(--ink) !important; }
.gs-sec p { margin: 0; color: var(--ink-2); line-height: 1.45; }
.gs kbd { font-size: 11px; }
.storage-status { font-size: 12.5px; }
.backup-row { margin: 4px 0 12px; }
.muted { color: var(--ink-2); }

/* ------------------------------------------------------------------ backstage */
.backstage {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  background: var(--chrome-2);
  animation: bs-in 0.16s ease-out;
}
@keyframes bs-in { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
.bs-side {
  width: 220px;
  background: linear-gradient(180deg, #2e1065, #4c1d95 60%, #6d28d9);
  color: #fff;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: none;
}
.bs-back, .bs-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  background: transparent;
  color: #fff;
  padding: 9px 12px;
  border-radius: 6px;
  text-align: left;
  font-size: 14px;
}
.bs-back { margin-bottom: 8px; }
.bs-back:hover, .bs-item:hover { background: rgba(255, 255, 255, 0.12); }
.bs-item.on { background: rgba(255, 255, 255, 0.2); font-weight: 600; }
.bs-nav { display: flex; flex-direction: column; gap: 2px; }
.bs-main { flex: 1; overflow: auto; padding: 28px 40px 40px; }
.bs-main h1 { font-size: 28px; font-weight: 300; margin: 0 0 20px; }
.bs-main h2 { font-size: 15px; font-weight: 600; margin: 26px 0 10px; }
.tpl-grid { display: flex; gap: 16px; flex-wrap: wrap; }
.tpl { border: none; background: none; display: flex; flex-direction: column; gap: 8px; padding: 0; align-items: center; color: var(--ink); }
.tpl-thumb {
  width: 130px;
  height: 168px;
  background: #fff;
  color: #000;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  overflow: hidden;
  padding: 12px 10px;
  font: 4px/1.3 Calibri, Carlito, sans-serif;
  text-align: left;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(30, 20, 60, 0.08);
}
.tpl:hover .tpl-thumb { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.tpl-thumb h1 { font-size: 8px; color: #2f5496; margin: 3px 0 1px; font-weight: 400; }
.tpl-thumb h2 { font-size: 6.5px; color: #2f5496; margin: 2px 0 1px; font-weight: 400; }
.tpl-thumb h3 { font-size: 5.5px; color: #1f3763; margin: 2px 0 1px; font-weight: 400; }
.tpl-thumb p { margin: 0 0 3px; }
.tpl-thumb .ns-title { font-size: 12px; }
.tpl-thumb ul, .tpl-thumb ol { margin: 0 0 3px; padding-left: 8px; }
.tpl-thumb table { border-collapse: collapse; width: 100%; }
.tpl-thumb td { border: 0.5px solid #000; padding: 1px; }
.tpl-thumb .nsw-toc { height: 14px; border: 0.5px dashed #aaa; margin-bottom: 4px; }
.recent-list { display: flex; flex-direction: column; gap: 2px; max-width: 760px; }
.recent { display: flex; align-items: center; border-radius: 6px; }
.recent:hover { background: var(--hover); }
.recent.current .recent-text b::after { content: ' · open'; color: var(--accent); font-weight: 400; }
.recent-open { flex: 1; display: flex; align-items: center; gap: 12px; border: none; background: transparent; padding: 8px 10px; text-align: left; min-width: 0; }
.recent-ico { color: var(--accent); }
.recent-ico .ico { width: 22px; height: 22px; }
.recent-text { display: flex; flex-direction: column; min-width: 0; }
.recent-text small { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bs-cards, .bs-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; max-width: 900px; }
.bs-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  border: 1px solid var(--line);
  background: var(--chrome);
  border-radius: 10px;
  padding: 14px 16px;
  text-align: left;
}
.bs-card:hover { border-color: var(--accent); box-shadow: 0 4px 14px rgba(76, 29, 149, 0.12); }
.bs-card small { color: var(--ink-2); }
.bs-card .ico { width: 24px; height: 24px; color: var(--accent); }
.fmt-badge {
  font: 700 11px/1 var(--font-ui);
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 4px;
  padding: 4px 6px;
  margin-bottom: 4px;
}
.options { max-width: 520px; }

/* ------------------------------------------------------------------ toasts */
#toasts { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast {
  background: #26222f;
  color: #fff;
  padding: 9px 16px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  font-size: 13px;
  max-width: min(560px, 90vw);
  transition: opacity 0.3s, transform 0.3s;
}
.toast-ok { border-left: 4px solid #22c55e; }
.toast-error { border-left: 4px solid #ef4444; }
.toast-info { border-left: 4px solid var(--spark); }
.toast.out { opacity: 0; transform: translateY(6px); }
.toast.has-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; pointer-events: auto; padding-right: 8px; }
.toast-msg { flex: 1 1 220px; }
.toast-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.toast-btn { border: 1px solid rgba(255, 255, 255, 0.35); background: rgba(255, 255, 255, 0.1); color: #fff; border-radius: 6px; padding: 4px 10px; font-weight: 600; white-space: nowrap; }
.toast-btn:hover { background: rgba(255, 255, 255, 0.2); }
.toast-x { border: none; background: none; color: #fff; opacity: 0.75; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 5px; }
.toast-x:hover { opacity: 1; background: rgba(255, 255, 255, 0.12); }
.toast-x .ico { width: 14px; height: 14px; }
.toast :focus-visible { outline-color: #fff; }
.err-details { font: 12px/1.4 ui-monospace, Consolas, monospace; width: 100%; }
.noscript { padding: 2rem; font: 16px system-ui, sans-serif; }
.fatal { position: fixed; inset: auto 20px 20px; padding: 16px; background: #fee2e2; color: #7f1d1d; border-radius: 8px; z-index: 99; }

/* ------------------------------------------------------------------ small screens */
@media (max-width: 900px) {
  .brand-name, .sb-hide-sm { display: none; }
  /* Phones and small tablets: the save status shrinks to its icon (text kept for screen readers). */
  .save-state .ss-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .save-state { opacity: 0.95; padding: 4px; }
  .save-error .se-long { display: none; }
  .save-error .se-short { display: inline; }
  .pane { position: absolute; z-index: 20; top: 0; bottom: 0; right: 0; box-shadow: -8px 0 24px rgba(0, 0, 0, 0.15); }
  .navpane { left: 0; right: auto; }
  .workspace { position: relative; }
  .canvas { padding: 12px 8px 40px; }
  .bs-side { width: 76px; padding: 8px 4px; overflow-y: auto; }
  .bs-item, .bs-back { flex-direction: column; gap: 3px; padding: 7px 2px; font-size: 10.5px; line-height: 1.15; text-align: center; justify-content: center; }
  .bs-label { max-width: 68px; overflow-wrap: anywhere; }
  .bs-back { margin-bottom: 4px; }
  .bs-main { padding: 20px; }
  .zoom-range { width: 70px; }
}
@media (max-width: 600px) {
  .doc-name { gap: 4px; }
  .doc-title { width: auto; flex: 1; min-width: 0; }
  .qa { margin-left: 0; }
  .statusbar { gap: 2px; padding: 0 4px; }
  body.web-layout .sheet { padding: 16px !important; }
  body.web-layout .canvas { padding: 0; }
  .panel { min-height: 0; padding-top: 2px; }
  .group-label { display: none; }
  .ruler { display: none; }
}

/* ------------------------------------------------------------------ print */
@media print {
  html, body { height: auto; overflow: visible; background: #fff; }
  .titlebar, .scroller, .tabs, .ribbon, .ruler, .statusbar, .pane, #toasts, .backstage, .img-tools, .page-overlay, .dlg { display: none !important; }
  .app, .workspace, .canvas { display: block; height: auto; overflow: visible; padding: 0; }
  .zoom-outer { width: auto !important; height: auto !important; }
  .zoom-inner { position: static; transform: none !important; }
  .sheet { width: auto !important; min-height: 0 !important; padding: 0 !important; box-shadow: none; }
  .doc { min-height: 0 !important; }
  .doc .nsw-page-break { break-after: page; height: 0; margin: 0; border: none; }
  .doc .nsw-page-break::after { display: none; }
  .doc .nsw-section { display: none; }
  .doc .nsw-comment { background: none; border: none; }
  .doc.show-marks *::after { content: none !important; }
  .doc table.ns-table.ns-noborder td { border: none; }
  .doc h1, .doc h2, .doc h3 { break-after: avoid; }
  .doc table, .doc img { break-inside: avoid; }
}

.canvas:focus { outline: none; }
.canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ctx-anchor { position: fixed; width: 1px; height: 1px; pointer-events: none; }
.pop.ctx-menu { min-width: 230px; }
.hf-row { display: grid; grid-template-columns: 140px 1fr; gap: 8px; align-items: center; margin: 6px 0; }
.hf-row-label { font-size: 13px; color: var(--ink-2); }
.hf-trio { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.hf-trio .inp:nth-child(2) { text-align: center; }
.hf-trio .inp:nth-child(3) { text-align: right; }
.hf-first { padding: 4px 0 4px 12px; border-left: 3px solid var(--accent-soft); margin: 4px 0 8px; }
@media (max-width: 600px) { .hf-row { grid-template-columns: 1fr; } }
.style-preview { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: #000; padding: 12px; min-height: 48px; overflow: hidden; }
.ver-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; max-width: 720px; }
.ver-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel, transparent); }
.ver-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ver-info small { color: var(--ink-2); }
.ver-actions { display: flex; gap: 6px; flex: none; }
.dlg .ver-preview { max-height: 60vh; overflow: auto; border: 1px solid var(--line); padding: 24px 32px; background: #fff; color: #000; }
.shape-dlg { display: grid; grid-template-columns: 1fr 220px; gap: 16px; align-items: start; }
.shape-preview { border: 1px dashed var(--line-2); border-radius: var(--radius); min-height: 180px; display: grid; place-items: center; background: #fff; padding: 8px; overflow: hidden; }
.shape-preview svg { max-width: 100%; max-height: 260px; height: auto; }
.shape-colour { display: flex; align-items: center; gap: 8px; }
.shape-colour .inp[type=color], .shape-form .inp[type=color] { width: 56px; height: 32px; padding: 2px; }
@media (max-width: 600px) { .shape-dlg { grid-template-columns: 1fr; } }
.ref-list { width: 100%; min-height: 160px; font-size: 13px; white-space: pre; }
.sheet.multi-sec { background: transparent; box-shadow: none; }
.page-card { position: absolute; background: #fff; box-shadow: var(--sheet-shadow); }
.dlg .inp[type=color] { width: 64px; height: 32px; padding: 2px; }

/* ------------------------------------------------------------------ reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ------------------------------------------------------------------ round 2: shell features */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.btn.btn-sm { min-height: 28px; padding: 3px 10px; font-size: 12.5px; }

/* Templates drawn at real size and scaled down */
.tpl-thumb.tpl-real { padding: 0; position: relative; font: inherit; }
.tpl-real-in { position: absolute; top: 0; left: 0; width: 595px; height: 770px; padding: 56px 60px; box-sizing: border-box; transform: scale(0.2185); transform-origin: 0 0; column-gap: 24pt; overflow: hidden; }

/* Find pane tabs and Go To */
.find-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: -2px 0 10px; }
.find-tab { border: none; background: none; padding: 7px 10px 8px; min-height: 32px; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.find-tab:hover { color: var(--ink); background: var(--hover); }
.find-tab[aria-selected="true"] { color: var(--accent-ink); border-bottom-color: var(--accent); font-weight: 600; }
.goto-box select[size] { min-height: 120px; }
.goto-box .btn-row { margin-top: 0; }
.goto-box .btn-row .btn { flex: 1; justify-content: center; }

/* File › Options */
.options { max-width: 760px; }
.opt-jump { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 6px; }
.options h2[tabindex]:focus { outline: none; }
.options h2[tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
.opt-sec { margin-top: 8px; }
.opt-sub { font-size: 13px; font-weight: 600; margin: 16px 0 4px; }
.ac-add { display: grid; grid-template-columns: 1fr 1.6fr auto; gap: 8px; align-items: end; }
.ac-add .field { margin-bottom: 0; }
.ac-add .btn { min-width: 84px; justify-content: center; }
.ac-note { min-height: 18px; margin: 6px 0; font-size: 12.5px; }
.ac-list, .key-list { margin-top: 8px; max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--chrome); }
.ac-row, .key-row { display: grid; align-items: center; gap: 8px; padding: 5px 10px; border-top: 1px solid var(--line); }
.ac-row:first-child, .key-row:first-child { border-top: none; }
.ac-row { grid-template-columns: minmax(80px, 170px) 14px minmax(80px, 1fr) 72px auto; }
.ac-from, .ac-to { font-family: ui-monospace, Consolas, 'Cascadia Mono', Menlo, monospace; font-size: 12.5px; font-variant-ligatures: none; overflow-wrap: anywhere; }
.ac-from { font-weight: 600; }
.ac-arrow { color: var(--ink-2); }
.ac-kind { font-size: 11.5px; color: var(--ink-2); }
.ac-row.off .ac-from, .ac-row.off .ac-to { text-decoration: line-through; color: var(--ink-2); }
.ac-actions, .key-actions { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.key-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.key-tools .inp { flex: 1; min-width: 180px; width: auto; }
.key-list { max-height: 360px; }
.key-row { grid-template-columns: minmax(0, 1.5fr) minmax(90px, 1fr) auto; }
.key-cmd { display: flex; flex-direction: column; min-width: 0; }
.key-cmd small, .key-changed { color: var(--ink-2); font-size: 11.5px; }
.key-now { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.key-row.changed .key-now kbd { border-color: var(--accent); color: var(--accent-ink); }
.key-capture { font: 600 15px/1.2 var(--font-ui); text-align: center; caret-color: transparent; }
.key-msg { min-height: 36px; margin: 4px 0 0; color: var(--ink-2); font-size: 12.5px; }
.key-msg.warn { color: #b45309; }
body.dark .key-msg.warn { color: #fbbf24; }
.keys-custom { margin-bottom: 8px; }
.storage-status p { margin: 6px 0; }
.storage-line { font-size: 13px; }
.storage-meter { width: 100%; max-width: 420px; height: 10px; }
.storage-badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: #fef3c7; color: #92400e; }
.storage-badge[data-ok="true"] { background: #dcfce7; color: #166534; }
body.dark .storage-badge { background: #422006; color: #fde68a; }
body.dark .storage-badge[data-ok="true"] { background: #052e16; color: #bbf7d0; }

/* Recent documents */
.recent-tools { max-width: 760px; margin-bottom: 8px; }
.recent-search { max-width: 360px; }
.recent-acts { display: flex; gap: 2px; padding-right: 6px; opacity: 0.55; }
.recent:hover .recent-acts, .recent:focus-within .recent-acts, .recent.pinned .recent-acts { opacity: 1; }
.recent-act { width: 30px; height: 30px; }
.recent-act.on { color: var(--accent); background: var(--accent-soft); }
.recent-pin { color: var(--accent); display: none; }
.recent-pin .ico { width: 15px; height: 15px; }

/* Print preview */
.pp-layout { display: grid; grid-template-columns: 240px 1fr; gap: 28px; align-items: start; }
.pp-side { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 0; }
.pp-print { justify-content: center; min-height: 44px; font-size: 15px; }
.pp-print .ico { width: 20px; height: 20px; }
.pp-count { margin: 0; }
.pp-side p { margin: 0; font-size: 12.5px; line-height: 1.45; }
.pp-links { display: flex; flex-direction: column; gap: 6px; }
.pp-main { min-width: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.pp-strip { display: flex; flex-wrap: wrap; gap: 18px; justify-content: flex-start; }
.pp-page { border: none; background: none; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--ink-2); border-radius: 4px; }
.pp-paper { position: relative; overflow: hidden; background: #fff; box-shadow: var(--sheet-shadow); outline: 1px solid rgba(0, 0, 0, 0.06); }
.pp-page:hover .pp-paper { outline: 2px solid var(--accent); }
.pp-page:focus-visible { outline: none; }
.pp-page:focus-visible .pp-paper { outline: 3px solid var(--accent); outline-offset: 2px; }
.pp-num { font-size: 12px; font-variant-numeric: tabular-nums; }
.pp-sheet { box-shadow: none !important; pointer-events: none; text-align: left; white-space: normal; letter-spacing: normal; font: 13px/1.35 var(--font-ui); color: #000; }
.pp-sheet .page-gap { display: none; }
.pp-sheet .page-card { box-shadow: none; }
.pp-sheet .nsw-comment { background: none !important; border: none !important; }
.pp-sheet .toc-empty, .pp-sheet .nsw-page-break::after { visibility: hidden; }

/* Word count */
.wc-table thead th { text-align: right; font-weight: 600; color: var(--ink); padding: 4px 0 6px 12px; }
.wc-table td + td { padding-left: 16px; }
.wc-notes { margin-top: 10px; }
.wc-hint { font-size: 12px; margin: 6px 0 0; }

@media (max-width: 900px) {
  .pp-layout { grid-template-columns: 1fr; gap: 16px; }
  .pp-side { position: static; }
  .pp-links { flex-direction: row; flex-wrap: wrap; }
}
@media (max-width: 600px) {
  .ac-add { grid-template-columns: 1fr 1fr; }
  .ac-add .btn { grid-column: 1 / -1; }
  .ac-row { grid-template-columns: minmax(0, 1fr) 12px minmax(0, 1fr); row-gap: 2px; }
  .ac-kind { grid-column: 1; }
  .ac-actions { grid-column: 2 / -1; }
  .key-row { grid-template-columns: minmax(0, 1fr) auto; }
  .key-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .pp-main { padding: 10px; }
  .pp-strip { gap: 12px; justify-content: center; }
  .recent-acts { opacity: 1; padding-right: 2px; }
  .recent-act { width: 28px; height: 28px; }
}

/* Dialog tabs, radio groups and document-feature dialogs */
.dlg-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0 0 6px; overflow-x: auto; }
.dlg-tab { border: none; background: none; padding: 7px 12px 8px; min-height: 34px; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.dlg-tab:hover { color: var(--ink); background: var(--hover); }
.dlg-tab[aria-selected="true"] { color: var(--accent-ink); border-bottom-color: var(--accent); font-weight: 600; }
.para-extra { justify-content: flex-start; margin-top: 10px; }
.chk-hint { display: block; flex-basis: 100%; margin: -2px 0 4px 22px; font-size: 11.5px; }
.dlg .chk:has(.chk-hint) { flex-wrap: wrap; }
.fs { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px 8px; margin: 0 0 10px; min-width: 0; }
.fs legend { font-size: 12px; color: var(--ink-2); padding: 0 4px; }
.radio-row { display: flex; flex-wrap: wrap; gap: 0 14px; }
.tabs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.tab-list, .bm-list { width: 100%; min-height: 128px; font-variant-numeric: tabular-nums; }
.tab-msg, .bm-msg { min-height: 18px; margin: 6px 0 0; font-size: 12.5px; }
.bm-msg.warn { color: #b45309; }
body.dark .bm-msg.warn { color: #fbbf24; }
.tab-hint { font-size: 12px; margin: 6px 0 0; }
.bm-sort { margin: 6px 0 0; }
@media (max-width: 600px) { .tabs-grid { grid-template-columns: 1fr; } }
@media (max-width: 600px) {
  .tpl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; }
  .tpl-thumb { width: 108px; height: 140px; padding: 9px 8px; }
  .tpl .tpl-real-in { transform: scale(0.1815); }
  .tpl > span { font-size: 12px; text-align: center; }
}
.dlg-tabbed > [role="tabpanel"] { min-height: 290px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn:disabled:hover { background: var(--chrome); }
.btn.primary:disabled:hover { background: var(--accent); filter: none; }
.bs-main table.stats.props { max-width: 760px; }
.bs-main table.stats.props th { width: 160px; }
