/* ===================================================================
   wygge — Start-Dashboard chart strip (dashboard_charts.jsx, round 5)
   Brand Guidelines 2026 tokens only (theme.css / dashboard.css). The four palettes define the chart
   studio's --ad-viz-1..5 ramp ON THE CARD; crm_charts.jsx resolves the ramp on the rendered element
   (custom properties inherit), so the CRM's own charts are untouched.
   =================================================================== */

/* ── Palettes (the chart studio reads --ad-viz-1..5) ─────────────── */
/* FND-403: these class ramps serve the unbranded tenant ONLY (every tile tone + the accent = the wygge stock —
   dashboard_charts.jsx dashChartRamps `branded: false`). A branded tenant's card carries its OWN ramp as inline
   --ad-viz-1..5 (Design-Studio tile colours + accent, measured against the card), which beats these class rules.
   Ampel stays the status tokens.
   Area dashboards (2026-10-08): every CI colour that HAS a token is referenced by it — Deep var(--ad-brand), Process
   var(--ad-process), Cocoon var(--ad-cocoon) and the Signal ONLY as var(--ad-accent), so no lime literal is left and the
   Signal always follows the accent. The hand-tuned intermediate greens have no token and stay literal; they can only ever
   show on the stock theme. Single var() references only — crm_charts.jsx hands the custom property's value straight to
   the chart library (West Coast Charts parses plain colours, not color-mix()). */
/* brand = the Deep→Mist ramp, ordered light/dark alternating so adjacent categories stay distinguishable. */
.dash-pal-brand { --ad-viz-1: var(--ad-brand); --ad-viz-2: #7fa28f; --ad-viz-3: var(--ad-process); --ad-viz-4: #b9cfc0; --ad-viz-5: #2d5a4b; }
.dash-pal-signal { --ad-viz-1: var(--ad-accent); --ad-viz-2: var(--ad-process); --ad-viz-3: var(--ad-brand); --ad-viz-4: var(--ad-cocoon); --ad-viz-5: #7fa28f; }
.dash-pal-ampel { --ad-viz-1: var(--ad-success); --ad-viz-2: var(--ad-warn); --ad-viz-3: var(--ad-danger); --ad-viz-4: var(--ad-info); --ad-viz-5: var(--ad-purple); }
.dash-pal-mono { --ad-viz-1: var(--ad-process); --ad-viz-2: #5b8272; --ad-viz-3: #7a9c8e; --ad-viz-4: #9bb6aa; --ad-viz-5: #bdd0c7; }
[data-theme="dark"] .dash-pal-brand { --ad-viz-1: var(--ad-accent); --ad-viz-2: #9fd3b4; --ad-viz-3: #6fa58a; --ad-viz-4: #4c8069; --ad-viz-5: var(--ad-cocoon); }
[data-theme="dark"] .dash-pal-signal { --ad-viz-1: var(--ad-accent); --ad-viz-2: #9fd3b4; --ad-viz-3: var(--ad-cocoon); --ad-viz-4: #6fa58a; --ad-viz-5: #4c8069; }
[data-theme="dark"] .dash-pal-mono { --ad-viz-1: #9fd3b4; --ad-viz-2: #7fb89b; --ad-viz-3: #6fa58a; --ad-viz-4: #578a73; --ad-viz-5: var(--ad-process); }

/* ── Strip ────────────────────────────────────────────────────────── */
.dash-charts { position: relative; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
/* Standalone strip: the gear sits ABOVE the strip, over the hero's bottom-right corner (the strip overlaps the
   hero by 30 px). On the Start-Dashboard (2026-10-01) the head is portaled into the ONE control row
   (.dash-controls-charts, between "Bearbeiten" and "Anpassen") and flows there. */
.dash-charts-head { position: absolute; right: 0; top: -38px; z-index: 2; display: flex; align-items: center; gap: 6px; }
.dash-controls-charts { display: inline-flex; align-items: center; }
.dash-controls-charts:empty { display: none; }
.dash-controls .dash-charts-head { position: static; z-index: auto; }
.dash-charts-gear {
  width: 28px; height: 28px; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0;
  color: #fff; background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 6px 16px rgba(0, 0, 0, 0.28);
  -webkit-backdrop-filter: blur(14px) saturate(150%); backdrop-filter: blur(14px) saturate(150%);
  transition: transform 180ms var(--dash-spring), background 140ms;
}
.dash-charts-gear:hover { background: rgba(255, 255, 255, 0.24); transform: rotate(30deg); }
.dash-charts-gear:focus-visible { outline: 2px solid var(--ad-accent); outline-offset: 2px; }
/* Light flush: the gear sits over the photo's blend into the LIGHT canvas — the light surface skin. */
:root:not([data-theme="dark"]) .dash-flush .dash-charts-gear { color: var(--ad-text); background: color-mix(in srgb, var(--ad-surface) 84%, transparent); border-color: var(--ad-border-strong); box-shadow: 0 4px 12px rgba(3, 36, 37, 0.14); }
.dash-charts-sync { font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--ad-warn-bg); color: var(--ad-warn-fg); }
/* Round 7: n columns = the M tiles per row below, gap = the tile gap — card i sits exactly on tile column i
   (grid-template-columns + gap are set inline from dashCols / DASH_GAP; 12 px here is only the fallback). */
.dash-charts-grid { display: grid; gap: 12px; }
.dash-charts-empty { display: flex; align-items: center; gap: 10px; padding: 18px; border-radius: var(--dash-radius); background: var(--dash-card); color: var(--dash-card-muted); font-size: 13px; box-shadow: var(--dash-card-shadow); }

/* ── Card (round 5c, DASHBOARD-SPEC-R5C §4): 100 px = 7 + head 20 + 3 + body 63 + 7 ───────────
   ONE-line head (14-px icon, title, value right-aligned tabular); the body (63 % of the card) is the chart.
   One type scale for every card: title 11.5/600 muted · value 15/700 · Kennzahl 22/700 · notes 10.5. */
.dash-chart {
  position: relative; box-sizing: border-box; height: 100px; min-width: 0; padding: 7px 9px; border-radius: var(--dash-radius);
  display: flex; flex-direction: column; gap: 3px; background: var(--dash-card); color: var(--dash-card-text); box-shadow: var(--dash-card-shadow);
  font-family: var(--ad-font-body); overflow: hidden;
}
.dash-chart-head {
  flex: 0 0 20px; height: 20px; display: flex; align-items: center; gap: 5px; min-width: 0; padding: 0 1px;
  border: none; background: none; text-align: left; cursor: pointer; color: inherit; font-family: inherit; border-radius: 6px;
}
.dash-chart-head:disabled { cursor: default; }
/* Per-slot quick edit (Peter 2026-10-01): the head row = the open button (flex) + a 20-px gear at its right end —
   two sibling buttons, so the head keeps its one-line 20-px rhythm (round 5c) and no button nests in a button. */
.dash-chart-top { flex: 0 0 20px; height: 20px; display: flex; align-items: center; gap: 2px; min-width: 0; }
.dash-chart-top .dash-chart-head { flex: 1 1 auto; min-width: 0; }
.dash-chart-quick {
  flex: 0 0 20px; width: 20px; height: 20px; padding: 0; border: none; border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--dash-card-muted); opacity: .62; transition: opacity 120ms, background 120ms;
}
.dash-chart:hover .dash-chart-quick, .dash-chart-quick:focus-visible, .dash-chart-quick[aria-expanded="true"] { opacity: 1; }
.dash-chart-quick:hover { background: color-mix(in srgb, var(--dash-card-text) 8%, transparent); }
.dash-chart-quick:focus-visible { outline: 2px solid var(--ad-accent-deep); outline-offset: 1px; }
/* FND-402: an empty 8-week window shown in calendar months says so next to the title. */
.dash-chart-span { flex-shrink: 0; font-size: 10px; font-weight: 600; color: var(--dash-card-text); padding: 0 5px; border-radius: 999px; border: 1px solid var(--dash-card-line); line-height: 14px; white-space: nowrap; }
.dash-chart-head:focus-visible { outline: 2px solid var(--ad-accent-deep); outline-offset: 1px; }
.dash-chart-ico { display: inline-flex; color: var(--dash-card-muted); flex-shrink: 0; }
.dash-chart-label { flex: 1 1 auto; font-size: 11.5px; line-height: 20px; font-weight: 600; color: var(--dash-card-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dash-chart-val { font-family: var(--ad-font-display); font-weight: 700; font-size: 15px; line-height: 20px; font-variant-numeric: tabular-nums; color: var(--dash-card-text); white-space: nowrap; flex-shrink: 0; }
.dash-chart-cap { font-size: 10.5px; line-height: 1.2; color: var(--dash-card-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dash-chart-delta { display: inline-flex; align-items: center; gap: 1px; flex-shrink: 0; font-size: 10.5px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dash-chart-delta.is-up { color: var(--dash-up-text); }
.dash-chart-delta.is-down { color: var(--dash-down-text); }
.dash-chart-delta.is-flat { color: var(--dash-card-muted); }
.dash-chart-body { position: relative; flex: 1 1 auto; min-height: 0; min-width: 0; }
.dash-chart-canvas-wrap, .dash-chart-canvas { position: absolute; inset: 0; }
.dash-chart-canvas canvas { max-width: 100%; }
/* Round kinds: a 56-px square in the middle of the body; rings carry the value in their hole. */
.dash-chart.is-round .dash-chart-canvas { inset: 0; margin: auto; width: 56px; height: 56px; }
.dash-chart-center { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; font-size: 13px; line-height: 1; }
.dash-chart-unknown { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 4px; font-size: 10.5px; color: var(--dash-card-muted); }
/* Empty state (a zero series is never drawn): muted label over a dashed baseline. */
.dash-chart-none { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; padding-bottom: 8px; pointer-events: none; }
.dash-chart-none-t { font-size: 10.5px; font-weight: 600; color: var(--dash-card-muted); white-space: nowrap; }
.dash-chart-none-line { align-self: stretch; height: 0; border-top: 1.5px dashed color-mix(in srgb, var(--dash-card-muted) 70%, transparent); }
.dash-chart-note { position: absolute; left: 0; right: 0; bottom: 0; font-size: 10px; line-height: 1.3; color: var(--ad-warn-fg); background: var(--ad-warn-bg); border-radius: 5px; padding: 1px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-chart-err { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 11px; font-weight: 600; color: var(--dash-card-muted); padding: 2px; }
/* Kennzahl: the value big on the left (+ caption / delta), the real sparkline filling the right. */
.dash-chart-num { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 8px; padding-bottom: 4px; }
.dash-chart-num-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex-shrink: 0; max-width: 100%; }
.dash-chart-big { font-size: 22px; line-height: 26px; }
.dash-chart-num-sub { display: flex; align-items: center; gap: 5px; min-width: 0; }
.dash-chart-spark { flex: 1 1 auto; min-width: 0; height: 34px; overflow: visible; margin-bottom: 4px; }
.dash-chart-spark path { fill: none; stroke: var(--ad-viz-3, var(--ad-accent-deep)); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dash-chart-spark.is-forecast path { stroke: var(--dash-card-muted); stroke-dasharray: 3 3; }
/* Loading: the chart's box stays (no layout shift), the md Logo-Pixel-Spinner assembles in its centre
   (the former gradient sweep is gone — one loading motif cockpit-wide). */
.dash-chart-skel {
  position: absolute; inset: 4px 2px 6px; border-radius: 8px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--dash-card-text) 5%, transparent);
}
.dash-chart.is-preview { box-shadow: none; border: 1px solid var(--ad-border); max-width: 260px; }

/* ── Quick-edit menu (DashChartQuick) ─────────────────────────────── */
/* The menu is long and opens over the busy strip + tiles: the glass gets a nearly opaque surface so it stays legible
   where the backdrop blur is missing (Playwright WebKit renders it without the blur — measured 2026-10-01). */
.dash-glass-menu:has(> .dash-cq) { background: color-mix(in srgb, var(--ad-surface) 94%, transparent); }
.dash-cq-sources { display: flex; flex-direction: column; max-height: 236px; overflow-y: auto; overscroll-behavior: contain; margin: 0 -2px; padding: 0 2px; }
.dash-cq-group { padding: 6px 9px 2px; font-size: 10.5px; font-weight: 700; color: var(--ad-text-subtle); }
.dash-cq .dash-menu-item { padding: 6px 9px; font-size: 12px; }
.dash-cq-label { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-cq-kinds { display: flex; flex-wrap: wrap; gap: 4px; padding: 2px 7px 6px; }
.dash-cq-chip {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-family: var(--ad-font-body); font-size: 11.5px; font-weight: 600; color: var(--ad-text);
  border-radius: 8px; padding: 4px 8px; background: var(--ad-surface); border: 1.5px solid var(--ad-border);
}
.dash-cq-chip.is-on { border-color: var(--ad-accent-deep); background: var(--ad-accent-bg); color: var(--ad-accent-fg); font-weight: 800; }
.dash-cq-chip:focus-visible { outline: 2px solid var(--ad-accent-deep); outline-offset: 1px; }

/* ── Configuration sheet ──────────────────────────────────────────── */
/* The sheet is rendered inside .dash-stage (DashGlass has no portal): undo the stage's white-on-dark
   button skin for the light glass. */
.dash-stage .dash-cs .dash-btn { background: var(--ad-surface); border-color: var(--ad-border-strong); color: var(--ad-text); }
.dash-stage .dash-cs .dash-btn:hover { background: var(--ad-surface-inset); }
.dash-stage .dash-cs .dash-btn-lime { background: var(--ad-accent); color: var(--ad-on-accent); border-color: transparent; }
.dash-stage .dash-cs .dash-btn-lime:hover { background: color-mix(in srgb, var(--ad-accent) 88%, var(--ad-brand)); }
.dash-stage .dash-cs .dash-btn-danger { background: var(--ad-danger-bg); color: var(--ad-danger-fg); border-color: transparent; }
.dash-stage .dash-cs .dash-btn:focus-visible { outline-color: var(--ad-accent-deep); }
.dash-cs { display: flex; flex-direction: column; min-height: 0; max-height: 72vh; }
.dash-cs-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 18px 10px; display: flex; flex-direction: column; gap: 10px; }
.dash-cs-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.dash-cs-item { display: flex; align-items: center; gap: 6px; padding: 4px; border-radius: 12px; border: 1px solid transparent; }
.dash-cs-item.is-on { border-color: color-mix(in srgb, var(--ad-accent-deep) 55%, transparent); background: color-mix(in srgb, var(--ad-surface) 70%, transparent); }
.dash-cs-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: none; background: none; cursor: pointer; text-align: left; font-family: var(--ad-font-body); color: var(--ad-text); border-radius: 9px; }
.dash-cs-pick:focus-visible { outline: 2px solid var(--ad-accent-deep); outline-offset: 1px; }
.dash-cs-no { width: 22px; height: 22px; flex-shrink: 0; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; background: var(--ad-brand); color: var(--ad-accent); }
.dash-cs-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dash-cs-meta { margin-left: auto; font-size: 11.5px; color: var(--ad-text-subtle); white-space: nowrap; }
.dash-cs-acts { display: inline-flex; gap: 4px; flex-shrink: 0; }
.dash-cs-acts .dash-icon-btn { width: 28px; height: 28px; }
.dash-cs-acts .dash-icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.dash-cs-rm { color: var(--ad-danger-fg); }
.dash-cs-add { align-self: flex-start; }
.dash-cs-edit { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 14px; background: color-mix(in srgb, var(--ad-surface) 78%, transparent); border: 1px solid var(--ad-border); }
.dash-cs-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.dash-cs-field .dash-set-cap { padding: 0; }
.dash-cs-field select, .dash-cs-field textarea {
  font-family: var(--ad-font-body); font-size: 12.5px; color: var(--ad-text); background: var(--ad-surface); border: 1px solid var(--ad-border-strong);
  border-radius: 9px; padding: 7px 9px; min-width: 0; box-sizing: border-box; width: 100%;
}
.dash-cs-field textarea { font-family: var(--ad-font-mono, 'JetBrains Mono', ui-monospace, monospace); font-size: 11.5px; resize: vertical; }
.dash-cs-chips, .dash-cs-pals { display: flex; flex-wrap: wrap; gap: 6px; }
.dash-cs-chip, .dash-cs-kind, .dash-cs-pal {
  cursor: pointer; font-family: var(--ad-font-body); font-size: 12px; font-weight: 600; color: var(--ad-text); border-radius: 9px; padding: 6px 10px;
  background: var(--ad-surface); border: 1.5px solid var(--ad-border); text-align: left;
}
.dash-cs-chip.is-on, .dash-cs-kind.is-on, .dash-cs-pal.is-on { border-color: var(--ad-accent-deep); background: var(--ad-accent-bg); color: var(--ad-accent-fg); font-weight: 800; }
.dash-cs-kinds { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
.dash-cs-pal { display: inline-flex; align-items: center; gap: 8px; }
.dash-cs-dots { display: inline-flex; gap: 2px; }
.dash-cs-dots i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08); }
.dash-cs-hint { font-size: 10.5px; color: var(--ad-text-subtle); }
.dash-cs-adv summary { cursor: pointer; font-size: 12px; font-weight: 700; color: var(--ad-text-muted); }
.dash-cs-adv[open] summary { margin-bottom: 6px; }
.dash-cs-err { font-size: 12px; font-weight: 700; color: var(--ad-danger-fg); }
.dash-cs-preview { padding: 10px; border-radius: 12px; background: var(--dash-page); }
.dash-cs-foot { flex-shrink: 0; display: flex; flex-direction: column; gap: 6px; padding: 10px 18px 14px; border-top: 1px solid color-mix(in srgb, var(--ad-brand) 8%, transparent); }
.dash-cs-foot-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dash-cs-spacer { flex: 1; }
.dash-cs-sync { font-size: 11.5px; color: var(--ad-text-subtle); }

/* Round 7: no narrower strip gap on phones — the strip's columns ARE the tile columns (gap = the tile gap, 12 px). */
@media (max-width: 560px) {
  .dash-cs-meta { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .dash-charts-gear, .dash-charts-gear:hover { transition: none; transform: none; }
}

/* FND-2014: the sheet's type button opens the tile editor */
.dash-cs-typebtn { display: inline-flex; align-items: center; gap: 8px; }
