/* ---------------------------------------------------------------- top bar (toolbar.js) */
/* The bar never overflows: "⋯" and "PDF preview" are pinned at its end; controls that do not fit get
   .ov-hidden and appear in the "⋯" menu, or .ov-compact (an icon only). toolbar.js measures. */
.topbar { overflow: hidden; gap: 4px; padding: 0 10px; }
.topbar > * { flex-shrink: 0; }
.topbar .tb.primary, .topbar .menu { flex: none; }
.topbar .tpl-id { flex: 0 1 auto; min-width: 92px; display: flex; }
.topbar.ov-measure .tpl-id { flex-shrink: 0; }
.topbar .tpl-switch { max-width: 240px; min-width: 0; width: 100%; }
.topbar .tpl-name { min-width: 0; }
.topbar .brand { margin-inline-end: 2px; }
.topbar .ov-hidden { display: none !important; }
/* a group whose buttons all moved into "⋯" takes no room */
.topbar .tb-group:not(:has(> :not(.ov-hidden))) { display: none; }
.topbar .tb { padding: 6px 8px; }
.topbar .tb.primary { padding: 7px 12px; }

/* the menus by topic */
.menubar { display: flex; align-items: center; gap: 0; margin-inline-start: 2px; }
.mb-btn { border: 1px solid transparent; background: none; padding: 6px 8px; border-radius: 6px; white-space: nowrap; color: var(--text); font-weight: 500; }
.mb-btn:hover, .mb-btn[aria-expanded="true"] { background: var(--panel-2); border-color: var(--line); }

/* the command palette button */
.tb.cmdk { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); min-width: 150px; margin-inline-start: 4px; }
.tb.cmdk:hover { border-color: #c5ccd8; background: var(--panel); }
.cmdk-glass { font-size: 15px; line-height: 1; }
.cmdk-text { flex: 1; text-align: start; }
.tb.cmdk kbd, .cp kbd, .sc-table kbd { font: 11px/1.4 ui-monospace, 'Cousine', Consolas, monospace; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--panel); color: var(--muted); white-space: nowrap; }
.tb.cmdk.ov-compact { min-width: 0; padding: 5px 8px; }
.tb.cmdk.ov-compact .cmdk-text, .tb.cmdk.ov-compact kbd { display: none; }
.tour-btn.ov-compact { padding: 5px 9px; }
.tour-btn.ov-compact .tb-text { display: none; }
.tb.publish { border: 1px solid var(--accent) !important; color: var(--accent); font-weight: 600; }
.tb.publish:hover { background: var(--accent-soft); }
/* "⋯" holds controls of the bar that did not fit: a small mark says so */
.more-btn { position: relative; }
.more-btn.has-more::after { content: ''; position: absolute; top: 4px; inset-inline-end: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }


/* ---------------------------------------------------------------- command palette (palette.js) */
.cp-back { position: fixed; inset: 0; z-index: 950; background: rgba(15, 23, 42, .28); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.cp { width: min(640px, 100%); max-height: 70vh; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 24px 60px rgba(15, 23, 42, .3); overflow: hidden; }
.cp-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
.cp-glass { font-size: 18px; color: var(--muted); }
.cp-input { flex: 1; min-width: 0; border: 0; outline: none; font-size: 15px; padding: 6px 0; background: none; }
.cp-list { overflow-y: auto; padding: 6px; flex: 1; }
.cp-gh { font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 8px 10px 4px; }
.cp-opt { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; cursor: default; min-height: 36px; }
.cp-opt[aria-selected="true"] { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
html[dir="rtl"] .cp-opt[aria-selected="true"] { box-shadow: inset -3px 0 0 var(--accent); }
.cp-opt.dis .cp-label { color: var(--muted); }
.cp-ic { width: 20px; flex: none; text-align: center; color: var(--muted); }
.cp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cp-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; unicode-bidi: plaintext; text-align: start; }
.cp-why { font-size: 11.5px; color: var(--warn); }
.cp-meta { flex: none; font-size: 11.5px; color: var(--muted); }
.cp-key { flex: none; }
.cp-empty { padding: 18px; color: var(--muted); text-align: center; margin: 0; }
.cp-foot { display: flex; gap: 16px; padding: 7px 14px; border-top: 1px solid var(--line-2); font-size: 11.5px; color: var(--muted); }
.cp-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- shortcuts window (shortcuts.js) */
.sc-grid { columns: 2 300px; column-gap: 28px; }
.sc-group { break-inside: avoid; margin-bottom: 14px; }
.sc-group h3 { font-size: 13px; margin: 0 0 4px; color: var(--accent); }
.sc-table { width: 100%; border-collapse: collapse; }
.sc-table th { font-weight: 400; text-align: start; padding: 4px 0; border-bottom: 1px solid var(--line-2); }
.sc-table td { text-align: end; padding: 4px 0 4px 8px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
html[dir="rtl"] .sc-table td { padding: 4px 8px 4px 0; }

@media (pointer: coarse) {
  .mb-btn, .topbar .tb { min-height: 44px; } /* H6: a finger's 44 px, as tablet.css for the other controls */
  .cp-opt { min-height: 44px; }
}
