/* pages/chrome.css */
/* ---------- Health-strip extras (HH bar, alerts, actions) ---------- */
.health-strip__divider {
  flex: 0 0 1px;
  width: 1px;
  height: 16px;
  background: var(--border-subtle);
  margin: 0 var(--space-8);
}
.health-strip__pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: var(--space-8);
  font-weight: var(--fw-bold);
  color: var(--ok);
}
.health-strip__pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 6px var(--ok);
}
.health-strip--warn   .health-strip__pill        { color: var(--warn); }
.health-strip--warn   .health-strip__pill::before{ background: var(--warn); box-shadow: 0 0 6px var(--warn); }
.health-strip--danger .health-strip__pill        { color: var(--danger); }
.health-strip--danger .health-strip__pill::before{ background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.health-strip__meta {
  min-width: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.health-strip__hh {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: var(--space-8);
}
.health-strip__hh-label { color: var(--text-muted); font-size: var(--fs-label); font-weight: var(--fw-bold); }
.health-strip__hh-bar {
  width: 80px;
  height: 6px;
  background: var(--bg-input);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.health-strip__hh-fill {
  display: block; /* was an inline span → width:% was ignored, so the bar always read empty */
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--ok));
  transition: width var(--dur-slow) var(--ease-out);
}
.health-strip--warn   .health-strip__hh-fill { background: linear-gradient(90deg, var(--accent), var(--warn)); }
.health-strip--danger .health-strip__hh-fill { background: linear-gradient(90deg, var(--accent), var(--danger)); }
.health-strip__hh-text { font-family: var(--font-mono); color: var(--text-primary); font-size: var(--fs-small); }
.health-strip__alerts {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  color: var(--warn);
  font-weight: var(--fw-bold);
  cursor: pointer;
}
.health-strip__alerts--ok    { color: var(--text-muted); cursor: default; }
.health-strip__alerts--danger{ color: var(--danger); }
.health-strip__actions { flex: 0 0 auto; display: flex; gap: var(--space-8); margin-left: auto; }
.health-strip__actions .btn {
  gap: var(--space-6); min-width: 0; padding-inline: var(--space-10);
  font-size: var(--fs-small); white-space: nowrap;
}

/* ---------- Compact in-panel help ---------- */
.overlay--popover.help-menu.dd-menu { min-width: min(340px, calc(100vw - var(--space-24))); padding: var(--space-8); }
.help-menu__content { display: grid; gap: var(--space-4); }
.help-menu__intro {
  display: flex; align-items: center; gap: var(--space-10);
  padding: var(--space-8) var(--space-8) var(--space-12);
  border-bottom: 1px solid var(--border-subtle); margin-bottom: var(--space-4);
}
.help-menu__intro > span:last-child { display: grid; gap: var(--space-4); }
.help-menu__intro strong { color: var(--text-primary); font-size: var(--fs-secondary); }
.help-menu__intro small { color: var(--text-muted); font-size: var(--fs-label); }
.help-menu__intro-icon, .help-menu__icon {
  display: inline-grid; place-items: center; flex: 0 0 auto;
  width: 34px; height: 34px; border-radius: var(--radius-6);
  background: var(--bg-elevated); color: var(--accent-soft-text);
}
.help-menu__action {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center; gap: var(--space-10); width: 100%; min-height: 52px;
  padding: var(--space-8); border: 1px solid transparent; border-radius: var(--radius-6);
  background: transparent; color: var(--text-primary); font: inherit; text-align: left; cursor: pointer;
}
.help-menu__action:hover { background: var(--bg-elevated); border-color: var(--border-subtle); }
.help-menu__action:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 1px; }
.help-menu__action--featured { background: var(--accent-soft-bg); border-color: var(--accent-soft-border); }
.help-menu__action--featured .help-menu__icon { background: var(--accent); color: var(--text-on-accent); }
.help-menu__copy { display: grid; gap: var(--space-4); min-width: 0; }
.help-menu__copy strong { font-size: var(--fs-small); font-weight: var(--fw-medium); }
.help-menu__copy small { color: var(--text-muted); font-size: var(--fs-micro); line-height: 1.35; }
.help-menu__chevron { color: var(--text-muted); }
.help-menu__section-label {
  padding: var(--space-10) var(--space-8) var(--space-4); color: var(--text-muted);
  font-size: var(--fs-micro); font-weight: var(--fw-bold); letter-spacing: .06em; text-transform: uppercase;
}
.help-menu__footer {
  display: flex; justify-content: space-between; gap: var(--space-12);
  margin-top: var(--space-6); padding: var(--space-10) var(--space-8) var(--space-4);
  border-top: 1px solid var(--border-subtle); color: var(--text-muted); font-size: var(--fs-micro);
}
.help-menu__footer span:first-child { color: var(--text-secondary); font-weight: var(--fw-bold); }
.overlay--sheet.help-menu .help-menu__intro { display: none; }

/* The structured health row is denser than the original placeholder. Keep
 * optional diagnostics out of the tablet/narrow-desktop critical path so the
 * strip never widens the document. Full controls remain on roomy desktops. */
@media (max-width: 1399px) {
  .health-strip__meta,
  .health-strip__divider,
  .health-strip__actions { display: none; }
}

@media (max-width: 760px) {
  #health-strip-live { display: none !important; }
}

@media (max-width: 640px) {
  .health-strip__meta,
  .health-strip__divider,
  .health-strip__hh-label,
  .health-strip__actions { display: none; }
  .health-strip__hh-bar  { width: 56px; }
}

@media (max-width: 400px) {
  .health-strip__hh-bar { display: none; }
  .health-strip__pill { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ---------- Mobile bottom-tab-bar count badges (Plan 4 E.3) ---------- */
.tab-badge {
  position: absolute;
  top: 5px;
  left: calc(50% + 6px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--warn);
  color: var(--bg-canvas);
  font-size: var(--fs-micro);
  font-weight: var(--fw-bold);
  border-radius: var(--radius-8);
  min-width: 16px;
  height: 16px;
  padding: 0 var(--space-4);
  margin-left: 0;
  font-family: var(--font-mono);
}
.tab-badge[hidden] { display: none; }
.tab-badge--danger { background: var(--danger); color: var(--text-on-accent); }

/* ---------- Health-strip HH chip becomes a button ---------- */
.health-strip__hh {
  background: transparent;
  border: none;
  cursor: pointer;
  min-width: var(--touch-target);
  min-height: var(--touch-target);
  padding: 0 var(--space-4);
  margin: 0;
  font: inherit;
  color: inherit;
}
.health-strip__hh:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-4);
}

/* ---------- Shared HH-limits popover ---------- */
/* Container shell (position/bg/border/radius/shadow/padding/z-index/max-height/
   overflow/color) now comes from the shared .overlay--popover core
   (css/overlay.css). Only the content width is worth keeping bespoke — see
   the .overlay--popover.hh-limits-popover keeper below. */
.hh-limits-popover__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-8);
  margin-bottom: var(--space-8);
}
.hh-limits-popover__head strong { font-size: var(--fs-secondary); }
.hh-limits-popover__close {
  min-width: var(--touch-target);
  min-height: var(--touch-target);
  background: transparent;
  color: var(--text-muted);
  border: none;
  font-size: var(--fs-section);
  line-height: 1;
  cursor: pointer;
  padding: 0 var(--space-4);
}
.hh-limits-popover__close:hover { color: var(--text-primary); }
.hh-limits-popover__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}
.hh-limits-popover__hint,
.hh-limits-popover__error {
  color: var(--text-muted);
  font-size: var(--fs-secondary);
  margin: var(--space-8) 0;
}
.hh-limits-popover__error { color: var(--danger); }
.hh-limits-popover__foot {
  margin-top: var(--space-12);
  padding-top: var(--space-8);
  border-top: 1px solid var(--border-subtle);
  color: var(--text-tertiary);
  font-size: var(--fs-small);
  font-family: var(--font-mono);
}
/* Width keeper: specificity 0,2,0 beats the core .overlay--popover{min-width:200px}
   (0,1,0) regardless of file/load order. Needed for the dense limits table. */
.overlay--popover.hh-limits-popover { min-width: min(320px, calc(100vw - var(--space-32))); }
/* U2.1 — group head when ≥2 employers are surfaced in the popover. */
.hh-limits-group + .hh-limits-group { margin-top: var(--space-8); }
.hh-limits-group__head {
  font-size: var(--fs-small);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-4);
}
.hh-limits-row {
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  gap: var(--space-8);
  align-items: center;
  padding: var(--space-8) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.hh-limits-row:last-child { border-bottom: none; }
.hh-limits-row__avatar { display: inline-flex; align-items: center; }
.hh-limits-row__main { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.hh-limits-row__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-8);
}
/* long manager names (emails) must truncate, not shove the count into the % */
.hh-limits-row__top > strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hh-limits-row__mono {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  color: var(--text-secondary);
  white-space: nowrap;
  flex: 0 0 auto;
}
.hh-limits-row__bar {
  position: relative;
  height: 4px;
  background: var(--bg-input);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.hh-limits-row__fill {
  position: absolute;
  inset: 0;
  width: 0%;
  border-radius: var(--radius-pill);
  background: var(--ok);
  transition: width var(--dur-slow) var(--ease-out);
}
.hh-limits-row__fill--warn   { background: var(--warn); }
.hh-limits-row__fill--danger { background: var(--danger); }
.hh-limits-row__percent {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  color: var(--text-tertiary);
  min-width: 32px;
  text-align: right;
}

/* ---------- Complete mobile information architecture ---------- */
.mobile-more-sheet .overlay__surface {
  width: min(560px, 100%);
  max-width: 560px;
  border-radius: var(--radius-16) var(--radius-16) 0 0;
  background: var(--bg-surface);
}

.mobile-more-sheet .overlay__title {
  margin: var(--space-4) 44px var(--space-16) 0;
  color: var(--text-primary);
  font-size: var(--fs-section);
  letter-spacing: -0.02em;
}

.mobile-more-sheet .overlay__body {
  color: var(--text-primary);
}

.mobile-more {
  display: grid;
  gap: var(--space-20);
}

.mobile-more__section {
  display: grid;
  gap: var(--space-8);
}

.mobile-more__heading {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-label);
  font-weight: var(--fw-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mobile-more__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-8);
}

.mobile-more__item {
  appearance: none;
  min-width: 0;
  min-height: 68px;
  padding: var(--space-12);
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: var(--space-10);
  align-items: center;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-12);
  color: var(--text-secondary);
  background: var(--bg-elevated);
  font: inherit;
  font-weight: var(--fw-medium);
  text-align: left;
  cursor: pointer;
}

.mobile-more__item:hover,
.mobile-more__item[aria-current="page"] {
  color: var(--accent-soft-text);
  border-color: var(--accent-soft-border);
  background: var(--accent-soft-bg);
}

.mobile-more__item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-more__theme .theme-switcher {
  width: 100%;
}

@media (max-width: 340px) {
  .mobile-more__grid {
    grid-template-columns: 1fr;
  }
}
