/* AIC dashboard command centre — P0-2 / §3
   BRIEF-2026-07-08-AIC-FE-MASTER-SYNTHESISED §3.2–§3.10
   Two-panel grid: 220px left sidebar + main content (§3.2).
   2026-07-09: UX pass — full-width cockpit shell, sidebar legibility,
   KPI card min-width, hero lede breathing room, section top-padding. */

/* ---- Fix 1: cockpit shell gets full viewport width -------------------
   The outer .app grid (228px 1fr) was constraining the dashboard to the
   right-hand cell only.  .app--cockpit overrides to a single full-width
   column so db-shell owns the whole viewport below the topnav. ---------- */
.app--cockpit {
  display: block;   /* collapse the .app two-column grid */
}
.app--cockpit .content {
  max-width: none;
  padding: 0;
}

.db-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  align-items: start;
  min-height: calc(100vh - 92px); /* topnav ~56px + GHC bar 36px */
}

@media (max-width: 1023px) {
  .db-shell { grid-template-columns: 1fr; }
  .db-shell__sidebar { display: none; }
  .db-shell__sidebar.is-open { display: block; }
}

/* ---- Ambient GHC bar (§3.3) ---- */
/* Full-bleed strip pinned immediately below the topnav (fixed, full-viewport-width).
   The topnav (.pub-head) is ~56px tall; we sit at top:56px.
   On mobile (<640px) topnav may be taller — fallback handled by media query below. */
.aic-ghc-bar {
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 36px;
  padding: 0 20px;
  font-size: var(--fs-xs, 0.75rem);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  background: var(--card);
  color: var(--text);
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
}
/* Push page content down so bar doesn't overlap the hero */
body.has-topnav main {
  padding-top: 36px;
}
@media (max-width: 640px) {
  .aic-ghc-bar { top: 48px; }
  body.has-topnav main { padding-top: 44px; }
}
.aic-ghc-bar[data-health="green"] { background: rgba(61,220,151,.14); }
.aic-ghc-bar[data-health="amber"] { background: rgba(255,207,92,.16); }
.aic-ghc-bar[data-health="red"]   { background: rgba(255,90,90,.14); }
.aic-ghc-bar__score { font-weight: 700; }
.aic-ghc-bar__dismiss { margin-left: auto; background: none; border: none; cursor: pointer; color: inherit; font-size: 1rem; line-height: 1; padding: 2px 6px; }
.aic-ghc-bar.is-dismissed { display: none; }
.aic-ghc-bar__detail { display: none; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--card); font-size: var(--fs-sm); }
.aic-ghc-bar__detail.is-open { display: block; }

/* ---- Fix 2: Left sidebar legibility ---------------------------------
   Nav links: --fs-sm (12px) → --fs-base (14px).
   Section headings: --fs-2xs (10px) → --fs-xs (11px).
   Sticky so the nav stays visible while scrolling main content.  ------- */
.db-shell__sidebar {
  position: sticky;
  top: 92px; /* topnav 56 + GHC bar 36 */
  max-height: calc(100vh - 92px);
  overflow-y: auto;
  border-right: 1px solid var(--line);
  padding: 16px 14px;
  font-size: var(--fs-base);
  background: var(--surface);
}
.db-sidebar__section { margin-bottom: 24px; }
.db-sidebar__heading {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 10px;
  padding: 0 8px;
}
.db-sidebar__nav a {
  display: block;
  padding: 7px 10px;
  border-radius: 5px;
  color: var(--text);
  text-decoration: none;
  font-size: var(--fs-base);
  line-height: 1.4;
}
.db-sidebar__nav a.on { background: var(--acc); color: #fff; }
.db-sidebar__nav a:hover:not(.on) { background: var(--state-hover-bg); }
.db-watch-item { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px; }
.db-watch-empty { color: var(--text-muted); font-size: var(--fs-sm); padding: 4px 8px; }
.db-topic-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 7px 10px;
  border-radius: 5px;
  cursor: pointer;
  color: var(--text);
  font: inherit;
  font-size: var(--fs-base);
}
.db-topic-btn.on { background: var(--acc); color: #fff; }
.db-topic-btn:hover:not(.on) { background: var(--state-hover-bg); }
.db-tools-badge {
  font-size: var(--fs-2xs);
  background: var(--line);
  color: var(--text-muted);
  border-radius: 3px;
  padding: 1px 6px;
  margin-left: 6px;
}

/* ---- Persona bar (§3.5) ---- */
.db-persona-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.db-persona-btn {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: var(--fs-base);
  cursor: pointer;
  color: var(--text);
  transition: background .12s, color .12s;
}
.db-persona-btn[aria-pressed="true"] { background: var(--acc); color: #fff; border-color: var(--acc); }
.db-persona-btn:hover:not([aria-pressed="true"]) { background: var(--state-hover-bg); }

/* ---- Fix 3: This Week hero — breathing room -------------------------
   Remove 70ch constraint (panel is already narrower than that).
   Lede up to --fs-lg (15px) for readability.
   Add surface background to visually anchor the hero card.  ------------ */
.db-hero {
  padding: 24px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}
.db-hero__week {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-bottom: 8px;
}
.db-hero__headline {
  font-size: var(--fs-h3);   /* 20px — punchy */
  font-weight: 700;
  margin: 0 0 10px;
  line-height: 1.3;
  color: var(--text);
}
.db-hero__lede {
  color: var(--text-muted);
  font-size: var(--fs-lg);   /* 15px up from 14px */
  line-height: 1.6;
  margin: 0 0 14px;
  /* no max-width cap — let the panel width govern */
}
.db-hero__cta { color: var(--acc); text-decoration: none; font-weight: 600; font-size: var(--fs-base); }

/* ---- Fix 4: KPI strip — min card width prevents label wrap ----------
   Labels were wrapping to 4+ lines on narrow cards.
   min-width stops the grid from crushing cards below a readable size.
   Value font slightly smaller (1.4rem) to stay within card bounds.  ---- */
.db-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 14px;
  padding: 20px 24px;
  background: var(--surface);
}
@media (max-width: 900px) { .db-kpi-strip { grid-template-columns: 1fr 1fr; } }
@media (max-width: 540px) { .db-kpi-strip { grid-template-columns: 1fr; } }
.db-kpi-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  min-width: 0; /* allow shrink inside grid */
}
.db-kpi-card__label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: .05em;
  line-height: 1.4;
  margin-bottom: 2px;
}
.db-kpi-card__value {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 6px 0 4px;
  line-height: 1.1;
}
.db-kpi-card__value--stale { font-size: 1rem; color: var(--text-muted); font-weight: 400; }
.db-kpi-card__sub { font-size: var(--fs-xs); color: var(--text-muted); line-height: 1.4; }

/* ---- Fix 5: Section spacing + heat row legibility -------------------
   Sections now get top padding so headings don't sit flush against
   the preceding section's last border.  Heat rows: base font up to
   --fs-base (14px), more vertical padding, jid column fixed width so
   posture chips don't cascade.  ----------------------------------------- */
.db-section { padding: 20px 24px 28px; }
.db-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.db-section__title { font-size: var(--fs-h4); font-weight: 700; margin: 0; }
.db-section__link { font-size: var(--fs-sm); color: var(--acc); text-decoration: none; }

.db-heat-row {
  display: grid;
  grid-template-columns: 140px 1fr auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 4px;
  border-bottom: 1px solid var(--line-subtle, var(--line));
  font-size: var(--fs-base);
}
.db-heat-row:hover { background: var(--state-hover-bg); }
.db-heat-row.is-watchlisted { border-left: 3px solid #c9a356; background: rgba(201,163,86,.06); }
.db-heat-row__jid { font-weight: 600; font-size: var(--fs-base); }
.db-heat-row a.db-heat-row__link { color: inherit; text-decoration: none; }
.db-pin-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 3px 9px;
  cursor: pointer;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.db-pin-btn[aria-pressed="true"] { background: #c9a356; color: #fff; border-color: #c9a356; }
.db-heat-row__new-badge {
  font-size: var(--fs-2xs);
  background: #dbeafe;
  color: #1d4ed8;
  border-radius: 3px;
  padding: 1px 5px;
  margin-left: 6px;
  font-weight: 600;
  vertical-align: middle;
}

/* ---- Action feed (§3.9) ---- */
.db-action-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line-subtle, var(--line));
  font-size: var(--fs-base);
  align-items: flex-start;
}
.db-action-item:hover { background: var(--state-hover-bg); }
.db-action-item__sev {
  flex-shrink: 0;
  font-size: var(--fs-2xs);
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 10px;
  margin-top: 1px;
}
.db-action-item__sev[data-sev="critical"] { background: #fef2f2; color: #dc2626; }
.db-action-item__sev[data-sev="elevated"] { background: #fef3c7; color: #92400e; }
.db-action-item__sev[data-sev="moderate"] { background: #eef2ff; color: #4338ca; }
.db-action-item.is-watchlist-promoted { border-left: 3px solid #c9a356; }

/* ---- Brief tabs (§3.10) ---- */
.db-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.db-tab-btn {
  background: none;
  border: none;
  padding: 10px 18px;
  cursor: pointer;
  font: inherit;
  font-size: var(--fs-base);
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
}
.db-tab-btn[aria-selected="true"] { color: var(--acc); border-bottom-color: var(--acc); font-weight: 600; }
.db-tab-panel { font-size: var(--fs-base); line-height: 1.65; }
.db-tab-panel[hidden] { display: none; }
.db-tab-panel h4 { font-size: var(--fs-h4); margin: 14px 0 6px; }
.db-tab-panel p { margin: 0 0 12px; color: var(--text-muted); }
.db-issue-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 14px;
  margin-top: 14px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-sm);
}
.db-issue-nav__chip {
  font-size: var(--fs-2xs);
  background: var(--line);
  border-radius: 10px;
  padding: 2px 10px;
  color: var(--text-muted);
}

/* ---- Section-link cards for stripped §3.11 sections ---- */
.aim-section-link {
  display: block;
  padding: 10px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--acc);
  text-decoration: none;
  font-size: var(--fs-base);
}
.aim-section-link:hover { background: var(--card); }
