/* VibeOffice — the chrome shared by Quire, Ledger and Lectern: window layout, menus, toolbars, task panes,
 * dialogs, form controls, status bar. Colours, fonts and shadows come from the look settings in looks.css,
 * loaded first; each app's own CSS comes after this file and wins. */
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--dock-b); color: var(--ink); font: var(--ui-size)/1.25 var(--ui-font); overflow: hidden; }
* { box-sizing: border-box; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: var(--ink); }
:focus-visible { outline: 1px dotted var(--ink); outline-offset: 1px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

.app { display: flex; flex-direction: column; height: 100%; min-width: 0; }
/* ---------- title bar ---------- */
/* ---------- command bars ---------- */
.cmdbars { flex: none; background: linear-gradient(90deg, var(--dock-a), var(--dock-b)); border-bottom: 1px solid var(--chrome-line); }
.menurow { display: flex; align-items: center; gap: 8px; padding: 2px 4px 1px; min-height: 24px; overflow-x: auto; scrollbar-width: none; }
.menurow::-webkit-scrollbar { display: none; }
.menubar { display: flex; align-items: center; flex: none; padding-left: 4px; position: relative; }
.menubar::before { content: ""; width: 3px; height: 16px; margin-right: 5px; background: radial-gradient(circle, var(--grip) 1px, transparent 1.2px) 0 0 / 3px 4px; }
.mb-item { padding: 3px 7px 4px; border: 1px solid transparent; cursor: default; white-space: nowrap; user-select: none; }
.mb-item:hover { background: linear-gradient(var(--hot-a), var(--hot-b)); border-color: var(--hot-border); }
.mb-item.open { background: linear-gradient(var(--tb-a), var(--menu-open)); border-color: var(--menu-border); border-bottom-color: transparent; position: relative; z-index: 1001; }
.cmd-search { margin-left: auto; flex: none; position: relative; display: flex; align-items: center; }
.cmd-search .cs-glass { position: absolute; left: 6px; color: var(--hint-ink); pointer-events: none; }
.cmd-search input { width: 190px; height: 19px; border: 1px solid var(--combo-border); padding: 1px 4px 1px 22px; background: var(--surface); color: var(--ink-3); font: inherit; }
.cmd-search input::placeholder { color: var(--hint-ink); }
.cmd-search input::-webkit-search-cancel-button { cursor: pointer; }
.menu.cs-pop { padding: 2px; }
.cs-pop .m-lbl { overflow: hidden; text-overflow: ellipsis; }
.cs-pop .m-lbl b { font-weight: bold; }
.cs-where { margin-left: 10px; color: var(--muted); font-size: 0.92em; }
.cs-pop .m-item.dis .cs-where { color: inherit; }
.cs-none { padding-left: 28px; }
.toolbars { display: flex; flex-direction: column; gap: 0; padding: 0 2px 2px; }
.tb-row { display: flex; flex-wrap: wrap; align-items: stretch; gap: 2px 3px; min-height: 26px; }
.toolbar { display: inline-flex; align-items: center; height: 26px; padding: 0 2px 0 0; border-radius: 3px; border-bottom: 1px solid var(--tb-border); border-right: 1px solid var(--tb-edge);
  background: linear-gradient(var(--tb-a), var(--tb-b) 50%, var(--tb-c)); max-width: 100%; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; flex: none; }
.toolbar::-webkit-scrollbar { display: none; }
.tb-grip { flex: none; width: 7px; height: 18px; margin: 0 2px 0 3px; background: radial-gradient(circle at 1px 1px, var(--grip) 0.8px, transparent 1px) 0 0 / 4px 4px, radial-gradient(circle at 2px 2px, var(--grip-hi) 0.8px, transparent 1px) 0 0 / 4px 4px; }
.tb-sep { flex: none; width: 2px; height: 18px; margin: 0 3px; border-left: 1px solid var(--sep-dark); border-right: 1px solid var(--sep-light); }
.tb-end { flex: none; width: 2px; }
.tb-btn { flex: none; display: inline-flex; align-items: center; gap: 3px; height: 22px; min-width: 23px; padding: 0 3px; border: 1px solid transparent; background: none; border-radius: 0; cursor: default; justify-content: center; }
.tb-btn .ico { display: block; flex: none; }
.tb-btn.with-label { padding: 0 5px 0 3px; }
.tb-btn:not(.dis):hover, .tb-dd:hover, .tb-split:hover > .tb-btn:not(.dis) { background: linear-gradient(var(--hot-a), var(--hot-b)); border-color: var(--hot-border); }
.tb-split:hover > .tb-dd { background: linear-gradient(var(--hot-a), var(--hot-b)); border-color: var(--hot-border); }
.tb-btn:not(.dis):active { background: linear-gradient(var(--press-a), var(--press-b)); border-color: var(--hot-border); }
.tb-btn.on { background: linear-gradient(var(--chk-a), var(--chk-b)); border-color: var(--hot-border); }
.tb-btn.on:hover { background: linear-gradient(var(--press-a), var(--press-b)); }
.tb-btn.dis { opacity: .38; filter: grayscale(1); }
.tb-split { display: inline-flex; flex: none; }
.tb-split .tb-btn { min-width: 21px; padding-right: 1px; }
.tb-dd { width: 12px; height: 22px; border: 1px solid transparent; background: none; padding: 0; display: inline-flex; align-items: center; justify-content: center; cursor: default; }
.dd-arrow { display: inline-block; width: 0; height: 0; border-left: 3px solid transparent; border-right: 3px solid transparent; border-top: 3px solid var(--ink); margin-left: 2px; }
.tb-lbl { white-space: nowrap; }
.combo { flex: none; display: inline-flex; height: 19px; margin: 0 2px; border: 1px solid var(--combo-border); background: var(--surface); }
.combo.focus, .combo:hover { border-color: var(--hot-border); }
.combo.dis { opacity: .5; }
.combo-in { flex: 1; min-width: 0; border: 0; padding: 0 3px; height: 17px; outline: none; background: transparent; }
.combo-btn { flex: none; width: 13px; border: 0; border-left: 1px solid var(--combo-sep); background: linear-gradient(var(--tb-a), var(--tb-b)); padding: 0; display: flex; align-items: center; justify-content: center; }
.combo-btn:hover { background: linear-gradient(var(--hot-a), var(--hot-b)); }
.ico-swatch { display: block; }
/* ---------- menus ---------- */
.menu { position: fixed; z-index: 1000; min-width: 150px; max-height: calc(100% - 8px); overflow-y: auto; background: var(--surface) linear-gradient(90deg, var(--tb-a), var(--tb-b) 18px, var(--tb-c) 25px, var(--menu-face) 25px) no-repeat; border: 1px solid var(--menu-border); padding: 2px; box-shadow: 2px 2px 3px var(--shadow-c); user-select: none; outline: none; }
.m-item { display: grid; grid-template-columns: 22px 1fr auto 12px; align-items: center; min-height: 21px; border: 1px solid transparent; cursor: default; padding-right: 2px; white-space: nowrap; }
.m-item.act:not(.dis) { background: var(--menu-hot); border-color: var(--hot-border); }
.m-item.dis { color: var(--dis-ink); }
.m-item.dis .ico { opacity: .35; filter: grayscale(1); }
.m-ico { display: flex; align-items: center; justify-content: center; width: 20px; height: 19px; }
.m-ico.on { background: var(--chk-b); border: 1px solid var(--hot-border); }
.m-check { font-weight: bold; color: var(--ink); }
.m-radio { font-size: 8px; }
.m-lbl { padding: 0 10px 0 8px; }
.m-key { padding-left: 18px; color: inherit; }
.m-sub { font-size: 7px; text-align: right; }
.m-sep { height: 1px; margin: 2px 2px 2px 28px; background: var(--sep-dark); }
.m-head { padding: 3px 8px; font-weight: bold; color: var(--head-ink); background: var(--head-bg); border-block: 1px solid var(--head-line); }
.combo-list .m-key { color: var(--key-ink); }
.menu.combo-list .m-lbl { font-size: 13px; }
.menu.combo-list.fonts .m-item { min-height: 24px; }
.menu.combo-list.styles .m-lbl { font-size: 11px; }
.menu.grid-menu { padding: 3px; }
.shape-grid { display: grid; grid-template-columns: repeat(8, 24px); gap: 1px; padding: 2px; background: var(--surface); }
.shape-grid button { width: 24px; height: 24px; border: 1px solid transparent; background: none; padding: 0; display: flex; align-items: center; justify-content: center; }
.shape-grid button:hover { background: var(--menu-hot); border-color: var(--hot-border); }
.menu-title { padding: 2px 4px 3px 28px; font-weight: bold; color: var(--pane-ink); }
.style-list { display: flex; flex-direction: column; background: var(--surface); min-width: 150px; }
.style-list button { display: flex; align-items: center; gap: 8px; height: 22px; border: 1px solid transparent; background: none; padding: 0 6px; text-align: left; }
.style-list button:hover { background: var(--menu-hot); border-color: var(--hot-border); }
.color-panel { display: flex; flex-direction: column; gap: 3px; padding: 3px; background: var(--surface); min-width: 172px; }
.cp-wide { height: 22px; border: 1px solid transparent; background: none; text-align: center; }
.cp-wide:hover { background: var(--menu-hot); border-color: var(--hot-border); }
.cp-sep { height: 1px; background: var(--rule); margin: 1px 0; }
.cp-row, .cp-grid { display: grid; grid-template-columns: repeat(8, 18px); gap: 3px; justify-content: center; }
.cp-grid.hl { grid-template-columns: repeat(5, 18px); }
.cp-sw { width: 18px; height: 18px; border: 1px solid #808080; padding: 0; box-shadow: inset 0 0 0 1px #fff; }
.cp-sw:hover { outline: 1px solid var(--hot-border); outline-offset: 1px; }
.tbl-grid-pick { background: var(--surface); padding: 4px; }
.tgp-cells { display: grid; gap: 1px; }
.tgp-cells span { width: 18px; height: 16px; border: 1px solid var(--cell-line); background: var(--surface); }
.tgp-cells span.on { background: var(--sel); border-color: var(--sel-line); }
.tgp-label { text-align: center; padding: 3px 0 0; }
.border-grid { display: grid; grid-template-columns: repeat(6, 24px); gap: 1px; background: var(--surface); padding: 3px; }
.border-grid button { width: 24px; height: 24px; border: 1px solid transparent; background: none; padding: 0; display: flex; align-items: center; justify-content: center; }
.border-grid button:hover { background: var(--menu-hot); border-color: var(--hot-border); }

/* ---------- side panes ---------- */
.docmap-unused { flex: none; width: 200px; background: var(--surface); border-right: 1px solid var(--chrome-line); overflow: auto; padding: 4px 0; display: flex; flex-direction: column; min-height: 0; }
.dm-item { display: flex; align-items: baseline; gap: 3px; padding: 1px 4px; cursor: default; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); border: 1px solid transparent; }
.dm-item:hover { border-color: var(--hot-border); background: var(--menu-hot); }
.dm-item.on { background: var(--sel-soft); }
.dm-tog { flex: none; width: 10px; font-size: 9px; color: var(--ink-4); text-align: center; }

.splitter { flex: none; background: transparent; }
.splitter.v { width: 4px; cursor: col-resize; margin-left: -2px; margin-right: -2px; z-index: 2; position: relative; }
.splitter.h { height: 5px; cursor: row-resize; background: linear-gradient(var(--tb-a), var(--tb-c)); border-top: 1px solid var(--chrome-line); }

.taskpane { flex: none; width: 262px; display: flex; flex-direction: column; background: linear-gradient(var(--pane-a), var(--pane-b)); border-left: 1px solid var(--chrome-line); min-height: 0; }
.tp-head { flex: none; display: flex; align-items: center; gap: 2px; padding: 3px 4px; background: linear-gradient(var(--tb-a), var(--tb-b) 50%, var(--tb-c)); border-bottom: 1px solid var(--tb-border); }
.tp-nav { width: 18px; height: 18px; border: 1px solid transparent; background: none; padding: 0; display: flex; align-items: center; justify-content: center; }
.tp-nav:not(:disabled):hover { background: var(--menu-hot); border-color: var(--hot-border); }
.tp-nav:disabled { opacity: .4; }
.tp-title { flex: 1; min-width: 0; font-weight: bold; color: var(--ink); padding: 0 4px; display: flex; align-items: center; justify-content: space-between; border: 1px solid transparent; height: 20px; }
.tp-title:hover { border-color: var(--hot-border); background: var(--menu-hot); }
.tp-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-body { flex: 1; min-height: 0; overflow: auto; padding: 8px 8px 16px; }
.tp-sec { margin-bottom: 12px; }
.tp-h { font-weight: bold; color: var(--pane-ink); border-bottom: 1px solid var(--pane-line); padding: 2px 0 3px; margin: 6px 0 6px; display: flex; align-items: center; gap: 4px; }
.tp-link { display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: none; text-align: left; color: var(--pane-link); padding: 3px 2px; cursor: pointer; }
.tp-link:hover span { text-decoration: underline; }
.tp-link:disabled { color: var(--dis-ink-2); cursor: default; }
.tp-row { display: flex; align-items: center; gap: 6px; margin: 5px 0; flex-wrap: wrap; }
.tp-row > label { min-width: 62px; }
.tp-row select, .tp-row input[type=text] { flex: 1; min-width: 0; }
.tp-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.tp-note { color: var(--muted); margin: 4px 0; line-height: 1.4; }
.tp-box { background: var(--surface); border: 1px solid var(--box-line); padding: 4px 6px; margin: 4px 0; }
.sf-list { background: var(--surface); border: 1px solid var(--box-line); max-height: 340px; overflow: auto; }
.sf-item { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 3px 4px; border: 1px solid transparent; cursor: default; min-height: 22px; overflow: hidden; }
.sf-item:hover { border-color: var(--hot-border); background: var(--menu-hot); }
.sf-item.on { border-color: var(--sel); background: var(--sel-pale); }
.sf-item .sf-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sf-item .sf-k { flex: none; color: var(--ink-5); font: bold 10px Arial, Arimo, sans-serif; }
.rf-tree { background: var(--surface); border: 1px solid var(--box-line); padding: 4px; font-size: 11px; }
.rf-tree h5 { margin: 6px 0 2px; font-size: 11px; color: var(--pane-ink); }
.rf-tree div { padding-left: 12px; color: var(--ink-2); }
.clip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; }
.clip-it { border: 1px solid var(--card-line); background: var(--surface); padding: 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: default; }
.clip-it:hover { border-color: var(--hot-border); background: var(--menu-hot); }
.clip-it img { width: 56px; height: 56px; object-fit: contain; }
.clip-it span { font-size: 10px; color: var(--ink-3); }
.cb-item { display: flex; gap: 6px; align-items: center; background: var(--surface); border: 1px solid var(--card-line); padding: 4px; margin-bottom: 4px; cursor: default; }
.cb-item:hover { border-color: var(--hot-border); background: var(--menu-hot); }
.cb-item .cb-t { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.help-topic { background: var(--surface); border: 1px solid var(--card-line); padding: 6px 8px; margin-bottom: 6px; }
.help-topic h4 { margin: 0 0 4px; font-size: 11px; color: var(--pane-ink); }
.help-topic p { margin: 0 0 4px; line-height: 1.4; }
.kbd-table { width: 100%; border-collapse: collapse; }
.kbd-table td { padding: 2px 3px; border-bottom: 1px solid var(--row-line); vertical-align: top; }
.kbd-table td:first-child { white-space: nowrap; font-weight: bold; color: var(--ink-key); }
.search-hit { background: var(--surface); border: 1px solid var(--card-line); padding: 4px 6px; margin-bottom: 4px; cursor: pointer; line-height: 1.35; }
.search-hit:hover { border-color: var(--hot-border); background: var(--menu-hot); }
.search-hit b { background: var(--find-hit); font-weight: normal; }

.statusbar { flex: none; display: flex; align-items: center; height: 22px; padding: 0 4px; background: linear-gradient(var(--dock-a), var(--dock-b)); border-top: 1px solid var(--chrome-line); gap: 0; overflow: hidden; white-space: nowrap; }
.sb-cell { padding: 0 8px; border-right: 1px solid var(--sb-sep); box-shadow: 1px 0 0 var(--sb-sep-hi); height: 16px; line-height: 16px; overflow: hidden; text-overflow: ellipsis; flex: none; }
.sb-cell.grow { flex: 1; min-width: 0; border-right: 0; box-shadow: none; }
.sb-cell.flag { color: var(--flag-off); cursor: default; font-weight: bold; padding: 0 5px; }
.sb-cell.flag.on { color: var(--ink); }
.sb-cell.act { cursor: default; }
.sb-cell.act:hover { background: var(--menu-hot); }
.sb-spell { display: inline-flex; align-items: center; }
.sb-spell.off svg { filter: grayscale(1); opacity: .5; }

/* floating toolbars */
.floatbar { position: absolute; z-index: 60; background: linear-gradient(var(--tb-a), var(--tb-b)); border: 1px solid var(--tb-border); border-radius: 3px; box-shadow: 2px 2px 5px var(--shadow-c); display: flex; flex-direction: column; }
.floatbar .fb-title { height: 17px; padding: 0 1px 0 6px; display: flex; align-items: center; justify-content: space-between; background: linear-gradient(var(--tb-a), var(--tb-b)); border-bottom: 1px solid var(--pane-line); color: var(--pane-ink); font: bold 10px var(--ui-font); cursor: move; user-select: none; }
.floatbar .fb-title button { width: 16px; height: 14px; border: 1px solid transparent; background: none; color: var(--pane-ink); padding: 0; font: bold 10px/1 var(--ui-font); }
.floatbar .fb-title button:hover { background: var(--menu-hot); border-color: var(--hot-border); }
.floatbar .fb-body { display: flex; flex-wrap: wrap; align-items: center; padding: 2px; gap: 1px; max-width: 520px; }
.floatbar .fb-body .toolbar { border: 0; background: none; height: auto; flex-wrap: wrap; }
.floatbar .fb-body .tb-grip { display: none; }

/* ---------- dialogs ---------- */
.dlg-overlay { position: fixed; inset: 0; z-index: 2000; background: var(--overlay); }
.dlg { position: absolute; background: var(--dlg); border: 1px solid var(--tb-border); box-shadow: 0 6px 20px var(--dlg-shadow-c); padding: 0; max-height: calc(100% - 8px); display: flex; flex-direction: column; color: var(--dlg-ink); }
.dlg-title { height: 26px; margin: 0 0 3px; padding: 0 2px 0 9px; display: flex; align-items: center; gap: 2px; color: var(--pane-ink); font: bold 11px/1 var(--ui-font); cursor: default; user-select: none;
  background: linear-gradient(var(--tb-a), var(--tb-b)); border-bottom: 1px solid var(--pane-line); }
.dlg-ttl { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-x { width: 22px; height: 20px; border: 1px solid transparent; padding: 0; display: flex; align-items: center; justify-content: center; background: none; color: var(--pane-ink); }
.dlg-x:hover { background: var(--menu-hot); border-color: var(--hot-border); }
.dlg-x:active { background: linear-gradient(var(--press-a), var(--press-b)); }
.dlg-help { font-size: 12px; font-weight: bold; }
.dlg-body { padding: 8px 12px 6px; overflow: auto; min-height: 0; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 6px; padding: 6px 12px 9px; flex-wrap: wrap; }
.dlg-foot .btn.left { margin-right: auto; }
.btn { min-width: 75px; height: 23px; padding: 0 10px; border: 1px solid var(--btn-border); border-radius: 2px; background: linear-gradient(var(--btn-a), var(--btn-b)); cursor: default; }
.btn:hover:not(:disabled) { border-color: var(--tb-border); background: linear-gradient(var(--btn-a), var(--btn-hot-b)); }
.btn:active:not(:disabled) { background: linear-gradient(var(--btn-press-a), var(--btn-press-b)); }
.btn.primary { border-color: var(--tb-border); box-shadow: inset 0 0 0 1px var(--btn-ring); }
.btn:disabled { color: var(--btn-dis-ink); border-color: var(--btn-dis-line); background: var(--btn-dis-bg); }
.btn.small { min-width: 0; height: 21px; padding: 0 6px; }
.dlg input[type=text], .dlg input[type=number], .dlg input[type=password], .dlg select, .dlg textarea, .tp-body input[type=text], .tp-body select { border: 1px solid var(--field-border); background: var(--surface); height: 21px; padding: 1px 3px; }
.dlg textarea { height: auto; padding: 3px; resize: vertical; }
.dlg select, .tp-body select { padding: 0 1px; }
.dlg select[size] { height: auto; }
.dlg fieldset, .grp { border: 1px solid var(--grp-line); padding: 6px 8px 8px; margin: 0 0 8px; min-width: 0; }
.dlg legend, .grp legend { color: var(--pane-ink); padding: 0 3px; }
.field { display: flex; align-items: center; gap: 6px; margin: 4px 0; flex-wrap: wrap; }
.field > label:first-child { min-width: 78px; }
.field.wide > label:first-child { min-width: 110px; }
.field.narrow > label:first-child { min-width: 50px; }
.row { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.row > * { min-width: 0; }
.col { display: flex; flex-direction: column; gap: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, auto); gap: 2px 14px; align-items: center; }
.ck { display: inline-flex; align-items: center; gap: 4px; margin: 3px 10px 3px 0; cursor: default; }
.ck input { margin: 0; }
.spin { display: inline-flex; align-items: stretch; height: 21px; border: 1px solid var(--field-border); background: var(--surface); }
.spin-in { width: 62px; border: 0 !important; height: 19px !important; padding: 0 3px; outline: none; }
.spin-bs { display: flex; flex-direction: column; width: 15px; }
.spin-b { flex: 1; border: 1px solid var(--spin-line); background: linear-gradient(var(--spin-a), var(--spin-b)); padding: 0; display: flex; align-items: center; justify-content: center; }
.spin-b span { width: 0; height: 0; border-left: 3px solid transparent; border-right: 3px solid transparent; }
.spin-b.up span { border-bottom: 3px solid var(--spin-ink); }
.spin-b.dn span { border-top: 3px solid var(--spin-ink); }
.tabs-head { display: flex; gap: 0; padding-left: 2px; position: relative; z-index: 1; flex-wrap: wrap; }
.tab { border: 1px solid var(--field-border); border-bottom: 0; background: linear-gradient(var(--tab-a), var(--tab-b)); padding: 3px 9px; margin-right: -1px; cursor: default; position: relative; top: 1px; }
.tab.on { background: var(--surface); box-shadow: inset 0 2px 0 var(--tb-border); z-index: 2; padding-bottom: 4px; top: 1px; }
.tabs-body { border: 1px solid var(--field-border); background: var(--surface); padding: 9px 10px; min-height: 120px; }
.msgbox { display: flex; gap: 14px; align-items: flex-start; padding: 6px 4px 2px; }
.msg-ico { flex: none; }
.msg-text { line-height: 1.45; padding-top: 4px; max-width: 46ch; }
.about-head { display: flex; gap: 12px; align-items: center; }
.about-name { font-weight: bold; font-size: 16px; }
.about p { margin: 6px 0; line-height: 1.4; }
.about .about-marks { color: var(--ink-5); font-size: 11px; line-height: 1.35; }
.preview-box { border: 1px solid var(--field-border); background: var(--surface); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.font-preview { height: 60px; font-size: 22px; padding: 0 8px; white-space: nowrap; }
.prev-cap { color: var(--ink-5); text-align: center; font-size: 10px; margin-top: 3px; }

.listbox { background: var(--surface); border: 1px solid var(--field-border); min-height: 80px; max-height: 220px; overflow: auto; }
.listbox .li { display: flex; align-items: center; gap: 4px; padding: 1px 4px; cursor: default; white-space: nowrap; }
.listbox .li.on { background: var(--sel); color: var(--sel-ink); }
.listbox .li-group { padding: 2px 4px; background: var(--group-bg); color: var(--ink-3); font-weight: bold; }
.listbox-in { width: 100%; }

.sym-grid { display: grid; grid-template-columns: repeat(16, 26px); max-height: 230px; overflow: auto; border: 1px solid var(--grid-line); background: var(--surface); }
.sym-grid button { height: 26px; border: 0; border-right: 1px solid var(--grid-line-2); border-bottom: 1px solid var(--grid-line-2); background: var(--surface); padding: 0; font-size: 16px; }
.sym-grid button.on { background: var(--sel); color: var(--sel-ink); }
.sym-recent { display: grid; grid-template-columns: repeat(16, 26px); border: 1px solid var(--grid-line); background: var(--surface); }
.sym-recent button { height: 26px; border: 0; border-right: 1px solid var(--grid-line-2); background: var(--surface); padding: 0; font-size: 16px; }
.bd-preview { width: 150px; height: 150px; background: var(--surface); border: 1px solid var(--field-border); position: relative; }
.bd-preview .bd-box { position: absolute; left: 22px; top: 22px; right: 22px; bottom: 22px; }
.bd-preview .bd-text { position: absolute; left: 30px; right: 30px; top: 34px; display: flex; flex-direction: column; gap: 5px; }
.bd-preview .bd-text i { height: 3px; background: var(--sample-line); }
.bd-preview .bd-btn { position: absolute; width: 22px; height: 22px; border: 1px solid var(--grid-line); background: var(--surface); padding: 0; display: flex; align-items: center; justify-content: center; }
.bd-preview .bd-btn.on { background: var(--bd-on); border-color: var(--hot-border); }
.bd-setting { display: flex; flex-direction: column; gap: 6px; }
.bd-setting button { display: flex; align-items: center; gap: 8px; border: 1px solid transparent; background: none; padding: 2px 4px; text-align: left; }
.bd-setting button.on { border-color: var(--pane-link); background: var(--sel-pale-2); }
.bd-setting svg { flex: none; }

.cc-wrap { display: flex; gap: 10px; }
.cc-wrap .tabs { flex: 1; min-width: 0; }
.cc-honey { display: flex; flex-direction: column; align-items: center; }
.cc-hrow { display: flex; margin-top: -2px; }
.cc-hex { width: 14px; height: 16px; border: 0; padding: 0; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.cc-hex:hover { filter: brightness(1.15) drop-shadow(0 0 1px #000); }
.cc-grays { display: flex; justify-content: center; margin-top: 8px; }
.cc-side { flex: none; width: 70px; display: flex; flex-direction: column; justify-content: flex-end; gap: 0; padding-bottom: 10px; }
.cc-new, .cc-cur { height: 30px; border: 1px solid #000; }
.cc-cap { color: var(--ink); margin: 3px 0; }
.cc-custom { display: flex; flex-direction: column; gap: 2px; }

.datasheet { overflow: auto; max-height: 190px; border: 1px solid var(--field-border); background: var(--surface); }
.datasheet table { border-collapse: collapse; }
.datasheet th, .datasheet td { border: 1px solid var(--sheet-grid); padding: 0; }
.datasheet th { background: linear-gradient(var(--sheet-hdr-a), var(--sheet-hdr-b)); font-weight: normal; }
.datasheet input { width: 64px; border: 0; height: 19px; padding: 0 3px; background: transparent; }
.chart-dlg { display: flex; gap: 10px; flex-wrap: wrap; }
.cd-left { flex: 1 1 340px; min-width: 0; }
.cd-right { flex: 0 0 310px; max-width: 100%; }
.cd-row { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; flex-wrap: wrap; }
.cd-row > label:first-child { min-width: 70px; }
.cd-cap { color: var(--pane-ink); margin-bottom: 3px; }
.chart-preview { border: 1px solid var(--field-border); background: var(--surface); width: 310px; max-width: 100%; height: 200px; display: flex; align-items: center; justify-content: center; }
.ds-tools { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.tooltip { position: fixed; z-index: 3000; background: var(--tip-bg); border: 1px solid var(--tip-line); padding: 1px 4px; pointer-events: none; font-size: 11px; white-space: nowrap; box-shadow: 1px 1px 2px var(--tip-shadow-c); }
.toast { position: fixed; left: 50%; bottom: 60px; transform: translateX(-50%); z-index: 2500; background: var(--tip-bg); border: 1px solid var(--tip-line); padding: 6px 12px; box-shadow: 2px 2px 4px var(--toast-shadow-c); }
.busy { position: fixed; inset: 0; z-index: 2600; background: var(--busy-veil); display: flex; align-items: center; justify-content: center; cursor: progress; }
.busy-box { background: var(--dlg); border: 1px solid var(--tb-border); padding: 14px 20px; display: flex; gap: 10px; align-items: center; box-shadow: 3px 3px 8px var(--shadow-c); }
.busy-spin { width: 16px; height: 16px; border: 2px solid var(--pane-line); border-top-color: var(--pane-link); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.drop-hint { position: fixed; inset: 0; z-index: 2400; background: var(--drop-veil); border: 3px dashed var(--sel); display: flex; align-items: center; justify-content: center; font-size: 16px; color: var(--pane-ink); pointer-events: none; }
.smarttag { position: absolute; z-index: 35; width: 20px; height: 16px; border: 1px solid var(--combo-border); background: linear-gradient(var(--tb-a), var(--tb-b)); display: flex; align-items: center; justify-content: center; padding: 0; }

/* ---- dialogs: modeless windows let the document keep working underneath ---- */
.dlg-overlay.modeless { background: transparent; pointer-events: none; }
.dlg-overlay.modeless .dlg { pointer-events: auto; }
.options-tabs .tabs-head { row-gap: 0; }
.options-tabs .tabs-body { min-height: 300px; }
.cpk { display: inline-flex; align-items: center; gap: 4px; height: 21px; min-width: 120px; padding: 0 4px; border: 1px solid var(--field-border); background: var(--surface); cursor: default; }
.cpk-sw { width: 26px; height: 11px; border: 1px solid #555; flex: none; background: #fff; }
.cpk-l { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.wc-table { border-collapse: collapse; min-width: 240px; }
.wc-table td { padding: 2px 4px; }
.wc-table td + td { text-align: right; font-variant-numeric: tabular-nums; }

.sg-context { background: var(--surface); border: 1px solid var(--field-border); padding: 4px 6px; min-height: 64px; max-height: 110px; overflow: auto; line-height: 1.45; white-space: pre-wrap; user-select: text; }
.sg-bad { color: #c00000; font-weight: bold; }
.sg-gram { color: #1a7f1a; font-weight: bold; }
.ac-tip { white-space: normal; max-width: 320px; pointer-events: none; }

.readbar, .preview-bar { display: flex; align-items: center; gap: 2px; height: 26px; padding: 0 4px; background: linear-gradient(var(--tb-a), var(--tb-b) 60%, var(--tb-c)); border-bottom: 1px solid var(--tb-border); border-radius: 3px; overflow-x: auto; }
.readbar .tb-btn.with-label, .preview-bar .tb-btn.with-label { padding: 0 5px; }

/* ---------- ribbon (looks whose layout is 'ribbon': <html data-layout="ribbon">; common/ribbon.js) ---------- */
.ribbon { display: none; position: relative; flex-direction: column; background: var(--rb-bg); user-select: none; }
[data-layout="ribbon"] .ribbon { display: flex; }
[data-layout="ribbon"] .menurow, [data-layout="ribbon"] .toolbars, [data-layout="ribbon"] .drawrow { display: none !important; }
[data-layout="ribbon"] .cmdbars { background: var(--rb-bg); }
.rb-bar { display: flex; align-items: flex-end; gap: 8px; padding: 4px 8px 0; min-height: 31px; }
.rb-qat { display: flex; align-items: center; gap: 1px; align-self: center; padding: 0 8px 3px 0; margin-right: 2px; border-right: 1px solid var(--rb-line); }
.rb-tabs { display: flex; align-items: flex-end; gap: 1px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.rb-tabs::-webkit-scrollbar { display: none; }
.rb-tab { flex: none; border: 1px solid transparent; border-bottom: 0; background: none; padding: 4px 11px 5px; color: var(--rb-tab-ink); cursor: default; white-space: nowrap; border-radius: var(--ctl-radius) var(--ctl-radius) 0 0; font: inherit; }
.rb-tab:hover { background: var(--rb-tab-hot); }
.rb-tab.on { background: var(--rb-panel); border-color: var(--rb-line); color: var(--rb-tab-on-ink); position: relative; top: 1px; }
.rb-tab.file { color: var(--rb-file-ink); font-weight: bold; }
.rb-ctx { flex: none; display: flex; align-items: flex-end; margin-left: 4px; background: var(--rb-ctx-bg); border-top: 2px solid var(--rb-ctx); border-radius: var(--ctl-radius) var(--ctl-radius) 0 0; }
.rb-ctx-name { align-self: center; padding: 0 2px 0 8px; font-size: 10px; font-weight: bold; color: var(--rb-ctx); white-space: nowrap; }
.rb-ctx-tabs { display: flex; }
.rb-tab.ctx { color: var(--rb-ctx); }
.rb-bar .cmd-search { margin-left: 0; align-self: center; margin-bottom: 3px; }
.rb-bar .cmd-search input { height: 22px; padding: 0 8px 0 22px; border: 1px solid var(--rb-line); border-radius: 11px; color: var(--ink); }
.rb-panel { display: flex; height: 96px; border-top: 1px solid var(--rb-line); border-bottom: 1px solid var(--chrome-line); background: var(--rb-panel); overflow: hidden; }
.rb-groups { display: flex; align-items: stretch; padding: 3px 2px 0; }
.rb-group { flex: none; display: flex; flex-direction: column; padding: 0 5px; border-right: 1px solid var(--rb-line); }
.rb-body { flex: 1; min-height: 0; display: flex; align-items: flex-start; gap: 2px; }
.rb-col { display: flex; flex-direction: column; gap: 1px; }
.rb-col[data-kind="rows"] { gap: 5px; padding-top: 3px; }
.rb-row { display: flex; align-items: center; gap: 1px; }
.rb-gap { width: 6px; }
.rb-label { position: relative; padding: 1px 16px 3px; color: var(--rb-label-ink); font-size: 10px; text-align: center; white-space: nowrap; }
.rb-launch { position: absolute; right: 0; bottom: 2px; width: 14px; height: 14px; padding: 0; border: 1px solid transparent; background: none; color: var(--rb-label-ink); display: flex; align-items: center; justify-content: center; }
.rb-launch:hover { background: var(--menu-hot); border-color: var(--hot-border); }
.tb-btn.rb-medium { justify-content: flex-start; padding: 0 5px 0 3px; }
.tb-btn.rb-large, .tb-split.rb-large > .tb-btn { flex-direction: column; justify-content: flex-start; height: 62px; min-width: 44px; padding: 3px 4px 0; gap: 3px; }
.tb-btn.rb-large .tb-lbl, .tb-split.rb-large .tb-lbl { max-width: 62px; white-space: normal; text-align: center; line-height: 1.15; }
.tb-btn.rb-large.tb-drop { position: relative; padding-bottom: 8px; }
.tb-btn.rb-large.tb-drop .dd-arrow { margin: 0; }
.tb-split.rb-large { flex-direction: column; }
.tb-split.rb-large > .tb-btn { height: 46px; }
.tb-split.rb-large > .tb-dd { width: 100%; height: 16px; }
.tb-split.rb-medium > .tb-btn { padding-right: 3px; }
.rb-panelwrap { position: relative; }
.rb-pin { position: absolute; right: 4px; bottom: 4px; width: 18px; height: 16px; padding: 0; border: 1px solid transparent; background: none; color: var(--rb-label-ink); display: flex; align-items: center; justify-content: center; }
.rb-pin:hover { background: var(--menu-hot); border-color: var(--hot-border); }
.ribbon.collapsed .rb-panelwrap { display: none; }
.ribbon.collapsed .rb-pin { transform: rotate(180deg); }
.ribbon.collapsed.peek .rb-panelwrap { display: block; position: absolute; left: 0; right: 0; top: 100%; z-index: 70; box-shadow: 0 4px 12px var(--shadow-c); }
.ribbon.collapsed:not(.peek) .rb-tab.on { background: none; border-color: transparent; color: var(--rb-tab-ink); top: 0; }
.rb-fold { display: none; }
.rb-group.folded > .rb-body, .rb-group.folded > .rb-label { display: none; }
.rb-group.folded > .rb-fold { display: flex; margin-top: 2px; }
.rb-pop { position: fixed; z-index: 990; height: 96px; padding: 3px 6px 0; border: 1px solid var(--rb-line); border-right: 1px solid var(--rb-line); background: var(--rb-panel); box-shadow: 0 4px 12px var(--shadow-c); }
.rb-keytip { position: fixed; z-index: 3500; transform: translateX(-50%); min-width: 14px; padding: 0 3px; border: 1px solid var(--tip-line); border-radius: 2px; background: var(--tip-bg); color: var(--ink); font: bold 10px/13px var(--ui-font); text-align: center; pointer-events: none; box-shadow: 1px 1px 2px var(--tip-shadow-c); }
