/* Data sources (Settings) and Query Lab. Loaded after style.css; uses its
   tokens and the shared frame (settings-card, templates-header, main-card). */

/* ── Shared bits ───────────────────────────────────────────────────────── */
.ds-btn { width: auto; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; text-decoration: none; }
.ds-btn[disabled] { opacity: 0.6; cursor: not-allowed; }
.ds-danger { color: var(--envoy-red-hover, #e23c32); }
.ds-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ds-muted { color: var(--fg-3); font-size: 13px; margin: 0; }
.ds-muted.sm, .ds-error.sm, .ds-loading.sm { font-size: 12px; padding: 6px 2px; }
.ds-error { color: var(--envoy-red-hover, #e23c32); background: var(--envoy-red-tint, #fff1f0); border-radius: var(--radius); padding: 10px 12px; margin: 10px 0 0; font-size: 13px; }
.ds-loading { display: flex; align-items: center; gap: 10px; color: var(--fg-3); padding: 16px 0; font-size: 14px; }
.ds-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--carbon-10, #ebebf0); border-top-color: var(--envoy-red, #fa4338); animation: ds-spin 0.8s linear infinite; flex-shrink: 0; display: inline-block; }
@keyframes ds-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ds-spin { animation: none; } }
.ds-ico { width: 36px; height: 36px; border-radius: var(--radius); background: var(--arctic); color: var(--fg-2); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ds-ico.sm { width: 28px; height: 28px; border-radius: 6px; }
.ds-ico.lg { width: 52px; height: 52px; border-radius: 14px; }
.ds-label { display: block; font-size: 12px; font-weight: var(--fw-bold, 700); color: var(--fg-2); text-transform: uppercase; letter-spacing: 0.06em; margin: 18px 0 8px; }
.ds-input { width: 100%; box-sizing: border-box; font-family: inherit; font-size: 13px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; color: var(--fg-1); min-height: 36px; }
.ds-input::placeholder { color: var(--fg-4, #8a8f9e); }
.ds-input:focus { outline: none; border-color: var(--envoy-red); box-shadow: 0 0 0 2px rgba(250, 67, 56, 0.12); }
select.ds-input {
  appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}

/* ── Settings › Data sources: built from Access Control's pieces
   (settings-section-title, settings-card, admin-table, admin-person-*,
   admin-you-pill, admin-badge, admin-input/select). Only the gaps here. ── */
#datasrc-root { display: flex; flex-direction: column; gap: 12px; max-width: 980px; }
.ds-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ds-toolbar .settings-section-title { margin: 0; }
.ds-blank { padding: 18px 20px; color: var(--fg-3); font-size: 14px; line-height: 1.5; }
.ds-flabel { display: block; font-size: 13px; font-weight: 500; color: var(--fg-2); margin: 0 0 6px; }
.ds-full { width: 100%; box-sizing: border-box; min-width: 0; }

/* Connect popup (Quarry modal) */
.modal.ds-modal { width: min(600px, calc(100vw - 32px)); max-height: calc(100vh - 64px); display: flex; flex-direction: column; }
.ds-modal-body { padding: 18px 28px 8px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
.ds-seg { display: flex; }
.ds-seg .artdash-seg-btn { flex: 1; text-align: center; }
.ds-steps { margin: 0; padding: 14px 14px 14px 32px; background: var(--arctic); border-radius: var(--radius); display: flex; flex-direction: column; gap: 12px; font-size: 13px; color: var(--fg-2); line-height: 1.5; }
.ds-steps li::marker { font-weight: 700; color: var(--fg-1); }
.ds-code-wrap { position: relative; margin-top: 6px; }
.ds-code { margin: 0; padding: 10px 12px; background: #fff; color: var(--fg-1); border: 1px solid var(--border); border-radius: var(--radius-sm); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; line-height: 1.5; overflow: auto; max-height: 140px; white-space: pre; }
.ds-copy { position: absolute; top: 6px; right: 6px; display: inline-flex; align-items: center; gap: 4px; font: inherit; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--border); background: #fff; color: var(--fg-2); cursor: pointer; }
.ds-copy:hover { color: var(--fg-1); border-color: var(--border-strong); }
.ds-region-chips { cursor: default; }
.ds-add-region { border: 0; background: transparent; font: inherit; font-size: 13px; color: var(--fg-3); padding: 3px 4px; cursor: pointer; outline: none; }
.ds-add-region:focus-visible { color: var(--fg-1); }

.ds-account { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.ds-acct-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 4px; }
.ds-acct-line .admin-you-pill { margin-left: 6px; }
.ds-meta { margin: 0 0 0 10px; }
.ds-grow { flex: 1; }
.ds-link { font: inherit; font-size: 13px; font-weight: 600; color: var(--fg-2); background: none; border: 0; padding: 6px 8px; border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.ds-link:hover { background: var(--arctic); color: var(--fg-1); }
.ds-link[disabled] { opacity: 0.6; cursor: default; }
.ds-link-danger { color: var(--envoy-red-hover, #e23c32); }
.ds-note { margin: 0; font-size: 12.5px; color: #587000; }
.ds-tablecard { padding: 0; overflow: hidden; }
.ds-table th:nth-child(2) { width: 18%; }
.ds-table th:nth-child(3) { width: 13%; }
.ds-table td:nth-child(3), .ds-table td:nth-child(4) { white-space: nowrap; }
.ds-table th:nth-child(4) { width: 16%; }
.ds-table th:nth-child(5) { width: 110px; }
.ds-table tr.ds-missing td { opacity: 0.55; }
.ds-table tr.ds-open td { border-bottom: none; background: var(--arctic); }
.ds-table tr.ds-setup-row:hover { background: none; }
.ds-table tr.ds-setup-row td { background: var(--arctic); padding: 4px 18px 16px; }
.ds-badge-warn { background: #f7f7d9; color: #587000; }
.ds-setup { display: flex; flex-direction: column; gap: 10px; }
.ds-setup-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.ds-setup-grid .ds-wide { grid-column: span 2; }

.ds-switch { position: relative; display: inline-block; width: 32px; height: 18px; cursor: pointer; vertical-align: middle; }
.ds-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.ds-switch span { position: absolute; inset: 0; border-radius: 999px; background: #cbd5e1; transition: background 150ms; pointer-events: none; }
.ds-switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(31, 35, 45, 0.2); transition: transform 150ms; }
.ds-switch input:checked + span { background: var(--envoy-red, #fa4338); }
.ds-switch input:checked + span::after { transform: translateX(14px); }
.ds-switch input:focus-visible + span { outline: 2px solid rgba(250, 67, 56, 0.35); outline-offset: 2px; }
.ds-switch.off { cursor: not-allowed; opacity: 0.4; }
.ds-switch.off input { cursor: not-allowed; }
.ds-hint { margin: 0; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--fg-3); }
.ds-hint.bad { color: var(--envoy-red-hover, #e23c32); }
.ds-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }

/* ── Query Lab ─────────────────────────────────────────────────────────── */
#screen-querylab, #screen-documents, #screen-shared-query, #screen-querylab-logs, #screen-querylab-links { padding: var(--page-pad-top) var(--page-pad-x) calc(var(--page-pad-top) * 1.4); background: var(--arctic); }
#screen-querylab.hidden, #screen-documents.hidden, #screen-shared-query.hidden, #screen-querylab-logs.hidden, #screen-querylab-links.hidden { display: none; }
#querylab-root { max-width: var(--content-max); }
.ql-card {
  --ql-bg: #fff; --ql-side: #fff; --ql-fg: var(--fg-1); --ql-fg2: var(--fg-2); --ql-fg3: var(--fg-3); --ql-fg4: var(--fg-4, #8a8f9e);
  --ql-border: var(--border); --ql-subtle: var(--border-subtle, #ebebf0); --ql-hover: var(--arctic, #f6f6f9); --ql-head: var(--arctic, #f6f6f9);
  --ql-ed-bg: #fbfbfd; --ql-ed-gutter: #f3f3f7; --ql-ed-fg: #1f232d; --ql-ed-ln: #a3a8b5; --ql-ed-sel: #ffe1de;
  --ql-kw: #c4291f; --ql-str: #027839; --ql-num: #4141a2; --ql-com: #8a8f9e; --ql-fn: #7a4b00;
  display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 560px; background: var(--ql-bg); color: var(--ql-fg);
}
.ql-card[data-theme="dark"] {
  --ql-bg: #151922; --ql-side: #11151d; --ql-fg: #e6e9ef; --ql-fg2: #c3c8d2; --ql-fg3: #8f96a6; --ql-fg4: #6b7282;
  --ql-border: #272d3a; --ql-subtle: #1f2430; --ql-hover: #1d2331; --ql-head: #1a1f2a;
  --ql-ed-bg: #0d1118; --ql-ed-gutter: #0d1118; --ql-ed-fg: #dbe4f0; --ql-ed-ln: #4b5263; --ql-ed-sel: #2a3346;
  --ql-kw: #ff7b72; --ql-str: #7ee787; --ql-num: #a5b4fc; --ql-com: #6b7282; --ql-fn: #f2cc60;
  border-color: #272d3a;
}
.ql-card.is-expanded { position: fixed; inset: 0; z-index: 150; height: 100vh; min-height: 0; border-radius: 0; border: 0; grid-template-columns: 280px minmax(0, 1fr); }
.ql-card.is-expanded .ql-side { overflow-y: auto; }
body:has(#screen-querylab:not(.hidden) .ql-card.is-expanded) { overflow: hidden; }
.ql-card.is-expanded .ql-tables { max-height: none; flex: 1; min-height: 0; }
.ql-card.is-expanded .ql-tables-field { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.ql-card.is-expanded .ql-main { height: 100vh; box-sizing: border-box; overflow-y: auto; overscroll-behavior: contain; }
.ql-card.is-expanded .ql-out { flex: 1 0 auto; display: flex; flex-direction: column; }
/* The column scrolls instead of squeezing: the editor keeps the height you dragged it to. */
.ql-card.is-expanded .ql-main > *, .ql-card.is-expanded .ql-editor-host { flex-shrink: 0; }
.ql-card.is-expanded .ql-grid-wrap { max-height: none; flex: none; height: max(360px, calc(100vh - 140px)); }
@media (max-width: 1000px) { .ql-card.is-expanded { grid-template-columns: minmax(0, 1fr); } .ql-card.is-expanded .ql-side { display: none; } }
.ql-side { background: var(--ql-side); padding: 6px 18px 18px; display: flex; flex-direction: column; min-width: 0; }
.ql-dbs { display: flex; flex-direction: column; gap: 6px; }
.ql-db { text-align: left; font: inherit; cursor: pointer; display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--radius); border: 0; background: transparent; color: var(--fg-2); transition: background 150ms; }
.ql-db:hover { background: var(--arctic); }
.ql-db.sel { background: var(--envoy-red-tint, #fff1f0); }
.ql-db.sel strong { color: var(--envoy-red-hover, #e23c32); }
.ql-db.sel .ds-ico { background: #fff; color: var(--envoy-red, #fa4338); }
.ql-db strong { display: block; font-size: 14px; color: var(--fg-1); }
.ql-db small { display: block; font-size: 11.5px; color: var(--fg-3); }
.ql-filter { min-height: 34px; padding: 6px 10px; font-size: 13px; }
.ql-tables { margin-top: 8px; overflow: auto; flex: 1; min-height: 120px; display: flex; flex-direction: column; overscroll-behavior: contain; }
.ql-table { text-align: left; font: inherit; font-size: 12.5px; cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 5px 6px; border: 0; background: transparent; color: var(--ql-fg); border-radius: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.ql-table:hover { background: var(--ql-hover); }
.ql-table svg { color: var(--fg-4, #8a8f9e); flex-shrink: 0; }
.ql-schema { color: var(--fg-3); }
.ql-main { border-left: 1px solid var(--ql-border); min-width: 0; display: flex; flex-direction: column; padding: 16px; gap: 12px; }
.ql-editor-legacy { display: block; width: 100%; box-sizing: border-box; min-height: 200px; resize: vertical; border: 0; outline: none; border-radius: var(--radius); padding: 14px 16px; background: #0f1724; color: #dbe4f0; caret-color: #fff; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.6; tab-size: 2; }
.ql-editor-legacy:focus { box-shadow: inset 0 0 0 2px rgba(250, 67, 56, 0.5); }
.ql-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
/* The toolbar is the editor's header: one bordered unit, tools on the left, Run on the right. */
.ql-edwrap { display: flex; flex-direction: column; border: 1px solid var(--ql-border); border-radius: var(--radius); overflow: hidden; background: var(--ql-ed-bg); }
.ql-edwrap > .ql-bar { gap: 6px; padding: 5px 8px 5px 10px; background: var(--ql-head, var(--arctic)); border-bottom: 1px solid var(--ql-border); }
.ql-edwrap > .ql-editor-host { flex: 1 1 auto; border: 0; border-radius: 0; }
.ql-card:focus-within .ql-edwrap:focus-within { border-color: var(--envoy-red); box-shadow: 0 0 0 2px rgba(250, 67, 56, 0.12); }
.ql-edwrap .ql-bar .small-btn { padding: 4px 10px; font-size: 12.5px; }
/* Format, Undo format, Save and Share are icon-only (name in the tooltip). */
.ql-bar .ql-ibtn { display: inline-flex; align-items: center; justify-content: center; padding: 5px; border: 0; border-radius: 6px; background: none; color: var(--ql-fg3, var(--fg-3)); cursor: pointer; }
.ql-bar .ql-ibtn svg { stroke-width: 1.5; }
.ql-edwrap .ql-bar [data-act="run"] { padding-left: 14px; padding-right: 14px; margin-left: 4px; }
.ql-bar .ql-ibtn:hover, .ql-bar .ql-ibtn:focus-visible { background: var(--ql-hover, var(--arctic)); color: var(--ql-fg, var(--fg-1)); outline: none; }
.ql-bar .ql-ibtn.hidden { display: none; }
.ql-bar .ql-ticon { padding: 5px; }
.ql-bar .ql-ticon:first-of-type { margin-left: 2px; }
.ql-tabs .ql-tabs-share { margin-bottom: 4px; padding: 6px; }
.ql-grow { flex: 1; }
.ql-kbd { font-size: 12px; }
.ql-out { min-height: 160px; }
/* Before the first run there's nothing to show: don't hold space for results. */
.ql-out:empty { min-height: 0; }
.ql-hint { padding: 14px 2px; }
.ql-grid-wrap { overflow: auto; max-height: 60vh; border: 1px solid var(--ql-border); border-radius: var(--radius); }
.ql-grid { border-collapse: separate; border-spacing: 0; font-size: 12.5px; width: max-content; min-width: 100%; }
.ql-grid th, .ql-grid td { padding: 7px 12px; border-bottom: 1px solid var(--ql-subtle); text-align: left; white-space: nowrap; max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
.ql-grid thead th { position: sticky; top: 0; background: var(--ql-head); color: var(--ql-fg); font-weight: var(--fw-semibold, 600); z-index: 1; }
.ql-grid td { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ql-fg2); }
.ql-grid tbody tr:hover td { background: var(--ql-hover); }
.ql-rn { color: var(--fg-4, #8a8f9e) !important; text-align: right !important; }
.ql-null { color: var(--fg-4, #8a8f9e); font-style: italic; }
.ql-empty { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 48px 24px; }
.ql-empty h3 { margin: 6px 0 0; font-size: 19px; color: var(--fg-1); }
.ql-empty p { margin: 0; color: var(--fg-3); }
/* Narrow: pickers above the editor, full width (never a half-empty card). */
@media (max-width: 1000px) { .ql-card { grid-template-columns: minmax(0, 1fr); } .ql-side { border-right: 0; border-bottom: 1px solid var(--border-subtle); } }

/* Cascading pickers (Cloud › Server › Database › Schema) and context line */
.ql-field .ds-label { margin-top: 14px; }
.ql-field:first-child .ds-label { margin-top: 8px; }
.ql-tables-field { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.ql-tables-head { display: flex; align-items: baseline; justify-content: space-between; }
.ql-count { font-size: 12px; color: var(--fg-3); }
.ql-tname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ql-badge { margin-left: auto; font-family: inherit; font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 999px; background: var(--arctic); color: var(--fg-3); }
.ql-ctx { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ql-fg2); min-height: 28px; }
.ql-ctx svg { color: var(--envoy-red, #fa4338); flex-shrink: 0; }
.ql-sep { color: var(--fg-4, #8a8f9e); margin: 0 2px; }

/* Scope: Cloud › Server › Database › Schema behind one button */
.ql-scope { position: relative; margin: 12px 0 4px; }
.ql-scope-btn { width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 10px; box-sizing: border-box; font: inherit; text-align: left; color: var(--ql-fg); background: var(--ql-bg); border: 1px solid var(--ql-border); border-radius: var(--radius-sm); cursor: pointer; }
.ql-scope-btn:hover { border-color: var(--fg-4, #b7bbc6); }
.ql-scope-btn:focus-visible, .ql-scope.is-open .ql-scope-btn { outline: none; border-color: var(--envoy-red); box-shadow: 0 0 0 2px rgba(250, 67, 56, 0.12); }
.ql-scope-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ql-scope-top { font-size: 11.5px; color: var(--ql-fg3, var(--fg-3)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ql-scope-main { font-size: 13.5px; font-weight: var(--fw-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ql-scope.is-open > .ql-scope-btn .ql-combo-chev { transform: rotate(180deg); }
.ql-scope-pop { display: none; position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px); padding: 4px 10px 10px; background: var(--ql-bg, #fff); border: 1px solid var(--ql-border, var(--border)); border-radius: var(--radius-md, 10px); box-shadow: 0 12px 28px -8px rgba(31, 35, 45, 0.18); }
.ql-scope.is-open .ql-scope-pop { display: block; }
.ql-scope-pop .ql-field .ds-label { margin: 10px 0 4px; font-size: 10.5px; }
.ql-scope-pop .ql-field:first-child .ds-label { margin-top: 6px; }
.ql-scope-pop .ql-combo { min-height: 30px; padding: 5px 9px; }

/* Query Lab searchable picker */
.ql-field { position: relative; }
.ql-count { float: right; font-weight: 400; color: var(--fg-3); letter-spacing: 0; text-transform: none; }
.ql-combo { width: 100%; min-height: 36px; display: flex; align-items: center; gap: 8px; padding: 8px 10px; box-sizing: border-box; font: inherit; font-size: 13px; color: var(--ql-fg); background: var(--ql-bg); border: 1px solid var(--ql-border); border-radius: var(--radius-sm); cursor: pointer; text-align: left; }
.ql-combo:hover:not(:disabled) { border-color: var(--fg-4, #b7bbc6); }
.ql-combo:focus-visible, .ql-combo[aria-expanded="true"] { outline: none; border-color: var(--envoy-red); box-shadow: 0 0 0 2px rgba(250, 67, 56, 0.12); }
.ql-combo:disabled { cursor: default; color: var(--ql-fg3); background: var(--ql-hover); }
.ql-combo.is-empty .ql-combo-text { color: var(--fg-3); }
.ql-combo-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ql-combo-chev { flex: none; color: var(--fg-3); transition: transform 0.15s; }
.ql-combo[aria-expanded="true"] .ql-combo-chev { transform: rotate(180deg); }
.ql-combo .ds-spin { width: 12px; height: 12px; }
.ql-pop { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px); background: var(--ql-bg, #fff); border: 1px solid var(--ql-border, var(--border)); border-radius: var(--radius-md, 10px); box-shadow: 0 12px 28px -8px rgba(31, 35, 45, 0.18); overflow: hidden; }
.ql-pop-search { display: block; width: 100%; box-sizing: border-box; border: 0; border-bottom: 1px solid var(--ql-subtle, #ebebf0); padding: 10px 12px; font: inherit; font-size: 13px; color: var(--ql-fg, var(--fg-1)); background: transparent; outline: none; }
.ql-pop-search::placeholder { color: var(--fg-4, #8a8f9e); }
.ql-pop-list { list-style: none; margin: 0; padding: 4px; max-height: 280px; overflow-y: auto; }
.ql-opt { padding: 7px 10px; border-radius: 6px; font-size: 13px; color: var(--ql-fg, var(--fg-1)); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ql-opt.is-active, .ql-saved-opt:hover { background: var(--ql-hover, #f6f6f9); }
.ql-opt.is-selected { color: var(--envoy-red); font-weight: var(--fw-bold, 600); }
.ql-opt-more { padding: 8px 10px; font-size: 12px; color: var(--fg-3); }

/* Labels, inputs and muted text follow the card theme */
.ql-card .ds-label, .ql-card .ql-count { color: var(--ql-fg2); }
.ql-card .ds-muted, .ql-card .ql-hint { color: var(--ql-fg3); }
.ql-card .ds-input { background: var(--ql-bg); color: var(--ql-fg); border-color: var(--ql-border); }
.ql-card .ql-badge { background: var(--ql-hover); color: var(--ql-fg3); }
.ql-card .ql-sep, .ql-card .ql-rn, .ql-card .ql-null { color: var(--ql-fg4) !important; }
.ql-card .secondary-btn { background: var(--ql-bg); color: var(--ql-fg); border-color: var(--ql-border); }
.ql-card .secondary-btn:hover:not(:disabled) { background: var(--ql-hover); }
.ql-card code { font-size: 12px; padding: 1px 4px; border-radius: 4px; background: var(--ql-hover); color: var(--ql-fg); }

/* Header: Saved, theme, Connections */
.ql-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ql-head-actions { display: flex; align-items: center; gap: 8px; padding-top: 6px; }
.ql-hbtn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.ql-seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--arctic, #f1f3f6); border: 1px solid var(--border); }
.ql-seg-btn { display: inline-flex; align-items: center; gap: 5px; border: 0; background: transparent; color: var(--fg-3); font: inherit; font-size: 12.5px; padding: 5px 11px; border-radius: 999px; cursor: pointer; }
.ql-seg-btn.is-on { background: #fff; color: var(--fg-1); box-shadow: 0 1px 2px rgba(31, 35, 45, 0.12); font-weight: 600; }
.ql-saved-wrap { position: relative; }
.ql-saved-pop { left: auto; right: 0; width: 340px; }
.ql-saved-opt { display: flex; flex-direction: column; gap: 2px; white-space: normal; }
.ql-saved-title { font-weight: 600; }
.ql-saved-meta { font-size: 11.5px; color: var(--ql-fg3, var(--fg-3)); }
.ql-saved-name { display: inline-flex; align-items: center; gap: 5px; margin-left: 6px; white-space: nowrap; max-width: 45%; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: var(--envoy-red-tint, #fff1f0); color: var(--envoy-red-hover, #e23c32); }
.ql-ctx-path { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex-shrink: 1; }
.ql-fs-btn { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 8px; border: 0; background: transparent; color: var(--ql-fg3); font: inherit; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.ql-fs-btn:hover { background: var(--ql-hover); color: var(--ql-fg); }
.ql-fs-btn kbd { font: inherit; font-size: 11px; color: var(--ql-fg4); border: 1px solid var(--ql-border); border-radius: 4px; padding: 0 4px; }

/* Editor (CodeMirror) */
.ql-editor-host { border: 1px solid var(--ql-border); border-radius: var(--radius); overflow: hidden; background: var(--ql-ed-bg); min-height: 120px; }
.ql-editor-host .ds-loading, .ql-editor-host .ds-error { padding: 14px; }
.ql-editor-host .CodeMirror { height: 100%; background: var(--ql-ed-bg); color: var(--ql-ed-fg); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.6; }
.ql-editor-host .CodeMirror-gutters { background: var(--ql-ed-gutter); border-right: 1px solid var(--ql-subtle); }
.ql-editor-host .CodeMirror-linenumber { color: var(--ql-ed-ln); padding: 0 8px 0 6px; }
.ql-editor-host .CodeMirror-cursor { border-left: 2px solid var(--envoy-red, #fa4338); }
.ql-editor-host .CodeMirror-selected, .ql-editor-host .CodeMirror-focused .CodeMirror-selected { background: var(--ql-ed-sel); }
.ql-editor-host .CodeMirror-lines { padding: 10px 0; }
.ql-editor-host .CodeMirror pre.CodeMirror-placeholder { color: var(--ql-ed-ln); }
.ql-editor-host .cm-s-default .cm-keyword { color: var(--ql-kw); font-weight: 600; }
.ql-editor-host .cm-s-default .cm-string, .ql-editor-host .cm-s-default .cm-string-2 { color: var(--ql-str); }
.ql-editor-host .cm-s-default .cm-number { color: var(--ql-num); }
.ql-editor-host .cm-s-default .cm-comment { color: var(--ql-com); font-style: italic; }
.ql-editor-host .cm-s-default .cm-builtin, .ql-editor-host .cm-s-default .cm-type { color: var(--ql-fn); }
.ql-editor-host .cm-s-default .cm-atom { color: var(--ql-num); }
.ql-editor-host .cm-s-default .cm-operator, .ql-editor-host .cm-s-default .cm-variable, .ql-editor-host .cm-s-default .cm-variable-2, .ql-editor-host .cm-s-default .cm-variable-3, .ql-editor-host .cm-s-default .cm-def, .ql-editor-host .cm-s-default .cm-bracket { color: var(--ql-ed-fg); }
.ql-editor-host .CodeMirror-matchingbracket { color: var(--ql-ed-fg) !important; background: var(--ql-ed-sel); }
.ql-card:focus-within .ql-editor-host:not(.ql-edwrap > *):focus-within { border-color: var(--envoy-red); box-shadow: 0 0 0 2px rgba(250, 67, 56, 0.12); }
.ql-resize { height: 12px; margin: -6px 0; cursor: row-resize; position: relative; touch-action: none; }
.ql-resize::after { content: ''; position: absolute; left: 0; right: 0; top: 5px; height: 2px; border-radius: 2px; background: transparent; transition: background 0.15s; }
.ql-resize:hover::after, .ql-resize.is-dragging::after { background: var(--envoy-red, #fa4338); }

/* Autocomplete list (rendered on <body>; body.ql-hints-dark follows the Query Lab theme) */
ul.CodeMirror-hints { z-index: 400; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: #fff; border: 1px solid var(--border, #ebebf0); border-radius: 8px; box-shadow: 0 12px 28px -8px rgba(31, 35, 45, 0.2); padding: 4px; max-height: 240px; }
ul.CodeMirror-hints li.CodeMirror-hint { padding: 4px 8px; border-radius: 5px; color: var(--fg-1, #1f232d); }
ul.CodeMirror-hints li.CodeMirror-hint-active { background: var(--envoy-red, #fa4338); color: #fff; }
body.ql-hints-dark ul.CodeMirror-hints { background: #151922; border-color: #272d3a; box-shadow: 0 12px 28px -8px rgba(0, 0, 0, 0.6); }
body.ql-hints-dark ul.CodeMirror-hints li.CodeMirror-hint { color: #e6e9ef; }
body.ql-hints-dark ul.CodeMirror-hints li.CodeMirror-hint-active { background: var(--envoy-red, #fa4338); color: #fff; }

/* Schema tree: tables expand to their columns */
.ql-trow { display: flex; align-items: center; border-radius: 6px; }
.ql-trow:hover { background: var(--ql-hover); }
.ql-trow .ql-table { flex: 1; min-width: 0; background: transparent !important; }
.ql-tname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ql-tchev { display: inline-flex; color: var(--ql-fg4); transition: transform 0.15s; }
.ql-trow.is-open .ql-tchev { transform: rotate(90deg); color: var(--ql-fg2); }
.ql-tins { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin-right: 2px; border: 0; border-radius: 5px; background: transparent; color: var(--ql-fg3); cursor: pointer; opacity: 0; }
.ql-trow:hover .ql-tins, .ql-tins:focus-visible { opacity: 1; }
.ql-tins:hover { background: var(--ql-bg); color: var(--envoy-red, #fa4338); }
.ql-cols { margin: 0 0 4px 22px; padding-left: 10px; border-left: 1px solid var(--ql-subtle); display: flex; flex-direction: column; }
.ql-col { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 3px 6px; border: 0; border-radius: 5px; background: transparent; cursor: pointer; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--ql-fg2); text-align: left; }
.ql-col:hover { background: var(--ql-hover); color: var(--ql-fg); }
.ql-col-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ql-col-type { flex: none; font-size: 11px; color: var(--ql-fg4); }

/* Connections: what Query Lab shows per server */
.ds-scope-btn { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; max-width: 100%; padding: 3px 8px; border: 1px solid var(--border); border-radius: 999px; background: #fff; color: var(--fg-2); font: inherit; font-size: 12px; cursor: pointer; }
.ds-scope-btn span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ds-scope-btn svg { color: var(--fg-4, #8a8f9e); flex: none; }
.ds-scope-edit { color: var(--envoy-red, #fa4338); font-weight: 600; flex: none; }
.ds-scope-btn:hover { border-color: var(--fg-4, #b7bbc6); }
.ds-sc-mode { margin-bottom: 14px; }
.modal-overlay > .modal.ds-scope-modal { width: min(820px, calc(100vw - 32px)); max-width: min(820px, calc(100vw - 32px)); }
.ds-sc-wrap { display: grid; grid-template-columns: 230px minmax(0, 1fr); border: 1px solid var(--border); border-radius: var(--radius); height: min(420px, 52vh); overflow: hidden; }
.ds-sc-list { border-right: 1px solid var(--border); overflow-y: auto; background: #fff; }
.ds-sc-db { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--border-subtle, #ebebf0); }
.ds-sc-db:hover { background: var(--arctic, #f6f6f9); }
.ds-sc-db.is-open { background: var(--envoy-red-tint, #fff1f0); box-shadow: inset 3px 0 0 var(--envoy-red, #fa4338); }
.ds-sc-db input { accent-color: var(--envoy-red, #fa4338); width: 15px; height: 15px; flex: none; cursor: pointer; }
.ds-sc-db-text { display: flex; flex-direction: column; min-width: 0; }
.ds-sc-name { font-weight: 600; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; color: var(--fg-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-sc-sub { font-size: 11.5px; color: var(--fg-3); }
.ds-sc-db:not(.is-on) .ds-sc-name { color: var(--fg-3); font-weight: 500; }
.ds-sc-pane { overflow: hidden; display: flex; flex-direction: column; background: var(--arctic, #f6f6f9); }
.ds-sc-empty { margin: auto; padding: 24px; text-align: center; max-width: 280px; }
.ds-sc-schemas-box { display: flex; flex-direction: column; min-height: 0; flex: 1; padding: 12px 14px; }
.ds-sc-pane-title { font-weight: 600; font-size: 13px; color: var(--fg-1); margin-bottom: 8px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.ds-sc-check { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--fg-1); cursor: pointer; min-width: 0; }
.ds-sc-check input { accent-color: var(--envoy-red, #fa4338); width: 15px; height: 15px; flex: none; }
.ds-sc-all { margin-bottom: 10px; }
.ds-sc-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-bottom: 8px; }
.ds-sc-filter { flex: 1 0 100%; width: 100%; box-sizing: border-box; margin: 0 !important; }
.ds-sc-count { font-size: 12px; color: var(--fg-3); white-space: nowrap; }
.ds-sc-schema-list { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); align-content: start; gap: 6px 14px; padding: 4px 2px; }
.ds-sc-schema-list .ds-sc-check span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
@media (max-width: 640px) { .ds-sc-wrap { grid-template-columns: minmax(0, 1fr); height: auto; } .ds-sc-list { max-height: 200px; border-right: 0; border-bottom: 1px solid var(--border); } .ds-sc-pane { min-height: 260px; } }
.ds-sc-note { margin-top: 14px; }

/* Save dialog */
.ql-save-body { padding: 4px 24px 8px; }
.ql-save-body .ds-label:first-child { margin-top: 4px; }
.ql-save-folder-row { display: flex; align-items: center; gap: 12px; }
.ql-save-folder-row .admin-select { flex: 1; }

/* Sidebar: Documents */
.doc-nav-count { margin-left: auto; font-size: 11.5px; color: var(--fg-4, #8a8f9e); }


/* Documents page */
.doc-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.doc-header .templates-title { display: inline-flex; align-items: center; gap: 10px; }
.doc-header .templates-title svg { color: var(--fg-3); }
.doc-head-actions { display: flex; align-items: center; gap: 8px; padding-top: 6px; }
.doc-head-actions .primary-btn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.ds-danger-btn { color: var(--envoy-red-hover, #e23c32) !important; }
.doc-body { max-width: var(--content-max); }
.doc-table th:nth-child(1) { width: 38%; }
.doc-name { display: inline-flex; align-items: center; gap: 8px; color: var(--fg-1); font-weight: 600; text-decoration: none; }
.doc-name svg { color: var(--fg-4, #8a8f9e); flex: none; }
.doc-name:hover span { color: var(--envoy-red, #fa4338); }
.doc-muted { color: var(--fg-3); font-size: 13px; }
.doc-owner { display: flex; align-items: center; gap: 8px; margin: 22px 0 8px; font-weight: 600; font-size: 13.5px; color: var(--fg-1); }
.doc-owner:first-child { margin-top: 4px; }
.doc-owner svg { color: var(--fg-3); }
.doc-owner-n { font-weight: 500; font-size: 12px; color: var(--fg-3); }
.doc-menu-wrap { position: relative; display: inline-block; }
.doc-menu-btn { padding: 0 6px; }
.doc-menu { position: fixed !important; width: 220px; padding: 4px; text-align: left; z-index: 200; max-height: 70vh; overflow-y: auto; }
.doc-menu button { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; font: inherit; font-size: 13px; color: var(--fg-1); padding: 7px 10px; border-radius: 6px; cursor: pointer; text-align: left; }
.doc-menu button:hover:not(:disabled) { background: var(--arctic, #f6f6f9); }
.doc-menu button:disabled { color: var(--fg-4, #8a8f9e); cursor: default; }
.doc-menu button.is-danger { color: var(--envoy-red-hover, #e23c32); }
.doc-menu-sep { height: 1px; background: var(--border-subtle, #ebebf0); margin: 4px 2px; }
.doc-menu-label { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-3); padding: 6px 10px 2px; }

/* Documents tree in the sidebar: chevron inside the row on the right (like Query Lab) */
.doc-nav-row { position: relative; display: flex; align-items: center; padding-left: calc(var(--depth, 0) * 14px); }
.doc-nav-row .doc-nav-link { flex: 1; min-width: 0; padding-right: 12px; }
.doc-nav-row.has-chev .doc-nav-link { padding-right: 34px; }
.doc-nav-row .sidebar-nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.doc-nav-chev { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border: 0; background: none; padding: 0; color: var(--fg-3); cursor: pointer; border-radius: 5px; z-index: 1; }
.doc-nav-chev svg { transform: rotate(90deg); transition: transform 0.15s; }
.doc-nav-chev.is-closed svg { transform: none; }
.doc-nav-chev:hover { color: var(--fg-1); background: rgba(0, 0, 0, 0.05); }
.doc-nav-row.active .doc-nav-chev { color: var(--envoy-red, #fa4338); }
.doc-nav-add { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border: 0; border-radius: 5px; background: transparent; color: var(--fg-3); cursor: pointer; opacity: 0; z-index: 1; }
.doc-nav-row.has-chev .doc-nav-add { right: 30px; }
.doc-nav-row.has-chev .doc-nav-count { margin-right: 22px; }
.doc-nav-row:hover .doc-nav-add, .doc-nav-add:focus-visible { opacity: 1; }
.doc-nav-row:hover .doc-nav-count { visibility: hidden; }
.doc-nav-add:hover { background: #fff; color: var(--envoy-red, #fa4338); box-shadow: 0 0 0 1px var(--border); }

/* Folder page: path and subfolders */
.doc-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; color: var(--fg-3); margin-bottom: 6px; }
.doc-crumbs a { color: var(--fg-3); text-decoration: none; }
.doc-crumbs a:hover { color: var(--envoy-red, #fa4338); }
.doc-subs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 16px; }
.doc-sub { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); color: var(--fg-1); text-decoration: none; font-weight: 600; font-size: 13.5px; min-width: 0; }
.doc-sub:hover { border-color: var(--fg-4, #b7bbc6); box-shadow: 0 2px 8px -4px rgba(31, 35, 45, 0.15); }
.doc-sub svg { color: var(--fg-3); flex: none; }
.doc-sub-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.doc-sub-n { font-size: 12px; font-weight: 500; color: var(--fg-3); }
.doc-empty-line { margin-top: 4px; }

/* Quarry dialogs (prompt/confirm replacements) */
.modal-overlay > .modal.vd-dlg { width: min(460px, calc(100vw - 32px)); max-width: min(460px, calc(100vw - 32px)); }
.vd-dlg .modal-header { position: relative; }
.vd-dlg-ico { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; background: var(--envoy-red-tint, #fff1f0); color: var(--envoy-red, #fa4338); margin-bottom: 10px; }
.vd-dlg-body { padding: 0 24px 4px; }
.vd-dlg-body .ds-label { margin-top: 2px; }
.vd-dlg-body .modal-input { width: 100%; box-sizing: border-box; }
.primary-btn.vd-danger { background: var(--envoy-red-hover, #e23c32); }
.ql-save-newfolder { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.ql-save-newfolder .modal-input { flex: 1; min-width: 0; margin: 0; }
.ql-save-newfolder.hidden { display: none; }

/* Ask AI */
.ql-ai { display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 12px; border-radius: 12px; border: 1px solid var(--ql-border); background: var(--ql-bg); box-shadow: 0 1px 0 rgba(31,35,45,0.02); transition: border-color 0.15s, box-shadow 0.15s; }
.ql-ai:focus-within { border-color: var(--envoy-red, #fa4338); box-shadow: 0 0 0 3px rgba(250, 67, 56, 0.12); }
.ql-ai.is-busy { background: linear-gradient(90deg, var(--ql-bg), var(--envoy-red-tint, #fff1f0), var(--ql-bg)); background-size: 200% 100%; animation: ql-ai-shimmer 2.2s linear infinite; }
@keyframes ql-ai-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .ql-ai.is-busy { animation: none; } }
.ql-ai-ico { display: inline-flex; color: var(--envoy-red, #fa4338); flex: none; align-self: flex-start; margin-top: 9px; }
.ql-ai-input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font: inherit; font-size: 14px; line-height: 1.5; color: var(--ql-fg); padding: 6px 2px; resize: vertical; min-height: 33px; max-height: 60vh; overflow-y: auto; }
.ql-ai-input::placeholder { color: var(--ql-fg4); }
.ql-ai-go { flex: none; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; width: auto !important; max-width: 50%; }
.ql-ai-phase { overflow: hidden; text-overflow: ellipsis; }
.ql-ai-go .ds-spin { width: 12px; height: 12px; border-color: rgba(255,255,255,0.4); border-top-color: #fff; }
.ql-ai-err { margin: -4px 0 0; }
.ql-card[data-theme="dark"] .ql-sum { background: #2a1d22; }
.ql-err-box { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.ql-sum { margin-bottom: 12px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--ql-border); background: var(--envoy-red-tint, #fff8f7); }
.ql-sum-cta { padding: 0; border: 0; background: none !important; margin-bottom: 8px; }
.ql-sum-cta .ql-fs-btn { color: var(--envoy-red, #fa4338); padding-left: 2px; }
.ql-sum-head { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--envoy-red-hover, #e23c32); margin-bottom: 6px; }
.ql-sum ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; line-height: 1.5; color: var(--ql-fg); }
.ql-sum strong { font-weight: 650; }
/* Connections: chips and AI notes */
.ds-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.modal-overlay > .modal.ds-notes-modal { width: min(640px, calc(100vw - 32px)); max-width: min(640px, calc(100vw - 32px)); }
.ds-notes { min-height: 220px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.55; }
.ds-notes-count { text-align: right; margin-top: 4px; }

/* Tables picker: sections, groups, show all */
.ql-tsec-label { font-size: 10.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ql-fg4); padding: 10px 6px 4px; }
.ql-tsec-label:first-child { padding-top: 2px; }
.ql-tgroup { display: flex; align-items: center; gap: 6px; width: 100%; padding: 6px 6px; border: 0; border-radius: 6px; background: transparent; font: inherit; font-size: 13px; font-weight: 600; color: var(--ql-fg); cursor: pointer; text-align: left; }
.ql-tgroup:hover { background: var(--ql-hover); }
.ql-tgroup .ql-tchev { transition: transform 0.15s; }
.ql-tgroup.is-open .ql-tchev { transform: rotate(90deg); color: var(--ql-fg2); }
.ql-tgroup-name { flex: 1; min-width: 0; }
.ql-tgroup-n { font-size: 11.5px; font-weight: 500; color: var(--ql-fg4); }
.ql-tgroup-body { padding-left: 10px; margin-bottom: 4px; }
.ql-tmore { align-self: flex-start; margin: 2px 0 6px 28px; padding: 3px 6px; border: 0; border-radius: 5px; background: none; font: inherit; font-size: 12px; font-weight: 600; color: var(--envoy-red, #fa4338); cursor: pointer; }
.ql-tmore:hover { background: var(--ql-hover); }
.ql-trow.is-undoc .ql-tname { color: var(--ql-fg3); }
.ql-layer { text-transform: lowercase; }

.ql-ai-expand { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; margin-bottom: 2px; border: 0; border-radius: 7px; background: transparent; color: var(--ql-fg3); cursor: pointer; }
.ql-ai-expand:hover:not(:disabled) { background: var(--ql-hover); color: var(--ql-fg); }
.ql-ai-go { margin-bottom: 0; }
/* Ask AI bar: no resize grabber (it grows as you type), light thin icons, an Ask AI the size of Run. */
.ql-ai-input { resize: none; }
.ql-ai .ql-ai-expand { width: 28px; height: 28px; color: var(--ql-fg3, var(--fg-3)); }
.ql-ai .ql-ai-expand svg { stroke-width: 1.5; }
.ql-ai .ql-ai-go { padding: 5px 14px; font-size: 12.5px; }
.modal-overlay > .modal.ql-ai-modal { width: min(1080px, calc(100vw - 32px)); max-width: min(1080px, calc(100vw - 32px)); padding: 0; overflow: hidden; }
.ql-ai-big { width: 100%; box-sizing: border-box; min-height: 34vh; resize: vertical; font-size: 15px; line-height: 1.6; padding: 14px 16px; }
.ql-ai-big-hint { margin: 0; }

/* AI thread: steps, versions, follow-ups */
.ql-thread { border-radius: 12px; background: var(--envoy-red-tint, #fff6f5); border: 1px solid rgba(250, 67, 56, 0.14); padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.ql-card[data-theme="dark"] .ql-thread { background: #241a1e; border-color: rgba(255, 123, 114, 0.18); }
.ql-thread-head { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--envoy-red-hover, #e23c32); }
.ql-thread-head .ql-fs-btn { text-transform: none; letter-spacing: 0; font-weight: 600; height: 24px; }
.ql-thread-more { align-self: flex-start; border: 0; background: none; padding: 0 2px; font: inherit; font-size: 12px; color: var(--ql-fg3); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.ql-step { display: flex; flex-direction: column; gap: 4px; padding: 6px 0; border-top: 1px dashed rgba(250, 67, 56, 0.16); }
.ql-thread-head + .ql-step, .ql-thread-more + .ql-step { border-top: 0; }
.ql-step-ask { display: flex; align-items: baseline; gap: 8px; font-size: 13px; color: var(--ql-fg2); }
.ql-step-you { flex: none; font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ql-fg4); width: 26px; }
.ql-step-prompt { white-space: pre-wrap; min-width: 0; }
.ql-step-ans { display: flex; align-items: flex-start; gap: 8px; }
.ql-step-v { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 20px; padding: 0 5px; box-sizing: border-box; border-radius: 6px; font-size: 11px; font-weight: 700; background: var(--ql-bg); color: var(--ql-fg3); border: 1px solid var(--ql-border); margin-top: 1px; }
.ql-step.is-active .ql-step-v { background: var(--envoy-red, #fa4338); color: #fff; border-color: var(--envoy-red, #fa4338); }
.ql-step-v .ds-spin { width: 10px; height: 10px; }
.ql-step-text { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.5; color: var(--ql-fg); }
.ql-step:not(.is-active) .ql-step-text { color: var(--ql-fg2); }
.ql-step-phase { color: var(--ql-fg3); font-style: italic; }
.ql-step-cur { flex: none; font-size: 11px; font-weight: 600; color: var(--envoy-red-hover, #e23c32); margin-top: 3px; }
.ql-step-restore { flex: none; height: 24px; margin-top: -2px; }
.ql-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0 2px 34px; }
.ql-chip { border: 1px solid rgba(250, 67, 56, 0.28); background: var(--ql-bg); color: var(--envoy-red-hover, #e23c32); font: inherit; font-size: 12.5px; padding: 4px 10px; border-radius: 999px; cursor: pointer; }
.ql-chip:hover { background: var(--envoy-red, #fa4338); color: #fff; border-color: var(--envoy-red, #fa4338); }
.ql-thread-note { margin: 0 0 0 34px; font-size: 12px; color: var(--ql-fg3); }
.ql-ai-follow { margin-left: 34px; background: var(--ql-bg); }
.ql-ai-follow .ql-ai-ico { color: var(--ql-fg4); }
@media (max-width: 640px) { .ql-chips, .ql-thread-note, .ql-ai-follow { margin-left: 0; padding-left: 0; } }

/* The pickers column stays put while the editor and results scroll past it
   (sticky, sized to the window); the tables list scrolls inside it. */
.ql-card:not(.is-expanded) .ql-side { position: sticky; top: 12px; align-self: start; max-height: calc(100vh - 24px); overflow: hidden; box-sizing: border-box; border-radius: var(--radius-lg, 14px) 0 0 var(--radius-lg, 14px); }
.ql-card:not(.is-expanded) .ql-side .ql-tables-field { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ql-card.is-expanded .ql-main { border-left: 1px solid var(--ql-border); }
@media (max-width: 1000px) { .ql-card:not(.is-expanded) .ql-side { position: static; height: auto; max-height: none; overflow: visible; border-radius: 0; } .ql-main { border-left: 0; } .ql-card:not(.is-expanded) .ql-side .ql-tables { max-height: 360px; } }
/* overflow: hidden (from .main-card) makes the card a scroll container, which
   stops position: sticky; clip still rounds the corners without that. */
.main-card.ql-card:not(.is-expanded) { overflow: clip; }

/* Console fits the window: the card takes the height left under the header,
   the editor grows into spare space, and each column scrolls inside the card
   (results push the editor's column to scroll, not the page). */
@media (min-width: 1001px) {
  #screen-querylab:not(.hidden) { height: 100vh; box-sizing: border-box; display: flex; flex-direction: column; overflow: hidden; }
  #screen-querylab #querylab-root { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  #screen-querylab #querylab-root > .card-section { flex: 1; min-height: 0; display: flex; }
  #screen-querylab .main-card.ql-card:not(.is-expanded) { flex: 1; width: 100%; min-height: 420px; }
  .ql-card:not(.is-expanded) .ql-side { position: static; align-self: stretch; max-height: none; min-height: 0; }
  .ql-card:not(.is-expanded) .ql-main { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .ql-card:not(.is-expanded) .ql-main > * { flex-shrink: 0; }
  .ql-card:not(.is-expanded) .ql-main:has(> .ql-out:empty) > .ql-edwrap { flex-grow: 1; }
}

/* Shared query page */
.sq-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.sq-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; --ql-bg: #fff; --ql-border: var(--border); --ql-subtle: var(--border-subtle, #ebebf0); --ql-fg: var(--fg-1); --ql-fg2: var(--fg-2); --ql-fg3: var(--fg-3); --ql-fg4: var(--fg-4, #8a8f9e); --ql-head: var(--arctic, #f6f6f9); --ql-hover: var(--arctic, #f6f6f9); }
.sq-note { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 12.5px; color: var(--fg-3); }
.sq-sql summary { cursor: pointer; font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ql-fg3, var(--fg-3)); }
.sq-sql pre { margin: 8px 0 0; padding: 12px 14px; border-radius: var(--radius); background: var(--arctic, #f6f6f9); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; overflow-x: auto; }
.sq-card .ql-grid-wrap { border: 1px solid var(--border); }
.sq-card .ql-grid thead th { background: var(--arctic); }

/* Ask AI history */
.ql-ai-hist-wrap { position: relative; display: inline-flex; align-self: flex-end; }
.ql-hist-pop { left: auto !important; right: -40px; top: calc(100% + 8px); width: 380px; max-width: calc(100vw - 48px); }
.ql-hist-head { padding: 10px 12px 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ql-fg3, var(--fg-3)); }
.ql-hist-opt { display: flex; align-items: center; gap: 8px; white-space: normal; }
.ql-hist-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.ql-hist-text .ql-saved-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ql-hist-del { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border: 0; border-radius: 5px; background: transparent; color: var(--ql-fg4, #8a8f9e); cursor: pointer; opacity: 0; }
.ql-hist-opt:hover .ql-hist-del { opacity: 1; }
.ql-hist-del:hover { color: var(--envoy-red, #fa4338); background: var(--ql-bg, #fff); }

/* Full-window Ask AI: past conversations beside the composer */
.ql-aim { display: grid; grid-template-columns: 260px minmax(0, 1fr); max-height: calc(100vh - 64px); }
.ql-aim-side { border-right: 1px solid var(--border); background: var(--arctic, #f6f6f9); display: flex; flex-direction: column; min-height: 0; }
.ql-aim-list { overflow-y: auto; padding: 0 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.ql-aim-thread { display: flex; flex-direction: column; gap: 2px; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; font: inherit; cursor: pointer; color: var(--fg-1); }
.ql-aim-thread:hover { background: #fff; }
.ql-aim-thread.is-current { background: #fff; box-shadow: inset 3px 0 0 var(--envoy-red, #fa4338); }
.ql-aim-thread .ql-saved-title { font-size: 13px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ql-aim-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow-y: auto; }
.ql-aim-main .modal-title { display: flex; align-items: center; gap: 8px; }
.ql-aim-main .modal-title svg { color: var(--envoy-red, #fa4338); }
.ql-aim-ctx { margin: 0 24px 12px; padding: 10px 12px; border-radius: 10px; background: var(--envoy-red-tint, #fff6f5); display: flex; flex-direction: column; gap: 8px; max-height: 26vh; overflow-y: auto; }
.ql-aim-step { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.ql-aim-step .ql-step-v { --ql-bg: #fff; --ql-border: var(--border); --ql-fg3: var(--fg-3); }
.ql-aim-step .ql-step-v.is-cur { background: var(--envoy-red, #fa4338); color: #fff; border-color: var(--envoy-red, #fa4338); }
.ql-aim-ask { font-weight: 600; color: var(--fg-1); white-space: pre-wrap; }
.ql-aim-ans { color: var(--fg-2); }
.ql-aim-body { padding: 0 24px; }
@media (max-width: 760px) { .ql-aim { grid-template-columns: minmax(0, 1fr); } .ql-aim-side { display: none; } }

/* Query Lab pages: Console / Logs / Shared links, as tabs under each screen's header. */
.ql-pages { position: relative; display: flex; gap: 4px; margin: -18px 0 20px; border-bottom: 1px solid var(--border); }
.ql-pages a { padding: 8px 12px; font-size: 14px; font-weight: var(--fw-medium); color: var(--fg-3); text-decoration: none; transition: color 0.2s ease; }
.ql-pages a:hover { color: var(--fg-1); }
.ql-pages a.active { color: var(--envoy-red); }
.ql-pages-ind { position: absolute; left: 0; bottom: -1px; height: 2px; width: 0; background: var(--envoy-red); }
.ql-pages a:focus:not(:focus-visible) { outline: none; }

/* Query Lab › Logs */
.ql-logs-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.ql-logs-user { width: auto; min-width: 200px; }
.ql-logs-q { width: 280px; max-width: 100%; }
.ql-logs-table th:nth-child(1) { width: 110px; }
.ql-log { cursor: pointer; }
.ql-log:hover td { background: var(--arctic, #f6f6f9); }
.ql-log.is-open td { background: var(--arctic, #f6f6f9); border-bottom: 0; }
.ql-log-when { color: var(--fg-3); font-size: 13px; white-space: nowrap; }
.ql-log-user { font-size: 13px; color: var(--fg-2); white-space: nowrap; }
.ql-log-kind { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--fg-2); white-space: nowrap; }
.ql-log-kind svg { color: var(--envoy-red, #fa4338); }
.ql-log-kind.bad { color: var(--envoy-red-hover, #e23c32); }
.ql-log-title { font-weight: 600; color: var(--fg-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 640px; }
.ql-log-detail { font-size: 12.5px; color: var(--fg-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 640px; }
.ql-log-more td { background: var(--arctic, #f6f6f9); padding: 4px 18px 16px; }
.ql-log-sql { margin: 6px 0 10px; padding: 12px 14px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; max-height: 320px; overflow: auto; }
.ql-log-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ql-log-actions a { text-decoration: none; }
.ql-logs-table { table-layout: fixed; width: 100%; }
.ql-logs-table th:nth-child(1) { width: 104px; }
.ql-logs-table.has-who th:nth-child(2) { width: 230px; }
.ql-logs-table.has-who th:nth-child(3), .ql-logs-table:not(.has-who) th:nth-child(2) { width: 150px; }
.ql-log-title, .ql-log-detail, .ql-log-user { max-width: none; overflow: hidden; text-overflow: ellipsis; }
.ql-log-more td { overflow: hidden; }

.ql-logs-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ql-logs-head .templates-subtitle { max-width: 760px; }
.ql-logs-src { margin-top: 6px; }
.ql-log-untagged { font-style: italic; color: var(--fg-4, #8a8f9e); }

/* Logs: people picker */
.ql-people { position: relative; }
.ql-people-btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; font: inherit; font-size: 13.5px; color: var(--fg-1); cursor: pointer; max-width: 320px; }
.ql-people-btn:hover { border-color: var(--fg-4, #b7bbc6); }
.ql-people-btn > svg:first-child { color: var(--fg-3); }
.ql-people-btn > svg:last-child { color: var(--fg-3); transform: rotate(90deg); margin-left: 2px; }
.ql-people-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; font-weight: 500; }
.ql-people-n { font-size: 11.5px; font-weight: 600; color: var(--fg-3); background: var(--arctic, #f6f6f9); border-radius: 999px; padding: 1px 7px; }
.ql-people-pop { left: 0; right: auto; width: 300px; top: calc(100% + 6px); }
.ql-person { display: flex; align-items: center; gap: 10px; }
.ql-person-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ql-person-n { font-size: 11.5px; color: var(--fg-3); }
.ql-person.is-selected { color: var(--envoy-red-hover, #e23c32); font-weight: 600; }
.ql-av { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 999px; background: var(--envoy-red-tint, #fff1f0); color: var(--envoy-red-hover, #e23c32); font-size: 11px; font-weight: 700; }
.ql-av-all { background: var(--arctic, #f1f3f6); color: var(--fg-2); }

/* Logs: date range + failed only */
.ql-range-pop { left: 0; right: auto; width: 280px; top: calc(100% + 6px); }
.ql-range-custom { border-top: 1px solid var(--border-subtle, #ebebf0); padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.ql-range-custom .ql-hist-head { padding: 6px 0 0; }
.ql-range-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ql-range-row label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--fg-3); }
.ql-range-row .ds-input { min-height: 34px; padding: 6px 8px; font-size: 12.5px; }
.ql-range-custom .ds-btn { align-self: flex-end; }
.ql-failed { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; font-size: 13.5px; color: var(--fg-2); cursor: pointer; user-select: none; }
.ql-failed input { accent-color: var(--envoy-red, #fa4338); width: 15px; height: 15px; margin: 0; }
.ql-failed.is-on { border-color: rgba(250, 67, 56, 0.4); background: var(--envoy-red-tint, #fff1f0); color: var(--envoy-red-hover, #e23c32); font-weight: 600; }

/* Share sheet */
.modal-overlay > .modal.sh-modal { width: min(500px, calc(100vw - 32px)); max-width: min(500px, calc(100vw - 32px)); padding: 0; }
.sh { display: flex; flex-direction: column; }
.sh-head { padding: 20px 22px 12px; }
.sh-head .modal-title { margin: 0; }
.sh-snap { display: flex; align-items: flex-start; gap: 12px; margin: 0 22px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border-subtle, #ebebf0); background: #fff; }
.sh-snap-ico { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 9px; background: var(--envoy-red-tint, #fff1f0); color: var(--envoy-red, #fa4338); }
.sh-snap-text { flex: 1; min-width: 0; }
.sh-snap-title { font-weight: 600; font-size: 14px; color: var(--fg-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-snap-meta { font-size: 12.5px; color: var(--fg-3); margin-top: 3px; line-height: 1.45; }
.sh-link { display: flex; align-items: center; gap: 8px; margin: 14px 22px 0; padding: 4px 4px 4px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.sh-link:focus-within { border-color: var(--envoy-red, #fa4338); box-shadow: 0 0 0 3px rgba(250, 67, 56, 0.12); }
.sh-link-input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font: inherit; font-size: 13px; color: var(--fg-2); text-overflow: ellipsis; }
.sh-copy { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 8px; white-space: nowrap; }
.sh-copy.is-done { background: var(--envoy-red, #fa4338); border-color: var(--envoy-red, #fa4338); }
.sh-access { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 10px 22px 0; font-size: 12.5px; color: var(--fg-3); }
.sh-access > svg { color: var(--fg-3); }
.sh-dot { color: var(--fg-4, #8a8f9e); }
.sh-exp-wrap { position: relative; display: inline-flex; align-items: center; gap: 3px; color: var(--fg-2); font-weight: 600; cursor: pointer; border-radius: 6px; padding: 2px 4px; }
.sh-exp-wrap:hover { background: var(--arctic, #f6f6f9); color: var(--fg-1); }
.sh-exp-wrap > svg { transform: rotate(90deg); }
.sh-exp { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.sh-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding: 12px 22px; border-top: 1px solid var(--border-subtle, #ebebf0); }
.sh-remove { border: 0; background: none; padding: 6px 2px; font: inherit; font-size: 13px; font-weight: 600; color: var(--envoy-red-hover, #e23c32); cursor: pointer; }
.sh-remove:hover { text-decoration: underline; text-underline-offset: 3px; }
.sh-modal .sh-link .sh-copy { flex: none; width: auto !important; min-width: 0; margin: 0; }
.sh-modal .sh-link .sh-link-input { flex: 1 1 auto; width: auto !important; min-width: 0; padding: 0; height: auto; box-shadow: none; }
.sh-modal .sh-foot .secondary-btn, .sh-modal .sh-head .sh-x { width: auto !important; }

/* Share sheet: access picker + people */
.sh-acc-ico { display: inline-flex; color: var(--fg-3); }
.sh-people { margin: 10px 22px 0; }
.sh-people.hidden { display: none; }
.sh-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 8px; min-height: 40px; box-sizing: border-box; border: 1px solid var(--border); border-radius: 10px; background: #fff; cursor: text; }
.sh-chips:focus-within { border-color: var(--envoy-red, #fa4338); box-shadow: 0 0 0 3px rgba(250, 67, 56, 0.12); }
.sh-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 3px; border-radius: 999px; background: var(--arctic, #f6f6f9); font-size: 12.5px; color: var(--fg-1); }
.sh-chip .ql-av { width: 20px; height: 20px; font-size: 10.5px; }
.sh-chip button { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border: 0; border-radius: 999px; background: transparent; color: var(--fg-3); cursor: pointer; padding: 0; }
.sh-chip button:hover { background: #fff; color: var(--envoy-red, #fa4338); }
.sh-chip-input { flex: 1; min-width: 160px; border: 0; outline: none; background: transparent; font: inherit; font-size: 13px; color: var(--fg-1); padding: 4px 2px; }
.sh-modal .sh-chip-input { width: auto !important; height: auto; box-shadow: none; }
.sh-chip-input.is-bad { color: var(--envoy-red-hover, #e23c32); }
.sh-people-note { margin: 6px 2px 0; font-size: 12px; color: var(--fg-3); }

/* Share sheet: access panel */
.sh-panel { margin: 14px 22px 0; border: 1px solid var(--border-subtle, #ebebf0); border-radius: 12px; padding: 4px 0; }
.sh-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px 8px 14px; }
.sh-row + .sh-row, .sh-people + .sh-row { border-top: 1px solid var(--border-subtle, #ebebf0); }
.sh-row-label { font-size: 13px; color: var(--fg-2); }
.sh-ctl { position: relative; display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; font-size: 13px; font-weight: 600; color: var(--fg-1); cursor: pointer; white-space: nowrap; }
.sh-ctl:hover { border-color: var(--fg-4, #b7bbc6); }
.sh-ctl:focus-within { border-color: var(--envoy-red, #fa4338); box-shadow: 0 0 0 3px rgba(250, 67, 56, 0.12); }
.sh-ctl > svg:first-child, .sh-ctl .sh-acc-ico { color: var(--fg-3); display: inline-flex; }
.sh-ctl > svg:last-of-type { color: var(--fg-3); transform: rotate(90deg); }
.sh-ctl.is-static { cursor: default; border-color: transparent; background: var(--arctic, #f6f6f9); }
.sh-panel .sh-people { margin: 0; padding: 0 12px 10px 14px; }

/* Share sheet: Quarry menus for access and expiry */
.sh-ctl-wrap { position: relative; display: inline-flex; }
button.sh-ctl { font: inherit; font-size: 13px; font-weight: 600; }
.sh-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 260px; padding: 6px; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 16px 36px -12px rgba(31, 35, 45, 0.28); display: flex; flex-direction: column; gap: 2px; }
.sh-menu-opt { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; font: inherit; text-align: left; cursor: pointer; color: var(--fg-1); }
.sh-menu-opt:hover, .sh-menu-opt:focus-visible { background: var(--arctic, #f6f6f9); outline: none; }
.sh-menu-ico { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 999px; background: var(--arctic, #f1f3f6); color: var(--fg-2); }
.sh-menu-opt.is-on .sh-menu-ico { background: var(--envoy-red-tint, #fff1f0); color: var(--envoy-red-hover, #e23c32); }
.sh-menu-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.sh-menu-title { font-size: 13.5px; font-weight: 600; }
.sh-menu-desc { font-size: 12px; color: var(--fg-3); }
.sh-menu-check { flex: none; width: 16px; display: inline-flex; color: var(--envoy-red, #fa4338); }
/* Let the share sheet's menus hang below the dialog instead of being clipped. */
.modal-overlay > .modal.sh-modal { overflow: visible; }

/* Query Lab › Shared links */
.sl-table { table-layout: fixed; width: 100%; }
.sl-table.has-who th:nth-child(2) { width: 210px; }
.sl-table th:nth-last-child(4) { width: 130px; }
.sl-table th:nth-last-child(3) { width: 120px; }
.sl-table th:nth-last-child(2) { width: 100px; }
.sl-table th:last-child { width: 170px; }
.sl-acc { font-size: 13px; color: var(--fg-2); white-space: nowrap; }
.sl-acc svg { color: var(--fg-3); vertical-align: -2px; }
.sl-actions { text-align: right; white-space: nowrap; }
.sl-actions .ql-fs-btn { text-decoration: none; padding: 0 7px; }
.sl-actions .secondary-btn { margin-left: 4px; }
.sl-status { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--arctic, #f1f3f6); color: var(--fg-3); vertical-align: 1px; }
.sl-table tr.is-gone td { opacity: 0.6; }

/* Share sheet: people suggestions */
.sh-people { position: relative; }
.sh-sugg { position: absolute; left: 0; right: 0; top: 44px; z-index: 30; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14); padding: 4px; max-height: 280px; overflow: auto; }
.sh-sugg.hidden { display: none; }
.sh-sugg-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; padding: 7px 8px; border-radius: 8px; cursor: pointer; text-align: left; font: inherit; color: var(--fg-1); }
.sh-sugg-item.is-hi, .sh-sugg-item:hover { background: var(--arctic, #f6f6f9); }
.sh-sugg-item .ql-av { width: 26px; height: 26px; font-size: 12px; flex: none; }
.sh-sugg-txt { display: flex; flex-direction: column; min-width: 0; }
.sh-sugg-txt b { font-size: 13px; font-weight: 600; }
.sh-sugg-txt small { font-size: 12px; color: var(--fg-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Share sheet: rename the link in place */
.sh-modal .sh-title-input { display: block; width: 100% !important; height: auto; box-sizing: border-box; margin: -3px 0 -1px -6px; padding: 2px 6px; border: 1px solid transparent; border-radius: 6px; background: transparent; box-shadow: none; font: inherit; font-weight: 600; font-size: 14px; color: var(--fg-1); cursor: text; }
.sh-modal .sh-title-input:hover { border-color: var(--border); }
.sh-modal .sh-title-input:focus { outline: none; border-color: var(--envoy-red, #fa4338); background: #fff; box-shadow: 0 0 0 3px rgba(250, 67, 56, 0.12); }
.sl-actions .sl-del { color: var(--fg-3); margin-left: 2px; }
.sl-actions .sl-del:hover { color: var(--envoy-red, #fa4338); }

/* Logs pagination */
.ql-pager { display: flex; align-items: center; gap: 4px; margin-top: 12px; flex-wrap: wrap; }
.ql-pg-num { min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--fg-1); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.ql-pg-num:hover:not(:disabled):not(.is-on) { border-color: var(--fg-3); }
.ql-pg-num.is-on { background: var(--envoy-red, #fa4338); border-color: var(--envoy-red, #fa4338); color: #fff; cursor: default; }
.ql-pg-num:disabled { opacity: 0.4; cursor: default; }
.ql-pg-step { font-size: 16px; line-height: 1; }
.ql-pg-gap { padding: 0 4px; color: var(--fg-3); }

/* Settings: collapsible accounts + databases on a server */
.ds-acct-toggle { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin-right: 2px; border: 0; border-radius: 6px; background: transparent; color: var(--fg-3); cursor: pointer; padding: 0; }
.ds-acct-toggle:hover { background: var(--arctic, #f1f3f6); color: var(--fg-1); }
.ds-acct-toggle svg { transition: transform 0.15s ease; transform: rotate(90deg); }
.ds-account.is-collapsed .ds-acct-toggle svg { transform: rotate(0deg); }
.ds-acct-name { cursor: pointer; }
.ds-account.is-collapsed { padding-bottom: 4px; }
.ds-dbs-btn svg { transition: transform 0.15s ease; }
.ds-dbs-btn.is-open svg { transform: rotate(90deg); }
.ds-dbs-row > td { background: var(--arctic, #f8f9fb); padding-top: 4px !important; }
.ds-dbs { padding: 4px 4px 2px 18px; }
.ds-db-list { list-style: none; margin: 0 0 6px; padding: 0; border: 1px solid var(--border); border-radius: 10px; background: #fff; overflow: hidden; }
.ds-db-item { display: flex; align-items: center; gap: 8px; padding: 9px 12px; font-size: 13px; }
.ds-db-item + .ds-db-item { border-top: 1px solid var(--border); }
.ds-db-item svg { color: var(--fg-3); flex: none; }
.ds-db-name { font-weight: 500; color: var(--fg-1); }
.ds-db-item.is-off .ds-db-name { color: var(--fg-3); }

/* Connections: inline "Change sign-in" */
.ds-inline-link { margin-left: 6px; padding: 0; font-size: 12.5px; vertical-align: baseline; }
.doc-owner-email { color: var(--fg-3); font-weight: 400; font-size: 12.5px; }

/* Connections: databases list header with Hide */
.ds-dbs-head { display: flex; align-items: center; gap: 8px; margin: 2px 0 6px; }
.ds-dbs-hide { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; }
.ds-dbs-hide svg { transform: rotate(-90deg); }

/* Download: red button with a CSV / Excel menu */
.ql-dl-wrap { position: relative; display: inline-flex; }
.ql-dl-btn { display: inline-flex; align-items: center; gap: 6px; }
.ql-dl-btn svg:last-child { transform: rotate(90deg); opacity: 0.85; }
.ql-dl-pop { position: absolute; right: 0; top: calc(100% + 6px); left: auto; width: 240px; padding: 4px; z-index: 40; }
.ql-dl-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; text-align: left; font: inherit; color: var(--ql-fg, var(--fg-1)); }
.ql-dl-opt b { font-size: 13px; font-weight: 600; }
.ql-dl-opt small { font-size: 12px; color: var(--ql-fg3, var(--fg-3)); }
.ql-dl-opt:hover { background: var(--ql-hover, var(--arctic, #f6f6f9)); }

/* Tell me why */
.ql-why-cta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--ql-border); }
.ql-why-btn { display: inline-flex; align-items: center; gap: 6px; }
.ql-why { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--ql-border); }
.ql-why-head { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--envoy-red, #fa4338); margin-bottom: 8px; }
.ql-why-head .ql-fs-btn { text-transform: none; letter-spacing: 0; font-weight: 500; }
.ql-why-card { background: var(--ql-bg, #fff); border: 1px solid var(--ql-border); border-left: 3px solid var(--ql-border); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.ql-why-card.conf-high { border-left-color: #16a34a; }
.ql-why-card.conf-medium { border-left-color: #d97706; }
.ql-why-card.conf-low { border-left-color: #94a3b8; }
.ql-why-card.conf-none { border-left-color: #cbd5e1; }
.ql-why-what { display: flex; align-items: flex-start; gap: 10px; font-weight: 600; font-size: 13.5px; color: var(--ql-fg, var(--fg-1)); }
.ql-why-what { flex-wrap: wrap; }
.ql-why-what > span:first-child { flex: 1 1 260px; min-width: 0; }
.ql-why-conf { flex: none; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--arctic, #f1f3f6); color: var(--ql-fg3, var(--fg-3)); }
.conf-high .ql-why-conf { background: #dcfce7; color: #166534; }
.conf-medium .ql-why-conf { background: #fef3c7; color: #92400e; }
.ql-why-text { margin: 6px 0 0; font-size: 13.5px; line-height: 1.55; color: var(--ql-fg, var(--fg-1)); }
.ql-why-ev { margin-top: 8px; font-size: 12.5px; }
.ql-why-ev summary { cursor: pointer; color: var(--ql-fg3, var(--fg-3)); }
.ql-why-ev-item { margin-top: 8px; }
.ql-why-ev-item p { margin: 0 0 4px; color: var(--ql-fg, var(--fg-1)); }
.ql-why-ev-item pre { margin: 0 0 4px; padding: 8px 10px; border-radius: 6px; background: var(--ql-code-bg, #f6f7f9); font-size: 12px; white-space: pre-wrap; word-break: break-word; max-height: 180px; overflow: auto; }
.ql-why-next { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }

/* Run IDs */
.ql-run-id { display: inline-flex; align-items: center; gap: 5px; margin-left: 8px; padding: 2px 8px; border: 1px solid var(--ql-border, var(--border)); border-radius: 999px; background: transparent; color: var(--ql-fg3, var(--fg-3)); font: inherit; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; cursor: pointer; }
.ql-run-id:hover { color: var(--envoy-red, #fa4338); border-color: var(--envoy-red, #fa4338); }
.ql-log-ids { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; }
.ql-log-ids .ql-run-id { margin-left: 0; }
.ql-run-banner { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--ql-border, var(--border)); border-radius: 10px; background: var(--arctic, #f6f6f9); font-size: 13px; color: var(--ql-fg, var(--fg-1)); }
.ql-card[data-theme="dark"] .ql-run-banner { background: rgba(255, 255, 255, 0.04); }
.ql-run-banner svg { color: var(--ql-fg3, var(--fg-3)); flex: none; }

/* Hide / Show for the AI summary and Why */
.ql-sum-head .ql-fs-btn + .ql-fs-btn { margin-left: 2px; }
.ql-sum-head [data-act="sum-hide"] svg, .ql-why-head [data-act="why-hide"] svg { transform: rotate(-90deg); }
.ql-sum-head [data-act="sum-show"] svg, .ql-why-head [data-act="why-show"] svg { transform: rotate(90deg); }
.ql-sum-folded { padding-top: 8px; padding-bottom: 8px; }
.ql-sum-folded .ql-sum-head, .ql-why-folded .ql-why-head { margin-bottom: 0; }
.ql-fold-note { margin-left: 8px; text-transform: none; letter-spacing: 0; font-weight: 500; }

/* Slate › Present: the deck full screen (keyboard ← →, Esc) */
.slate-present { position: fixed; inset: 0; z-index: 1000; background: #11131a; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.slate-present-stage { width: min(96vw, calc(88vh * 16 / 9)); display: flex; cursor: pointer; }
.slate-present-stage .slate-slide { flex: 1 1 auto; width: 100%; border: 0; border-radius: 6px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45); padding: 4.5% 5.5%; }
.slate-present-stage .slate-slide-h { font-size: clamp(22px, 3vw, 46px); margin-right: 12%; }
.slate-present-stage .slate-slide-s { font-size: clamp(14px, 1.4vw, 22px); }
.slate-present-stage .slate-slide-logo { font-size: clamp(11px, 1vw, 16px); }
.slate-present-stage .slate-slide-foot { font-size: clamp(10px, 0.9vw, 14px); }
.slate-present-wait { flex: 1; aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center; gap: 10px; color: #c9cbd4; background: #1f232d; border-radius: 6px; font-size: 15px; }
.slate-present-bar { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 999px; background: rgba(31, 35, 45, 0.92); color: #ffffff; font-size: 13px; transition: opacity 0.25s ease; }
.slate-present.idle .slate-present-bar { opacity: 0; }
.slate-present.idle { cursor: none; }
.slate-present-btn { min-width: 36px; height: 36px; border: 0; border-radius: 999px; background: transparent; color: #ffffff; font: inherit; font-size: 20px; line-height: 1; cursor: pointer; }
.slate-present-btn.wide { font-size: 13px; padding: 0 14px; font-weight: 600; }
.slate-present-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.12); }
.slate-present-btn:disabled { opacity: 0.35; cursor: default; }
.slate-present-n { min-width: 56px; text-align: center; font-variant-numeric: tabular-nums; }
.slate-present-sep { width: 1px; height: 20px; background: rgba(255, 255, 255, 0.2); margin: 0 4px; }

/* Slate: column chips (studio "Edit columns") */
.sg-chip:focus-visible { outline: 2px solid var(--envoy-red); outline-offset: 2px; }
.sg-chips { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 2px; }
.sg-chip { padding: 5px 11px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--bg-0); color: var(--fg-2); font: inherit; font-size: 12.5px; cursor: pointer; }
.sg-chip[aria-pressed="true"] { border-color: var(--envoy-red); background: var(--envoy-red); color: #fff; }

/* Slate step 4: slide studio */
.ss-top { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; }
.ss-top > button { flex: none; }
.ss-src { flex: 1 1 auto; min-width: 0; font-size: 13px; color: var(--fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@container (max-width: 560px) { .ss-src { display: none; } .ss-top .ss-pill { margin-left: auto; } }
.ss-pill { border: 1px solid var(--border-strong); background: var(--bg-0); color: var(--fg-1); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.ss-pill:hover, .ss-pill[aria-expanded="true"] { border-color: var(--fg-3); }
.ss-pop { margin: 0 0 14px; padding: 14px 16px 10px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--bg-0); box-shadow: 0 10px 30px rgba(16,24,40,.08); }
.ss-pop-foot { display: flex; align-items: center; gap: 8px; padding-top: 6px; }
.ss-wrap { container-type: inline-size; }
.ss-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
/* The studio sits beside the app sidebar: stack by its own width, not the window's. */
@container (max-width: 900px) {
  .ss-grid { grid-template-columns: 1fr; }
}
.ss-stage .slate-slide { width: 100%; }
.ss-stage.is-draft .slate-slide-h { color: var(--fg-3); }
.ss-status { min-height: 22px; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--fg-3); padding: 8px 2px 4px; }
.ss-err { color: var(--danger, #c70a14); }
.ss-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--envoy-red); flex: none; animation: ss-pulse 1.1s ease-in-out infinite; }
@keyframes ss-pulse { 0%, 100% { opacity: .25; transform: scale(.85); } 50% { opacity: 1; transform: scale(1); } }
.ss-strip-h { display: flex; align-items: center; margin: 6px 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-3); }
.ss-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 10px; margin-bottom: 14px; }
.ss-thumb { display: flex; flex-direction: column; gap: 6px; padding: 8px 8px 7px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--bg-0); color: var(--fg-2); font: inherit; font-size: 12.5px; cursor: pointer; text-align: left; transition: border-color .12s, box-shadow .12s; }
.ss-thumb:hover { border-color: var(--fg-3); }
.ss-thumb[aria-checked="true"] { border-color: var(--envoy-red); box-shadow: 0 0 0 2px color-mix(in srgb, var(--envoy-red) 22%, transparent); color: var(--fg-1); font-weight: 600; }
.ss-thumb:disabled { opacity: .5; cursor: default; }
.ss-thumb-art { height: 62px; overflow: hidden; border-radius: 6px; background: var(--bg-1); display: flex; align-items: center; justify-content: center; pointer-events: none; }
.ss-thumb-art .slate-chart-wrap { width: 100%; }
.ss-thumb-art .slate-axis-t, .ss-thumb-art .slate-legend, .ss-thumb-art .slate-hint { display: none; }
.ss-thumb-art svg text { display: none; }
.ss-thumb-art .slate-kpis, .ss-thumb-art .slate-mini-table { zoom: .32; }
.ss-thumb-ai .ss-thumb-art { font-size: 22px; color: var(--envoy-red); background: color-mix(in srgb, var(--envoy-red) 6%, var(--bg-1)); }
.ss-rail { display: flex; flex-direction: column; gap: 12px; }
.ss-card { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--bg-0); }
.ss-card h4 { margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-3); }
.ss-card-h { display: flex; align-items: center; margin-bottom: 8px; }
.ss-card-h h4 { margin: 0; }
.ss-p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--fg-1); }
.ss-muted { margin: 0 0 8px; font-size: 13px; line-height: 1.45; color: var(--fg-3); }
.ss-head { display: block; width: 100%; text-align: left; margin: 0 0 6px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-0); color: var(--fg-2); font: inherit; font-size: 13.5px; line-height: 1.35; cursor: pointer; }
.ss-head:hover { border-color: var(--fg-3); }
.ss-head[aria-pressed="true"] { border-color: var(--envoy-red); color: var(--fg-1); font-weight: 600; background: color-mix(in srgb, var(--envoy-red) 5%, var(--bg-0)); }
.ss-finding { padding: 8px 0; border-top: 1px solid var(--border); }
.ss-card-h + .ss-finding { border-top: 0; padding-top: 0; }
.ss-finding-h { display: flex; align-items: baseline; gap: 8px; justify-content: space-between; font-size: 13.5px; color: var(--fg-1); }
.ss-finding p { margin: 4px 0 0; font-size: 13px; line-height: 1.45; color: var(--fg-2); }
.ss-finding-why { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.ss-finding-why.open { display: block; -webkit-line-clamp: unset; cursor: auto; }
.ss-running { display: flex; gap: 10px; align-items: flex-start; }
.ss-running .ss-dot { margin-top: 5px; }
.ss-conf { flex: none; font-size: 11px; padding: 2px 7px; border-radius: 999px; background: var(--bg-2); color: var(--fg-2); }
.ss-conf.high { background: color-mix(in srgb, #21944E 14%, var(--bg-0)); color: #1a7a40; }
.ss-switch { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--fg-2); cursor: pointer; }
.ss-switch input { accent-color: var(--envoy-red); }
.ss-callout { display: flex; gap: 8px; align-items: flex-start; padding: 5px 0; font-size: 13px; color: var(--fg-2); cursor: pointer; }
.ss-callout input { margin-top: 3px; accent-color: var(--envoy-red); }
.ss-callout b { color: var(--fg-1); font-weight: 600; margin-right: 4px; }
.ss-caveat { margin: 0; }
.ss-link { border: 0; background: none; padding: 0; color: var(--fg-2); font: inherit; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; align-self: flex-start; }
.ss-link:disabled { opacity: .5; cursor: default; }
.ss-skel { display: block; height: 12px; margin: 7px 0; border-radius: 6px; background: linear-gradient(90deg, var(--bg-2), var(--bg-1), var(--bg-2)); background-size: 200% 100%; animation: ss-shimmer 1.3s linear infinite; }
@keyframes ss-shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .ss-dot, .ss-skel { animation: none; } }

/* Slide: Envoy business review layout. Sized to the slide's own width (cqw),
   so the studio, deck thumbnails and Present all match. */
.slate-slide.br { container-type: inline-size; padding: 3.2% 3.6% 2.4%; gap: 0; }
.slate-slide.br .br-top { display: flex; justify-content: space-between; align-items: center; min-height: 2.2cqw; margin-bottom: .6cqw; }
.slate-slide.br .br-eyebrow { display: inline-flex; align-items: center; gap: .9cqw; font-size: 1.15cqw; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #8a8f9e; }
.slate-slide.br .br-eyebrow::before { content: ''; width: 2.2cqw; height: .3cqw; border-radius: 2px; background: var(--envoy-red); }
.slate-slide.br .br-logo { font-size: 1.15cqw; font-weight: 800; letter-spacing: .14em; color: var(--envoy-red); }
.slate-slide.br .slate-slide-h { font-size: 3.1cqw; line-height: 1.18; margin: 0 0 .5cqw; color: #1f232d; font-weight: 800; letter-spacing: -.01em; }
.slate-slide.br .slate-slide-h em { font-style: normal; color: var(--envoy-red); }
.slate-slide.br .slate-slide-s { font-size: 1.45cqw; line-height: 1.4; color: #5c6270; margin: 0 0 1.2cqw; }
.slate-slide.br .br-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr; gap: 1.6cqw; padding-top: 1.2cqw; border-top: 1px solid #ebebf0; }
.slate-slide.br .br-body.with-rail { grid-template-columns: minmax(0, 1fr) 29%; }
.slate-slide.br .br-chart { display: flex; flex-direction: column; min-height: 0; border: 1px solid #ebebf0; border-radius: 1cqw; padding: 1.2cqw 1.4cqw .8cqw; }
.slate-slide.br .br-chart-t { font-size: 1.3cqw; font-weight: 700; color: #3f4450; margin-bottom: .4cqw; }
.slate-slide.br .br-chart .slate-axis-t { font-size: 1cqw; }
.slate-slide.br .br-chart .slate-legend { font-size: 1.05cqw; }
.slate-slide.br .br-rail { display: flex; flex-direction: column; gap: 1cqw; min-height: 0; overflow: hidden; }
.slate-slide.br .br-hero { background: var(--envoy-red); color: #fff; border-radius: 1cqw; padding: 1.3cqw 1.6cqw; }
.slate-slide.br .br-hero-v { font-size: 3.6cqw; font-weight: 800; line-height: 1.05; letter-spacing: -.01em; }
.slate-slide.br .br-hero-l { font-size: 1.3cqw; font-weight: 700; margin-top: .3cqw; }
.slate-slide.br .br-hero-d { font-size: 1.15cqw; opacity: .92; margin-top: .1cqw; }
.slate-slide.br .br-card { background: #f6f6f9; border-radius: .8cqw; padding: 1cqw 1.3cqw; border-left: .45cqw solid #a4a9b6; }
.slate-slide.br .br-card.red { border-left-color: var(--envoy-red); }
.slate-slide.br .br-card.indigo { border-left-color: #4141a2; }
.slate-slide.br .br-card.indigo .br-card-t { color: #4141a2; }
.slate-slide.br .br-card-t { font-size: 1.32cqw; font-weight: 700; line-height: 1.3; color: #1f232d; }
.slate-slide.br .br-card-b { font-size: 1.12cqw; line-height: 1.45; color: #3f4450; margin-top: .3cqw; }
.slate-slide.br .br-foot { display: flex; justify-content: space-between; gap: 2cqw; font-size: .95cqw; color: #8a8f9e; border-top: 1px solid #ebebf0; padding-top: .7cqw; margin-top: 1.2cqw; }
.slate-slide.br .slate-kpi-v { font-size: 6cqw; }
.slate-slide.br .slate-kpi-l { font-size: 1.3cqw; }
.ss-tone { flex: none; width: 10px; height: 10px; margin-top: 4px; border-radius: 3px; background: #a4a9b6; }
.ss-tone.hero, .ss-tone.red { background: var(--envoy-red); }
.ss-tone.indigo { background: #4141a2; }
.ss-tone.pin { background: transparent; border: 2px solid #1f2430; border-radius: 50%; width: 9px; height: 9px; }
.ss-sub { margin: 8px 0 2px; font-size: 11.5px; color: var(--fg-3); }
.slate-slide.br .br-card-t { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.slate-slide.br .br-card-b { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.slate-slide.br .br-card { flex: 0 1 auto; min-height: 0; }
/* A hero plus three cards: two lines each, so the rail never spills. */
.slate-slide.br .br-rail:has(.br-hero):has(.br-card:nth-child(4)) .br-card-b { -webkit-line-clamp: 2; }
.slate-slide.br .br-foot span:first-child { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slate-slide.br .br-foot span:last-child { flex: none; }

/* Slate deck: slides and sections in order, drag or Alt+arrow to move */
.sd-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--bg-0); }
.sd-row { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--border); outline: none; }
.sd-row:last-child { border-bottom: 0; }
.sd-row:focus-visible { box-shadow: inset 0 0 0 2px var(--envoy-red); }
.sd-row.dragging { opacity: .45; }
.sd-row.drop-before::before, .sd-row.drop-after::after { content: ''; position: absolute; left: 8px; right: 8px; height: 3px; border-radius: 2px; background: var(--envoy-red); z-index: 1; }
.sd-row.drop-before::before { top: -2px; }
.sd-row.drop-after::after { bottom: -2px; }
.sd-grip { flex: none; cursor: grab; color: var(--fg-3); font-size: 14px; letter-spacing: -2px; padding: 6px 2px; user-select: none; }
.sd-grip:active { cursor: grabbing; }
.sd-n, .sd-chap { flex: none; width: 22px; font-family: ui-monospace, monospace; font-size: 12px; color: var(--fg-3); }
.sd-thumb { flex: none; position: relative; width: 128px; height: 72px; overflow: hidden; border-radius: 6px; border: 1px solid var(--border); background: #fff; pointer-events: none; }
.sd-thumb > .slate-slide { position: absolute; top: 0; left: 0; width: 640px; height: 360px; transform: scale(.2); transform-origin: 0 0; border: 0; box-shadow: none; border-radius: 0; }
.sd-thumb-none { display: grid; place-items: center; height: 100%; padding: 6px; font-size: 10.5px; color: var(--fg-3); text-align: center; }
.sd-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.sd-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-1); }
.sd-meta { font-size: 12px; color: var(--fg-3); white-space: nowrap; }
.sd-acts { flex: none; display: flex; gap: 2px; }
.sd-acts .artdash-icon-btn:disabled { opacity: .3; cursor: default; background: none; }
.sd-div { background: color-mix(in srgb, var(--envoy-red) 4%, var(--bg-0)); }
.sd-div .sd-chap { color: var(--envoy-red); font-weight: 700; }
.sd-div-name { flex: 1; min-width: 0; max-width: 360px; font-weight: 700; color: var(--fg-1); }
.sd-div .sd-meta { flex: 1; }
.sd-menu-wrap { position: relative; display: inline-flex; }
.sd-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; min-width: 240px; padding: 6px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--bg-0); box-shadow: 0 12px 32px rgba(16,24,40,.14); display: flex; flex-direction: column; }
.sd-menu button { text-align: left; padding: 8px 10px; border: 0; border-radius: 6px; background: none; color: var(--fg-1); font: inherit; font-size: 13.5px; cursor: pointer; }
.sd-menu button:hover, .sd-menu button:focus-visible { background: var(--bg-2); outline: none; }
.sd-menu .sd-menu-custom { border-top: 1px solid var(--border); border-radius: 0 0 6px 6px; margin-top: 4px; padding-top: 10px; color: var(--fg-2); }
@media (max-width: 640px) { .sd-thumb { display: none; } }

/* Chapter slide (a section divider), as in the business review deck */
.slate-slide.br-div { container-type: inline-size; justify-content: center; padding: 6% 7%; background: #fff; }
.slate-slide.br-div .br-logo { position: absolute; top: 5%; right: 5%; font-size: 1.15cqw; font-weight: 800; letter-spacing: .14em; color: var(--envoy-red); }
.slate-slide.br-div .br-div-n { width: 4.6cqw; height: 4.6cqw; border-radius: 50%; background: #3f4450; color: #fff; display: grid; place-items: center; font-size: 2cqw; font-weight: 800; margin-bottom: 4cqw; }
.slate-slide.br-div .br-div-t { margin: 0; font-size: 4.6cqw; font-weight: 800; color: var(--envoy-red); letter-spacing: -.01em; line-height: 1.1; }
.slate-slide.br-div .br-div-s { margin: 1.2cqw 0 0; font-size: 1.5cqw; color: #8a8f9e; }

/* Callout layouts from the Envoy board deck */
.slate-slide.br .br-body.br-col { display: flex; flex-direction: column; gap: 1.2cqw; }
.slate-slide.br .br-col .br-chart { flex: 1; min-height: 0; }
/* strip: short cards in a row under the chart */
.slate-slide.br .br-strip { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 1.2cqw; }
.slate-slide.br .br-strip .br-card-b { -webkit-line-clamp: 2; }
.slate-slide.br .br-strip-v { font-size: 2.4cqw; font-weight: 800; color: var(--envoy-red); line-height: 1.05; }
/* tiles: filled stat tiles, label left, number right */
.slate-slide.br .br-tiles { gap: 1cqw; }
.slate-slide.br .br-tile { border-radius: 1cqw; padding: 1.2cqw 1.5cqw; background: #f6f6f9; color: #1f232d; }
.slate-slide.br .br-tile.red { background: var(--envoy-red); color: #fff; }
.slate-slide.br .br-tile.indigo { background: #4141a2; color: #fff; }
.slate-slide.br .br-tile-row { display: flex; align-items: center; justify-content: space-between; gap: 1cqw; }
.slate-slide.br .br-tile-l { font-size: 1.3cqw; font-weight: 700; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.slate-slide.br .br-tile-v { flex: none; font-size: 3cqw; font-weight: 800; letter-spacing: -.01em; line-height: 1; }
.slate-slide.br .br-tile-s { font-size: 1.05cqw; line-height: 1.4; margin-top: .4cqw; opacity: .88; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* bullets: a filled hero tile, then a gray panel of colored bullets */
.slate-slide.br .br-hero.indigo { background: #4141a2; }
.slate-slide.br .br-hero .br-up { font-size: 1.1cqw; letter-spacing: .06em; text-transform: uppercase; margin: 0 0 .3cqw; }
.slate-slide.br .br-bullets { flex: 1; min-height: 0; overflow: hidden; background: #f6f6f9; border-radius: 1cqw; padding: 1.3cqw 1.5cqw; display: flex; flex-direction: column; gap: .9cqw; }
.slate-slide.br .br-bullet { position: relative; padding-left: 1.6cqw; font-size: 1.15cqw; line-height: 1.45; color: #3f4450; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.slate-slide.br .br-bullet::before { content: ''; position: absolute; left: 0; top: .55cqw; width: .7cqw; height: .7cqw; border-radius: 50%; background: #a4a9b6; }
.slate-slide.br .br-bullet.red::before { background: var(--envoy-red); }
.slate-slide.br .br-bullet.indigo::before { background: #4141a2; }
.slate-slide.br .br-bullet b { color: #1f232d; }

/* Studio: the slide in each callout style */
.ss-styles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ss-style-art { pointer-events: none; border-radius: 6px; overflow: hidden; border: 1px solid var(--border); }
.ss-style-art .slate-slide { border: 0; box-shadow: none; border-radius: 0; }
@container (max-width: 560px) { .ss-styles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Studio: callout editor */
.ss-co .ss-card-h { margin-bottom: 10px; }
.ss-co-hero { display: flex; flex-direction: column; gap: 6px; padding: 10px; margin-bottom: 10px; border-radius: 10px; background: color-mix(in srgb, var(--envoy-red) 6%, var(--bg-0)); border: 1px solid color-mix(in srgb, var(--envoy-red) 22%, transparent); }
.ss-co-k { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--envoy-red); }
.ss-co-heroin { display: flex; gap: 6px; align-items: center; }
.ss-co-heroin .artdash-input { min-width: 0; flex: 1; padding: 6px 8px; font-size: 13px; }
.ss-co-heroin [data-hero="value"] { flex: 0 0 38%; font-weight: 700; }
.ss-co-addhero { margin-bottom: 10px; }
.ss-co-item { display: flex; gap: 8px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--border); }
.ss-co-tone { flex: none; width: 14px; height: 14px; margin-top: 8px; border-radius: 4px; border: 0; padding: 0; cursor: pointer; background: #a4a9b6; }
.ss-co-tone.red { background: var(--envoy-red); }
.ss-co-tone.indigo { background: #4141a2; }
.ss-co-tone:focus-visible { outline: 2px solid var(--fg-1); outline-offset: 2px; }
.ss-co-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ss-co-fields .artdash-input { padding: 6px 8px; font-size: 13px; }
.ss-co-title { font-weight: 700; }
.ss-co-body { resize: vertical; min-height: 40px; line-height: 1.4; }
.ss-co-acts { flex: none; display: flex; flex-direction: column; }
.ss-co-acts .artdash-icon-btn { padding: 2px 4px; font-size: 12px; }
.ss-co-acts .artdash-icon-btn:disabled { opacity: .3; background: none; cursor: default; }
.ss-co-pin { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.ss-co-px { flex: none; font-size: 12px; color: var(--fg-3); font-family: ui-monospace, monospace; }
.ss-co-pin .artdash-input { flex: 1; min-width: 0; padding: 4px 8px; font-size: 13px; }
.ss-muted-i { color: var(--fg-3); font-weight: 400; }
.ss-stage .ss-hit { cursor: crosshair; }
.ss-stage .ss-hit:hover { fill: rgba(65, 65, 162, .07); }

/* Studio: the reply to the last requested change */
.ss-reply { margin: 8px 2px 0; font-size: 13px; color: var(--fg-3); }
.ss-reply.err { color: var(--danger, #c70a14); }
.ss-reply .ss-link { margin-left: 6px; font-size: 13px; }

/* Studio: the prompts the author controls */
.ss-prompt { width: 100%; box-sizing: border-box; resize: vertical; min-height: 64px; font: inherit; font-size: 13.5px; line-height: 1.45; padding: 8px 10px; }
.ss-pop .ss-prompt { min-height: 110px; margin-top: 6px; }
.ss-prompt-card { border-color: color-mix(in srgb, var(--envoy-red) 28%, var(--border)); }
.ss-prompt-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; }

/* Deck prompt popover */
.ss-pop.ss-dp { padding: 18px 20px 16px; border-radius: 14px; box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 16px 40px -12px rgba(16,24,40,.18); }
.ss-dp-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.ss-dp-head > div { flex: 1; min-width: 0; }
.ss-dp-title { font-size: 15px; font-weight: 700; color: var(--fg-1); letter-spacing: -.005em; }
.ss-dp-sub { margin-top: 2px; font-size: 13px; color: var(--fg-3); }
.ss-dp-reset { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 0; border-radius: 8px; background: none; color: var(--fg-2); font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
.ss-dp-reset:hover { background: var(--bg-2); color: var(--fg-1); }
.ss-dp-box { border: 1px solid var(--border-strong); border-radius: 12px; background: var(--bg-0); transition: border-color .12s, box-shadow .12s; }
.ss-dp-box:focus-within { border-color: var(--envoy-red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--envoy-red) 14%, transparent); }
.ss-dp-text { display: block; width: 100%; box-sizing: border-box; min-height: 104px; padding: 14px 16px 6px; border: 0; outline: none; resize: vertical; background: transparent; font: inherit; font-size: 14.5px; line-height: 1.55; color: var(--fg-1); }
.ss-dp-text::placeholder { color: var(--fg-3); }
.ss-dp-meta { display: flex; align-items: center; gap: 10px; padding: 8px 10px 10px 12px; border-top: 1px dashed var(--border); }
.ss-dp-chips { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ss-dp-chip { padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-1); color: var(--fg-2); font: inherit; font-size: 12px; cursor: pointer; transition: border-color .12s, color .12s; }
.ss-dp-chip:hover { border-color: var(--fg-3); color: var(--fg-1); }
.ss-dp-count { flex: none; font-size: 12px; color: var(--fg-3); font-variant-numeric: tabular-nums; }
.ss-dp-foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.ss-dp-foot > button { flex: none; }
.ss-dp-hint { font-size: 12px; color: var(--fg-3); display: inline-flex; align-items: center; gap: 3px; }
.ss-dp-hint kbd { font: inherit; font-size: 11px; min-width: 18px; padding: 1px 5px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; background: var(--bg-1); color: var(--fg-2); text-align: center; }
@container (max-width: 560px) { .ss-dp-hint { display: none; } }
/* .primary-btn is full width by default; the studio and deck size buttons to their label. */
.ss-wrap .primary-btn, .ss-wrap .secondary-btn, .ss-dp-foot .primary-btn, .ss-dp-foot .secondary-btn, .sd-list ~ .slate-actions .primary-btn { width: auto; }
.ss-dp-hint { white-space: nowrap; }

/* Studio workspace (like revenue-command's Insight Studio): fixed height,
   the slide on a canvas that never scrolls away, the rail scrolls on its own. */
@container (min-width: 901px) {
  .ss-grid { height: var(--ss-h, 760px); grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: stretch; }
  .ss-main { min-height: 0; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-0); }
  .ss-canvas { position: relative; flex: 1 1 auto; min-height: 260px; display: flex; align-items: center; justify-content: center; padding: 22px 22px 34px; background: var(--bg-2); overflow: hidden; }
  .ss-canvas .ss-stage { flex: none; }
  .ss-canvas .ss-stage .slate-slide { box-shadow: 0 20px 25px -5px rgba(0,0,0,.10), 0 8px 10px -6px rgba(0,0,0,.10); border: 0; }
  .ss-canvas .ss-status { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); max-width: 80%; min-height: 0; padding: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ss-askbar { flex: none; padding: 10px 14px 8px; border-top: 1px solid var(--border); background: var(--bg-0); }
  .ss-askbar .slate-ask { margin: 0; }
  .ss-askbar .ss-reply { margin: 6px 2px 0; }
  .ss-tray { flex: none; max-height: 42%; overflow-y: auto; padding: 4px 14px 12px; border-top: 1px solid var(--border); background: var(--bg-0); }
  .ss-tray .ss-strip-h { margin: 8px 0 6px; }
  .ss-tray .ss-strip { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 4px; padding-bottom: 4px; scrollbar-width: thin; }
  .ss-tray .ss-strip .ss-thumb { flex: 0 0 116px; }
  .ss-tray .ss-strip.ss-styles .ss-thumb { flex: 0 0 172px; }
  .ss-tray .ss-thumb-art { height: 54px; }
  .ss-tray .ss-pop { margin: 8px 0 0; }
  .ss-rail { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 4px 12px 0; scrollbar-width: thin; }
}
@container (max-width: 900px) {
  .ss-askbar { margin: 10px 0 0; }
  .ss-canvas .ss-status { min-height: 22px; }
}
/* Tray: one row of design choices at a time (Chart | Callout style) */
.ss-tray-h { display: flex; align-items: center; gap: 8px; margin: 10px 0 8px; }
.ss-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: var(--bg-2); }
.ss-seg-b { padding: 5px 12px; border: 0; border-radius: 7px; background: none; color: var(--fg-2); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.ss-seg-b[aria-selected="true"] { background: var(--bg-0); color: var(--fg-1); box-shadow: 0 1px 2px rgba(16,24,40,.08); }
.ss-seg-b:focus-visible { outline: 2px solid var(--envoy-red); outline-offset: 1px; }

/* Field editor ("Edit chart"), shown in place of the rail */
.fe { border: 1px solid var(--border); border-radius: 14px; background: var(--bg-0); overflow: hidden; }
.fe-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg-0) 92%, transparent); backdrop-filter: blur(6px); }
.fe-head b { font-size: 14px; color: var(--fg-1); }
.fe-sec { padding: 12px 14px 14px; border-bottom: 1px solid var(--border); }
.fe-sec:last-child { border-bottom: 0; }
.fe-sec h5 { margin: 0 0 4px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-3); }
.fe .ql-field .ds-label { margin-top: 10px; font-size: 12px; }
.fe-field { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; font-size: 12px; color: var(--fg-2); font-weight: 600; }
.fe-in { padding: 7px 10px; font-size: 13px; font-weight: 400; }
.fe-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; }
.fe-card { margin-top: 10px; padding: 4px 10px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-1); }
.fe-card-h { display: flex; align-items: center; padding-top: 6px; }
.fe-n { width: 20px; height: 20px; border-radius: 50%; background: var(--fg-1); color: var(--bg-0); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.fe-add { margin-top: 10px; }
.fe-check { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--fg-1); }
.fe-check input { accent-color: var(--envoy-red); }
.fe .sg-chips { margin-top: 2px; }

/* Deck chrome on slides */
.slate-slide.br .br-period, .slate-slide.br-div .br-period { font-size: 1.15cqw; font-weight: 700; letter-spacing: .04em; color: #a4a9b6; }
.slate-slide.br .br-foot-r { display: inline-flex; gap: 1.4cqw; align-items: baseline; flex: none; }
.slate-slide.br .br-conf, .slate-slide.br-div .br-conf { font-weight: 600; color: #8a8f9e; }
.slate-slide.br .br-page, .slate-slide.br-div .br-page { font-weight: 700; color: #3f4450; }
.slate-slide.br-div .br-div-top { position: absolute; top: 5%; right: 5%; }
.slate-slide.br-div .br-div-top .br-logo { position: static; }
.slate-slide.br-div .br-div-foot { position: absolute; bottom: 5%; right: 5%; display: inline-flex; gap: 1.4cqw; font-size: .95cqw; }

/* Deck settings: tabs, palettes, colors, chrome */
.ss-dp-tabs { margin: 0 0 12px; }
.ss-dp-pal { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.ss-dp-palb { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--bg-0); color: var(--fg-1); font: inherit; font-size: 13px; cursor: pointer; }
.ss-dp-palb[aria-pressed="true"] { border-color: var(--envoy-red); box-shadow: 0 0 0 2px color-mix(in srgb, var(--envoy-red) 18%, transparent); font-weight: 600; }
.ss-dp-sw { display: inline-flex; }
.ss-dp-sw i { width: 12px; height: 12px; border-radius: 3px; margin-right: 2px; }
.ss-dp-colors { display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow-y: auto; }
.ss-dp-crow { display: flex; align-items: center; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.ss-dp-cname { flex: 0 0 140px; font-size: 13px; color: var(--fg-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-dp-cpick { display: flex; flex-wrap: wrap; gap: 5px; }
.ss-dp-dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid transparent; padding: 0; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.ss-dp-dot[aria-pressed="true"] { border-color: var(--bg-0); box-shadow: 0 0 0 2px var(--fg-1); }
.ss-dp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.ss-dp-grid .fe-check { grid-column: 1 / -1; }
@container (max-width: 560px) { .ss-dp-grid { grid-template-columns: 1fr; } }
.fe-ref-k { font-size: 12px; font-weight: 700; color: var(--fg-1); }
.fe-addrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* Studio: edit the slide in place */
.ss-stage [data-edit] { border-radius: 3px; outline: 1px dashed transparent; outline-offset: 2px; cursor: text; transition: outline-color .12s, background .12s; }
.ss-stage [data-edit]:hover { outline-color: color-mix(in srgb, var(--envoy-red) 55%, transparent); }
.ss-stage [data-edit]:focus { outline: 2px solid var(--envoy-red); background: rgba(255,255,255,.6); }
.ss-stage .br-hero [data-edit]:focus, .ss-stage .br-tile.red [data-edit]:focus, .ss-stage .br-tile.indigo [data-edit]:focus { background: rgba(255,255,255,.18); outline-color: #fff; }
.ss-stage .ss-series { cursor: pointer; }
.ss-stage text.ss-series:hover { text-decoration: underline; }
.ss-stage .slate-legend .ss-series:hover { text-decoration: underline; }

/* Board-deck tables */
.slate-table { width: 100%; border-collapse: collapse; font-size: 1.15cqw; color: #1f232d; font-variant-numeric: tabular-nums; }
.slate-table th { background: #3f4450; color: #fff; font-size: 1cqw; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; text-align: left; padding: .7cqw .9cqw; }
.slate-table td { padding: .6cqw .9cqw; border-bottom: 1px solid #ebebf0; }
.slate-table tbody tr:nth-child(even) td { background: #f9f9fb; }
.slate-table .num { text-align: right; }
.slate-table td.lead { font-weight: 700; }
.slate-table td.up { color: #4141a2; font-weight: 700; }
.slate-table td.down { color: var(--envoy-red); font-weight: 700; }
.slate-table th.hl { background: #c9312a; }
.slate-table td.hl, .slate-table tbody tr:nth-child(even) td.hl { background: #fdecea; }
.slate-table.bold-last tbody tr:last-child td { font-weight: 800; border-top: 1.5px solid #3f4450; border-bottom: 0; }
.ss-thumb-art .slate-table, .sd-thumb .slate-table { font-size: 6px; }
.ss-thumb-art .slate-table { zoom: .5; }

/* Two charts side by side */
.slate-slide.br .br-pair { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 1.4cqw; }
.slate-slide.br .br-pair .br-chart { min-height: 0; }
/* Text slide ("State of Envoy") */
.slate-slide.br .br-tcols { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 1.4cqw; height: 100%; }
.slate-slide.br .br-tcol { border: 1px solid #ebebf0; border-top: .4cqw solid #a4a9b6; border-radius: .6cqw; padding: 1.2cqw 1.4cqw; min-height: 0; overflow: hidden; }
.slate-slide.br .br-tcol.red { border-top-color: var(--envoy-red); }
.slate-slide.br .br-tcol.indigo { border-top-color: #4141a2; }
.slate-slide.br .br-tcol-h { font-size: 1.35cqw; font-weight: 700; padding-bottom: .8cqw; margin-bottom: .8cqw; border-bottom: 1px solid #ebebf0; color: #717684; }
.slate-slide.br .br-tcol.red .br-tcol-h { color: var(--envoy-red); }
.slate-slide.br .br-tcol.indigo .br-tcol-h { color: #4141a2; }
.slate-slide.br .br-tcol ul { margin: 0; padding-left: 1.6cqw; font-size: 1.2cqw; line-height: 1.5; color: #1f232d; }
.slate-slide.br .br-tcol li { margin-bottom: .5cqw; }
.slate-slide.br.br-text .br-body { border-top: 0; padding-top: .4cqw; }
/* Text slide editor */
.ts-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.ts-col { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 3px solid #a4a9b6; }
.ts-col.red { border-top-color: var(--envoy-red); }
.ts-col.indigo { border-top-color: #4141a2; }
.ts-head { font-weight: 700; }
.ts-bul { resize: vertical; line-height: 1.45; }
@media (max-width: 720px) { .ts-cols { grid-template-columns: 1fr; } }

/* Templates and presets */
.ss-dp-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 10px; font-size: 12.5px; }
.ss-dp-presets .ss-link { margin-left: 4px; font-size: 12.5px; }
.ss-tmenu { min-width: 300px; left: auto; right: 0; }
.ss-trow { display: flex; align-items: center; gap: 4px; }
.ss-trow > button:first-child { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.ss-trow > button:first-child span { font-size: 11.5px; color: var(--fg-3); }
.ss-tempty { padding: 8px 10px; margin: 0; }

/* Decks on the server: bar, conflicts, comments, history */
.sp-deckbar { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.sp-sync { font-size: 12.5px; color: var(--fg-3); }
.sp-sync .ss-link { font-size: 12.5px; }
.sp-conflict { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--envoy-red) 35%, transparent); background: color-mix(in srgb, var(--envoy-red) 7%, var(--bg-0)); font-size: 13px; }
.sp-conflict .primary-btn, .sp-conflict .secondary-btn, .sp-deckbar .secondary-btn { width: auto; }
.sp-viewonly { margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; background: var(--bg-2); font-size: 13px; color: var(--fg-2); }
.sd-cbtn { position: relative; }
.sd-badge { position: absolute; top: -2px; right: -4px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px; background: var(--envoy-red); color: #fff; font-size: 10px; font-weight: 700; line-height: 15px; text-align: center; }
.sd-locked { color: var(--fg-1); }
.ss-cpop { right: 12px; left: auto; top: calc(100% - 6px); width: min(380px, 90vw); padding: 0; }
.sd-menu.is-floating { position: fixed; right: auto; z-index: 400; overflow-y: auto; max-width: calc(100vw - 16px); }
.ss-clist { max-height: 260px; overflow-y: auto; padding: 6px 10px; }
.ss-c { padding: 8px 0; border-bottom: 1px solid var(--border); }
.ss-c.done { opacity: .6; }
.ss-c-h { display: flex; gap: 8px; align-items: baseline; font-size: 12px; color: var(--fg-3); }
.ss-c-h b { color: var(--fg-1); }
.ss-c-h .ss-link, .ss-c-h .ss-muted-i { margin-left: auto; font-size: 12px; }
.ss-c p { margin: 4px 0 0; font-size: 13px; line-height: 1.45; color: var(--fg-1); white-space: pre-wrap; }
.ss-cnew { display: flex; gap: 8px; align-items: flex-end; padding: 10px; border-top: 1px solid var(--border); }
.ss-cnew textarea { flex: 1; resize: vertical; }
.ss-cnew .primary-btn { width: auto; }
.vh-list { display: flex; flex-direction: column; max-height: 420px; overflow-y: auto; }
.vh-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.vh-row > div { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.vh-row span { color: var(--fg-3); font-size: 12px; }
.vh-row .secondary-btn { width: auto; }
.sd-row { position: relative; }
.sd-locked { color: var(--envoy-red); }
.sd-acts .artdash-icon-btn svg { display: block; }
/* Library rows: share with Envoy */
.sd-menu .ss-lib-share { flex: none; align-self: center; padding: 3px 10px; border: 1px solid var(--border-strong); border-radius: 999px; font-size: 11.5px; font-weight: 600; color: var(--fg-2); background: var(--bg-0); }
.sd-menu .ss-lib-share[aria-pressed="true"] { border-color: rgba(250, 67, 56, .35); color: var(--envoy-red); background: rgba(250, 67, 56, .06); }
/* Slides draw in the deck's font (the Envoy template's Proxima Nova) where the machine has it, so the preview matches Google Slides. */
.slate-slide, .slate-slide button, .slate-slide input, .slate-slide textarea { font-family: "Proxima Nova", "Sofia Pro", system-ui, -apple-system, sans-serif; }
/* Query Lab tabs: one SQL window each, a + to add, × to close, double-click to rename. */
.ql-tabs { display: flex; align-items: flex-end; gap: 6px; margin: 0 0 10px; padding: 0 2px; border-bottom: 1px solid var(--ql-border, var(--border)); }
.ql-tabs-strip { flex: 0 1 auto; min-width: 0; display: flex; align-items: flex-end; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.ql-tabs-strip::-webkit-scrollbar { display: none; }
.ql-tab { flex: 0 1 190px; min-width: 96px; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 6px 0 12px; border: 1px solid var(--ql-subtle, var(--border)); border-bottom: 0; border-radius: 8px 8px 0 0; color: var(--ql-fg2, var(--fg-2)); font-size: 13px; cursor: pointer; user-select: none; margin-bottom: -1px; }
/* Every tab has a faint outline; the open one is a shade darker. */
.ql-tab:hover { background: var(--ql-ed-bg, var(--bg-0)); color: var(--ql-fg, var(--fg-1)); }
.ql-tab.is-on { background: var(--ql-head, var(--arctic)); border-color: var(--ql-border, var(--border)); color: var(--ql-fg, var(--fg-1)); font-weight: var(--fw-medium); }
.ql-tab:focus-visible { outline: 2px solid rgba(250, 67, 56, .35); outline-offset: -2px; }
.ql-tab-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ql-tab-x { flex: none; margin-left: auto; width: 20px; height: 20px; border: 0; border-radius: 5px; background: none; color: inherit; opacity: .45; font-size: 15px; line-height: 1; cursor: pointer; }
.ql-tab-x:hover, .ql-tab-x:focus-visible { opacity: 1; background: rgba(0, 0, 0, .07); outline: none; }
.ql-tab .ds-spin { width: 11px; height: 11px; }
.ql-tab-addwrap { flex: none; display: inline-flex; margin: 0 0 2px 2px; }
.ql-tab-add, .ql-tab-more { height: 28px; border: 0; border-radius: 6px; background: none; color: var(--ql-fg2, var(--fg-2)); cursor: pointer; line-height: 1; }
.ql-tab-add { width: 30px; font-size: 17px; }
.ql-tab-more { width: 22px; display: inline-grid; place-items: center; }
.ql-tab-add:hover, .ql-tab-add:focus-visible, .ql-tab-more:hover, .ql-tab-more:focus-visible { background: var(--ql-subtle, var(--bg-2)); color: var(--ql-fg, var(--fg-1)); outline: none; }
.ql-tabs .ql-fs-btn { flex: none; margin-bottom: 4px; }
.ql-share-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; max-height: 260px; overflow: auto; }

/* Three charts side by side (a slide with three datasets). */
.slate-slide.br .br-pair.br-trio { grid-template-columns: 1fr 1fr 1fr; }
.slate-slide .ss-loading-chart { display: grid; place-items: center; height: 100%; margin: 0; font-size: 1.1cqw; }
/* Slate Plan step: a deck across several datasets. */
.sp-planner { display: flex; flex-direction: column; gap: 14px; }
.sp-sets { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.sp-set { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-0); min-width: 0; }
.sp-set > div { display: flex; flex-direction: column; min-width: 0; }
.sp-set b { font-size: 13.5px; color: var(--fg-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-set span { font-size: 12px; color: var(--fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-set-l, .sp-set-chip b { flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--fg-1); color: #fff; font-size: 11.5px; font-weight: 700; }
.sp-set-chip b { width: 18px; height: 18px; font-size: 10.5px; margin-right: 4px; background: var(--fg-3); }
.sp-set-chip[aria-pressed="true"] b { background: var(--envoy-red); }
.sp-plan-go { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sp-plan { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--border); padding-top: 14px; }
.sp-plan-story { margin: 0; font-size: 14px; color: var(--fg-2); }
.sp-plan-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sp-plan-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-0); }
.sp-plan-n { font-weight: 800; color: var(--envoy-red); font-size: 15px; padding-top: 8px; }
.sp-plan-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sp-plan-h { width: 100%; font-weight: 600; }
.sp-plan-sets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sp-plan-acts { display: flex; gap: 2px; }
.sp-plan-foot { display: flex; justify-content: flex-end; align-items: center; gap: 12px; border-top: 1px solid var(--border); padding-top: 14px; }
.sp-plan-foot .primary-btn { width: auto; }
.sp-plan-go .primary-btn, .sp-plan-go .secondary-btn { width: auto; }
.sp-build { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--fg-2); }
@media (max-width: 640px) { .sp-plan-row { grid-template-columns: 1fr; } .sp-plan-acts { justify-content: flex-end; } }

/* Query Lab sessions: a switcher left of the tabs (only with 2+ sessions) and small menus. */
.ql-sess { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; max-width: 220px; margin: 0 4px 2px 0; padding: 0 10px; border: 1px solid var(--ql-border, var(--border-strong)); border-radius: 8px; background: var(--ql-ed-bg, var(--bg-0)); color: var(--ql-fg, var(--fg-1)); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.ql-sess:hover, .ql-sess:focus-visible { border-color: var(--envoy-red); outline: none; }
.ql-sess-dot { display: none; } /* was always red: red reads as an error and meant nothing */
.ql-sess-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ql-smenu { position: fixed; z-index: 400; min-width: 260px; max-width: min(380px, calc(100vw - 16px)); max-height: min(70vh, 520px); overflow: auto; padding: 6px; border: 1px solid var(--ql-border, var(--border-strong)); border-radius: 10px; background: var(--ql-bg, var(--bg-0)); color: var(--ql-fg, var(--fg-1)); box-shadow: 0 12px 32px rgba(16,24,40,.16); font-size: 13.5px; }
.ql-smenu-sessions { min-width: 330px; }
.ql-smenu .ql-pop-search { width: 100%; margin-bottom: 4px; }
.ql-smenu-it { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: none; color: var(--ql-fg, var(--fg-1)); font: inherit; text-align: left; cursor: pointer; }
.ql-smenu-it:hover, .ql-smenu-it:focus-visible { background: var(--bg-2); outline: none; }
.ql-smenu-it kbd { margin-left: auto; font: 11px ui-monospace, Menlo, monospace; color: var(--ql-fg3, var(--fg-3)); }
.ql-smenu-note { margin: 2px 10px 6px; font-size: 12px; color: var(--ql-fg3, var(--fg-3)); line-height: 1.4; }
.ql-smenu-h { padding: 8px 10px 3px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-3); }
.ql-smenu hr { border: 0; border-top: 1px solid var(--border); margin: 5px 0; }
.ql-srow { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 6px; cursor: pointer; }
.ql-srow:hover, .ql-srow:focus-visible { background: var(--bg-2); outline: none; }
.ql-srow.is-on { background: rgba(250, 67, 56, .07); }
.ql-srow-t { display: flex; flex-direction: column; min-width: 0; }
.ql-srow-t b { font-weight: 600; color: var(--ql-fg, var(--fg-1)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ql-srow-t span { font-size: 12px; color: var(--ql-fg3, var(--fg-3)); }
.ql-srow-acts { margin-left: auto; display: flex; gap: 2px; opacity: 0; }
.ql-srow:hover .ql-srow-acts, .ql-srow:focus-within .ql-srow-acts, .ql-srow:focus .ql-srow-acts, .ql-srow.is-on .ql-srow-acts { opacity: 1; }
@media (hover: none) { .ql-srow-acts { opacity: 1; } } /* touch: no hover to reveal them */
.ql-srow-acts button { border: 0; background: none; padding: 2px 6px; border-radius: 4px; font: inherit; font-size: 12px; color: var(--ql-fg2, var(--fg-2)); cursor: pointer; }
.ql-srow-acts button:hover { background: var(--ql-hover, var(--bg-0)); color: var(--ql-fg, var(--fg-1)); }
.ql-sess svg, .ql-tab-more svg { flex: none; transform: rotate(90deg); opacity: .7; }
/* Tabs never collapse to nothing: at least one tab's width; the link buttons drop to icons first. */
.ql-tabs { container-type: inline-size; }
.ql-tabs-strip { min-width: min(140px, 40%); }
@container (max-width: 640px) { .ql-tabs .ql-fs-btn { font-size: 0; gap: 0; padding-left: 6px; padding-right: 6px; } .ql-sess { max-width: 150px; } }

.ql-smenu-h-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ql-smenu-link { border: 0; background: none; padding: 0; font: inherit; font-size: 11px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--envoy-red); cursor: pointer; }
.ql-smenu-link:hover { text-decoration: underline; }
.ql-srow:focus { outline: 2px solid rgba(250, 67, 56, .35); outline-offset: -2px; }
