/* Обзор, second pass (markup: dashboard.js). Loaded after contrast.css.
   - «Как считается» is an ⓘ button in the card header with a popover, not a footer row on every card
   - funnel hides empty stages behind «Пустые стадии · N»
   - sticky top bar gets a frosted plate on wallpapers so scrolled content does not show through it */

/* ---------- ⓘ «Как считается» ---------- */
#dashboard-workspace.hm .hm-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-2); }
#dashboard-workspace.hm .hm-card-head .hm-about { position: relative; flex: none; margin: -2px -4px 0 0; padding: 0; border: 0; }
#dashboard-workspace.hm .hm-card-head .hm-about > summary {
  display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border-radius: 50%;
  color: var(--muted); cursor: pointer; list-style: none;
}
#dashboard-workspace.hm .hm-card-head .hm-about > summary::before { content: none; }
#dashboard-workspace.hm .hm-card-head .hm-about > summary::-webkit-details-marker { display: none; }
#dashboard-workspace.hm .hm-card-head .hm-about > summary .icon { width: 16px; height: 16px; }
#dashboard-workspace.hm .hm-card-head .hm-about > summary:hover,
#dashboard-workspace.hm .hm-card-head .hm-about[open] > summary { background: var(--surface-2); color: var(--blue-text); }
#dashboard-workspace.hm .hm-card-head .hm-about > summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
#dashboard-workspace.hm .hm-about-pop {
  position: absolute; z-index: 25; top: calc(100% + 6px); right: 0; width: min(300px, 80vw); padding: var(--sp-3);
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--ink);
  box-shadow: 0 10px 28px var(--shadow-strong, rgb(16 24 40 / .18));
}
#dashboard-workspace.hm .hm-about-pop > b { display: block; margin-bottom: 4px; font-size: var(--fs-sm); }
#dashboard-workspace.hm .hm-about-pop .dash-note { margin: 0; font-size: var(--fs-xs); line-height: 1.5; color: var(--secondary); }

/* ---------- Funnel: empty stages folded ---------- */
#dashboard-workspace.hm .hm-funnel:not(.show-empty) [data-empty] { display: none; }
:root[data-theme] #dashboard-workspace.hm .hm-funnel-toggle {
  margin-top: var(--sp-2); padding: 4px 8px; border: 0; border-radius: var(--r-sm); background: none; box-shadow: none;
  color: var(--blue-text); font-size: var(--fs-xs); font-weight: 600; cursor: pointer;
}
:root[data-theme] #dashboard-workspace.hm .hm-funnel-toggle:hover { background: var(--surface-2); }

/* ---------- Top bar on a wallpaper (all pages) ---------- */
:root[data-portal-backdrop]:not([data-portal-backdrop=default]) #app .topbar {
  background: color-mix(in srgb, #0f1a2c 58%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid rgb(255 255 255 / .08);
}

/* ---------- Calm palette (business look) ----------
   Colour is kept only where it carries meaning: the overdue count, an overdue date, a risk marker.
   Icons are monochrome, reasons are plain secondary text, chips have no coloured fills. */

/* Icons: one neutral style for KPI and list icons */
:root[data-theme] :is(#dashboard-workspace.hm, .hm-modal) :is(.hm-kpi-icon, .hm-row-icon),
:root[data-theme] :is(#dashboard-workspace.hm, .hm-modal) :is(.hm-kpi-icon, .hm-row-icon)[class*="k-"] {
  background: var(--surface-2); color: var(--secondary); box-shadow: inset 0 0 0 1px var(--line);
}
:root[data-theme] #dashboard-workspace.hm .hm-kpi.alert .hm-kpi-icon { background: var(--surface-2); color: var(--danger-text); }

/* Overdue KPI: only the number is red; the card and the caption stay neutral */
:root[data-theme] #dashboard-workspace.hm .hm-kpi.alert { border-color: var(--line); }
:root[data-theme] #dashboard-workspace.hm .hm-kpi.alert .hm-kpi-sub { color: var(--secondary); font-weight: 500; }

/* Reasons («Истёк плановый срок · Нет запланированного действия …»): secondary text, a small marker shows the risk */
:root[data-theme] :is(#dashboard-workspace.hm, .hm-modal) .hm-row.risk .hm-row-reason,
:root[data-theme] #dashboard-workspace.hm .hm-project.risk .hm-row-reason { color: var(--secondary); font-weight: 400; }
:root[data-theme] #dashboard-workspace.hm .hm-project.risk .hm-row-reason::before {
  content: ''; display: inline-block; width: 6px; height: 6px; margin: 0 6px 1px 0; border-radius: 50%;
  background: var(--warning-text); vertical-align: middle;
}

/* Date chips: outlined, no tinted fills; overdue = red text only */
:root[data-theme] :is(#dashboard-workspace.hm, .hm-modal) .hm-due {
  background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--secondary);
}
:root[data-theme] :is(#dashboard-workspace.hm, .hm-modal) .hm-due.late { background: transparent; color: var(--danger-text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger-text) 35%, var(--line)); }
:root[data-theme] :is(#dashboard-workspace.hm, .hm-modal) .hm-due.today { background: transparent; color: var(--ink); }

/* Project progress: neutral bar; risk shown by the marker, overdue keeps a thin red bar */
:root[data-theme] #dashboard-workspace.hm .hm-project.risk .hm-progress i { background: color-mix(in srgb, var(--warning-text) 70%, var(--surface-3)); }

/* People load: «1 просрочено» without bold */
:root[data-theme] #dashboard-workspace.hm .hm-person-top .late { font-weight: 500; }

/* Header summary «2 просроченных дела»: readable text, the red is a small marker in front */
:root[data-theme] #app #page #dashboard-workspace.hm .hm-summary b.late,
:root[data-portal-backdrop]:not([data-portal-backdrop=default]) #app #page .hm-summary b.late { color: inherit; font-weight: 700; }
:root[data-portal-backdrop]:not([data-portal-backdrop=default]) #app #page .hm-summary b.late { color: var(--backdrop-nav-text); }
#dashboard-workspace.hm .hm-summary b.late::before {
  content: ''; display: inline-block; width: 7px; height: 7px; margin: 0 6px 1px 0; border-radius: 50%;
  background: var(--danger-red); vertical-align: middle; box-shadow: 0 0 0 2px rgb(255 255 255 / .25);
}
