/* portal-ia.css -- Phase 3 portal IA rebuild
 * Lays new top-nav active state, engagement bar, sub-rail, scenario badges,
 * dashboard tiles, settings grid. Loaded after portal.css and responsive.css.
 * Tokens come from portal.css :root -- no new palette here.
 */

/* === Top nav active state === */
.bc-nav__link--active {
  color: var(--text-primary);
  font-weight: 600;
  position: relative;
}
.bc-nav__link--active::after {
  content: "";
  position: absolute;
  left: var(--sp-2);
  right: var(--sp-2);
  bottom: -14px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

/* === Engagement bar (sticky, sits under main header) === */
.bc-engagement-bar {
  background: var(--white);
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 57px; /* main header height */
  z-index: 90;
}
.bc-engagement-bar__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--sp-2) var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  font-size: 14px;
}
.bc-engagement-bar__back {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}
.bc-engagement-bar__sep {
  color: var(--text-muted);
  font-size: 14px;
}
.bc-engagement-bar__name {
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
}
.bc-engagement-bar__matrix {
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--font-mono);
  margin-left: auto;
}

/* === Sub-navigation rail (Assess/Plan/Decide/Deliver) === */
.bc-subnav {
  /* phase6-spacing: unify with .bc-subnav-items as one cohesive block.
     - background -> white (matches items rail; eliminates grey band)
     - drop bottom border (items rail provides the block's bottom rule)
     - top: 104 (flush under sticky engagement-bar; was 99)
  */
  background: var(--white);
  position: sticky;
  top: 104px;
  z-index: 80;
}
.bc-subnav__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--sp-4);
  display: flex;
  gap: 0;
  overflow-x: auto;
}
.bc-subnav__phase {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.bc-subnav__phase:hover {
  /* phase6-spacing: base is now white; use carbon-10 for hover feedback. */
  background: var(--carbon-10);
  color: var(--text-primary);
  text-decoration: none;
}
.bc-subnav__phase--active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
  background: var(--white);
}
.bc-subnav__step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--carbon-20);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-mono);
}
.bc-subnav__phase--active .bc-subnav__step {
  background: var(--accent);
  color: var(--white);
}
.bc-subnav__label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
}
.bc-subnav__hint {
  color: var(--text-muted);
  font-size: 11px;
  font-family: var(--font-mono);
}
.bc-subnav__tabs {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--sp-2) var(--sp-4);
  border-top: 1px solid var(--rule);
  background: var(--white);
  display: flex;
  gap: var(--sp-1);
  flex-wrap: wrap;
}
.bc-subnav__tab {
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}
.bc-subnav__tab:hover {
  background: var(--carbon-10);
  color: var(--text-primary);
  text-decoration: none;
}
.bc-subnav__tab--active {
  background: var(--ibm-blue-10);
  color: var(--accent);
  font-weight: 600;
}

/* === Scenario badges === */
.bc-scenario-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
}
.bc-scenario-badge--migration {
  background: var(--ibm-blue-10);
  color: var(--ibm-blue-70);
  border-color: var(--ibm-blue-30);
}
.bc-scenario-badge--arbitrage {
  background: #FCF4D6;
  color: #6D4800;
  border-color: #F1C21B;
}
.bc-scenario-badge--rationalization {
  background: #DEFBE6;
  color: #0E6027;
  border-color: #42BE65;
}
.bc-scenario-badge--carveout {
  background: #F6F2FF;
  color: #491D8B;
  border-color: #BE95FF;
}

/* === Dashboard tiles === */
.bc-dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--sp-3);
  margin-top: var(--sp-4);
}
.bc-dash-tile {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  padding: var(--sp-4);
  text-decoration: none;
  color: var(--text-primary);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.bc-dash-tile:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
}
.bc-dash-tile--static {
  cursor: default;
}
.bc-dash-tile--static:hover {
  transform: none;
  box-shadow: none;
}
.bc-dash-tile__label {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.bc-dash-tile__metric {
  font-size: 40px;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-top: var(--sp-1);
}
.bc-dash-tile__sub {
  font-size: 13px;
  color: var(--text-secondary);
}
.bc-dash-tile__cta {
  margin-top: auto;
  padding-top: var(--sp-2);
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
}
.bc-dash-tile__list {
  margin: var(--sp-1) 0 0;
  padding-left: var(--sp-3);
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}
.bc-dash-tile__empty {
  list-style: none;
  margin-left: calc(0px - var(--sp-3));
  color: var(--text-muted);
  font-style: italic;
}

/* === Activity feed === */
.bc-activity-feed {
  list-style: none;
  padding: 0;
  margin: 0;
}
.bc-activity-feed li {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--rule);
  font-size: 14px;
}
.bc-activity-feed li:last-child {
  border-bottom: 0;
}
.bc-activity-feed__msg {
  color: var(--text-primary);
}
.bc-activity-feed__time {
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* === Settings grid === */
.bc-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--sp-3);
  margin-top: var(--sp-4);
}
.bc-settings-tile {
  text-decoration: none;
  color: var(--text-primary);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  padding: var(--sp-4);
}
.bc-settings-tile:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
}
.bc-settings-tile h3 {
  margin: 0 0 var(--sp-2);
  font-size: 18px;
}
.bc-settings-tile p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
}

/* === Key-value descriptive list === */
.bc-keyval {
  display: grid;
  grid-template-columns: minmax(140px, 200px) 1fr;
  gap: var(--sp-2) var(--sp-3);
  margin: 0;
}
.bc-keyval dt {
  color: var(--text-secondary);
  font-size: 13px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.bc-keyval dd {
  margin: 0;
  color: var(--text-primary);
  font-size: 14px;
  word-break: break-all;
}

/* === Mobile responsive (<=768px per spec) === */
@media (max-width: 768px) {
  /* Force hamburger at the wider 768 breakpoint (override responsive.css 640) */
  .bc-hamburger { display: inline-flex; }
  .bc-brand__sub { display: none; }
  .bc-nav {
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--rule);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: var(--sp-2) var(--sp-3);
    display: none;
    z-index: 99;
  }
  .bc-nav.bc-nav--open { display: flex; }
  .bc-nav__link, .bc-nav__user {
    padding: 12px var(--sp-2);
    font-size: 15px;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .bc-nav__link--active::after { display: none; }
  .bc-nav__link--active {
    background: var(--ibm-blue-10);
    border-left: 3px solid var(--accent);
    padding-left: calc(var(--sp-2) - 3px);
  }
  .bc-nav form { width: 100%; }
  .bc-nav form .bc-btn { width: 100%; justify-content: center; min-height: 44px; }
  .bc-header__inner { position: relative; padding: var(--sp-2) var(--sp-3); }

  /* Sub-rail goes horizontal-scroll on mobile */
  .bc-subnav__inner { padding: 0 var(--sp-2); }
  .bc-subnav__phase { padding: var(--sp-2) var(--sp-3); }
  .bc-subnav__hint { display: none; }
  .bc-engagement-bar { top: 49px; }
  /* phase6-spacing: engagement-bar is ~47px tall in practice -> 49+47=96 */
  .bc-subnav { top: 96px; }
}

@media (max-width: 480px) {
  .bc-subnav__phase { padding: var(--sp-2); gap: var(--sp-1); }
  .bc-subnav__label { font-size: 13px; }
  .bc-subnav__step { width: 18px; height: 18px; font-size: 10px; }
  .bc-engagement-bar__matrix { display: none; }
}

/* === Engagement-subnav phase-2 (sub-items under the four-phase rail) === */
.bc-subnav-items {
  /* phase6-spacing: top recalibrated to sit flush under .bc-subnav
     (was 153 -- caused a 14-19px grey band on desktop). */
  background: var(--white);
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 138px;
  z-index: 79;
}
.bc-subnav-items__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--sp-2) var(--sp-4);
  display: flex;
  gap: var(--sp-1);
  flex-wrap: wrap;
  align-items: center;
}
.bc-subnav-items .bc-subnav__tab {
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.bc-subnav-items .bc-subnav__tab:hover {
  background: var(--carbon-10);
  color: var(--text-primary);
  text-decoration: none;
}
.bc-subnav-items .bc-subnav__tab.is-active,
.bc-subnav-items .bc-subnav__tab--active {
  background: var(--ibm-blue-10);
  color: var(--accent);
  font-weight: 600;
}
/* Phase-rail tabs also accept the .is-active class produced by the partial */
.bc-subnav__phase.is-active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
  background: var(--white);
}
.bc-subnav__phase.is-active .bc-subnav__step {
  background: var(--accent);
  color: var(--white);
}

@media (max-width: 768px) {
  .bc-subnav-items {
    position: static;
    overflow-x: auto;
  }
  .bc-subnav-items__inner {
    flex-wrap: nowrap;
    padding: var(--sp-2);
  }
  .bc-subnav-items .bc-subnav__tab {
    font-size: 12px;
    padding: var(--sp-1) var(--sp-2);
  }
}

@media (max-width: 480px) {
  .bc-subnav-items .bc-subnav__tab { font-size: 11px; }
}

/* ============================================================ */
/* Phase 5 HTML previews -- shared chrome for the three preview  */
/* surfaces (reports list, negotiation pack, executive summary). */
/* ============================================================ */

.bc-actions-row {
  margin-top: var(--sp-3);
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  align-items: center;
}
.bc-inline-form {
  display: inline-flex;
  align-items: center;
  margin: 0;
}
.bc-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.bc-checkbox input { margin: 0; }
.bc-muted { color: var(--text-muted); font-size: 13px; }

/* Generic table chrome used by preview pages */
.bc-table-wrap {
  overflow-x: auto;
  margin: var(--sp-2) 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--white);
}
.bc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.bc-table thead th {
  background: #F4F4F4;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid var(--rule);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-strong);
}
.bc-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
  color: var(--text-strong);
}
.bc-table tbody tr:last-child td { border-bottom: none; }
.bc-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* --- Negotiation-pack preview -------------------------------- */
.np-section {
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  padding: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.np-section h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-strong);
  margin: 0 0 var(--sp-2);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 4px;
}
.np-section h2 + p,
.np-section h2 + .bc-lede { margin-top: var(--sp-2); }

.np-kv {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 6px var(--sp-3);
  margin: 0;
}
.np-kv dt {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.np-kv dd { margin: 0; color: var(--text-strong); font-size: 14px; }

.np-chart {
  margin: var(--sp-2) 0;
  text-align: center;
  background: #FAFAFA;
  padding: var(--sp-2);
  border-radius: var(--radius-sm);
}
.np-chart img { max-width: 100%; height: auto; }

.np-tco-table .np-total-row td {
  background: #F4F4F4;
  border-top: 2px solid var(--accent);
}

.np-method ul { margin: 0; padding-left: var(--sp-3); }
.np-method li { margin-bottom: 6px; font-size: 13px; line-height: 1.5; }

@media (max-width: 700px) {
  .np-kv { grid-template-columns: 1fr; }
  .np-kv dt { margin-top: 8px; }
}

/* --- Reports list grid --------------------------------------- */
.rep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: var(--sp-3);
  margin-top: var(--sp-3);
}
.rep-card {
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.rep-card__head h2 {
  font-size: 16px;
  margin: 0 0 4px;
  color: var(--text-strong);
}
.rep-card__sub {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}
.rep-card__meta {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--rule);
  padding-top: var(--sp-2);
}
.rep-card__meta li {
  font-size: 12px;
  color: var(--text-muted);
  padding: 3px 0;
}
.rep-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: var(--sp-2);
  border-top: 1px solid var(--rule);
}

/* --- Executive summary upgrades ------------------------------ */
.es-warn {
  background: #FFF8E6;
  border-left: 4px solid #B97A00;
  padding: var(--sp-3);
  border-radius: var(--radius-sm);
  margin-top: var(--sp-3);
}
.es-warn__hint {
  margin: var(--sp-2) 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.es-meta {
  color: var(--text-muted);
  font-size: 12px;
  margin: var(--sp-3) 0 var(--sp-2);
}
.es-meta__pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 6px;
}
.es-meta__pill--cache    { background: #4F9E60; }
.es-meta__pill--fallback { background: #B97A00; }
.es-meta__pill--ai       { background: var(--accent); }

.es-section {
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  padding: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.es-section h2 {
  font-size: 18px;
  margin: 0 0 var(--sp-2);
  color: var(--text-strong);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 4px;
}
.es-section--hero {
  background: linear-gradient(180deg, #FFFFFF 0%, #F7F9FC 100%);
  border-left: 4px solid var(--accent);
}
.es-section--hero .es-section__body {
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-strong);
  margin: 0;
}

.es-move-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--sp-3);
  margin-top: var(--sp-2);
}
.es-move-card {
  position: relative;
  background: #FAFAFA;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: var(--sp-3);
}
.es-move-card__num {
  position: absolute;
  top: -10px;
  left: -10px;
  width: 28px;
  height: 28px;
  background: var(--accent);
  color: var(--white);
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}
.es-move-card__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-strong);
  margin: 0 0 var(--sp-2);
}
.es-move-card__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  color: var(--text-muted);
  margin: var(--sp-2) 0 4px;
}
.es-move-card__body {
  font-size: 13px;
  line-height: 1.55;
  margin: 0;
  color: var(--text-strong);
}
.es-move-card__body--impact { font-weight: 600; }

.es-rationale-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: var(--sp-2);
}
.es-rationale {
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--white);
  padding: 0;
  overflow: hidden;
}
.es-rationale__summary {
  list-style: none;
  cursor: pointer;
  padding: 12px var(--sp-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  color: var(--text-strong);
  background: #FAFAFA;
  user-select: none;
}
.es-rationale__summary::-webkit-details-marker { display: none; }
.es-rationale[open] .es-rationale__summary { background: #F0F4F8; }
.es-rationale__name { font-size: 14px; }
.es-rationale__chev {
  font-size: 16px;
  color: var(--accent);
  font-weight: 700;
  width: 20px;
  text-align: center;
}
.es-rationale[open] .es-rationale__chev { transform: rotate(45deg); }
.es-rationale__text {
  padding: var(--sp-3);
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-strong);
  border-top: 1px solid var(--rule);
}

@media (max-width: 700px) {
  .es-move-grid { grid-template-columns: 1fr; }
  .rep-grid { grid-template-columns: 1fr; }
  .bc-actions-row { flex-direction: column; align-items: stretch; }
  .bc-actions-row .bc-btn { width: 100%; text-align: center; }
}
