/* PubStudio editor chrome: warm paper-and-linen neutrals, an ink top bar, one berry accent, hairlines and soft
   rounded cards; numbers in JetBrains Mono. Document content (.page, .item, .para, .text, .table, .cell,
   span.field ...) is styled by DOC_CSS in app/editor/render.tsx; this file only adds editing chrome around
   and on top of it. */

/* ------------------------------------------------------------------------- */
/* Fonts (bundled in app/renderer/fonts, SIL Open Font License) */

@font-face {
  font-family: 'Inter Variable'; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(fonts/inter-latin-ext-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter Variable'; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(fonts/inter-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono Variable'; font-style: normal; font-display: swap; font-weight: 100 800;
  src: url(fonts/jetbrains-mono-latin-ext-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'JetBrains Mono Variable'; font-style: normal; font-display: swap; font-weight: 100 800;
  src: url(fonts/jetbrains-mono-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ------------------------------------------------------------------------- */
/* Tokens */

:root {
  /* berry accent */
  --accent: #9c2a5c;
  --accent-hover: #b03068;
  --accent-dark: #7d1f49;
  --accent-darker: #64183a;
  --accent-tint: #f6e5ec;
  --accent-soft: #f0cfde;
  --accent-line: #e0b3c7;
  --accent-ring: rgba(156, 42, 92, 0.16);
  --accent-text: var(--accent);   /* accent-coloured text and icons */

  /* ink: the top bar */
  --ink: #221c1f;
  --ink-raised: #312a2d;
  --ink-3: #3d3538;
  --ink-hover: rgba(255, 244, 238, 0.08);
  --ink-pressed: rgba(255, 244, 238, 0.14);
  --ink-line: rgba(255, 244, 238, 0.12);
  --ink-text: #f3ece6;
  --ink-muted: #a3958f;

  /* paper and linen */
  --chrome: #f5f1eb;        /* command area, File screen */
  --ribbon: #f5f1eb;
  --card: #fffdfa;          /* cards, panes, popups, dialogs */
  --panel: #fffdfa;
  --field: #fffefc;         /* text boxes */
  --well: #f3eee8;          /* inset wells and chips */
  --line: #e5ddd3;          /* hairlines */
  --line-soft: #efe8e0;
  --line-strong: #d8cec2;
  --text: #2a2225;
  --muted: #857872;
  --faint: #b5aaa2;
  --icon: #4a3f44;          /* ribbon icons */
  --hover: #f3ede6;
  --hover-chrome: #ebe4dc;
  --pressed: #e8e0d6;
  --on: #f6e5ec;
  --on-border: #e0b3c7;
  --field-border: #ddd3c7;
  --field-hover: #c6b9ab;
  --desk: #e9e3db;
  --desk-dot: #d2c7ba;
  --ruler: #fbf8f4;
  --tick: #d8cec2;
  --sel: #9c2a5c;
  --handle: #9c2a5c;
  --pro-ring: rgba(214, 150, 179, 0.35);   /* the Pro badge's outline in the top bar */

  /* context colours (contextual tabs) */
  --ctx-drawing: #c0632b;
  --ctx-text: #2f8f86;
  --ctx-picture: #7b55b0;
  --ctx-table: #b17c12;
  --ctx-master: #4c8a3c;
  --ctx-catalog: #15808a;

  /* shape */
  --r-sm: 6px;
  --r: 8px;
  --r-md: 10px;
  --r-lg: 12px;
  --shadow-card: 0 1px 1px rgba(70, 46, 34, 0.03), 0 1px 3px rgba(70, 46, 34, 0.04);
  --shadow-float: 0 6px 24px -10px rgba(60, 35, 25, 0.25);
  --shadow-pill: 0 8px 24px -12px rgba(60, 35, 25, 0.35);
  --popup-shadow: 0 2px 6px rgba(45, 28, 22, 0.07), 0 14px 36px rgba(45, 28, 22, 0.15);
  --modal-shadow: 0 2px 8px rgba(34, 28, 31, 0.08), 0 28px 72px rgba(34, 28, 31, 0.24);

  --font-ui: 'Inter Variable', 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono Variable', 'JetBrains Mono', 'Cascadia Mono', Consolas, ui-monospace, monospace;

  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--text);
}

/* Dark mode (File > Options > App appearance). Only the app changes: pages, thumbnails and previews
   stay white paper, so anything drawn on a page keeps the light accent. */
:root[data-theme='dark'] {
  color-scheme: dark;
  --accent: #b03a70;
  --accent-hover: #c2477f;
  --accent-dark: #e07fab;
  --accent-darker: #eb9cc0;
  --accent-tint: #3d1f2e;
  --accent-soft: #4a2638;
  --accent-line: #7d3a5a;
  --accent-ring: rgba(210, 106, 155, 0.28);
  --accent-text: #e07fab;
  --accent-pressed: #8f2d5b;   /* a primary button held down */

  --chrome: #2a2427;
  --ribbon: #2a2427;
  --card: #322b2e;
  --panel: #322b2e;
  --field: #2a2427;
  --well: #231e20;
  --line: #433a3e;
  --line-soft: #3a3236;
  --line-strong: #54494e;
  --text: #ece3dd;
  --muted: #a3958f;
  --faint: #6f625d;
  --icon: #d6cac4;
  --hover: #3b3337;
  --hover-chrome: #342d30;
  --pressed: #443a3f;
  --on: #4a2638;
  --on-border: #7d3a5a;
  --field-border: #54494e;
  --field-hover: #6b5e63;
  --desk: #1c1719;
  --desk-dot: #2e272a;
  --ruler: #2a2427;
  --tick: #5c5055;

  --ctx-drawing: #e08a55;
  --ctx-text: #4fb8ad;
  --ctx-picture: #a585d6;
  --ctx-table: #d9a441;
  --ctx-master: #74b562;
  --ctx-catalog: #3cb0ba;

  --shadow-card: 0 1px 1px rgba(0, 0, 0, 0.2), 0 1px 3px rgba(0, 0, 0, 0.25);
  --shadow-float: 0 6px 24px -10px rgba(0, 0, 0, 0.6);
  --shadow-pill: 0 8px 24px -12px rgba(0, 0, 0, 0.7);
  --popup-shadow: 0 2px 6px rgba(0, 0, 0, 0.3), 0 14px 36px rgba(0, 0, 0, 0.45);
  --modal-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 28px 72px rgba(0, 0, 0, 0.55);
}
:root[data-theme='dark'] :is(.link-nav, .overflow-mark) {
  --accent: #9c2a5c; --accent-dark: #7d1f49; --accent-tint: #f6e5ec; --accent-line: #e0b3c7;
}
:root[data-theme='dark'] button.primary:active:not(:disabled) { background: var(--accent-pressed); }
:root[data-theme='dark'] button.primary:disabled { color: rgba(255, 255, 255, 0.6); }
:root[data-theme='dark'] :is(.st-pill, .pager) { background: rgba(50, 43, 46, 0.92); }
:root[data-theme='dark'] ::-webkit-scrollbar-thumb { background-color: rgba(236, 227, 221, 0.18); }
:root[data-theme='dark'] ::-webkit-scrollbar-thumb:hover { background-color: rgba(236, 227, 221, 0.3); }
/* previews of what goes on a page keep white paper and dark text */
:root[data-theme='dark'] :is(.bullet-tile, .number-tile, .dropcap-tile, .block-thumb, .gtile.sym, .sample, .symbol-grid, .bullet-grid button, .dropcap-preview) {
  color: #262626; color-scheme: light;
  --accent: #9c2a5c; --accent-dark: #7d1f49; --accent-tint: #f6e5ec; --accent-soft: #f0cfde; --accent-line: #e0b3c7; --accent-text: #9c2a5c;
}
:root[data-theme='dark'] :is(.combo, .tg-cell, .rec-grid-wrap) { background: var(--field); }
:root[data-theme='dark'] .rec-grid td input:not([type=checkbox]):focus { background: #3a3226; }
:root[data-theme='dark'] .find-results mark { color: #2a2225; }
:root[data-theme='dark'] .new-gallery .tile-art { background: #3a3236; }
:root[data-theme='dark'] :is(.bs-item, .bs-page.about p) { color: var(--text); }
:root[data-theme='dark'] .bs-item svg { color: var(--muted); }
:root[data-theme='dark'] :is(.rtab, .dtab-strip button, .bs-page button.recent-row) { color: #c4b7b1; }
:root[data-theme='dark'] :is(.st-views button, .zoom-controls button, .zoom-controls button.zoom .fit) { color: #c9bcb6; }
:root[data-theme='dark'] .ctx-tabs .rtab { color: color-mix(in srgb, var(--ctx) 70%, #ece3dd); }
:root[data-theme='dark'] :is(.hint.ok, .gm-status) { color: #7fbf78; }
:root[data-theme='dark'] :is(.error, .gm-status.missing) { color: #f08a80; }
:root[data-theme='dark'] .lic-msg.error { color: #f3a39b; }
:root[data-theme='dark'] .lic-msg.ok { color: #9ed497; }
:root[data-theme='dark'] :is(.lic-msg.warn, .lic-chip) { color: #ecc977; }

/* App color (File > Options, Pro; theme.ts ACCENTS): berry above, and these, made from berry's tokens with the
   hue turned (same lightness steps). In dark mode, previews of page content keep the light accent, as berry does. */
:root[data-accent='plum'] {
  --accent: #723fa1; --accent-hover: #8147b6; --accent-dark: #5a3082; --accent-darker: #472668;
  --accent-tint: #ebe8f7; --accent-soft: #dbd5f3; --accent-line: #c5bbe4; --accent-ring: rgba(114, 63, 161, 0.16);
  --on: #ebe8f7; --on-border: #c5bbe4; --sel: #723fa1; --handle: #723fa1; --pro-ring: rgba(178, 161, 220, 0.35);
}
:root[data-accent='plum'][data-theme='dark'] {
  --accent: #804fb8; --accent-hover: #8e5dcb; --accent-dark: #ae90e8; --accent-darker: #bfaaf2;
  --accent-tint: #2d2541; --accent-soft: #372d4e; --accent-line: #5c4684; --accent-ring: rgba(159, 124, 220, 0.28); --accent-text: #ae90e8;
  --on: #372d4e; --on-border: #5c4684; --accent-pressed: #673f97;
}
:root[data-accent='plum'][data-theme='dark'] :is(.link-nav, .overflow-mark, .bullet-tile, .number-tile, .dropcap-tile, .block-thumb, .gtile.sym, .sample, .symbol-grid, .bullet-grid button, .dropcap-preview) {
  --accent: #723fa1; --accent-dark: #5a3082; --accent-tint: #ebe8f7; --accent-soft: #dbd5f3; --accent-line: #c5bbe4; --accent-text: #723fa1;
}
:root[data-accent='ocean'] {
  --accent: #005fa5; --accent-hover: #006bba; --accent-dark: #004b83; --accent-darker: #003b69;
  --accent-tint: #dfecf7; --accent-soft: #c2def3; --accent-line: #a1c7e5; --accent-ring: rgba(0, 95, 165, 0.16);
  --on: #dfecf7; --on-border: #a1c7e5; --sel: #005fa5; --handle: #005fa5; --pro-ring: rgba(123, 179, 222, 0.35);
}
:root[data-accent='ocean'][data-theme='dark'] {
  --accent: #0371b9; --accent-hover: #047fcf; --accent-dark: #52abee; --accent-darker: #7ac0f5;
  --accent-tint: #0f2d41; --accent-soft: #13374f; --accent-line: #135987; --accent-ring: rgba(50, 154, 226, 0.28); --accent-text: #52abee;
  --on: #13374f; --on-border: #135987; --accent-pressed: #025b95;
}
:root[data-accent='ocean'][data-theme='dark'] :is(.link-nav, .overflow-mark, .bullet-tile, .number-tile, .dropcap-tile, .block-thumb, .gtile.sym, .sample, .symbol-grid, .bullet-grid button, .dropcap-preview) {
  --accent: #005fa5; --accent-dark: #004b83; --accent-tint: #dfecf7; --accent-soft: #c2def3; --accent-line: #a1c7e5; --accent-text: #005fa5;
}
:root[data-accent='teal'] {
  --accent: #056a6e; --accent-hover: #06787d; --accent-dark: #025457; --accent-darker: #004346;
  --accent-tint: #ddefed; --accent-soft: #bee2df; --accent-line: #9bcdca; --accent-ring: rgba(5, 106, 110, 0.16);
  --on: #ddefed; --on-border: #9bcdca; --sel: #056a6e; --handle: #056a6e; --pro-ring: rgba(111, 188, 185, 0.35);
}
:root[data-accent='teal'][data-theme='dark'] {
  --accent: #097c7f; --accent-hover: #088c8f; --accent-dark: #21b9b8; --accent-darker: #68cbc8;
  --accent-tint: #043130; --accent-soft: #033c3a; --accent-line: #006160; --accent-ring: rgba(9, 167, 166, 0.28); --accent-text: #21b9b8;
  --on: #033c3a; --on-border: #006160; --accent-pressed: #026466;
}
:root[data-accent='teal'][data-theme='dark'] :is(.link-nav, .overflow-mark, .bullet-tile, .number-tile, .dropcap-tile, .block-thumb, .gtile.sym, .sample, .symbol-grid, .bullet-grid button, .dropcap-preview) {
  --accent: #056a6e; --accent-dark: #025457; --accent-tint: #ddefed; --accent-soft: #bee2df; --accent-line: #9bcdca; --accent-text: #056a6e;
}
:root[data-accent='forest'] {
  --accent: #1c6e37; --accent-hover: #1f7d3f; --accent-dark: #145729; --accent-darker: #104520;
  --accent-tint: #e5ede4; --accent-soft: #cfdfcc; --accent-line: #b3c9af; --accent-ring: rgba(28, 110, 55, 0.16);
  --on: #e5ede4; --on-border: #b3c9af; --sel: #1c6e37; --handle: #1c6e37; --pro-ring: rgba(149, 183, 146, 0.35);
}
:root[data-accent='forest'][data-theme='dark'] {
  --accent: #327f42; --accent-hover: #408e4d; --accent-dark: #7db37c; --accent-darker: #9bc597;
  --accent-tint: #1f2f1d; --accent-soft: #263924; --accent-line: #395f39; --accent-ring: rgba(104, 163, 103, 0.28); --accent-text: #7db37c;
  --on: #263924; --on-border: #395f39; --accent-pressed: #286732;
}
:root[data-accent='forest'][data-theme='dark'] :is(.link-nav, .overflow-mark, .bullet-tile, .number-tile, .dropcap-tile, .block-thumb, .gtile.sym, .sample, .symbol-grid, .bullet-grid button, .dropcap-preview) {
  --accent: #1c6e37; --accent-dark: #145729; --accent-tint: #e5ede4; --accent-soft: #cfdfcc; --accent-line: #b3c9af; --accent-text: #1c6e37;
}
:root[data-accent='copper'] {
  --accent: #924200; --accent-hover: #a54c00; --accent-dark: #753300; --accent-darker: #5f2700;
  --accent-tint: #f6e7e1; --accent-soft: #f1d2c7; --accent-line: #e0b7a8; --accent-ring: rgba(146, 66, 0, 0.16);
  --on: #f6e7e1; --on-border: #e0b7a8; --sel: #924200; --handle: #924200; --pro-ring: rgba(214, 157, 134, 0.35);
}
:root[data-accent='copper'][data-theme='dark'] {
  --accent: #ad4c02; --accent-hover: #bf5918; --accent-dark: #df8a65; --accent-darker: #eba488;
  --accent-tint: #3e2218; --accent-soft: #4b2a1d; --accent-line: #7d4227; --accent-ring: rgba(210, 118, 77, 0.28); --accent-text: #df8a65;
  --on: #4b2a1d; --on-border: #7d4227; --accent-pressed: #8d3b02;
}
:root[data-accent='copper'][data-theme='dark'] :is(.link-nav, .overflow-mark, .bullet-tile, .number-tile, .dropcap-tile, .block-thumb, .gtile.sym, .sample, .symbol-grid, .bullet-grid button, .dropcap-preview) {
  --accent: #924200; --accent-dark: #753300; --accent-tint: #f6e7e1; --accent-soft: #f1d2c7; --accent-line: #e0b7a8; --accent-text: #924200;
}
:root[data-accent='slate'] {
  --accent: #475f78; --accent-hover: #516c88; --accent-dark: #374b5f; --accent-darker: #2b3b4c;
  --accent-tint: #e7ebee; --accent-soft: #d2dbe2; --accent-line: #b8c4cd; --accent-ring: rgba(71, 95, 120, 0.16);
  --on: #e7ebee; --on-border: #b8c4cd; --sel: #475f78; --handle: #475f78; --pro-ring: rgba(158, 175, 188, 0.35);
}
:root[data-accent='slate'][data-theme='dark'] {
  --accent: #55708a; --accent-hover: #617e99; --accent-dark: #8ea6bc; --accent-darker: #a6bbcc;
  --accent-tint: #232b32; --accent-soft: #2b353d; --accent-line: #455765; --accent-ring: rgba(123, 150, 172, 0.28); --accent-text: #8ea6bc;
  --on: #2b353d; --on-border: #455765; --accent-pressed: #435a6f;
}
:root[data-accent='slate'][data-theme='dark'] :is(.link-nav, .overflow-mark, .bullet-tile, .number-tile, .dropcap-tile, .block-thumb, .gtile.sym, .sample, .symbol-grid, .bullet-grid button, .dropcap-preview) {
  --accent: #475f78; --accent-dark: #374b5f; --accent-tint: #e7ebee; --accent-soft: #d2dbe2; --accent-line: #b8c4cd; --accent-text: #475f78;
}

* { box-sizing: border-box; }
html, body, #root { margin: 0; height: 100%; overflow: hidden; background: var(--chrome); }
body { -webkit-font-smoothing: antialiased; }

/* Document content keeps the font and colour it has always inherited: only the chrome changes. */
.page, .thumb-page { font-family: 'Segoe UI', system-ui, sans-serif; color: #262626; }

/* Numbers in the chrome: JetBrains Mono, tabular figures */
.num, .spin input, .combo.numeric input, .combo-list.numeric .mitem, .record-box, .st-page, .st-pos, .st-size, .st-paper, .zoom-controls .zoom,
.pnum, .pane-head .count, .ruler-corner, .drag-readout, .doc-ext, .tellme kbd, .tile small, .print-go input, .print-settings label.field input, :where(.modal, .task-pane, .bs-page) input[type=number], .custom-size input {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
}

button, select, input, textarea { font: inherit; color: inherit; }
button {
  margin: 0; padding: 0; border: 1px solid transparent; border-radius: var(--r-sm); background: transparent;
  cursor: default; white-space: nowrap; line-height: normal;
}
button:disabled { cursor: default; }
button:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 1px; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); margin: 0; }
input[type=range] { accent-color: var(--accent); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(110, 88, 74, 0.24); border: 3px solid transparent; border-radius: 6px; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(110, 88, 74, 0.4); }
::-webkit-scrollbar-corner { background: transparent; }

:where(.modal, .task-pane, .backstage, .rbody, .titlebar, .popup) ::selection { background: var(--accent-soft); color: var(--text); }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Text inputs and selects in dialogs, panes and the File screen */
:where(.modal, .task-pane, .backstage) :is(input:not([type]), input[type=text], input[type=number], input[type=search], select, textarea) {
  height: 28px; padding: 0 8px; border: 1px solid var(--field-border); border-radius: var(--r-sm); background: var(--field); min-width: 0;
}
:where(.rbody) :is(input:not([type]), input[type=text], input[type=number], input[type=search], select, textarea) {
  height: 26px; padding: 0 6px; border: 1px solid var(--field-border); border-radius: var(--r-sm); background: var(--field); min-width: 0;
}
/* :not() matches the specificity of the input rule above, so rows= sets the height */
:where(.modal, .task-pane, .backstage) textarea:not([hidden]) { height: auto; padding: 6px 8px; resize: vertical; line-height: 1.4; }
/* drop-down selects get the same small chevron as the combo boxes */
:where(.modal, .task-pane, .backstage, .rbody) select:not([size]):not([multiple]) {
  appearance: none; padding-right: 24px;
  background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.75 6 7.75l3-3' fill='none' stroke='%237b6f6a' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 8px center;
}
:where(.modal, .task-pane, .backstage, .rbody) :is(input, select, textarea):hover:not(:disabled):not(:focus):not([type=checkbox]):not([type=radio]):not([type=range]) { border-color: var(--field-hover); }
:where(.modal, .task-pane, .backstage) select:not([size]):not([multiple]):disabled { background-color: var(--well); opacity: .8; }
:where(.modal, .task-pane, .backstage) select[size] { height: auto; padding: 2px; }
:where(.modal, .task-pane, .backstage, .rbody) :is(input, select, textarea):focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
:where(.modal, .task-pane, .backstage) :is(input, select, textarea):disabled { background: var(--well); color: var(--faint); }
select.list { width: 100%; }
select.list option { padding: 3px 8px; }
select.list option:checked, select[size] option:checked {
  background: var(--accent-soft) linear-gradient(var(--accent-soft), var(--accent-soft)); color: var(--text); -webkit-text-fill-color: var(--text);
}

/* Push buttons in dialogs, panes and File pages: outlined; primary is filled berry */
:where(.modal, .task-pane, .bs-page) button {
  height: 30px; min-width: 76px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--card);
  font-weight: 500;
}
:where(.modal, .task-pane, .bs-page) button:hover:not(:disabled) { background: var(--hover); border-color: var(--field-hover); }
:where(.modal, .task-pane, .bs-page) button:active:not(:disabled) { background: var(--pressed); }
:where(.modal, .task-pane, .bs-page) button:disabled { color: var(--faint); border-color: var(--line); background: var(--chrome); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
button.primary:active:not(:disabled) { background: var(--accent-dark); }
button.primary:disabled { background: var(--accent-line); border-color: var(--accent-line); color: #fff; }
button.on { background: var(--on); border-color: var(--on-border); color: var(--accent-dark); }

.spacer { flex: 1 1 auto; }
.hint { margin: 0; color: var(--muted); line-height: 1.45; }
.hint.ok { color: #3f7d3a; }
.error { margin: 0; color: #b0302b; }

/* ------------------------------------------------------------------------- */
/* App frame */

.app { display: flex; flex-direction: column; height: 100%; }
.workspace { flex: 1 1 auto; display: flex; min-height: 0; position: relative; background: var(--desk); }
/* the canvas column; the status pills float over its bottom corners */
.stage { flex: 1 1 auto; min-width: 0; position: relative; display: flex; }
.stage > .canvas-area { flex: 1 1 auto; }

/* ------------------------------------------------------------------------- */
/* Top bar (ink): app mark, File, document name, search, quick access */

.ribbon { flex: none; position: relative; z-index: 20; background: var(--chrome); user-select: none; border-bottom: 1px solid var(--line); }

.titlebar {
  height: 44px; display: flex; align-items: center; gap: 6px; padding: 0 8px 0 10px; background: var(--ink); color: var(--ink-text); font-size: 13px;
}
.app-mark {
  flex: none; width: 26px; height: 26px; margin-right: 4px; display: grid; place-items: center; border-radius: 7px; background: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.app-mark svg { width: 16px; height: 16px; display: block; }
/* File: solid berry while the File screen is open */
.tb-file {
  flex: none; height: 28px; padding: 0 9px 0 10px; display: inline-flex; align-items: center; gap: 5px; border: 0; border-radius: 7px;
  background: var(--ink-raised); color: var(--ink-text); font-weight: 500;
}
.tb-file svg { width: 12px; height: 12px; opacity: .7; }
.tb-file:hover { background: var(--ink-3); }
.tb-file.open, .tb-file.open:hover { background: var(--accent); color: #fff; }
.tb-file.open svg { opacity: .9; }
.tb-sep { flex: none; width: 1px; height: 18px; margin: 0 8px; background: var(--ink-3); }

/* name, extension in mono, then a muted state with a dot */
.doc-title { min-width: 0; display: flex; align-items: baseline; }
.doc-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; letter-spacing: -0.005em; color: var(--ink-text); }
.doc-ext { flex: none; margin-left: 1px; font-size: 12px; color: var(--ink-muted); letter-spacing: 0; }
.doc-state {
  flex: none; display: inline-flex; align-items: center; gap: 6px; margin-left: 12px; font-size: 11.5px; color: var(--ink-muted); white-space: nowrap;
}
.doc-state::before { content: ''; flex: none; width: 6px; height: 6px; border-radius: 50%; background: #7fae7a; }
.doc-state.new::before { background: var(--ink-muted); }
.doc-state.dirty::before, .doc-state.imported::before { background: #d9a441; }
/* for a file opened from .pub: send it to support (File > Help with the file attached) */
.doc-send {
  flex: none; align-self: center; margin-left: 10px; padding: 2px 10px; border: 1px solid rgba(217, 164, 65, .55); border-radius: 999px;
  background: rgba(217, 164, 65, .14); color: #f0d49c; font: inherit; font-size: 11.5px; font-weight: 500; white-space: nowrap; cursor: pointer;
}
.doc-send:hover { background: rgba(217, 164, 65, .26); color: #fff; }
.titlebar > .spacer { flex: 1 1 auto; min-width: 12px; }
/* Windows: the top bar is the window's title bar. It drags the window, its controls don't, and the native
   minimise/maximise/close buttons (drawn by Electron's title bar overlay) take its right end. It stays above File. */
.win-titlebar .titlebar { -webkit-app-region: drag; padding-right: 140px; }
.win-titlebar .titlebar :is(button, input, .tellme, .qat) { -webkit-app-region: no-drag; }

/* search pill with its keyboard shortcut */
.tellme { flex: none; position: relative; display: flex; align-items: center; width: 300px; height: 28px; }
.tellme > svg { position: absolute; left: 10px; width: 14px; height: 14px; color: var(--ink-muted); pointer-events: none; }
.tellme input {
  width: 100%; height: 100%; padding: 0 56px 0 32px; border: 0; border-radius: var(--r); font-size: 12.5px;
  background: var(--ink-raised); color: var(--ink-text); outline: none; box-shadow: inset 0 0 0 1px var(--ink-3);
}
.tellme input::placeholder { color: var(--ink-muted); }
.tellme input:hover { background: #362e31; }
.tellme kbd {
  position: absolute; right: 6px; padding: 2px 6px; border-radius: 5px; background: var(--ink-3); color: var(--ink-muted); font-size: 10.5px;
  line-height: 14px; pointer-events: none;
}
.tellme:focus-within input { background: var(--ink-3); box-shadow: inset 0 0 0 1px rgba(224, 179, 199, 0.55), 0 0 0 3px rgba(224, 179, 199, 0.16); }
.tellme:focus-within > svg { color: var(--accent-line); }
.tellme:focus-within kbd { display: none; }

/* quick access: undo and redo first, as in the mock-up's top bar; customise stays at the end */
.qat { flex: none; display: flex; align-items: center; gap: 2px; margin-left: 10px; }
.qat-btn { width: 30px; height: 28px; display: grid; place-items: center; color: var(--ink-text); border: 0; border-radius: 7px; }
.qat-btn[data-cmd='qat:undo'] { order: -2; }
.qat-btn[data-cmd='qat:redo'] { order: -1; }
.qat-btn svg { width: 16px; height: 16px; }
.qat-btn:hover:not(:disabled) { background: var(--ink-hover); }
.qat-btn:active:not(:disabled) { background: var(--ink-pressed); }
.qat-btn:disabled { opacity: 0.4; color: var(--ink-text) !important; }
.qat-more { width: 18px; color: var(--ink-muted); }
.qat-more svg { width: 12px; height: 12px; }

/* ------------------------------------------------------------------------- */
/* Tabs: a row of pills on the command area */

.tabstrip {
  height: 36px; display: flex; align-items: flex-end; gap: 2px; padding: 0 52px 0 12px; background: var(--chrome); position: relative;
}
.rtab {
  position: relative; flex: none; height: 28px; padding: 0 12px; border: 0; border-radius: var(--r); font-size: 13px; font-weight: 500; color: #5d5257;
}
.rtab:hover { background: var(--hover-chrome); color: var(--text); }
.rtab.cur, .rtab.cur:hover { background: var(--accent-tint); color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent-line); }

/* Contextual tabs ("Drawing Tools", "Picture Tools"...): pills with a coloured dot, after a thin divider */
.ctx-group {
  --ctx: var(--ctx-drawing);
  position: relative; display: flex; align-items: center; gap: 2px; margin-left: 6px; padding-left: 7px;
}
.ctx-group::before { content: ''; position: absolute; left: 0; top: 50%; width: 1px; height: 16px; margin-top: -8px; background: var(--line-strong); }
.ctx-group[data-context='Text Box Tools'] { --ctx: var(--ctx-text); }
.ctx-group[data-context='Picture Tools'] { --ctx: var(--ctx-picture); }
.ctx-group[data-context='Table Tools'] { --ctx: var(--ctx-table); }
.ctx-group[data-context='Master Page'] { --ctx: var(--ctx-master); }
.ctx-group[data-context='Catalog Tools'] { --ctx: var(--ctx-catalog); }
.ctx-label {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.ctx-tabs { display: flex; align-items: center; gap: 2px; }
.ctx-tabs .rtab { display: inline-flex; align-items: center; gap: 7px; padding-left: 11px; color: color-mix(in srgb, var(--ctx) 50%, #2a2225); }
.ctx-tabs .rtab::before {
  content: ''; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--ctx);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ctx) 17%, transparent);
}
.ctx-tabs .rtab.cur { color: var(--accent-text); }

/* ------------------------------------------------------------------------- */
/* Command area: groups are rounded cards */

.rbody {
  min-height: 0; display: flex; align-items: flex-start; gap: 5px; padding: 8px 10px 10px; background: var(--chrome);
  overflow-x: auto; overflow-y: hidden;
}
.rbody::-webkit-scrollbar { height: 6px; }
.rbody::-webkit-scrollbar-thumb { border-width: 1px; }
.rbody.peek {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 40; padding-top: 8px; border-bottom: 1px solid var(--line);
  box-shadow: 0 12px 24px rgba(45, 28, 22, 0.12);
}
.ribbon.collapsed .tabstrip { height: 44px; padding-bottom: 8px; }
.rbody > .spacer { flex: 1 0 0; margin-left: -5px; }
/* collapse sits at the right end of the tab row (it is positioned on the ribbon, outside the scrolling body) */
.rbody > .collapse {
  position: absolute; top: 52px; right: 12px; flex: none; width: 28px; height: 28px; margin: 0; display: grid; place-items: center;
  color: var(--muted); background: transparent; border-radius: 7px;
}
.rbody.peek > .collapse { position: sticky; top: auto; right: 0; align-self: flex-end; background: var(--chrome); }
.rbody > .collapse:hover { background: var(--hover-chrome); color: var(--text); }
.rbody > .collapse svg { width: 14px; height: 14px; }
.ribbon.collapsed .rbody > .collapse svg { transform: rotate(180deg); }

/* Groups */
.rgroup {
  flex: none; position: relative; height: 109px; display: flex; flex-direction: column; padding: 6px 6px 7px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: 0 1px 0 rgba(60, 40, 30, 0.03);
}
.rgroup-body { flex: 1 1 auto; min-height: 0; display: flex; align-items: flex-start; gap: 2px; }
.rgroup-label {
  order: -1; flex: none; position: relative; height: 16px; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; padding: 0 2px 0 3px;
  font-size: 9.5px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; line-height: 1; color: #ab9f97; white-space: nowrap;
}
.launcher {
  flex: none; margin-left: auto; margin-right: -2px; width: 18px; height: 16px; display: grid; place-items: center; border: 0; border-radius: 4px;
  color: var(--faint);
}
.launcher svg { width: 12px; height: 12px; }
.launcher:hover { background: var(--hover); color: var(--accent-text); }

/* Icons: forced to the ribbon sizes */
.rbody svg { flex: none; }
.ico32, .rbig .ico-wrap > svg { width: 24px; height: 24px; }
.rbig .ico-wrap > svg, .rsmall > svg:not(.chev), .rsmall > .ico-wrap > svg { color: var(--icon); }
.ico20 { width: 16px; height: 16px; }
.ico16 { width: 16px; height: 16px; }

/* Big buttons: icon over a label that wraps to two lines */
.rbig {
  height: 74px; min-width: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; padding: 4px 5px 3px; border-radius: var(--r); line-height: 14px; font-size: 12px; text-align: center; white-space: normal;
}
.rbig > svg, .rbig > .ico-wrap { margin-bottom: 0; }
.rbig-label {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; text-wrap: balance;
  max-width: 74px; min-width: min-content;
}
.rbig-label svg { width: 11px; height: 11px; vertical-align: -1.5px; margin-left: 2px; color: var(--muted); opacity: .8; }
.rbig:hover:not(:disabled) { background: var(--hover); }
.rbig:active:not(:disabled) { background: var(--pressed); }
.rbig.on, .rbig.on:hover { background: var(--on); border-color: transparent; color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--on-border); }
.rbig.on .ico-wrap > svg { color: var(--accent-text); }

/* Small buttons: 16px icon + label, three rows per column */
.rsmall {
  height: 24px; min-width: 24px; display: inline-flex; align-items: center; gap: 6px; padding: 0 4px; line-height: 20px; border-radius: var(--r-sm);
  font-size: 12px;
}
.rsmall.labelled { padding-right: 6px; }
/* icon-only buttons in the two-row groups (Font, Paragraph) are 27 x 26, as in the mock-up */
.rrow .rsmall:not(.labelled) { height: 26px; min-width: 27px; justify-content: center; }
.rsmall > svg:not(.chev), .rsmall > .ico-wrap > svg { width: 16px; height: 16px; }
.rsmall:hover:not(:disabled) { background: var(--hover); }
.rsmall:active:not(:disabled) { background: var(--pressed); }
.rsmall.on, .rsmall.on:hover { background: var(--on); border-color: transparent; color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--on-border); }
.rsmall.on > svg:not(.chev), .rsmall.on > .ico-wrap > svg { color: var(--accent-text); }
.rsmall .chev { width: 10px; height: 10px; margin-left: -3px; color: var(--muted); opacity: .8; }
.rsmall.labelled .chev { margin-left: -1px; }

:is(.rbig, .rsmall, .arrow, .launcher):disabled { color: var(--faint); }
:is(.rbig, .rsmall):disabled svg { opacity: 0.5; }

/* Colour bar under Font Color / Highlight / Fill icons */
.ico-wrap { position: relative; display: inline-flex; flex: none; }
.swatch-bar {
  position: absolute; left: 0; right: 0; bottom: -2px; height: 3px; border: 1px solid transparent; border-radius: 2px;
}
.rbig .swatch-bar { left: 3px; right: 3px; height: 4px; bottom: -3px; }
:disabled .swatch-bar { opacity: 0.4; }

/* Split and drop-down buttons */
.rdrop { position: relative; display: inline-flex; align-items: stretch; flex: none; border-radius: var(--r-sm); }
.rdrop.split > .main { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.rdrop .arrow {
  width: 14px; display: grid; place-items: center; border-top-left-radius: 0; border-bottom-left-radius: 0; color: var(--muted);
}
.rdrop .arrow svg { width: 10px; height: 10px; }
.rdrop.split:hover > button:not(:disabled) { background: var(--hover); }
.rdrop.split > .main:hover:not(:disabled), .rdrop .arrow:hover:not(:disabled) { background: var(--pressed); }
.rdrop.split > .main.on, .rdrop.split:hover > .main.on { background: var(--on); }
.rdrop.split:not(.big) > .arrow { border-left: 1px solid transparent; }
.rdrop.split:not(.big):hover > .arrow:not(:disabled) { border-left-color: var(--card); }
.rdrop.open > button, .rdrop.open > button:hover { background: var(--pressed); }
.rdrop.split.open > .main { background: transparent; }

/* Big split button (Paste, Page): icon part on top, label + arrow below */
.rdrop.split.big { flex-direction: column; height: 74px; border-radius: var(--r); }
.rdrop.split.big > .main { height: auto; flex: 1 1 auto; border-radius: var(--r) var(--r) 0 0; padding-bottom: 0; }
.rdrop.split.big > .arrow { width: auto; height: 14px; border-radius: 0 0 var(--r) var(--r); margin-top: -1px; }
.rdrop.split.big:hover > .arrow:not(:disabled) { border-top: 1px solid var(--card); }

/* Columns, rows and stacks of small controls */
.rstack { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; flex: none; }
/* two rows (Font, Paragraph): one at the top of the card, one level with the bottom row of the three-row stacks */
.rstack.rows-2 { align-self: stretch; justify-content: space-between; gap: 0; padding: 0; }
.rrow { display: flex; align-items: center; gap: 2px; height: 26px; flex: none; }
.rcol { display: flex; flex-direction: column; gap: 9px; padding-top: 4px; flex: none; }
/* three-row columns (Mail Merge > Preview Merge) must fit the 74px group body */
.rcol:has(> :nth-child(3)):not(.checks):not(.size-col) { gap: 0; padding-top: 0; }
.rcol:has(> :nth-child(3)):not(.checks):not(.size-col) > .rrow { height: 24px; }
.rcol.checks { gap: 2px; padding: 1px 6px 0 2px; }
.rcol.size-col { gap: 1px; padding-top: 0; }
.rcol.checks .check { height: 24px; }
.rlabel { font-size: 11px; color: var(--muted); height: 18px; line-height: 18px; }
.rbody .check { height: 22px; padding: 0 4px 0 2px; }
.rnote { font-size: 11px; color: var(--muted); padding-left: 4px; }
.rbody .measure { gap: 5px; }
.rbody .mlab { min-width: 14px; text-align: center; color: var(--muted); }
.record-box {
  width: 40px; height: 26px; text-align: center; border: 1px solid var(--field-border); border-radius: var(--r-sm); background: var(--field); margin: 0 2px;
}
.record-box:disabled { background: var(--well); color: var(--faint); }

.check { display: flex; align-items: center; gap: 7px; white-space: nowrap; line-height: 18px; }

/* Combo boxes (font name, font size); the ribbon's are a little narrower than the TSX asks for */
.rgroup[data-group='Font'] .combo:has([data-cmd='font-name']) { width: 130px !important; }
.rgroup[data-group='Font'] .combo:has([data-cmd='font-size']) { width: 54px !important; }

.combo {
  position: relative; display: inline-flex; align-items: stretch; height: 26px; flex: none; background: #fff;
  border: 1px solid var(--line-strong); border-radius: 7px;
}
.combo input {
  flex: 1 1 auto; min-width: 0; width: 100%; height: 100%; padding: 0 2px 0 8px; font-size: 12.5px; border: 0 !important; background: transparent; outline: none;
  box-shadow: none !important;
}
.combo.numeric input { padding-left: 7px; font-size: 12px; }
.combo-arrow {
  flex: none; width: 18px; min-width: 0 !important; height: auto !important; padding: 0 !important; display: grid; place-items: center; border: 0 !important;
  border-radius: 0 5px 5px 0 !important; background: transparent !important; color: var(--muted);
}
.combo-arrow svg { width: 10px; height: 10px; }
.combo:hover { border-color: var(--field-hover); }
.combo-arrow:hover { background: var(--hover) !important; color: var(--text); }
.combo:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.modal .combo, .backstage .combo { height: 28px; }

/* Measurement spin boxes */
.measure { display: flex; align-items: center; gap: 8px; }
.mlab { color: var(--text); white-space: nowrap; }
.spin {
  display: inline-flex; align-items: stretch; height: 26px; flex: none; background: var(--field); border: 1px solid var(--field-border);
  border-radius: var(--r-sm); overflow: hidden;
}
.spin:hover { border-color: var(--field-hover); }
.spin:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.spin input {
  height: 100% !important; min-width: 0; padding: 0 4px 0 7px !important; border: 0 !important; border-radius: 0 !important; background: transparent !important;
  outline: none; box-shadow: none !important; font-size: 11.5px;
}
.spin-btns { display: flex; flex-direction: column; width: 16px; border-left: 1px solid var(--line-soft); }
.spin-btns button {
  position: relative; flex: 1 1 0; height: auto !important; min-width: 0 !important; padding: 0 !important; border: 0 !important; border-radius: 0 !important;
  font-size: 0; line-height: 0; color: var(--muted); background: transparent !important;
}
.spin-btns button::before {
  content: ''; position: absolute; inset: 0; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath d='M1.75 5.25 4 3l2.25 2.25' fill='none' stroke='%23000' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 8px 8px no-repeat;
}
.spin-btns button + button::before { transform: scaleY(-1); }
.spin-btns button:hover { background: var(--hover) !important; color: var(--accent-text); }
.modal .spin, .backstage .spin { height: 28px; }

/* Gallery strips inside the ribbon (Shape Styles, Picture Styles, Color Schemes) */
.inline-gallery, .scheme-gallery {
  display: grid; grid-template-columns: repeat(3, auto) 18px; grid-template-rows: repeat(2, 33px); align-items: center; justify-items: center;
  gap: 2px 3px; padding: 1px 0 1px 3px; margin-top: 1px; background: var(--field); border: 1px solid var(--line); border-radius: var(--r); flex: none;
  overflow: hidden;
}
.inline-gallery > .rdrop, .scheme-gallery > .rdrop {
  grid-column: 4; grid-row: 1 / -1; align-self: stretch; justify-self: stretch; border-left: 1px solid var(--line-soft); border-radius: 0;
}
.inline-gallery > .rdrop > .rsmall, .scheme-gallery > .rdrop > .rsmall {
  position: relative; width: 100%; height: 100%; min-width: 0; padding: 0; border-radius: 0; justify-content: center; align-items: flex-end;
  padding-bottom: 6px;
}
/* scroll up / down marks above the More arrow: the whole column opens the full gallery */
.inline-gallery > .rdrop > .rsmall::before, .scheme-gallery > .rdrop > .rsmall::before {
  content: ''; position: absolute; left: 50%; top: 8px; margin-left: -3px; border: 3px solid transparent; border-bottom: 3.5px solid var(--faint); border-top: 0;
}
.inline-gallery > .rdrop > .rsmall::after, .scheme-gallery > .rdrop > .rsmall::after {
  content: ''; position: absolute; left: 50%; top: 21px; margin-left: -3px; border: 3px solid transparent; border-top: 3.5px solid var(--faint); border-bottom: 0;
}
.inline-gallery > .rdrop .chev, .scheme-gallery > .rdrop .chev {
  margin: 0; width: 10px; height: 10px; color: var(--muted); border-top: 1.5px solid var(--faint); padding-top: 1px; box-sizing: content-box;
}
.inline-gallery > .gtile { width: 46px; height: 31px; padding: 1px; }
.style-tile {
  display: grid; place-items: center; width: 40px; height: 25px; font-size: 11px; color: #fff; text-shadow: 0 0 2px rgba(0, 0, 0, 0.7);
  border-radius: 3px;
}
.scheme-btn { width: 66px; height: 31px; display: grid; place-items: center; padding: 2px; border-radius: var(--r-sm); }
.scheme-btn:hover { background: var(--hover); }
.scheme-btn.cur { border-color: var(--accent-line); background: var(--accent-tint); }
.scheme-strip { display: inline-flex; width: 58px; height: 18px; flex: none; border: 1px solid rgba(60, 40, 30, 0.14); border-radius: 3px; overflow: hidden; }
.scheme-strip > span { flex: 1 1 0; }

.align-grid { display: grid; grid-template-columns: repeat(3, 24px); grid-auto-rows: 22px; gap: 1px; padding-top: 1px; flex: none; }
.align-grid .rsmall { justify-content: center; padding: 0; }

/* Picture style previews */
.picstyle-tile {
  display: grid; place-items: end center; width: 40px; height: 27px; font-size: 10px; line-height: 1.1; text-align: center;
  background: linear-gradient(160deg, #8fbcd9 0%, #8fbcd9 45%, #6f9e5f 46%, #4f7f45 100%); color: #fff;
}
.picstyle-tile.ps-simple-frame { box-shadow: 0 0 0 1px #222; }
.picstyle-tile.ps-thick-white-frame { border: 3px solid #fff; box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5); }
.picstyle-tile.ps-rounded-corners { border-radius: 5px; }
.picstyle-tile.ps-oval { border-radius: 50%; }
.picstyle-tile.ps-drop-shadow { box-shadow: 3px 3px 4px rgba(0, 0, 0, 0.45); }
.picstyle-tile.ps-soft-edge { -webkit-mask-image: radial-gradient(ellipse at center, #000 55%, transparent 100%); }
.picstyle-tile.ps-accent-frame { border: 3px solid var(--accent); }
.picstyle-tile.ps-double-frame { border: 3px double #222; }
.popup .picstyle-tile { width: 92px; height: 64px; padding-bottom: 3px; }

/* ------------------------------------------------------------------------- */
/* Popups and menus (stack above dialogs: colour pickers open from dialogs) */

.popup {
  position: fixed; z-index: 1000; min-width: 132px; overflow: auto; padding: 4px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--popup-shadow); font-size: 12px; color: var(--text); user-select: none;
}
.popup.wide, .popup.blocks-pop, .popup.shapes-pop { padding-bottom: 6px; }
.popup.tellme-list { min-width: 280px; }
.popup.combo-list { min-width: 60px; padding: 4px; }
.popup.styles-pop { min-width: 220px; }

.mitem {
  display: flex; align-items: center; width: 100%; min-height: 28px; padding: 0 14px 0 0; border: 0; border-radius: var(--r-sm); text-align: left;
  white-space: nowrap; background: transparent;
}
.mitem:hover:not(:disabled), .mitem.sub:focus { background: var(--hover); }
.mitem:active:not(:disabled) { background: var(--pressed); }
.mitem:disabled { color: var(--faint); }
.mitem.cur { background: var(--accent-tint); color: var(--accent-dark); }
.mitem.cur:hover { background: var(--accent-soft); }
.mcheck { width: 30px; flex: none; display: grid; place-items: center; font-size: 12px; color: var(--accent-text); }
.mcheck svg { width: 16px; height: 16px; color: var(--text); }
.mitem:disabled .mcheck svg { opacity: 0.4; }
.mlabel { flex: 1 1 auto; }
.mkeys { margin-left: 28px; color: var(--faint); font-family: var(--font-mono); font-size: 10.5px; }
.msep { height: 1px; margin: 4px 6px 4px 30px; background: var(--line-soft); }
.mhead, .mheading {
  padding: 8px 8px 4px; margin: 0; background: none; font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em; color: var(--muted); white-space: nowrap;
}
.popup > .mhead:first-child, .popup > .mheading:first-child, .popup > div:first-child > .mhead:first-child { padding-top: 5px; }
.combo-list .mitem { min-height: 24px; padding: 0 12px 0 8px; }
.combo-list .mitem span { white-space: nowrap; }
.mitem.scheme-row { gap: 10px; padding-left: 10px; }
.mitem.font-scheme { flex-direction: column; align-items: flex-start; gap: 0; padding: 6px 16px 7px 12px; line-height: 1.3; }
.fs-name { font-size: 10.5px; font-weight: 600; color: var(--muted); }
.mitem.style-item { min-height: 32px; padding-left: 12px; }
.more-colors { position: relative; cursor: default; }
.more-colors input[type=color] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: default; border: 0; padding: 0; }

/* Galleries in popups */
.gallery { display: grid; gap: 4px; padding: 4px 6px; justify-content: start; }
.gtile {
  display: grid; place-items: center; padding: 3px; border: 1px solid transparent; border-radius: var(--r-sm); background: transparent;
}
.gtile:hover { border-color: var(--accent-line); background: var(--accent-tint); }
.gtile.cur { border-color: var(--accent); background: var(--accent-tint); }
.bullet-tile { display: grid; place-items: center; width: 40px; height: 40px; font-size: 20px; background: #fff; border: 1px solid var(--line); border-radius: 4px; }
.gtile:first-child > .bullet-tile { font-size: 12px; } /* the "None" tile */
.number-tile {
  display: grid; place-items: center; width: 72px; height: 56px; white-space: pre; font-size: 11px; line-height: 1.35; background: #fff;
  border: 1px solid var(--line); border-radius: 4px;
}
.wordart-tile { display: grid; place-items: center; width: 60px; height: 54px; font-size: 42px; line-height: 1; font-family: Georgia, 'Times New Roman', serif; }
.bg-tile { display: block; width: 46px; height: 36px; border: 1px solid var(--line-strong); border-radius: 3px; }
.recolor-tile {
  display: grid; place-items: center; width: 74px; height: 44px; padding: 2px; font-size: 10px; line-height: 1.15; white-space: normal;
  text-align: center; color: #fff; text-shadow: 0 0 2px rgba(0, 0, 0, 0.8); border-radius: 3px;
}
.dropcap-tile {
  display: flex; align-items: flex-start; width: 56px; height: 54px; padding: 3px; overflow: hidden; font-size: 11px; line-height: 1;
  background: #fff; border: 1px solid var(--line); border-radius: 4px; text-align: left;
}
.dropcap-tile b { color: var(--accent-text); margin-right: 1px; line-height: 0.85; }
.corrections-grid { display: grid; grid-template-columns: repeat(5, auto); gap: 3px; padding: 4px 6px; }
.corrections-grid .gtile img { display: block; width: 64px; height: 48px; object-fit: cover; border-radius: 3px; }

/* Table size picker */
.table-grid-menu { padding-bottom: 4px; }
.table-grid { display: grid; grid-template-columns: repeat(10, 17px); gap: 2px; padding: 4px 8px 6px; }
.tg-cell { width: 17px; height: 17px; border: 1px solid var(--line-strong); border-radius: 3px; background: #fff; }
.tg-cell.on { border-color: var(--accent-line); background: var(--accent-tint); }

/* Shapes gallery */
.shapes-menu { width: 286px; padding-bottom: 2px; }
.shape-grid { display: grid; grid-template-columns: repeat(11, 24px); gap: 1px; padding: 3px 6px 4px; }
.shape-tile { width: 24px; height: 24px; padding: 1px; }
.shape-icon { display: block; }
.shape-icon path[fill='#dce6f2'] { fill: #f1e6e0; }
.shape-icon path[stroke='#3a5f8f'] { stroke: #6e5a55; }
.shape-tile:hover .shape-icon path[stroke='#3a5f8f'] { stroke: var(--accent); }

/* Building blocks and calendars */
.blocks-menu { width: 438px; }
.block-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 6px; }
.block-tile { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 5px; padding: 5px; }
.block-thumb {
  display: grid; place-items: center; width: 124px; height: 96px; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 6px;
  pointer-events: none;
}
.block-name { max-width: 128px; font-size: 11px; line-height: 1.25; text-align: center; white-space: normal; }

/* Symbols in the ribbon menu */
.popup .symbol-grid { display: grid; grid-template-columns: repeat(8, 30px); gap: 2px; padding: 6px; }
.gtile.sym { width: 30px; height: 30px; font-size: 17px; background: #fff; border-color: var(--line-soft); }

/* Colour picker grid */
.colors { padding: 0 0 2px; min-width: 250px; }
.colors > .mhead { margin: 2px 0 0; }
.colors > .mitem:first-child + .mhead, .colors > .mhead:first-child { margin-top: 0; }
.swatches { display: grid; grid-template-columns: repeat(11, 18px); gap: 4px; padding: 4px 8px 2px; }
.swatches.tints { grid-template-columns: repeat(6, 18px); gap: 0 4px; padding-top: 0; padding-left: calc(8px + 22px); }
.sw { width: 18px; height: 18px; padding: 0; border: 1px solid rgba(60, 40, 30, 0.16); border-radius: 4px; position: relative; }
.swatches.tints .sw { height: 16px; border-radius: 0; border-top-color: transparent; }
.swatches.tints .sw:nth-child(-n+6) { border-top-color: rgba(60, 40, 30, 0.16); border-radius: 4px 4px 0 0; }
.swatches.tints .sw:nth-last-child(-n+6) { border-radius: 0 0 4px 4px; }
.sw:hover { outline: 2px solid var(--ink); outline-offset: 1px; z-index: 1; }
.sw.cur { outline: 2px solid var(--accent); outline-offset: 1px; z-index: 1; }
.sw.big { display: inline-block; width: 26px; height: 22px; }

/* ------------------------------------------------------------------------- */
/* Context menu */

.ctx-menu {
  position: fixed; z-index: 1100; min-width: 200px; padding: 4px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--popup-shadow); font-size: 12px; color: var(--text); user-select: none;
}
.ctx-sub { position: relative; anchor-name: --ctx-sub; anchor-scope: --ctx-sub; }
.ctx-menu.ctx-submenu { position: absolute; left: calc(100% - 2px); top: -5px; z-index: 1; }
/* near the window edge the submenu opens to the left (or upwards) instead of being cut off */
@supports (position-try-fallbacks: flip-inline) {
  .ctx-menu.ctx-submenu {
    position: fixed; position-anchor: --ctx-sub; left: calc(anchor(right) - 2px); top: calc(anchor(top) - 5px);
    position-try-fallbacks: flip-inline, flip-block, flip-block flip-inline;
  }
}
.ctx-menu .mitem { min-height: 27px; }
.ctx-menu .mitem.sub .mkeys { margin-left: 24px; font-size: 9px; }

/* ------------------------------------------------------------------------- */
/* Pages pane (left): a floating card */

.pages-pane {
  flex: none; width: 148px; margin: 10px 10px 10px 10px; display: flex; flex-direction: column; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-float); overflow: hidden; user-select: none;
}
.pages-pane.collapsed { width: 44px; }
.pane-head {
  flex: none; height: 36px; display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 0 5px 0 12px;
  font-size: 9.5px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted);
}
.pane-head > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pane-head > button {
  flex: none; width: 26px; height: 26px; min-width: 0; padding: 0; display: grid; place-items: center; border: 0; color: var(--muted);
  background: transparent; border-radius: var(--r-sm);
}
.pane-head > button:hover { background: var(--hover); color: var(--text); }
.pane-head > button svg { width: 15px; height: 15px; }
.pages-pane .pane-head { height: 38px; justify-content: flex-start; gap: 7px; padding: 4px 8px 0 12px; font-size: 11px; letter-spacing: 0.08em; }
.pages-pane .pane-head > button { margin-left: auto; width: 24px; height: 22px; color: var(--faint); }
.pane-head .count {
  flex: none; padding: 0 5px; border: 1px solid var(--line); border-radius: 5px; background: var(--chrome); color: var(--muted);
  font-size: 10.5px; font-weight: 500; letter-spacing: 0; line-height: 15px; text-transform: none;
}
.pages-pane.collapsed .pane-head { justify-content: center; padding: 0; }
.pages-pane.collapsed .pane-head > button { margin: 0; }

.pages-list {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 4px 6px 14px; display: flex; flex-direction: column;
  align-items: center; gap: 4px;
}
.page-group { display: flex; justify-content: center; gap: 0; }
.page-thumb {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 7px 5px; border: 0; border-radius: var(--r);
  background: transparent; white-space: normal;
}
.page-group.pair .page-thumb { padding-left: 1px; padding-right: 1px; }
.page-group.pair .page-thumb:first-child { padding-left: 6px; }
.page-group.pair .page-thumb:last-child { padding-right: 6px; }
.page-thumb:hover { background: var(--hover); }
.page-thumb .thumb { border-radius: 3px; box-shadow: 0 0 0 1px var(--line), 0 2px 6px -2px rgba(60, 35, 25, 0.2); }
.page-thumb.cur .thumb { box-shadow: 0 0 0 2px var(--accent), 0 0 0 5px var(--accent-tint); }
.page-thumb.cur:hover { background: transparent; }
.page-thumb.drop { box-shadow: inset 0 3px 0 var(--accent); }
.pnum {
  min-width: 0; height: 15px; padding: 0 6px; border-radius: 5px; font-size: 10.5px; line-height: 15px; text-align: center; color: var(--muted);
}
.page-thumb.cur .pnum { background: var(--accent); color: #fff; font-weight: 500; }
.pname { font-size: 11px; color: var(--muted); max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pages-pane.collapsed .pages-list { padding: 2px 4px; gap: 3px; }
.pages-pane.collapsed .page-thumb { width: 34px; height: 28px; padding: 0; justify-content: center; }
.pages-pane.collapsed .page-group.pair { flex-direction: column; gap: 3px; }
/* section headers: a name, a page count and a chevron that folds the section's pages away */
.section-head {
  flex: none; align-self: stretch; display: flex; align-items: center; gap: 5px; height: 26px; margin-top: 4px; padding: 0 6px 0 5px;
  border: 0; border-radius: var(--r-sm); background: var(--well); color: var(--muted); font-size: 11px; font-weight: 600; text-align: left;
}
.section-head:first-child { margin-top: 0; }
.section-head:hover { background: var(--hover); color: var(--text); }
.section-head.cur { color: var(--text); }
.section-head svg { flex: none; width: 12px; height: 12px; }
.section-head .sname { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-head .scount { flex: none; font-size: 10px; font-weight: 500; color: var(--faint); }
.pages-pane.collapsed .section-head { height: 9px; padding: 0 4px; margin: 2px 0; background: transparent; }
.section-rule { flex: 1; height: 2px; border-radius: 1px; background: var(--line-strong); }
.section-head.folded .section-rule { background: var(--accent-line); }

/* Thumbnails (pages pane, galleries, File screen) */
.thumb { position: relative; flex: none; overflow: hidden; background: #fff; pointer-events: none; }
.thumb-page { position: relative; }

/* ------------------------------------------------------------------------- */
/* Canvas: linen desk with a fine dot grid, thin rulers */

.canvas-area { flex: 1 1 auto; min-width: 0; position: relative; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); }
.canvas-area.with-rulers { grid-template: 22px minmax(0, 1fr) / 22px minmax(0, 1fr); }
.canvas-area > .canvas-scroll { grid-area: 1 / 1; }
.canvas-area.with-rulers > .canvas-scroll { grid-area: 2 / 2; }
/* the corner box names the ruler unit */
.ruler-corner {
  grid-area: 1 / 1; z-index: 1; display: grid; place-items: center; background: var(--ruler); box-shadow: inset -1px -1px 0 var(--line);
  color: var(--faint); font-size: 9.5px; user-select: none;
}
.ruler { display: block; width: 100%; height: 100%; overflow: hidden; background: var(--ruler); user-select: none; }
.ruler-x { grid-area: 1 / 2; box-shadow: inset 0 -1px 0 var(--line); cursor: row-resize; }
.ruler-y { grid-area: 2 / 1; box-shadow: inset -1px 0 0 var(--line); cursor: col-resize; }
.ticks line { stroke: var(--tick); stroke-width: 1px; shape-rendering: crispEdges; }
.ticks text { fill: var(--muted); font-size: 9.5px; font-family: var(--font-mono); letter-spacing: -0.02em; }
/* the selection's extent, in berry on both rulers */
.ruler-hl { fill: color-mix(in srgb, var(--sel) 10%, transparent); }
.ruler-hl-edge { fill: none; stroke: var(--accent); stroke-width: 1px; shape-rendering: crispEdges; }
.ruler-ptr { stroke: var(--accent); stroke-width: 1px; shape-rendering: crispEdges; }

.canvas-scroll {
  position: relative; min-width: 0; min-height: 0; overflow: auto; background-color: var(--desk);
  background-image: radial-gradient(circle at 1px 1px, var(--desk-dot) 1px, transparent 1.2px);
  background-size: 16px 16px; background-position: 6px 6px; background-attachment: local;
}
.desk {
  display: flex; align-items: center; justify-content: center; width: max-content; height: max-content; min-width: 100%; min-height: 100%;
  user-select: none;
}
.spread { display: flex; align-items: flex-start; flex: none; }
.spread > .page {
  flex: none;
  box-shadow: 0 0 0 1px rgba(60, 40, 30, 0.06), 0 18px 40px -18px rgba(60, 35, 25, 0.35), 0 4px 10px -4px rgba(60, 35, 25, 0.12);
}
.spread > .page.facing { cursor: pointer; }
.spread > .page.is-master { box-shadow: 0 0 0 1px rgba(76, 138, 60, 0.6), 0 2px 4px rgba(70, 46, 34, 0.06), 0 10px 30px rgba(70, 46, 34, 0.12); }

/* Pointer shapes for the tools */
.desk.tool-select .page.current .item[data-id] { cursor: move; }
.desk:is(.tool-text, .tool-shape, .tool-table, .tool-placeholder, .tool-freeform, .tool-scribble),
.desk:is(.tool-text, .tool-shape, .tool-table, .tool-placeholder, .tool-freeform, .tool-scribble) .page .item[data-id] { cursor: crosshair; }
.desk.tool-link .page .item[data-id] { cursor: alias; }
.desk.tool-painter, .desk.tool-painter .page .item[data-id] { cursor: copy; }
/* See-Through Color: an eyedropper (Lucide's pipette) whose tip picks the colour */
.desk.tool-transparent .page .item[data-id] { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg stroke='%23fff' stroke-width='4'%3E%3Cpath d='m12 9-8.414 8.414A2 2 0 0 0 3 18.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 3.828 21h1.344a2 2 0 0 0 1.414-.586L15 12'/%3E%3Cpath d='m18 9 .4.4a1 1 0 1 1-3 3l-3.8-3.8a1 1 0 1 1 3-3l.4.4 3.4-3.4a1 1 0 1 1 3 3z'/%3E%3Cpath d='m2 22 .414-.414'/%3E%3C/g%3E%3Cg stroke='%232b1d22' stroke-width='1.6'%3E%3Cpath d='m12 9-8.414 8.414A2 2 0 0 0 3 18.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 3.828 21h1.344a2 2 0 0 0 1.414-.586L15 12'/%3E%3Cpath d='m18 9 .4.4a1 1 0 1 1-3 3l-3.8-3.8a1 1 0 1 1 3-3l.4.4 3.4-3.4a1 1 0 1 1 3 3z'/%3E%3Cpath d='m2 22 .414-.414'/%3E%3C/g%3E%3C/svg%3E") 2 22, crosshair; }

/* Overlay: guides, selection and handles drawn over the page */
.overlay { position: absolute; inset: 0; pointer-events: none; }
.guides { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.guide-hit { pointer-events: stroke; }
.guide-hit[data-guide^='x'] { cursor: ew-resize; }
.guide-hit[data-guide^='y'] { cursor: ns-resize; }

.sel { position: absolute; border-style: solid; border-color: var(--sel); pointer-events: none; transform-origin: center center; }
.sel.locked { border-style: dashed; border-color: #8f8078; }
/* The grip is a ring around the selection for dragging it; its inside stays clickable. */
.sel-grip {
  position: absolute; border-style: solid; border-color: transparent; pointer-events: auto; cursor: move;
  clip-path: polygon(evenodd, -500% -500%, 600% -500%, 600% 600%, -500% 600%, -500% -500%, 0 0, 0 100%, 100% 100%, 100% 0, 0 0) padding-box;
}
.multi-sel { position: absolute; border-style: dashed; border-color: var(--sel); pointer-events: none; }
/* handles: small white squares with a berry border; the rotation handle is a berry dot */
.handle {
  position: absolute; z-index: 2; box-sizing: border-box; border-style: solid; border-color: var(--handle); border-radius: 22%;
  background: #fff; pointer-events: auto;
}
.handle:hover { background: var(--accent-tint); }
.h-n, .h-s { cursor: ns-resize; }
.h-e, .h-w { cursor: ew-resize; }
.h-ne, .h-sw { cursor: nesw-resize; }
.h-nw, .h-se { cursor: nwse-resize; }
.handle.rot { cursor: grab; border-radius: 50%; border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.7); }
.handle.rot:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.handle.rot:active { cursor: grabbing; }
.rot-stem { position: absolute; left: 50%; transform: translateX(-50%); background: var(--sel); pointer-events: none; }
/* X/Y/W/H beside the selection while it moves or resizes */
.drag-readout {
  position: absolute; z-index: 8; display: flex; gap: 9px; padding: 4px 8px; transform: translateY(-50%); white-space: nowrap; pointer-events: none;
  background: var(--ink); color: var(--ink-text); font-size: 10.5px; line-height: 14px; border-radius: 6px; box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.4);
}
.drag-readout.flip { transform: translate(-100%, -50%); }
.drag-readout i { margin-right: 4px; font-style: normal; color: var(--ink-muted); }
.handle.adjust { background: #f6c445; border-color: #7a5a00; border-radius: 50%; cursor: pointer; }
.handle.adjust:hover { background: #ffd970; }
.handle.line-end { cursor: crosshair; border-radius: 50%; }
.line-sel { position: absolute; overflow: visible; pointer-events: none; }
.line-sel line { stroke: var(--sel); }
.draw-preview { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.draw-preview polyline { stroke: var(--sel); }
.marquee { position: absolute; border-style: dashed; border-color: #7a6a63; background: color-mix(in srgb, var(--sel) 5%, transparent); pointer-events: none; }
.marquee.creating { border-style: solid; border-color: var(--sel); background: color-mix(in srgb, var(--sel) 4%, transparent); }
.boundary { position: absolute; border-style: dotted; border-color: #8ea3bd; pointer-events: none; transform-origin: center center; }

.link-nav {
  position: absolute; z-index: 3; width: 1.9em; height: 1.7em; display: grid; place-items: center; padding: 0; pointer-events: auto;
  border: 1px solid var(--accent-line); border-radius: 3px; background: #fff; color: var(--accent-dark); line-height: 1;
}
.link-nav:hover { background: var(--accent-tint); border-color: var(--accent); color: var(--accent-dark); }
.link-nav.prev { left: 0; bottom: 100%; margin-bottom: 0.3em; }
.link-nav.next { right: 0; top: 100%; margin-top: 0.3em; }

/* Table editing marks */
.table-marks { position: absolute; pointer-events: none; transform-origin: center center; }
.col-line { position: absolute; top: 0; bottom: 0; pointer-events: auto; cursor: col-resize; }
.row-line { position: absolute; left: 0; right: 0; pointer-events: auto; cursor: row-resize; }
.cell-sel { position: absolute; background: color-mix(in srgb, var(--sel) 12%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--sel) 45%, transparent); pointer-events: none; }

/* Picture cropping */
.crop-ui { position: absolute; pointer-events: none; transform-origin: center center; }
.crop-ghost { position: absolute; max-width: none; opacity: 0.35; pointer-events: auto; cursor: move; }
.crop-window { position: absolute; inset: 0; pointer-events: auto; cursor: move; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6); }
.crop-handle { position: absolute; background: var(--ink); box-shadow: 0 0 0 1px #fff; pointer-events: auto; }
.crop-handle:is([data-crop='n'], [data-crop='s']) { cursor: ns-resize; }
.crop-handle:is([data-crop='e'], [data-crop='w']) { cursor: ew-resize; }
.crop-handle:is([data-crop='ne'], [data-crop='sw']) { cursor: nesw-resize; }
.crop-handle:is([data-crop='nw'], [data-crop='se']) { cursor: nwse-resize; }

/* Reshape Text Wrap: the outline text wraps to, with its points */
.wrap-ui { position: absolute; overflow: visible; pointer-events: none; transform-origin: center center; }
.wrap-line { fill: color-mix(in srgb, var(--sel) 6%, transparent); stroke: var(--sel); }
.wrap-hit { stroke: transparent; pointer-events: stroke; cursor: copy; }
.wrap-point { fill: #fff; stroke: var(--handle); pointer-events: all; cursor: move; }
.wrap-point:hover { fill: var(--accent-tint); }

/* Text editing */
.item.editing-box { outline: 1px dashed rgba(60, 30, 40, 0.5); outline-offset: 0; }
.text-editor { outline: none; cursor: text; user-select: text; -webkit-user-select: text; }
html[data-spell='off'] .text-editor ::spelling-error { text-decoration: none; }
.overflow-mark {
  position: absolute; right: -2px; bottom: -2px; transform: translate(50%, 50%); padding: 0 3px; font-size: 9px; line-height: 13px;
  font-family: var(--font-mono); color: var(--accent-dark); background: #fff; border: 1px solid var(--accent); border-radius: 2px; pointer-events: none; white-space: nowrap;
}
.desk .item .overflow-mark { visibility: hidden; }

/* ------------------------------------------------------------------------- */
/* Task pane (right): a floating card */

.task-pane {
  flex: none; width: 272px; margin: 8px 8px 8px 8px; display: flex; flex-direction: column; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-float); overflow: hidden;
}
.task-pane .pane-head {
  height: 44px; padding: 0 7px 0 16px; border-bottom: 1px solid var(--line-soft); font-size: 13px; font-weight: 600; letter-spacing: 0;
  text-transform: none; color: var(--text);
}
.pane-body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 10px;
}
.pane-body .hint { font-size: 11.5px; }
.row-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.task-pane .row-buttons button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 0; height: 28px; padding: 0 12px; }
.task-pane .row-buttons button svg { width: 15px; height: 15px; }
.task-pane label.field { display: flex; flex-direction: column; align-items: stretch; gap: 5px; }
.task-pane label.field > span { width: auto; font-size: 11.5px; font-weight: 500; color: var(--muted); }
.task-pane .radios { gap: 18px; }

.sel-list { display: flex; flex-direction: column; background: var(--field); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.sel-row { display: flex; align-items: center; gap: 2px; height: 30px; padding-right: 2px; border-bottom: 1px solid var(--line-soft); cursor: default; }
.sel-row:last-child { border-bottom: 0; }
.sel-row:hover { background: var(--hover); }
.sel-row.cur { background: var(--accent-tint); box-shadow: inset 2px 0 0 var(--accent); }
.sel-row.hidden .sel-name { color: var(--faint); font-style: italic; }
.twisty {
  flex: none; width: 18px; height: 18px; min-width: 0 !important; padding: 0 !important; display: grid; place-items: center; border: 0 !important;
  background: transparent !important; color: var(--muted);
}
.twisty svg { width: 12px; height: 12px; }
.sel-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-row input { flex: 1 1 auto; height: 24px !important; }
.lock { flex: none; width: 12px; height: 12px; color: var(--muted); }
.eye {
  flex: none; width: 26px !important; height: 24px !important; min-width: 0 !important; padding: 0 !important; display: grid; place-items: center;
  border: 0 !important; background: transparent !important; color: var(--muted);
}
.eye:hover { background: var(--hover) !important; color: var(--text); }
.eye svg { width: 16px; height: 16px; }

.problems, .find-results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border-top: 1px solid var(--line-soft); }
.problems li, .find-results li { padding: 8px 8px; border-bottom: 1px solid var(--line-soft); cursor: default; line-height: 1.4; }
.problems li { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 8px; }
.problems li .ptext { grid-column: 1; }
.problems li .ppage { grid-column: 1; }
.problems li button { grid-column: 2; grid-row: 1 / span 2; min-width: 0; height: 26px; padding: 0 10px; }
.problems li:hover, .find-results li:hover { background: var(--hover); }
.find-results li { display: flex; flex-direction: column; gap: 2px; border-radius: 0; }
.find-results li.cur { background: var(--accent-tint); box-shadow: inset 2px 0 0 var(--accent); }
.find-results mark { background: #fbe3a0; color: inherit; border-radius: 2px; }
.ppage { font-size: 11px; color: var(--muted); }
.thes-meaning { display: flex; flex-direction: column; gap: 2px; }
.thes-meaning > .twisty { height: 26px; padding: 0 4px !important; border-radius: var(--r-sm); color: var(--text); }
.thes-meaning > .twisty:hover { background: var(--hover) !important; }
.thes-meaning > .twisty b { font-weight: 600; }
.task-pane .find-results li:has(> button.link) { padding: 2px 6px; }
.thes-meaning .find-results { margin-left: 6px; border-top: 0; }
.thes-meaning .find-results li[data-syn] { padding: 0 2px 0 10px; border-bottom-color: var(--line-soft); }
.thes-meaning .find-results li[data-syn] > span:first-child { min-height: 30px; }
.thes-meaning .find-results li[data-syn] button.link { margin: 0; padding: 0 !important; height: 30px !important; color: var(--text); font-weight: 400; }
.thes-meaning .find-results li[data-syn] button.link:hover { color: var(--accent-dark); text-decoration: none; }
.thes-meaning .find-results li[data-syn] .twisty { width: 24px; height: 24px; border-radius: var(--r-sm); }
.thes-meaning .find-results li[data-syn] .twisty:hover { background: var(--well) !important; color: var(--text); }
.thes-meaning .find-results li[data-syn] > .row-buttons { padding: 2px 0 10px; }
.thes-meaning .find-results li.ppage { padding: 12px 0 4px 10px; border-bottom: 0; font-size: 9.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.thes-meaning .find-results li.ppage:hover { background: none; }
.research-article { display: flex; flex-direction: column; gap: 8px; padding: 12px; background: var(--well); border-radius: var(--r); line-height: 1.45; }
/* Picture List */
.gm-list li.gm-item { display: grid; grid-template-columns: 64px 1fr auto; align-items: start; gap: 10px; cursor: pointer; }
.gm-thumb { width: 64px; height: 48px; display: grid; place-items: center; background: var(--well); border-radius: var(--r-sm); overflow: hidden; }
.gm-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.gm-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.gm-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.gm-status { font-size: 11px; color: #3f7d3a; }
.gm-status.missing { color: #b42318; font-weight: 600; }
.task-pane .gm-menu { width: 24px; height: 24px; min-width: 0; padding: 0; display: grid; place-items: center; }
.gm-menu svg { width: 12px; height: 12px; }

/* ------------------------------------------------------------------------- */
/* Status: two floating pills over the bottom corners of the canvas */

.status {
  position: absolute; left: 12px; right: 22px; bottom: 12px; z-index: 6; display: flex; align-items: flex-end; justify-content: space-between;
  gap: 8px; pointer-events: none; font-size: 12px; color: var(--text); user-select: none; white-space: nowrap;
}
.stage:has(> .canvas-area.with-rulers) > .status { left: 34px; }
.st-pill {
  pointer-events: auto; display: flex; align-items: center; gap: 2px; height: 34px; padding: 0 6px; min-width: 0;
  background: rgba(255, 253, 250, 0.92); border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow-pill);
  backdrop-filter: blur(6px);
}
.st-left { flex: 0 1 auto; overflow: hidden; padding: 0 2px; }
.st-right { flex: none; gap: 4px; }
.st-pill > * + * { position: relative; }
/* hairlines between the parts of a pill */
.st-pill > :is(.st-paper, .st-pos, .st-size, .zoom-controls)::before {
  content: ''; position: absolute; left: -1px; top: 50%; height: 16px; margin-top: -8px; width: 1px; background: var(--line);
}
.st-page { display: flex; align-items: baseline; gap: 4px; height: 26px; line-height: 26px; padding: 0 10px; border-radius: 7px; font-size: 12px; font-weight: 500; color: var(--text); }
.st-page:hover { background: var(--hover); }
.st-page .of { color: var(--faint); font-weight: 400; }
.st-page .total { color: var(--muted); font-weight: 400; }
.st-paper { height: 26px; line-height: 26px; padding: 0 10px; font-size: 11px; color: var(--muted); }
.st-pos, .st-size { display: flex; align-items: center; gap: 10px; height: 26px; padding: 0 10px; font-size: 11px; color: var(--muted); }
.st-pos { gap: 6px; }
.st-pos::after {
  content: ''; order: -1; width: 13px; height: 13px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23857872' stroke-width='1.2'%3E%3Ccircle cx='8' cy='8' r='5.5'/%3E%3Cpath d='M8 .8v3.4M8 11.8v3.4M.8 8h3.4M11.8 8h3.4'/%3E%3C/svg%3E") center / contain no-repeat;
}
.st-size { color: var(--text); }
.st-size .ro { display: inline-flex; align-items: baseline; gap: 4px; }
.st-size .ro > i { font-style: normal; font-size: 10px; color: var(--faint); }
/* messages: a dark toast centred above the pills, fading out after a few seconds */
.status > .message {
  position: absolute; left: 50%; bottom: 46px; max-width: min(720px, 70%); height: 34px; display: flex; align-items: center; padding: 0 14px;
  border-radius: 11px; overflow: hidden; text-overflow: ellipsis; background: var(--ink); color: var(--ink-text); font-size: 12px; font-weight: 500;
  box-shadow: 0 8px 24px -10px rgba(34, 28, 31, 0.5); pointer-events: auto; transform: translateX(-50%);
  animation: toast 6s ease-out forwards;
}
.status > .message:empty { display: none; }
@keyframes toast {
  0% { opacity: 0; transform: translate(-50%, 6px); }
  4%, 88% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, 0); visibility: hidden; pointer-events: none; }
}
.st-update {
  height: 26px; padding: 0 10px; border: 0; border-radius: 7px; font: inherit; font-weight: 600;
  background: var(--accent-tint); color: var(--accent-text);
}
.st-update:hover { background: var(--accent); color: #fff; }
.st-views { display: flex; align-items: center; gap: 2px; padding: 0 4px 0 0; }
.st-views button { width: 28px; height: 26px; display: grid; place-items: center; color: #5a4f54; border: 0; border-radius: 7px; }
.st-views button svg { width: 15px; height: 15px; }
.st-views button:hover { background: var(--hover); color: var(--text); }
.st-views button.on { background: var(--accent-tint); color: var(--accent-text); }
.zoom-controls { display: flex; align-items: center; gap: 2px; padding-left: 6px; }
.zoom-controls button {
  width: 28px; height: 26px; display: grid; place-items: center; font-size: 16px; font-weight: 400; line-height: 1; color: #5a4f54;
  border: 0; border-radius: 7px;
}
.zoom-controls button:hover { background: var(--hover); color: var(--text); }
/* the zoom button: the percentage, then the fit-page mark */
.zoom-controls button.zoom { width: auto; display: inline-flex; align-items: center; gap: 2px; padding: 0; font-size: 12px; font-weight: 500; color: var(--text); background: none; }
.zoom-controls button.zoom .pct { width: 46px; text-align: center; }
.zoom-controls button.zoom .fit { width: 28px; height: 26px; display: grid; place-items: center; border-radius: 7px; color: #5a4f54; }
.zoom-controls button.zoom .fit svg { width: 15px; height: 15px; }
.zoom-controls button.zoom:hover .fit { background: var(--hover); color: var(--accent-text); }
.zoom-controls input[type=range] {
  --fill: 0%;
  -webkit-appearance: none; appearance: none; width: 96px; height: 20px; margin: 0 4px; background: transparent;
}
.zoom-controls input[type=range]::-webkit-slider-runnable-track {
  height: 3px; border-radius: 2px; background: linear-gradient(to right, var(--accent) var(--fill), var(--line-strong) var(--fill));
}
.zoom-controls input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 13px; height: 13px; margin-top: -5px; border-radius: 50%; background: #fff; border: 1.5px solid var(--accent);
}
.zoom-controls input[type=range]:hover::-webkit-slider-thumb { background: var(--accent-tint); }

/* ------------------------------------------------------------------------- */
/* Dialogs */

.modal-back { position: fixed; inset: 0; z-index: 500; display: grid; place-items: center; background: rgba(34, 28, 31, 0.2); }
.modal {
  display: flex; flex-direction: column; max-width: 96vw; max-height: 94vh; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--modal-shadow); font-size: 12px; color: var(--text); overflow: hidden;
}
.modal-title {
  flex: none; height: 52px; display: flex; align-items: center; padding: 0 10px 0 22px; background: transparent; font-size: 15px; font-weight: 600;
  letter-spacing: -0.005em; user-select: none; cursor: default; border-bottom: 0;
}
.modal-title > span { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-title > .x {
  flex: none; align-self: center; width: 30px; height: 30px; min-width: 0; padding: 0; display: grid; place-items: center; border: 0;
  border-radius: var(--r); background: transparent; color: var(--muted);
}
.modal-title > .x svg { width: 15px; height: 15px; }
.modal-title > .x:hover:not(:disabled) { background: var(--hover); color: var(--text); border: 0; }
.modal-body {
  flex: 1 1 auto; min-height: 0; overflow: auto; padding: 2px 22px 8px; display: flex; flex-direction: column; gap: 12px;
}
.modal-body > p { margin: 0; line-height: 1.5; }
.modal-buttons { flex: none; display: flex; align-items: center; gap: 8px; padding: 14px 22px 20px; }
.modal-buttons button { min-width: 84px; }
/* the primary (OK) button sits on the right, after Cancel */
.modal-buttons > [data-cmd='dialog:ok'] { order: 1; }

/* Tabs inside dialogs: the same pills as the ribbon tabs */
.dtabs { display: flex; flex-direction: column; min-height: 0; gap: 10px; }
.dtab-strip { display: flex; flex-wrap: wrap; gap: 2px; padding: 0; position: relative; z-index: 1; align-items: center; }
.dtab-strip button {
  height: 28px; min-width: 0; padding: 0 12px; border: 0; border-radius: var(--r); background: transparent; color: #5b4f4b; font-weight: 550;
}
.dtab-strip button:hover:not(:disabled) { background: var(--hover); border-color: transparent; color: var(--text); }
.dtab-strip button.cur, .dtab-strip button.cur:hover { background: var(--accent-tint); color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent-line); }
.dtab-body { padding: 4px 0 0; display: flex; flex-direction: column; gap: 12px; min-height: 120px; }

/* Form layout */
label.field, div.field { display: flex; align-items: center; gap: 10px; min-width: 0; }
label.field > span:first-child, div.field > span:first-child { flex: none; min-width: 84px; color: var(--text); }
label.field > :is(input, select, textarea, .combo), div.field > :is(input, select) { flex: 1 1 auto; }
label.field:has(> textarea), label.field:has(> select[size]), label.field:has(> .spell-context) { flex-direction: column; align-items: stretch; gap: 5px; }
label.field.inline { display: inline-flex; flex-wrap: wrap; }
label.field.inline > span:first-child { min-width: 0; }
fieldset {
  margin: 0; padding: 8px 14px 14px; min-width: 0; border: 1px solid var(--line); border-radius: var(--r-md); display: flex; flex-direction: column;
  gap: 9px;
}
legend { padding: 0 6px; margin-left: -4px; color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 20px; align-items: center; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px 16px; align-items: center; }
.grid2 .measure .mlab, .grid3 .measure .mlab { min-width: 52px; }
.grid2 label.field > span:first-child, .grid3 label.field > span:first-child { min-width: 64px; }
.span2 { grid-column: 1 / -1; }
.radios { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.checks { display: flex; flex-direction: column; gap: 5px; }
.checks3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px 12px; }
.modal .measure .mlab { min-width: 84px; }
/* in narrow grid cells the label goes above its box instead of overlapping it */
.modal :is(.grid2, .grid3) .measure .mlab { min-width: 52px; }
.modal :is(.grid2, .grid3) :is(.measure, label.field) { min-width: 0; flex-wrap: wrap; row-gap: 4px; }
.modal :is(.grid2, .grid3) label.field > :is(select, .combo) { flex: 1 1 96px; min-width: 96px; width: auto !important; }
.modal .check { min-height: 20px; }
.sample {
  display: grid; place-items: center; height: 66px; padding: 4px 10px; overflow: hidden; background: #fff; border: 1px solid var(--line);
  border-radius: var(--r); white-space: nowrap; text-align: center;
}
.modal .color-pick { flex: none; }

/* Colour button in dialogs */
.color-pick {
  display: inline-flex; align-items: center; gap: 7px; height: 28px; min-width: 96px; padding: 0 7px 0 6px; border: 1px solid var(--field-border);
  border-radius: var(--r-sm); background: var(--field);
}
.modal .color-pick { height: 28px; min-width: 96px; padding: 0 7px 0 6px; }
.color-pick:hover { border-color: var(--field-hover); }
.cp-sw { width: 44px; height: 16px; flex: none; border: 1px solid rgba(60, 40, 30, 0.2); border-radius: 3px; }
.cp-sw.none { background: #fff linear-gradient(to top left, transparent calc(50% - 1px), #c0392b 50%, transparent calc(50% + 1px)); }
.cp-label { flex: 1 1 auto; text-align: left; color: var(--muted); }
.color-pick > svg { width: 10px; height: 10px; flex: none; color: var(--muted); }

/* Specific dialogs */
.setup { display: flex; gap: 18px; }
.setup > div:first-child { flex: 1 1 auto; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.setup-preview {
  width: 176px; flex: none; display: grid; place-items: center; background: var(--desk); border: 1px solid var(--line); border-radius: var(--r-md);
  background-image: radial-gradient(circle at center, var(--desk-dot) 0.9px, transparent 1.3px); background-size: 12px 12px;
}
.setup-preview > span { display: block; max-width: 150px; max-height: 150px; background: #fff; box-shadow: 0 1px 2px rgba(70, 46, 34, 0.12), 0 6px 16px rgba(70, 46, 34, 0.14); }

.tabs-dlg { display: flex; gap: 16px; }
.tabs-dlg > div { flex: 1 1 0; display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.tabs-dlg .measure { flex-direction: column; align-items: stretch; gap: 4px; }
.tabs-dlg .measure .spin { width: 100%; }
.tabs-dlg .measure .spin input { flex: 1; }

.link-dlg, .blocks-dlg { display: flex; gap: 14px; min-height: 230px; }
.link-kinds {
  flex: none; width: 156px; display: flex; flex-direction: column; gap: 2px; padding: 4px; background: var(--chrome); border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.link-kinds button {
  height: auto !important; min-height: 44px; min-width: 0 !important; padding: 7px 10px !important; text-align: left; white-space: normal;
  border: 0 !important; border-radius: var(--r-sm) !important; background: transparent !important; line-height: 1.3; font-weight: 500;
}
.link-kinds button:hover { background: var(--hover-chrome) !important; }
.link-kinds button.cur { background: var(--accent-tint) !important; color: var(--accent-dark); }
.link-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.blocks-dlg .link-kinds button { min-height: 32px; }
.block-grid.big {
  flex: 1 1 auto; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); align-content: start; max-height: 440px; overflow: auto;
  background: var(--field); border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px;
}
.block-grid.big .gtile { height: auto; min-width: 0; padding: 5px; border-color: transparent; background: transparent; }
.block-grid.big .gtile:hover { border-color: var(--accent-line); background: var(--accent-tint); }
.block-tile.mine { position: relative; }
.block-tile.mine > button:first-child {
  display: flex; flex-direction: column; align-items: center; gap: 5px; height: auto; min-width: 0; padding: 0; border: 0; background: transparent;
}
.block-tile.mine > .x {
  position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; min-width: 0; padding: 0; line-height: 1; font-size: 14px; border-radius: 11px;
}

.spell { display: flex; gap: 16px; }
.spell-main { flex: 1 1 auto; display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.spell-context {
  min-height: 52px; padding: 8px 10px; background: var(--field); border: 1px solid var(--field-border); border-radius: var(--r-sm); line-height: 1.45;
  white-space: normal;
}
.spell-context mark { background: none; color: #c0392b; font-weight: 700; text-decoration: underline wavy #c0392b; }
.spell-buttons { flex: none; width: 136px; display: flex; flex-direction: column; gap: 6px; padding-top: 20px; }
.spell-buttons button { width: 100%; }

.symbol-grid {
  display: grid; grid-template-columns: repeat(16, minmax(0, 1fr)); max-height: 232px; overflow: auto; background: #fff; border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.modal .symbol-grid button {
  height: 30px; min-width: 0; padding: 0; border: 0; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); border-radius: 0;
  background: #fff; font-size: 17px; font-weight: 400;
}
.modal .symbol-grid button:hover { background: var(--accent-tint); border-color: var(--line-soft); }
.modal .symbol-grid button.cur { background: var(--accent); color: #fff; }
.symbol-grid.recent { max-height: none; min-height: 32px; }

.bullet-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
.bullet-grid button { height: 38px !important; min-width: 0 !important; padding: 0 !important; font-size: 20px; background: #fff !important; font-weight: 400; }
.bullet-grid button.cur { border-color: var(--accent) !important; background: var(--accent-tint) !important; box-shadow: inset 0 0 0 1px var(--accent); }

.wrap-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.wrap-choice { display: flex; align-items: center; gap: 7px; padding: 7px 11px; background: var(--field); border: 1px solid var(--line); border-radius: var(--r); }
.wrap-choice.cur { border-color: var(--accent-line); background: var(--accent-tint); }

.scheme-edit { display: grid; grid-template-columns: 44px 60px 1fr; gap: 7px 12px; align-items: center; }
.scheme-edit > .mhead { padding: 0; margin: 0; background: none; font-weight: 600; }
.scheme-edit input[type=color] { width: 52px; height: 26px; padding: 2px; border: 1px solid var(--field-border); border-radius: var(--r-sm); background: var(--field); }
.modal > .modal-body > .scheme-strip { width: 100%; height: 22px; }

.biz-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 16px; }
.biz-grid label.field, .biz-grid div.field { flex-direction: column; align-items: stretch; gap: 4px; }
.biz-grid label.field > input { flex: 0 0 auto; }
.biz-head { margin: 14px 0 6px; font-size: 12px; font-weight: 650; }
.brand-colors { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.brand-color { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); text-align: center; }
.brand-color input[type=color] { width: 40px; height: 40px; padding: 2px; border: 1px solid var(--field-border); border-radius: var(--r); background: var(--field); cursor: pointer; }
.brand-color input[type=color].unset { opacity: 0.45; }
.brand-color button.link { padding: 0; border: 0; background: none; color: var(--accent-text); font-size: 11px; cursor: pointer; }
.logo-box { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 6px; background: var(--field); border: 1px solid var(--line); border-radius: var(--r); }
.logo-box img { max-width: 90px; max-height: 44px; object-fit: contain; }
.logo-box button { min-width: 0 !important; }

.search-row { display: flex; gap: 8px; }
.search-row input { flex: 1 1 auto; height: 30px !important; }
.search-row button { height: 30px !important; }
.online-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 6px; min-height: 200px; max-height: 400px; overflow: auto;
  align-content: start;
}
.online-tile { height: 100px; padding: 2px; border: 2px solid transparent; border-radius: var(--r); background: var(--well); }
.online-tile:hover { border-color: var(--accent-line); }
.online-tile.cur { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.online-tile img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 5px; }
.loading { color: var(--muted); }

.rec-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rec-toolbar .filter { width: 150px; }
.rec-toolbar button { min-width: 0 !important; }
.rec-columns { display: flex; flex-wrap: wrap; gap: 6px; }
.rec-col { display: inline-flex; align-items: center; }
.rec-col input { width: 120px; border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; }
.rec-col button { min-width: 0 !important; height: 28px !important; padding: 0 9px !important; margin-left: -1px; border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important; }
.rec-grid-wrap { max-height: 360px; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--r); }
.rec-grid { border-collapse: collapse; width: 100%; }
.rec-grid th {
  position: sticky; top: 0; z-index: 1; padding: 5px 7px; background: var(--chrome); text-align: left; font-weight: 600; white-space: nowrap;
  border-bottom: 1px solid var(--line); border-right: 1px solid var(--line-soft); cursor: default; font-size: 11.5px;
}
.rec-grid th:hover { background: var(--hover-chrome); }
.rec-grid td { padding: 0; border-bottom: 1px solid var(--line-soft); border-right: 1px solid var(--line-soft); }
.rec-grid td:first-child, .rec-grid th:first-child { width: 30px; text-align: center; }
.rec-grid td input:not([type=checkbox]) {
  width: 100%; min-width: 80px; height: 26px; border: 0 !important; border-radius: 0 !important; background: transparent; box-shadow: none !important;
}
.rec-grid td input:not([type=checkbox]):focus { background: #fff8e8; }
.rec-grid tr.cur td { background: var(--accent-tint); }

.notes { margin: 0; padding-left: 20px; line-height: 1.55; }
.pn-restart { display: flex; align-items: center; gap: 12px; }
.fix-replace { display: flex; flex-direction: column; gap: 10px; }
.fix-pair { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 12px; }
.fix-pair label.field { flex-direction: column; align-items: stretch; gap: 5px; }
.fix-pair label.field > span:first-child { min-width: 0; }
.fix-list { height: 236px; }
.fix-list td { padding: 4px 9px; cursor: default; }
.fix-list :is(td, th):first-child { width: 40%; text-align: left; }
.fix-list tbody tr:hover td { background: var(--hover); }
.fix-list tr.cur td { background: var(--accent-tint); }
.bg-preview { max-width: 220px; max-height: 120px; object-fit: contain; border: 1px solid var(--line); border-radius: 4px; background: #fff; align-self: flex-start; }
.calendar-preview { display: grid; place-items: center; padding: 14px; background: var(--desk); border: 1px solid var(--line); border-radius: var(--r-md); }
.calendar-preview .thumb { box-shadow: 0 1px 2px rgba(70, 46, 34, 0.12), 0 6px 16px rgba(70, 46, 34, 0.14); }
.dropcap-preview {
  height: 96px; overflow: hidden; padding: 8px 10px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); line-height: 1.35;
}
.dropcap-preview b { float: left; margin: 2px 4px 0 0; line-height: 0.82; color: var(--accent-dark); font-family: Georgia, serif; }
.tf-preview { display: grid; grid-template-columns: repeat(3, 20px); grid-template-rows: repeat(4, 10px) auto; width: 64px; }
.tf-preview > span:not(.tf-name) { display: block; }
.tf-name { grid-column: 1 / -1; margin-top: 3px; font-size: 10px; line-height: 1.2; text-align: center; white-space: normal; color: var(--muted); }

/* ------------------------------------------------------------------------- */
/* File: a home screen on warm paper, light nav on the left, content in cards */

/* under the top bar, which stays in place with File lit */
.backstage { position: fixed; top: 44px; left: 0; right: 0; bottom: 0; z-index: 400; display: flex; background: var(--chrome); }
.bs-nav {
  flex: none; width: 232px; display: flex; flex-direction: column; gap: 2px; padding: 14px 12px; background: var(--chrome);
  border-right: 1px solid var(--line); color: var(--text); user-select: none;
}
.bs-back {
  width: 100%; height: 34px; margin: 0 0 10px 0; display: flex; align-items: center; gap: 9px; padding: 0 10px; border: 1px solid var(--line);
  border-radius: var(--r); background: var(--card); color: var(--muted); font-size: 12.5px;
}
.bs-back svg { width: 15px; height: 15px; }
.bs-back:hover { background: var(--hover); border-color: var(--line-strong); color: var(--text); }
.bs-item {
  height: 36px; display: flex; align-items: center; gap: 11px; padding: 0 12px; border: 0; border-radius: 9px; text-align: left; font-size: 13px;
  font-weight: 500; color: #4d4247;
}
.bs-item svg { flex: none; width: 16px; height: 16px; color: #7d7176; }
.bs-item:hover { background: var(--hover-chrome); color: var(--text); }
.bs-item.cur, .bs-item.cur:hover { background: var(--accent); color: #fff; box-shadow: 0 6px 14px -8px color-mix(in srgb, var(--sel) 80%, transparent); }
.bs-item.cur svg { color: #fff; }
.bs-nav > .spacer { flex: 1 1 auto; }
.bs-main { flex: 1 1 auto; min-width: 0; overflow: auto; background: var(--chrome); }
.bs-page { padding: 26px 40px 40px; max-width: 1280px; }
.bs-page h1 { margin: 0 0 18px; font-size: 22px; font-weight: 600; color: var(--text); letter-spacing: -0.015em; }
.bs-page h2 { margin: 0; font-size: 18px; font-weight: 600; color: var(--text); }
.bs-page h3 { margin: 18px 0 10px; font-size: 13px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 7px; }
.bs-page h3 svg { width: 18px; height: 18px; color: var(--accent-text); }
.bs-page p { line-height: 1.5; }
.bs-sub { margin: -16px 0 22px; font-size: 12.5px; color: var(--muted); }
.bs-sub .path { color: var(--faint); font-family: var(--font-mono); font-size: 11px; }
.bs-page select { height: 30px; }
.bs-page input:not([type=checkbox]):not([type=radio]) { height: 30px; }

/* big tile buttons */
.bs-tile {
  flex: none; width: 112px !important; height: 100px !important; min-width: 0 !important; padding: 10px !important; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 9px; white-space: normal; text-align: center; line-height: 1.3; background: var(--card);
  border-radius: var(--r-md) !important;
}
.bs-tile svg { width: 26px; height: 26px; color: var(--accent-text); }
.bs-wide {
  display: flex; align-items: center; gap: 14px; width: 100%; height: 56px !important; padding: 0 16px !important; text-align: left;
  font-size: 13.5px; background: var(--card); border-radius: var(--r-md) !important;
}
.bs-wide svg { width: 24px; height: 24px; flex: none; }
.bs-wide:not(.primary) svg { color: var(--accent-text); }

.info-cols { display: flex; gap: 24px; align-items: flex-start; }
.info-actions { flex: 1 1 auto; min-width: 0; max-width: 700px; display: flex; flex-direction: column; gap: 10px; }
.info-card {
  display: flex; gap: 20px; align-items: center; padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}
.info-card .bs-tile { background: var(--chrome); border-color: var(--line); }
.info-card .bs-tile:hover:not(:disabled) { background: var(--accent-tint); border-color: var(--accent-line); }
.info-card h3 { margin: 0 0 4px; }
.info-card p { margin: 0; color: var(--muted); max-width: 460px; }
.info-props {
  flex: none; width: 330px; display: flex; flex-direction: column; gap: 9px; padding: 18px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-card);
}
.info-props h3 { margin-top: 0; }
.info-props dl { display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; margin: 0 0 10px; padding-bottom: 12px; border-bottom: 1px solid var(--line-soft); }
.info-props dt { color: var(--muted); }
.info-props dd { margin: 0; }
.info-props label.field > span:first-child { min-width: 80px; color: var(--muted); }
.info-props label.field:has(> textarea) { flex-direction: row; align-items: flex-start; }

.new-cols { display: flex; gap: 20px; align-items: flex-start; }
.new-gallery { flex: 1 1 auto; min-width: 0; }
.new-gallery > h3:first-child { margin-top: 0; }
.new-gallery h3 { margin: 18px 0 10px; font-size: 10.5px; letter-spacing: 0.09em; }
.new-gallery h3 svg { width: 13px; height: 13px; color: var(--muted); }
/* a heading with the colour and font schemes at its right */
.new-search { display: flex; align-items: center; gap: 8px; max-width: 460px; height: 34px; padding: 0 12px; border: 1px solid var(--field-border); border-radius: 8px; background: var(--field); color: var(--muted); }
.new-search:focus-within { border-color: var(--accent); }
.new-search input[type=search], .new-search input[type=search]:focus { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; box-shadow: none; background: transparent; font: inherit; font-size: 13px; color: var(--text); }
.new-head { display: flex; align-items: center; gap: 16px; min-height: 28px; margin: 18px 0 10px; }
.new-head > h3, .new-head > .crumbs { margin: 0; }
.new-customize { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px 14px; font-size: 12px; }
.nc-field { display: inline-flex; align-items: center; gap: 6px; color: var(--faint); white-space: nowrap; }
.nc-field .scheme-strip { width: 42px; height: 12px; border-radius: 3px; }
.bs-page .nc-field select {
  max-width: 190px; height: 26px; padding: 0 22px 0 6px; text-overflow: ellipsis; border-color: transparent; background-color: transparent; background-position: right 6px center;
  color: var(--muted); font-weight: 500;
}
.bs-page .nc-field select:hover { border-color: var(--line-strong); background-color: var(--card); }
.bs-page .nc-field button { height: 26px; min-width: 0; padding: 0 10px; font-size: 12px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 12px; }
.tile {
  width: auto; height: auto !important; min-width: 0 !important; padding: 8px !important; display: flex; flex-direction: column; align-items: center;
  gap: 7px; white-space: normal; text-align: center; line-height: 1.3; border: 1px solid transparent !important; background: transparent !important;
  border-radius: var(--r-md) !important; font-weight: 500;
}
.tile:hover { background: var(--hover) !important; border-color: var(--line) !important; }
.tile.cur { background: var(--accent-tint) !important; border-color: var(--accent-line) !important; }
.tile small { color: var(--muted); font-size: 11px; font-weight: 400; font-family: var(--font-mono); }
.tile-art { width: 138px; height: 138px; display: grid; place-items: center; }
.tile-art .thumb { box-shadow: 0 0 0 1px rgba(70, 46, 34, 0.1), 0 4px 14px rgba(70, 46, 34, 0.12); }
.tile.more .tile-art svg { width: 40px; height: 40px; color: var(--faint); }
.blank-page { display: block; background: #fff; border: 1px solid var(--line); box-shadow: 0 4px 14px rgba(70, 46, 34, 0.1); }

/* File > New: every tile is a card; blank sizes sit on a dotted desk with their size in mono */
.new-gallery .tile {
  padding: 10px !important; background: var(--card) !important; border: 1px solid var(--line) !important; border-radius: var(--r-lg) !important;
  gap: 3px; align-items: stretch; text-align: left;
}
.new-gallery .tile:hover { border-color: var(--accent-line) !important; box-shadow: 0 0 0 3px var(--accent-tint); }
.new-gallery .tile.cur { border-color: var(--accent-line) !important; box-shadow: 0 0 0 3px var(--accent-tint); background: var(--card) !important; }
.new-gallery .tile > span:not(.tile-art) { font-size: 12.5px; font-weight: 500; }
.new-gallery .tile small { font-size: 10.5px; }
.new-gallery .tile-art { width: auto; height: 136px; margin-bottom: 6px; border-radius: var(--r); background: #f1ebe4; }
.new-gallery .tile-art .thumb { box-shadow: 0 6px 14px -6px rgba(60, 35, 25, 0.35); border-radius: 1px; }
.tiles.blanks { display: flex; flex-wrap: wrap; gap: 12px; }
.tiles.blanks .tile { width: 128px; }
.tiles.blanks .tile-art {
  height: 86px; background: var(--chrome) radial-gradient(circle at 1px 1px, var(--desk-dot) 1px, transparent 1.2px) 0 0 / 10px 10px;
}
.tiles.blanks .blank-page { zoom: 0.68; border: 0; box-shadow: 0 0 0 1px var(--line-strong), 0 4px 10px -4px rgba(60, 35, 25, 0.3); border-radius: 1px; }
.tiles.blanks .tile.more .tile-art { background: none; border: 1.5px dashed var(--line-strong); }
.tiles.blanks .tile.more .tile-art svg { width: 22px; height: 22px; color: var(--muted); }
.tiles.templates { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); }
.tiles.templates .tile { display: grid !important; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 0 6px; padding-bottom: 9px !important; }
.tiles.templates .tile-art { grid-column: 1 / -1; margin-bottom: 8px; }
.tiles.templates .count { color: var(--faint); }
/* template previews are drawn 120-140px; the cards are narrower */
.new-gallery .tiles:not(.blanks) .tile-art > .thumb { zoom: 0.8; }
/* recent publications: a card of rows */
.recent-card { margin-bottom: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.bs-page button.recent-row {
  display: flex; align-items: center; gap: 12px; width: 100%; height: 40px; min-width: 0; padding: 0 14px; border: 0; border-top: 1px solid var(--line-soft);
  border-radius: 0; background: transparent; color: #6d6166; font-weight: 400; text-align: left;
}
.bs-page button.recent-row:first-child { border-top: 0; }
.bs-page button.recent-row:hover:not(:disabled) { background: var(--hover); }
.recent-row svg { flex: none; width: 16px; height: 16px; }
.recent-row .r-name { flex: none; width: 220px; overflow: hidden; text-overflow: ellipsis; font-weight: 500; color: var(--text); }
.recent-row .r-path { flex: 1 1 auto; min-width: 0; color: var(--faint); }
.recent-row .r-time { flex: none; font-family: var(--font-ui); font-size: 12px; }
.crumbs { margin-bottom: 16px; font-size: 13px; color: var(--muted); }
.crumbs button {
  height: auto !important; min-width: 0 !important; padding: 0 !important; border: 0 !important; background: none !important;
  color: var(--accent-dark); font-size: 13px; font-weight: 500;
}
.crumbs button:hover { text-decoration: underline; }
.custom-size { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.custom-size label { display: flex; align-items: center; gap: 7px; }
.custom-size input { width: 90px; }
.new-side {
  flex: none; width: 290px; display: flex; flex-direction: column; gap: 12px; padding: 14px; margin-top: 46px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-card);
}
.new-side h3 { margin: 2px 0 0; }
.new-side label.field, .new-side div.field { flex-direction: column; align-items: stretch; gap: 5px; }
.new-side div.field button { align-self: flex-start; }
.new-side .scheme-strip { width: 100%; height: 20px; }
.new-preview {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 10px; border-radius: var(--r-md); background: var(--desk);
  background-image: radial-gradient(circle at 1px 1px, var(--desk-dot) 1px, transparent 1.2px); background-size: 12px 12px;
}
.new-preview .thumb { box-shadow: 0 1px 2px rgba(70, 46, 34, 0.12), 0 6px 16px rgba(70, 46, 34, 0.16); }
.primary.big { height: 38px !important; font-size: 13.5px; }

.open-cols { display: flex; gap: 20px; align-items: flex-start; }
.open-places {
  flex: none; width: 290px; display: flex; flex-direction: column; gap: 12px; padding: 16px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-card);
}
.open-places .bs-wide { background: var(--chrome); }
.open-list {
  flex: 1 1 auto; min-width: 0; max-width: 800px; display: flex; flex-direction: column; padding: 16px 18px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-card);
}
.open-list > h3:first-child { margin-top: 0; }
button.recent {
  display: grid !important; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'name time' 'path time'; align-items: center;
  width: 100%; height: auto !important; min-width: 0 !important; padding: 9px 10px !important; gap: 2px 16px; text-align: left; border: 0 !important;
  border-radius: var(--r) !important; background: transparent !important; font-weight: 400;
}
button.recent:hover { background: var(--hover) !important; }
.r-name { grid-area: name; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.r-path { grid-area: path; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; font-family: var(--font-mono); }
.r-time { grid-area: time; font-size: 11px; color: var(--muted); font-family: var(--font-mono); }
button.link {
  align-self: flex-start; height: auto !important; min-width: 0 !important; margin-top: 6px; padding: 2px 0 !important; border: 0 !important;
  background: none !important; color: var(--accent-dark); font-weight: 500;
}
button.link:hover { text-decoration: underline; }

.print-cols { display: flex; gap: 20px; align-items: flex-start; }
.print-settings {
  flex: none; width: 320px; display: flex; flex-direction: column; gap: 9px; padding: 18px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-card);
}
.print-settings > h3 { margin: 10px 0 0; }
:is(.print-settings, .new-gallery, .new-side, .open-list, .info-props) h3 {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted);
}
.new-preview h3 { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--text); }
.print-settings > select { width: 100%; }
.print-settings > .print-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.print-settings > .print-note { margin: 0; font-size: 12px; line-height: 1.45; color: var(--muted); }
.print-go { display: flex; align-items: center; gap: 16px; padding-bottom: 8px; }
.print-go .bs-wide { width: 96px; height: 88px !important; flex: none; flex-direction: column; justify-content: center; gap: 7px; padding: 0 !important; }
.print-go .bs-wide svg { width: 26px; height: 26px; }
.print-go label.field { flex-direction: column; align-items: flex-start; gap: 5px; }
.print-go label.field input { width: 80px; }
.print-preview {
  flex: 1 1 auto; min-width: 0; min-height: 600px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  padding: 28px; background-color: var(--desk); border: 1px solid var(--line); border-radius: var(--r-lg);
  background-image: radial-gradient(circle at 1px 1px, var(--desk-dot) 1px, transparent 1.2px); background-size: 16px 16px;
}
.sheet { position: relative; flex: none; background: #fff; box-shadow: 0 0 0 0.5px rgba(70, 46, 34, 0.14), 0 2px 4px rgba(70, 46, 34, 0.06), 0 12px 32px rgba(70, 46, 34, 0.14); }
.sheet-page { position: absolute; }
.pager {
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 4px; color: var(--text); font-family: var(--font-mono); font-size: 11px;
  background: rgba(255, 253, 250, 0.92); border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow-pill);
}
.pager button { width: 28px; height: 26px !important; min-width: 0 !important; padding: 0 !important; font-size: 14px; border: 0 !important; border-radius: 7px !important; background: transparent !important; }
.pager button:hover:not(:disabled) { background: var(--hover) !important; }

.export-cols { display: flex; gap: 20px; align-items: flex-start; }
.export-list {
  flex: none; width: 320px; display: flex; flex-direction: column; gap: 2px; padding: 8px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-card);
}
.export-choice {
  display: flex !important; align-items: center; gap: 12px; width: 100%; height: auto !important; min-height: 54px; min-width: 0 !important;
  padding: 8px 12px !important; text-align: left; white-space: normal; font-size: 13px; border: 0 !important; border-radius: var(--r) !important;
  background: transparent !important;
}
.export-choice svg { width: 24px; height: 24px; flex: none; color: var(--accent-text); }
.export-choice:hover { background: var(--hover) !important; }
.export-choice.cur { background: var(--accent-tint) !important; color: var(--accent-dark); }
.export-detail {
  flex: 1 1 auto; min-width: 0; max-width: 600px; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 20px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-card);
}
.export-detail > p { margin: 0; color: var(--muted); }
.export-detail .bs-wide { width: auto; min-width: 200px; margin-top: 8px; }
.export-detail .export-list {
  width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 4px; box-shadow: none; background: var(--chrome);
  border-radius: var(--r-md);
}
.export-detail .export-list .export-choice { min-height: 34px; padding: 6px 10px !important; }
.export-detail .export-list .hint { grid-column: 1 / -1; margin: 6px 6px 2px; }

/* File > Help (helppage.tsx) uses the Export page's layout */
.bs-page.help .export-detail .hint { margin: 0; }
.bs-page.help .help-message { width: 100%; min-height: 150px; }
.help-attach { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); line-height: 1.45; cursor: pointer; }
.help-attach input { margin-top: 3px; flex: none; }
.help-attach b { display: block; color: var(--text); font-weight: 600; }
.help-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.help-actions .bs-wide { margin-top: 0; }
.help-actions .bs-wide:not(.primary) { min-width: 120px; }
.bs-page.help .export-detail h3 { margin: 10px 0 0; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.help-links { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.export-detail.shortcuts { gap: 6px; overflow: auto; }
.export-detail.shortcuts section { display: flex; flex-direction: column; gap: 4px; }
.shortcut-table { border-collapse: collapse; width: 100%; max-width: 640px; table-layout: fixed; }
.shortcut-table th, .shortcut-table td { padding: 4px 8px 4px 0; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line-soft); }
.shortcut-table th { width: 250px; font-weight: 400; color: var(--muted); }
.shortcut-table td { color: var(--text); }
.shortcut-table kbd {
  display: inline-block; padding: 0 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px;
  background: var(--card); color: var(--text); font: 500 11px/18px var(--font-mono); white-space: nowrap;
}
.help-links .link { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: var(--accent-text); cursor: pointer; }
.help-links .link:hover { text-decoration: underline; text-underline-offset: 3px; }
.help-links .link svg { width: 16px; height: 16px; }

/* File > Email (emailpage.tsx) uses the Export page's layout */
.bs-page.email .export-detail .hint { margin: 0; }
html[data-locked~='export-xps'] [data-cmd='email:xps'] > span::after {
  content: ''; display: inline-block; width: 9px; height: 9px; margin-left: 5px; vertical-align: -0.5px; background: currentColor; opacity: 0.5;
  -webkit-mask: var(--lock-mask) center / contain no-repeat; mask: var(--lock-mask) center / contain no-repeat;
}

/* Merge to Email and Embed a File dialogs */
.email-subject { flex: 1 1 auto; display: flex; gap: 6px; min-width: 0; }
.email-subject > input { flex: 1 1 auto; min-width: 0; }
.email-subject > select { flex: none; width: 128px; }
.radios.column { flex-direction: column; gap: 6px; }
.modal div.field:has(> [data-cmd='embed:name']) > input { min-width: 0; }

/* Mail Merge > Mail Merge Guide (guide.tsx) */
.guide-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.guide-steps button {
  width: 100%; display: flex !important; align-items: center; gap: 10px; height: 32px !important; padding: 0 8px !important; text-align: left;
  border: 0 !important; border-radius: var(--r) !important; background: transparent !important; color: var(--muted);
}
.guide-steps button:hover:not(:disabled) { background: var(--hover) !important; color: var(--text); }
.guide-steps b {
  flex: none; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: var(--well); color: var(--muted);
  font-size: 11px; font-weight: 650;
}
.guide-steps li.cur button { background: var(--accent-tint) !important; color: var(--accent-dark); font-weight: 600; }
.guide-steps li.cur b { background: var(--accent); color: #fff; }
.guide-steps li.done b { background: var(--accent-soft); color: var(--accent-dark); }
.guide-step { display: flex; flex-direction: column; gap: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.guide-step .hint { margin: 0; line-height: 1.45; }
.guide-note { margin: 0; padding: 8px 10px; border-radius: var(--r); background: var(--well); font-size: 12px; line-height: 1.4; }
.guide-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.guide-actions.column { flex-direction: column; align-items: stretch; }
.guide-actions button { min-width: 0; height: 28px; padding: 0 12px; }
.guide-fields {
  list-style: none; margin: 0; padding: 4px; display: flex; flex-direction: column; max-height: 220px; overflow-y: auto;
  background: var(--field); border: 1px solid var(--line); border-radius: var(--r);
}
.guide-fields button {
  width: 100%; height: 26px !important; padding: 0 8px !important; text-align: left; border: 0 !important; background: transparent !important;
  border-radius: var(--r-sm) !important; font-family: var(--font-mono); font-size: 11.5px;
}
.guide-fields button:hover { background: var(--hover) !important; }
.guide-record { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; }
.guide-record button { width: 30px; min-width: 0 !important; height: 26px; padding: 0 !important; font-size: 15px; }
.guide-nav { display: flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.guide-nav button { min-width: 0; height: 30px; padding: 0 12px; }

.bs-page.options section {
  max-width: 700px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px 20px 18px; margin-bottom: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-card);
}
.bs-page.options section h3 { margin: 0 0 2px; }
.bs-page.options input[type=number] { width: 80px; }
.accent-swatches { display: flex; gap: 8px; }
.bs-page.options .accent-swatches button, .bs-page.options .accent-swatches button:hover, .bs-page.options .accent-swatches button.on {
  flex: none; width: 24px; min-width: 0; height: 24px; padding: 0; border: 0; border-radius: 50%; background: var(--swatch); cursor: pointer;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08) inset;
}
.bs-page.options .accent-swatches button:hover { transform: scale(1.08); }
.bs-page.options .accent-swatches button.on { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--swatch); }
/* Insert > QR Code */
.qr-dialog { display: flex; gap: 18px; align-items: flex-start; }
.qr-fields { flex: 1; min-width: 0; }
.qr-dialog .qr-fields input[type=color] { flex: none; width: 48px; height: 28px; padding: 2px; }
.qr-preview { flex: none; width: 168px; height: 168px; display: grid; place-items: center; background: #fff; border: 1px solid var(--line); border-radius: var(--r); }
.qr-preview img { width: 152px; height: 152px; image-rendering: pixelated; }
.qr-preview .hint { padding: 0 16px; text-align: center; }
.bs-page.options .pro-tag {
  margin-left: 6px; padding: 1px 6px; border-radius: 8px; background: var(--ink); color: var(--ink-text); font-size: 9.5px; font-weight: 650;
  letter-spacing: 0.06em; text-transform: uppercase; vertical-align: 1px;
}
.bs-page.about p.big { font-size: 18px; margin: 0 0 8px; }
.bs-page.about p { max-width: 640px; color: #4a3f42; }
.credits { margin: 0; padding-left: 20px; line-height: 1.7; }
.credits span { color: var(--muted); }

/* ------------------------------------------------------------------------- */
/* Narrow windows: the ribbon first drops the labels of small buttons in the busiest groups,
   then turns the Arrange group's Rotate into a small button. Nothing overlaps; below ~1000px the ribbon scrolls. */

/* three-word labels that would otherwise need a third line */
.rbody .rbig:is([data-cmd='Edit Recipient List'], [data-cmd='Select Recipients'], [data-cmd='Add Master Page'], [data-cmd='Close Master Page'], [data-cmd='Borders & Accents'], [data-cmd='Cell Margins']) .rbig-label {
  max-width: 84px !important;
}

/* Adaptive ribbon. Ribbon.tsx sets data-fit on .rbody to the lowest level (0-4)
   at which the current tab fits the window; each level squeezes a little more.
   Level 0 is the full layout. */

/* 1: tighter spacing */
.rbody:is([data-fit='1'], [data-fit='2'], [data-fit='3'], [data-fit='4']) { gap: 4px; padding-left: 6px; padding-right: 6px; }
.rbody:is([data-fit='1'], [data-fit='2'], [data-fit='3'], [data-fit='4']) .rgroup { padding-left: 3px; padding-right: 3px; }
.rbody:is([data-fit='1'], [data-fit='2'], [data-fit='3'], [data-fit='4']) .rgroup-body { gap: 1px; }
.rbody:is([data-fit='1'], [data-fit='2'], [data-fit='3'], [data-fit='4']) .rbig { min-width: 38px; padding-left: 2px; padding-right: 2px; }
.rbody:is([data-fit='1'], [data-fit='2'], [data-fit='3'], [data-fit='4']) .rbig-label { max-width: 62px; }
.rbody:is([data-fit='1'], [data-fit='2'], [data-fit='3'], [data-fit='4']) .rsmall:not(.labelled) { padding: 0 2px; gap: 2px; }
.rbody:is([data-fit='1'], [data-fit='2'], [data-fit='3'], [data-fit='4']) .rrow .rsmall:not(.labelled) { min-width: 25px; }
.rbody:is([data-fit='1'], [data-fit='2'], [data-fit='3'], [data-fit='4']) .rsmall.labelled { gap: 4px; padding-right: 4px; }
.rbody:is([data-fit='1'], [data-fit='2'], [data-fit='3'], [data-fit='4']) .rgroup[data-group='Font'] .combo:has([data-cmd='font-name']) { width: 118px !important; }
.rbody:is([data-fit='1'], [data-fit='2'], [data-fit='3'], [data-fit='4']) .rgroup[data-group='Font'] .combo:has([data-cmd='font-size']) { width: 48px !important; }

/* 2: small buttons stacked three high lose their labels (Clipboard, Arrange, Editing...) */
.rbody:is([data-fit='2'], [data-fit='3'], [data-fit='4']) .rstack:not(.rows-2) .rsmall.labelled > span:not(.ico-wrap) { display: none; }
.rbody:is([data-fit='2'], [data-fit='3'], [data-fit='4']) .rstack:not(.rows-2) .rsmall.labelled { padding-right: 3px; }
.rbody:is([data-fit='2'], [data-fit='3'], [data-fit='4']) { gap: 3px; }

/* 3: every small button is icon-only; Rotate shrinks to a small button */
.rbody:is([data-fit='3'], [data-fit='4']) { gap: 3px; }
.rbody:is([data-fit='3'], [data-fit='4']) .rsmall.labelled > span:not(.ico-wrap) { display: none; }
.rbody:is([data-fit='3'], [data-fit='4']) .rsmall.labelled { padding-right: 3px; gap: 2px; }
.rbody:is([data-fit='3'], [data-fit='4']) .rbig-label { max-width: 56px; }
.rbody:is([data-fit='3'], [data-fit='4']) .rdrop .arrow { width: 13px; }
.rbody:is([data-fit='3'], [data-fit='4']) .rgroup-label { font-size: 9px; letter-spacing: 0.05em; }
.rbody:is([data-fit='3'], [data-fit='4']) .rgroup[data-group='Font'] .combo:has([data-cmd='font-name']) { width: 106px !important; }
.rbody:is([data-fit='3'], [data-fit='4']) .rgroup[data-group='Font'] .combo:has([data-cmd='font-size']) { width: 46px !important; }
.rbody:is([data-fit='3'], [data-fit='4']) .rgroup[data-group='Arrange'] .rdrop.big > .rbig { height: 24px; flex-direction: row; gap: 1px; min-width: 0; padding: 0 3px; }
.rbody:is([data-fit='3'], [data-fit='4']) .rgroup[data-group='Arrange'] .rdrop.big > .rbig .ico-wrap > svg { width: 16px; height: 16px; }
.rbody:is([data-fit='3'], [data-fit='4']) .rgroup[data-group='Arrange'] .rdrop.big > .rbig > .ico-wrap { margin: 0; }
.rbody:is([data-fit='3'], [data-fit='4']) .rgroup[data-group='Arrange'] .rdrop.big .rbig-label { font-size: 0; min-width: 0; color: var(--muted); }
.rbody:is([data-fit='3'], [data-fit='4']) .rgroup[data-group='Arrange'] .rdrop.big .rbig-label svg { width: 10px; height: 10px; }

/* 4: last squeeze before the ribbon scrolls */
.rbody[data-fit='4'] { gap: 3px; padding-left: 6px; padding-right: 6px; }
.rbody[data-fit='4'] .rgroup { padding-left: 3px; padding-right: 3px; }
.rbody[data-fit='4'] .rbig { padding-left: 2px; padding-right: 2px; min-width: 36px; }
.rbody[data-fit='4'] .rbig-label { max-width: 50px; font-size: 11px; }
.rbody[data-fit='4'] .rgroup-label { font-size: 8.5px; letter-spacing: 0.04em; }
.rbody[data-fit='4'] .rgroup[data-group='Font'] .combo:has([data-cmd='font-name']) { width: 94px !important; }

@media (max-width: 1280px) {
  .tellme { width: 220px; }
}

@media (max-width: 1180px) {
  .tellme { width: 180px; }
  .doc-send .long { display: none; }
  .task-pane { width: 244px; }
  .pages-pane:not(.collapsed) { width: 120px; }
}

/* ------------------------------------------------------------------------- */
/* Licence: the File > Account card, the Free/Pro badge in the top bar, the Upgrade dialog, and lock hints on
   what Pro unlocks (app/editor/LicenceCard.tsx, dialogs/upgrade.tsx). html[data-locked] lists the features this
   copy can't use (pro.ts), so a feature made free loses its lock without touching this file. */

:root {
  --lock-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='18' height='11' x='3' y='11' rx='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E");
}

/* top bar: a quiet outline pill; Pro in the accent's light tint */
.tier-badge {
  flex: none; height: 20px; margin-right: 4px; padding: 0 8px; border: 0; border-radius: 10px; background: transparent; color: var(--ink-muted);
  box-shadow: inset 0 0 0 1px var(--ink-line); font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
}
.tier-badge:hover { background: var(--ink-hover); color: var(--ink-text); }
.tier-badge.pro { color: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--pro-ring); }

/* Update available (top bar): outlined while the new version downloads, berry once it's ready to install */
.tb-update {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 24px; margin-right: 6px; padding: 0 10px 0 8px; border: 0; border-radius: 12px;
  background: transparent; color: var(--ink-text); box-shadow: inset 0 0 0 1px var(--ink-line); font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer;
}
.tb-update svg { width: 15px; height: 15px; flex: none; }
.tb-update:hover { background: var(--ink-hover); }
.tb-update-pct { color: var(--ink-muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.tb-update.ready { background: var(--accent); color: #fff; box-shadow: none; }
.tb-update.ready:hover { background: var(--accent-hover); }
.update-pop { width: 300px; }
.update-pop-text { display: flex; flex-direction: column; gap: 4px; padding: 8px 12px 10px; font-size: 12px; line-height: 1.45; color: var(--muted); }
.update-pop-text b { color: var(--text); font-size: 12.5px; font-weight: 600; }
.update-bar { display: block; height: 4px; margin-top: 6px; border-radius: 2px; background: var(--well); overflow: hidden; }
.update-bar span { display: block; height: 100%; background: var(--accent); }

/* lock hints: a small padlock after the label of each command Pro unlocks */
html[data-locked~='mail-merge'] .rtab[data-tab='mailings']::after,
html[data-locked~='catalog-merge'] [data-cmd='Catalog Pages'] .rbig-label::after,
html[data-locked~='business-info'] :is([data-cmd='Brand Kit'] > span:not(.ico-wrap), [data-cmd='info:business'] > span, [data-cmd='new:business'], [data-cmd='Apply Brand Kit'] .rbig-label)::after,
html[data-locked~='export-web'] :is([data-cmd='export:html'], [data-cmd='export:type:mht'], [data-cmd='export:type:html']) > span::after,
html[data-locked~='export-pictures'] :is([data-cmd='export:images'], [data-cmd='export:photo'], [data-cmd='export:type:gif'], [data-cmd='export:type:jpeg'],
  [data-cmd='export:type:tiff'], [data-cmd='export:type:png'], [data-cmd='export:type:bmp'], [data-cmd='export:type:wmf'], [data-cmd='export:type:emf']) > span::after,
html[data-locked~='export-text'] :is([data-cmd='export:type:rtf'], [data-cmd='export:type:txt'], [data-cmd='export:type:utxt'], [data-cmd='export:type:docx'],
  [data-cmd='export:type:doc'], [data-cmd='export:type:wpd']) > span::after,
html[data-locked~='export-xps'] [data-cmd='export:type:xps'] > span::after,
html[data-locked~='export-postscript'] [data-cmd='export:type:ps'] > span::after,
html[data-locked~='save-template'] [data-cmd='export:type:template'] > span::after,
html[data-locked~='qr-codes'] [data-cmd='QR Code'] .rbig-label::after,
html[data-locked~='pdf-press'] [data-cmd='export:commercial'] > span::after,
html[data-locked~='pack-and-go'] [data-cmd='export:pack'] > span::after {
  content: ''; display: inline-block; width: 9px; height: 9px; margin-left: 5px; vertical-align: -0.5px; background: currentColor; opacity: 0.5;
  -webkit-mask: var(--lock-mask) center / contain no-repeat; mask: var(--lock-mask) center / contain no-repeat;
}

/* template tiles that need Pro */
.tile:has(> .pro-tag) { position: relative; }
.tiles .tile > span.pro-tag[data-pro-template] {
  position: absolute; top: 8px; right: 8px; display: inline-flex; align-items: center; gap: 3px; height: 18px; padding: 0 6px 0 5px; border-radius: 9px;
  background: var(--ink); color: var(--ink-text); font-size: 9.5px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; line-height: 1;
  box-shadow: var(--shadow-card);
}
.tiles .tile > span.pro-tag svg { width: 9px; height: 9px; }

/* File > Account */
.lic-card {
  max-width: 660px; margin: 0 0 26px; padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-card);
}
.lic-card.pro { border-color: var(--accent-soft); }
.lic-head { display: flex; align-items: flex-start; gap: 14px; }
.lic-icon { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--r-md); background: var(--accent-tint); color: var(--accent-text); }
.lic-icon svg { width: 22px; height: 22px; }
.lic-title { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.bs-page .lic-title h2 { font-size: 17px; letter-spacing: -0.01em; }
.lic-pill {
  flex: none; height: 22px; padding: 0 10px; display: inline-flex; align-items: center; border-radius: 11px; background: var(--well); color: var(--muted);
  font-size: 10.5px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase;
}
.lic-pill.pro { background: var(--accent); color: #fff; }
/* Dodo's test mode (apiBase test.*): a small amber chip and a note; never shown for live */
.lic-test { margin: -4px 0 0; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.lic-chip {
  flex: none; height: 20px; padding: 0 8px; display: inline-flex; align-items: center; border-radius: 10px;
  background: color-mix(in srgb, #d9a441 18%, var(--card)); box-shadow: inset 0 0 0 1px color-mix(in srgb, #d9a441 45%, var(--card)); color: #6e4c10;
  font-size: 10px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase;
}
.lic-facts {
  margin: 0; padding: 12px 14px; display: grid; grid-template-columns: max-content 1fr; gap: 7px 20px; background: var(--well); border-radius: var(--r-md);
}
.lic-facts dt { color: var(--muted); }
.lic-facts dd { margin: 0; min-width: 0; color: var(--text); font-weight: 500; overflow-wrap: anywhere; }
.lic-facts dd.mono { font-family: var(--font-mono); letter-spacing: 0.02em; }
.lic-activate { display: flex; align-items: center; gap: 8px; }
.lic-activate label.field { flex: 1 1 auto; }
.lic-activate input { font-family: var(--font-mono); letter-spacing: 0.02em; }
.lic-activate > button { flex: none; min-width: 96px; height: 30px; }
.lic-msg { margin: 0; padding: 9px 12px; border-radius: var(--r); line-height: 1.45; }
.lic-msg.error { background: color-mix(in srgb, #b0302b 9%, var(--card)); color: #8e2622; }
.lic-msg.ok { background: color-mix(in srgb, #3f7d3a 10%, var(--card)); color: #2f6a2b; }
.lic-msg.warn { background: color-mix(in srgb, #d9a441 15%, var(--card)); color: #6e4c10; }
.lic-msg button.link { margin: 0; display: inline; color: inherit; text-decoration: underline; }
.lic-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lic-actions:empty { display: none; }
.lic-actions > button { height: 30px; }
.lic-actions > button.link { margin-top: 0; }
button.lic-buy { display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; background: var(--accent-tint); border-color: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
button.lic-buy:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent-line); }
button.lic-buy svg { width: 16px; height: 16px; }
/* the lifetime pass: the same shape, quieter than the monthly subscription */
button.lic-buy.alt { background: var(--card); border-color: var(--line); color: var(--text); }
button.lic-buy.alt:hover:not(:disabled) { background: var(--accent-tint); border-color: var(--accent-soft); }
.lic-plans { margin: -6px 0 0; font-size: 12px; line-height: 1.45; }

/* the Upgrade dialog */
.lic-upgrade { display: flex; align-items: center; gap: 12px; }
.lic-upgrade p { margin: 0; font-size: 13.5px; line-height: 1.45; }
.lic-list { margin: 0; padding: 10px 14px 10px 30px; display: grid; gap: 4px; background: var(--well); border-radius: var(--r-md); line-height: 1.4; }
.lic-list li::marker { color: var(--accent-text); }
/* its two plans, one above the other: the monthly subscription (the main button), then the lifetime pass */
.lic-choices { display: grid; gap: 8px; }
.lic-choices > button { height: 34px; padding: 0 14px; font-weight: 600; }
