/* Shared Project context contract. Keep this independent from Overview-only editing. */
:root {
  --context-nav-surface: #fbfcfd;
  --context-nav-frame: #dce5e0;
  --context-nav-divider: #e3ebe7;
  --context-nav-active: #176b50;
  --context-nav-hover-surface: #f5f8f6;
  --context-nav-hover-text: #0d513d;
}

html:has(.project-context-surface) { scrollbar-gutter: stable; }
html:has(.record-context-surface) { scrollbar-gutter: stable; }
.record-context-path {
  display: flex;
  min-width: 0;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  padding: 6px 18px;
  overflow: hidden;
  border-bottom: 1px solid #dce5e0;
  color: #718078;
  background: #f3f8f5;
  font-size: 11px;
  line-height: 1.35;
  white-space: nowrap;
}

.record-context-path a,
.record-context-path > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-context-path a {
  display: inline-flex;
  min-height: 24px;
  flex: 0 1 auto;
  align-items: center;
  gap: 7px;
  color: #176b50;
  font-weight: 700;
  text-decoration: none;
}

.record-context-path a:first-child { flex: 0 0 auto; }
.record-context-path > i { flex: 0 0 auto; color: #9aaba3; font-size: 9px; }
.record-context-path > span[aria-current="page"] { color: #42554c; font-weight: 600; }

.horizon-workbench .project-context-surface {
  margin-bottom: 16px;
  border-color: var(--context-nav-frame);
}

.horizon-workbench .project-context-surface .project-inline-hero {
  min-height: 100px;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 14px;
  padding: 14px 18px;
}

.horizon-workbench .project-context-surface .project-hero-image {
  width: 72px;
  height: 72px;
}

.horizon-workbench .project-context-surface .project-hero-copy .eyebrow {
  margin: 0 0 2px;
  font-size: 10px;
}

.horizon-workbench .project-context-surface .project-hero-copy h1 {
  margin-block: 2px 5px;
  font-size: clamp(24px, 2.3vw, 34px);
  line-height: 1.08;
}

.horizon-workbench .project-context-surface .project-hero-copy > p:last-child {
  margin: 0;
  font-size: 12px;
}

.project-section-selector { display: none; }

.horizon-workbench .project-context-surface .context-tabs {
  width: 100%;
  margin: 0;
  padding: 0 10px;
  overflow: hidden;
  border: 1px solid var(--context-nav-frame);
  border-width: 1px 0 0;
  background: var(--context-nav-surface);
}

.horizon-workbench .project-context-surface .context-tabs a {
  display: inline-flex;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 12px 14px;
  text-align: center;
  white-space: nowrap;
}

.horizon-workbench .project-context-surface .context-tabs a:hover {
  color: var(--context-nav-hover-text);
  background: var(--context-nav-hover-surface);
}

@media (min-width: 861px) {
  .horizon-workbench .project-context-surface .context-tabs {
    display: grid;
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 140px;
    justify-content: start;
    gap: 0;
  }

  .horizon-workbench .project-context-surface .context-tabs a {
    box-sizing: border-box;
    border-right: 1px solid var(--context-nav-divider);
    border-bottom-width: 3px;
  }

  .horizon-workbench .project-context-surface .context-tabs a.active {
    border-bottom-color: var(--context-nav-active);
    background: var(--context-nav-surface);
  }
}

/* Project Products: actions must reflow instead of being clipped. */
@media (max-width: 860px) and (min-width: 561px) {
  .horizon-workbench .project-context-surface .project-hero-actions {
    grid-column: auto;
    align-self: start;
    width: auto;
  }
}

@media (max-width: 640px) {
  .horizon-workbench .section-block:has(.project-products-table) > .section-heading {
    gap: 12px;
  }

  .horizon-workbench .project-product-list-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    width: 100%;
    gap: 8px;
  }

  .horizon-workbench .project-product-list-actions .project-product-scope-switch {
    grid-column: 1 / -1;
    width: 100%;
  }

  .horizon-workbench .project-product-list-actions .project-product-scope-switch button {
    flex: 1 1 0;
  }

  .horizon-workbench .project-product-list-actions > :is(.button, .secondary-button) {
    width: 100%;
    min-width: 0;
    justify-content: center;
    padding-inline: 8px;
    white-space: nowrap;
  }
}

/* History is an operational log, so keep rows compact and readable. */
.horizon-workbench .page-shell:has(> .section-block > .timeline) .timeline-item {
  min-height: 0;
  padding: 13px 16px;
}

.horizon-workbench .page-shell:has(> .section-block > .timeline) .record-main {
  min-width: 0;
}

.horizon-workbench .page-shell:has(> .section-block > .timeline) .record-main > p {
  overflow: hidden;
  color: var(--ui-muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.horizon-workbench .page-shell:has(> .section-block > .timeline) .record-main details {
  margin-top: 7px;
}

@media (max-width: 560px) {
  .record-context-path {
    min-height: 40px;
    gap: 6px;
    padding-inline: 14px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .record-context-path::-webkit-scrollbar { display: none; }

  .horizon-workbench .project-context-surface .project-inline-hero {
    min-height: 82px;
    grid-template-columns: 58px minmax(0, 1fr) auto;
    gap: 11px;
    padding: 12px 14px;
  }

  .horizon-workbench .project-context-surface .project-hero-image {
    width: 58px;
    height: 58px;
  }

  .horizon-workbench .project-context-surface .project-hero-copy h1 {
    margin: 0;
    font-size: clamp(1.16rem, 5.5vw, 1.36rem);
    line-height: 1.12;
  }

  .horizon-workbench .project-context-surface .project-hero-copy > p:last-child {
    margin-top: 3px;
    font-size: 11px;
  }

  .horizon-workbench .project-context-surface .project-hero-actions {
    grid-column: auto;
    align-self: start;
    width: auto;
  }

  .horizon-workbench .project-context-surface .project-hero-actions .status-pill {
    padding: 4px 7px;
    font-size: 9px;
  }

  .horizon-workbench .project-context-surface .context-tabs { display: none; }

  .project-section-selector {
    display: block;
    position: relative;
    margin: 0;
    border-top: 1px solid var(--ui-line);
  }

  .project-section-selector > summary {
    display: flex;
    min-height: 44px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 13px;
    color: #29483d;
    background: #fff;
    font-size: 12px;
    font-weight: 700;
    list-style: none;
    cursor: pointer;
  }

  .project-section-selector > summary::-webkit-details-marker,
  .project-section-selector > summary::after { display: none !important; content: none !important; }
  .project-section-selector[open] > summary i { transform: rotate(180deg); }

  .project-section-selector > nav {
    display: grid;
    position: absolute;
    top: calc(100% + 5px);
    right: 8px;
    left: 8px;
    z-index: 50;
    gap: 2px;
    padding: 5px;
    border: 1px solid #d9e1e6;
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(18, 49, 37, .15);
  }

  .project-section-selector > nav a {
    display: flex;
    min-height: 42px;
    align-items: center;
    padding: 8px 10px;
    border-radius: 5px;
    color: #344a42;
    font-size: 12px;
    text-decoration: none;
  }

  .project-section-selector > nav a[aria-current="page"] {
    color: #176b50;
    background: #edf7f2;
    font-weight: 750;
  }

  .horizon-workbench .page-shell:has(> .section-block > .timeline) .timeline-item {
    padding: 12px;
  }
}
