/* Palette: validated reference instance. Light only - no dark theme. */
:root{
  --plane:#f9f9f7; --surface:#fcfcfb; --line:#e3e2dd;
  --ink:#0b0b0b; --ink2:#52514e; --ink3:#8a8983;
  --accent:#2a78d6;
  --s1:#2a78d6; --s2:#eb6834; --s3:#1baf7a; --s4:#eda100;
  --s5:#e87ba4; --s6:#008300; --s7:#4a3aa7; --s8:#e34948;
  --good:#0ca30c; --critical:#d03b3b;
  --radius:10px; --nav:212px; --nav-min:52px;

  /* Extended tokens (enterprise shell) - additive, do not replace the tokens above.
     Surfaces/text/borders/semantic follow the same light-only palette. */
  --surface-2:#f4f4f1;              /* secondary surface: slightly recessed from --surface */
  --surface-hover:#f1f1ee;
  --surface-selected:color-mix(in srgb, var(--accent) 8%, var(--surface));
  --overlay:rgba(16,24,40,.34);
  --border-strong:#c9c8c2;
  --border-subtle:#ececE7;
  --ink-disabled:#b8b7b1;
  --ink-inverse:#ffffff;
  --warn:#b45309; --warn-bg:#fff7ed; --warn-border:#f5c99b;
  --info:#2a78d6; --info-bg:#eef4fd; --info-border:#cfe0f8;
  --topbar-h:52px;
  --sp-1:4px; --sp-2:8px; --sp-3:12px; --sp-4:16px; --sp-5:20px; --sp-6:24px; --sp-7:32px; --sp-8:40px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; display:flex; flex-direction:column; height:100vh; background:var(--plane); color:var(--ink);
  font:14px/1.5 ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
}
#shell{flex:1;display:flex;min-height:0}
h1{font-size:21px;letter-spacing:-.01em;margin:0 0 4px}
h2{font-size:14px;font-weight:600;color:var(--ink2);margin:26px 0 10px}
p{margin:0}
a{color:var(--accent);text-decoration:none}
a:hover{text-decoration:underline}
.hidden{display:none !important}
.muted{color:var(--ink3)}
.small{font-size:12px}
.mono{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}
.grow{flex:1;min-width:0}
.row{display:flex;gap:8px;align-items:center;flex:0 0 auto}

button,.btn{font:inherit;cursor:pointer;border-radius:8px;border:1px solid var(--line);
  background:var(--surface);color:var(--ink);padding:6px 12px;display:inline-block}
button:hover,.btn:hover{border-color:var(--ink3);text-decoration:none}
button.ghost{background:transparent}
button.primary,.btn.primary{background:var(--accent);color:#fff;border-color:transparent;font-weight:600}
button.primary:hover{filter:brightness(.94)}
button.danger{color:var(--critical)}
button.danger:not(.ghost){border-color:var(--critical)}
button.danger:not(.ghost):hover{background:var(--critical);color:#fff}
button:disabled{opacity:.5;cursor:default}

input,select,textarea{font:inherit;width:100%;padding:7px 9px;border-radius:8px;
  border:1px solid var(--line);background:var(--surface);color:var(--ink)}
textarea{resize:vertical}
label{display:block;font-size:12px;color:var(--ink3)}
label input,label select{margin-top:4px;color:var(--ink)}
.chk{display:flex;gap:6px;align-items:center;font-size:12.5px;color:var(--ink2)}
.chk input{width:auto;margin:0}

/* ---------- nav ---------- */
#nav{width:var(--nav);flex:0 0 var(--nav);height:100%;overflow-y:auto;
  display:flex;flex-direction:column;gap:2px;padding:16px 12px;
  border-right:1px solid var(--line);background:var(--surface)}
#nav .brand{font-weight:700;letter-spacing:-.01em;padding:0 4px 14px;
  display:flex;align-items:center;justify-content:space-between;gap:6px}
#nav .brand span{white-space:nowrap;overflow:hidden}
.brand-link{display:flex;align-items:center;text-decoration:none;min-width:0;overflow:hidden}
.brand-logo{height:28px;max-width:145px;width:auto;object-fit:contain;display:block}
.brand-name{display:flex;align-items:center;gap:8px;font-size:15px}
.brand-mark{color:var(--accent);font-size:13px;flex:0 0 auto}
body.nav-collapsed .brand-mark{font-size:15px}
#nav-toggle{border:0;background:transparent;color:var(--ink3);padding:2px 6px;
  font-size:14px;line-height:1;border-radius:6px;flex:0 0 auto}
#nav-toggle:hover{background:var(--plane);color:var(--ink);border:0}
#nav a,.nav-soon{display:flex;align-items:center;gap:9px;padding:7px 10px;border-radius:8px;
  color:var(--ink2);font-size:13.5px;white-space:nowrap;overflow:hidden}
#nav a i,.nav-soon i{font-style:normal;width:16px;text-align:center;flex:0 0 auto;
  font-size:13px;opacity:.75}

/* Section grouping - a label above each workflow stage (Home/Data/Analyze/Build/...),
   not a full rule, to stay subtle at this density. First one needs no top gap. */
.nav-group-label{font-size:10.5px;font-weight:700;text-transform:uppercase;letter-spacing:.07em;
  color:var(--ink3);padding:14px 10px 4px}
.nav-group-label:first-of-type{padding-top:2px}

/* Coming soon - same row rhythm as a real nav link, but inert: no href, no hover affordance,
   muted text, and a small badge instead of pretending the destination exists. */
.nav-soon{color:var(--ink-disabled);cursor:default}
.nav-soon i{opacity:.5}
.nav-soon .soon-badge{margin-left:auto;font-size:9.5px;font-weight:700;text-transform:uppercase;
  letter-spacing:.04em;color:var(--ink3);border:1px solid var(--line);border-radius:4px;
  padding:1px 5px;flex:0 0 auto}

/* Collapsed: icons only. The width is a token so main content reflows with it, and the
   choice is remembered - a menu that springs back open every page is worse than no menu. */
body.nav-collapsed #nav{width:var(--nav-min);flex:0 0 var(--nav-min);padding-left:8px;padding-right:8px}
body.nav-collapsed #nav .brand-text,
body.nav-collapsed #nav a span,
body.nav-collapsed .nav-soon span,
body.nav-collapsed .nav-soon .soon-badge,
body.nav-collapsed .nav-group-label,
body.nav-collapsed #nav .nav-foot{display:none}
body.nav-collapsed #nav .brand{display:flex;flex-direction:column;align-items:center;gap:8px;padding:0 0 14px}
body.nav-collapsed .brand-link{justify-content:center}
body.nav-collapsed .brand-logo{width:32px;height:32px;object-fit:cover;object-position:left center;border-radius:4px}
body.nav-collapsed #nav a,body.nav-collapsed .nav-soon{justify-content:center;padding:8px 0}
body.nav-collapsed #nav a i,body.nav-collapsed .nav-soon i{width:auto;font-size:15px;opacity:.9}
body.nav-collapsed .nav-soon i{opacity:.5}
#nav,#nav a{transition:width .15s ease,flex-basis .15s ease}
@media (prefers-reduced-motion:reduce){#nav,#nav a{transition:none}}
#nav a:hover{background:var(--plane);text-decoration:none}
#nav a.on{background:var(--plane);color:var(--ink);font-weight:600}
.nav-foot{margin-top:auto;padding:10px 10px 0;border-top:1px solid var(--line);font-size:12px}
.dot{display:inline-block;width:7px;height:7px;border-radius:50%;margin-right:6px}
.dot.rw{background:var(--good)} .dot.ro{background:var(--ink3)}

/* ---------- page ---------- */
#view{flex:1;min-width:0;height:100%;overflow:auto}
.page{padding:22px 26px 80px;max-width:1500px}
.page-head{display:flex;justify-content:space-between;gap:20px;align-items:flex-start;margin-bottom:18px}
.crumb{font-size:12px;color:var(--ink3);margin-bottom:4px}
.loading{padding:40px 26px;color:var(--ink3)}

/* A page hosting the 3-zone analytical workspace fills the viewport exactly instead of
 * growing with its content: the header is a fixed-size flex item and .workspace takes
 * whatever is left. This replaces a fragile "100vh minus a guessed header height" calc
 * that under-counted the page's own padding + crumb + h1, which is what was pushing the
 * chat panel's question input below the fold (needing a scroll no one expected).
 *
 * The chat panel is a full-height docked sidebar, not a third grid column that shares the
 * page's own top/bottom padding - it reaches from the topbar's own divider line straight
 * to the bottom of the viewport, independent of this page's breadcrumb/title. .page's
 * normal padding is zeroed here and reapplied only to .ws-main (breadcrumb + title +
 * filters/canvas), so .ws-chat can sit flush against every edge. */
.page.page-workspace{padding:0}
.page-workspace{height:calc(100vh - var(--topbar-h));display:flex;flex-direction:column;
  overflow:hidden}
.ws-shell{display:flex;flex:1;min-height:0}
.ws-main{flex:1;min-width:0;display:flex;flex-direction:column;min-height:0;
  padding:22px 26px 16px}
.ws-main .page-head{flex:0 0 auto}
.ws-main .workspace{flex:1;min-height:0;height:auto}
/* The Ask workspace scrolls INSIDE .workspace, so .ws-main itself never needs to. A
   report has no such inner box - its hero, executive summary and panel grid are stacked
   children of .ws-main - so under .page-workspace's overflow:hidden a board taller than
   the viewport was simply clipped, with no way to reach the panels below the fold. */
.page-workspace.report .ws-main{overflow-y:auto;overflow-x:hidden}

.stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px}
.stat{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:12px 14px}
.stat .k{font-size:11.5px;color:var(--ink3)}
.stat .v{font-size:22px;font-weight:700;letter-spacing:-.02em}

.cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:10px}
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);
  padding:12px 14px;display:block;color:inherit}
.card:hover{border-color:var(--ink3);text-decoration:none}
/* Overview's small cards reuse the same real preview (renderOne()'s `mini` option, a
   captured data sample - see loadCardPreview()/mountCardPreview() in views.js) as the
   Ask/Reports/Custom Builder library cards, just shorter. Negative margin bleeds it to the
   card's edges past the card's own padding, matching the library card's full-bleed look. */
.card-preview-ov{position:relative;height:90px;margin:-12px -14px 8px;background:var(--plane);
  border-radius:var(--radius) var(--radius) 0 0;border-bottom:1px solid var(--line);overflow:hidden}
.card-top{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
.card-title{font-weight:600;font-size:13.5px}
.empty-card{grid-column:1/-1;background:var(--surface);border:1px dashed var(--line);
  border-radius:var(--radius);padding:16px;color:var(--ink3);font-size:13px}
.empty-card.bad{border-color:var(--critical);color:var(--critical)}

/* ---------------------------------------------------------------- asset library cards
   The Ask/Reports/Custom Builder library grid (see renderCardList() in views.js) - a
   distinct class from the plain .cards/.card above (still used by Overview's small
   preview cards and Connectors) since these are a full "analytical asset" gallery:
   sized bigger, with a structural preview area (see the Analytical Subgraph Preview
   block below), clickable as a whole to open the Asset Overview drawer rather than a
   plain link. */
/* Mobile 1 / tablet 2 / desktop 3 (the preferred column count) / a 4th column only once
   there is genuinely enough width for a 4th card to stay readable. */
.asset-cards{display:grid;grid-template-columns:1fr;gap:16px}
@media (min-width:640px){.asset-cards{grid-template-columns:repeat(2,1fr)}}
@media (min-width:1100px){.asset-cards{grid-template-columns:repeat(3,1fr)}}
@media (min-width:1600px){.asset-cards{grid-template-columns:repeat(4,1fr)}}

.asset-card{display:flex;flex-direction:column;background:var(--surface);
  border:1px solid var(--line);border-radius:var(--radius);overflow:hidden;
  min-height:360px;cursor:pointer;color:inherit;
  transition:border-color .12s ease,box-shadow .12s ease}
.asset-card:hover{border-color:var(--ink3);box-shadow:0 2px 12px rgba(0,0,0,.07)}
.asset-card:focus-visible{outline:2px solid var(--accent);outline-offset:2px}

/* The preview occupies ~40% of the card - a REAL miniature ECharts render of the asset's
   own saved chart (see loadCardPreview()/mountCardPreview() in views.js, built on
   charts.js's `mini` option and a small captured data sample - core/asset_lifecycle's
   widgets.preview / a report panel's own embedded .preview), never a placeholder and
   never a fabricated number. Lazily mounted once scrolled into view. */
.card-preview{position:relative;flex:none;height:150px;background:var(--plane);
  border-bottom:1px solid var(--line);overflow:hidden}
/* Mounted into separately from the ⋮ overlay below - renderOne()/renderPanels() replace
   their host's entire innerHTML, which would otherwise wipe the menu button out too. */
.card-preview-inner{position:absolute;inset:0}
.card-preview-skel{position:absolute;inset:0;border-radius:0}
.card-preview-empty{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;text-align:center}
.card-menu-overlay{position:absolute;top:6px;right:6px;z-index:2}
.card-menu-overlay button{background:var(--surface);border:1px solid var(--line)}

.card-body{padding:12px 14px;display:flex;flex-direction:column;gap:4px;flex:1}
.tag-chip-more{color:var(--ink3);background:var(--plane)}

/* ---------------------------------------------------------------- Asset Overview drawer
   Opened by clicking a card (or its ⋮ menu's "Preview") - see openAssetOverview() in
   views.js. Reuses ui.js's openDrawer() shell, just narrower than its 680px default. */
.drawer.asset-overview{width:min(480px,92vw)}
.aov-header{padding-bottom:14px;border-bottom:1px solid var(--line);margin-bottom:4px}
.aov-meta-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-top:10px}
.aov-section{padding:14px 0;border-top:1px solid var(--line)}
.aov-section:first-of-type{border-top:0}
.aov-section-label{font-size:11px;text-transform:uppercase;letter-spacing:.05em;
  color:var(--ink3);font-weight:700;margin-bottom:6px}
.aov-preview{position:relative;height:240px;background:var(--plane);
  border:1px solid var(--line);border-radius:var(--radius);overflow:hidden}

.tag{font-size:10.5px;text-transform:uppercase;letter-spacing:.05em;font-weight:700;
  color:var(--ink3);border:1px solid var(--line);border-radius:5px;padding:1px 6px}
.tag.generated{color:var(--accent);border-color:var(--accent)}
.tag.custom{color:var(--s3);border-color:var(--s3)}
.tag.widget{color:var(--s5);border-color:var(--s5)}

.card-desc{font-size:12.5px;color:var(--ink2);margin:2px 0 8px;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.card-meta{font-size:11.5px;color:var(--ink3);display:flex;align-items:center;gap:5px;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

.tag-chips{display:flex;flex-wrap:wrap;gap:5px;margin-top:6px}
.tag-chip{font-size:10.5px;color:var(--ink2);background:var(--plane);
  border:1px solid var(--line);border-radius:999px;padding:2px 9px;line-height:1.5}
/* Clickable only inside an asset card (a shortcut to filter by that tag - see
   renderCardList() in views.js); elsewhere (Overview's preview cards, a report's own tag
   row) a chip is still just a label. */
.asset-card .tag-chip{cursor:pointer}
.asset-card .tag-chip:hover{border-color:var(--accent);color:var(--accent)}
.tag-filter{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:12px}
.tag-filter button{font-size:12px;color:var(--ink2);background:var(--surface);
  border:1px solid var(--line);border-radius:999px;padding:5px 12px;
  transition:border-color .12s ease,color .12s ease,background .12s ease}
.tag-filter button:hover{border-color:var(--accent);color:var(--accent)}
.tag-filter button.active{background:var(--accent);border-color:var(--accent);color:#fff}

/* Deterministic per-tag color (see tagColorClass() in views.js) - not literally random,
   the same tag text always lands on the same one of these 8 slots everywhere it appears,
   reusing the app's own chart-series palette (--s1..--s8) rather than a second one. */
.tag-c1{--tc:var(--s1)} .tag-c2{--tc:var(--s2)} .tag-c3{--tc:var(--s3)} .tag-c4{--tc:var(--s4)}
.tag-c5{--tc:var(--s5)} .tag-c6{--tc:var(--s6)} .tag-c7{--tc:var(--s7)} .tag-c8{--tc:var(--s8)}
.tag-chip[class*="tag-c"]{background:color-mix(in srgb, var(--tc) 14%, var(--surface));
  color:var(--tc);border-color:color-mix(in srgb, var(--tc) 40%, var(--line))}
.tag-filter button[class*="tag-c"]{color:var(--tc);border-color:color-mix(in srgb, var(--tc) 45%, var(--line))}
.tag-filter button[class*="tag-c"]:hover{border-color:var(--tc);color:var(--tc);background:transparent}
.tag-filter button[class*="tag-c"].active{background:var(--tc);border-color:var(--tc);color:#fff}

/* Search/datasource/sort toolbar shared by every saved-item list (Ask, Reports, Custom
   builder - see renderCardList() in views.js). Built once per list render; only the results
   below it repaint on a filter change, so the search input never loses focus mid-type. */
.list-toolbar{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:12px}
.list-toolbar input[type=search]{flex:1;min-width:180px}
.list-toolbar select{width:auto;min-width:150px}
.list-noresults{color:var(--ink3);font-size:13px;padding:32px 0;text-align:center}

/* The Filter button opens a real left-side drawer (not an inline box pushing the page
   around) - toggling it also collapses/expands the main nav sidebar for room (see
   setNavCollapsedForFilter() in views.js), since both are pinned to the left edge. */
#lcl-filter-btn.active{background:var(--accent);border-color:var(--accent);color:#fff}
.lcl-backdrop{position:fixed;inset:0;background:rgba(16,24,40,.28);z-index:59}
.list-filter-drawer{position:fixed;left:0;top:0;bottom:0;width:300px;max-width:88vw;
  z-index:60;background:var(--surface);border-right:1px solid var(--line);
  box-shadow:14px 0 32px rgba(0,0,0,.10);overflow-y:auto;padding:14px 16px}
.lcl-drawer-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}
.lcl-filter-group{padding:12px 0;border-top:1px solid var(--line)}
.lcl-filter-group:first-of-type{border-top:0;padding-top:0}
.lcl-filter-group label{font-size:12px;color:var(--ink3);display:block}
.lcl-filter-label{font-size:11px;text-transform:uppercase;letter-spacing:.05em;
  color:var(--ink3);font-weight:700;margin-bottom:8px}
.lcl-filter-group input[type=search]{margin-bottom:8px}
.list-filter-drawer .tag-filter{margin-bottom:0}
#lcl-clear{margin-top:6px;width:100%}

/* Status filter checkboxes (see renderCardList() in views.js) - same status-dot language
   as the card itself, one per row so a live count can sit flush right. */
.status-check{display:flex;align-items:center;gap:6px;font-size:12.5px;
  color:var(--ink2);width:100%;cursor:pointer;padding:3px 0}
.status-check input{width:auto;margin:0}
.lcl-status-name{flex:1}
.lcl-status-count{color:var(--ink3)}

/* One controlled status enum, shown as a small dot + label - never a colored block (see
   the asset lifecycle spec: subtle, easy to recognise, must not dominate the card). */
.status-dot{display:inline-block;width:8px;height:8px;border-radius:50%;flex:none}
.status-dot.status-draft{background:var(--ink3)}
.status-dot.status-ready{background:var(--good)}
.status-dot.status-published{background:var(--good)}
.status-dot.status-archived{background:var(--ink3)}
.status-dot.status-failed{background:var(--critical)}
.card-status{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--ink2);margin-top:6px}
.card-owner{margin-top:2px}
.card-error{font-size:11.5px;color:var(--critical);margin-top:2px}

.tag-suggest-row{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin-top:8px;min-height:22px}
.tag-suggest{font-size:11.5px;color:var(--accent);background:transparent;
  border:1px dashed var(--accent);border-radius:999px;padding:3px 10px;
  transition:background .12s ease,opacity .12s ease}
.tag-suggest:hover{background:color-mix(in srgb, var(--accent) 10%, transparent)}
.tag-suggest:disabled{opacity:.4;border-style:solid;cursor:default}

.list{display:flex;flex-direction:column;gap:6px}
.list-row{display:flex;gap:12px;align-items:center;background:var(--surface);
  border:1px solid var(--line);border-radius:var(--radius);padding:10px 14px;font-size:13px}
.list-row.active{border-color:var(--accent)}

.form{display:flex;flex-direction:column;gap:12px;max-width:720px}
.card-form{background:var(--surface);border:1px solid var(--line);
  border-radius:var(--radius);padding:16px}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:12px}

.checks{margin-top:6px;border-radius:8px;padding:10px 12px;background:var(--plane);
  border:1px solid var(--line);display:flex;flex-direction:column;gap:5px;font-size:12.5px}
.checks.ok{border-color:var(--good)} .checks.bad{border-color:var(--critical)}
.check{display:flex;gap:8px;align-items:baseline}
.check.bad{color:var(--critical)}
.check-row{display:flex;align-items:center;gap:10px;padding:9px 0;border-bottom:1px solid var(--line)}
.check-row:last-of-type{border-bottom:0}

.uploader{text-align:center;padding:18px;border-radius:var(--radius);
  border:1px dashed var(--line);color:var(--ink2);cursor:pointer;font-size:13px}
.uploader:hover{border-color:var(--accent);color:var(--accent)}
/* the accepted-formats line sits under the prompt, not beside it */
.uploader span{display:block;margin-top:4px;font-size:11.5px}

.picker{display:flex;gap:12px;margin-bottom:12px;max-width:720px}
.picker label{flex:1}
.chips{display:flex;flex-wrap:wrap;gap:6px;margin:10px 0 4px}
.chips button{font-size:11.5px;padding:4px 9px;color:var(--ink2);text-align:left}

.result{margin-top:18px}
.result-head{display:flex;justify-content:space-between;gap:20px;align-items:flex-start;margin-bottom:14px}
.result-head h2{margin:0 0 4px;font-size:17px;color:var(--ink);font-weight:600}
.result-head p{color:var(--ink2);max-width:78ch}
.insights{margin:8px 0 0;padding-left:18px;color:var(--ink2);font-size:13px}
.followups{display:flex;flex-wrap:wrap;gap:6px;margin-top:16px}
.followups .lbl{width:100%;font-size:10.5px;text-transform:uppercase;letter-spacing:.05em;color:var(--ink3)}
.followups button{font-size:11.5px;padding:4px 9px;color:var(--ink2);text-align:left}

/* ---------- panels ---------- */
.grid{display:grid;grid-template-columns:repeat(12,1fr);gap:12px}
.panel{min-width:0;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);
  padding:12px 14px;display:flex;flex-direction:column;overflow:hidden}
.panel h3{margin:0;font-size:13px;font-weight:600;color:var(--ink2)}
.panel .desc{font-size:11.5px;color:var(--ink3);margin:2px 0 6px;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.panel .chart{flex:1;min-height:0}
.panel-error{border-color:var(--critical)}
/* A KPI card is label, optional description, then the figure - the figure centred in
   whatever room the first two leave, so a row of cards lines its numbers up whether or
   not each one carries a description. `min-width:0` + the wrap below keep a long
   formatted value inside the card instead of pushing past its edge. */
.kpi-val{font-size:clamp(20px,2.2vw,30px);font-weight:700;letter-spacing:-.02em;
  line-height:1.1;margin:auto 0;min-width:0;overflow-wrap:anywhere;
  font-variant-numeric:tabular-nums}
/* A gauge is a chart, so it gets the same flexible box every other chart gets - it must
   never be taller than the card that holds it. */
.panel .chart canvas{max-width:100%}
.tablewrap{overflow:auto;flex:1}

/* mini: a thumbnail-sized panel for a card/drawer preview (see renderPanel()'s mini
   param in charts.js) - same panel, no border/padding/title of its own since it sits
   inside a preview box that already provides those. */
.panel-mini{background:transparent;border:0;border-radius:0;padding:0;height:100%}
.panel-mini .kpi-val.mini{font-size:clamp(14px,3vw,20px);margin:auto}
.mini-table-label{margin:auto;color:var(--ink3);font-size:11px}
table{border-collapse:collapse;width:100%;font-size:12px}
th,td{text-align:left;padding:5px 8px;border-bottom:1px solid var(--line);white-space:nowrap}
th{color:var(--ink3);font-weight:600;position:sticky;top:0;background:var(--surface)}
td.num,th.num{text-align:right;font-variant-numeric:tabular-nums}

/* ---------- gridstack ---------- */
.grid-stack{margin:0 -6px}
.grid-stack-item-content{inset:0;display:flex;overflow:visible}
.grid-stack-item-content > .panel{flex:1}
body.editing .panel h3{cursor:move}
body.editing .grid-stack-item-content > .panel{border-color:var(--accent);border-style:dashed}

/* ---------- drawer, toast, dropzone ---------- */
.drawer{position:fixed;right:0;top:0;bottom:0;width:min(680px,58vw);background:var(--surface);
  border-left:1px solid var(--line);box-shadow:-14px 0 40px rgba(0,0,0,.14);
  display:flex;flex-direction:column;z-index:60}
.drawer-head{display:flex;justify-content:space-between;align-items:center;
  padding:12px 16px;border-bottom:1px solid var(--line)}
.drawer-body{padding:14px 16px;overflow:auto;flex:1}
.cand{border:1px solid var(--line);border-radius:var(--radius);padding:10px;margin-bottom:10px}
.cand.win{border-color:var(--good)}
.cand .tag{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.04em;border:0;padding:0}
.cand.win .tag{color:var(--good)}
.cand.fail .tag{color:var(--critical)}
.cand pre{background:var(--plane);padding:8px;border-radius:6px;overflow:auto;
  font-size:11.5px;margin:6px 0 0;white-space:pre-wrap}

#dropzone{position:fixed;inset:0;z-index:70;display:flex;align-items:center;justify-content:center;
  background:color-mix(in srgb, var(--plane) 88%, transparent);backdrop-filter:blur(2px)}
#dropzone div{border:2px dashed var(--accent);color:var(--accent);font-weight:600;
  padding:40px 60px;border-radius:16px;background:var(--surface);text-align:center}
#dropzone span{display:block;margin-top:6px;font-weight:400;font-size:12px;color:var(--ink3)}

.toast{position:fixed;left:50%;bottom:24px;transform:translateX(-50%);z-index:80;
  background:var(--ink);color:#fff;padding:9px 16px;border-radius:999px;font-size:13px}
.toast.bad{background:var(--critical)}

.spin{display:inline-block;width:12px;height:12px;border:2px solid var(--line);
  border-top-color:var(--accent);border-radius:50%;animation:sp .8s linear infinite;vertical-align:-2px}
@keyframes sp{to{transform:rotate(360deg)}}

/* ---------- staged uploads ---------- */
.stage-head{display:flex;justify-content:space-between;align-items:center;
  font-size:12px;color:var(--ink3);margin:4px 0 8px}
.file-row{display:flex;gap:12px;align-items:center;padding:9px 0;border-top:1px solid var(--line)}
.file-row .row-top{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.file-row input.tbl{width:auto;min-width:150px;padding:3px 7px;font-size:12px}
.bar{height:4px;border-radius:999px;background:var(--line);overflow:hidden;margin:7px 0 4px}
.bar .fill{height:100%;background:var(--accent);border-radius:999px;transition:width .15s linear}
.bar .fill.done{background:var(--good)}
.bar .fill.error{background:var(--critical)}
.ok-tick{color:var(--good);font-weight:700}
.err-tick{color:var(--critical);font-weight:700}
.file-row.error b{color:var(--critical)}

/* ---------- report surface ---------- */
.report-hero{display:flex;justify-content:space-between;gap:24px;align-items:flex-start;
  background:var(--surface);border:1px solid var(--line);border-radius:14px;
  padding:18px 20px;margin-bottom:14px}
.report-hero h1{font-size:23px;margin:2px 0 6px}
.hero-sum{color:var(--ink2);max-width:80ch;font-size:13.5px}
.hero-meta{display:flex;gap:16px;flex-wrap:wrap;margin-top:10px;font-size:12px;color:var(--ink3)}
.hero-meta b{color:var(--ink);font-variant-numeric:tabular-nums}
.hero-meta .bad{color:var(--critical)}
.hero-actions{display:flex;gap:6px;flex:0 0 auto}
.crumb .sep{color:var(--line);margin:0 4px}

.filterbar{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-bottom:12px;
  padding:9px 12px;background:#eef4fd;border:1px solid #cfe0f8;border-radius:10px}
.fb-label{font-size:11px;text-transform:uppercase;letter-spacing:.05em;color:var(--ink3)}
.chip{background:var(--surface);border:1px solid var(--accent);color:var(--ink);
  border-radius:999px;padding:3px 10px;font-size:12px}
.chip .x{color:var(--ink3);margin-left:2px}
.chip:hover .x{color:var(--critical)}

/* panels get a head bar that doubles as the drag handle */
.panel-live{transition:box-shadow .14s ease,border-color .14s ease}
.panel-live:hover{box-shadow:0 2px 14px rgba(16,24,40,.07);border-color:#d5d4ce}
.panel-head{display:flex;align-items:center;gap:8px;min-height:20px}
.panel-head h3{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.panel-tools{display:flex;gap:4px;align-items:center;opacity:0;transition:opacity .14s ease}
.panel-live:hover .panel-tools{opacity:1}
.panel-tools .tool{border:1px solid transparent;background:transparent;color:var(--ink3);
  padding:1px 6px;border-radius:6px;font-size:13px;line-height:1.3;cursor:pointer}
.panel-tools .tool:hover{background:var(--plane);color:var(--ink);border-color:var(--line)}
.panel-tools .swap{width:auto;padding:1px 4px;font-size:11px;color:var(--ink3);
  border-color:transparent;background:transparent;cursor:pointer}
.panel-tools .swap:hover{border-color:var(--line);background:var(--plane)}

.modal{position:fixed;inset:0;z-index:90;background:rgba(16,24,40,.34);
  display:flex;align-items:center;justify-content:center;padding:40px}
.modal-card{background:var(--surface);border-radius:14px;border:1px solid var(--line);
  width:min(1200px,94vw);height:min(760px,88vh);display:flex;flex-direction:column;
  box-shadow:0 24px 70px rgba(16,24,40,.28)}
.modal-head{display:flex;justify-content:space-between;align-items:center;
  padding:14px 18px;border-bottom:1px solid var(--line)}
.modal-body{flex:1;min-height:0;padding:14px 18px;display:flex}
.modal-body .panel{flex:1;border:0}

/* ---------- figure verification ---------- */
.verified{color:var(--good);font-weight:600}
.notice{margin-top:8px;padding:8px 11px;border-radius:8px;font-size:12.5px;line-height:1.45}
.notice.warn{background:#fff7ed;border:1px solid #f5c99b;color:#7c3a08}

/* ---------- analyst findings ---------- */
.findings{margin-top:14px;border:1px solid var(--line);border-radius:var(--radius);
  background:var(--surface);overflow:hidden;max-width:86ch}
.findings-head{padding:9px 13px;border-bottom:1px solid var(--line);font-size:11px;
  text-transform:uppercase;letter-spacing:.05em;color:var(--ink2);font-weight:700}
.findings-head .muted{text-transform:none;letter-spacing:0;font-weight:400;margin-left:8px}
.finding{display:flex;gap:11px;padding:10px 13px;border-top:1px solid var(--line);font-size:13px}
.finding:first-of-type{border-top:0}
.ftype{flex:0 0 92px;font-size:10.5px;text-transform:uppercase;letter-spacing:.04em;
  font-weight:700;padding-top:2px}
.finding.high .ftype{color:var(--critical)}
.finding.med  .ftype{color:#b45309}
.finding.low  .ftype{color:var(--ink3)}
.finding.high{background:#fffaf9}
.faction{color:var(--ink3);font-size:12px;margin-top:3px}

/* a computed panel note gets more room than the model's one-line label */
.panel .desc.note{-webkit-line-clamp:3;color:var(--ink2);font-size:12px;line-height:1.45}

/* ---------- metadata ---------- */
.md-tabs{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:14px}
.md-tab{display:flex;gap:8px;align-items:center;padding:6px 12px;border-radius:8px;
  border:1px solid var(--line);background:var(--surface);color:var(--ink2);font-size:13px}
.md-tab:hover{border-color:var(--ink3);text-decoration:none}
.md-tab.on{border-color:var(--accent);color:var(--ink);font-weight:600}
.cov{font-size:10.5px;font-weight:700;padding:1px 6px;border-radius:999px}
.cov.good{background:#e8f6e8;color:#0a7a0a}
.cov.part{background:#fff3e0;color:#a45a06}
.cov.none{background:var(--plane);color:var(--ink3)}

.md-table-desc{margin-bottom:8px;max-width:none}
.badge{font-size:10.5px;font-weight:700;text-transform:uppercase;letter-spacing:.04em;
  padding:2px 7px;border-radius:5px;border:1px solid var(--line);color:var(--ink3)}
.badge.ok{color:var(--good);border-color:var(--good)}
.badge.guess{color:#a45a06;border-color:#f5c99b;background:#fff7ed}
.badge.none{color:var(--ink3)}

.md-grid{border:1px solid var(--line);border-radius:var(--radius);overflow:hidden;
  background:var(--surface)}
/* column · shown as · meaning · role · unit · filter · status */
.md-head,.md-row{display:grid;
  grid-template-columns:1.3fr 1.3fr 2.8fr 1.1fr .7fr .5fr .8fr;
  gap:10px;align-items:center;padding:8px 12px;border-top:1px solid var(--line)}
.md-head{border-top:0;background:var(--plane);font-size:11px;text-transform:uppercase;
  letter-spacing:.05em;color:var(--ink3);font-weight:700}
.md-row{font-size:12.5px}
.md-row:hover{background:var(--plane)}
.md-row.pii{background:#fff7f7}
.md-row input[type=text],.md-row input:not([type]),.md-row select{padding:4px 7px;font-size:12.5px}
.md-row input[type=checkbox]{width:auto}
.md-head span:nth-child(6),.md-row > span:nth-child(6){text-align:center}

/* database connector wizard - table selection grid (Step 2) */
.tbl-grid{border:1px solid var(--line);border-radius:var(--radius);overflow:hidden;
  background:var(--surface)}
/* select · table (+status) · rows · columns · size · details */
.tbl-head,.tbl-row{display:grid;grid-template-columns:34px 1.6fr .8fr .7fr .8fr 2.3fr;
  gap:10px;align-items:center;padding:9px 12px;border-top:1px solid var(--line)}
.tbl-head{border-top:0;background:var(--plane);font-size:11px;text-transform:uppercase;
  letter-spacing:.05em;color:var(--ink3);font-weight:700}
.tbl-row{font-size:12.5px}
.tbl-row:hover{background:var(--plane)}
.tbl-row .tbl-name{display:flex;align-items:center;gap:7px;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}
.tbl-row .tbl-details{color:var(--ink3);display:flex;align-items:center;gap:8px;flex-wrap:wrap}

/* database connector wizard - per-table metadata accordion (Step 3) */
.wz-acc{border:1px solid var(--line);border-radius:var(--radius);margin-bottom:10px;overflow:hidden}
.wz-acc-head{display:flex;justify-content:space-between;align-items:center;padding:11px 14px;
  background:var(--plane);cursor:pointer;font-size:13px;font-weight:600;border:0;width:100%;
  text-align:left;color:var(--ink)}
.wz-acc-head .chev{color:var(--ink3);font-size:11px;font-weight:400}
.wz-acc-body{padding:16px;border-top:1px solid var(--line)}

/* ---------------------------------------------------------------- load wizard */
/* A four-step path: add a file, check the data, check the meanings, done. The
   numbered steps are real - each one is a gate you pass, not decoration. */
.steps{display:flex;gap:0;list-style:none;margin:0 0 20px;padding:0;
  border:1px solid var(--line);border-radius:var(--radius);overflow:hidden;background:var(--surface)}
.steps li{flex:1;display:flex;align-items:center;gap:8px;padding:10px 14px;font-size:13px;
  color:var(--ink3);border-right:1px solid var(--line)}
.steps li:last-child{border-right:0}
.steps li .n{width:20px;height:20px;border-radius:50%;display:grid;place-items:center;
  font-size:11px;font-weight:600;background:var(--plane);color:var(--ink3);flex:0 0 auto}
.steps li.on{color:var(--ink);font-weight:600}
.steps li.on .n{background:var(--accent);color:#fff}
.steps li.done{color:var(--ink2)}
.steps li.done .n{background:var(--good);color:#fff}

/* Full-width wizard body - a step's content decides its own internal layout (a compact
   two-column form for Configuration, a full grid for Preview/Metadata/Verification)
   rather than the whole wizard being pinned to one narrow card width regardless of step. */
.wizard-panel{background:var(--surface);border:1px solid var(--line);
  border-radius:var(--radius);padding:24px 28px}
.wizard-config{display:grid;grid-template-columns:minmax(0,420px) 1fr;gap:32px;align-items:start}
@media (max-width:900px){.wizard-config{grid-template-columns:1fr}}
.wizard-config .field-col{display:flex;flex-direction:column;gap:14px;max-width:420px}
.wizard-side{background:var(--plane);border:1px solid var(--line);border-radius:var(--radius);
  padding:18px;font-size:13px;color:var(--ink2)}
.wizard-side h4{margin:0 0 8px;font-size:13px;color:var(--ink)}
.wizard-side ul{margin:0;padding-left:18px;display:flex;flex-direction:column;gap:4px}
/* Compact per-table verification embedded under its metadata (Step 3) - not a page of
   its own, so it stays small and scannable rather than repeating the full checks grid. */
.verify-inline{background:var(--plane);border:1px solid var(--line);border-radius:var(--radius);
  padding:10px 14px;margin-top:10px}
.verify-inline-head{display:flex;align-items:center;gap:10px}
.verify-inline-list{margin:8px 0 0;padding-left:18px;font-size:12.5px;color:var(--ink2);
  display:flex;flex-direction:column;gap:2px}

.review{display:flex;flex-direction:column;gap:16px}
.review-head{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;flex-wrap:wrap}
h2.tight{margin:0 0 2px;font-size:17px;color:var(--ink)}
label.inline{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--ink3);
  white-space:nowrap;flex:0 0 auto}
label.inline input{width:200px}
.wizard-actions{justify-content:flex-end;gap:10px}

.notice{border-left:3px solid var(--s4);background:color-mix(in srgb,var(--s4) 9%,var(--surface));
  padding:11px 15px;border-radius:0 8px 8px 0;font-size:13.5px}
.notice ul{margin:6px 0 0;padding-left:18px;color:var(--ink2)}
.notice li{margin-bottom:3px}
.notice.warn{border-left-color:var(--s4)}
button.linkish{background:none;border:0;padding:0 0 0 4px;color:var(--accent);
  font-size:inherit;text-decoration:underline;cursor:pointer}
button.linkish:hover{border:0;filter:brightness(.85)}

.scrollx{overflow-x:auto}
table.preview,table.meaning{font-size:13px}
table.preview th{vertical-align:top;white-space:nowrap}
table.preview th div{font-weight:600;color:var(--ink)}
table.preview td{white-space:nowrap;max-width:220px;overflow:hidden;text-overflow:ellipsis}
.coltype{display:inline-block;margin-top:3px;font-size:10.5px;font-weight:500;
  padding:1px 6px;border-radius:4px;background:var(--plane);color:var(--ink3)}
.coltype.date{background:color-mix(in srgb,var(--s3) 15%,var(--surface));color:var(--s3)}
.coltype.int,.coltype.float{background:color-mix(in srgb,var(--s1) 13%,var(--surface));color:var(--s1)}

table.meaning td{vertical-align:middle}
table.meaning td.mid{text-align:center}
table.meaning input[type=text],table.meaning input:not([type]),table.meaning select{padding:5px 7px;font-size:13px}
table.meaning tr.saved{background:color-mix(in srgb,var(--good) 10%,transparent);transition:background .4s}
table.meaning tr.pii td:first-child{border-left:2px solid var(--critical)}

.finished{text-align:center;padding:44px 20px}
.finished .tick{width:52px;height:52px;margin:0 auto 14px;border-radius:50%;
  display:grid;place-items:center;font-size:26px;background:var(--good);color:#fff}
@media (prefers-reduced-motion:reduce){table.meaning tr.saved{transition:none}}
table.meaning input.narrow{width:72px}
table.meaning .badge{font-size:10.5px;padding:1px 6px}
table.meaning td:first-child{max-width:180px;overflow:hidden;text-overflow:ellipsis}

/* ---------------------------------------------------------------- table meaning + rules */
/* The description says what a row IS; the operations say how this business counts it.
   Side by side, because the second only makes sense next to the first. */
/* The two cards match height and the rules list has room to grow into, so the panel does
   not jump every time an operation is added. */
.md-about{display:grid;grid-template-columns:1fr 1fr;gap:16px;align-items:stretch;
  margin-bottom:18px}
.md-about > .card-form{display:flex;flex-direction:column;gap:7px}
.md-about .ops p{margin:0 0 4px}
/* "Notes for the model" + "optional" are one line; without this they read as one phrase */
label .muted.small{margin-left:6px;font-weight:400}
label .muted.small::before{content:'· '}
.md-about textarea{flex:1;min-height:104px;resize:vertical}
#md-ops{flex:1;min-height:104px;padding-top:2px}
.op-eg{border-left:2px solid var(--line);padding-left:9px;margin:0 0 8px!important}
.op-eg i{font-style:normal;color:var(--ink2)}
/* the two boxes line up under their own headings, so neither needs explaining twice */
.op-head,.op-row{display:grid;grid-template-columns:1fr 2fr 26px;gap:6px}
.op-head{font-size:10.5px;text-transform:uppercase;letter-spacing:.06em;
  color:var(--ink3);padding:0 2px 4px}
.op-row{margin-bottom:6px}
.op-row input{font-size:12.5px;padding:5px 8px}
/* The report PREVIEW is a real GridStack board, so a panel can be dragged and resized
   before the report is saved - see mountEditableGrid() in views.js. The item content is
   the panel itself, so it fills its cell the way the saved board's panels do. */
.grid-stack .grid-stack-item-content{display:flex;flex-direction:column;inset:0;
  overflow:visible}
.grid-stack .grid-stack-item-content > .panel{flex:1;min-height:0;height:100%}
.grid-stack .panel-head{cursor:move}
.grid-stack .ui-resizable-handle{z-index:3}

/* A metric is a definition rather than a note, so it gets a bordered block of its own -
   several fields that only mean anything together. */
.metric-row{border:1px solid var(--line);border-radius:8px;padding:8px;margin-bottom:8px}
.metric-row .row{display:flex;gap:6px;align-items:center;margin-bottom:6px}
.metric-row input,.metric-row select{font-size:12.5px;padding:5px 8px;min-width:0;flex:1}
.metric-row .met-formula{flex:3}
.metric-row label{flex:0 0 auto;white-space:nowrap}
.metric-row button{flex:0 0 auto}
.met-parts{padding-left:10px;border-left:2px solid var(--line)}
button.small,.btn.small{font-size:12px;padding:4px 9px}
@media (max-width:1100px){.md-about{grid-template-columns:1fr}}

/* ---------------------------------------------------------------- filter bar */
/* Multi-select, browser-side. The choices come from the rows already loaded, which is why
   a saved report can be narrowed and cleared but never widened past its own query. */
.fbar{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.fbar .fb-label{flex:0 0 auto}
.fsel{position:relative}
.fsel-btn{display:flex;align-items:center;gap:7px;padding:5px 10px;font-size:12.5px;
  background:var(--surface);border:1px solid var(--line);border-radius:8px;max-width:280px}
.fsel.on .fsel-btn{border-color:var(--accent);background:color-mix(in srgb,var(--accent) 7%,var(--surface))}
.fsel-name{color:var(--ink3)}
.fsel.on .fsel-name{color:var(--ink2)}
.fsel-val{color:var(--ink);font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.fsel-caret{color:var(--ink3);font-size:10px}
.fsel-menu{position:absolute;z-index:40;top:calc(100% + 4px);left:0;min-width:220px;
  max-width:320px;background:var(--surface);border:1px solid var(--line);
  border-radius:10px;box-shadow:0 8px 24px rgba(0,0,0,.10);overflow:hidden}
.fsel-tools{display:flex;gap:4px;padding:7px 8px;border-bottom:1px solid var(--line)}
.fsel-tools button{font-size:11.5px;padding:3px 8px;background:transparent;color:var(--ink2)}
.fsel-list{max-height:260px;overflow-y:auto;padding:5px}
.fsel-list label{display:flex;align-items:center;gap:8px;padding:5px 7px;border-radius:6px;
  font-size:12.5px;color:var(--ink);cursor:pointer}
.fsel-list label:hover{background:var(--plane)}
.fsel-list input{width:auto;margin:0;flex:0 0 auto}
.fsel-list span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#r-filters{margin:14px 0 10px}

/* ---------------------------------------------------------------- inspect */
.drawer.wide{width:min(620px,94vw)}
.ins-block{padding:14px 0;border-bottom:1px solid var(--line)}
.ins-block:last-child{border-bottom:0}
.ins-h{font-size:11px;text-transform:uppercase;letter-spacing:.07em;color:var(--ink3);margin-bottom:8px}
.ins-formula{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:12.5px;color:var(--ink2);margin-bottom:6px}
.ins-steps{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:13px;
  line-height:1.75;padding-left:2px}
.ins-steps .last{font-weight:600;font-size:17px;color:var(--ink)}
.ins-parts{width:100%;margin:10px 0 8px;font-size:12.5px;border-collapse:collapse}
.ins-parts td{padding:3px 6px;border-bottom:1px solid var(--line)}
.ins-parts td.num{text-align:right;font-variant-numeric:tabular-nums}
.ins-kv{width:100%;font-size:13px;border-collapse:collapse}
.ins-kv th{text-align:left;font-weight:400;color:var(--ink3);width:130px;
  padding:4px 8px 4px 0;vertical-align:top}
.ins-kv td{padding:4px 0;vertical-align:top}
.ins-caveats{margin:0;padding-left:18px;font-size:13px;color:var(--ink2)}
.ins-caveats li{margin-bottom:5px}
/* The preview has no .panel-tools bar, so the button has to stand on its own. Pinned to
   the corner rather than placed in the flow, so it cannot stretch or push the value down. */
.panel{position:relative}
.panel .tool.ins{position:absolute;top:8px;right:8px;z-index:2;
  width:22px;height:22px;padding:0;line-height:1;font-size:13px;
  display:grid;place-items:center;border:1px solid transparent;background:transparent;
  color:var(--ink3);border-radius:6px;opacity:0;transition:opacity .12s}
.panel:hover .tool.ins,.panel .tool.ins:focus-visible{opacity:1}
.panel .tool.ins:hover{background:var(--plane);color:var(--ink);border-color:var(--line)}
.panel.clickable{cursor:pointer}
.panel.clickable:hover{border-color:var(--ink3)}
@media (prefers-reduced-motion:reduce){.panel .tool.ins{transition:none}}

/* ================================================================== topbar */
#topbar{height:var(--topbar-h);flex:0 0 var(--topbar-h);display:flex;align-items:center;
  gap:14px;padding:0 18px;border-bottom:1px solid var(--line);background:var(--surface)}
#topbar .tb-title{font-weight:600;font-size:13.5px;color:var(--ink2);white-space:nowrap}
#topbar .tb-spacer{flex:1;min-width:0}
.search-trigger{display:flex;align-items:center;gap:8px;width:min(360px,40vw);
  padding:6px 10px;border:1px solid var(--line);border-radius:8px;background:var(--plane);
  color:var(--ink3);font-size:13px;cursor:pointer}
.search-trigger:hover{border-color:var(--border-strong);color:var(--ink2)}
.search-trigger .kbd{margin-left:auto;display:flex;gap:2px}
.kbd{font:11px/1 ui-monospace,monospace;color:var(--ink3);background:var(--surface);
  border:1px solid var(--line);border-radius:4px;padding:2px 5px}
.tb-link{font-size:12.5px;color:var(--ink3);white-space:nowrap}
.tb-link:hover{color:var(--ink2)}

/* ================================================================== command palette */
.cmdk-overlay{position:fixed;inset:0;z-index:100;background:var(--overlay);
  display:flex;align-items:flex-start;justify-content:center;padding-top:min(14vh,120px)}
.cmdk{width:min(640px,92vw);max-height:min(72vh,560px);display:flex;flex-direction:column;
  background:var(--surface);border:1px solid var(--line);border-radius:14px;
  box-shadow:0 24px 70px rgba(16,24,40,.28);overflow:hidden}
.cmdk-input-row{display:flex;align-items:center;gap:10px;padding:12px 16px;
  border-bottom:1px solid var(--line);flex:0 0 auto}
.cmdk-input-row .ic{color:var(--ink3);font-size:15px;flex:0 0 auto}
.cmdk-input-row input{border:0;padding:4px 0;font-size:15px;background:transparent;flex:1;min-width:0}
.cmdk-input-row input:focus{outline:0}
.cmdk-input-row .cmdk-esc-hint{font-size:11px;color:var(--ink3);border:1px solid var(--line);
  border-radius:5px;padding:1px 6px;flex:0 0 auto}
.cmdk-close{border:0;background:transparent;color:var(--ink3);font-size:15px;line-height:1;
  padding:3px 4px;border-radius:6px;flex:0 0 auto}
.cmdk-close:hover{background:var(--plane);color:var(--ink);border:0}
.cmdk-results{overflow-y:auto;padding:8px;flex:1}
.cmdk-group{margin-bottom:6px}
.cmdk-group + .cmdk-group{border-top:1px solid var(--border-subtle);padding-top:2px}
.cmdk-group-label{font-size:10.5px;text-transform:uppercase;letter-spacing:.06em;
  color:var(--ink3);font-weight:700;padding:8px 10px 4px}
.cmdk-item{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:8px;
  font-size:13.5px;color:var(--ink);cursor:pointer}
.cmdk-item .ci-icon{width:18px;text-align:center;flex:0 0 auto;font-size:13px;opacity:.8}
.cmdk-item .ci-title{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:0 1 auto}
.cmdk-item .ci-sub{color:var(--ink3);font-size:12px;white-space:nowrap;overflow:hidden;
  text-overflow:ellipsis;flex:1 1 auto;min-width:20px}
.cmdk-item .ci-time{color:var(--ink3);font-size:11px;margin-left:auto;flex:0 0 auto;
  white-space:nowrap;padding-left:8px}
.cmdk-item:hover,.cmdk-item.active{background:var(--surface-selected)}
.cmdk-item.active{outline:1px solid var(--surface-selected)}
.cmdk-empty{padding:30px 16px;text-align:center;color:var(--ink3);font-size:13px}
.cmdk-empty .spin{margin-right:6px}
.cmdk-foot{display:flex;gap:14px;padding:8px 16px;border-top:1px solid var(--line);
  font-size:11px;color:var(--ink3)}
.cmdk-foot span{display:flex;align-items:center;gap:5px}
@media (max-width:640px){.cmdk-item .ci-sub{display:none}}

/* ================================================================== stat tiles */
.stat-tile{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);
  padding:13px 15px;display:block;text-decoration:none;color:inherit}
a.stat-tile:hover{border-color:var(--ink3)}
.stat-tile-top{display:flex;justify-content:space-between;align-items:flex-start;gap:8px}
.stat-tile .k{font-size:10.5px;text-transform:uppercase;letter-spacing:.06em;
  color:var(--ink3);font-weight:700}
.stat-tile .si{width:28px;height:28px;border-radius:8px;flex:0 0 auto;
  display:flex;align-items:center;justify-content:center;font-size:13px}
.stat-tile .si.c1{background:color-mix(in srgb, var(--s1) 14%, var(--surface));color:var(--s1)}
.stat-tile .si.c2{background:color-mix(in srgb, var(--s2) 14%, var(--surface));color:var(--s2)}
.stat-tile .si.c3{background:color-mix(in srgb, var(--s3) 14%, var(--surface));color:var(--s3)}
.stat-tile .si.c4{background:color-mix(in srgb, var(--s4) 14%, var(--surface));color:var(--s4)}
.stat-tile .si.c5{background:color-mix(in srgb, var(--s7) 14%, var(--surface));color:var(--s7)}
.stat-tile .v{font-size:26px;font-weight:700;letter-spacing:-.02em;margin-top:8px;
  font-variant-numeric:tabular-nums}
.stat-tile .d{font-size:11.5px;margin-top:4px;color:var(--ink3)}
.stat-tile .d.up{color:var(--good)}
.stat-tile .d.down{color:var(--critical)}

/* ================================================================== section headers with "view all" */
.section-head{display:flex;align-items:baseline;justify-content:space-between;
  margin:26px 0 10px}
.section-head h2{margin:0}
.section-head a{font-size:12.5px}

/* ================================================================== empty / error / skeleton states */
.state-block{display:flex;flex-direction:column;align-items:center;text-align:center;
  gap:6px;padding:44px 20px;color:var(--ink3);border:1px dashed var(--line);
  border-radius:var(--radius);background:var(--surface)}
.state-block .si{font-size:26px;opacity:.5;margin-bottom:4px}
.state-block h3{margin:0;font-size:14.5px;color:var(--ink);font-weight:600}
.state-block p{max-width:52ch;font-size:13px;color:var(--ink3)}
.state-block .row{margin-top:8px;justify-content:center}
.state-block.bad{border-style:solid;border-color:var(--critical)}
.state-block.bad h3{color:var(--critical)}

.skel{background:linear-gradient(90deg,var(--surface-2) 25%,var(--surface-hover) 37%,var(--surface-2) 63%);
  background-size:400% 100%;animation:skel-shimmer 1.4s ease infinite;border-radius:6px}
@keyframes skel-shimmer{0%{background-position:100% 0}100%{background-position:0 0}}
@media (prefers-reduced-motion:reduce){.skel{animation:none;background:var(--surface-2)}}
.skel-line{height:12px;margin-bottom:8px}
.skel-tile{height:74px;border-radius:var(--radius)}
.skel-row{display:grid;gap:10px}

/* ================================================================== tabs */
.tabbar{display:flex;gap:2px;border-bottom:1px solid var(--line);margin-bottom:16px}
.tabbar button{border:0;border-radius:0;background:transparent;padding:9px 4px;
  margin-right:18px;color:var(--ink3);font-size:13.5px;font-weight:500;
  border-bottom:2px solid transparent}
.tabbar button:hover{color:var(--ink2);border-color:transparent}
.tabbar button.on{color:var(--ink);font-weight:600;border-bottom-color:var(--accent)}

/* ================================================================== dropdown / overflow menu */
.menu-wrap{position:relative;display:inline-flex}
.menu{position:absolute;right:0;top:calc(100% + 4px);min-width:180px;z-index:65;
  background:var(--surface);border:1px solid var(--line);border-radius:10px;
  box-shadow:0 8px 24px rgba(0,0,0,.10);padding:4px;overflow:hidden}
.menu button{display:flex;width:100%;text-align:left;border:0;background:transparent;
  padding:7px 9px;border-radius:6px;font-size:13px;color:var(--ink)}
.menu button:hover{background:var(--surface-hover)}
.menu button.danger{color:var(--critical)}
.menu hr{border:0;border-top:1px solid var(--line);margin:4px 2px}

/* ================================================================== category picker (new connection) */
.cat-section{margin-bottom:22px}
.cat-label{font-size:10.5px;text-transform:uppercase;letter-spacing:.06em;
  color:var(--ink3);font-weight:700;margin-bottom:8px}
.cat-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px}
.cat-card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);
  padding:14px;display:flex;flex-direction:column;gap:6px;color:inherit;cursor:pointer}
.cat-card:hover{border-color:var(--accent);box-shadow:0 2px 10px rgba(16,24,40,.06);
  text-decoration:none}
.cat-card .ci{font-size:20px}
.cat-card .cn{font-weight:600;font-size:13.5px}
.cat-card .cs{font-size:11px}
.cat-card .cs.avail{color:var(--good)}
.cat-card .cs.soon{color:var(--ink3)}
.cat-card.soon{cursor:default;opacity:.55}
.cat-card.soon:hover{border-color:var(--line);box-shadow:none}

/* ================================================================== connector cards */
.connector-card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);
  padding:14px;display:block;color:inherit}
.connector-card:hover{border-color:var(--border-strong);text-decoration:none}
.connector-head{display:flex;align-items:center;gap:8px;margin-bottom:10px}
.connector-head .ci{font-size:12px;margin-right:5px}
.connector-name{font-weight:600;font-size:14px;overflow:hidden;text-overflow:ellipsis;
  white-space:nowrap;margin-bottom:3px}
.connector-path{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-bottom:8px}
.connector-perm{display:flex;flex-wrap:wrap;align-items:center;gap:6px 12px;font-size:11.5px;color:var(--ink3)}
.connector-meta{display:flex;flex-wrap:wrap;gap:6px 12px;font-size:11.5px;color:var(--ink3)}

.type-badge{display:inline-flex;align-items:center}
.menu-trigger{margin-left:auto;flex:0 0 auto;padding:2px 7px;font-size:14px;line-height:1;border:0;
  background:transparent;color:var(--ink3)}
.menu-trigger:hover{background:var(--plane);color:var(--ink);border:0}

.health-pill{display:inline-flex;align-items:center;font-size:11px;color:var(--ink3);white-space:nowrap}
.dot.healthy{background:var(--good)} .dot.error{background:var(--critical)}
.dot.warning{background:var(--warn)} .dot.inactive{background:var(--ink-disabled)}
.health-pill.healthy{color:var(--good)} .health-pill.error{color:var(--critical)}
.health-pill.inactive{color:var(--ink3)}

/* ================================================================== drawer footer (generic) */
.drawer-foot{display:flex;justify-content:flex-end;gap:8px;padding:12px 16px;
  border-top:1px solid var(--line);flex:0 0 auto}
.kv-list{display:flex;flex-direction:column;gap:0}
.kv-row{display:flex;justify-content:space-between;gap:12px;padding:9px 0;
  border-top:1px solid var(--line);font-size:13px}
.kv-row:first-child{border-top:0}
.kv-row .kk{color:var(--ink3)}
.kv-row .kv{color:var(--ink);text-align:right;overflow:hidden;text-overflow:ellipsis}
.readonly-note{font-size:11.5px;color:var(--ink3);background:var(--plane);
  border:1px solid var(--line);border-radius:8px;padding:8px 10px;margin-top:4px}

/* ================================================================== analytical workspace
   .ws-main's height comes from the .page-workspace flex parent (see the "page" section
   above), never a standalone calc() here - that was the fragile part. min-height is only
   a floor for the rare case this renders outside that wrapper.
   No persistent left panel by default - only the middle (dashboard) column, per the
   new-screen-design mockup. The left column exists in the DOM but stays display:none
   until the canvas's Filter button opens it (.filters-open) - a transient panel, not a
   second permanent one, and it never shows a datasource picker (that lives in the chat
   header - see .ws-chat-ds below). Chat itself is OUTSIDE this grid entirely (a docked
   full-height sidebar in .ws-shell, see the "page" section) - it is not a third track
   that shares .ws-main's own padding/height budget. */
.workspace{display:grid;grid-template-columns:1fr;gap:14px;
  min-height:420px;transition:grid-template-columns .15s ease}
@media (prefers-reduced-motion:reduce){.workspace{transition:none}}
.workspace.filters-open{grid-template-columns:236px 1fr}
.ws-col{min-height:0;display:flex;flex-direction:column}
.ws-context{background:var(--surface);border:1px solid var(--line);
  border-radius:14px;overflow:hidden;box-shadow:0 1px 3px rgba(0,0,0,.04);
  padding:14px;display:none}
.workspace.filters-open .ws-context{display:flex}
.ws-col-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}
.ws-col-head .ws-section-label{margin-bottom:0}
.ws-collapse-btn{border:0;background:transparent;color:var(--ink3);padding:3px 6px;
  border-radius:6px;font-size:13px;line-height:1;flex:0 0 auto}
.ws-collapse-btn:hover{background:var(--plane);color:var(--ink);border:0}
.ws-collapsed-rail{align-items:center;padding-top:12px !important;gap:10px}
.ws-collapsed-rail .ic{color:var(--accent);font-size:15px}
.ws-canvas{overflow-y:auto;padding-right:2px}
.ws-section-label{font-size:10.5px;text-transform:uppercase;letter-spacing:.06em;
  color:var(--ink3);font-weight:700;margin-bottom:8px}
.ws-nofilter{font-size:12.5px;color:var(--ink3);padding:8px 0}

/* ------------------------------------------------------------ copilot-style chat panel
 * A small gradient "spark" badge in the header, pill-shaped role tags instead of plain
 * uppercase labels, elevated bubbles, a floating pill composer with a circular send
 * button, and a bouncing-dots "thinking" cue - the same visual language a modern AI
 * copilot chat uses, built entirely from this app's existing tokens (no new palette).
 *
 * Docked full-height sidebar, not a floating grid card: it sits flush against the
 * viewport's top/right/bottom edges in .ws-shell (see the "page" section), reaching the
 * same horizontal divider line as the global topbar rather than starting below this
 * page's own breadcrumb/title. A left border is its only separation from the canvas. */
.ws-chat{display:flex;flex-direction:column;flex:0 0 320px;min-height:0;
  border-left:1px solid var(--line);transition:flex-basis .15s ease;
  background:linear-gradient(180deg, color-mix(in srgb, var(--accent) 5%, var(--surface)) 0%, var(--surface) 160px)}
@media (prefers-reduced-motion:reduce){.ws-chat{transition:none}}
.ws-chat.ws-collapsed-rail{flex-basis:44px}
.ws-chat-head{padding:10px 14px;border-bottom:1px solid var(--line);font-weight:600;
  font-size:13px;flex:0 0 auto;display:flex;align-items:center;gap:10px}
.ws-chat-head .ic{color:var(--accent)}
.ws-ai-badge{width:26px;height:26px;border-radius:8px;flex:0 0 auto;
  display:flex;align-items:center;justify-content:center;color:#fff;font-size:12px;
  background:linear-gradient(135deg, var(--accent), var(--s7));
  box-shadow:0 2px 6px color-mix(in srgb, var(--accent) 40%, transparent)}
/* The datasource/table picker lives in the chat header, not a separate context panel
 * (per the new-screen-design mockup) - laid out as compact inline rows instead of the
 * stacked label-over-select form .picker uses elsewhere. */
.ws-chat-ds{flex:1;min-width:0;display:flex;flex-direction:column;gap:4px}
.ws-chat-ds .picker{display:flex;flex-direction:column;gap:4px;margin-bottom:0;max-width:none}
.ws-chat-ds .picker label{display:flex;align-items:center;gap:6px;font-size:11.5px;
  color:var(--ink3);font-weight:400}
.ws-chat-ds .picker select{flex:1;min-width:0;font-size:12.5px;padding:3px 6px}
.ws-chat-body{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:16px}

.chat-empty{color:var(--ink2);font-size:13px;padding:10px 2px 2px;text-align:left}
.chat-empty-badge{width:34px;height:34px;border-radius:10px;margin-bottom:12px;
  display:flex;align-items:center;justify-content:center;color:#fff;font-size:15px;
  background:linear-gradient(135deg, var(--accent), var(--s7));
  box-shadow:0 3px 8px color-mix(in srgb, var(--accent) 35%, transparent)}
.chat-empty p{margin:0;color:var(--ink2)}
.chat-empty .eg{margin-top:12px;display:flex;flex-direction:column;gap:7px}
.chat-empty .eg button{text-align:left;font-size:12.5px;color:var(--ink2);
  background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:9px 13px;
  display:flex;align-items:center;gap:8px;box-shadow:0 1px 2px rgba(0,0,0,.03);
  transition:transform .12s ease,border-color .12s ease,box-shadow .12s ease,color .12s ease}
.chat-empty .eg button::before{content:'→';color:var(--accent);font-weight:700;flex:0 0 auto}
.chat-empty .eg button:hover{border-color:var(--accent);color:var(--accent);
  transform:translateY(-1px);box-shadow:0 4px 10px color-mix(in srgb, var(--accent) 16%, transparent)}

/* Same "here are some questions to start from" idea as .chat-empty .eg, but inside a
   builder slot's tight card - a row of small wrapping pills instead of a stacked list. */
.builder-slot .eg{display:flex;flex-wrap:wrap;gap:6px}
.builder-slot .eg button{font-size:12px;color:var(--ink2);background:var(--surface);
  border:1px solid var(--line);border-radius:999px;padding:5px 11px;
  transition:border-color .12s ease,color .12s ease}
.builder-slot .eg button:hover{border-color:var(--accent);color:var(--accent)}

.chat-msg{font-size:13px;line-height:1.5;display:flex;flex-direction:column}
.chat-msg .who{font-size:10px;letter-spacing:.03em;font-weight:700;margin-bottom:6px;
  display:inline-flex;align-items:center;gap:4px;padding:2px 9px;border-radius:20px;
  align-self:flex-start}
.chat-msg.user{align-items:flex-end}
.chat-msg.ai{align-items:stretch}
.chat-msg.user .who{color:var(--ink3);background:var(--plane);align-self:flex-end}
.chat-msg.ai .who{color:var(--accent);background:color-mix(in srgb, var(--accent) 10%, var(--surface))}
.chat-msg.ai:not(.dig) .who::before{content:'✦'}
.chat-msg .body{color:var(--ink)}
.chat-msg.user .body{background:linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 78%, #000));
  color:#fff;border-radius:16px 16px 3px 16px;
  padding:9px 13px;display:inline-block;max-width:88%;box-shadow:0 2px 6px color-mix(in srgb, var(--accent) 25%, transparent)}
.chat-msg.ai .body{background:var(--surface);border:1px solid var(--line);
  border-radius:3px 16px 16px 16px;padding:11px 14px;display:inline-block;max-width:100%;
  box-shadow:0 1px 3px rgba(0,0,0,.04)}
.chat-meta{font-size:11.5px;color:var(--ink3);margin-top:6px}
.chat-meta .verified{color:var(--good)}
.chat-followups{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
.chat-followups button{font-size:11.5px;padding:5px 11px;color:var(--ink2);border-radius:14px;
  transition:transform .12s ease,border-color .12s ease,color .12s ease}
.chat-followups button:hover{border-color:var(--accent);color:var(--accent);transform:translateY(-1px)}
.chat-err{color:var(--critical);font-size:13px}

/* A bouncing three-dot "composing a reply" cue, the way a chat-style copilot signals it's
 * still working, instead of a bare spinner + "thinking…" caption. */
.typing-indicator{display:inline-flex;background:var(--surface);border:1px solid var(--line);
  border-radius:3px 16px 16px 16px;padding:12px 16px;box-shadow:0 1px 3px rgba(0,0,0,.04)}
.typing-dots{display:inline-flex;gap:4px;align-items:center}
.typing-dots span{width:6px;height:6px;border-radius:50%;background:var(--accent);opacity:.5;
  animation:typingBounce 1.1s infinite ease-in-out}
.typing-dots span:nth-child(2){animation-delay:.15s}
.typing-dots span:nth-child(3){animation-delay:.3s}
@keyframes typingBounce{0%,60%,100%{transform:translateY(0);opacity:.4}30%{transform:translateY(-3px);opacity:1}}
@media (prefers-reduced-motion:reduce){.typing-dots span{animation:none;opacity:.7}}

/* The live pipeline checklist shown while a question runs (see typingIndicator()/stepsHtml()
 * in views.js) - each stage stays on screen with a checkmark once passed, instead of one
 * line that gets overwritten and disappears before a fast stage is even readable. */
.pipeline-steps{display:inline-flex;flex-direction:column;align-items:flex-start;gap:6px;
  margin-bottom:10px;text-align:left}
.pipeline-step{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--ink3)}
.pipeline-step.active{color:var(--ink)}
.pipeline-step .step-icon{display:inline-flex;align-items:center;justify-content:center;
  width:14px;height:14px;flex:none;color:var(--good);font-size:12px}
.spin-sm{display:inline-block;width:10px;height:10px;border:2px solid var(--line);
  border-top-color:var(--accent);border-radius:50%;animation:sp .8s linear infinite}

/* A Dig investigation reads differently from a normal turn - it never touched the main
   dashboard, so its chat entry says so and offers to promote it ("Go live") instead of
   looking like an ordinary answered question. */
.chat-msg.dig{border-left:2px solid var(--s7);padding-left:10px}
.chat-msg.dig .who{color:var(--s7);background:color-mix(in srgb, var(--s7) 10%, var(--surface))}
/* The dig result's own chart, mounted via renderOne() at chat width - a summary sentence
 * alone isn't the widget, this is (see mountDigCharts() in views.js). */
/* A chart inside a chat bubble. The panel is adapted for this width by chatPanel() in
   views.js; these rules only stop it overflowing the column. */
.dig-chart{margin:10px 0;width:100%;min-width:0;overflow:hidden}
.dig-chart .panel{width:100%;min-width:0;max-width:100%;padding:8px 10px}
.dig-chart .panel h3{font-size:12px}
.dig-chart .panel .chart{min-height:0}
.dig-actions{display:flex;gap:8px;margin-top:8px}
.dig-actions button{font-size:11.5px;padding:4px 9px}

.ws-chat-foot{border-top:1px solid var(--line);padding:12px 14px;flex:0 0 auto;background:var(--surface)}
.ws-ask-box{display:flex;gap:6px;align-items:flex-end;background:var(--plane);
  border:1px solid var(--line);border-radius:20px;padding:5px 5px 5px 14px;
  transition:border-color .15s ease,box-shadow .15s ease}
.ws-ask-box:focus-within{border-color:var(--accent);
  box-shadow:0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent)}
.ws-ask-box textarea,.ws-ask-box input[type=text]{resize:none;max-height:100px;
  border:0;background:transparent;padding:7px 0;font-size:13.5px}
.ws-ask-box textarea:focus,.ws-ask-box input[type=text]:focus{outline:none;box-shadow:none;border:0}
.ws-ask-box button{flex:0 0 auto}
.ws-ask-box button.primary{width:32px;height:32px;border-radius:50%;padding:0;
  display:flex;align-items:center;justify-content:center;font-size:15px;line-height:1}

.ws-widget-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;
  height:100%;min-height:280px;text-align:center;color:var(--ink3);gap:6px}
.ws-widget-empty .si{font-size:30px;opacity:.4}
/* Real starter questions for this datasource, not a bare caption - the center's empty
 * state is a place to act from, not just a placeholder waiting for the chat panel. */
.ws-suggest{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin-top:16px;
  max-width:520px}
.ws-suggest button{font-size:12.5px;color:var(--ink2);background:var(--surface);
  border:1px solid var(--line);border-radius:16px;padding:7px 14px;
  transition:transform .12s ease,border-color .12s ease,color .12s ease}
.ws-suggest button:hover{border-color:var(--accent);color:var(--accent);background:var(--plane);
  transform:translateY(-1px)}

@media (max-width:1180px){
  .workspace{grid-template-columns:1fr;height:auto}
  .ws-col{min-height:280px}
  .page-workspace{height:auto;overflow:visible}
  .ws-shell{flex-direction:column}
  .ws-chat{flex-basis:auto;border-left:0;border-top:1px solid var(--line)}
}

/* ================================================================== widget card chrome (canvas result) */
.widget-toolbar{display:flex;align-items:center;gap:8px;margin-bottom:10px}
.widget-toolbar .grow{min-width:0}
.widget-toolbar select.swap{width:auto;flex:0 0 auto;padding:5px 8px;font-size:12.5px;
  border-color:var(--line);color:var(--ink2)}
.widget-summary{font-size:13px;color:var(--ink2);margin-bottom:6px;line-height:1.5}
.widget-metrics{margin-bottom:14px}
.widget-metrics .warn{color:var(--s4)}
.ask-rawdata{margin-top:22px;padding-top:18px;border-top:1px solid var(--line)}
.ask-rawdata .section-head{margin:0 0 10px}
.ask-rawdata .section-head h3{margin:0;font-size:14px}

/* ================================================================== custom builder
   No dashboard-level datasource: each widget card is a fully independent analytical unit
   (its own datasource + table selectors, question, result), laid out two-per-row so the
   grid keeps scaling as more are added instead of one long single-width column. */
.builder-head{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);
  padding:16px;margin-bottom:18px}
.builder-slots{display:grid;grid-template-columns:1fr 1fr;gap:14px;align-items:start}
@media (max-width:860px){.builder-slots{grid-template-columns:1fr}}
.builder-slot{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);
  min-height:120px}
.builder-slot-head{display:flex;justify-content:space-between;align-items:center;
  padding:10px 14px;border-bottom:1px solid var(--line)}
.builder-slot-head select.swap{width:auto;flex:0 0 auto;padding:4px 6px;font-size:12px;
  border-color:var(--line);color:var(--ink2)}
.builder-slot-body{padding:14px}
.builder-slot-ds{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:10px}
.builder-slot-ds select{width:100%}
.slot-placeholder{color:var(--ink3);font-size:13px;text-align:center;padding:30px 10px}
.add-slot{width:100%;padding:14px;border:1px dashed var(--line);border-radius:var(--radius);
  background:transparent;color:var(--ink3);font-size:13px}
.add-slot:hover{border-color:var(--accent);color:var(--accent)}

/* ================================================================== configuration */
.cfg-shell{display:grid;grid-template-columns:200px 1fr;gap:24px}
.cfg-nav{display:flex;flex-direction:column;gap:2px}
.cfg-nav button{text-align:left;border:0;background:transparent;padding:8px 10px;
  border-radius:8px;color:var(--ink2);font-size:13px}
.cfg-nav button:hover{background:var(--plane)}
.cfg-nav button.on{background:var(--surface-selected);color:var(--ink);font-weight:600}
@media (max-width:900px){.cfg-shell{grid-template-columns:1fr}}



/* ---------------------------------------------------------------- report sections */
/* A generated report is read top to bottom: the executive summary first, then the
   breakdowns, then the denser reads, then the 3D view. The headings are grid items so
   one GridStack still owns the board - see reportDetail() in views.js. */
.exec-summary{border:1px solid var(--line);border-radius:10px;padding:14px 16px;
  margin:0 0 14px;background:var(--surface,transparent)}
.exec-summary.hidden{display:none}
.exec-summary .exec-text{margin:6px 0 0;font-size:14.5px;line-height:1.55;max-width:80ch}
.exec-summary .exec-points{margin:8px 0 0;padding-left:18px}
.exec-summary .exec-points li{margin:3px 0;font-size:13.5px;line-height:1.5}
.exec-summary .exec-prov{margin:10px 0 0}
.section-head-title{margin:0;font-size:13px;text-transform:uppercase;
  letter-spacing:.08em;color:var(--ink2);display:flex;align-items:baseline;gap:8px}
.section-head-title .muted{text-transform:none;letter-spacing:0}
.grid-stack-item.section-item .grid-stack-item-content{background:none;border:none;
  box-shadow:none;display:flex;align-items:flex-end;padding:6px 2px 0}
body.editing .grid-stack-item.section-item{opacity:.55}


/* ---------------------------------------------------------------- chat suggestions */
/* What to ask next. The first set is assembled from the board's own operations crossed
   with the datasource catalog (instant, no model call); the datasource's starter
   questions are merged in when they arrive. See digSuggestions() in views.js. */
.dig-suggests{display:flex;flex-direction:column;align-items:stretch;gap:6px;
  margin-top:14px;width:100%}
.dig-suggests.inline{margin-top:8px}
.dig-suggests .muted{margin-bottom:2px;text-align:left}
button.dig-suggest{display:block;width:100%;text-align:left;font-size:12.5px;
  line-height:1.4;padding:7px 10px;border:1px solid var(--line);border-radius:8px;
  background:var(--surface);color:var(--ink);cursor:pointer;white-space:normal}
button.dig-suggest:hover{border-color:var(--accent);color:var(--accent)}
