:root {
  /* warm, calm palette: ivory canvas, beige sidebar, charcoal text, clay accent */
  --bg: #faf9f5;
  --surface: #ffffff;
  --surface-2: #f3f1ea;
  --sidebar: #f2f0e8;
  --text: #1f1e1d;
  --muted: #73716b;
  --border: #e7e4da;
  --grid: #efede5;
  --accent: #c6613f;
  --accent-soft: #f6e9e2;
  --ok: #2f8f6b;
  --warn: #c9850f;
  --err: #c2453a;
  --err-soft: #fbeceb;
  --shadow: 0 1px 2px rgba(31, 30, 29, 0.04), 0 2px 8px rgba(31, 30, 29, 0.03);
  --radius: 14px;
  --topbar: 50px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --serif: 'Bricolage Grotesque', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --surface: #111111;
    --surface-2: #1b1b1a;
    --sidebar: #0a0a0a;
    --text: #f2f0e9;
    --muted: #a3a09a;
    --border: #2c2b29;
    --grid: #232321;
    --accent: #d97757;
    --accent-soft: #4a3229;
    --ok: #4fbf94;
    --warn: #e6a640;
    --err: #ec6b5e;
    --err-soft: #4a2622;
    --shadow: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
    --bg: #000000;
    --surface: #111111;
    --surface-2: #1b1b1a;
    --sidebar: #0a0a0a;
    --text: #f2f0e9;
    --muted: #a3a09a;
    --border: #2c2b29;
    --grid: #232321;
    --accent: #d97757;
    --accent-soft: #4a3229;
    --ok: #4fbf94;
    --warn: #e6a640;
    --err: #ec6b5e;
    --err-soft: #4a2622;
    --shadow: none;
    color-scheme: dark;
  }
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
html { overflow-y: scroll; } /* a steady scrollbar keeps the dashboard scale from jumping */
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font: 13px/1.4 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, h5 { margin: 0; line-height: 1.25; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* ---------- top bar (thin line) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 900; height: var(--topbar);
  display: flex; align-items: center; gap: 8px; padding: 0 10px 0 6px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.burger { border: 0; background: none; font-size: 18px; width: 32px; height: 32px; border-radius: 6px; cursor: pointer; color: var(--muted); flex: none; }
.burger:hover { background: var(--surface-2); color: var(--text); }
.tb-title { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; }
.tb-icon { border: 0; background: none; padding: 2px 4px; border-radius: 6px; cursor: pointer; display: flex; align-items: center; flex: none; }
.tb-icon:hover { background: var(--surface-2); }
.d-icon { font-size: 17px; line-height: 1; }
img.d-icon { width: 22px; height: 22px; object-fit: cover; border-radius: 5px; }
.d-icon.add { font-size: 14px; color: var(--muted); width: 22px; text-align: center; }
.tb-name { border: 0; background: none; padding: 3px 6px; border-radius: 6px; cursor: text; font-size: 15px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tb-name:hover { background: var(--surface-2); }
.tb-name-edit { display: flex; align-items: center; gap: 4px; min-width: 0; flex: 0 1 420px; }
.tb-name-input { font-size: 15px; font-weight: 650; padding: 3px 8px; }
.tb-plain { font-size: 15px; font-weight: 650; padding: 0 4px; white-space: nowrap; }
.tb-crumb { color: var(--muted); font-size: 14px; padding: 0 4px; white-space: nowrap; }
.tb-crumb:hover { color: var(--text); }
.tb-sep { color: var(--muted); }
.tb-live { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); margin-left: 4px; white-space: nowrap; }
.tb-actions { display: flex; gap: 6px; flex: none; align-items: center; }
.tb-actions .btn { white-space: nowrap; }
@media (max-width: 1200px) { .tb-actions .bt { display: none; } .tb-updated { display: none; } }
@media (max-width: 1000px) { .tb-live { display: none; } .tb-desc { display: none; } .tb-var select { max-width: 110px; } }
.avatar-btn { border: 0; background: none; padding: 0; margin-left: 4px; cursor: pointer; border-radius: 50%; flex: none; }
.av { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; background: var(--accent-soft); color: var(--accent); font-weight: 650; object-fit: cover; overflow: hidden; }
.av.initials { font-size: 11.5px; }
.av.lg { width: 40px; height: 40px; font-size: 22px; }
.av.lg.initials { font-size: 15px; }
.av.xl { width: 64px; height: 64px; font-size: 34px; }
.av.xl.initials { font-size: 22px; }
.avatar-btn:hover .av { box-shadow: 0 0 0 2px var(--accent); }

/* ---------- sidebar (hidden; slides in from the burger) ---------- */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 950; width: 248px;
  display: flex; flex-direction: column; gap: 16px; padding: 12px 10px; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--border); box-shadow: 8px 0 30px rgba(0, 0, 0, 0.18);
  transform: translateX(-105%); transition: transform 0.18s ease;
}
body.nav-open .sidebar { transform: none; }
.nav-backdrop { position: fixed; inset: 0; z-index: 940; background: rgba(10, 12, 18, 0.3); opacity: 0; pointer-events: none; transition: opacity 0.18s; }
body.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }
.sidebar-head { display: flex; justify-content: space-between; align-items: center; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; padding: 2px 6px; }
.brand svg { width: 22px; height: 22px; }
.nav-title { font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 0 6px 4px; }
nav a { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 6px; color: var(--text); min-width: 0; }
nav a span:not(.count):not(.nav-icon) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
nav a:hover { background: var(--surface-2); }
nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-icon { width: 18px; text-align: center; flex: none; font-size: 14px; }
img.nav-icon { height: 18px; object-fit: cover; border-radius: 4px; }
.count { font-size: 10.5px; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 0 6px; }
.nav-add { margin-top: 2px; width: 100%; text-align: left; border: 0; background: none; color: var(--muted); padding: 6px; border-radius: 6px; cursor: pointer; }
.nav-add:hover { background: var(--surface-2); color: var(--text); }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); padding: 0 6px; }

.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: pulse 2s infinite; flex: none; }
body.offline .live-dot { background: var(--err); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); } 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ---------- page ---------- */
main { padding: 10px 16px 32px; min-width: 0; }
.page-intro { margin: 2px 0 12px; }
.dash-head { margin-bottom: 8px; }
.dash-desc { padding: 4px 6px; margin: 0 -6px; border-radius: 6px; cursor: text; color: var(--muted); font-size: 12.5px; max-width: 1100px; }
.dash-desc:hover { background: var(--surface-2); }
.dash-desc.empty { font-style: italic; opacity: 0.7; }
.dash-desc img { max-height: 120px; max-width: 100%; border-radius: 6px; vertical-align: middle; }
.dash-desc.editing-desc { background: none; cursor: default; }
.desc-editor { display: flex; flex-direction: column; gap: 6px; max-width: 900px; }
.desc-editor textarea { font: 13px/1.45 var(--font); min-height: 70px; }
.row-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- buttons & forms ---------- */
.btn { border: 1px solid var(--border); background: var(--surface); padding: 4px 10px; border-radius: 6px; cursor: pointer; font-weight: 500; font-size: 12.5px; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.sm { padding: 3px 9px; font-size: 12px; }
.btn.icon-only { padding: 3px 8px; font-size: 14px; line-height: 1; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--err); }
.btn:disabled { opacity: 0.6; cursor: progress; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
input, select, textarea { border: 1px solid var(--border); background: var(--surface); border-radius: 6px; padding: 5px 8px; font-weight: 400; font-size: 13px; color: var(--text); width: 100%; min-width: 0; }
textarea { min-height: 60px; resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 30%, transparent); border-color: var(--accent); }
.help { font-weight: 400; font-size: 11.5px; }
.with-btn { display: flex; gap: 4px; align-items: center; }
.emoji-btn { border: 1px solid var(--border); background: var(--surface); border-radius: 6px; cursor: pointer; padding: 3px 6px; font-size: 14px; flex: none; }
.emoji-btn:hover { background: var(--surface-2); }
.icon-row { display: flex; align-items: center; gap: 8px; }
.icon-preview { min-width: 28px; display: inline-flex; align-items: center; font-size: 18px; color: var(--text); }
.icon-btn { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 14px; padding: 2px 6px; border-radius: 5px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }
.link-btn { align-self: flex-start; border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font-size: 12px; }

/* rich text toolbar */
.rt-bar { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-bottom: 0; border-radius: 6px 6px 0 0; background: var(--surface-2); }
.rt-bar + textarea { border-top-left-radius: 0; border-top-right-radius: 0; font-family: var(--font); font-size: 13px; }
.rt-bar button { border: 0; background: none; cursor: pointer; border-radius: 4px; padding: 2px 7px; font-size: 13px; color: var(--text); }
.rt-bar button:hover { background: var(--surface); }

/* emoji picker */
.emoji-picker { position: fixed; inset: auto; margin: 0; overflow: visible; color: var(--text); z-index: 1300; width: 336px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2); padding: 8px; }
.ep-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; max-height: 210px; overflow-y: auto; }
.ep-grid button { border: 0; background: none; font-size: 18px; padding: 3px 0; border-radius: 5px; cursor: pointer; }
.ep-grid button:hover { background: var(--surface-2); }
.ep-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }

/* ---------- cards (widgets) — content sizes multiply by --s ---------- */
body.sharp-corners { --radius: 0px; } /* dashboard option: square corners (a widget's own radius still wins) */
.card { --s: 1; font-family: var(--font); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; min-width: 0; position: relative; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: calc(8px * var(--s)) var(--pad, calc(11px * var(--s))) 0; min-height: var(--head-h, calc(26px * var(--s))); }
/* Format → Border → "under title": a line between the header and the content, in the border's colour */
.card[style*="--head-line"] > .card-head { border-bottom: var(--head-line); border-bottom-color: var(--head-line-color, var(--card-line)); padding-bottom: calc(6px * var(--s)); margin-bottom: calc(4px * var(--s)); }
body.no-lines .card-head { border-bottom-color: transparent !important; } /* ⋯ → Hide lines hides this line too */
.no-title.card[style*="--head-line"] > .card-head { border-bottom: 0; padding-bottom: 4px; margin-bottom: 0; }
.card-head h3 { font-size: round(var(--fs-title, calc(13px * var(--s))), 1px); font-weight: var(--title-weight, 600); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 0.4em; min-width: 0; }
.w-title { overflow: hidden; text-overflow: ellipsis; }
.w-icon { font-size: 1.15em; line-height: 1; flex: none; }
img.w-icon { height: 1.35em; width: auto; max-width: 3em; object-fit: contain; border-radius: 3px; }
.card-tools { display: flex; gap: 1px; opacity: 0.55; transition: opacity 0.15s; flex: none; }
.card:hover .card-tools, .card:focus-within .card-tools { opacity: 1; }
.tool-btn { border: 0; background: none; color: var(--muted); border-radius: 5px; padding: 0 7px 3px; cursor: pointer; font-size: 16px; line-height: 1; letter-spacing: 1px; }
.tool-btn:hover { background: var(--surface-2); color: var(--text); }
.card-body { flex: 1; padding: calc(4px * var(--s)) var(--pad, calc(11px * var(--s))) var(--pad, calc(2px * var(--s))); min-height: 0; position: relative; }
.card-foot { padding: 0 calc(11px * var(--s)) calc(6px * var(--s)); font-size: round(var(--fs-label, calc(10.5px * var(--s))), 1px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart { width: 100%; height: 210px; }
.kpi { padding: 2px 0; min-width: 0; width: 100%; display: flex; flex-direction: column; align-items: flex-start; text-align: left; }
/* where the number sits, and where the "▲ 1.7% vs previous" line goes */
.kpi.val-center { align-items: center; text-align: center; }
.kpi.val-right { align-items: flex-end; text-align: right; }
.kpi.cmp-above { flex-direction: column-reverse; justify-content: flex-end; }
.kpi.cmp-above .kpi-delta { margin: 0 0 calc(2px * var(--s)); }
.kpi.cmp-left, .kpi.cmp-right { flex-direction: row; align-items: baseline; gap: calc(10px * var(--s)); justify-content: flex-start; }
.kpi.cmp-left { flex-direction: row-reverse; justify-content: flex-end; }
.kpi.cmp-right.val-center, .kpi.cmp-left.val-center { justify-content: center; }
.kpi.cmp-right.val-right { justify-content: flex-end; }
.kpi.cmp-left.val-right { justify-content: flex-start; }
.kpi.cmp-left .kpi-delta, .kpi.cmp-right .kpi-delta { margin: 0; flex: 0 1 auto; min-width: 0; }
.head-right .head-text { align-items: flex-end; text-align: right; }
.head-right .card-head h3 { justify-content: flex-end; }
.kpi-value { font-size: round(var(--fs-value, calc(26px * var(--s) * var(--kpi-mult, 1))), 1px); font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; white-space: nowrap; }
.kpi-l { --kpi-mult: 1.38; }
.kpi-xl { --kpi-mult: 1.9; }
.kpi-delta { font-size: round(var(--fs-label, calc(12px * var(--s))), 1px); color: var(--muted); margin-top: calc(2px * var(--s)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-delta b { color: var(--text); font-weight: 600; }
.card.banded { box-shadow: inset calc(3px * var(--s)) 0 0 var(--band), var(--shadow); }
.loading, .err, .empty-small { color: var(--muted); padding: 10px 0; font-size: round(calc(12px * var(--s)), 1px); }
.err { color: var(--err); background: var(--err-soft); border-radius: 6px; padding: 8px 10px; margin: 4px 0; font-size: 12px; }
.no-title .card-head { position: absolute; top: 0; right: 0; padding: 4px 6px; min-height: 0; z-index: 2; }
.no-title .card-head h3 { display: none; }
.no-title .card-body { padding-top: calc(8px * var(--s)); }
.card.editing { outline: 2px solid var(--accent); outline-offset: 2px; }

/* rich text (text widgets, descriptions) */
.rich { font-size: round(var(--fs-label, calc(13px * var(--s))), 1px); line-height: 1.5; color: var(--text); overflow: auto; height: 100%; }
.rich h3 { font-size: 1.5em; margin: 0.2em 0; } .rich h4 { font-size: 1.25em; margin: 0.2em 0; } .rich h5 { font-size: 1.08em; margin: 0.2em 0; }
.rich img { max-width: 100%; max-height: 100%; border-radius: 6px; vertical-align: middle; }
.rich a { color: var(--accent); text-decoration: underline; }
.rich.align-center { text-align: center; } .rich.align-right { text-align: right; }

/* ---------- tables ---------- */
.table-wrap { overflow: auto; max-height: 260px; }
table { border-collapse: collapse; width: 100%; font-size: 12px; }
th { position: sticky; top: 0; background: var(--surface); text-align: left; font-weight: 600; color: var(--muted); font-size: 11px; padding: 5px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 4px 8px; border-bottom: 1px solid var(--grid); white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.item table { font-size: round(var(--fs-label, calc(12.5px * var(--s))), 1px); }
.item th { font-size: round(var(--fs-label, calc(11.5px * var(--s))), 1px); padding: calc(5px * var(--s)) calc(8px * var(--s)); }
.item td { padding: calc(4px * var(--s)) calc(8px * var(--s)); }
.item .comfy td { padding: calc(8px * var(--s)) calc(10px * var(--s)); }
/* extra compact: smaller text and padding, so more rows and columns fit */
.item .dense table { font-size: round(var(--fs-label, calc(10.5px * var(--s))), 1px); line-height: 1.2; }
.item .dense th { font-size: round(var(--fs-label, calc(10px * var(--s))), 1px); padding: calc(3px * var(--s)) calc(5px * var(--s)); }
.item .dense td { padding: calc(1.5px * var(--s)) calc(5px * var(--s)); }
/* dragging a column heading to reorder */
.item th.col-dragging { opacity: 0.45; }
.col-drop { position: absolute; top: 0; width: 2px; background: var(--accent); pointer-events: none; z-index: 5; border-radius: 1px; }
/* filter → linked widgets list */
.links-editor { display: flex; flex-direction: column; gap: 3px; max-height: 240px; overflow: auto; border: 1px solid var(--border); border-radius: 6px; padding: 4px 6px; }
.link-row { display: grid; grid-template-columns: auto 1fr 120px; gap: 6px; align-items: center; font-size: 12px; }
.link-row .link-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-row .link-name small { margin-left: 6px; }
.link-row select { font-size: 11.5px; padding: 2px 4px; }
/* resizable columns & rows */
.item th { position: sticky; }
.col-grip { position: absolute; top: 0; right: 0; width: 7px; height: 100%; cursor: col-resize; z-index: 2; }
.col-filter { border: 0; background: transparent; color: var(--muted); font-size: 0.9em; padding: 0 3px; margin-left: 4px; cursor: pointer; border-radius: 3px; opacity: 0.55; vertical-align: -0.12em; line-height: 1; }
.col-filter svg { display: block; }
.col-filter.on svg { fill: currentColor; } /* filled funnel = this column is filtered */
.col-filter:hover, .col-filter.on { opacity: 1; color: var(--accent); }
.col-filter.on { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.col-filter-pop { position: fixed; z-index: 1200; width: 250px; max-height: 320px; display: flex; flex-direction: column; gap: 6px; padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3); }
.col-filter-pop .cf-search { font-size: 12px; padding: 4px 6px; }
.col-filter-pop .cf-tools { display: flex; gap: 8px; font-size: 11px; }
.col-filter-pop .cf-list { overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.col-filter-pop .cf-list label { display: flex; gap: 6px; align-items: center; min-width: 0; }
.col-filter-pop .cf-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-wrap .cell-link { color: var(--accent); text-decoration: none; }
.table-wrap .cell-link:hover { text-decoration: underline; }
.table-wrap tr.grp-row td { background: color-mix(in srgb, var(--accent) 10%, var(--surface-2)); cursor: pointer; font-size: 0.95em; padding-top: calc(4px * var(--s)); padding-bottom: calc(4px * var(--s)); }
.table-wrap tr.grp-row .grp-caret { display: inline-block; width: 1em; color: var(--muted); }
.datefilter { display: flex; flex-direction: column; gap: calc(6px * var(--s)); padding: calc(2px * var(--s)) 0; }
.df-custom { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.df-custom input { width: auto; font-size: round(calc(12px * var(--s)), 1px); padding: 3px 6px; }
.df-preset { width: auto; max-width: 100%; font-size: round(calc(13px * var(--s)), 1px); }
.df-note { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ref-row { display: grid; grid-template-columns: 1fr 1fr 1.2fr auto auto auto; gap: 4px; align-items: center; margin-bottom: 4px; }
.ref-row input, .ref-row select { padding: 3px 5px; font-size: 12px; }
.ref-row input[type='color'] { width: 34px; height: 24px; padding: 1px; }
.measure-fmt { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; align-items: center; }
.measure-fmt input[type='color'] { width: 30px; height: 22px; padding: 1px; }
/* Format → Numbers: one row per measure on multi-measure charts */
.measures-table-wrap { overflow-x: auto; margin: 0 0 8px; }
.measures-table { width: 100%; border-collapse: collapse; font-size: 12px; table-layout: fixed; }
.measures-table th { text-align: left; font-weight: 600; color: var(--muted, #667); padding: 2px 4px 4px; white-space: nowrap; }
.measures-table td { padding: 2px 3px; vertical-align: middle; }
.measures-table td.c, .measures-table th:nth-child(n + 5) { text-align: center; }
.measures-table input:not([type='checkbox']):not([type='color']), .measures-table select { width: 100%; min-width: 0; font-size: 12px; padding: 3px 4px; }
.measures-table td.c { white-space: nowrap; padding: 2px 0; }
.measures-table th { font-size: 11px; padding: 2px 2px 4px; }
.measures-table input[type='color'] { width: 22px; height: 20px; padding: 1px; margin-left: 3px; vertical-align: middle; }
.measures-table input[type='checkbox'] { width: auto; margin: 0; vertical-align: middle; }
.measures-table select { padding: 3px 1px !important; text-overflow: ellipsis; }
.measures-table tbody tr + tr td { border-top: 1px solid var(--border, #e3e6ea); }
.drawer-body h5 { margin: 2px 0 0; font-size: 11px; color: var(--muted); font-weight: 600; }
.tlink-row { display: grid; grid-template-columns: 110px 1fr auto; gap: 4px; align-items: center; margin-bottom: 4px; }
.tlink-row input, .tlink-row select { padding: 3px 5px; font-size: 12px; }
.col-grip::after { content: ''; position: absolute; top: 20%; bottom: 20%; right: 0; width: 1px; background: var(--border); }
.col-grip:hover::after, .resizing-col .col-grip::after { background: var(--accent); width: 2px; }
.item table.sized { table-layout: fixed; }
.item table.sized th, .item table.sized td { overflow: hidden; text-overflow: ellipsis; max-width: none; }
.item .table-wrap.row-edge, .item .table-wrap.row-edge td { cursor: row-resize; }
.item .table-wrap.resizing-col { cursor: col-resize; user-select: none; }
.item .rows-sized td { height: var(--row-h); padding-top: 0; padding-bottom: 0; line-height: 1.1; }
tr:last-child td { border-bottom: 0; }
table.list tbody tr { cursor: pointer; }
table.list tbody tr:hover td { background: var(--surface-2); }
table.list td { padding: 7px 10px; font-size: 12.5px; }
table.list th { padding: 7px 10px; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; }
.badge.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.badge.err { color: var(--err); background: var(--err-soft); }
.badge.neutral { color: var(--muted); background: var(--surface-2); }
.no { color: var(--err); font-weight: 600; }

/* ---------- free-form canvas ---------- */
.canvas { position: relative; min-height: 120px; }
.item { position: absolute; }
.item > .card { height: 100%; overflow: hidden; }
.item .card-body { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.item .chart { flex: 1; height: auto; min-height: 20px; }
.item .table-wrap { flex: 1; max-height: none; min-height: 0; }
.item .type-kpi .card-body { flex-direction: row; align-items: center; }
.item > .card { cursor: move; } /* drag the title or empty space to move */
.item .card-body :is(td, .rich, p, li, .kpi-value, .tk-text) { cursor: text; } /* text selects for copying */
.item .card-body button, .item .card-body a, .item .table-wrap { cursor: auto; }
.item .card-head button { cursor: pointer; }
body.dragging, body.dragging * { user-select: none !important; }

/* resize: grab anywhere on the border or a corner — no visible boxes; the border lights up instead */
.rh { position: absolute; z-index: 4; }
.rh-n, .rh-s { left: 10px; right: 10px; height: 10px; cursor: ns-resize; }
.rh-n { top: -5px; } .rh-s { bottom: -5px; }
.rh-e, .rh-w { top: 10px; bottom: 10px; width: 10px; cursor: ew-resize; }
.rh-e { right: -5px; } .rh-w { left: -5px; }
.rh-ne, .rh-nw, .rh-se, .rh-sw { width: 16px; height: 16px; }
.rh-nw { top: -6px; left: -6px; cursor: nwse-resize; }
.rh-se { bottom: -6px; right: -6px; cursor: nwse-resize; }
.rh-ne { top: -6px; right: -6px; cursor: nesw-resize; }
.rh-sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.item:has(.rh:hover) > .card,
.item.resizing > .card { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.item.moving > .card { border-color: var(--accent); box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22); }
body.tv .rh { display: none; }
body.tv .item .card-head { cursor: default; }

.size-badge {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 6;
  background: var(--text); color: var(--bg); font-size: 12px; font-weight: 600; white-space: nowrap;
  padding: 5px 10px; border-radius: 6px; pointer-events: none; transition: opacity 0.3s;
}
.size-badge.fade { opacity: 0; }

/* ---------- source detail ---------- */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; margin-bottom: 12px; }
.card.pad { padding: 12px 14px; gap: 10px; }
.card h2 { font-size: 13px; font-weight: 600; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 7px 10px; align-items: center; }
.kv dt { color: var(--muted); font-size: 12px; }
.kv dd { margin: 0; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { font-size: 11.5px; border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; background: var(--surface-2); }
.chip i { font-style: normal; color: var(--muted); margin-left: 4px; }
/* extra measures on a chart */
.measure-row { display: grid; grid-template-columns: 1.1fr 1fr 1.2fr 0.85fr 0.8fr 0.95fr auto; gap: 4px; align-items: center; margin-bottom: 4px; }
.measure-row [hidden] { display: none; }
.measure-row input[data-k="formula"]:not([hidden]) { grid-column: span 1; }
.measure-row select, .measure-row input { font-size: 12px; padding: 4px 6px; min-width: 0; }
/* formula / SQL editor */
.chip-list { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.chip-list button.chip { cursor: pointer; color: var(--text); font: inherit; font-size: 11.5px; }
.chip-list button.chip:hover { border-color: var(--accent); }
.sql-box textarea, [data-role="formula"] textarea { width: 100%; }
.sql-preview { margin-top: 6px; border: 1px solid var(--border); border-radius: 8px; padding: 6px; }
.sql-preview .table-wrap { max-height: 180px; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 0.92em; background: var(--surface-2); padding: 0 3px; border-radius: 4px; }
pre.code { margin: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 7px 9px; font: 11.5px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-all; }

/* ---------- empty state ---------- */
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty h2 { color: var(--text); font-size: 15px; margin-bottom: 4px; }
.empty .btn { margin-top: 12px; }

/* ---------- modal ---------- */
dialog { border: 1px solid var(--border); border-radius: 12px; padding: 0; background: var(--surface); color: var(--text); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22); }
dialog:has(.wide) { width: min(680px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(10, 12, 18, 0.4); }
dialog { position: relative; }
.modal-x { position: absolute; top: 8px; right: 8px; z-index: 2; border: 0; background: transparent; color: var(--muted); font-size: 14px; width: 28px; height: 28px; border-radius: 6px; cursor: pointer; }
.modal-x:hover { background: var(--surface-2); color: var(--text); }
dialog .modal-form > h2:first-of-type, dialog .modal-body > h2:first-of-type { padding-right: 28px; }
.modal-form { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.modal-form h2 { font-size: 15px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid > div.full { display: flex; flex-direction: column; gap: 4px; }
.form-grid > div.full > label { font-size: 12px; }
fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px 10px; display: grid; grid-template-columns: 1.2fr 1fr 1.2fr; gap: 6px; margin: 0; }
legend { font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 4px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 6px; }
textarea.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.connector-search { width: 100%; }
.connector-group h4 { margin: 6px 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
#modal:has(.connector-group) { max-height: 88vh; }
#modal .modal-form:has(.connector-group) { max-height: calc(88vh - 40px); overflow: auto; }
.connector-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.connector { text-align: left; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 10px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; }
.connector:hover { border-color: var(--accent); background: var(--accent-soft); }
.tag { align-self: flex-start; font-size: 10px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent); }
.profile-edit-avatar { display: flex; align-items: center; gap: 12px; }

/* ---------- popover menu ---------- */
.menu { position: fixed; z-index: 1100; min-width: 170px; max-width: 280px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14); padding: 4px; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 6px 10px; border-radius: 5px; cursor: pointer; font-size: 12.5px; color: var(--text); }
.menu button:hover { background: var(--surface-2); }
.menu button.danger { color: var(--err); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.profile-card { display: flex; gap: 10px; align-items: center; padding: 8px 10px 6px; }
.menu-note { padding: 4px 10px 6px; }

/* ---------- format panel (drawer) ---------- */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 330px; max-width: 100vw; z-index: 1000; background: var(--surface); border-left: 1px solid var(--border); box-shadow: -8px 0 24px rgba(0, 0, 0, 0.1); display: flex; }
.drawer.left { right: auto; left: 0; border-left: 0; border-right: 1px solid var(--border); box-shadow: 8px 0 24px rgba(0, 0, 0, 0.1); }
.drawer-form { display: flex; flex-direction: column; width: 100%; min-height: 0; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { font-size: 14px; }
.drawer-head p { margin: 2px 0 0; }
.drawer-body { flex: 1; overflow-y: auto; padding: 0 14px 12px; }
.drawer-body section[hidden] { display: none; }
/* segmented pickers (left / centre / right, above / below …) */
.pos-picker { display: flex; flex-wrap: wrap; gap: 3px; }
.pos-opt { display: inline-flex; cursor: pointer; }
.pos-opt input { position: absolute; opacity: 0; pointer-events: none; }
.pos-opt span { border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.pos-opt input:checked + span { border-color: var(--accent); color: var(--text); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.pos-opt input:focus-visible + span { outline: 2px solid var(--accent); }
/* format panel tabs */
.format-tabs { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px 10px 0; border-bottom: 1px solid var(--border); }
.format-tabs button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 12px; padding: 6px 8px 7px; border-bottom: 2px solid transparent; cursor: pointer; border-radius: 6px 6px 0 0; white-space: nowrap; }
.format-tabs button:hover { color: var(--text); background: var(--surface-2); }
.format-tabs button.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.drawer-body section { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--grid); }
.drawer-body section:last-child { border-bottom: 0; }
.drawer-body h4 { margin: 0; font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.drawer-body p { margin: 0; }
.drawer-foot { display: flex; justify-content: flex-end; gap: 6px; padding: 10px 14px; border-top: 1px solid var(--border); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.row4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
/* Format panel fields: the label sits inside the box, in front of the value */
.drawer-body label:not(.check):not(.mini):not(.color-field):not(:has(textarea)):not(:has(input[type='range'])):not(:has(input[type='checkbox'])) {
  flex-direction: row; align-items: center; gap: 6px; min-height: 30px;
  border: 1px solid var(--border); border-radius: 6px; padding-left: 8px; background: var(--surface);
  font-size: 11px; font-weight: 500; white-space: nowrap;
}
.drawer-body label:not(.check):not(.mini):not(.color-field) > input:not([type='range']):not([type='checkbox']),
.drawer-body label:not(.check):not(.mini):not(.color-field) > select,
.drawer-body label:not(.check):not(.mini):not(.color-field) > .with-btn,
.drawer-body label:not(.check):not(.mini):not(.color-field) > .icon-row { flex: 1; min-width: 0; border: 0; border-radius: 0 5px 5px 0; background: transparent; padding: 5px 6px; font-size: 12.5px; color: var(--text); }
.drawer-body label > .with-btn > input, .drawer-body label > .with-btn > select { border: 0; background: transparent; padding: 0; }
.drawer-body label:not(.check):not(.mini):not(.color-field):focus-within { border-color: var(--accent); }
.drawer-body label > .muted.small { font-weight: 400; }
.drawer-body .row4 > label { padding-left: 6px; gap: 3px; }
.drawer-body .row4 > label > input { padding: 5px 2px; font-size: 12px; appearance: textfield; -moz-appearance: textfield; }
.drawer-body .row4 > label > input::-webkit-inner-spin-button, .drawer-body .row4 > label > input::-webkit-outer-spin-button { display: none; }
.drawer-body label:has(input[type='range']) { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.drawer-body label:has(input[type='range']) > input[type='range'] { flex-basis: 100%; }
.drawer-body label > select { text-overflow: ellipsis; }
.drawer-body .color-field { flex-direction: row; align-items: center; justify-content: space-between; min-height: 30px; border: 1px solid var(--border); border-radius: 6px; padding: 0 4px 0 8px; font-size: 11px; font-weight: 500; }
.drawer-body .color-field input[type='color'] { width: 34px; height: 22px; padding: 1px; }
label.check { flex-direction: row; align-items: center; gap: 7px; font-weight: 500; color: var(--text); cursor: pointer; }
label.check input { width: auto; margin: 0; }
input[type='color'] { height: 30px; padding: 2px 3px; cursor: pointer; }

/* colour band editor: +∞ ▸ colour ▸ 90 ▸ colour ▸ 80 ▸ colour ▸ −∞ */
#bands-editor { display: flex; flex-direction: column; gap: 4px; padding-left: 12px; border-left: 2px solid var(--border); margin-left: 4px; }
.band-end { font-size: 12px; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.band-end input[type='number'] { width: 90px; }
.band-row { display: flex; align-items: center; gap: 8px; }
.band-row input[type='color'] { width: 44px; flex: none; }
.band-range { font-size: 12px; color: var(--muted); }
.band-stop { display: flex; align-items: center; gap: 4px; margin-left: -14px; }
.band-stop::before { content: ''; width: 10px; border-top: 2px solid var(--muted); flex: none; }
.band-stop input { width: 110px; font-weight: 600; }

/* ---------- toast ---------- */
#toast { position: fixed; bottom: 16px; left: 50%; transform: translate(-50%, 16px); opacity: 0; pointer-events: none; background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: 8px; font-size: 12.5px; transition: 0.2s; max-width: calc(100vw - 32px); z-index: 1400; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--err); color: #fff; }

/* ---------- TV mode: just the widgets, scaled to fit the screen ---------- */
.tv-exit { display: none; }
body.tv .topbar, body.tv .dash-head, body.tv .sidebar, body.tv .nav-backdrop { display: none; }
body.tv main { padding: 14px; overflow: hidden; }
body.tv .canvas { margin: 0 auto; }
/* a small round ✕ in the top-right corner: faint so it doesn't distract on a wallboard, clear on hover */
body.tv .tv-exit {
  display: grid; place-items: center; position: fixed; right: 10px; top: 10px; z-index: 1000; width: 28px; height: 28px; padding: 0;
  border: 1px solid var(--card-line); border-radius: 50%; background: color-mix(in srgb, var(--bg) 70%, transparent); color: var(--text);
  font-size: 13px; line-height: 1; cursor: pointer; opacity: 0.45; transition: opacity 0.15s, background 0.15s;
}
body.tv .tv-exit:hover { opacity: 1; background: var(--surface); }

/* ---------- phones ---------- */
@media (max-width: 900px) {
  main { padding: 10px 12px 32px; }
  .tb-live, .tb-actions .btn:not(.primary):not(.icon-only) { display: none; }
  .canvas { height: auto !important; width: auto !important; display: flex; flex-direction: row; flex-wrap: wrap; gap: 12px; }
  .item { position: relative; left: auto !important; top: auto !important; width: 100% !important; z-index: auto !important; }
  .item.half { width: calc(50% - 6px) !important; }
  .rh { display: none; }
  .item .card-head { cursor: default; }
  .form-grid, fieldset { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 3px; }
}

/* ---------- dashboard title + one-line description, stacked in the top bar ---------- */
.tb-titles { display: flex; flex-direction: column; justify-content: center; min-width: 0; flex: 0 1 auto; line-height: 1.15; }
.tb-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
.tb-titles .tb-name { font-size: 14.5px; padding: 1px 5px; }
.tb-desc {
  border: 0; background: none; text-align: left; cursor: text; border-radius: 4px;
  padding: 0 5px 1px; margin-top: 1px; max-width: min(720px, 55vw);
  font-size: 11.5px; color: var(--muted); line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tb-desc:hover { background: var(--surface-2); color: var(--text); }
.tb-desc br { display: none; }
.tb-desc h3, .tb-desc h4, .tb-desc h5 { display: inline; font-size: inherit; }
.tb-desc img { height: 1.3em; width: auto; vertical-align: -0.3em; border-radius: 3px; }
.tb-desc a { color: inherit; text-decoration: underline; }
.desc-pop { position: fixed; z-index: 1150; width: min(520px, calc(100vw - 16px)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2); padding: 10px; }
/* no description → a bigger title using the whole bar */
.tb-titles.solo .tb-name { font-size: 18px; padding: 2px 6px; }

/* time-window chip, top-right of each data widget */
.win-chip {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
  border-radius: 999px; cursor: pointer; white-space: nowrap; font-weight: 600;
  font-size: round(max(9.5px, calc(10.5px * var(--s))), 1px); line-height: 1.5; padding: 0 calc(7px * var(--s));
}
.win-chip:hover { color: var(--text); border-color: var(--accent); }
.card-tools { align-items: center; gap: 4px; }
.card:hover .win-chip, .win-chip { opacity: 1; }
body.tv .win-chip { pointer-events: none; } /* still shows the window on a wallboard */
.card-tools { opacity: 1; }
.tool-btn { opacity: 0.55; transition: opacity 0.15s; }
.card:hover .tool-btn, .tool-btn:focus-visible { opacity: 1; }
body.tv .tool-btn { display: none; }

/* ---------- filter widget (click values to filter other widgets) ---------- */
.item .type-filter .card-body { justify-content: center; }
.slicer { display: flex; flex-wrap: wrap; gap: calc(6px * var(--s)); align-content: flex-start; overflow: auto; max-height: 100%; padding: 2px 0; }
.slicer-chip {
  display: inline-flex; align-items: center; gap: 0.45em; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px;
  font-size: round(var(--fs-label, calc(12px * var(--s))), 1px); padding: calc(3px * var(--s)) calc(11px * var(--s)); font-weight: 500;
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
}
.slicer-chip:hover { border-color: var(--accent); }
.slicer-chip .n { color: var(--muted); font-size: 0.88em; font-variant-numeric: tabular-nums; }
.slicer-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.slicer-chip.on .n { color: rgba(255, 255, 255, 0.8); }
.slicer-chip.dim { opacity: 0.55; }
.slicer-chip.dim:hover { opacity: 1; }
.slicer-clear { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: round(var(--fs-label, calc(11.5px * var(--s))), 1px); padding: calc(3px * var(--s)) 4px; }
.slicer-clear:hover { color: var(--err); }
/* filtered widgets: footer note in the accent colour */

/* ---------- widget header: title + optional description; header/frame colours ---------- */
.head-text { min-width: 0; display: flex; flex-direction: column; flex: 1; }
.card-head { background: var(--head-bg, transparent); border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0; }
.card-head h3 { color: var(--head-color, var(--text)); font-family: var(--title-font, inherit); }
.card.band-bg { background: var(--band) !important; }
.card.band-bg { --text: #fff; --muted: rgba(255, 255, 255, 0.85); color: #fff; }
.card.band-bg .kpi-value { color: #fff !important; }
.card.band-head .card-head { background: var(--band); padding-bottom: calc(6px * var(--s)); }
.card.band-border { border-color: var(--band) !important; }
.check-row { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 11px; color: var(--muted); font-weight: 600; }
.check-row label.check { font-size: 12px; }
.card-sub { font-size: round(var(--fs-sub, calc(11px * var(--s))), 1px); color: var(--sub-color, var(--head-color, var(--muted))); background: var(--sub-bg, transparent); text-align: var(--sub-align, inherit); border-radius: 3px; padding: 0 calc(3px * var(--s)); margin-left: calc(-3px * var(--s)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.card[style*="--head-bg"] .card-head { padding-bottom: calc(6px * var(--s)); }
.head-center .head-text { align-items: center; text-align: center; }
.head-center .card-head h3 { justify-content: center; }
.card-body { color: var(--body-color, inherit); }
.card[style*="--body-color"] .kpi-delta, .card[style*="--body-color"] .card-foot { color: var(--body-color); opacity: 0.8; }
.no-foot .card-foot, .card-foot:empty { display: none; } /* an empty footer takes no room */
/* KPI extras: sparkline, target progress */
.kpi-stack { width: 100%; min-width: 0; display: flex; flex-direction: column; gap: calc(3px * var(--s)); }
/* circular status: the number inside a ring; multiple circles: one ring per measure */
.kpi-stack.shape-circle, .kpi-stack.shape-multi { height: 100%; }
.kpi.kpi-circles { flex-direction: row; align-items: center; justify-content: center; gap: calc(14px * var(--s)); height: 100%; min-height: 0; flex-wrap: nowrap; padding: 0; }
.kpi.kpi-circles.val-left { justify-content: flex-start; }
.kpi.kpi-circles.val-right { justify-content: flex-end; }
.kpi-ring { display: flex; flex-direction: column; align-items: center; gap: calc(4px * var(--s)); height: 100%; min-width: 0; min-height: 0; flex: 0 1 auto; }
.kpi-circle { aspect-ratio: 1 / 1; height: 100%; width: auto; flex: none; min-height: 0; min-width: 0; max-width: 100%; overflow: hidden; container-type: size; border-radius: 50%; border: max(3px, calc(5px * var(--s))) solid var(--ring, var(--accent)); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; box-sizing: border-box; }
.kpi-circle .kpi-value { white-space: nowrap; font-size: min(round(var(--fs-value, calc(26px * var(--s) * var(--kpi-mult, 1))), 1px), 26cqw); line-height: 1.1; }
.kpi-circle .kpi-delta { margin: 0; font-size: min(round(var(--fs-label, calc(12px * var(--s))), 1px), 11cqw); max-width: 86%; }
.kpi-ring-label { flex: none; font-size: round(var(--fs-label, calc(12px * var(--s))), 1px); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.kpi-ring:has(.kpi-ring-label) .kpi-circle { height: calc(100% - 1.5em - 4px); }
.kpi-spark { width: 100%; height: calc(30px * var(--s)); display: block; }
.kpi-progress { height: calc(6px * var(--s)); border-radius: 999px; background: var(--grid); overflow: hidden; }
.kpi-progress .bar { height: 100%; border-radius: 999px; transition: width 0.4s ease; }
.kpi-target { font-size: round(var(--fs-label, calc(11px * var(--s))), 1px); color: var(--muted); }
/* alert banner */
.item .type-alert .card-body { padding: calc(6px * var(--s)) calc(11px * var(--s)); }
.alert-banner { flex: 1; display: flex; align-items: center; gap: calc(12px * var(--s)); background: var(--alert); color: #fff; border-radius: calc(var(--radius) - 2px); padding: calc(8px * var(--s)) calc(14px * var(--s)); min-height: 0; }
.alert-icon { font-size: round(calc(24px * var(--s)), 1px); line-height: 1; }
.alert-text { flex: 1; font-size: round(var(--fs-value, calc(16px * var(--s))), 1px); font-weight: 650; line-height: 1.25; }
.alert-value { font-size: round(var(--fs-value, calc(26px * var(--s))), 1px); font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.alert-banner.flash { animation: alert-flash 1.1s ease-in-out infinite; }
@keyframes alert-flash { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(0.6); } }
@media (prefers-reduced-motion: reduce) { .alert-banner.flash { animation: none; } }
/* leaderboard */
.leaderboard { list-style: none; margin: 0; padding: 0; flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: calc(2px * var(--s)); }
.lb-row { display: grid; grid-template-columns: calc(26px * var(--s)) auto minmax(0, 1fr) minmax(0, 1.2fr) auto; align-items: center; gap: calc(8px * var(--s)); padding: calc(3px * var(--s)) calc(4px * var(--s)); border-radius: 6px; font-size: round(var(--fs-label, calc(12.5px * var(--s))), 1px); transition: opacity 0.15s; }
.leaderboard.no-bars .lb-row { grid-template-columns: calc(26px * var(--s)) auto minmax(0, 1fr) 0 auto; }
.leaderboard.no-bars .lb-bar { display: none; }
.leaderboard.clickable .lb-row { cursor: pointer; }
.leaderboard.clickable .lb-row:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.lb-row.dim { opacity: 0.3; }
/* status tiles (grid or honeycomb) */
.tiles { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: calc(4px * var(--s)); }
.tiles-grid { position: relative; flex: 1; min-height: 0; }
.tile { position: absolute; box-sizing: border-box; border: 0; padding: 0; margin: 0; color: #fff; font: inherit; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.1em; overflow: hidden; border-radius: calc(5px * var(--s)); line-height: 1.1; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25); font-size: max(8px, calc(var(--ts, 40px) * 0.135)); transition: opacity 0.15s, background-color 0.4s, transform 0.15s; cursor: default; }
.tile.hex { border-radius: 0; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.tiles.clickable .tile { cursor: pointer; }
.tiles.clickable .tile:hover { transform: scale(1.04); z-index: 1; }
.tile.dim { opacity: 0.3; }
.tile-name { max-width: 92%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.tile-val { font-weight: 800; font-size: 1.5em; font-variant-numeric: tabular-nums; }
.tile-val.small { font-size: 0.8em; font-weight: 500; opacity: 0.9; }
.tile.tiny .tile-name { display: none; }
.tile.tiny .tile-val { font-size: 1em; }
.tiles-legend { display: flex; flex-wrap: wrap; gap: calc(4px * var(--s)) calc(12px * var(--s)); justify-content: center; font-size: round(calc(11px * var(--s)), 1px); color: var(--muted); }
.tiles-legend i { display: inline-block; width: 0.7em; height: 0.7em; border-radius: 2px; margin-right: 0.35em; }
.tiles-legend b { color: var(--text); font-weight: 650; }
/* uptime / SLO bars */
.uptime { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: calc(3px * var(--s)); font-size: round(var(--fs-label, calc(12px * var(--s))), 1px); }
.up-rows { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: calc(5px * var(--s)); justify-content: center; }
.up-row { flex: 1 1 0; max-height: calc(34px * var(--s)); min-height: 0; display: grid; grid-template-columns: minmax(0, 0.28fr) minmax(0, 1fr) 3.4em; align-items: center; gap: calc(8px * var(--s)); transition: opacity 0.15s; }
.up-row.dim { opacity: 0.3; }
.uptime.clickable .up-row { cursor: pointer; }
.up-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.up-strip { display: flex; gap: 1px; height: 78%; min-height: 6px; }
.up-strip i { flex: 1 1 0; min-width: 1px; border-radius: 1px; }
.up-pct { min-width: 3.4em; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.up-axis { display: grid; grid-template-columns: minmax(0, 0.28fr) minmax(0, 1fr) 3.4em; gap: calc(8px * var(--s)); color: var(--muted); font-size: 0.85em; }
.up-ax2 { display: flex; justify-content: space-between; gap: 0.6em; }
.up-ax2 b, .up-ax2 em { font-weight: 500; font-style: normal; }
.lb-rank { text-align: center; font-weight: 700; color: var(--muted); font-size: 1.05em; }
.lb-avatar { width: calc(24px * var(--s)); height: calc(24px * var(--s)); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 0.78em; }
.lb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.lb-bar { height: calc(8px * var(--s)); border-radius: 999px; background: var(--grid); overflow: hidden; }
.lb-bar i { display: block; height: 100%; border-radius: 999px; transition: width 0.4s ease; }
.lb-value { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
/* clock / countdown */
.clock { width: 100%; text-align: center; }
.clock .clock-time { font-variant-numeric: tabular-nums; }
.clock.done .clock-time { color: var(--err); animation: alert-flash 1s ease-in-out infinite; }
.clock .clock-sub { white-space: normal; }
/* scrolling ticker */
.item .type-ticker .card-body { padding: calc(4px * var(--s)) 0; justify-content: center; }
.ticker { overflow: hidden; width: 100%; white-space: nowrap; mask-image: linear-gradient(to right, transparent, #000 3%, #000 97%, transparent); }
.ticker-track { display: inline-block; white-space: nowrap; animation: ticker-scroll linear infinite; font-size: round(var(--fs-value, calc(16px * var(--s))), 1px); font-weight: 600; will-change: transform; }
.ticker-track span { display: inline-block; padding-right: calc(20px * var(--s)); }
@keyframes ticker-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.ticker:hover .ticker-track { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .ticker-track { animation: none; } }
/* alert rules & report schedules */
.alert-rules { display: flex; flex-direction: column; gap: 4px; }
.alert-rule { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.alert-rule.off { opacity: 0.6; }
.alert-rule-main { flex: 1; min-width: 0; }
.alert-rule-tools { display: flex; gap: 4px; flex: none; }
.modal-form fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px 10px; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.modal-form legend { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 0 4px; }
table.list.small td { padding: 3px 6px; font-size: 12px; }
/* scorecard */
.scorecard .sc-label { font-weight: 600; min-width: 120px; }
.scorecard .sc-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.scorecard .sc-change { font-variant-numeric: tabular-nums; color: var(--muted); }
.scorecard .sc-change.up { color: var(--ok, #12a189); }
.scorecard .sc-change.down { color: var(--err); }
.sc-progress { height: calc(4px * var(--s)); border-radius: 999px; background: var(--grid); margin-top: calc(3px * var(--s)); overflow: hidden; }
.sc-progress i { display: block; height: 100%; border-radius: 999px; }
.sc-status { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.sc-status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 25%, transparent); }
/* KPI picker / measure rows */
.measure-row { grid-template-columns: 1fr 1.1fr 1fr 1.2fr 0.85fr 0.8fr 0.95fr auto; }
.measure-row [data-chart][hidden], .measure-row [data-sc][hidden] { display: none; }
.measure-row.sc { grid-template-columns: 1fr 1.1fr 1fr 1.2fr 0.95fr 0.7fr 0.95fr auto; }
/* AI insights */
.ai-box { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: calc(6px * var(--s)); overflow: auto; font-size: round(var(--fs-label, calc(12.5px * var(--s))), 1px); line-height: 1.4; }
.ai-summary { margin: 0; font-size: round(var(--fs-value, calc(14px * var(--s))), 1px); font-weight: 600; line-height: 1.35; }
.ai-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: calc(4px * var(--s)); }
.ai-item { display: flex; gap: 6px; align-items: flex-start; }
.ai-item .ai-dot { flex: none; font-size: 0.8em; line-height: 1.7; }
.ai-item.critical { color: var(--text); }
.ai-foot { margin-top: auto; display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.ai-setup { color: var(--muted); display: flex; flex-direction: column; gap: 8px; }
.ai-setup p { margin: 0; }
/* matrix / pivot */
.pivot th.pv-rowhead { text-align: left; }
.pivot .pv-label { white-space: nowrap; }
.pv-toggle { border: 0; background: none; color: var(--muted); cursor: pointer; font: inherit; width: calc(16px * var(--s)); padding: 0; margin-right: 2px; }
.pv-toggle:hover { color: var(--text); }
.pv-dot { display: inline-block; width: calc(16px * var(--s)); }
.pivot tr.lvl-1 > td { font-weight: 600; }
.pivot tr.lvl-1.has-kids > td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.pivot tr.lvl-3 > td { color: var(--muted); }
.pivot .pv-total { border-left: 1px solid var(--border); font-weight: 650; }
.pivot tfoot td { border-top: 2px solid var(--border); font-weight: 700; position: sticky; bottom: 0; background: var(--surface); }
.pivot th[data-sort-m] { cursor: pointer; }
.pivot.clickable tbody tr { cursor: pointer; }
.pivot.clickable tbody tr:hover > td { background: color-mix(in srgb, var(--accent) 10%, transparent); }
/* shaded map */
.map-note { position: absolute; left: 8px; bottom: 24px; z-index: 500; }
/* word cloud */
.wordcloud { flex: 1; min-height: 0; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; align-items: center; gap: calc(2px * var(--s)) calc(10px * var(--s)); overflow: hidden; line-height: 1.05; padding: calc(4px * var(--s)); }
.wordcloud .word { font-weight: 650; white-space: nowrap; transition: opacity 0.15s; }
.wordcloud.clickable .word { cursor: pointer; }
.wordcloud.clickable .word:hover { text-decoration: underline; }
.wordcloud .word.dim { opacity: 0.25; }
/* click to drill */
.kpi.clickable { cursor: pointer; border-radius: 8px; transition: background 0.15s; }
.kpi.clickable:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.card.drilled { outline: 2px solid var(--accent); outline-offset: -2px; }
.drill-chip { border: 0; background: var(--accent); color: #fff; border-radius: 999px; font-size: round(calc(10.5px * var(--s)), 1px); padding: 1px 8px; cursor: pointer; white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.card.drilled .card-tools { opacity: 1; }
.drawer section.flash { animation: flash-section 1.4s ease-out; }
@keyframes flash-section { 0%, 40% { background: color-mix(in srgb, var(--accent) 18%, transparent); } 100% { background: transparent; } }
.click-row { grid-template-columns: auto 1fr; cursor: pointer; }
.tb-updated { font-size: 10.5px; color: var(--muted); margin-left: 6px; white-space: nowrap; }
.tb-save { min-width: 74px; }
.tb-save.pending, .tb-save.saving { color: var(--warn, #e0a030); }
.tb-save.error { color: var(--err); }
.share-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
#modal .modal-form { overflow-x: hidden; }
.share-row input { flex: 1; font-size: 12px; }
.share-note { background: color-mix(in srgb, var(--accent) 10%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: 8px; padding: 8px 10px; }
.no-title .head-text { display: none; }

/* ---------- table extras ---------- */
.item .card-body:has(.tbl-count) { gap: 2px; }
.item th[data-act] { cursor: pointer; user-select: none; }
.item th[data-act]:hover { color: var(--text); }
td.counter { font-variant-numeric: tabular-nums; font-weight: 600; }
.table-wrap.align-center td, .table-wrap.align-center th { text-align: center; }
.table-wrap.align-right td, .table-wrap.align-right th { text-align: right; }
.tbl-count { font-size: round(var(--fs-label, calc(10.5px * var(--s))), 1px); color: var(--muted); padding: 2px 4px 0; display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
/* page buttons under a table */
.table-wrap tr.empty-row td { text-align: center !important; color: var(--muted); padding: calc(18px * var(--s, 1)) 8px; border-bottom: 0; white-space: normal; max-width: none; }
.pager { display: inline-flex; align-items: center; gap: 2px; }
.pg-btn { border: 1px solid var(--border); background: transparent; color: var(--text); border-radius: 5px; min-width: 1.9em; height: 1.9em; padding: 0 0.4em; cursor: pointer; font: inherit; line-height: 1; }
.pg-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pg-btn:disabled { opacity: 0.3; cursor: default; }
.pg-of { padding: 0 6px; white-space: nowrap; }
.pg-input { width: 3.4em; font: inherit; padding: 1px 3px; text-align: center; border: 1px solid var(--border); border-radius: 4px; background: transparent; color: var(--text); -moz-appearance: textfield; }
.pg-input::-webkit-inner-spin-button { display: none; }
/* widget tables: headings are plain text on the page colour with a slim line under them, not a grey box */
.item th { background: var(--bg); color: var(--muted); border-bottom: 1px solid var(--card-line); }
tbody tr[style*="background"] td { background: transparent; }

/* ---------- image & web widgets ---------- */
.img-wrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.img-wrap img { max-width: 100%; max-height: 100%; border-radius: 6px; }
.img-wrap.fit-cover img { width: 100%; height: 100%; object-fit: cover; }
.img-wrap video { max-width: 100%; max-height: 100%; border-radius: 6px; pointer-events: none; }
.img-wrap.fit-cover video { width: 100%; height: 100%; object-fit: cover; }
.img-pick video, .bg-vid video { max-height: 56px; max-width: 160px; border-radius: 6px; }
/* dashboard background video + darkening layer (both behind every widget) */
#page-video { position: fixed; inset: 0; width: 100vw; height: 100vh; object-fit: cover; z-index: -2; pointer-events: none; }
body.has-page-dim::before { content: ''; position: fixed; inset: 0; background: rgba(0, 0, 0, var(--page-dim, 0)); z-index: -1; pointer-events: none; }
.web-frame { flex: 1; width: 100%; min-height: 0; border: 0; border-radius: 6px; background: #fff; }
.web-note { font-size: 10.5px; color: var(--muted); padding-top: 2px; }
.img-pick { display: flex; align-items: center; gap: 10px; }
.img-pick img { max-height: 56px; max-width: 160px; border-radius: 6px; }

/* ---------- time pickers ---------- */
.win-chip.locked { border-style: dashed; }
.tb-time.on { border-color: var(--accent); color: var(--accent); }

/* ---------- format panel: colour fields, columns, rules ---------- */
.color-field span { display: flex; align-items: center; gap: 6px; }
.color-field span input { width: auto; margin: 0; }
.col-search { margin-bottom: 4px; }
#cols-editor { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow-y: auto; }
.col-row { display: grid; grid-template-columns: auto 1fr 84px 46px auto; gap: 4px; align-items: center; }
.col-row input:not([type]), .col-row select, .col-row input[type='number'] { padding: 3px 5px; font-size: 12px; }
.col-row input[type='checkbox'] { width: auto; margin: 0; }
.col-move { display: flex; }
.col-move .icon-btn { padding: 0 4px; }
#rules-editor { display: flex; flex-direction: column; gap: 8px; }
.rule-row { border: 1px solid var(--border); border-radius: 8px; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.rule-line { display: grid; grid-template-columns: 1.3fr 0.9fr 1fr auto; gap: 4px; align-items: center; }
.rule-line:nth-child(2) { grid-template-columns: 1fr 1fr 1fr; }
.rule-line select, .rule-line input:not([type]) { padding: 3px 5px; font-size: 12px; }
label.mini { flex-direction: row; align-items: center; gap: 4px; font-weight: 500; color: var(--text); font-size: 12px; }
label.mini input[type='checkbox'] { width: auto; margin: 0; }
label.mini input[type='color'] { width: 30px; height: 24px; padding: 1px; }

/* ---------- sidebar: search + folders ---------- */
.nav-search { margin: 0 0 6px; padding: 4px 8px; font-size: 12.5px; }
.nav-folder-head { display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: none; padding: 6px; border-radius: 6px; cursor: pointer; color: var(--text); font-weight: 600; text-align: left; }
.nav-folder-head:hover { background: var(--surface-2); }
.nav-folder-head .count { margin-left: auto; }
.nav-folder .caret { display: inline-block; transition: transform 0.15s; color: var(--muted); font-size: 10px; }
.nav-folder.open .caret { transform: rotate(90deg); }
.nav-folder-items { display: none; padding-left: 14px; }
.nav-folder.open .nav-folder-items { display: block; }

/* ---------- page background & Play mode ---------- */
body.has-page-bg { background: var(--page-bg); background-attachment: fixed; }
.play-list { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.play-badge { position: fixed; left: 12px; bottom: 12px; z-index: 1000; font-size: 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; opacity: 0.55; }
.play-badge:hover { opacity: 1; }

/* ---------- widget groups ---------- */
.group {
  position: absolute; z-index: 0; border-radius: calc(var(--radius) + 2px);
  background: var(--g-bg, transparent); /* see-through like widgets unless a colour is chosen */
  border: 1px solid var(--g-border, var(--card-line)); box-shadow: none;
}
.group-head {
  display: flex; align-items: center; gap: 0.5em; height: var(--g-head-h, calc(28 / 13 * 1em)); padding: 0 0.5em;
  font-size: var(--g-head-fs, inherit); font-family: var(--g-head-ff, inherit);
  background: var(--g-head-bg, transparent); color: var(--g-head-color, var(--text)); /* transparent unless a header colour is chosen */
  border-radius: calc(var(--radius) + 1px) calc(var(--radius) + 1px) 0 0; cursor: move; font-weight: var(--g-head-fw, 650);
}
.group.collapsed .group-head { border-radius: calc(var(--radius) + 1px); }
.group-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-count { font-size: 0.8em; font-weight: 600; opacity: 0.6; border: 1px solid currentColor; border-radius: 999px; padding: 0 0.5em; }
.group-toggle { border: 0; background: none; color: inherit; cursor: pointer; font-size: 0.9em; padding: 0 0.2em; }
.group .tool-btn { color: inherit; }
.group.collapsed > .rh { display: none; } /* every group can be resized; only a collapsed one cannot */
.group:has(> .rh:hover), .group.resizing { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.group.moving { box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22); border-color: var(--accent); }
.item.in-collapsed { display: none; }
.item.in-tile > .rh { display: none; }
.item.in-tile > .card { cursor: default; }
body.tv .group-head { cursor: default; }
body.tv .group .tool-btn { display: none; }

/* ---------- selecting several widgets ---------- */
.item.selected > .card { outline: 2px solid var(--accent); outline-offset: 2px; }
.marquee { position: absolute; z-index: 50; border: 1.5px dashed var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 4px; pointer-events: none; }
.selection-bar {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 1050;
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--accent); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25); font-size: 13px; white-space: nowrap;
}
@media (max-width: 900px) { .group { display: none; } }

/* ---------- map widget ---------- */
.type-map .card-body { position: relative; padding: calc(4px * var(--s)) calc(8px * var(--s)) calc(6px * var(--s)); }
.map-el { flex: 1; min-height: 60px; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.map-el.leaflet-container { font: inherit; cursor: grab; }
.map-overlay { position: absolute; top: calc(10px * var(--s)); right: calc(14px * var(--s)); z-index: 500; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; pointer-events: none; }
.map-chip {
  pointer-events: auto; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 88%, transparent); color: var(--text); border-radius: 999px;
  font-size: round(max(10px, calc(11px * var(--s))), 1px); padding: 2px 9px; backdrop-filter: blur(4px);
}
.map-chip i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
button.map-chip { cursor: pointer; }
.map-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
/* a new order: an expanding ring that fades out */
.map-pulse span {
  position: absolute; left: -9px; top: -9px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--c); box-shadow: 0 0 0 0 var(--c); animation: map-pulse 1.2s ease-out 2;
}
@keyframes map-pulse {
  0% { transform: scale(0.4); opacity: 1; box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 70%, transparent); }
  70% { transform: scale(1); opacity: 0.85; box-shadow: 0 0 0 16px transparent; }
  100% { transform: scale(1.3); opacity: 0; box-shadow: 0 0 0 0 transparent; }
}
.leaflet-tooltip { font: 12px/1.4 var(--font); }
/* dark mode: invert the OpenStreetMap tiles into a dark map (dots and labels stay their real colours) */
.map-dark .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.85) contrast(0.9) saturate(0.6); }

/* ---------- format panel: never hide widgets ---------- */
.canvas { transition: margin 0.2s ease; }
body.room-left .canvas { margin-left: 334px; }  /* docked on the left: widgets slide right, same size */
/* docked on the right: an invisible spacer past the canvas lets you scroll right to reach widgets under the panel */
body.room-right .canvas::after { content: ""; position: absolute; top: 0; left: 100%; width: 350px; height: 1px; }
.drawer-head { cursor: move; user-select: none; }
.drawer-tools { display: flex; gap: 2px; flex: none; }
.drawer.floating {
  right: auto; bottom: auto; height: min(78vh, 760px); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3); overflow: hidden;
  resize: both; min-width: 280px; min-height: 220px; max-width: 92vw; max-height: 92vh; /* drag the bottom-right corner to resize */
}
.drawer.floating::after { content: ''; position: absolute; right: 3px; bottom: 3px; width: 12px; height: 12px; pointer-events: none; opacity: 0.55;
  background: linear-gradient(135deg, transparent 0 45%, var(--muted) 45% 55%, transparent 55% 70%, var(--muted) 70% 80%, transparent 80%); }
.drawer.min { height: auto !important; bottom: auto; }
.drawer.min .drawer-body, .drawer.min .drawer-foot, .drawer.min .drawer-head p { display: none; }
.drawer.min:not(.floating) { top: calc(var(--topbar) + 8px); border-radius: 0 0 0 10px; }
.drawer.min.left:not(.floating) { border-radius: 0 0 10px 0; }

/* ---------- filter widget: checklist (table with tick boxes) ---------- */
.item .type-filter .card-body:has(.slicer-list) { justify-content: flex-start; }
.slicer-list { display: flex; flex-direction: column; gap: calc(4px * var(--s)); min-height: 0; flex: 1; }
.sl-search { padding: calc(4px * var(--s)) 8px; font-size: round(var(--fs-label, calc(12px * var(--s))), 1px); }
.sl-rows { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 8px; }
.sl-row {
  position: relative; display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; cursor: pointer;
  border: 0; border-bottom: 1px solid var(--grid); background: none; color: var(--text);
  padding: calc(5px * var(--s)) calc(10px * var(--s)); font-size: round(var(--fs-label, calc(12.5px * var(--s))), 1px);
}
.sl-row:last-child { border-bottom: 0; }
.sl-row:hover { background: var(--surface-2); }
.sl-row.on { background: color-mix(in srgb, var(--accent) 12%, transparent); font-weight: 600; }
.sl-row.all { font-style: italic; color: var(--muted); }
.sl-row.all.on { color: var(--text); background: none; }
.sl-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; position: relative; z-index: 1; }
.sl-row .n { color: var(--muted); font-variant-numeric: tabular-nums; position: relative; z-index: 1; }
.sl-bar { position: absolute; left: 0; bottom: 0; height: 2px; background: color-mix(in srgb, var(--accent) 55%, transparent); border-radius: 2px; }
.sl-box { width: 1.05em; height: 1.05em; flex: none; border: 1.5px solid var(--muted); border-radius: 3px; position: relative; z-index: 1; }
.sl-box.radio { border-radius: 50%; }
.sl-box.on { background: var(--accent); border-color: var(--accent); }
.sl-box.on::after { content: ''; position: absolute; left: 30%; top: 8%; width: 30%; height: 58%; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.sl-box.radio.on::after { left: 25%; top: 25%; width: 50%; height: 50%; border: 0; border-radius: 50%; background: #fff; transform: none; }
.sl-foot { font-size: round(var(--fs-label, calc(11px * var(--s))), 1px); color: var(--muted); display: flex; align-items: center; gap: 4px; }

/* ---------- dashboard variables & drill-through chips (top bar) ---------- */
.tb-var { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); }
.tb-var select { font-size: 12px; padding: 3px 6px; max-width: 170px; }
.tb-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; padding: 3px 4px 3px 8px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--text); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.tb-chip button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 11px; padding: 0 3px; }
.tb-chip button:hover { color: var(--text); }
.var-row { display: grid; grid-template-columns: 1fr 1.2fr 1fr auto; gap: 6px; align-items: center; margin-bottom: 6px; }
/* ---------- widget type picker (＋ Widget) ---------- */
.type-pick > label { display: block; margin-bottom: 4px; }
.type-groups { display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow: auto; padding-right: 2px; }
.type-group h5 { margin: 2px 0 3px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 5px; }
.type-tile { border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 7px 4px 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; font: inherit; font-size: 11.5px; color: var(--text); line-height: 1.15; text-align: center; }
.type-tile .ico { font-size: 20px; line-height: 1; }
.type-tile:hover { border-color: var(--accent); }
.type-tile.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); font-weight: 600; }
#modal .modal-form:has(.type-groups) { max-height: calc(92vh - 40px); overflow: auto; }

/* the member count only matters while a group is collapsed */
.group:not(.collapsed) .group-count { display: none; }

/* Format panel: roomier, with collapsible groups */
.drawer { width: 340px; }
.drawer.floating { width: 470px; }
.drawer-body h4[data-act="format-fold"] { cursor: pointer; display: flex; align-items: center; justify-content: space-between; padding: 2px 0; user-select: none; }
.drawer-body h4[data-act="format-fold"]::after { content: "▾"; font-size: 13px; color: var(--muted); transition: transform 0.15s; }
.drawer-body section.folded > h4::after { transform: rotate(-90deg); }
.drawer-body section.folded > :not(h4) { display: none !important; }
.drawer-body section.folded { padding: 8px 0; }
.drawer-body h4[data-act="format-fold"]:hover { color: var(--text); }
.drawer-body label:not(.check):not(.mini):not(.color-field) > select { text-overflow: ellipsis; }

body.brushing, body.brushing .item { cursor: crosshair; }
body.brushing .item:hover .card { outline: 2px dashed var(--accent); outline-offset: -2px; }

/* ---------- dashboard looks (⋯ → Look) ---------- */
:root[data-look='control'] { --bg: #000; --surface: #0b0b0b; --surface-2: #151515; --text: #fff; --muted: #c2c8d4; --border: #3a3f4b; --grid: #1f2330; --accent: #00b4ff; --accent-soft: #00324a; --ok: #19d17b; --warn: #ffb020; --err: #ff4d5e; --shadow: none; --radius: 0px; color-scheme: dark; }
:root[data-look='control'] .card-head h3 { font-weight: 800; letter-spacing: 0.01em; }
:root[data-look='control'] .kpi-value { font-weight: 800; }
:root[data-look='control'] .card { border-color: var(--border); }

:root[data-look='paper'] { --bg: #eef1f5; --surface: #fff; --surface-2: #f4f6f9; --text: #111827; --muted: #5b6475; --border: #d9dee7; --grid: #e8ecf2; --accent: #2563eb; --accent-soft: #e5edff; --ok: #0f9d7a; --warn: #d97706; --err: #d92d4b; --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 6px 18px rgba(16, 24, 40, 0.05); --radius: 12px; color-scheme: light; }
:root[data-look='paper'] .card { border-color: transparent; }

:root[data-look='glass'] { --bg: #1a1740; --surface: rgba(255, 255, 255, 0.07); --surface-2: rgba(255, 255, 255, 0.1); --text: #f3f1ff; --muted: #c4bfe8; --border: rgba(255, 255, 255, 0.16); --grid: rgba(255, 255, 255, 0.1); --accent: #a78bfa; --accent-soft: rgba(167, 139, 250, 0.2); --ok: #5eead4; --warn: #fcd34d; --err: #fb7185; --shadow: 0 8px 30px rgba(8, 4, 40, 0.35); --radius: 16px; color-scheme: dark; }
:root[data-look='glass'] body { background: radial-gradient(1200px 700px at 12% -10%, #4338ca 0%, transparent 60%), radial-gradient(900px 600px at 100% 0%, #be185d 0%, transparent 55%), #14123a; background-attachment: fixed; }
:root[data-look='glass'] .card { backdrop-filter: blur(14px); }
:root[data-look='glass'] .topbar, :root[data-look='glass'] .sidebar { background: rgba(20, 18, 58, 0.7); backdrop-filter: blur(14px); }

:root[data-look='terminal'] { --bg: #05070a; --surface: #0b1117; --surface-2: #101922; --text: #d7ffe8; --muted: #6fae8f; --border: #16342a; --grid: #10231c; --accent: #39ff88; --accent-soft: #0e2f1f; --ok: #39ff88; --warn: #ffd23f; --err: #ff5470; --shadow: none; --radius: 3px; --font: ui-monospace, 'Cascadia Mono', Consolas, monospace; color-scheme: dark; }
:root[data-look='terminal'] .kpi-value { text-shadow: 0 0 12px color-mix(in srgb, var(--accent) 45%, transparent); }

:root[data-look='ocean'] { --bg: #0b1e33; --surface: #123152; --surface-2: #19406a; --text: #eaf6ff; --muted: #a5c4de; --border: #24507d; --grid: #1a3f66; --accent: #38bdf8; --accent-soft: #0f3a5c; --ok: #34d399; --warn: #fbbf24; --err: #fb7185; --shadow: none; --radius: 12px; color-scheme: dark; }

.look-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.look-card { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; padding: 8px; text-align: left; background: var(--surface-2); border: 2px solid var(--border); border-radius: 10px; cursor: pointer; color: var(--text); }
.look-card:hover { border-color: var(--muted); }
.look-card.on { border-color: var(--accent); }
.look-prev { width: 100%; height: 74px; border-radius: 6px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.look-tile { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px; font-size: 13px; }
.look-tile i { display: block; width: 28%; height: 5px; border-radius: 3px; }
.look-tile.small { padding: 5px 8px; }

/* ⋯ → Hide lines: no borders around widgets or groups, no table rules */
body.no-lines .card, body.no-lines .group { border-color: transparent !important; box-shadow: none; }
body.no-lines .group-head { border-bottom-color: transparent; }
body.no-lines th, body.no-lines td, body.no-lines .tbl-count, body.no-lines .pivot tfoot td { border-color: transparent !important; }
body.no-lines .slicer-chip, body.no-lines .win-chip { border-color: transparent; }


/* ---------- calm, warm interface ---------- */
.sidebar { background: var(--sidebar); border-right: 1px solid var(--border); }
.topbar { background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.brand { font-family: var(--serif); font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.tb-titles .tb-name, .tb-titles.solo .tb-name { font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; }
.modal-form h2, .drawer-head h2 { font-family: var(--serif); font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.nav-title { letter-spacing: 0.02em; text-transform: none; font-size: 12px; font-weight: 500; padding-top: 4px; }
nav a { padding: 7px 8px; border-radius: 9px; }
nav a:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }
nav a.active { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); font-weight: 600; }
.nav-add { border-radius: 9px; }
.nav-add:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }
.nav-search, .sidebar input[type='search'] { border-radius: 10px; background: var(--surface); }
.btn { border-radius: 9px; padding: 5px 12px; }
.btn.sm { border-radius: 8px; }
.btn.primary { box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05); }
.btn.primary:hover { filter: none; background: color-mix(in srgb, var(--accent) 88%, #000); border-color: color-mix(in srgb, var(--accent) 88%, #000); }
.icon-btn, .modal-x { border-radius: 8px; }
input, select, textarea { border-radius: 9px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.modal, .drawer { border-radius: 16px; }
.drawer.floating { box-shadow: 0 8px 30px rgba(31, 30, 29, 0.12); }
.nav-backdrop { background: rgba(31, 30, 29, 0.25); }

/* ---------- navigation & top bar (redesign guide, phase 1) ---------- */
.nav-title { display: flex; align-items: center; gap: 5px; width: 100%; border: 0; background: none; cursor: pointer; text-align: left; }
.nav-title .caret { font-size: 9px; transition: transform 0.15s; display: inline-block; width: 10px; }
.nav-section.closed > .nav-title .caret { transform: rotate(-90deg); }
.nav-section.closed > :not(.nav-title) { display: none; }
.nav-sub { margin-bottom: 6px; }
.nav-sub-title { font-size: 11px; color: var(--muted); padding: 6px 8px 2px; }
.nav-badge { font-style: normal; font-size: 10px; font-weight: 600; letter-spacing: 0.02em; color: var(--muted); background: color-mix(in srgb, var(--text) 7%, transparent); border-radius: 999px; padding: 1px 7px; flex: none; }
nav a .nav-badge { margin-left: auto; }
.health { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--border); }
.health.ok { background: var(--ok); }
.health.warn { background: var(--warn); }
.health.err { background: var(--err); }
nav a .health { margin-left: auto; }
nav a .health + .count { margin-left: 4px; }
.tb-crumb { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; flex: none; }
.tb-crumb button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 1px 3px; border-radius: 6px; font: inherit; }
.tb-crumb button:hover { color: var(--text); background: color-mix(in srgb, var(--text) 6%, transparent); }
.tb-crumb .sl { opacity: 0.6; }
.tb-pin { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 15px; line-height: 1; padding: 1px 3px; border-radius: 6px; }
.tb-pin:hover { color: var(--text); }
.tb-pin.on { color: var(--accent); }
.tb-sep { width: 1px; height: 18px; background: var(--border); margin: 0 3px; flex: none; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.btn.soft { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 600; }
.btn.soft:hover { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
@media (max-width: 700px) { .tb-crumb, .tb-sep { display: none; } }

/* dashboard settings panel */
.settings-form { max-width: 860px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.settings-grid fieldset { gap: 9px; }
.settings-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 500; }
.settings-grid label.check { flex-direction: row; }
.settings-grid .help { font-weight: 400; font-size: 11.5px; }
@media (max-width: 760px) { .settings-grid { grid-template-columns: 1fr; } }

/* ---------- accounts: read-only viewers, view-only links, sign-in ---------- */
body.readonly #tb-actions [data-act='add-widget'], body.readonly #tb-actions [data-act='dash-settings'], body.readonly #tb-actions [data-act='dash-menu'],
body.readonly #tb-actions [data-act='dash-share'], body.readonly #tb-actions .tb-save, body.readonly #tb-actions [data-act='dash-time-menu'],
body.readonly #tb-actions [data-act='dash-refresh-menu'], body.readonly #tb-actions .tb-sep, body.readonly .card-head [data-act='w-menu'],
body.readonly .rh { display: none !important; }
body.readonly .tb-name, body.readonly .tb-desc, body.readonly .tb-icon { pointer-events: none; }
body.readonly .item .card-head { cursor: default; }
.ro-badge { display: none; }
body.readonly .ro-badge { display: inline-block; }
body.link-mode .burger, body.link-mode .tb-crumb, body.link-mode .tb-pin, body.link-mode .avatar-btn { display: none; }
body.no-build .nav-section[data-section='data'], body.link-mode .nav-add { display: none; }
body.signed-out .topbar, body.signed-out .sidebar, body.signed-out .nav-backdrop { display: none; }
body.signed-out main { padding: 0; }
.signin { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.signin form { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 28px 26px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
.signin h1 { font-family: var(--serif); font-weight: 600; font-size: 26px; margin: 0; display: flex; align-items: center; gap: 10px; }
.signin h1 svg { width: 30px; height: 30px; }
.signin label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; font-size: 12.5px; }
.signin .btn.primary { padding: 9px; font-size: 14px; }
.signin .err { color: var(--err); font-size: 12.5px; min-height: 1em; }
.people-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.people-table td, .people-table th { padding: 5px 6px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.people-table th { font-weight: 600; color: var(--muted); font-size: 11.5px; }
.people-table select { width: auto; padding: 3px 6px; }
.people-table .muted { font-size: 11.5px; }
.pill { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--muted); }
.pill.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.pill.off { background: color-mix(in srgb, var(--err) 12%, transparent); color: var(--err); }
.secret-box { background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; }
.secret-box code { font-size: 13px; user-select: all; }
.audit-list { max-height: 260px; overflow: auto; font-size: 12px; border: 1px solid var(--border); border-radius: 10px; }
.audit-list div { padding: 5px 9px; border-bottom: 1px solid var(--border); display: flex; gap: 8px; }
.audit-list div:last-child { border-bottom: 0; }
.audit-list time { color: var(--muted); flex: none; width: 118px; }
.signin .err:empty { display: none; }
.acc-vis { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.acc-vis select { width: auto; }

/* ---------- top band: one compact toolbar of shortcut icons ---------- */
:root { --topbar: 48px; }
.topbar { border-bottom: 1px solid var(--border); }
.tb-tools { display: flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.tb-tools .tb-sep { height: 20px; margin: 0 4px; }
.tool { width: 32px; height: 30px; display: inline-grid; place-items: center; border: 0; border-radius: 9px; background: none; color: var(--muted); cursor: pointer; padding: 0; }
.tool:hover { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); }
.tool:focus-visible, .chip-tool:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; }
.tool.accent { background: var(--accent); color: #fff; }
.tool.accent:hover { background: color-mix(in srgb, var(--accent) 86%, #000); color: #fff; }
.tool.tb-save.saved { color: var(--ok); }
.tool.tb-save.pending { color: var(--accent); }
.tool.tb-save.saving svg { animation: spin 0.9s linear infinite; }
.tool.tb-save.error { color: var(--err); }
@keyframes spin { to { transform: rotate(360deg); } }
.chip-tool { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 9px; border: 0; border-radius: 9px; background: none; color: var(--muted); cursor: pointer; font: inherit; font-size: 12px; white-space: nowrap; }
.chip-tool:hover { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); }
.chip-tool.on { color: var(--accent); background: var(--accent-soft); }
@media (max-width: 1100px) { .chip-tool span { display: none; } .chip-tool { padding: 0 7px; } }
.kbd-list { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; align-items: center; font-size: 13px; }
kbd { font: 600 12px/1 ui-monospace, Menlo, monospace; padding: 4px 7px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; background: var(--surface-2); color: var(--text); min-width: 26px; text-align: center; display: inline-block; }

/* folders in the menu: owners get a ⋯; drop dashboards onto a folder to move them */
.nav-folder-row { display: flex; align-items: center; gap: 2px; }
.nav-folder-row .nav-folder-head { flex: 1; min-width: 0; }
.nav-folder-head .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.nav-folder-more { border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 7px; padding: 2px 6px; opacity: 0; }
.nav-folder-row:hover .nav-folder-more, .nav-folder-more:focus-visible { opacity: 1; }
.nav-folder-more:hover { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); }
.nav-shared { font-size: 10.5px; color: var(--muted); flex: none; }
.nav-empty { margin: 2px 8px 6px; font-size: 11.5px; color: var(--muted); }
#nav-dashboards a[draggable='true'] { cursor: grab; }
#nav-dashboards.dragging .nav-unfiled { min-height: 30px; border: 1px dashed var(--border); border-radius: 9px; }
.drop-on { outline: 2px dashed color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; border-radius: 9px; background: var(--accent-soft); }
.fs-pick { max-height: 180px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; padding: 6px 9px; display: flex; flex-direction: column; gap: 4px; }

/* dashboard settings: essentials first, the rest folded */
.settings-form { max-width: 520px; }
.settings-main, .settings-more { display: flex; flex-direction: column; gap: 10px; }
.settings-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 500; }
.settings-form label.check { flex-direction: row; align-items: center; }
.settings-form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
/* dashboard settings: tabs sit flush with the form edges */
.settings-tabs { margin: -4px -16px 0; padding: 0 16px; }
[data-spane][hidden] { display: none !important; }
.settings-form textarea { font: 13px/1.45 var(--font); }

/* widget time window: a small half-circle timer instead of "All" / "8h" text */
.win-chip.timer-chip { padding: 2px 5px; border: 0; background: none; line-height: 0; border-radius: 7px; }
.win-chip.timer-chip:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.timer { display: block; }
.timer-track { fill: none; stroke: color-mix(in srgb, var(--muted) 35%, transparent); stroke-width: 2.4; stroke-linecap: round; }
.timer-fill { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; }
.timer-fill.dotted { stroke-dasharray: 1.5 2.6; }
.timer-dot { fill: var(--muted); }
.win-chip.timer-chip.locked { border: 0; }
.win-chip.timer-chip.locked .timer-fill { stroke: var(--muted); }

/* top-right: avatar + name opens your user settings */
.avatar-btn { display: inline-flex; align-items: center; gap: 8px; padding: 3px 10px 3px 3px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); max-width: 220px; }
.avatar-btn:hover { background: color-mix(in srgb, var(--text) 6%, var(--surface)); }
.avatar-btn:hover .av { box-shadow: none; }
.av-name { font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.av-caret { font-size: 9px; color: var(--muted); }
@media (max-width: 900px) { .av-name, .av-caret { display: none; } .avatar-btn { padding: 0; border: 0; background: none; } }

/* formula examples: real columns, click to insert */
.fx-examples { flex-direction: column; align-items: stretch; }
.chip.fx { display: flex; justify-content: space-between; gap: 10px; text-align: left; }
.chip.fx code { background: none; padding: 0; white-space: normal; word-break: break-word; }
.chip.fx i { flex: none; }

/* widget editor: foldable Visualization list, ⓘ guide on each tile */
.type-pick > summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.type-pick > summary::-webkit-details-marker { display: none; }
.type-pick .tp-label { font-weight: 600; font-size: 12.5px; }
.type-pick .tp-current { flex: 1; font-size: 13px; }
.type-pick .tp-change { font-size: 12px; color: var(--accent); }
.type-pick .tp-change::after { content: ' ▾'; }
.type-pick[open] .tp-change::after { content: ' ▴'; }
.type-pick[open] > summary { margin-bottom: 6px; }
.type-tile { position: relative; }
.ti-info { position: absolute; top: 3px; right: 3px; width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  font: italic 600 10px/13px Georgia, serif; text-align: center; cursor: help; opacity: 0.75; }
.type-tile:hover .ti-info, .ti-info:focus-visible { opacity: 1; color: var(--accent); border-color: var(--accent); }
.viz-pop { position: fixed; z-index: 50; width: 300px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; box-shadow: 0 12px 34px rgba(0,0,0,.35);
  display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; }
.viz-pop[hidden] { display: none; }
.vp-head { display: flex; justify-content: space-between; align-items: center; }
.vp-pic { background: var(--surface-2); border-radius: 10px; display: grid; place-items: center; padding: 6px; }
.vp-pic svg { max-width: 100%; height: auto; }
.vp-row { display: grid; grid-template-columns: 60px 1fr; gap: 6px; }
.vp-row span { color: var(--muted); font-size: 11.5px; padding-top: 1px; }
.vp-row p { margin: 0; line-height: 1.4; }
.vp-use { align-self: flex-start; }

.vp-sql { margin: 0; font: 11px/1.45 ui-monospace, Menlo, monospace; background: var(--surface-2); border-radius: 8px; padding: 7px 8px; white-space: pre-wrap; max-height: 150px; overflow: auto; }
.vp-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.viz-pop { width: 340px; max-height: calc(100vh - 16px); overflow: auto; }
/* typing help under the SQL / formula boxes */
.assist { position: absolute; left: 0; right: 0; top: 100%; z-index: 60; max-height: 220px; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 28px rgba(0,0,0,.35); margin-top: 2px; }
.as-item { display: flex; justify-content: space-between; gap: 10px; padding: 5px 10px; cursor: pointer; font: 12.5px/1.3 ui-monospace, Menlo, monospace; }
.as-item i { font: 11px system-ui, sans-serif; color: var(--muted); font-style: normal; white-space: nowrap; }
.as-item.on, .as-item:hover { background: var(--accent-soft); }
.assist-warn { font-size: 12px; color: var(--warn); display: flex; flex-direction: column; gap: 3px; margin: -2px 0 4px; }
.assist-warn .link-btn { font: inherit; color: var(--accent); text-decoration: underline; }

/* ---------- widget header tools: hidden until the pointer is over the widget ---------- */
.card-tools { opacity: 0; transition: opacity 0.15s; gap: 1px; }
.card:hover .card-tools, .card:focus-within .card-tools, .card.drilled .card-tools { opacity: 1; }
@media (hover: none) { .card-tools { opacity: 1; } }
.tool-btn { opacity: 1; }
.tool-btn.ti { padding: 3px 4px; line-height: 0; border-radius: 6px; }
.tool-btn.ti svg, .timer { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tool-btn.ti.on { color: var(--accent); background: var(--accent-soft); }
.win-chip.timer-chip { color: var(--muted); padding: 3px 4px; }
.win-chip.timer-chip:hover { color: var(--text); }
.win-chip.timer-chip.locked { color: var(--accent); }
body.readonly .card-tools .edit-only { display: none !important; }
body.tv .card-tools { display: none; }
/* a chart shown as a table */
.as-table { overflow: auto; height: 100%; font-size: calc(12px * var(--s, 1)); }
.as-table table { width: 100%; border-collapse: collapse; }
.as-table th { position: sticky; top: 0; background: var(--surface); text-align: left; font-weight: 600; color: var(--muted); padding: 4px 8px; border-bottom: 1px solid var(--border); }
.as-table td { padding: 3px 8px; border-bottom: 1px solid var(--grid); }
.as-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* SQL console in the widget editor */
.sql-console { min-height: 200px; font-size: 12.5px; line-height: 1.5; }
.sql-tables { border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px; }
.sql-tables > summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.sql-table { display: flex; gap: 8px; align-items: baseline; padding: 5px 0; border-top: 1px solid var(--grid); }
.sql-table:first-of-type { border-top: 0; margin-top: 6px; }
.sql-table > .chip { flex: none; }
.sql-fields { display: flex; flex-wrap: wrap; gap: 3px; }
.field-chip { border: 0; background: var(--surface-2); color: var(--muted); border-radius: 6px; padding: 1px 6px; font: 11.5px ui-monospace, Menlo, monospace; cursor: pointer; }
.field-chip:hover { color: var(--text); background: var(--accent-soft); }

/* paint brush loaded: its icon stays lit and visible */
.card-tools:has(.tool-btn.on[data-act='w-copy-format']) { opacity: 1; }

/* widget editor filters: one line each */
.filters-box { display: flex; flex-direction: column; gap: 6px; }
.filters-head { font-size: 12.5px; }
.filter-row { display: grid; grid-template-columns: 1.3fr 0.9fr 1.3fr auto; gap: 6px; align-items: center; }

/* header tools float over the widget's top-right corner on hover — never squeezed on small widgets */
.card-tools {
  position: absolute; top: calc(4px * var(--s)); right: calc(5px * var(--s)); z-index: 6;
  display: flex; align-items: center; flex-wrap: nowrap; white-space: nowrap; gap: 1px;
  padding: 2px 3px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28); pointer-events: none;
}
.card:hover .card-tools, .card:focus-within .card-tools, .card.drilled .card-tools,
.card-tools:has(.tool-btn.on[data-act='w-copy-format']) { opacity: 1; pointer-events: auto; }
@media (hover: none) { .card-tools { pointer-events: auto; } }
/* the hovered widget comes above its neighbours and stops clipping, so a toolbar wider than the widget still shows */
/* above other widgets (they stay well under 850) but below the top bar (900), side menu (940), panels (1000) and menus (1100) */
.item:hover, .item:focus-within { z-index: 850 !important; }
.item:hover > .card, .item:focus-within > .card { overflow: visible; }

/* widget editor: measured by · format · decimals · prefix · suffix in one compact row */
.compact-row { display: grid; grid-template-columns: 1.4fr 1.1fr 0.8fr 0.7fr 0.8fr; gap: 8px; align-items: end; }
.compact-row label { font-size: 12px; min-width: 0; }
.compact-row select, .compact-row input { padding: 5px 7px; font-size: 12.5px; }
.compact-row label[hidden] { display: none; }
@media (max-width: 760px) { .compact-row { grid-template-columns: 1fr 1fr; } }
.form-grid > div.full.compact-row { display: grid; flex-direction: initial; }

/* side menu: a normal arrow over dashboards and links (no hand) — dragging into folders still works */
#sidebar nav a, #sidebar nav a[draggable='true'], #nav-dashboards a { cursor: default; }
#nav-dashboards a:active { cursor: default; }

/* top band: no "Live" label while all is well — only a warning when the connection drops; the updated time stays */
.tb-live .live-dot, .tb-live .live-label { display: none; }
body.offline .tb-live .live-dot, body.offline .tb-live .live-label { display: inline-block; }
body.offline .tb-live .live-label { color: var(--err); font-weight: 600; }
/* the "add an icon" ＋ before a dashboard name only shows when you point at the title */
.tb-icon .d-icon.add { opacity: 0; transition: opacity 0.15s; }
#tb-title:hover .tb-icon .d-icon.add, .tb-icon:focus-visible .d-icon.add { opacity: 0.6; }

/* sliders (transparency, darken…): no box padding or frame, so the track runs edge to edge */
input[type='range'] { padding: 0; border: 0; background: none; box-shadow: none; margin: 6px 0; height: 18px; accent-color: var(--accent); cursor: pointer; }
input[type='range']:focus { outline: none; }
input[type='range']:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 2px; }

/* Format → Columns: a grip to drag rows */
.col-row { grid-template-columns: auto auto 1fr 84px 46px auto; }
.col-grip { cursor: grab; color: var(--muted); font-size: 12px; letter-spacing: -2px; padding: 0 3px; user-select: none; }
.col-grip:active { cursor: grabbing; }
.col-row.dragging { opacity: 0.45; }
/* Format → Live counter: one line per counter, conditions under it */
#counters-editor { display: flex; flex-direction: column; gap: 8px; }
.ctr { border: 1px solid var(--border); border-radius: 10px; padding: 7px 8px; display: flex; flex-direction: column; gap: 5px; }
.ctr-line { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 6px; align-items: center; }
.ctr-case { display: grid; grid-template-columns: auto 1fr auto 1fr auto 1fr auto; gap: 4px; align-items: center; }
.ctr-line input, .ctr-line select, .ctr-case input, .ctr-case select { padding: 3px 5px; font-size: 12px; min-width: 0; }
.ctr .link-btn.sm { align-self: flex-start; font-size: 12px; }

/* widget editor: live preview */
.w-preview { border: 1px dashed var(--border); border-radius: 12px; padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 6px; }
.wp-stage { height: 260px; display: flex; align-items: stretch; justify-content: stretch; }
.wp-stage > .muted { margin: auto; }
.wp-stage > article { flex: 1; min-width: 0; }
.wp-stage .card-tools { display: none; }

/* ---------- widgets: see-through by default, slim white outline ---------- */
:root { --card-bg: transparent; --card-line: rgba(31, 30, 29, 0.22); --radius: 14px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) { --card-line: rgba(255, 255, 255, 0.78); } }
:root[data-theme='dark'] { --card-line: rgba(255, 255, 255, 0.78); }
.card { background: var(--card-bg); border: 1px solid var(--card-line); box-shadow: none; }
/* (a widget's own Format → Background / Border still wins — those are set on the widget itself) */
.corner-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; }
.corner-num { display: flex !important; flex-direction: row !important; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.corner-num input { width: 62px !important; padding: 4px 6px; }

/* scrollbars inside widgets: a thin lane of their own (Mac's floating scrollbars used to cover the last column) */
.item ::-webkit-scrollbar { width: 7px; height: 7px; }
.item ::-webkit-scrollbar-track { background: transparent; }
.item ::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 45%, transparent); border-radius: 4px; }
.item ::-webkit-scrollbar-thumb:hover { background: var(--muted); }
.item ::-webkit-scrollbar-corner { background: transparent; }

/* Connections list: sync / edit / delete on each row */
.row-acts { white-space: nowrap; text-align: right; width: 1%; max-width: none !important; overflow: visible !important; }
.row-acts .icon-btn { margin-left: 2px; width: 28px; height: 28px; display: inline-grid; place-items: center; padding: 0; color: var(--muted); border-radius: 6px; }
.row-acts .icon-btn:hover { color: var(--text); background: var(--surface-2, rgba(255,255,255,.06)); }
.row-acts .icon-btn.danger:hover { color: var(--err); }
.icon-btn.spinning { animation: spin 0.9s linear infinite; }

/* Add / Edit widget: the preview stays inside its box, and Cancel / Add widget stay pinned at the bottom, always on top */
.wp-stage { overflow: hidden; position: relative; isolation: isolate; contain: paint; }
#wform > .modal-actions { position: sticky; bottom: calc(-1 * var(--modal-pad, 16px)); z-index: 20; background: var(--surface); margin: 6px calc(-1 * var(--modal-pad, 16px)) calc(-1 * var(--modal-pad, 16px)); padding: 10px var(--modal-pad, 16px); border-top: 1px solid var(--border); }

/* Dashboard background → Library: folder chips, thumbnails, and the selected one's name / folder */
.bg-lib { display: flex; flex-direction: column; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.bg-lib-head { font-size: 13px; }
.bg-folders { display: flex; flex-wrap: wrap; gap: 4px; }
.bg-chip { border: 1px solid var(--border); background: transparent; color: var(--muted); border-radius: 999px; padding: 2px 9px; font: inherit; font-size: 12px; cursor: pointer; }
.bg-chip .n { opacity: 0.6; font-size: 0.9em; margin-left: 2px; }
.bg-chip:hover { color: var(--text); }
.bg-chip.on { color: var(--text); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.bg-chip.drop { border-style: dashed; border-color: var(--accent); color: var(--accent); }
.bg-chip.add { border-style: dashed; }
.bg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; max-height: 178px; overflow-y: auto; padding: 2px; }
.bg-tile { position: relative; border: 1px solid var(--border); border-radius: 8px; padding: 0; background: var(--surface-2, #1a1a1a); cursor: pointer; overflow: hidden; aspect-ratio: 16 / 10; }
.bg-tile img, .bg-tile video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.bg-tile:hover { border-color: var(--muted); }
.bg-tile.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.bg-tile-name { position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 6px; font-size: 10.5px; color: #fff; text-align: left; background: linear-gradient(transparent, rgba(0, 0, 0, 0.75)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bg-kind { position: absolute; top: 4px; right: 5px; font-size: 10px; color: #fff; background: rgba(0, 0, 0, 0.55); border-radius: 4px; padding: 0 4px; }
.bg-edit { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; align-items: center; }
.bg-edit input, .bg-edit select { font-size: 12px; padding: 4px 6px; min-width: 0; }

/* ---------- sign-in page: background pictures/videos, show-password, request access ---------- */
.signin { position: relative; overflow: hidden; }
.signin-bg { position: absolute; inset: 0; z-index: 0; background: var(--bg); }
.signin-bg .signin-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 1s ease; }
.signin-bg .signin-media.on { opacity: 1; }
.signin.has-bg .signin-bg::after { content: ''; position: absolute; inset: 0; background: #000; opacity: var(--signin-dim, 0.35); z-index: 1; }
.signin-card { position: relative; z-index: 2; width: min(380px, 100%); }
.signin-card form, .signin-card .signin-done { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 28px 26px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
.signin.has-bg .signin-card form, .signin.has-bg .signin-card .signin-done { box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px); }
.signin-card h1 { font-family: var(--serif); font-weight: 600; font-size: 26px; margin: 0; display: flex; align-items: center; gap: 10px; }
.signin-card h1 > svg { width: 30px; height: 30px; flex: none; }
.signin-logo { width: 34px; height: 34px; border-radius: 8px; object-fit: contain; flex: none; }
.signin-logo.emoji { font-size: 28px; line-height: 34px; text-align: center; }
.signin-tag { margin: -6px 0 0; color: var(--muted); font-size: 13px; }
.signin-h2 { margin: 2px 0 0; font-size: 16px; }
.signin-card label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; font-size: 12.5px; }
.signin-card label .muted.small { font-weight: 400; }
.signin-card textarea { font-family: inherit; font-size: 13px; min-height: 44px; }
.signin-card .btn.primary { padding: 9px; font-size: 14px; }
.signin-card .err { color: var(--err); font-size: 12.5px; }
.signin-card .err:not(:empty) { background: var(--err-soft); border-radius: 8px; padding: 8px 10px; }
.signin-alt { margin: 0; color: var(--muted); }
.signin-alt .link-btn { font-size: 12.5px; font-weight: 600; }
.signin-done p { margin: 0; line-height: 1.5; }
.caps { font-size: 12px; color: var(--warn); font-weight: 600; }
.pw-wrap { position: relative; display: flex; }
.pw-wrap input { padding-right: 36px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: none; cursor: pointer; padding: 4px; color: var(--muted); display: flex; border-radius: 5px; }
.pw-eye:hover { color: var(--text); }
.pw-eye svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.signin-preview-note { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 3; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 5px 14px; font-size: 12px; }

/* ---------- the bell ---------- */
.bell-btn { position: relative; border: 0; background: none; cursor: pointer; color: var(--muted); padding: 5px; border-radius: 8px; display: flex; flex: none; }
.bell-btn:hover { color: var(--text); background: var(--surface-2); }
.bell-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.bell-n { position: absolute; top: 0; right: -1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; }
body.tv .bell-btn, body.link-mode .bell-btn, body.signed-out .bell-btn { display: none; }

/* ---------- shared bits ---------- */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; flex: none; }
.seg button { border: 0; background: none; padding: 5px 11px; font-size: 12.5px; cursor: pointer; color: var(--muted); font-weight: 500; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.badge.new { color: var(--accent); background: var(--accent-soft); }
.badge.open { color: #3b6cf6; background: color-mix(in srgb, #3b6cf6 14%, transparent); }
.badge.waiting { color: var(--warn); background: color-mix(in srgb, var(--warn) 15%, transparent); }
.badge.muted { color: var(--muted); background: var(--surface-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted); }
.dot.new { background: var(--accent); } .dot.open { background: #3b6cf6; } .dot.waiting { background: var(--warn); } .dot.ok { background: var(--ok); }
.grow { flex: 1; }
.center { text-align: center; }
.small-empty { padding: 40px 16px; }
.small-empty h2 { margin: 0 0 6px; font-size: 17px; color: var(--text); }
.small-empty .btn { margin: 10px 0; }

/* ---------- tickets: list left, ticket right, fits one screen ---------- */
.tk-page { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: 12px; height: calc(100vh - 76px); min-height: 420px; }
.tk-left, .tk-right { padding: 12px; gap: 10px; min-height: 0; overflow: hidden; }
.tk-chips { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.tk-chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 2px 9px; font-size: 11.5px; cursor: pointer; color: var(--text); }
.tk-chip b { font-weight: 650; }
.tk-chip.on { border-color: var(--accent); background: var(--accent-soft); }
.tk-filters { display: flex; gap: 6px; }
.tk-filters select { width: auto; max-width: 45%; }
.tk-list { overflow: auto; display: flex; flex-direction: column; gap: 2px; margin: 0 -6px; padding: 0 6px; flex: 1; }
.tk-row { display: block; text-decoration: none; color: var(--text); padding: 7px 9px; border-radius: 8px; border: 1px solid transparent; }
.tk-row:hover { background: var(--surface-2); }
.tk-row.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.tk-row-top { display: flex; gap: 6px; align-items: baseline; }
.tk-id { color: var(--muted); font-size: 11.5px; flex: none; }
.tk-subj { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.tk-row.unread .tk-subj { font-weight: 750; }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; align-self: center; }
.tk-row-meta { display: flex; gap: 5px; align-items: center; color: var(--muted); font-size: 11.5px; margin-top: 3px; white-space: nowrap; overflow: hidden; }
.tk-head h2 { margin: 0; font-size: 17px; }
.tk-controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.tk-controls label { width: auto; min-width: 150px; }
.tk-thread { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 2px; min-height: 80px; }
.tk-msg { background: var(--surface-2); border-radius: 10px; padding: 8px 11px; max-width: 86%; align-self: flex-start; }
.tk-msg.first { max-width: 100%; align-self: stretch; border: 1px solid var(--border); background: var(--surface); }
.tk-msg.mine { align-self: flex-end; background: var(--accent-soft); }
.tk-msg.internal { background: color-mix(in srgb, var(--warn) 13%, var(--surface)); border: 1px dashed color-mix(in srgb, var(--warn) 50%, transparent); }
.tk-msg-head { display: flex; gap: 8px; align-items: center; font-size: 11.5px; color: var(--muted); margin-bottom: 3px; }
.tk-msg-head b { color: var(--text); }
.tk-msg-head span:last-child { margin-left: auto; }
.tk-text { white-space: pre-wrap; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.tk-event { align-self: center; font-size: 11px; color: var(--muted); }
.tk-event.internal { font-style: italic; }
.tk-rate { display: flex; align-items: center; gap: 2px; font-size: 12.5px; }
.tk-rate .btn { margin-left: 10px; }
.star { border: 0; background: none; cursor: pointer; font-size: 19px; color: var(--border); padding: 0 1px; line-height: 1; }
.star.on, .star:hover { color: var(--warn); }
.tk-reply { display: flex; flex-direction: column; gap: 6px; }
.tk-reply textarea { font-family: inherit; font-size: 13px; min-height: 58px; }
.tk-reply-bar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
@media (max-width: 800px) {
  .tk-page { grid-template-columns: 1fr; height: auto; }
  .tk-left { max-height: 50vh; }
  .tk-right { min-height: 70vh; }
}

/* ---------- my account ---------- */
.acc-page { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; align-items: start; max-width: 1100px; }
.acc-card { padding: 18px; gap: 8px; }
.acc-card h3 { font-size: 13px; margin: 10px 0 2px; }
.acc-id { display: flex; gap: 14px; align-items: center; }
.acc-id h2 { margin: 0; font-size: 19px; }
.acc-badges { display: flex; gap: 5px; margin-top: 5px; }
.acc-actions, .acc-links { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.acc-links .btn { text-decoration: none; color: var(--text); }
.acc-hist { display: flex; flex-direction: column; font-size: 12.5px; }
.acc-hist > div { display: grid; grid-template-columns: 1fr auto 110px; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--border); }
.acc-hist time { color: var(--muted); }

/* ---------- sign-in page settings ---------- */
.sl-page { display: grid; grid-template-columns: minmax(360px, 560px) 1fr; gap: 12px; align-items: start; }
.sl-form { padding: 16px 18px; gap: 9px; }
.sl-form h3 { margin: 8px 0 0; font-size: 13px; }
.sl-form h3:first-child { margin-top: 0; }
.sl-logo-row { display: flex; gap: 8px; align-items: center; }
.sl-default { background: var(--accent); color: #fff; font-size: 13px; border-radius: 10px; }
.sl-bgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.sl-bg { position: relative; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.sl-bg img, .sl-bg video { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.sl-bg.off img, .sl-bg.off video { opacity: 0.35; filter: grayscale(1); }
.sl-kind { position: absolute; top: 4px; left: 6px; color: #fff; font-size: 11px; text-shadow: 0 1px 3px #000; }
.sl-bg-bar { display: flex; align-items: center; gap: 0; padding: 2px 4px; font-size: 11.5px; }
.sl-bg-bar label.check { font-size: 11.5px; }
.sl-add { display: flex; gap: 6px; flex-wrap: wrap; }
.sl-preview { padding: 10px; position: sticky; top: 64px; }
.sl-preview-label { margin-bottom: 6px; }
.sl-mini { position: relative; aspect-ratio: 16 / 10; border-radius: 10px; overflow: hidden; background: var(--bg); display: grid; place-items: center; border: 1px solid var(--border); }
.sl-mini > img, .sl-mini > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mini-dim { position: absolute; inset: 0; background: #000; }
.mini-card { position: relative; width: 44%; min-width: 180px; background: color-mix(in srgb, var(--surface) 94%, transparent); border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 7px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); }
.mini-title { display: flex; align-items: center; gap: 7px; font-family: var(--serif); font-weight: 600; font-size: 16px; }
.mini-logo { width: 20px; height: 20px; border-radius: 5px; font-size: 16px; line-height: 20px; object-fit: contain; display: inline-block; }
.mini-logo.fv { background: var(--accent); }
.mini-tag { font-size: 10.5px; color: var(--muted); margin-top: -4px; }
.mini-in { height: 18px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface); }
.mini-btn { height: 22px; border-radius: 6px; background: var(--accent); color: #fff; font-size: 10.5px; display: grid; place-items: center; font-weight: 600; }
.mini-link { font-size: 10px; color: var(--accent); }
@media (max-width: 900px) { .sl-page { grid-template-columns: 1fr; } .sl-preview { position: static; } }

/* ---------- help chat review ---------- */
.hr-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.hr-stats .stat { padding: 10px 14px; gap: 2px; }
.hr-stats .stat span { font-size: 12px; color: var(--muted); }
.hr-stats .stat b { font-size: 24px; }
.hr-grid { display: grid; grid-template-columns: minmax(320px, 1fr) 1.3fr; gap: 12px; align-items: start; }
.hr-grid > .card { padding: 14px; gap: 6px; }
.hr-grid h3 { font-size: 13px; margin: 6px 0 0; display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.hr-grid .table-wrap { max-height: calc(100vh - 230px); }
.hr-gaps, .hr-custom { display: flex; flex-direction: column; }
.hr-gap { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
@media (max-width: 900px) { .hr-stats { grid-template-columns: 1fr 1fr; } .hr-grid { grid-template-columns: 1fr; } }

/* ---------- help chat bubble ---------- */
.help-fab { position: fixed; right: 18px; bottom: 18px; z-index: 40; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; font-size: 21px; font-weight: 700; cursor: pointer; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28); }
.help-fab:hover { filter: brightness(1.08); }
.help-fab.on { background: var(--text); color: var(--bg); }
body.tv .help-fab, body.tv .help-panel, body.link-mode .help-fab, body.signed-out .help-fab, body.signed-out .help-panel, body.editing-dash .help-fab { display: none; }
.help-panel { position: fixed; right: 18px; bottom: 72px; z-index: 41; width: min(380px, calc(100vw - 32px)); height: min(560px, calc(100vh - 110px)); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35); display: flex; flex-direction: column; overflow: hidden; }
.help-panel[hidden] { display: none; }
.help-panel header { display: flex; align-items: center; gap: 6px; padding: 9px 10px 9px 14px; border-bottom: 1px solid var(--border); }
.help-log { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.hm { font-size: 13px; line-height: 1.45; border-radius: 12px; padding: 8px 11px; max-width: 92%; }
.hm p { margin: 0 0 5px; }
.hm p:last-child { margin-bottom: 0; }
.hm ul { margin: 2px 0 4px; padding-left: 18px; }
.hm li { margin: 2px 0; }
.hm code { font-size: 12px; background: var(--surface-2); padding: 0 4px; border-radius: 4px; }
.hm.me { align-self: flex-end; background: var(--accent); color: #fff; }
.hm.bot { align-self: flex-start; background: var(--surface-2); }
.hm-title { font-weight: 700; margin-bottom: 4px; }
.hm-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.hm .chip { cursor: pointer; color: var(--text); font: inherit; font-size: 11.5px; text-align: left; background: var(--surface); }
.hm .chip:hover { border-color: var(--accent); }
.hm-group { font-size: 11px; font-weight: 700; color: var(--muted); margin-top: 8px; text-transform: uppercase; letter-spacing: 0.04em; }
.hm-vote { margin-top: 6px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 2px; }
.hm-rel { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.hm .btn { margin-top: 7px; }
.help-panel form { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--border); }

.tk-reply-bar { padding-right: 52px; }
#tkform textarea, #teachform textarea { font-family: inherit; font-size: 13px; }
body.tk-open .help-fab { bottom: 14px; }

.brand-co { margin: -4px 12px 8px; font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.code-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 11.5px; white-space: pre-wrap; overflow-wrap: anywhere; user-select: all; }
.hist-pick { display: flex; flex-wrap: wrap; gap: 4px 14px; }
/* People & roles: room for every column and button */
#modal:has(#peopledlg) { width: min(940px, 96vw); max-width: 96vw; }
#peopledlg #people-body { overflow-x: auto; }
.people-table td:last-child { max-width: none; overflow: visible; }


/* data browser in the widget editor (Picking a measure): Measures / Filter / Options */
.dsb { display: flex; flex-direction: column; gap: 6px; }
.dsb-sec { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow: hidden; }
.dsb-sec > summary { cursor: pointer; padding: 6px 10px; font-weight: 600; background: var(--surface-2); list-style: none; }
.dsb-sec > summary::before { content: '▸ '; color: var(--muted); }
.dsb-sec[open] > summary::before { content: '▾ '; }
.dsb-sec > input[type=search] { margin: 8px 10px 4px; width: calc(100% - 20px); }
.dsb-sec > label, .dsb-sec > .help { display: block; margin: 6px 10px; }
.dsb-tree { max-height: 240px; overflow: auto; padding: 2px 6px 8px; }
.dsb-head { font-size: 12px; font-weight: 600; color: var(--muted); margin: 6px 4px 2px; }
.dsb-folder > summary { cursor: pointer; padding: 3px 4px; border-radius: 6px; }
.dsb-folder > summary:hover { background: var(--surface-2); }
.dsb-folder .dsb-item { margin-left: 16px; }
.dsb-item { display: block; width: calc(100% - 16px); text-align: left; background: none; border: 0; border-radius: 6px; padding: 3px 8px; font: inherit; font-size: 13px; color: var(--text); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsb-item:hover { background: var(--accent-soft); }
.dsb-item.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.dsb-fields { display: flex; flex-wrap: wrap; gap: 4px; }
.dsb-fields .dsb-item { display: inline-block; width: auto; border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; }

/* smart guides while moving / resizing a widget */
.guides { position: absolute; inset: 0; pointer-events: none; z-index: 100000; }
.guide-line { position: absolute; background: #ff3d8b; }
.guide-line.v { width: 1px; } .guide-line.h { height: 1px; }
.guide-line { box-shadow: 0 0 0 1px rgba(255, 61, 139, 0.35); }
.guide-eq { position: absolute; color: #ff3d8b; }
.guide-eq.h { height: 0; border-top: 1px solid #ff3d8b; }
.guide-eq.v { width: 0; border-left: 1px solid #ff3d8b; }
.guide-eq b { position: absolute; font: 700 11px/1 var(--font); background: #ff3d8b; color: #fff; border-radius: 3px; padding: 1px 4px; }
.guide-eq.h b { left: 50%; top: -7px; transform: translateX(-50%); }
.guide-eq.v b { top: 50%; left: -8px; transform: translateY(-50%); }
/* hide tile: no frame, background or shadow (still outlined while editing so it can be found) */
.card.bare { background: transparent !important; background-image: none !important; border-color: transparent !important; box-shadow: none !important; }
body:not(.readonly) .item:hover > .card.bare { outline: 1px dashed var(--border); outline-offset: -1px; }
/* scrolling text that doesn't fit */
.mq { display: block; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: clip !important; mask-image: linear-gradient(to right, transparent, #000 4%, #000 96%, transparent); }
.mq-track { display: inline-block; white-space: nowrap; animation: ticker-scroll linear infinite; will-change: transform; }
.mq-track > span { display: inline-block; padding-right: 2.5em; }
.mq:hover .mq-track { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .mq-track { animation: none; } }

/* group Display: one widget at a time */
.group-rot { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; margin-right: 4px; }
.group-rot .rot-dot { width: 7px; height: 7px; padding: 0; border-radius: 50%; border: 1px solid currentColor; background: transparent; opacity: 0.6; cursor: pointer; }
.group-rot .rot-dot.on { background: currentColor; opacity: 1; }
.group-rot .rot-arrow { background: none; border: 0; color: inherit; font-size: 15px; line-height: 1; padding: 0 3px; cursor: pointer; opacity: 0.75; }
.group-rot .rot-arrow:hover { opacity: 1; }
/* every widget of a rotating group sits exactly on the group's inside; the movement happens INSIDE that box and is
   clipped to it, so nothing slides out past the group's frame */
.item.in-rot { overflow: hidden; perspective: 1400px; transition: opacity 0.7s ease; }
.item.in-rot > .card { width: 100%; height: 100%; transition: transform 0.7s ease; transform-origin: center; backface-visibility: hidden; }
.item.in-rot:not(.rot-on) { opacity: 0; pointer-events: none; }
/* waiting their turn: go to the starting side instantly and unseen (no sweep back across the frame) */
.item.in-rot:not(.rot-on):not(.rot-out), .item.in-rot:not(.rot-on):not(.rot-out) > .card { transition: none; }
/* slides push: the old one keeps showing while it leaves, the new one comes in from the other side */
.item.rot-fx-slide.rot-out, .item.rot-fx-slide-up.rot-out { opacity: 1; z-index: 0 !important; }
.item.rot-fx-slide:not(.rot-on) > .card { transform: translateX(100%); } .item.rot-fx-slide.rot-out > .card { transform: translateX(-100%); }
.item.rot-fx-slide-up:not(.rot-on) > .card { transform: translateY(100%); } .item.rot-fx-slide-up.rot-out > .card { transform: translateY(-100%); }
.item.rot-fx-carousel:not(.rot-on) > .card { transform: rotateY(-75deg) scale(0.82); } .item.rot-fx-carousel.rot-out > .card { transform: rotateY(75deg) scale(0.82); }
.item.rot-fx-flip:not(.rot-on) > .card { transform: rotateX(-90deg); } .item.rot-fx-flip.rot-out > .card { transform: rotateX(90deg); }
.item.rot-fx-zoom:not(.rot-on) > .card { transform: scale(0.85); } .item.rot-fx-zoom.rot-out > .card { transform: scale(1.12); }
@media (prefers-reduced-motion: reduce) { .item.in-rot > .card { transform: none !important; } .item.in-rot.rot-out { opacity: 0 !important; } }

/* group header options: alignment, hidden (a small ⋯ appears in the corner on hover so the menu is still there) */
.group.head-center .group-name { text-align: center; } .group.head-right .group-name { text-align: right; }
.group.head-hidden > .group-head { position: absolute; top: 2px; right: 2px; height: auto; padding: 2px 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; z-index: 3; opacity: 0; transition: opacity 0.15s; font-size: 12px; }
.group.head-hidden > .group-head > .group-name, .group.head-hidden > .group-head > .group-count, .group.head-hidden > .group-head > .group-toggle { display: none; }
.group.head-hidden:hover > .group-head { opacity: 1; }
body.tv .group.head-hidden > .group-head, body.readonly .group.head-hidden > .group-head:not(:has(.rot-dot)) { display: none; }



/* showpieces */
.card.glow { box-shadow: 0 0 0 1px color-mix(in srgb, var(--glow, #6aa0ff) 55%, transparent), 0 0 22px color-mix(in srgb, var(--glow, #6aa0ff) 30%, transparent), inset 0 0 36px color-mix(in srgb, var(--glow, #6aa0ff) 9%, transparent); }
.card.glow[data-glow='neon'] { box-shadow: 0 0 0 1.5px var(--glow, #6aa0ff), 0 0 34px color-mix(in srgb, var(--glow, #6aa0ff) 60%, transparent), inset 0 0 54px color-mix(in srgb, var(--glow, #6aa0ff) 18%, transparent); text-shadow: 0 0 14px color-mix(in srgb, var(--glow, #6aa0ff) 70%, transparent); }
.avatars { position: relative; width: 100%; height: 100%; overflow: hidden; }
.av-bubble { position: absolute; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; background: radial-gradient(circle at 34% 28%, color-mix(in srgb, var(--c) 55%, #fff), var(--c) 70%); box-shadow: 0 6px 18px color-mix(in srgb, var(--c) 45%, transparent), inset 0 -6px 12px rgba(0,0,0,.18); animation: av-float 5.5s ease-in-out infinite; }
.av-bubble.clickable { cursor: pointer; }
.av-init { text-shadow: 0 1px 3px rgba(0,0,0,.35); }
.av-tag { position: absolute; top: 100%; margin-top: 4px; left: 50%; transform: translateX(-50%); white-space: nowrap; background: var(--surface, #1b2233); color: var(--text, #fff); border: 1px solid var(--border, rgba(255,255,255,.18)); border-radius: 999px; padding: 1px 8px; font-weight: 500; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
@keyframes av-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .av-bubble { animation: none; } }
.map-flat { background: transparent !important; }
.map-flat .leaflet-container, .map-flat.leaflet-container { background: transparent; }
.avatars.dense .av-tag { display: none; }
.avatars.dense .av-bubble:hover { z-index: 5; }
.avatars.dense .av-bubble:hover .av-tag { display: block; }

/* ---------- sidebar polish: line icons, folders as groups, clear active item ---------- */
.nav-icon svg, .ico { width: 16px; height: 16px; display: block; margin: auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
nav a .nav-icon, .nav-add .nav-icon { color: var(--muted); }
nav a.active .nav-icon { color: var(--accent); }
nav a.active { box-shadow: inset 2px 0 0 var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); }
.nav-add { display: flex; align-items: center; gap: 8px; }
.nav-add .nav-icon { width: 18px; }
.nav-section > .nav-title { text-transform: uppercase; letter-spacing: 0.07em; font-size: 10.5px; font-weight: 600; color: var(--muted); }
.nav-section { padding-bottom: 6px; }
.nav-section + .nav-section { border-top: 1px solid var(--border); padding-top: 12px; }
.nav-sub-title { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; padding: 8px 8px 3px; }
.nav-folder-head { font-weight: 600; font-size: 13px; }
.nav-folder-head .nav-icon.fld { color: var(--muted); width: 18px; }
.nav-folder.open > .nav-folder-row .nav-icon.fld { color: var(--accent); }
.nav-folder-items { margin-left: 15px; padding-left: 6px; border-left: 1px solid var(--border); }
nav a .nav-icon.dflt { opacity: 0.8; }
nav a span.nav-icon { flex: none; }

.sidebar { width: 272px; }

/* ---------- sidebar gradient: a warm glow from the top corner, fading into the sidebar colour ---------- */
.sidebar {
  background:
    radial-gradient(130% 55% at 0% 0%, color-mix(in srgb, var(--accent) 26%, transparent) 0%, transparent 62%),
    radial-gradient(120% 40% at 100% 100%, color-mix(in srgb, var(--accent) 12%, transparent) 0%, transparent 70%),
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 9%, var(--sidebar)) 0%, var(--sidebar) 48%, color-mix(in srgb, var(--accent) 5%, var(--sidebar)) 100%);
}
.sidebar .nav-section + .nav-section { border-top-color: color-mix(in srgb, var(--accent) 16%, var(--border)); }
.sidebar .nav-search, .sidebar input[type='search'] { background: color-mix(in srgb, var(--surface) 70%, transparent); backdrop-filter: blur(6px); }

/* ---------- public landing page (shown when signed out) ---------- */
.signin.site { display: block; padding: 0; min-height: 100vh; overflow: visible; position: relative; }
.site .signin-bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: var(--bg); }
.site:not(.has-bg) .signin-bg::before { content: ''; position: absolute; inset: 0; background-image: linear-gradient(color-mix(in srgb, var(--text) 4.5%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, var(--text) 4.5%, transparent) 1px, transparent 1px); background-size: 56px 56px; -webkit-mask-image: radial-gradient(90% 70% at 50% 20%, #000 15%, transparent 80%); mask-image: radial-gradient(90% 70% at 50% 20%, #000 15%, transparent 80%); }
/* the moving backdrop: drifting colour, figures that float up like live numbers, and slow data lines */
.orb { position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%; filter: blur(80px); opacity: 0.5; animation: orb-drift 30s ease-in-out infinite alternate; will-change: transform; }
.orb.o1 { background: color-mix(in srgb, var(--accent) 60%, transparent); left: -14vmax; top: -16vmax; }
.orb.o2 { background: color-mix(in srgb, #1f9fbf 50%, transparent); right: -16vmax; top: 8vh; animation-duration: 36s; animation-delay: -9s; }
.orb.o3 { background: color-mix(in srgb, #6d5bd0 55%, transparent); left: 28vw; bottom: -28vmax; animation-duration: 42s; animation-delay: -15s; }
@keyframes orb-drift { 0% { transform: translate(0, 0) scale(1); } 50% { transform: translate(6vmax, 4vmax) scale(1.12); } 100% { transform: translate(-4vmax, 8vmax) scale(0.94); } }
.fig { position: absolute; left: var(--x); bottom: -50px; font: 600 clamp(13px, 1.2vw, 19px) var(--serif); color: color-mix(in srgb, var(--text) 30%, transparent); padding: 4px 11px; border: 1px solid color-mix(in srgb, var(--text) 14%, transparent); border-radius: 10px; opacity: 0; animation: fig-up var(--s) linear infinite; animation-delay: var(--d); }
@keyframes fig-up { 0% { transform: translateY(0); opacity: 0; } 8% { opacity: 0.75; } 85% { opacity: 0.5; } 100% { transform: translateY(-115vh); opacity: 0; } }
.bd-canvas { position: absolute; inset: 0; width: 100%; height: 100%; -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 65%, transparent 100%); mask-image: linear-gradient(180deg, #000 0%, #000 65%, transparent 100%); }
.site .signin-preview-note { position: fixed; top: 66px; left: 50%; transform: translateX(-50%); z-index: 40; }
/* full-width: the bar and the sections use the whole window and adapt to it */
.site .site-wrap { width: 100%; max-width: none; margin: 0; padding-inline: clamp(16px, 2.6vw, 64px); box-sizing: border-box; }
.site-nav { display: block; width: 100%; box-sizing: border-box; position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent); }
.nav-in { display: flex; align-items: center; gap: 20px; height: 60px; width: 100%; box-sizing: border-box; padding-inline: clamp(14px, 1.8vw, 32px); }
.site-brand { display: flex; align-items: center; gap: 9px; font-family: var(--serif); font-weight: 600; font-size: 20px; letter-spacing: -0.01em; color: var(--text); text-decoration: none; }
.site-brand > svg { width: 28px; height: 28px; }
.nav-links { display: flex; gap: 2px; margin-left: 12px; flex: 1; }
.nav-links button, .nav-link, .nav-link-a { border: 0; background: none; color: var(--muted); font: inherit; font-size: clamp(13.5px, 1vw, 16px); font-weight: 500; padding: 7px 12px; border-radius: 9px; cursor: pointer; text-decoration: none; }
.nav-links button:hover, .nav-link:hover, .nav-link-a:hover, .nav-link-a.on { color: var(--text); background: color-mix(in srgb, var(--text) 6%, transparent); }
.nav-cta { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.nav-signin { padding: 7px 18px; font-size: 13.5px; }
.site-main { position: relative; z-index: 2; }
.site-ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mini-ico { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -2px; }
.btn.big { padding: 11px 22px; font-size: 15px; border-radius: 11px; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
/* hero */
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: clamp(28px, 6vh, 80px); gap: 14px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); padding: 5px 12px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); background: color-mix(in srgb, var(--accent) 9%, transparent); }
.site .hero-title { font-family: var(--serif); font-weight: 600; font-size: clamp(36px, 5.4vw, 92px); line-height: 1.04; letter-spacing: -0.025em; margin: 0; max-width: 20ch; display: block; text-wrap: balance; }
.hero-title em { font-style: normal; background: linear-gradient(90deg, var(--accent), #e6a640); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-lead { margin: 0; max-width: 72ch; color: var(--muted); font-size: clamp(15px, 1.4vw, 21px); line-height: 1.55; }
.hero-hint { margin: 6px 0 0; color: var(--muted); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
/* sample dashboards: small cards that cascade; click one to see it full screen */
.dcards { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 1.7vw, 32px); margin-top: clamp(14px, 3vh, 36px); align-items: start; text-align: left; }
.dcard { --i: 0; padding: 0; border: 1px solid color-mix(in srgb, var(--text) 16%, var(--border)); border-radius: 16px; overflow: hidden; background: var(--surface); color: inherit; font: inherit; cursor: pointer; text-align: left; opacity: 0; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28); animation: dc-rise 0.85s cubic-bezier(0.2, 0.7, 0.2, 1) forwards, dc-bob 8s ease-in-out infinite; animation-delay: calc(var(--i) * 130ms), calc(var(--i) * 130ms + 0.9s); transition: border-color 0.2s, box-shadow 0.2s; }
.dcard:nth-child(3n + 2) { margin-top: clamp(14px, 2.6vw, 52px); }
.dcard:nth-child(3n + 3) { margin-top: clamp(28px, 5.2vw, 104px); }
.dcard:hover, .dcard:focus-visible { border-color: var(--accent); box-shadow: 0 24px 70px color-mix(in srgb, var(--accent) 30%, transparent); outline: none; }
.dthumb { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: #0b0d14; }
.dthumb img { width: 100%; height: 100%; object-fit: cover; object-position: top left; display: block; transition: transform 0.5s ease; }
.dcard:hover .dthumb img { transform: scale(1.04); }
.dmeta { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 14px; }
.dmeta b { font-size: clamp(13px, 1vw, 16px); }
.dmeta em { font-style: normal; font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.dcard:hover .dmeta em { color: var(--accent); }
@keyframes dc-rise { from { opacity: 0; transform: translateY(46px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes dc-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
/* sections */
.site-section { padding-top: clamp(44px, 9vh, 100px); }
.site-section h2 { font-family: var(--serif); font-weight: 600; font-size: clamp(26px, 3.2vw, 52px); letter-spacing: -0.02em; margin: 0; text-align: center; }
.section-sub { text-align: center; color: var(--muted); margin: 10px auto 0; max-width: 64ch; font-size: clamp(15px, 1.2vw, 19px); }
/* features: cards that turn over */
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 1.6vw, 28px); margin-top: 32px; }
.flip { perspective: 1400px; height: clamp(390px, 27vw, 480px); cursor: pointer; outline: none; }
.flip-in { position: relative; width: 100%; height: 100%; transition: transform 0.85s cubic-bezier(0.2, 0.7, 0.2, 1); transform-style: preserve-3d; }
.flip.flipped .flip-in { transform: rotateY(180deg); }
.flip:focus-visible .flip-front { border-color: var(--accent); }
.flip-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 20px; border: 1px solid var(--border); padding: clamp(20px, 2vw, 32px); display: flex; flex-direction: column; gap: 8px; overflow: auto; background: color-mix(in srgb, var(--surface) 78%, transparent); backdrop-filter: blur(8px); }
.flip-front:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.flip-front .big-ico { width: 38px; height: 38px; color: var(--accent); margin-bottom: 10px; }
.flip h3 { margin: 4px 0 4px; font-size: clamp(17px, 1.4vw, 23px); }
.flip p { margin: 0; color: var(--muted); font-size: clamp(14px, 1.05vw, 17px); line-height: 1.5; }
.flip-hint { margin-top: auto; color: var(--accent); font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.flip-back { transform: rotateY(180deg); background: radial-gradient(90% 60% at 0% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%), color-mix(in srgb, var(--surface) 88%, transparent); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.flip-back ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 5px; color: var(--text); font-size: clamp(12.5px, 0.95vw, 15px); line-height: 1.4; }
.flip-back li::marker { color: var(--accent); }
/* the moving pictures on the back of the cards */
.fa { width: 100%; height: auto; max-height: 116px; flex: none; margin-bottom: 4px; overflow: visible; }
.fa-grid path { stroke: color-mix(in srgb, var(--text) 14%, transparent); stroke-width: 1; fill: none; }
.fa-line { fill: none; stroke: var(--accent); stroke-width: 2.8; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: fa-draw 3.8s ease-in-out infinite; }
@keyframes fa-draw { 0% { stroke-dashoffset: 1; } 55%, 100% { stroke-dashoffset: 0; } }
.fa-area { fill: color-mix(in srgb, var(--accent) 22%, transparent); opacity: 0; animation: fa-fade 3.8s ease-in-out infinite; }
@keyframes fa-fade { 0%, 30% { opacity: 0; } 60%, 100% { opacity: 1; } }
.fa-dot { fill: var(--accent); transform-box: fill-box; transform-origin: center; animation: fa-pulse 1.4s ease-in-out infinite; }
@keyframes fa-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.9); opacity: 0.35; } }
.fa-num { fill: var(--text); font: 700 14px var(--serif); }
.fa-num.mid { text-anchor: middle; }
.fa-bar { fill: var(--accent); transform-box: fill-box; transform-origin: 50% 100%; animation: fa-grow 2.8s ease-in-out infinite; }
.fa-bar.b2, .fa-bar.a2 { animation-delay: 0.25s; fill: #2fb6a3; }
.fa-bar.b3, .fa-bar.a3 { animation-delay: 0.5s; fill: #8b7cf6; }
.fa-bar.b4, .fa-bar.a4 { animation-delay: 0.75s; fill: #e6a640; }
.fa-bar.a5 { animation-delay: 1s; fill: #2fb6a3; }
@keyframes fa-grow { 0% { transform: scaleY(0.12); } 45%, 70% { transform: scaleY(1); } 100% { transform: scaleY(0.12); } }
.fa-ring-bg { fill: none; stroke: color-mix(in srgb, var(--text) 14%, transparent); stroke-width: 9; }
.fa-ring { fill: none; stroke: var(--accent); stroke-width: 9; stroke-linecap: round; stroke-dasharray: 0 100; transform: rotate(-90deg); transform-origin: 196px 55px; animation: fa-sweep 3.2s ease-in-out infinite; }
@keyframes fa-sweep { 0% { stroke-dasharray: 0 100; } 50%, 80% { stroke-dasharray: 72 100; } 100% { stroke-dasharray: 0 100; } }
.fa-card { animation: fa-theme 7.5s ease-in-out infinite; stroke: color-mix(in srgb, var(--text) 20%, transparent); stroke-width: 1; }
.fa-card.c2 { animation-delay: -2.5s; }
.fa-card.c3 { animation-delay: -5s; }
@keyframes fa-theme { 0%, 100% { fill: #1d1d1c; } 33% { fill: #efe9dc; } 66% { fill: #14395e; } }
.fa-mini rect { fill: var(--accent); opacity: 0.85; }
.fa-tv { fill: color-mix(in srgb, var(--surface) 60%, transparent); stroke: color-mix(in srgb, var(--text) 35%, transparent); stroke-width: 2; }
.fa-stand { fill: color-mix(in srgb, var(--text) 35%, transparent); }
.fa-pane { opacity: 0; animation: fa-cycle 7.5s ease-in-out infinite; }
.fa-pane.p2 { animation-delay: 2.5s; }
.fa-pane.p3 { animation-delay: 5s; }
@keyframes fa-cycle { 0% { opacity: 0; } 6%, 30% { opacity: 1; } 38%, 100% { opacity: 0; } }
.fa-pane rect { fill: var(--accent); }
.fa-pane circle { fill: none; stroke: #2fb6a3; stroke-width: 12; }
.fa-pane.p2 rect { fill: #8b7cf6; }
.fa-pane path { fill: none; stroke: #8b7cf6; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.fa-thresh { stroke: #d92d4b; stroke-dasharray: 5 4; stroke-width: 1.6; fill: none; }
.fa-bar.hot { animation: fa-grow 2.8s ease-in-out infinite, fa-hot 2.8s ease-in-out infinite; }
@keyframes fa-hot { 0%, 40% { fill: #e6a640; } 55%, 72% { fill: #d92d4b; } 100% { fill: #e6a640; } }
.fa-bell { fill: none; stroke: var(--text); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transform-origin: 216px 44px; animation: fa-ring 2.8s ease-in-out infinite; }
@keyframes fa-ring { 0%, 45%, 66%, 100% { transform: rotate(0); } 50% { transform: rotate(14deg); } 55% { transform: rotate(-12deg); } 60% { transform: rotate(8deg); } }
.fa-ping { fill: #d92d4b; transform-box: fill-box; transform-origin: center; animation: fa-pulse 1.1s ease-in-out infinite; }
.fa-co { fill: color-mix(in srgb, var(--surface) 70%, transparent); stroke: color-mix(in srgb, var(--text) 25%, transparent); stroke-width: 1.5; }
.fa-lock rect { fill: var(--accent); }
.fa-lock path { fill: none; stroke: var(--accent); stroke-width: 3.2; stroke-linecap: round; }
.fa-wave { fill: none; stroke: var(--accent); stroke-width: 2; opacity: 0; transform-box: fill-box; transform-origin: center; animation: fa-wave 2.6s ease-out infinite; }
.fa-wave.w2 { animation-delay: 1.3s; }
@keyframes fa-wave { 0% { transform: scale(0.6); opacity: 0.8; } 100% { transform: scale(3); opacity: 0; } }
/* teams and integrations */
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 28px; }
.chips span, .chip-btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px; border-radius: 999px; border: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 72%, transparent); color: var(--text); font: inherit; font-size: clamp(13.5px, 1.05vw, 17px); font-weight: 500; }
.chip-btn { cursor: pointer; transition: transform 0.15s, border-color 0.15s, background 0.15s; }
.chip-btn:hover, .chip-btn:focus-visible { transform: translateY(-2px); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); outline: none; }
.chip-btn .mini-ico { fill: var(--accent); stroke: var(--accent); }
/* the Learn teaser */
.learn-band { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding: clamp(22px, 3vw, 44px); border-radius: 22px; border: 1px solid var(--border); background: radial-gradient(70% 140% at 100% 0%, color-mix(in srgb, #6d5bd0 22%, transparent), transparent 70%), color-mix(in srgb, var(--surface) 78%, transparent); }
.learn-band h2 { text-align: left; }
.learn-band p { margin: 8px 0 0; color: var(--muted); max-width: 56ch; font-size: clamp(14px, 1.1vw, 17px); }
/* Connect: leave an email and a message */
.contact-card { display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(20px, 3vw, 56px); align-items: start; padding: clamp(22px, 4vw, 64px); border-radius: 22px; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); background: radial-gradient(80% 120% at 0% 0%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 70%), color-mix(in srgb, var(--surface) 80%, transparent); }
.contact-text h2 { text-align: left; }
.contact-text > p { color: var(--muted); margin: 10px 0 0; max-width: 46ch; line-height: 1.55; font-size: clamp(14px, 1.1vw, 17px); }
.contact-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.contact-list { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 12px; }
.contact-list li { display: flex; align-items: center; gap: 14px; padding: 13px 16px; border-radius: 14px; border: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 85%, transparent); }
.contact-list .site-ico { width: 22px; height: 22px; color: var(--accent); }
.contact-list span { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.contact-list b { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.contact-list a { color: inherit; text-decoration: none; }
.contact-list a:hover { color: var(--accent); }
.enq { display: flex; flex-direction: column; gap: 12px; }
.enq label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 500; }
.enq textarea { font-family: inherit; font-size: 14px; resize: vertical; min-height: 96px; }
.enq .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.enq-msg { min-height: 1.2em; font-size: 13px; }
.enq-msg.ok { color: var(--ok); }
.enq-msg.bad { color: var(--err); }
.enq button.big { align-self: flex-start; justify-content: center; }
.site-foot { margin-top: clamp(44px, 9vh, 100px); border-top: 1px solid var(--border); padding: 22px 0 28px; background: color-mix(in srgb, var(--bg) 80%, transparent); }
/* the Learn page */
.learn-main { height: calc(100vh - 61px); }
.learn-root { height: 100%; background: color-mix(in srgb, var(--surface) 72%, transparent); backdrop-filter: blur(10px); }
.learn-root .gd-reader { height: 100%; }
/* the sign-in form opens from the top-right button */
.signin-dialog { border: 0; padding: 0; background: transparent; max-width: 100vw; overflow: visible; width: min(420px, calc(100vw - 24px)); }
.signin-dialog::backdrop { background: rgba(8, 8, 12, 0.6); backdrop-filter: blur(6px); }
.signin-dialog .signin-card { width: 100%; }
.signin-dialog .signin-card form, .signin-dialog .signin-card .signin-done { max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); border-radius: 20px; padding: 30px 28px; background: var(--surface); }
.dlg-x { position: absolute; top: 10px; right: 10px; z-index: 3; border: 0; background: none; color: var(--muted); font-size: 16px; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; }
.dlg-x:hover { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); }
.signin-welcome { display: none; }
/* full-screen sample dashboard */
.pv { position: fixed; inset: 0; z-index: 2000; background: #05060a; color: #fff; display: flex; flex-direction: column; }
.pv-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 16px; background: rgba(22, 22, 28, 0.92); border-bottom: 1px solid rgba(255, 255, 255, 0.1); flex: none; }
.pv-title { min-width: 0; }
.pv-title b { display: block; font-size: 15px; }
.pv-title span { display: block; font-size: 12.5px; color: #b9b9c4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-actions { display: flex; gap: 6px; flex: none; }
.pv-btn { border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.06); color: #fff; font: inherit; font-size: 13px; padding: 7px 12px; border-radius: 9px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; }
.pv-btn:hover { background: rgba(255, 255, 255, 0.14); }
.pv-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: clamp(8px, 1.6vw, 28px); }
.pv-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 10px; box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6); animation: pv-in 0.35s ease; }
@keyframes pv-in { from { opacity: 0; transform: scale(0.985); } to { opacity: 1; transform: none; } }
.pv-note { position: absolute; bottom: 8px; left: 0; right: 0; text-align: center; color: #8b8b98; font-size: 12px; pointer-events: none; }
body.pv-open { overflow: hidden; }
/* smaller screens */
@media (max-width: 1100px) { .dcards { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dcard:nth-child(3n + 2), .dcard:nth-child(3n + 3) { margin-top: 0; } .dcard:nth-child(2n) { margin-top: clamp(14px, 3vw, 40px); } .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .contact-card { grid-template-columns: 1fr; } .flip { height: 420px; } }
@media (max-width: 720px) { .nav-links, .nav-cta .nav-link { display: none; } .dcards, .feature-grid { grid-template-columns: 1fr; } .dcard:nth-child(2n) { margin-top: 0; } .pv-btn span { display: none; } .pv-title span { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .orb, .fig, .dcard, .flip-in { animation: none !important; transition: none !important; }
  .dcard { opacity: 1; }
  .fa * { animation: none !important; }
  .fa-line { stroke-dashoffset: 0; }
  .fa-area, .fa-pane.p1 { opacity: 1; }
}

/* ---------- guides (public page and in-app) ---------- */
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: clamp(12px, 1.2vw, 22px); margin-top: 30px; }
.guide-card { text-align: left; display: flex; flex-direction: column; gap: 6px; padding: 18px; border-radius: 16px; border: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 72%, transparent); backdrop-filter: blur(8px); color: var(--text); font: inherit; cursor: pointer; transition: transform 0.18s, border-color 0.18s; }
.guide-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.guide-card .g-num { font-family: var(--serif); color: var(--accent); font-size: 14px; font-weight: 600; }
.guide-card b { font-size: 15.5px; }
.guide-card .g-sum { color: var(--muted); font-size: 13px; line-height: 1.45; flex: 1; }
.guide-card em { font-style: normal; font-size: 12px; color: var(--muted); }
.gd-reader { display: grid; grid-template-columns: 270px minmax(0, 1fr); height: 100%; min-height: 0; }
.g-list { border-right: 1px solid var(--border); padding: 16px 12px; overflow: auto; display: flex; flex-direction: column; gap: 10px; background: color-mix(in srgb, var(--sidebar, var(--surface-2)) 80%, transparent); }
.g-search { width: 100%; }
.g-list nav { display: flex; flex-direction: column; gap: 2px; }
.g-list nav button { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; text-align: left; border: 0; background: none; color: var(--text); font: inherit; font-size: 13.5px; padding: 8px 10px; border-radius: 9px; cursor: pointer; }
.g-list nav button:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.g-list nav button.on { background: color-mix(in srgb, var(--accent) 12%, transparent); box-shadow: inset 2px 0 0 var(--accent); font-weight: 600; }
.g-list nav em { font-style: normal; font-size: 11px; color: var(--muted); flex: none; }
.g-none { color: var(--muted); font-size: 13px; padding: 6px 10px; }
.g-body { padding: clamp(20px, 3vw, 44px); overflow: auto; max-width: 78ch; line-height: 1.6; font-size: 15px; }
.g-body h2 { font-family: var(--serif); font-weight: 600; font-size: clamp(24px, 2.6vw, 34px); letter-spacing: -0.02em; margin: 4px 0 6px; }
.g-body h3 { font-size: 16px; margin: 22px 0 6px; }
.g-meta { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.g-lead { color: var(--muted); font-size: 16px; margin: 0 0 14px; }
.g-body ul, .g-body ol { padding-left: 22px; margin: 8px 0; display: grid; gap: 7px; }
.g-tip { margin: 18px 0; padding: 12px 14px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); background: color-mix(in srgb, var(--accent) 9%, transparent); font-size: 14px; }
.g-tip b { color: var(--accent); margin-right: 4px; }
.g-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.guides-dlg { width: min(1120px, 96vw); height: min(780px, 92vh); border: 1px solid var(--border); border-radius: 20px; padding: 0; background: var(--surface); color: var(--text); overflow: hidden; box-shadow: 0 40px 100px rgba(0, 0, 0, 0.5); }
.guides-dlg::backdrop { background: rgba(8, 8, 12, 0.6); backdrop-filter: blur(6px); }
.guides-dlg .g-root { height: 100%; }
.guides-dlg .dlg-x { z-index: 5; }
.g-page { height: calc(100vh - 80px); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: var(--surface); margin: 8px; }
.g-page .g-root { height: 100%; }
@media (max-width: 760px) { .gd-reader { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); } .g-list { border-right: 0; border-bottom: 1px solid var(--border); max-height: 38%; } }
/* guides: let the article use the width, and make the in-app page fill the area under the top bar */
.g-body { max-width: none; }
.g-body > * { max-width: 78ch; }
main:has(.g-page) { padding: 0; }
.g-page { margin: 0; border: 0; border-radius: 0; height: calc(100vh - var(--topbar, 50px)); background: transparent; }
main:has(.g-page) { padding-top: var(--topbar, 50px); }
@media (max-width: 760px) {
  .gd-reader { grid-template-rows: auto minmax(0, 1fr); }
  .g-list { max-height: none; flex-direction: column; padding: 10px; gap: 8px; }
  .g-list nav { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .g-list nav button { flex: none; white-space: nowrap; border: 1px solid var(--border); }
  .g-list nav em { display: none; }
}
main:has(.g-page) { height: 100vh; box-sizing: border-box; overflow: hidden; }
.g-page { height: 100%; }
#main:has(.g-page) { padding: var(--topbar, 50px) 0 0; height: 100vh; box-sizing: border-box; overflow: hidden; }
/* the in-app guides page is pinned under the top bar, independent of the page flow */
#main:has(.g-page) { padding: 0; height: auto; overflow: visible; }
.g-page { position: fixed; top: 48px; left: 0; right: 0; bottom: 0; height: auto; margin: 0; z-index: 1; background: var(--bg); }
.g-page .g-root, .g-page .gd-reader { height: 100%; }
/* website fixes: the page fills its container, the bar hugs the edges, the form ignores the old sign-in card rule */
.signin.site, .site .site-main, .site .learn-main { width: 100%; box-sizing: border-box; }
.site .nav-in { padding-inline: clamp(12px, 1.1vw, 22px); }
.site .enq, .site form.enq { width: 100%; max-width: none; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; backdrop-filter: none; }
.site .flip { height: clamp(360px, 24vw, 430px); }

/* ---------- tighter website: a horizontal strip of dashboards, compact feature cards, smaller boxes ---------- */
.dstrip-wrap { position: relative; align-self: stretch; margin-inline: calc(-1 * clamp(16px, 2.6vw, 64px)); margin-top: clamp(10px, 2vh, 24px); }
.dstrip { display: flex; gap: clamp(12px, 1.4vw, 24px); overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: clamp(16px, 2.6vw, 64px); padding: 8px clamp(16px, 2.6vw, 64px) 26px; scrollbar-width: none; text-align: left; -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 2.5%, #000 97.5%, transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 2.5%, #000 97.5%, transparent 100%); outline: none; }
.dstrip::-webkit-scrollbar { display: none; }
.dstrip .dcard { flex: 0 0 clamp(300px, 27vw, 560px); scroll-snap-align: start; margin-top: 0; }
.dstrip .dcard:nth-child(even) { margin-top: clamp(10px, 1.6vw, 30px); }
.dnav { position: absolute; top: 40%; z-index: 4; width: 42px; height: 42px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--text) 25%, var(--border)); background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(8px); color: var(--text); font-size: 26px; line-height: 1; cursor: pointer; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); transition: transform 0.15s, border-color 0.15s; }
.dnav:hover { transform: scale(1.08); border-color: var(--accent); }
.dnav.prev { left: clamp(10px, 1.6vw, 30px); }
.dnav.next { right: clamp(10px, 1.6vw, 30px); }
.site .hero { padding-top: clamp(18px, 4vh, 48px); gap: 10px; }
.site .hero-title { font-size: clamp(32px, 4.6vw, 76px); }
.site .hero-lead { font-size: clamp(14px, 1.2vw, 18px); }
.site .site-section { padding-top: clamp(26px, 5vh, 56px); }
.site .site-section h2 { font-size: clamp(22px, 2.4vw, 36px); }
.site .section-sub { font-size: clamp(13.5px, 1vw, 16px); margin-top: 6px; }
/* feature cards: compact, with little text */
.site .feature-grid { margin-top: 18px; gap: clamp(10px, 1.1vw, 18px); }
.site .flip { height: clamp(176px, 12.5vw, 214px); }
.site .flip-face { padding: clamp(14px, 1.3vw, 22px); gap: 4px; border-radius: 16px; }
.site .flip-front .big-ico { width: 28px; height: 28px; margin-bottom: 4px; }
.site .flip h3 { font-size: clamp(15px, 1.15vw, 18px); margin: 2px 0; }
.site .flip p { font-size: clamp(13px, 0.95vw, 15px); line-height: 1.4; }
.site .flip-hint { font-size: 12px; }
.site .fa { max-height: 70px; margin-bottom: 0; }
.site .flip-back .fa-num { font-size: 13px; }
/* the other boxes, squeezed */
.site .chips { margin-top: 16px; gap: 8px; }
.site .chips span, .site .chip-btn { padding: 7px 14px; font-size: clamp(13px, 0.95vw, 15px); }
.site .learn-band { padding: clamp(14px, 1.8vw, 24px) clamp(16px, 2.2vw, 30px); border-radius: 18px; }
.site .learn-band h2 { font-size: clamp(19px, 1.8vw, 28px); }
.site .learn-band p { font-size: clamp(13px, 0.95vw, 15px); margin-top: 4px; }
.site .btn.big { padding: 9px 18px; font-size: 14px; }
.site .contact-card { padding: clamp(16px, 2.2vw, 32px); gap: clamp(16px, 2.2vw, 34px); border-radius: 18px; }
.site .contact-text > p { font-size: clamp(13px, 0.95vw, 15px); }
.site .enq { gap: 8px; }
.site .enq label { font-size: 12px; }
.site .enq textarea { min-height: 60px; }
.site .enq-msg { min-height: 1em; font-size: 12.5px; }
.site .site-foot { margin-top: clamp(24px, 4.5vh, 52px); padding: 12px 0 16px; }
@media (max-width: 1100px) { .site .flip { height: 190px; } }
@media (max-width: 720px) { .dnav { display: none; } .dstrip .dcard { flex-basis: 78vw; } .dstrip .dcard:nth-child(even) { margin-top: 0; } }

/* ---------- split-screen sign-in: the form on the left, the dashboards on the right ---------- */
.site .hero.hero-split { display: grid; grid-template-columns: minmax(330px, 460px) minmax(0, 1fr); gap: clamp(24px, 4vw, 84px); align-items: center; text-align: left; min-height: calc(100vh - 61px); padding-top: clamp(16px, 3vh, 40px); padding-bottom: clamp(16px, 3vh, 40px); }
.hs-left { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; min-width: 0; }
.site .hs-left .hero-title { font-size: clamp(30px, 3.2vw, 54px); max-width: 14ch; text-align: left; margin: 0; }
.hs-left .hero-lead { max-width: 42ch; margin: 0; font-size: clamp(14px, 1.1vw, 17px); }
.hs-left .signin-card { width: 100%; max-width: 440px; margin-top: 8px; position: relative; z-index: 2; }
.hs-left .signin-card form, .hs-left .signin-card .signin-done { width: 100%; max-width: none; box-sizing: border-box; background: color-mix(in srgb, var(--surface) 84%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid color-mix(in srgb, var(--text) 14%, var(--border)); border-radius: 20px; padding: clamp(18px, 1.8vw, 26px); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35); gap: 10px; }
.hs-left .signin-card h1 { display: none; }
.hs-left .signin-card .signin-welcome { display: block; font-size: 24px; }
.hs-right { min-width: 0; position: relative; }
.hs-right .dstrip-wrap { margin: 0; width: 100%; }
.hs-right .dstrip { padding: 14px 10px 30px; gap: clamp(10px, 1.1vw, 18px); scroll-padding-inline: 10px; }
.hs-right .dstrip .dcard { flex: 0 0 clamp(240px, 22vw, 440px); border-radius: 14px; }
.hs-right .dthumb { aspect-ratio: 16 / 9; }
.hs-right .hero-hint { margin: 0; text-align: center; justify-content: center; width: 100%; }
/* arrows: plain chevrons, no circles */
.dnav { position: absolute; top: 46%; transform: translateY(-50%); z-index: 4; width: 40px; height: 64px; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; backdrop-filter: none; display: grid; place-items: center; color: color-mix(in srgb, var(--text) 75%, transparent); cursor: pointer; transition: color 0.15s, transform 0.15s; }
.dnav svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.6)); }
.dnav:hover { background: none; color: var(--accent); transform: translateY(-50%) scale(1.12); border: 0; }
.dnav.prev { left: -14px; }
.dnav.next { right: -14px; }
@media (max-width: 960px) {
  .site .hero.hero-split { grid-template-columns: 1fr; min-height: 0; }
  .hs-left { align-items: stretch; }
  .site .hs-left .hero-title { max-width: none; }
  .hs-left .signin-card { max-width: none; }
  .hs-right .dstrip .dcard { flex-basis: 70vw; }
  .dnav.prev { left: -6px; }
  .dnav.next { right: -6px; }
}

/* ---------- wide headline, dashboards, then the features straight away ---------- */
.site .hero { display: flex; flex-direction: column; align-items: center; text-align: center; min-height: 0; padding-top: clamp(12px, 2.4vh, 32px); padding-bottom: 0; gap: 8px; }
.site .hero .hero-title { font-size: clamp(32px, 4.9vw, 88px); max-width: none; text-align: center; line-height: 1.05; }
.site .hero .hero-lead { max-width: 90ch; font-size: clamp(14px, 1.15vw, 18px); }
.site .hero .dstrip-wrap { margin: 4px calc(-1 * clamp(16px, 2.6vw, 64px)) 0; width: auto; align-self: stretch; }
.site .hero .dstrip { padding: 10px clamp(16px, 2.6vw, 64px) 16px; }
.site .hero .dstrip .dcard { flex: 0 0 clamp(240px, 22vw, 440px); border-radius: 14px; }
.site .hero .dnav.prev { left: clamp(6px, 1.2vw, 24px); }
.site .hero .dnav.next { right: clamp(6px, 1.2vw, 24px); }
.site .hero .hero-hint { margin: 0 0 4px; }
.site #site-features { padding-top: clamp(14px, 2.5vh, 30px); }
@media (max-width: 960px) { .site .hero .dstrip .dcard { flex-basis: 70vw; } .site .hero .dnav.prev { left: 2px; } .site .hero .dnav.next { right: 2px; } }

/* dashboards flow on their own: no snapping, and every card keeps its own 16:9 height (no dark bands) */
.dstrip { align-items: flex-start; scroll-snap-type: none !important; }
.dstrip .dcard { scroll-snap-align: none; align-self: flex-start; height: auto; display: block; }
.dstrip .dthumb { display: block; }

/* dashboards sit on one straight line (no cascade offset) */
.dstrip .dcard, .dstrip .dcard:nth-child(even), .site .hero .dstrip .dcard:nth-child(even) { margin-top: 0 !important; }

/* eight features: four across on wide screens */
.site .feature-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .site .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .site .feature-grid { grid-template-columns: 1fr; } }
.fa-set { stroke: none; transform-box: fill-box; transform-origin: center; opacity: 0.55; }
.fa-set.sa { fill: var(--accent); animation: fa-left 4s ease-in-out infinite; }
.fa-set.sb { fill: #2fb6a3; animation: fa-right 4s ease-in-out infinite; }
@keyframes fa-left { 0%, 100% { transform: translateX(-14px); } 50% { transform: translateX(26px); } }
@keyframes fa-right { 0%, 100% { transform: translateX(14px); } 50% { transform: translateX(-26px); } }
.fa-lbl { fill: var(--text); font: 600 10px var(--font); text-anchor: middle; opacity: 0.85; }
.fa-merged rect { fill: var(--text); opacity: 0; animation: fa-show 4s ease-in-out infinite; }
.fa-merged rect:nth-child(2) { animation-delay: 0.15s; }
.fa-merged rect:nth-child(3) { animation-delay: 0.3s; }
@keyframes fa-show { 0%, 30% { opacity: 0; } 50%, 75% { opacity: 0.9; } 100% { opacity: 0; } }
.fa-star { fill: var(--accent); transform-box: fill-box; transform-origin: center; animation: fa-twinkle 2.4s ease-in-out infinite; }
@keyframes fa-twinkle { 0%, 100% { transform: scale(1) rotate(0); opacity: 1; } 50% { transform: scale(1.25) rotate(18deg); opacity: 0.7; } }
.fa-ln { fill: color-mix(in srgb, var(--text) 55%, transparent); transform-box: fill-box; transform-origin: left center; transform: scaleX(0); animation: fa-type 4.2s ease-in-out infinite; }
.fa-ln.l2 { animation-delay: 0.5s; }
.fa-ln.l3 { animation-delay: 1s; }
@keyframes fa-type { 0% { transform: scaleX(0); } 30%, 80% { transform: scaleX(1); } 100% { transform: scaleX(0); } }
.fa-caret { fill: var(--accent); animation: fa-blink 1s steps(2) infinite; }
@keyframes fa-blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .fa-ln { transform: scaleX(1); } .fa-merged rect { opacity: 0.9; } }

/* a section reached from the top bar stops just below the bar, not under it */
.site .site-section { scroll-margin-top: 62px; }

/* the Kshan mark: the dot on the tallest bar beats like a live signal */
.kdot { transform-box: fill-box; transform-origin: center; animation: kdot-beat 1.9s ease-in-out infinite; }
@keyframes kdot-beat { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(1.55); } }
@media (prefers-reduced-motion: reduce) { .kdot { animation: none; } }

/* ---------- Why Kshan, Trust, and the "Sample data" tag ---------- */
.why { display: grid; grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.5fr); gap: clamp(22px, 4vw, 72px); align-items: start; }
.why-intro h2 { text-align: left; }
.why-name { margin: 12px 0 0; color: var(--muted); font-size: clamp(14px, 1.1vw, 17px); line-height: 1.55; max-width: 44ch; }
.why-name i { color: var(--text); font-family: var(--serif); font-size: 1.08em; }
.why-label { margin: 22px 0 0; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.why-vision { margin: 6px 0 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--accent); font-family: var(--serif); font-size: clamp(20px, 2vw, 32px); line-height: 1.22; letter-spacing: -0.01em; }
.why-values { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.why-values li { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 14px; align-items: start; padding: 12px 16px; border: 1px solid var(--border); border-radius: 14px; background: color-mix(in srgb, var(--surface) 72%, transparent); backdrop-filter: blur(8px); }
.why-letter { font-family: var(--serif); font-weight: 700; font-size: 40px; line-height: 1; color: var(--accent); text-align: center; }
.why-values b { font-size: clamp(15px, 1.15vw, 18px); margin-right: 8px; }
.why-values em { font-style: normal; color: var(--accent); font-size: clamp(13px, 0.95vw, 15px); }
.why-values p { margin: 4px 0 0; color: var(--muted); font-size: clamp(13px, 0.95vw, 15px); line-height: 1.45; }
.trust-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(10px, 1.1vw, 18px); margin-top: 18px; }
.tcard { padding: clamp(14px, 1.4vw, 22px); border-radius: 16px; border: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 72%, transparent); backdrop-filter: blur(8px); transition: border-color 0.18s, transform 0.18s; }
.tcard:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); transform: translateY(-2px); }
.tcard .site-ico { width: 24px; height: 24px; color: var(--accent); }
.tcard h3 { margin: 10px 0 6px; font-size: clamp(15px, 1.15vw, 18px); }
.tcard p { margin: 0; color: var(--muted); font-size: clamp(13px, 0.95vw, 15px); line-height: 1.5; }
.dcard { position: relative; }
.dsample { position: absolute; top: 8px; left: 8px; z-index: 2; padding: 2px 9px; border-radius: 999px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: #fff; background: rgba(0, 0, 0, 0.55); border: 1px solid rgba(255, 255, 255, 0.25); backdrop-filter: blur(6px); }
@media (max-width: 1100px) { .why { grid-template-columns: 1fr; } .trust-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .trust-grid { grid-template-columns: 1fr; } .why-values li { grid-template-columns: 40px minmax(0, 1fr); } .why-letter { font-size: 32px; } }

/* teams: one scrolling line, names divided by a bar, no boxes */
.ticker-line { overflow: hidden; margin-top: 22px; -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.ticker-track { display: flex; align-items: center; width: max-content; animation: ticker-run 48s linear infinite; }
.ticker-line:hover .ticker-track { animation-play-state: paused; }
.ticker-track .tk { white-space: nowrap; font-size: clamp(16px, 1.5vw, 24px); font-weight: 500; padding: 0 clamp(14px, 1.6vw, 28px); }
.ticker-track .tk-bar { font-style: normal; color: var(--accent); font-weight: 300; font-size: clamp(18px, 1.7vw, 28px); opacity: 0.8; }
@keyframes ticker-run { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .ticker-line { -webkit-mask-image: none; mask-image: none; } .ticker-track { animation: none; flex-wrap: wrap; justify-content: center; width: auto; } .ticker-track [aria-hidden="true"]:nth-child(n + 23) { display: none; } }
/* integrations: the same plain look, centred and wrapped, still */
.plain-line { margin: 22px auto 0; max-width: 1100px; text-align: center; line-height: 2.1; font-size: clamp(16px, 1.45vw, 23px); font-weight: 500; }
.plain-line span { white-space: nowrap; padding: 0 clamp(8px, 1vw, 18px); }
.plain-line i { font-style: normal; color: var(--accent); font-weight: 300; opacity: 0.8; }

/* feature cards fit their content: no fixed height, so text never overflows or scrolls */
.site .flip { height: auto; }
.site .flip-in { display: grid; height: 100%; }
.site .flip-face { position: relative; inset: auto; grid-area: 1 / 1; overflow: hidden; min-height: 176px; }

/* ---------- a calmer page: fewer boxes, a quieter background, more room ---------- */
.fig { display: none; }
.orb { opacity: 0.3; }
.site:not(.has-bg) .signin-bg::before { opacity: 0.45; }
.site .site-section { padding-top: clamp(48px, 9vh, 96px); }
.site #site-features { padding-top: clamp(28px, 5vh, 56px); }
.site .site-section h2 { font-size: clamp(24px, 2.4vw, 38px); }
/* the dashboards: a smaller, quieter label */
.dsample { top: 7px; left: 7px; padding: 1px 7px; font-size: 9.5px; letter-spacing: 0.05em; background: rgba(0, 0, 0, 0.45); border-color: rgba(255, 255, 255, 0.16); }
/* features: soft panels, no outlines */
.site .flip-face { border-color: transparent; background: color-mix(in srgb, var(--surface) 55%, transparent); backdrop-filter: none; }
.site .flip-back { background: color-mix(in srgb, var(--surface) 70%, transparent); border-color: transparent; }
.site .flip-front:hover { border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.site .feature-grid { gap: clamp(8px, 0.9vw, 14px); }
/* Why Kshan: plain rows divided by thin lines, not boxes */
.why-values { gap: 0; }
.why-values li { background: none; border: 0; border-top: 1px solid color-mix(in srgb, var(--text) 11%, transparent); border-radius: 0; padding: 16px 0; backdrop-filter: none; }
.why-values li:last-child { border-bottom: 1px solid color-mix(in srgb, var(--text) 11%, transparent); }
.why-values em { color: var(--muted); }
.why-vision { font-size: clamp(18px, 1.7vw, 27px); border-left-width: 2px; }
.why-label { margin-top: 18px; }
/* Trust: three plain columns, no boxes */
.trust-grid { gap: clamp(26px, 3vw, 48px) clamp(24px, 3.4vw, 64px); margin-top: 28px; }
.tcard { background: none; border: 0; border-radius: 0; padding: 0; backdrop-filter: none; }
.tcard:hover { transform: none; }
.tcard h3 { margin-top: 12px; }
/* Learn and Connect: lighter bands */
.site .learn-band { background: none; border-color: color-mix(in srgb, var(--text) 12%, transparent); }
.site .contact-card { background: color-mix(in srgb, var(--surface) 55%, transparent); border-color: color-mix(in srgb, var(--text) 12%, transparent); }
.site .section-sub { opacity: 0.85; }

/* the one-line tagline: small and light */
.site .hero .hero-lead { max-width: none; font-size: clamp(13px, 0.95vw, 15px); letter-spacing: 0.02em; opacity: 0.85; }

/* the top band keeps its original fonts: a serif name and the system font for the links */
.site-nav { --serif: 'Iowan Old Style', Charter, 'Source Serif Pro', 'Palatino Linotype', Georgia, serif; --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif; font-family: var(--font); }
.site-nav .site-brand { font-family: var(--serif); }
.site-nav .nav-links button, .site-nav .nav-link, .site-nav .nav-link-a, .site-nav .btn, .site-nav button { font-family: var(--font); }

/* hero: one calm call to action */
.site .hero-cta { margin-top: 14px; display: flex; justify-content: center; }
.site .hero-cta .btn { padding: 8px 20px; font-size: 14px; }

/* the headline gets room to breathe: space above it, and space below before the dashboards */
.site .hero { padding-top: clamp(44px, 10vh, 120px); }
.site .hero .hero-title { margin-bottom: clamp(14px, 2.4vh, 26px); }
.site .hero .hero-cta { margin-bottom: 0; }
.site .hero .dstrip-wrap { margin-top: clamp(40px, 8vh, 96px); }

/* clear grouping: each heading has room before its blocks, the blocks have room between them, and each group has room after it */
.site .site-section h2 { margin-bottom: clamp(26px, 4.4vh, 52px); }
.site .site-section .section-sub { margin-top: -10px; margin-bottom: clamp(26px, 4.4vh, 52px); }
.site .feature-grid { gap: clamp(16px, 1.7vw, 28px); }
.site .site-section { padding-bottom: clamp(30px, 6vh, 80px); }
/* "Why Kshan?" keeps its heading close to its own text */
.site .why-intro h2 { margin-bottom: 14px; text-align: left; }

/* the feature group: heading and cards inside one very thin box */
.site #site-features .site-wrap { border: 1px solid color-mix(in srgb, var(--text) 16%, transparent); border-radius: 22px; padding: clamp(22px, 3.4vh, 40px) clamp(16px, 2vw, 32px) clamp(20px, 3vh, 36px); box-sizing: border-box; }
.site #site-features h2 { margin-top: 0; }
.site #site-features .site-wrap { width: auto; margin-inline: clamp(16px, 2.6vw, 48px); max-width: none; }

/* "Why Kshan?" gets the same thin box as the features group */
.site #site-why .site-wrap { border: 1px solid color-mix(in srgb, var(--text) 16%, transparent); border-radius: 22px; padding: clamp(22px, 3.6vh, 44px) clamp(18px, 2.4vw, 40px); box-sizing: border-box; width: auto; max-width: none; margin-inline: clamp(16px, 2.6vw, 48px); }

/* the two boxes sit closer together */
.site #site-features { padding-bottom: 0; }
.site #site-why { padding-top: clamp(14px, 2.4vh, 28px); }

/* Ask your data */
.ask-page { max-width: 860px; margin: 0 auto; padding: 24px 16px 60px; }
.ask-page h1 { margin: 0 0 4px; }
.ask-form { display: flex; gap: 8px; margin: 18px 0 10px; }
.ask-form input { flex: 1; font-size: 16px; padding: 10px 14px; border-radius: 12px; }
.ask-ex { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ask-ex .chip { border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 4px 11px; font-size: 12.5px; cursor: pointer; }
.ask-ex .chip:hover { color: var(--text); border-color: var(--accent); }
.ask-note { margin: 4px 0 16px; }
.ask-card { border: 1px solid var(--border); background: var(--surface); border-radius: 14px; padding: 16px 18px; margin-bottom: 14px; }
.ask-q { margin: 0 0 8px; font-weight: 600; color: var(--muted); }
.ask-a { margin: 0 0 8px; font-size: 17px; line-height: 1.5; }
.ask-hl { margin: 0 0 8px; padding-left: 20px; }
.ask-cv { margin: 6px 0; font-size: 13px; color: var(--muted); }
.ask-how { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; }
.ask-step { margin: 6px 0; }
.ask-step summary { cursor: pointer; }
.ask-sql { background: var(--surface-2, rgba(127,127,127,.12)); border-radius: 8px; padding: 8px 10px; font-size: 12px; overflow: auto; white-space: pre-wrap; }
.ask-tbl { overflow: auto; max-height: 260px; margin: 6px 0; }
.ask-tbl table { border-collapse: collapse; font-size: 12.5px; }
.ask-tbl th, .ask-tbl td { padding: 3px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.ask-err { color: var(--err, #d92d4b); margin: 4px 0; }

/* nested folders */
.nav-folder .nav-folder { margin: 1px 0; }
.nav-folder-head[draggable="true"] { cursor: grab; }
.nav-unfiled { min-height: 6px; }
.dragging .nav-unfiled { min-height: 34px; margin-top: 8px; border: 1px dashed var(--border); border-radius: 8px; }
.dragging .nav-unfiled::before { content: 'Drop here for the top level'; display: block; padding: 5px 8px; font-size: 11px; color: var(--muted); }
.nav-unfiled.drop-on, .nav-folder.drop-on > .nav-folder-row { background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 8px; }

/* stale-data state: a panel whose source stopped refreshing (or failed) is dimmed and says so */
.card.is-stale .card-body, .card.is-source-error .card-body { opacity: 0.55; filter: saturate(0.6); }
.card.is-stale { border-color: #d97706; border-style: dashed; }
.card.is-source-error { border-color: #dc2626; border-style: dashed; }
.stale-pill { position: absolute; right: 8px; bottom: 6px; z-index: 3; max-width: calc(100% - 16px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 11px/1 var(--font, system-ui); padding: 4px 8px; border-radius: 999px; color: #fff; background: #b45309; pointer-events: auto; }
.card.is-source-error .stale-pill { background: #b91c1c; }
.alert-rule { flex-wrap: wrap; }
.alert-mute { font-size: 12px; padding: 3px 4px; max-width: 96px; }
.alert-rule-main .badge { margin-left: 4px; }
.badge.warn { color: #92400e; background: #fef3c7; }
.ask-policy { display: flex; flex-direction: column; gap: 6px; } .ask-blocked { display: flex; flex-direction: column; gap: 2px; max-height: 120px; overflow: auto; } .ask-sent { margin: 6px 0 0; }
.trust-more { margin: 14px 0 0; font-size: 15px; } .trust-more a { color: var(--accent, #d8532a); }
.tb-updated.has-stale { color: #d97706; font-weight: 600; }
#mfa-box label { flex-direction: row !important; justify-content: flex-start !important; text-align: left; } #mfa-box select { width: auto; }

body.no-create .nav-add { display: none; }
.roles-table td:first-child { text-align: left; }
.roles-help { margin: 6px 0; }
