/* web/pages/dashboard/dashboard.css — [DBX1 dashboard-page-v1]

   The Dashboard page, built by pages/dashboard/dashboard.js.

   SCOPING: every selector in this file starts with #view-dashboard, with no
   exceptions. That is not style, it is a correctness requirement — almost
   every class this page touches is SHARED:
     .dashv        is `.dashv, .brsv` in boot/overrides.css:17-23 (Sessions)
     .db-card .db-cards .db-k .db-v .db-s .db-sub .db-bar .db-2col
                   are app.css:750-771, reachable from other views
     .cpg-switch   is connectors_page.css:62 (the Connectors overlay)
     .cn-chip      is app.css:762-771, also painted by the Connectors overlay
     .set-hint     is shared with Workflows, Devices, Sessions and Tools
     .db-chips     is `.dashv .db-chips` in boot/overrides.css:27
   An unscoped rule here would silently restyle every one of them.

   The page's own markup uses a `dbx-` prefix instead, so the only shared
   names left in this sheet are the four the page cannot rename because
   app.js creates them at paint time:
     .cn-chip / .cn-chip .dot   (paintDashboard's chip loop)
     .db-s                      (the injected #db-cost-measured line)
     .cpg-switch                (the smart-routing switch structure app.js
                                 assumes when it round-trips /routing/prefs)
   All four are written #view-dashboard-scoped.

   NO literal hex and no !important anywhere: every colour, radius and family
   resolves through brandkit.css / theme_b.css, which are declared for both
   the dark :root and :root[data-theme="light"], so the page themes correctly
   in one pass. app.css's own .cn-chip colours are raw hex (#22c55e / #f59e0b
   / #ef4444) and do NOT theme; they are re-pointed at the tokens below —
   scoped, so the Connectors overlay keeps the old look.

   TYPE: same desktop-era inheritance as every other page — .db-v is 26px and
   .cn-chip is 15.5px in app.css, sized for a 2019 desktop shell. Corrected
   per-selector onto the kit's 12-15 band (with the two deliberate display
   numbers larger), with a measure cap on prose. --f-sm itself is untouched:
   38 other declarations depend on it. */

#view-dashboard.view.active {
  overflow-y: auto;
  min-height: 0;
}

#view-dashboard .dbx-page {
  max-width: none;
  width: 100%;
  box-sizing: border-box;
  padding: 24px 34px 72px;
  font-family: var(--font);
}

/* ------------------------------------------------------------------ head */

#view-dashboard .dbx-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

#view-dashboard .dbx-lede {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-muted);
  margin: 0;
  max-width: 70ch;
}

#view-dashboard .dbx-acts { display: flex; align-items: center; gap: 8px; flex: none; }

/* The refresh control stays on the PAGE, top-right of its own header — same
   shape and position as .tlsx-icon on Tools and .sesx-icon on Sessions. It is
   deliberately NOT in the shared navbar: it refreshes this view only. */
#view-dashboard .dbx-icon {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1;
  padding: 8px 11px;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-btn);
  cursor: pointer;
}
#view-dashboard .dbx-icon:hover {
  color: var(--text);
  border-color: var(--border-hover);
  background: var(--surface-2);
}

/* ------------------------------------------------------------ bento grid

   Four equal tracks. Money saved and System each take two, so row 1 reads
   [ money x2 ][ privacy ][ questions ] and row 2 [ system x2 ][ learning x2 ].
   The connectors bar takes all four. Equal cards gave the old page no
   hierarchy at all; the headline number now occupies twice the area of
   anything beside it. */

#view-dashboard .dbx-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

#view-dashboard .dbx-span2 { grid-column: span 2; }
#view-dashboard .dbx-span4 { grid-column: 1 / -1; }

/* ---- card chrome --------------------------------------------------------
   One thin edge all the way round, plus a thicker rail down the left so a
   card reads as a card at a glance. Both are theme-coloured: blue on light,
   lime on dark, matching the connector chips corrected earlier.

   The rail is `border-left`, NOT a ::before strip. A pseudo-element would
   need its own radius to follow the card's rounded corners and would still
   show a hairline seam where the two curves meet; a border is mitred by the
   browser against `border-radius` so the corner transition is exact.

   Locals rather than raw colours so the light override below is two lines
   instead of a dozen. Dark is the default here because the app's own :root
   is dark; light is the override, exactly as theme_b.css does it. */
#view-dashboard {
  --dbx-edge: var(--success-tint-border);      /* muted lime */
  --dbx-rail: var(--success);                  /* bright lime */
  --dbx-ico: var(--success);
  --dbx-shadow: 0 1px 2px rgb(0 0 0 / 28%), 0 6px 18px rgb(0 0 0 / 22%);
  --dbx-shadow-hi: 0 2px 4px rgb(0 0 0 / 32%), 0 14px 32px rgb(0 0 0 / 30%),
                   0 0 0 1px var(--success-tint-border);
}
:root[data-theme="light"] #view-dashboard {
  --dbx-edge: var(--tb-accent-soft);           /* soft blue */
  --dbx-rail: var(--tb-accent-text);           /* deep blue */
  --dbx-ico: var(--tb-accent-text);
  --dbx-shadow: 0 1px 2px rgb(16 32 84 / 6%), 0 6px 16px rgb(16 32 84 / 7%);
  --dbx-shadow-hi: 0 2px 6px rgb(16 32 84 / 9%), 0 14px 30px rgb(16 32 84 / 12%);
}

#view-dashboard .dbx-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid var(--dbx-edge);
  border-left: 3px solid var(--dbx-rail);
  border-radius: var(--radius-card);
  background: var(--surface);
  padding: 18px 20px;
  box-shadow: var(--dbx-shadow);
  transition: box-shadow .16s ease, transform .16s ease, border-color .16s ease;
}

/* Lift on hover. translateY only — no scale, which would blur text on a
   non-retina display. The connectors bar is excluded: it is a control, and a
   full-width card that jumps under the cursor reads as a misclick. */
#view-dashboard .dbx-card:not(.dbx-cn):hover {
  box-shadow: var(--dbx-shadow-hi);
  transform: translateY(-2px);
}

@media (prefers-reduced-motion: reduce) {
  #view-dashboard .dbx-card { transition: none; }
  #view-dashboard .dbx-card:not(.dbx-cn):hover { transform: none; }
}

/* ----------------------------------------------------------- card pieces */

/* Card title: icon + label on one baseline. The icon carries the theme
   colour; the label stays muted so the number below it leads. */
#view-dashboard .dbx-k {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: .05em;
  text-transform: uppercase;
  line-height: 1.3;
  color: var(--text-muted);
  margin-bottom: 10px;
}

#view-dashboard .dbx-ico {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--dbx-ico);
}

/* ---- the display number -------------------------------------------------
   Tabular figures so a changing number does not shuffle the digits beside
   it, and a tighter track because at 34px the default spacing reads loose. */
#view-dashboard .dbx-big {
  font-size: 34px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  margin-bottom: 6px;
}

/* An em dash or a bare 0 is not a value, it is the absence of one. The
   module tags those with .dbx-empty (a MutationObserver, because app.js
   writes the text and knows nothing about this styling) so a glance never
   reads "nothing yet" with the same weight as a measured result. */
#view-dashboard .dbx-big.dbx-empty {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 26px;
}

#view-dashboard .dbx-money .dbx-big { font-size: 40px; }

#view-dashboard .dbx-v {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
}

/* .db-s is NOT this page's class — app.js injects #db-cost-measured with
   className "db-s" ([P2 C12 dash-truth-v1], the auditable server-meter line).
   It is matched here so that line reads like the rest of the card instead of
   inheriting app.css's desktop size. Scoped, so no other view moves. */
#view-dashboard .dbx-s,
#view-dashboard .db-s {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-muted);
  margin: 0;
  max-width: 70ch;
}

#view-dashboard .dbx-ok  { color: var(--success-text); }
#view-dashboard .dbx-dim { color: var(--text-muted); }

#view-dashboard .dbx-2col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 10px 0 12px;
}

/* ---- progress bars ------------------------------------------------------
   Thicker and fully rounded, including the FILL: a square-ended fill inside
   a rounded track looks like a rendering bug at the left end. The track
   loses its border — at 8px the border was most of what you saw. */
#view-dashboard .dbx-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  margin-bottom: 8px;
}
#view-dashboard .dbx-bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--dbx-rail);
  transition: width .35s cubic-bezier(.4, 0, .2, 1);
}
@media (prefers-reduced-motion: reduce) {
  #view-dashboard .dbx-bar i { transition: none; }
}

/* ---- gateway status dot -------------------------------------------------
   app.js toggles .ok / .bad on the wrapper (it is the only thing that knows
   the state; CSS cannot read text). Neutral grey until the first paint, so
   a cold page never claims "connected". */
#view-dashboard .dbx-gw {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
#view-dashboard .dbx-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--border-hover);
  transition: background .16s ease, box-shadow .16s ease;
}
#view-dashboard .dbx-gw.ok .dbx-dot {
  background: var(--dbx-rail);
  box-shadow: 0 0 0 3px var(--dbx-edge);
}
#view-dashboard .dbx-gw.bad .dbx-dot { background: var(--danger); }

/* ---- smart routing: checkbox rendered as a switch -----------------------
   The INPUT itself is restyled with `appearance: none` rather than hidden
   behind an extra span. app.js owns this markup — it reads #db-c5.checked,
   binds change on it and disables it when an admin pinned the setting — so
   label.cpg-switch > input#db-c5 + span#db-c5-word has to stay exactly as it
   is. Styling the input in place changes nothing it can observe. */
#view-dashboard .cpg-switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
}
#view-dashboard .cpg-switch input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 34px;
  height: 19px;
  flex: none;
  margin: 0;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease;
}
#view-dashboard .cpg-switch input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform .16s ease, background .16s ease;
}
#view-dashboard .cpg-switch input[type="checkbox"]:checked {
  background: var(--dbx-rail);
  border-color: var(--dbx-rail);
}
#view-dashboard .cpg-switch input[type="checkbox"]:checked::after {
  transform: translateX(15px);
  background: var(--surface);
}
#view-dashboard .cpg-switch input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
#view-dashboard .cpg-switch input[type="checkbox"]:disabled {
  opacity: .5;
  cursor: not-allowed;
}
#view-dashboard .cpg-switch input[type="checkbox"]:disabled + span { opacity: .6; }
@media (prefers-reduced-motion: reduce) {
  #view-dashboard .cpg-switch input[type="checkbox"],
  #view-dashboard .cpg-switch input[type="checkbox"]::after { transition: none; }
}

/* ---- connectors bar chevron --------------------------------------------
   An SVG now, so it rotates instead of swapping glyph. The module keeps
   setting aria-expanded on the button; the rotation follows that rather
   than a second class, so the two can never disagree. */
#view-dashboard .dbx-cn-chev {
  display: inline-flex;
  flex: none;
  line-height: 1;
  color: var(--text-muted);
}
#view-dashboard .dbx-chev-ico {
  transition: transform .18s ease;
  color: var(--text-muted);
}
#view-dashboard .dbx-cn-head[aria-expanded="true"] .dbx-chev-ico {
  transform: rotate(90deg);
  color: var(--dbx-ico);
}
#view-dashboard .dbx-cn-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
#view-dashboard .dbx-pick-chev {
  width: 13px;
  height: 13px;
  color: var(--text-muted);
  opacity: .7;
  transition: transform .16s ease;
}
#view-dashboard .dbx-pick-btn[aria-expanded="true"] .dbx-pick-chev {
  transform: rotate(180deg);
  color: var(--dbx-ico);
}
@media (prefers-reduced-motion: reduce) {
  #view-dashboard .dbx-chev-ico,
  #view-dashboard .dbx-pick-chev { transition: none; }
}
#view-dashboard .dbx-money .dbx-bar > i { background: var(--success); }

/* A quiet secondary block pinned to the bottom of a card, so cards of
   different content heights still line their footers up. */
#view-dashboard .dbx-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
#view-dashboard .dbx-foot .dbx-v { font-size: 15px; margin: 2px 0; }

/* ------------------------------------------------------------ system rows */

#view-dashboard .dbx-rows { display: flex; flex-direction: column; }

#view-dashboard .dbx-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 0;
  border-top: 1px solid var(--border);
}
#view-dashboard .dbx-row:first-child { border-top: 0; padding-top: 0; }

#view-dashboard .dbx-rk {
  flex: 0 0 132px;
  font-size: 12.5px;
  color: var(--text-muted);
}
#view-dashboard .dbx-rv {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
  overflow-wrap: anywhere;
}
#view-dashboard .dbx-rs {
  flex: 1 1 auto;
  text-align: right;
  font-size: 12px;
  color: var(--text-muted);
  min-width: 0;
}

/* ---- the model "Change" control -----------------------------------------
   Modelled on the chat composer's #modelpop .dd-btn / .dd-opt (brandkit.css):
   34px control, 13.5px type, --radius-input. Both rows get the SAME fixed
   width so the two buttons line up — they sat at different widths before
   because a <select> sizes itself to its longest option. */

#view-dashboard .dbx-pick {
  position: relative;
  margin-left: auto;
  flex: none;
  display: inline-block;
}

#view-dashboard .dbx-pick-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 112px;                /* identical on both rows */
  height: 30px;
  padding: 0 10px;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-input);
  cursor: pointer;
}
#view-dashboard .dbx-pick-btn:hover { color: var(--text); border-color: var(--border-hover); }
#view-dashboard .dbx-pick-btn[aria-expanded="true"] {
  color: var(--text);
  border-color: var(--accent);
}

#view-dashboard .dbx-pick-pop {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  z-index: 40;
  width: 230px;
  /* Fixed and deliberately SHORT. A tall popover is the wrong trade here:
     it runs past the viewport and makes the whole dashboard scroll, which
     defeats the point of the one-screen layout. ~7 rows, then scroll inside
     the popover with the thin thumb below. Both pickers get the same height
     so they read as one control in two places. */
  max-height: 238px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-card);
  box-shadow: 0 10px 28px rgb(0 0 0 / 22%);
}

/* The lower picker opens UPWARD. Both rows sit near the bottom of the System
   card, so a downward menu from the second one pushes past the fold; opening
   up keeps it inside the same screen. No ancestor clips it — .dbx-card,
   .dbx-grid, .dbx-page and .dbx-row all leave overflow visible (checked). */
#view-dashboard .dbx-pick-pop.up {
  top: auto;
  bottom: calc(100% + 5px);
}

/* Thin, themed scrollbar — the default track is a 16px grey slab that
   dominates a 230px popover. Matches the kit's 6px treatment used on
   #convlist and #modelpop .dd-list. */
#view-dashboard .dbx-pick-pop::-webkit-scrollbar { width: 6px; }
#view-dashboard .dbx-pick-pop::-webkit-scrollbar-track { background: transparent; }
#view-dashboard .dbx-pick-pop::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 99px;
}
#view-dashboard .dbx-pick-pop::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

#view-dashboard .dbx-pick-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.3;
  padding: 7px 10px;
  border: 0;
  border-radius: var(--radius-btn);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#view-dashboard .dbx-pick-opt:hover { background: var(--surface-2); color: var(--text); }
#view-dashboard .dbx-pick-opt.on {
  background: var(--selected-fill);
  color: var(--tb-accent-text);
  font-weight: 600;
}

#view-dashboard .dbx-mdot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex: none;
  margin-right: 7px;
  vertical-align: middle;
}
#view-dashboard .dbx-mdot.on {
  background: var(--success);
  box-shadow: 0 0 6px var(--success-tint-border);
}
:root[data-theme="light"] #view-dashboard .dbx-mdot.on {
  background: var(--accent);
  box-shadow: 0 0 6px var(--tb-accent-soft);
}
#view-dashboard .dbx-mdot.off {
  background: var(--text-muted);
  box-shadow: none;
  opacity: 0.6;
}

#view-dashboard .dbx-badge-soon {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

#view-dashboard .dbx-pick-empty {
  margin: 0;
  padding: 8px 10px;
  font-size: 12.5px;
  color: var(--text-muted);
}

#view-dashboard .dbx-mini {
  margin-left: auto;
  flex: none;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 550;
  padding: 5px 11px;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-btn);
  cursor: pointer;
}
#view-dashboard .dbx-mini:hover {
  color: var(--text);
  border-color: var(--border-hover);
  background: var(--surface-2);
}

/* .cpg-switch is connectors_page.css's class, kept verbatim because app.js's
   /routing/prefs round-trip assumes exactly this structure (label wrapping
   the #db-c5 checkbox and the #db-c5-word span). Only spacing is set here. */
#view-dashboard .dbx-row-sw .cpg-switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
#view-dashboard .dbx-row-sw .cpg-switch input { accent-color: var(--accent); cursor: pointer; }
#view-dashboard .dbx-row-sw .cpg-switch input:disabled { cursor: not-allowed; }

/* ------------------------------------------------- connectors bar (row 3)

   ONE full-width bar, COLLAPSED BY DEFAULT so the five cards above fit a
   single screen with no scrolling. The collapsed header carries a live
   summary ("Connectors · 41 on of 58") so collapsing hides detail, never
   information. */

#view-dashboard .dbx-cn { padding: 0; }

#view-dashboard .dbx-cn-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: var(--radius-card);
  padding: 15px 20px;
  cursor: pointer;
}
#view-dashboard .dbx-cn-head:hover { background: var(--surface-2); }
#view-dashboard .dbx-cn-head:focus-visible { outline: 1px solid var(--accent); outline-offset: -2px; }

#view-dashboard .dbx-cn-sum {
  font-size: 12.5px;
  font-weight: 400;
  color: var(--text-muted);
}

#view-dashboard .dbx-cn-body { padding: 0 20px 18px; }
#view-dashboard .dbx-cn-hint { margin-bottom: 14px; }
#view-dashboard .dbx-cn-hint em { font-style: normal; font-weight: 600; color: var(--warning); }

/* The group boxes are created by dashboard.js's chipHost(), one per group
   that actually has a live connector — a group with none is never created,
   so no empty heading can render. */
#view-dashboard .dbx-cngrp { margin-bottom: 14px; }
#view-dashboard .dbx-cngrp:last-child { margin-bottom: 0; }

#view-dashboard .dbx-cngrp-h {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .05em;
  text-transform: uppercase;
  line-height: 1.3;
  /* --text-dim, not --text-muted: these are navigation landmarks in a wall
     of 58 chips. At 11px uppercase, muted grey on the light surface drops
     below readable and the groups stop reading as groups. */
  color: var(--text-dim);
  margin: 0 0 8px;
}

#view-dashboard .dbx-cngrp-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

/* .cn-chip is app.js's class (paintDashboard builds every chip). app.css
   sizes it at 15.5px and colours it with raw hex that does not theme. Both
   are re-pointed here, scoped — the Connectors overlay keeps app.css's look. */
#view-dashboard .cn-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  background: transparent;
}
#view-dashboard .cn-chip .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: none;
}
#view-dashboard .cn-chip.on   { color: var(--success-text); border: 1px solid var(--success-tint-border); }
#view-dashboard .cn-chip.on .dot   { background: var(--success); }
/* D11 amber: "you switched it off", never "broken". */
#view-dashboard .cn-chip.off  { color: var(--warning); border: 1px solid var(--warning-tint-border); }
#view-dashboard .cn-chip.off .dot  { background: var(--warning); }
#view-dashboard .cn-chip.down { color: var(--danger); border: 1px solid var(--danger-tint-border); }
#view-dashboard .cn-chip.down .dot { background: var(--danger); }
#view-dashboard .cn-chip:hover { border-color: var(--border-hover); background: var(--surface-2); }

/* ---- "connected" is LIME on dark, BLUE on light -------------------------
   The lime above is correct on the dark surface and illegible on the light
   one: --success stays lime in both themes (theme_b keeps it as a FILL
   token), so on #F4F6FE a lime chip reads as "nothing in particular" rather
   than "this is live". Light mode switches the connected state to the
   accent blue, which is the only colour on that page a user already reads
   as active.

   OFF stays amber in BOTH themes on purpose — amber means "you switched it
   off", and that meaning must not move when the theme does.

   These two rules do not START with #view-dashboard, but they still CONTAIN
   it, so they cannot match outside this view. */
:root[data-theme="light"] #view-dashboard .cn-chip.on {
  color: var(--tb-accent-text);
  border-color: var(--accent);
}
:root[data-theme="light"] #view-dashboard .cn-chip.on .dot {
  background: var(--accent);
}

/* .set-hint is shared with Workflows / Devices / Sessions / Tools; app.js
   uses it for the "No connectors reported" fallback inside #db-chips. */
#view-dashboard .set-hint {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-muted);
  margin: 0;
  max-width: 70ch;
}

/* ---- [DBX2] connector chip hover card ------------------------------------
   Built by pages/dashboard/dashboard.js (wireHover). Status colours follow
   the chips: ON lime on dark / blue on light, OFF amber in both themes (you
   switched it off), OFFLINE red. Solid panel background - no tint, so the
   chips under it never show through the text. */
#view-dashboard .dbx-hc {
  position: fixed;
  z-index: 70;
  width: 300px;
  max-width: calc(100vw - 16px);
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-card);
  background: var(--tb-bg-panel);
  box-shadow: var(--shadow-pop);
  color: var(--text);
  pointer-events: none;
}
#view-dashboard .dbx-hc-top {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
#view-dashboard .dbx-hc-t {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 650;
}
#view-dashboard .dbx-hc-st {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px;
  border: 1px solid var(--success-tint-border);
  border-radius: 999px;
  color: var(--success-text);
  font-size: 11.5px;
  font-weight: 700;
}
#view-dashboard .dbx-hc-st i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
}
#view-dashboard .dbx-hc.is-off .dbx-hc-st { border-color: var(--warning-tint-border); color: var(--warning); }
#view-dashboard .dbx-hc.is-off .dbx-hc-st i { background: var(--warning); }
#view-dashboard .dbx-hc.is-down .dbx-hc-st { border-color: var(--danger-tint-border); color: var(--danger); }
#view-dashboard .dbx-hc.is-down .dbx-hc-st i { background: var(--danger); }
:root[data-theme="light"] #view-dashboard .dbx-hc.is-on .dbx-hc-st { border-color: var(--accent); color: var(--tb-accent-text); }
:root[data-theme="light"] #view-dashboard .dbx-hc.is-on .dbx-hc-st i { background: var(--accent); }
#view-dashboard .dbx-hc-why {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-muted);
}
#view-dashboard .dbx-hc-d {
  margin: 8px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-dim);
}
#view-dashboard .dbx-hc-foot {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ---- [hidden] must always win -------------------------------------------
   #db-cn-body is toggled with `hidden`. Any rule in this sheet that set
   `display` on it would outrank the UA's `[hidden] { display: none }` and the
   bar would never collapse — the defect falsifiers/f_t3.py's "t11 hidden wins
   over display:flex" exists to catch. Nothing here matches a hidden element
   today (checked); this line keeps that true if someone adds one later. */
#view-dashboard [hidden] { display: none; }

/* ------------------------------------------------------------ narrow view

   boot/mobile.css:28 gave `.dashv` an `overflow-x: auto` escape hatch on
   narrow screens. The grid below never overflows — the tracks collapse — so
   that hatch is not reproduced; the layout simply reflows. */

@media (max-width: 1100px) {
  #view-dashboard .dbx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #view-dashboard .dbx-span2 { grid-column: span 2; }
}

@media (max-width: 760px) {
  #view-dashboard .dbx-page { padding: 18px 14px 56px; }
  #view-dashboard .dbx-head { flex-direction: column; gap: 12px; }
  #view-dashboard .dbx-grid { grid-template-columns: minmax(0, 1fr); }
  #view-dashboard .dbx-span2 { grid-column: span 1; }
  #view-dashboard .dbx-money .dbx-big { font-size: 34px; }
  #view-dashboard .dbx-rk { flex: 0 0 100%; }
  #view-dashboard .dbx-rs { text-align: left; }
  #view-dashboard .dbx-pick,
  #view-dashboard .dbx-mini { margin-left: 0; }
}
