/* Xenify Write — the look agreed for Write (warm stone,
   white sheets, ember accent, Figtree). */

@font-face {
  font-family: Figtree;
  src: url(fonts/Figtree.ttf) format('truetype');
  font-weight: 300 900;
  font-display: block;
}

:root {
  --ground: #EFECE8;
  --ground-2: #E6E2DD;
  --sheet: #FFFFFF;
  --soft: #F7F5F2;
  --soft-2: #F2EFEB;
  --line: #E2DDD7;
  --line-2: #D6D0C9;
  --ink: #1C1917;
  --ink-2: #44403C;
  --muted: #57534E;
  --faint: #78716C;
  --accent: #C2410C;
  --accent-ink: #9A3412;
  --accent-soft: #FFF1E8;
  --accent-line: #F3D2BF;
  --sel: rgba(194, 65, 12, 0.22);
  --shadow: 0 1px 3px rgba(28, 25, 23, .10), 0 8px 24px rgba(28, 25, 23, .06);
  --pop: 0 4px 10px rgba(28, 25, 23, .10), 0 18px 44px rgba(28, 25, 23, .18);
  --on-accent: #FFFFFF;
  --spell: #B91C1C;
  --gram: #1D4ED8;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #1C1A18; --ground-2: #2A2724; --sheet: #262321; --soft: #2E2B28; --soft-2: #33302C;
    --line: #3A3632; --line-2: #4A4540; --ink: #F5F3F0; --ink-2: #D6D0C9; --muted: #B5ADA5; --faint: #9C948C;
    --accent: #EA7A45; --accent-ink: #F59E6B; --accent-soft: #3A2418; --accent-line: #5A3420;
    --sel: rgba(234, 122, 69, 0.30);
    --on-accent: #1C1917; --spell: #F87171; --gram: #93C5FD;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #1C1A18; --ground-2: #2A2724; --sheet: #262321; --soft: #2E2B28; --soft-2: #33302C;
  --line: #3A3632; --line-2: #4A4540; --ink: #F5F3F0; --ink-2: #D6D0C9; --muted: #B5ADA5; --faint: #9C948C;
  --accent: #EA7A45; --accent-ink: #F59E6B; --accent-soft: #3A2418; --accent-line: #5A3420;
  --sel: rgba(234, 122, 69, 0.30);
  --on-accent: #1C1917; --spell: #F87171; --gram: #93C5FD;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* Thin scroll bars in the app's colours (WebKit's own draw over popups). */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--faint); border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-corner { background: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ground);
  color: var(--ink);
  font: 400 14px/1.4 Figtree, system-ui, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.app { display: flex; flex-direction: column; height: 100vh; }

/* ----- Menu bar ----- */
.menubar { display: flex; align-items: center; gap: 2px; padding: 6px 12px 0; flex: none; }
.brand { display: flex; align-items: center; gap: 8px; padding: 0 10px 0 4px; font-weight: 700; font-size: 15px; }
.mark { width: 22px; height: 22px; border-radius: 7px; background: var(--accent); color: #fff; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center; }
.menus { display: flex; gap: 2px; }
.menu-btn { border: 0; background: transparent; font-weight: 500; color: var(--ink-2); padding: 6px 10px; border-radius: 8px; cursor: default; }
.menu-btn:hover, .menu-btn[aria-expanded="true"] { background: var(--ground-2); color: var(--ink); }

/* ----- Popups (menus, pickers) ----- */
.popup { position: fixed; z-index: 50; background: var(--sheet); border-radius: 14px; box-shadow: var(--pop);
  padding: 6px; min-width: 220px; max-height: 70vh; overflow-y: auto; }
.item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 34px; padding: 6px 10px; border: 0;
  border-radius: 8px; background: transparent; text-align: left; cursor: default; font-size: 14px; }
.item:hover, .item.active { background: var(--accent-soft); }
.item[disabled] { color: var(--faint); background: transparent; }
.item .keys { margin-left: auto; padding-left: 24px; color: var(--muted); font-size: 12.5px; }
.item .check { width: 16px; flex: none; color: var(--accent); margin-left: auto; }
.item .keys + .check { margin-left: 0; }
.popup hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.popup .search { width: 100%; height: 36px; border-radius: 9px; border: 1px solid var(--line-2); padding: 0 10px; margin-bottom: 6px;
  background: var(--sheet); color: var(--ink); font: inherit; }

/* ----- Tabs ----- */
.tabstrip { display: flex; align-items: flex-end; gap: 4px; padding: 8px 12px 0; flex: none; min-height: 48px; }
.tabs { display: flex; align-items: flex-end; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tab { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 14px; border-radius: 12px 12px 0 0;
  color: var(--muted); white-space: nowrap; cursor: default; border: 0; background: transparent; max-width: 260px; }
.tab:hover { background: var(--ground-2); }
.tab[aria-selected="true"] { height: 40px; background: var(--sheet); color: var(--ink); font-weight: 600; }
.tab .name { overflow: hidden; text-overflow: ellipsis; }
.tab .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.tab .close { width: 24px; height: 24px; border-radius: 7px; border: 0; background: transparent; display: inline-flex;
  align-items: center; justify-content: center; color: var(--muted); opacity: 0; }
.tab:hover .close, .tab[aria-selected="true"] .close { opacity: 1; }
.tab .close:hover { background: var(--soft-2); color: var(--ink); }

/* ----- Toolbar ----- */
.toolbar { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; padding: 7px 12px; background: var(--sheet);
  border-bottom: 1px solid var(--line); flex: none; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 0;
  background: transparent; border-radius: 10px; color: var(--ink-2); font-weight: 600; font-size: 15px; cursor: default; }
.icon-btn:hover { background: var(--soft-2); }
.icon-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); }
.icon-btn[disabled] { color: var(--line-2); background: transparent; }
.pick[disabled], .size-box[disabled] { opacity: .45; }
/* Someone who may only comment on (or read) the document. */
.limited-note { margin-left: auto; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 13px; font-weight: 600; white-space: nowrap; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.small { width: 32px; height: 32px; margin-bottom: 2px; }
.sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; }
.pick { display: inline-flex; align-items: center; justify-content: space-between; gap: 6px; height: 34px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--sheet); font-weight: 500; cursor: default; }
.pick:hover { border-color: var(--line-2); }
.pick svg { width: 14px; height: 14px; color: var(--faint); flex: none; }
.pick .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.size-box { width: 64px; height: 34px; border: 1px solid var(--line); border-radius: 10px; padding: 0 8px; font: inherit;
  font-weight: 500; background: var(--sheet); color: var(--ink); }
.colour-bar { width: 16px; height: 3px; border-radius: 2px; margin-top: 1px; }
.spacer { flex: 1 1 0; }
.swatches { display: grid; grid-template-columns: repeat(8, 28px); gap: 6px; padding: 6px; }
.swatch { width: 28px; height: 28px; border-radius: 8px; border: 1px solid rgba(0,0,0,.12); cursor: default; }
.swatch-add { display: grid; place-items: center; position: relative; overflow: hidden; color: var(--muted); background: var(--sheet); border-style: dashed; }
.swatch-add:hover { color: var(--ink); border-color: var(--muted); }
.swatch-input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; padding: 0; border: 0; cursor: pointer; }

/* ----- Work area ----- */
.work { flex: 1 1 auto; display: flex; min-height: 0; }
.doc-area { flex: 1 1 auto; min-width: 0; position: relative; display: flex; flex-direction: column; }
.scroller { flex: 1 1 auto; overflow: auto; position: relative; }
.stack { position: relative; cursor: text; }
.sheet { position: absolute; background: #fff; box-shadow: var(--shadow); border-radius: 2px; }
.overlay { position: absolute; inset: 0; pointer-events: none; }
.caret { position: absolute; width: 2px; margin-left: -1px; background: var(--ink); display: none; }
.caret.blink { animation: blink 1.06s steps(1) infinite; }
@keyframes blink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }
:root[data-motion="reduce"] .caret.blink { animation: none; }
@media (prefers-reduced-motion: reduce) { .caret.blink { animation: none; } }
.sel { position: absolute; background: var(--sel); }
.ime { position: absolute; width: 2px; opacity: 0; border: 0; padding: 0; resize: none; overflow: hidden;
  font-size: 16px; pointer-events: none; }
:root:not(.focused) .caret { display: none !important; }

/* Ruler: sticks to the top while the pages scroll under it. */
.ruler { position: sticky; top: 0; z-index: 3; height: 34px; background: var(--ground); }
.ruler-track { position: absolute; top: 6px; height: 24px; background: var(--ground-2); border-radius: 4px; overflow: hidden; }
.ruler-body { position: absolute; top: 0; bottom: 0; background: var(--sheet); }
.ruler-tick { position: absolute; bottom: 0; width: 1px; background: var(--faint); }
.ruler-num { position: absolute; top: 2px; font-size: 10px; color: var(--muted); transform: translateX(-50%); }
.ruler-mark { position: absolute; width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; cursor: ew-resize; z-index: 2; }
.ruler-mark::after { content: ""; position: absolute; left: -7px; top: -9px; width: 14px; height: 16px; }
.ruler-edge { position: absolute; top: 8px; bottom: 8px; width: 8px; cursor: col-resize; z-index: 1; }
.ruler-edge:hover { background: rgba(194, 65, 12, .18); }
.ruler-mark.top { top: 0; border-top: 7px solid var(--accent); }
.ruler-mark.bottom { bottom: 0; border-bottom: 7px solid var(--accent); }

.card { background: var(--soft); border-radius: 14px; padding: 12px 14px; }
.card .small { font-size: 13px; color: var(--muted); }
.card .big { font-size: 15px; font-weight: 600; margin-top: 2px; }
.card .mid { font-size: 14px; color: var(--ink-2); margin-top: 2px; }

/* ----- Status bar ----- */
.status { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; padding: 6px 16px 6px 20px; font-size: 13.5px;
  color: var(--ink-2); border-top: 1px solid var(--line); background: var(--soft); flex: none; }
.status .spacer { flex: 1 1 0; }
.zoom { display: inline-flex; align-items: center; gap: 2px; }
.zoom button { width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; cursor: default; }
.zoom button:hover { background: var(--soft-2); }
.zoom .pct { min-width: 46px; text-align: center; }

.toast { position: fixed; left: 50%; bottom: 56px; transform: translateX(-50%); background: var(--ink); color: var(--sheet);
  padding: 10px 16px; border-radius: 12px; box-shadow: var(--pop); z-index: 60; font-size: 14px; }

/* ----- Full-window screens (New document, Settings) ----- */
.screen { position: fixed; inset: 0; z-index: 40; background: var(--ground); display: flex; flex-direction: column;
  gap: 16px; padding: 20px 24px 24px; overflow: hidden; }
@media (max-width: 900px) { .screen { overflow: auto; } .screen .sheet-pane { max-height: none; } }
.screen-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.screen-head h1 { margin: 0; font-size: 24px; font-weight: 700; }
.screen-head .lede { font-size: 15px; color: var(--muted); }
.screen-body { flex: 1 1 auto; display: flex; flex-wrap: wrap; gap: 16px; align-items: stretch; min-height: 0; }
.screen-body > * { max-height: 100%; }
.sheet-pane { background: var(--sheet); border-radius: 20px; padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.field { width: 100%; height: 42px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--sheet); padding: 0 12px;
  font: 400 15px Figtree, sans-serif; color: var(--ink); }
.field::placeholder { color: #8A827B; }
.field:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.field.big { height: 48px; font-size: 18px; font-weight: 600; }
.lbl { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.lbl .opt { font-weight: 400; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--sheet); font-weight: 500; cursor: default; }
.chip:hover { border-color: var(--faint); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--sheet); }
.segs { display: flex; gap: 4px; padding: 4px; background: var(--soft-2); border-radius: 12px; max-width: 420px; }
.seg { flex: 1 1 0; height: 38px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; font-weight: 500; color: var(--ink-2); cursor: default; white-space: nowrap; }
.seg.on { background: var(--sheet); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(28, 25, 23, .1); }
.btn { height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--sheet); font-weight: 600; font-size: 15px; cursor: default; white-space: nowrap; }
.btn:hover { border-color: var(--faint); }
.btn.main { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.main:hover { background: var(--accent-ink); }
.btn.danger { color: var(--spell); border-color: var(--spell); }
.recover-start { font-style: italic; }

.search-icon { position: absolute; left: 12px; top: 12px; color: var(--faint); }
.card-name { font-size: 14px; font-weight: 600; line-height: 1.25; }
.none { margin: 0; font-size: 15px; color: var(--ink-2); }
.about { margin: 4px 0 0; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.grow { flex: 1 1 auto; }
.actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 16px; }
.actions .later { font-size: 14px; color: var(--muted); flex: 1 1 240px; }
.actions.two .later { flex-basis: 100%; }
.actions.two .btn:first-of-type { margin-left: auto; }
.details-pop { display: flex; flex-direction: column; gap: 14px; padding: 10px 10px 6px; }
.details-pop h2 { margin: 0; font-size: 17px; }
.hint-text { margin: 6px 0 0; font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.pop-actions { display: flex; justify-content: flex-end; gap: 8px; }
.pop-actions .btn { height: 40px; }
select.field { appearance: auto; }

/* ----- Settings ----- */
.settings { flex-direction: row; flex-wrap: wrap; align-items: flex-start; padding: 16px; gap: 16px; overflow-y: auto; }
.set-nav { flex: 1 1 260px; max-width: 300px; display: flex; flex-direction: column; gap: 14px; padding: 8px 4px; position: sticky; top: 0; z-index: 2; }
.set-title { display: flex; align-items: center; justify-content: space-between; margin: 0 4px 0 8px; }
.set-title h1 { margin: 0; font-size: 24px; font-weight: 700; }
.btn.small { height: 38px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.set-search-wrap { position: relative; }
.set-search { height: 44px; border-radius: 12px; padding-left: 40px; }
.set-search-wrap .search-icon { top: 13px; }
.set-results { position: absolute; top: 52px; left: 0; width: 440px; max-width: calc(100vw - 48px); background: var(--sheet); border-radius: 16px;
  box-shadow: var(--pop); padding: 8px; z-index: 5; }
.set-results[hidden] { display: none; }
.res { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px;
  background: transparent; text-align: left; cursor: default; }
.res.on, .res:hover { background: var(--accent-soft); }
.res-label { font-size: 15px; }
.res mark { background: transparent; color: var(--accent-ink); font-weight: 700; }
.res-path { font-size: 13px; color: var(--muted); }
.res-none { padding: 12px; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.res-keys { display: flex; gap: 14px; padding: 8px 12px 4px; border-top: 1px solid var(--line); margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.set-nav-list { display: flex; flex-direction: column; gap: 2px; }
.set-nav-btn { display: flex; align-items: center; gap: 12px; width: 100%; height: 44px; padding: 0 12px; border: 0; border-radius: 12px;
  background: transparent; font-weight: 500; font-size: 15px; text-align: left; cursor: default; }
.set-nav-btn svg { color: var(--muted); flex: none; }
.set-nav-btn:hover { background: var(--ground-2); }
.set-nav-btn.on { background: var(--sheet); font-weight: 600; box-shadow: 0 1px 2px rgba(28, 25, 23, .08); }
.set-nav-btn.on svg { color: var(--accent); }
.set-foot { margin: 4px 12px; font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.set-main { flex: 999 1 560px; min-width: 0; background: var(--sheet); border-radius: 20px; padding: 28px 32px 36px; min-height: calc(100vh - 32px); }
.set-inner { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 26px; }
.set-inner h2 { margin: 0; font-size: 26px; font-weight: 700; }
.set-about { margin: 6px 0 0; font-size: 15.5px; line-height: 1.5; color: var(--ink-2); }
.set-group h3 { margin: 0 0 4px; font-size: 16px; font-weight: 700; }
.set-note { margin: 0 0 8px; font-size: 14.5px; line-height: 1.5; color: var(--muted); }
.set-rows { border: 1px solid var(--line); border-radius: 14px; margin-top: 8px; }
.set-row { display: flex; align-items: center; gap: 24px; padding: 16px 18px; border-radius: 12px; scroll-margin: 120px; }
.set-row + .set-row { border-top: 1px solid var(--line); }
.set-row.wide { flex-direction: column; align-items: stretch; gap: 12px; }
.set-row.hl { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); border-top-color: transparent; animation: glow 1.1s ease-out 2; }
.set-row.hl + .set-row { border-top-color: transparent; }
@keyframes glow { 0% { box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 0 rgba(194, 65, 12, .35); } 100% { box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 12px rgba(194, 65, 12, 0); } }
:root[data-motion="reduce"] .set-row.hl { animation: none; }
@media (prefers-reduced-motion: reduce) { .set-row.hl { animation: none; } }
.set-label { flex: 1 1 auto; min-width: 0; }
.set-name { font-size: 15.5px; font-weight: 600; line-height: 1.35; }
.set-desc { font-size: 14.5px; line-height: 1.5; color: var(--muted); margin-top: 3px; }
.switch { position: relative; flex: none; width: 48px; height: 28px; border-radius: 999px; border: 0; background: #C9C2BA; cursor: default; padding: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: left .15s; }
.switch.on { background: var(--accent); }
.chip.on { color: var(--sheet); }
.switch.on::after { left: 23px; }
:root[data-motion="reduce"] .switch::after { transition: none; }
.set-select { width: auto; min-width: 220px; max-width: 320px; height: 40px; font-weight: 500; }
.set-text { width: 260px; height: 40px; }
.set-segs { flex: none; max-width: none; }
.set-segs .seg { flex: none; height: 36px; }
.slider { display: flex; align-items: center; gap: 12px; flex: none; }
.slider input { accent-color: var(--accent); width: 200px; }
.slider-val { font-size: 15px; font-weight: 600; width: 48px; text-align: right; }
.pairs { display: flex; flex-direction: column; gap: 6px; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) 64px; gap: 8px; align-items: center; font-size: 15px; }
.pair.head { font-size: 13px; font-weight: 600; color: var(--muted); padding: 0 2px; }
.pair .field { height: 40px; }
.pair-list { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; }
.cell { background: var(--soft); border-radius: 8px; padding: 8px 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell.mono { font-family: ui-monospace, monospace; }

/* High contrast: black on white, strong outlines. */
:root[data-contrast="high"] { --ground: #FFFFFF; --ground-2: #E8E8E8; --soft: #F2F2F2; --soft-2: #E8E8E8; --line: #000000; --line-2: #000000;
  --ink: #000000; --ink-2: #000000; --muted: #222222; --faint: #333333; --accent: #9A2A00; --accent-ink: #7A2000; --accent-soft: #FFE8DA; }
.menu-label { font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 10px 2px; }
.modal-back { position: fixed; inset: 0; z-index: 70; background: rgba(28, 25, 23, .28); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { width: 440px; max-width: 100%; background: var(--sheet); border-radius: 20px; box-shadow: var(--pop); padding: 22px 24px 18px; }
.modal h2 { margin: 0 0 8px; font-size: 18px; }
.modal p { margin: 0 0 18px; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.modal-actions .btn { height: 40px; }

/* Spelling and grammar underlines (screen only). */
.uline { position: absolute; height: 4px; background-repeat: repeat-x; background-size: 6px 4px; }
.uline.spelling { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='4'%3E%3Cpath d='M0 3 L1.5 1 L3 3 L4.5 1 L6 3' fill='none' stroke='%23DC2626' stroke-width='1.2'/%3E%3C/svg%3E"); }
.uline.grammar { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='4'%3E%3Cpath d='M0 3 L1.5 1 L3 3 L4.5 1 L6 3' fill='none' stroke='%232563EB' stroke-width='1.2'/%3E%3C/svg%3E"); }
.uline.style, .uline.readability, .uline.register { height: 2px; background-image: radial-gradient(circle, #C2410C 0.9px, transparent 1.1px); background-size: 4px 2px; }

/* Writing panel */
.check-card { background: var(--soft); border-radius: 14px; padding: 12px 14px; }
.check-card .row { display: flex; justify-content: space-between; align-items: center; }
.check-card .small { font-size: 13px; color: var(--muted); }
.check-card .big { font-size: 15px; font-weight: 600; margin-top: 2px; }
.check-card .mid { font-size: 14px; color: var(--ink-2); margin-top: 2px; }
.link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; font-size: 13.5px; cursor: default; }
.link:hover { color: var(--accent-ink); text-decoration: underline; }
.count-row { display: flex; justify-content: space-between; align-items: baseline; }
.count-row h2 { margin: 0; font-size: 16px; }
.count-row span { font-size: 13.5px; color: var(--muted); }
.issue { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; cursor: default; }
.issue:hover { border-color: var(--line-2); }
.issue.on { border: 2px solid var(--accent); padding: 11px 13px; }
.issue .kind { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.issue .dot { width: 8px; height: 8px; border-radius: 50%; }
.issue.spelling .kind { color: var(--spell); } .issue.spelling .dot { background: #DC2626; }
.issue.grammar .kind { color: var(--gram); } .issue.grammar .dot { background: #2563EB; }
.issue.style .kind, .issue.readability .kind, .issue.register .kind { color: var(--accent-ink); }
.issue.style .dot, .issue.readability .dot, .issue.register .dot { background: var(--accent); }
.issue .ctx { font-size: 15px; margin: 6px 0 4px; line-height: 1.45; color: var(--ink-2); }
.issue .ctx s { color: var(--faint); }
.issue .ctx b { color: var(--ink); }
.issue .msg { font-size: 14px; color: var(--ink-2); line-height: 1.45; margin-bottom: 10px; }
.issue .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.issue .btn { height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.all-good { text-align: center; padding: 24px 8px; color: var(--ink-2); font-size: 15px; line-height: 1.5; }

.words { display: flex; flex-direction: column; gap: 12px; }
.words-add { display: flex; gap: 8px; flex-wrap: wrap; }
.words-add .field { height: 40px; }
.word-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.word { display: inline-flex; align-items: center; gap: 2px; height: 36px; padding: 0 2px 0 14px; border-radius: 999px; background: var(--soft); font-size: 15px; }
.word .icon-btn { width: 30px; height: 30px; border-radius: 999px; }

/* Look up: the word card */
.wordcard { padding: 10px 10px 6px; display: flex; flex-direction: column; gap: 8px; }
.wordcard .head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.wordcard .wc-word { font-family: Georgia, 'Times New Roman', serif; font-size: 21px; font-weight: 700; }
.wordcard .pos { font-size: 13px; color: var(--muted); }
.wordcard .say { font-size: 13px; color: var(--faint); }
.wordcard .def { margin: 0; font-size: 14.5px; line-height: 1.45; color: var(--ink-2); }
.wordcard .eg { margin: 2px 0 0; font-size: 13.5px; color: var(--muted); font-style: italic; }
.wordcard .swap-label { font-size: 12px; font-weight: 600; color: var(--muted); margin: 6px 0 2px; }
.wordcard .chips { gap: 6px; }
.wordcard .chip { height: 32px; padding: 0 12px; font-size: 14px; }
.wordcard .chip:hover { border-color: var(--accent); color: var(--accent-ink); }
.wordcard .opp { font-size: 13.5px; color: var(--muted); }
.wordcard .meaning:not(.first) { border-top: 1px solid var(--line); padding-top: 8px; }
.wordcard .foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 2px; }
.wordcard .hint { font-size: 12.5px; color: var(--muted); }

.hit { position: absolute; background: rgba(250, 204, 21, .40); border-radius: 2px; }
.hit.on { background: rgba(249, 115, 22, .45); box-shadow: 0 0 0 1px rgba(194, 65, 12, .6); }

/* Find bar: at the bottom, like a browser. */
.findbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; background: var(--sheet); border-top: 1px solid var(--line); flex: none; }
.findbar .field { height: 36px; width: 240px; font-size: 14px; }
.findbar .count { font-size: 13.5px; color: var(--muted); min-width: 72px; }
.findbar .opt { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--ink-2); padding: 0 6px; }
.findbar .opt input { accent-color: var(--accent); width: 16px; height: 16px; }
.findbar .btn { height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.table-grid { display: grid; grid-template-columns: repeat(8, 22px); gap: 3px; padding: 6px; }
.table-grid button { width: 22px; height: 22px; border: 1px solid var(--line-2); border-radius: 4px; background: var(--sheet); padding: 0; }
.table-grid button.on { background: var(--accent-soft); border-color: var(--accent); }
.table-size { font-size: 13px; color: var(--muted); padding: 4px 6px 2px; }
.link-pop { display: flex; flex-direction: column; gap: 10px; padding: 8px; }
.link-pages { display: flex; flex-direction: column; gap: 2px; }
.link-pages:empty { display: none; }
.link-page { text-align: left; border: 0; background: none; padding: 7px 8px; border-radius: 8px; font: inherit; color: var(--ink); cursor: pointer; }
.link-page:hover, .link-page:focus-visible { background: var(--accent-soft); }
.link-page.on { background: var(--accent-soft); font-weight: 600; }
.link-page .hint { color: var(--muted); font-weight: 400; font-size: 13px; }

.modal.wide { width: 520px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid .field { height: 40px; }
.form-grid .segs { max-width: none; }
@media (max-width: 560px) { .form-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* AI tab */
.ai-sec { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.ai-sec:first-of-type { border-top: 0; padding-top: 0; }
.ai-sec h3 { margin: 0; font-size: 15px; }
.ai-note { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.ai-row { display: flex; gap: 8px; }
.ai-row .field { height: 38px; font-size: 14px; flex: 1 1 auto; min-width: 0; }
.ai-sec .btn { height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.ai-sec .chips .btn { border-radius: 999px; }
.ai-result { background: var(--soft); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.ai-result .diff { font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; }
.ai-result .diff s { color: #B91C1C; margin-right: 4px; }
.ai-result .diff b { color: var(--ink); background: rgba(22, 163, 74, .12); font-weight: 600; }
.ai-result .acts, .issue .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.bubble { font-size: 14.5px; line-height: 1.5; padding: 8px 12px; border-radius: 14px; white-space: pre-wrap; display: flex; flex-direction: column; gap: 8px; }
.bubble.user { background: var(--accent-soft); align-self: flex-end; max-width: 90%; }
.bubble.assistant { background: var(--soft); }
.ai-error { background: #FEF2F2; color: #991B1B; border-radius: 12px; padding: 10px 12px; font-size: 14px; line-height: 1.45; }
.ai-foot { font-size: 12.5px; color: var(--muted); margin: 0; line-height: 1.5; }
.btn[disabled] { opacity: .5; }

.recover-list { display: flex; flex-direction: column; gap: 8px; }
.recover-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.recover-item .acts { display: flex; gap: 8px; flex: none; }

/* Navigation: the document's headings on the left. */
.navpane { flex: 0 0 260px; margin: 12px 0 12px 12px; background: var(--sheet); border-radius: 20px; padding: 14px 10px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px; }
.navpane h2 { margin: 0 6px 8px; font-size: 15px; display: flex; justify-content: space-between; align-items: center; }
.nav-item { display: flex; align-items: baseline; gap: 8px; width: 100%; min-height: 32px; padding: 5px 8px; border: 0; border-radius: 9px;
  background: transparent; text-align: left; font-size: 14px; line-height: 1.35; cursor: default; color: var(--ink-2); }
.nav-item:hover { background: var(--soft); }
.nav-item.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nav-item .t { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; }
.nav-item .pg { font-size: 12px; color: var(--faint); flex: none; }
.nav-item.l1 { font-weight: 600; color: var(--ink); }
.nav-empty { font-size: 14px; color: var(--muted); line-height: 1.5; padding: 4px 8px; }

.sym-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.sym-group { grid-column: 1 / -1; font-size: 12px; font-weight: 600; color: var(--muted); margin: 8px 2px 2px; }
.sym { height: 40px; border: 1px solid transparent; border-radius: 9px; background: var(--soft); font-size: 19px; cursor: default; display: flex; align-items: center; justify-content: center; }
.sym:hover { border-color: var(--accent); background: var(--accent-soft); }
.sym.emoji img { width: 26px; height: 26px; }

.track-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.field.area { height: auto; padding: 8px 12px; resize: vertical; font: 400 14.5px/1.45 Figtree, sans-serif; }
.issue.comment .who, .issue.change .who { display: flex; gap: 8px; align-items: baseline; font-size: 13.5px; }
.issue.comment .who span, .issue.change .who span { color: var(--muted); font-size: 12.5px; }
.issue.comment .quote { font-size: 13.5px; color: var(--muted); margin: 4px 0; font-style: italic; }
.issue.comment .msg { margin: 4px 0 8px; font-size: 14.5px; color: var(--ink); }
.issue.comment .reply { font-size: 14px; padding: 6px 0 6px 10px; border-left: 2px solid var(--line); margin-bottom: 6px; }
.issue.comment .field { height: 36px; font-size: 14px; margin-bottom: 8px; }
.issue.comment.resolved { opacity: .65; }
.issue.comment.new { display: flex; flex-direction: column; gap: 8px; }
.issue.change.inserted u { text-decoration-color: #16A34A; text-decoration-thickness: 2px; }
.issue.change.deleted s { color: #B91C1C; }

.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.check-line { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 14.5px; }
.check-line input { width: 18px; height: 18px; accent-color: var(--accent); }
.modal .chips .chip { height: 32px; font-size: 13.5px; }

.modal-back.clear { background: rgba(28, 25, 23, .08); align-items: flex-end; padding-bottom: 72px; }
.eq-palette { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; margin-bottom: 10px; }
.eq-palette .sym { height: 36px; font-size: 16px; }
.field.mono { font-family: ui-monospace, 'DejaVu Sans Mono', monospace; font-size: 14.5px; }

.issue .kind .times { margin-left: auto; font-weight: 500; color: var(--muted); background: var(--soft); border-radius: 999px; padding: 2px 8px; font-size: 12px; }

.pic-sel { position: absolute; outline: 2px solid var(--accent); outline-offset: 1px; pointer-events: none; }
.pic-handle { position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; border-radius: 4px; background: #fff; border: 2px solid var(--accent);
  pointer-events: auto; cursor: nwse-resize; }

.shortcuts { display: flex; flex-direction: column; gap: 6px; max-height: 55vh; overflow-y: auto; margin-top: 10px; }
.sc-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 6px 2px; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.sc-row.big { font-size: 16px; border: 0; }
.sc-row.big b { font-size: 24px; }
kbd { font: 500 13px Figtree, sans-serif; background: var(--soft); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 2px 8px; white-space: nowrap; }
.about-box p { margin: 0 0 10px; font-size: 14.5px; line-height: 1.5; color: var(--ink-2); }

.src-list { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; margin: 10px 0; }
.src-list.tall { max-height: 40vh; }
.src-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; line-height: 1.45; }
.src-item input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
.src-item .acts { margin-left: auto; display: flex; gap: 10px; flex: none; }
.src-item .cited { color: var(--accent-ink); font-weight: 600; }
.modal { max-height: calc(100vh - 32px); overflow-y: auto; }

/* Narrow windows: slimmer side panes, so the page keeps its room. */
@media (max-width: 1100px) { .navpane { flex-basis: 220px; } }
@media (max-width: 860px) { .navpane { display: none; } .toolbar .pick { width: auto !important; } }

.merge { display: flex; flex-direction: column; gap: 14px; }
.merge-step { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.merge-step p { margin: 0; font-size: 14.5px; line-height: 1.45; color: var(--ink-2); }
.merge-step .chips .chip { height: 32px; font-size: 14px; }

.modal.kinds { width: 920px; }
.kind-body { display: flex; gap: 16px; min-height: 0; }
.kind-list { flex: 0 0 220px; display: flex; flex-direction: column; gap: 2px; max-height: 60vh; overflow-y: auto; }
.kind-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; min-height: 38px; padding: 6px 10px; border: 0; border-radius: 9px; background: transparent; text-align: left; cursor: default; font-size: 14.5px; }
.kind-item:hover { background: var(--soft); }
.kind-item.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.kind-item .tag { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.kind-pane { flex: 1 1 auto; min-width: 0; max-height: 60vh; overflow-y: auto; padding-right: 4px; }
.kind-pane h3 { margin: 16px 0 6px; font-size: 15px; }
.kind-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.kind-row .segs { flex: none; }
.kind-row .seg { height: 32px; font-size: 13px; padding: 0 10px; }
.seg[disabled], .switch[disabled] { opacity: .55; }

.status-btn { border: 0; background: transparent; padding: 2px 6px; border-radius: 6px; cursor: default; color: inherit; font: inherit; }
.status-btn:hover { background: var(--soft-2); }

.modal-back.side { background: transparent; justify-content: flex-end; align-items: flex-start; padding: 140px 24px 24px; pointer-events: none; }
.modal-back.side .modal { pointer-events: auto; width: 400px; box-shadow: var(--pop); }
.merge-step .ai-row { flex-wrap: wrap; }
.merge-step .btn { white-space: nowrap; }
.modal-back.side .modal { max-height: calc(100vh - 164px); }

.frame-edge { position: absolute; outline: 1px dashed rgba(120, 113, 108, .55); pointer-events: none; }
.frame-sel { outline-style: solid; }

/* Spelling and grammar: a bar at the bottom, one thing at a time. */
.checkbar { gap: 12px 16px; padding: 10px 14px; }
.checkbar .check-what { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; flex: none; }
.checkbar .dot { width: 9px; height: 9px; border-radius: 50%; }
.checkbar .spelling { color: var(--spell); } .checkbar .spelling .dot { background: #DC2626; }
.checkbar .grammar { color: var(--gram); } .checkbar .grammar .dot { background: #2563EB; }
.checkbar .style, .checkbar .readability, .checkbar .register { color: var(--accent-ink); }
.checkbar .style .dot, .checkbar .readability .dot, .checkbar .register .dot { background: var(--accent); }
.checkbar .check-text { flex: 1 1 320px; min-width: 0; }
.checkbar .ctx { font-size: 15px; color: var(--ink-2); line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.checkbar .ctx mark { background: var(--accent-soft); color: var(--ink); font-weight: 600; border-radius: 4px; padding: 0 3px; box-shadow: inset 0 -2px 0 var(--accent); }
.checkbar .msg { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.checkbar .check-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.checkbar .check-nav { display: flex; align-items: center; gap: 2px; }
.checkbar .check-msg { font-size: 14.5px; }
.checkbar .check-ok { color: #15803D; display: inline-flex; }
.checkbar .link { font-size: 13.5px; }
.status-btn.issues { display: inline-flex; align-items: center; gap: 6px; }

/* Comments and tracked changes: notes in the margin, level with their text. */
.notes { position: absolute; inset: 0; pointer-events: none; }
.note { position: absolute; width: 260px; background: var(--sheet); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
  box-shadow: 0 1px 2px rgba(28, 25, 23, .06); pointer-events: auto; cursor: default; font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
.note.on { border-color: var(--accent); box-shadow: var(--shadow); z-index: 2; }
.note .who { display: flex; gap: 8px; align-items: baseline; font-size: 13px; }
.note .who span { color: var(--muted); font-size: 12px; }
.note .msg { line-height: 1.45; color: var(--ink); }
.note .reply { font-size: 13.5px; padding-left: 10px; border-left: 2px solid var(--line); }
.note .field { height: 34px; font-size: 13.5px; }
.note .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.note .btn.small { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.note.resolved { opacity: .6; }
.note.change { border-left: 3px solid #16A34A; }
.note.change.deleted { border-left-color: #DC2626; }
.note.change .ctx { font-size: 13.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.comment-tint { position: absolute; background: rgba(250, 204, 21, .28); border-bottom: 2px solid rgba(202, 138, 4, .7); pointer-events: none; }
.comment-tint.on { background: rgba(250, 204, 21, .5); }

/* Generated lists (contents…): a dashed outline and a label, on screen only. */
.gen-layer { position: absolute; inset: 0; pointer-events: none; }
.gen-box { position: absolute; border: 1px dashed rgba(120, 113, 108, .5); border-radius: 6px; }
.gen-box.empty { background: rgba(120, 113, 108, .04); }
.gen-label { position: absolute; top: -12px; left: 10px; height: 22px; display: inline-flex; align-items: center; gap: 4px; padding: 0 8px;
  font-size: 12px; font-weight: 600; color: var(--muted); background: var(--sheet); border: 1px solid var(--line-2); border-radius: 999px; pointer-events: auto; cursor: default; }
.gen-label:hover { color: var(--accent-ink); border-color: var(--accent); }

/* Visual pickers: a picture of each choice. */
.pick-pop { display: flex; flex-direction: column; gap: 8px; padding: 8px; }
.pick-pop h2 { margin: 0; font-size: 16px; }
.pick-pop .lbl { margin-top: 4px; }
.tiles, .row-acts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px 6px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--sheet); color: var(--ink-2); cursor: default; font: inherit; }
.tile:hover { border-color: var(--faint); }
.tile.on { border: 2px solid var(--accent); padding: 7px 3px 5px; background: var(--accent-soft); color: var(--ink); }
.tile .pic { display: flex; align-items: center; justify-content: center; min-height: 30px; }
.tile .name { font-size: 12.5px; font-weight: 500; }
.ctx-row { display: flex; gap: 2px; padding: 2px 4px; }
.ctx-row .icon-btn { width: 34px; height: 34px; min-height: 0; padding: 0; justify-content: center; }
.ctx-row .icon-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); }

.sym-dialog { display: flex; flex-direction: column; gap: 10px; width: 100%; min-width: 0; }
.sym-head { display: flex; gap: 10px; align-items: center; }
.sym-head .segs { flex: none; }
.sym-head .field { flex: 1 1 auto; }
.sym-scroll { height: min(420px, 55vh); overflow-y: auto; padding-right: 4px; }
.sym-dialog .sym-grid { grid-template-columns: repeat(9, minmax(0, 1fr)); }
.sym-head .field { min-width: 0; }

.ai-dialog { display: flex; flex-direction: column; gap: 14px; width: 100%; min-width: 0; }
.ai-dialog .ai-go { display: flex; }
.ai-text { font-size: 15px; line-height: 1.55; margin: 0; white-space: pre-wrap; }
.ai-feedback { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 10px; font-size: 14.5px; line-height: 1.45; }
.ai-feedback .quote { color: var(--muted); font-style: italic; }
.pop-actions .hint { margin-right: auto; font-size: 12.5px; color: var(--muted); align-self: center; }
/* Narrow windows: the toolbar keeps one row by leaving out what menus and keys also do. */
@media (max-width: 1440px) { .toolbar [aria-label="Symbols & emoji"], .toolbar [aria-label="Checklist"] { display: none; } }
@media (max-width: 1340px) { .toolbar [aria-label="Less indent"], .toolbar [aria-label="More indent"], .toolbar [aria-label="Justify"] { display: none; } }
@media (max-width: 1180px) { .toolbar [aria-label="Highlight"], .toolbar [aria-label="Comment"], .toolbar [aria-label="Picture"] { display: none; } }
.field.big.mono { font-size: 17px; font-weight: 500; }
.eq-advanced { margin-top: 12px; }
.eq-advanced summary { cursor: default; font-size: 14px; color: var(--ink-2); font-weight: 500; }
.eq-advanced[open] summary { margin-bottom: 6px; }
.modal:has(.sym-dialog), .modal:has(.ai-dialog) { width: 600px; }
.tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tiles.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.page-setup { padding: 0; }
.col-guide { position: absolute; outline: 1px dashed rgba(120, 113, 108, .35); pointer-events: none; }
.note-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.note-lines path { fill: none; stroke: rgba(202, 138, 4, .55); stroke-width: 1; stroke-dasharray: 3 3; }
.note-lines path.change { stroke: rgba(120, 113, 108, .45); }
.note-lines path.on, .note-lines path.hover { stroke: var(--accent); stroke-dasharray: none; stroke-width: 1.5; }
.comment-tint.hover { background: rgba(250, 204, 21, .5); box-shadow: 0 0 0 1px rgba(202, 138, 4, .8); }
.note.hover { border-color: var(--accent); }
.note .quote { font-size: 12.5px; color: var(--muted); font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comment-tint + .comment-tint { border-left: 1px solid rgba(202, 138, 4, .7); }
.checkbar .added { color: #15803D; } .checkbar .added .dot { background: #16A34A; }
.checkbar .removed { color: #B91C1C; } .checkbar .removed .dot { background: #DC2626; }
.checkbar .comment { color: #A16207; } .checkbar .comment .dot { background: #CA8A04; }
.checkbar .check-acts .field { height: 36px; width: 200px; font-size: 14px; }
.checkbar .ctx u { text-decoration-color: #16A34A; } .checkbar .ctx s { color: var(--muted); }
.dt-list { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow-y: auto; }
.dt-item { text-align: left; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--sheet); font: inherit; font-size: 15px; cursor: default; }
.dt-item:hover { border-color: var(--faint); }
.dt-item.on { border: 2px solid var(--accent); padding: 8px 11px; background: var(--accent-soft); }
.hf-row { display: flex; gap: 8px; align-items: center; }
.hf-row .field { flex: 1 1 auto; min-width: 0; height: 40px; }
.hf-row .segs { flex: none; }
.hf-row .seg { height: 32px; padding: 0 10px; font-size: 13px; }
.modal:has(.hf-pop) { width: 600px; }

/* ----- No system border: rounded corners, own buttons, edges to resize ----- */
html.rounded, html.rounded body { background: transparent; }
html.rounded .app { border-radius: 12px; overflow: hidden; background: var(--ground); box-shadow: inset 0 0 0 1px var(--line-2); }
html.rounded.maximized .app { border-radius: 0; box-shadow: none; }
.drag-gap { flex: 1 1 auto; align-self: stretch; }
.win-btns { display: flex; gap: 2px; margin-left: 8px; }
.win-btn { width: 34px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; cursor: default; }
.win-btn:hover { background: var(--ground-2); color: var(--ink); }
.win-btn.close:hover { background: #DC2626; color: #fff; }
.resize-edge { position: fixed; z-index: 200; }
.resize-edge.north, .resize-edge.south { left: 10px; right: 10px; height: 5px; cursor: ns-resize; }
.resize-edge.north { top: 0; } .resize-edge.south { bottom: 0; }
.resize-edge.east, .resize-edge.west { top: 10px; bottom: 10px; width: 5px; cursor: ew-resize; }
.resize-edge.east { right: 0; } .resize-edge.west { left: 0; }
.resize-edge.northeast, .resize-edge.northwest, .resize-edge.southeast, .resize-edge.southwest { width: 10px; height: 10px; }
.resize-edge.northeast { top: 0; right: 0; cursor: nesw-resize; } .resize-edge.southwest { bottom: 0; left: 0; cursor: nesw-resize; }
.resize-edge.northwest { top: 0; left: 0; cursor: nwse-resize; } .resize-edge.southeast { bottom: 0; right: 0; cursor: nwse-resize; }
html.maximized .resize-edge { display: none; }

/* ----- The visual equation editor ----- */
.eq-box { min-height: 72px; padding: 14px 16px; border: 1px solid var(--line-2); border-radius: 12px; background: #fff; color: #1C1917;
  font: italic 22px/1.2 'Times New Roman', 'DejaVu Serif', serif; display: flex; align-items: center; flex-wrap: wrap; cursor: text; }
.eq-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.mrow { display: inline-flex; align-items: center; }
.mtext { display: inline-block; min-width: 2px; padding: 0 1px; outline: none; white-space: pre; }
.mrow.empty { min-width: 18px; min-height: 22px; border: 1px dashed #A8A29E; border-radius: 3px; background: #FAFAF9; }
.mrow.empty .mtext { min-width: 16px; }
.mrow:focus-within.empty { border-color: var(--accent); }
.mpart { display: inline-flex; align-items: center; margin: 0 2px; }
.m-frac { flex-direction: column; vertical-align: middle; }
.m-frac .mnum { padding: 0 3px 2px; border-bottom: 1.5px solid currentColor; }
.m-frac .mden { padding: 2px 3px 0; }
.m-frac .mnum, .m-frac .mden { justify-content: center; font-size: .85em; }
.msign { font-style: normal; font-size: 1.15em; }
.m-sqrt .mrad, .m-root .mrad { border-top: 1.5px solid currentColor; padding: 2px 2px 0; margin-left: -1px; }
.m-root .mindex { font-size: .55em; align-self: flex-start; margin-right: -4px; }
.m-sup { align-self: flex-start; font-size: .65em; margin: 0 1px 0 -1px; }
.m-sub { align-self: flex-end; font-size: .65em; margin: 0 1px 0 -1px; }
.mlimits { display: inline-flex; flex-direction: column; align-items: center; }
.mlimits .mhi, .mlimits .mlo { font-size: .55em; }
.mbig { font-style: normal; font-size: 1.6em; line-height: 1; }
.mfence { font-style: normal; font-size: 1.3em; }
.eq-flat { margin: 8px 0 0; font: 13.5px ui-monospace, 'DejaVu Sans Mono', monospace; color: var(--muted); min-height: 1em; }
.frame-handle { position: absolute; width: 10px; height: 10px; border-radius: 3px; background: #fff; border: 2px solid var(--accent); pointer-events: auto; }
.frame-handle.n, .frame-handle.s { left: calc(50% - 5px); cursor: ns-resize; } .frame-handle.n { top: -6px; } .frame-handle.s { bottom: -6px; }
.frame-handle.e, .frame-handle.w { top: calc(50% - 5px); cursor: ew-resize; } .frame-handle.e { right: -6px; } .frame-handle.w { left: -6px; }
.frame-handle.ne { top: -6px; right: -6px; cursor: nesw-resize; } .frame-handle.sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.frame-handle.nw { top: -6px; left: -6px; cursor: nwse-resize; } .frame-handle.se { bottom: -6px; right: -6px; cursor: nwse-resize; }
.swatch.on { box-shadow: 0 0 0 2px var(--accent); }

/* Header and footer, edited on the page. */
.hf-edit { position: absolute; pointer-events: auto; z-index: 5; }
.hf-inputs { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.hf-in { height: 30px; border: 1px dashed var(--accent); border-radius: 6px; background: rgba(255, 255, 255, .95); padding: 0 8px; font: 13px Figtree, sans-serif; color: #1C1917; min-width: 0; }
.hf-in.center { text-align: center; } .hf-in.right { text-align: right; }
.hf-in:focus { outline: none; border-style: solid; box-shadow: 0 0 0 2px var(--accent-soft); }
.hf-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; padding: 6px; background: var(--sheet); border-radius: 12px; box-shadow: var(--pop); }
.hf-edit.footer { display: flex; flex-direction: column-reverse; transform: translateY(calc(-100% + 30px)); }
.hf-edit.footer .hf-bar { margin: 0 0 6px; }
.hf-bar .chip { height: 30px; padding: 0 10px; font-size: 13px; }
.hf-bar .sep { width: 1px; height: 20px; background: var(--line); }
.hf-bar .btn.small { height: 30px; }
.slash-menu { z-index: 60; }
.badge-pick { border: 0; border-radius: 4px; padding: 3px 7px; font: 700 11px Figtree, sans-serif; letter-spacing: .02em; cursor: default; }
.badge-pick.on { box-shadow: 0 0 0 2px var(--accent); }
.ctx-row .chip { height: 28px; padding: 0 9px; font-size: 12.5px; }
.ctx-row { flex-wrap: wrap; gap: 4px; }

/* Reading view: no toolbar or ruler, the page blends into a white background. */
html.reading .toolbar, html.reading .ruler, html.reading .tabstrip { display: none !important; }
html.reading .doc-area, html.reading .scroller { background: #fff; }
html.reading .sheet { box-shadow: none !important; }
#exit-reading { position: fixed; top: 52px; right: 20px; z-index: 30; box-shadow: var(--shadow); }
.tpl-note { position: absolute; top: 46px; left: 50%; transform: translateX(-50%); z-index: 6; display: flex; gap: 10px; align-items: center;
  background: var(--sheet); border: 1px solid var(--accent-line); border-radius: 12px; padding: 8px 10px 8px 14px; box-shadow: var(--shadow); font-size: 14px; }
.ai-chat { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; }
.ai-row { display: flex; gap: 8px; align-items: flex-end; }
.ai-row .field.area { flex: 1 1 auto; min-width: 0; }
.ai-feedback { display: flex; flex-direction: column; gap: 8px; padding: 0; }
.modal-back:has(.ai-dialog) { align-items: flex-start; padding-top: 48px; }
.ai-sending { margin: -6px 0 0; font-size: 13.5px; color: var(--muted); font-style: italic; line-height: 1.4; }
.bubble.assistant p, .ai-text p { margin: 0 0 6px; } .bubble.assistant p:last-child, .ai-text p:last-child { margin-bottom: 0; }
.ai-quote { margin: 4px 0 8px; padding: 4px 10px; border-left: 3px solid var(--line-2); color: var(--ink-2); }
.ai-list { margin: 2px 0 6px; padding-left: 20px; }
.bubble { white-space: normal; }

/* Table controls, on the table you're in or pointing at. */
.tbl-tools > * { pointer-events: auto; position: absolute; }
.tbl-handle { border: 0; border-radius: 4px; background: var(--line); cursor: default; padding: 0; }
.tbl-handle:hover { background: var(--accent); }
.tbl-handle.col { height: 9px; } .tbl-handle.row { width: 9px; }
.tbl-plus { width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--sheet); color: var(--muted); font: 600 12px/14px Figtree, sans-serif; padding: 0; text-align: center; cursor: default; opacity: .5; }
.tbl-plus:hover { opacity: 1; background: var(--accent); border-color: var(--accent); color: #fff; }
.tbl-resize { width: 6px; cursor: col-resize; }
.tbl-resize:hover, .tbl-resize:active { background: rgba(194, 65, 12, .35); }
.tbl-more { width: 16px; height: 16px; border-radius: 5px; border: 1px solid var(--line-2); background: var(--sheet); color: var(--muted); display: flex; align-items: center; justify-content: center; padding: 0; cursor: default; }
.tbl-more:hover { color: var(--accent-ink); border-color: var(--accent); }

/* The "/" list: all of it, scrolling. */
.slash-menu { max-height: min(380px, 60vh); overflow-y: auto; }
/* Column + buttons sit over the line above the table: shown while pointing at the controls. */
.tbl-plus.col { opacity: 0; }
.tbl-tools:hover .tbl-plus.col { opacity: .6; }
.tbl-tools .tbl-plus.col:hover { opacity: 1; }
.status-text { padding: 2px 6px; }

/* The AI's reply on its way. */
.bubble.thinking { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.bubble.thinking .dots { display: inline-flex; gap: 3px; }
.bubble.thinking .dots i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: think 1.2s infinite ease-in-out; }
.bubble.thinking .dots i:nth-child(2) { animation-delay: .15s; } .bubble.thinking .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes think { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .bubble.thinking .dots i { animation: none; opacity: .6; } }
.ai-table { border-collapse: collapse; font-size: 13px; margin: 2px 0 4px; }
.ai-table td { border: 1px solid var(--line-2); padding: 3px 8px; }
.bubble.thinking { flex-direction: row; justify-content: flex-start; }
.status-btn.update { color: var(--accent-ink); font-weight: 600; }

/* Others editing the same server document: their caret (with their name)
   and selection, in their colour. */
.other-caret { position: absolute; width: 2px !important; background: var(--who); pointer-events: none; }
.other-caret span { position: absolute; left: 0; bottom: 100%; padding: 1px 5px; border-radius: 4px 4px 4px 0; background: var(--who); color: #fff; font: 600 11px/1.4 Figtree, sans-serif; white-space: nowrap; }
.other-sel { position: absolute; background: var(--who); opacity: 0.18; pointer-events: none; }

/* An animated Draw canvas in the text: its play button, and the clip shown
   over the picture while it plays (screen only). */
.pic-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 48px; height: 48px; border-radius: 999px; border: 0; background: rgba(28,25,23,.72); color: #fff; font-size: 18px; cursor: pointer; pointer-events: auto; display: flex; align-items: center; justify-content: center; }
.pic-play:hover { background: rgba(28,25,23,.86); }
.pic-play.busy { animation: pic-wait 1s ease-in-out infinite alternate; }
@keyframes pic-wait { to { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .pic-play.busy { animation: none; opacity: .6; } }
.pic-play:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pic-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }

/* Insert › From Calc */
.calc-pick { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; min-height: 240px; }
.calc-items { display: flex; flex-direction: column; gap: 4px; max-height: 360px; overflow: auto; }
.calc-items b { font-size: 12.5px; color: var(--muted, #57534e); margin-top: 6px; }
.calc-item { text-align: left; padding: 7px 10px; border-radius: 8px; border: 1px solid transparent; background: none; font: inherit; font-size: 14px; cursor: pointer; color: inherit; }
.calc-item:hover { background: var(--soft, #f7f5f2); }
.calc-item.on { border-color: var(--accent, #c2410c); background: var(--accent-soft, #fff1e8); }
.calc-preview { overflow: auto; max-height: 360px; border: 1px solid var(--line, #e2ddd7); border-radius: 10px; padding: 8px; }
.calc-preview table { border-collapse: collapse; font-size: 13px; }
.calc-preview th, .calc-preview td { padding: 4px 10px; border-bottom: 1px solid var(--line, #e2ddd7); text-align: left; white-space: nowrap; }
.calc-preview td.n { text-align: right; font-variant-numeric: tabular-nums; }
.calc-preview img { max-width: 100%; }
/* Insert › From a server, a plan: what to show on the left, all of it previewed on the right. */
.modal:has(.plan-pick) { width: min(900px, calc(100vw - 32px)); max-width: none; }
.calc-pick.plan-pick { grid-template-columns: 280px minmax(0, 1fr); }
.plan-preview img { width: 100%; }
@media (max-width: 640px) { .calc-pick.plan-pick { grid-template-columns: 1fr; } }
.plan-parts { display: flex; flex-direction: column; gap: 8px; }
.plan-mode { display: flex; gap: 4px; margin-bottom: 4px; }
.plan-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted, #57534e); }
.plan-tick { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.plan-tick input { margin-top: 3px; }
.plan-tick .hint { font-size: 12.5px; }
.plan-preview { display: flex; flex-direction: column; gap: 12px; }
.plan-part > b { display: block; font-size: 12.5px; color: var(--muted, #57534e); margin-bottom: 4px; }
/* Insert › From Plan: a task chip's preview (the badge colours). */
.task-chip { display: inline-block; border-radius: 6px; padding: 2px 8px; font: 600 13px Figtree, sans-serif; background: #E7E5E4; color: #44403C; }
.task-chip.c-blue { background: #DBEAFE; color: #1E40AF; } .task-chip.c-green { background: #DCFCE7; color: #166534; } .task-chip.c-red { background: #FEE2E2; color: #991B1B; }

/* ----- In the browser on a Xenify server: back to its Files page ----- */

/* ----- Phones ----- */
/* The browser's own bars don't hide the bottom of the app. */
.app { height: 100dvh; }
@media (max-width: 600px) {
  /* The menus scroll sideways instead of running off the screen. */
  .menubar { overflow-x: auto; scrollbar-width: none; }
  .menubar::-webkit-scrollbar { display: none; }
  .menubar > * { flex: none; }
}

/* Editing a page inside the server's Files page: the toolbar and the page. */
.embed .menubar, .embed .tabstrip, .embed .ruler { display: none !important; }
/* …laid out like the wiki shows it: no paper, just the page's column on white. */
.embed .doc-area, .embed .scroller { background: #fff; }
.embed .sheet { box-shadow: none !important; }
/* Table options › Colours: a name, its swatches, None. */
.tcolour-row { display: grid; grid-template-columns: 92px 1fr auto; align-items: center; gap: 6px; }
.tcolour-name { font-size: 13px; color: var(--muted); }
.tcolour-row .swatches { grid-template-columns: repeat(auto-fill, 28px); padding: 4px 0; }

/* "This is a template": the starting parts, each a card with a little page. */
.tpl-starter { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 12px 0 8px; }
@media (max-width: 560px) { .tpl-starter { grid-template-columns: 1fr; } }
.tpl-part { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--paper, transparent); }
.tpl-part:hover { border-color: var(--accent-line); }
.tpl-part.on { border-color: var(--accent); background: var(--accent-soft); }
.tpl-part:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.tpl-part input { position: absolute; opacity: 0; pointer-events: none; }
.tpl-words { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--muted); line-height: 1.35; }
.tpl-words b { color: var(--ink); font-size: 14px; font-weight: 600; }
.tpl-pic { flex: none; position: relative; width: 44px; height: 58px; border: 1px solid var(--line-2, var(--line)); border-radius: 3px; background: #fff; display: flex; flex-direction: column; gap: 4px; padding: 7px 6px; box-sizing: border-box; }
.tpl-part.on .tpl-pic { border-color: var(--accent-line); }
.tpl-pic i { display: block; height: 3px; border-radius: 2px; background: #D6D0C9; }
.tpl-pic.title { justify-content: center; align-items: center; }
.tpl-pic.title i:nth-child(1) { width: 26px; height: 5px; background: var(--accent); }
.tpl-pic.title i:nth-child(2) { width: 20px; }
.tpl-pic.title i:nth-child(3), .tpl-pic.title i:nth-child(4) { width: 14px; }
.tpl-pic.contents i { width: 100%; background: linear-gradient(90deg, #D6D0C9 60%, transparent 60%, transparent 82%, #D6D0C9 82%); }
.tpl-pic.contents i:nth-child(1) { width: 60%; height: 4px; background: var(--accent); margin-bottom: 2px; }
.tpl-pic.contents i:nth-child(3) { margin-left: 5px; width: calc(100% - 5px); }
.tpl-pic.numbered i { width: 100%; }
.tpl-pic.numbered i:nth-child(odd) { height: 4px; width: 70%; background: linear-gradient(90deg, var(--accent) 0 5px, transparent 5px 8px, #A8A29E 8px); }
.tpl-pic.numbered i:nth-child(3) { margin-left: 4px; }
.tpl-pic.headers { justify-content: space-between; }
.tpl-pic.headers i:nth-child(1) { width: 18px; background: var(--accent); }
.tpl-pic.headers i:nth-child(2), .tpl-pic.headers i:nth-child(3) { width: 100%; }
.tpl-pic.headers i:nth-child(4) { width: 12px; align-self: center; background: var(--accent); }
