/* dash.css · ONE dashboard (10/16; brand 10/29): layout, panels, KPI tiles, goals, tips. Calm and dense on the brand tokens
   (shared/brand.css): one weight of border, the ok colour only for profit and progress, the bad colour only for real
   problems; the text on the bad fill is the page colour (black on orange, white on the light theme's red). AA contrast. */
:root { --pos: var(--ma-ok); --pos-fill: var(--ma-ok); --neg: var(--ma-bad); --neg-fill: var(--ma-bad); --on-neg: var(--ma-bg);
  --track: var(--ma-surface-2); --panel: var(--ma-surface); --line: var(--ma-border); }
.pos { color: var(--pos); } .neg { color: var(--neg); }
.dash-mode .main { max-width: 1400px; }
.dash-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 16px; margin: 4px 0 16px; }
.dash-head h1 { font-size: 1.35rem; font-weight: 650; letter-spacing: -0.02em; margin: 0 0 2px; }
.dash-head p { margin: 0; }
.dash-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.updated { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.crit-banner { margin: 0 0 12px; }
.crit-link { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 14px; border-radius: var(--ma-radius-sm); font-weight: 600;
  background: var(--neg-fill); color: var(--on-neg); text-decoration: none; }
.crit-link::before { content: "!"; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: var(--on-neg); color: var(--neg-fill); font-weight: 800; font-size: 0.8rem; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--ma-radius); padding: 16px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.panel-head h2 { font-size: 0.95rem; font-weight: 650; margin: 0; letter-spacing: -0.005em; }
.panel-kpis { padding: 0; background: none; border: 0; margin-bottom: 16px; }
.dash-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }

.kpis { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--ma-radius); padding: 12px 14px; min-width: 0;
  display: flex; flex-direction: column; gap: 2px; }
.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.kpi-label { font-size: 0.74rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 0; line-height: 1.3; }
.kpi-value { font-size: 1.45rem; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin: 2px 0 0; line-height: 1.2; overflow-wrap: anywhere; }
.kpi-sub { font-size: 0.8rem; color: var(--muted); margin: 0; line-height: 1.35; }
.kpi-meta { font-size: 0.72rem; color: var(--muted); margin: auto 0 0; padding-top: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.kind { display: inline-block; border: 1px solid var(--muted); border-radius: 999px; padding: 0 7px; font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.02em; color: var(--foreground); line-height: 1.5; white-space: nowrap; }
.kind-e { border-style: dashed; } .kind-n { border-style: dotted; color: var(--muted); }
.asof { white-space: nowrap; }

.bar { display: block; height: 6px; border-radius: 999px; background: var(--track); overflow: hidden; margin: 8px 0 4px; }
.bar-fill { display: block; height: 100%; border-radius: 999px; background: var(--foreground); }
.bar-fill.pos { background: var(--pos-fill); } .bar-fill.neg { background: var(--neg-fill); }

.goals { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.goal { border-top: 1px solid var(--line); padding-top: 10px; min-width: 0; }
.goal:first-child { border-top: 0; padding-top: 0; }
.goal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.goal-head h3 { font-size: 0.82rem; font-weight: 600; margin: 0; }
.goal-pct { white-space: nowrap; font-size: 0.82rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.goal-value { font-size: 1.25rem; font-weight: 650; font-variant-numeric: tabular-nums; margin: 4px 0 0; letter-spacing: -0.015em; }
.goal-sub { font-size: 0.8rem; color: var(--muted); margin: 0; }

.tip { display: inline-flex; vertical-align: middle; }
.tip-btn { width: 24px; height: 24px; min-width: 24px; border-radius: 50%; border: 1px solid var(--muted); background: transparent;
  color: var(--muted); font: italic 700 0.72rem/1 Georgia, serif; cursor: help; display: inline-grid; place-items: center; padding: 0; }
.tip-btn:hover, .tip.open .tip-btn { color: var(--foreground); border-color: var(--foreground); }
.tip-bubble { display: none; position: fixed; z-index: 40; padding: 10px 12px; border-radius: var(--ma-radius-sm); background: var(--foreground);
  color: var(--background); font: 400 0.78rem/1.45 var(--mono); white-space: pre-line; text-align: left; overflow-wrap: anywhere;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.18); max-height: 50vh; overflow: auto; }
.tip.open .tip-bubble { display: block; }
@media (hover: hover) { .tip:hover .tip-bubble { display: block; } }
.tip:focus-within .tip-bubble { display: block; }

.notwired, .readfail { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--muted); }
.empty { color: var(--muted); font-style: normal; font-size: 0.9rem; margin: 4px 0; }
.allclear { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 0.9rem; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--muted); flex: none; }
.dot-ok { background: var(--pos-fill); border-color: var(--pos-fill); }
.dot-attention { background: transparent; border-color: var(--foreground); }
.dot-paused { background: var(--muted); border-color: var(--muted); }
.link { font-size: 0.85rem; font-weight: 600; }

@media (min-width: 720px) {
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .goals { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .goal { border-top: 0; padding-top: 0; border-left: 1px solid var(--line); padding-left: 14px; }
  .goal:first-child { border-left: 0; padding-left: 0; }
}
@media (min-width: 1040px) {
  .dash-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .panel-alerts { grid-column: span 5; } .panel-goals { grid-column: span 7; } .panel-portfolio { grid-column: 1 / -1; }
  .panel-channels, .panel-top, .panel-core13 { grid-column: span 4; }
  .kpi-value { font-size: 1.6rem; }
}
@media (max-width: 599px) {
  .topbar { flex-wrap: nowrap; } .topbar .select-company { display: none; } .topbar .btn-ghost { white-space: nowrap; padding: 10px 8px; }
}
