/* ══════════════════════════════════════════════════════════════════
   shell.css v14.0.0 - Portal shell styles
   Pipeline nav: Home | Brain | Intake | Forge | Pulse | Scout.
   Business areas are color-coded filters within Brain tab.

   Design principles:
   - 10% side margins on all content areas
   - Generous padding (32px standard for cards, 48px for sections)
   - 8-point spacing grid using var(--space-*) tokens
   - Subtle shadows: var(--shadow-xs), var(--shadow-sm), var(--shadow-md)
   - Border-radius: var(--radius-sm) (4px), var(--radius-md) (6px), var(--radius-lg) (8px)
   - Gold accent lines: 3rem width, 1px height, for section breaks
   - Cards: white bg, 1px border, radius-lg, shadow on hover, generous padding
   - Buttons: teal primary (filled), ghost secondary (transparent), refined sizing
   - Labels/eyebrows: DM Mono, 9-10px, uppercase, letter-spacing 0.1em+
   - Transitions: var(--transition-fast) for quick interactions
   - 40-60% whitespace target
   - Top nav: increased to 64px, full-width dark obsidian bar with max-width inner container

   Imports tokens.css for all design tokens.
   ══════════════════════════════════════════════════════════════════ */

html, body {
  height: 100%;
  font-family: var(--font-sans);
  color: var(--steel);
  background: var(--obsidian);
  overflow: hidden;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ══════════════════════════════════════════════
   UTILITY CLASSES
   ══════════════════════════════════════════════ */

/* ══════════════════════════════════════════════
   ACCESSIBILITY
   ══════════════════════════════════════════════ */

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="tab"]:focus-visible,
[role="button"]:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.topnav button:focus-visible,
.topnav a:focus-visible {
  outline-color: rgba(255, 255, 255, 0.7);
}

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: 100;
  background: var(--gold);
  color: var(--obsidian);
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-decoration: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 0;
}

/* ══════════════════════════════════════════════
   APP SHELL LAYOUT
   ══════════════════════════════════════════════ */

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ══════════════════════════════════════════════
   TOP NAV (increased to 64px, refined styling)
   ══════════════════════════════════════════════ */

.topnav {
  height: 64px;
  flex-shrink: 0;
  background: var(--obsidian);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  padding: 0 var(--space-8);
  position: relative;
  z-index: 20;
}

.topnav::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gold);
  z-index: 1;
}

.topnav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 var(--layout-gutter);
}

.topnav__logo {
  display: flex;
  align-items: center;
  color: var(--white);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.05em;
  margin-right: var(--space-6);
}

.topnav__logo img {
  height: 24px;
  width: auto;
  margin-right: var(--space-3);
}

.topnav button {
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  border: none;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: color var(--transition-fast);
  white-space: nowrap;
  position: relative;
}

.topnav button:hover {
  color: rgba(255, 255, 255, 0.9);
}

/* Active tab indicator: gold underline + full white text */
.topnav button.active {
  color: var(--white);
  font-weight: var(--weight-semibold);
}

.topnav button.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: var(--space-4);
  right: var(--space-4);
  height: 2px;
  background: var(--gold);
  border-radius: 1px;
}

.topnav button[aria-current="page"] {
  color: var(--white);
  font-weight: var(--weight-semibold);
}

.topnav__right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

/* ══════════════════════════════════════════════
   BODY LAYOUT
   ══════════════════════════════════════════════ */

.body-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ══════════════════════════════════════════════
   DASH PANEL (main view switcher)
   ══════════════════════════════════════════════ */

.dash-panel {
  flex: 1;
  overflow-y: auto;
  display: none;
  flex-direction: column;
}

.dash-panel.active {
  display: flex;
}

.dash-panel::-webkit-scrollbar {
  width: 8px;
}

.dash-panel::-webkit-scrollbar-track {
  background: transparent;
}

.dash-panel::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.dash-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* ══════════════════════════════════════════════
   IFRAME CONTAINER
   ══════════════════════════════════════════════ */

.content-frame {
  flex: 1;
  overflow: auto;
  border: none;
}

.content-frame::-webkit-scrollbar {
  width: 8px;
}

.content-frame::-webkit-scrollbar-track {
  background: transparent;
}

.content-frame::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.content-frame::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* ══════════════════════════════════════════════
   HOME DASHBOARD
   ══════════════════════════════════════════════ */

.dash-home {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  background: var(--surface);
}

.dash-home__inner {
  margin: 0 auto;
  padding: var(--space-12) var(--layout-gutter);
  width: 100%;
}

/* ──────────────────────────────────────────── */
/* Two-column layout: activity feed + action queue */

.home-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
  margin-bottom: var(--space-12);
}

.home-columns--gates {
  grid-template-columns: 1fr;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* Activity feed full width, then gates in a responsive grid */
.home-columns--gates > .home-card:first-child {
  width: 100%;
}

.home-columns--gates > .home-card--gate {
  width: 100%;
}

.home-card {
  background: var(--white);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  overflow: hidden;
}

.home-card h2 {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--obsidian);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--border-soft);
}

/* Area health cards */

.area-health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-12);
  max-width: 100%;
}

.area-health-card {
  background: var(--white);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-width: 0;
}

.area-health-card:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--border);
  transform: translateY(-1px);
}

.area-health-card__accent {
  width: 4px;
  height: 100%;
  min-height: 40px;
  border-radius: 2px;
  flex-shrink: 0;
  align-self: stretch;
}

.area-health-card__body {
  flex: 1;
  min-width: 0;
}

.area-health-card__name {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--obsidian);
  margin-bottom: var(--space-2);
}

.area-health-card__meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.ahc-stat {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.ahc-stat__value {
  font-weight: var(--weight-bold);
  color: var(--steel);
}

.ahc-stat__value--teal { color: var(--teal); }
.ahc-stat__value--gold { color: var(--gold); }

.ahc-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
}

.ahc-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-2);
}

.ahc-action {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 3px;
}

.ahc-action--draft { background: rgba(200, 169, 110, 0.15); color: #9A7B3F; }
.ahc-action--request { background: rgba(13, 107, 110, 0.1); color: var(--teal); }
.ahc-action--auto { background: rgba(124, 58, 237, 0.1); color: #7C3AED; }

/* Per-area pipeline summary */
.ahc-pipeline {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-1);
}

.ahc-pip {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 2px;
}

.ahc-pip__icon {
  font-size: 10px;
  opacity: 0.6;
}

.ahc-pip--warn {
  color: var(--caution, #D97706);
  font-weight: var(--weight-semibold);
}

.ahc-pip--gold {
  color: #96793C;
  font-weight: var(--weight-semibold);
}

.ahc-pip--teal {
  color: var(--teal);
  font-weight: var(--weight-semibold);
}

.ahc-pip--active {
  color: var(--steel);
  font-weight: var(--weight-semibold);
}

.ahc-pip--clear {
  color: var(--muted);
  font-style: italic;
}

.ahc-pip-sep {
  width: 1px;
  height: 10px;
  background: var(--border);
  flex-shrink: 0;
}

.area-health-card__arrow {
  color: var(--muted);
  flex-shrink: 0;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
}

.area-health-card:hover .area-health-card__arrow {
  transform: translateX(2px);
  color: var(--obsidian);
}

/* Home footer */

.home-footer {
  margin-top: var(--space-12);
  padding-top: var(--space-8);
  border-top: 1px solid var(--border-soft);
  display: flex;
  justify-content: space-between;
}

.home-footer__text {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.home-footer__conf {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--border);
  letter-spacing: 0.04em;
}

/* ══════════════════════════════════════════════
   ACTIVITY FEED & ACTION QUEUE
   ══════════════════════════════════════════════ */

/* Action items in queue */

.action-item {
  padding: var(--space-4);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  background: var(--surface);
  transition: all var(--transition-fast);
}

.action-item:hover {
  box-shadow: var(--shadow-xs);
  border-color: var(--border);
}

.action-item__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-3);
}

.action-item__title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--obsidian);
  margin: 0;
  margin-bottom: var(--space-1);
}

.action-item__type {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--obsidian);
  background: var(--white);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  display: inline-block;
}

.action-item__subtitle {
  font-size: var(--text-xs);
  color: var(--muted);
  margin-bottom: var(--space-3);
}

.action-item__badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.action-item__badge {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--steel);
  border: none;
}

.action-item__actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
}

.action-item__action-btn {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--steel);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.action-item__action-btn:hover {
  background: var(--obsidian);
  color: var(--white);
  border-color: var(--obsidian);
}

.action-item__action-btn--approve {
  background: var(--teal);
  color: var(--white);
  border-color: var(--teal);
}

.action-item__action-btn--approve:hover {
  opacity: 0.9;
}

.action-item__empty {
  text-align: center;
  padding: var(--space-6) 0;
  color: var(--muted);
  font-size: var(--text-sm);
}

/* ══════════════════════════════════════════════
   AREA VIEW LAYOUT
   ══════════════════════════════════════════════ */

.area-view {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--white);
}

/* Pulse Zone (header section) */

.pulse-zone {
  flex-shrink: 0;
  padding: var(--space-10) var(--layout-gutter) var(--space-8);
  border-bottom: 1px solid var(--border-soft);
  background: var(--white);
}

/* Pulse Zone Extended */

.pulse-header {
  margin-bottom: var(--space-6);
}

.pulse-header__title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--obsidian);
  margin-bottom: var(--space-2);
}

.pulse-header__desc {
  font-size: var(--text-sm);
  color: var(--steel);
  line-height: var(--leading-normal);
}

.pulse-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.pulse-stat {
  padding: var(--space-4);
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
}

.pulse-stat__value {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--obsidian);
  margin-bottom: var(--space-1);
}

.pulse-stat__value--teal { color: var(--teal); }
.pulse-stat__value--gold { color: var(--gold); }

.pulse-stat__label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.pulse-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* Knowledge Zone (cards grid) */

.knowledge-zone {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-8);
  background: var(--white);
}

.knowledge-zone::-webkit-scrollbar {
  width: 8px;
}

.knowledge-zone::-webkit-scrollbar-track {
  background: transparent;
}

.knowledge-zone::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.knowledge-zone::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

.knowledge-zone {
  padding: var(--space-8) var(--layout-gutter) var(--space-12);
}

.knowledge-zone__controls {
  display: flex;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
  align-items: center;
}

.knowledge-zone__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-6);
}

/* KZ Card Classes */

.kz-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: all var(--transition-base);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  position: relative;
}

.kz-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  transition: background var(--transition-fast);
}

.kz-card:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.kz-card:hover::before {
  background: var(--gold);
}

.kz-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.kz-card__stability {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 2px var(--space-2);
  border-radius: 2px;
  background: rgba(13, 107, 110, 0.1);
  color: var(--teal);
  flex-shrink: 0;
}

.kz-card__source {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kz-card__title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--obsidian);
  line-height: var(--leading-snug);
}

.kz-card__tldr {
  font-size: var(--text-xs);
  color: var(--steel);
  line-height: var(--leading-body);
}

.kz-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  border-top: 1px solid var(--border-soft);
  padding-top: var(--space-3);
  margin-top: auto;
}

.kz-card__confidence {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kz-card__related {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
}

.kz-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.kz-card__tag {
  font-size: 10px;
  padding: 1px var(--space-2);
  background: var(--surface);
  color: var(--steel);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}

/* Page-level action flags on cards */
.kz-card__actions {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.kz-card__action {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 3px;
}

.kz-card__action--request { background: rgba(13, 107, 110, 0.1); color: var(--teal); }
.kz-card__action--lint { background: rgba(217, 119, 6, 0.1); color: #D97706; }

.kz-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-12) var(--space-4);
  color: var(--muted);
  font-size: var(--text-sm);
}

.kz-filters {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.kz-filter {
  padding: var(--space-1) var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--steel);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.kz-filter:hover {
  border-color: var(--gold);
  background: #fff;
}

.kz-filter.active {
  background: var(--teal);
  color: white;
  border-color: var(--teal);
}

.kz-search {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
}

.kz-search:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13, 107, 110, 0.1);
}

/* ══════════════════════════════════════════════
   REQUEST/DRAFT MODAL
   ══════════════════════════════════════════════ */


/* ══════════════════════════════════════════════
   UTILITY CLASSES (additional)
   ══════════════════════════════════════════════ */

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.no-scroll {
  overflow: hidden !important;
}

/* ══════════════════════════════════════════════
   TOP NAV EXTENDED (wordmark, avatar, profile panel, request btn)
   ══════════════════════════════════════════════ */

.logo-mark {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-mark svg {
  width: 28px;
  height: 28px;
}

.topnav__wordmark {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.topnav__wordmark__primary {
  display: flex;
  align-items: center;
  gap: 0;
}

.topnav__wordmark__primary span {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: var(--weight-bold);
  letter-spacing: 0.1em;
  line-height: 1;
}

.wm-text { color: #fff; }
.wm-gold { color: var(--gold); }

.topnav__items {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1;
}

/* Nav group */
.topnav__group {
  display: flex;
  align-items: center;
}

.topnav__group-btns {
  display: flex;
  align-items: center;
  gap: 2px;
}

/* Vertical separator between nav groups */
.topnav__sep {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, 0.15);
  margin: 0 10px;
}

/* Profile wrap: relative container so the dropdown positions correctly */
.topnav__profile-wrap {
  position: relative;
}

/* Avatar button: borderless icon-only button */
.topnav button.topnav__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: background var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  position: relative;
}

.topnav button.topnav__avatar:hover {
  background: rgba(255, 255, 255, 0.12);
}

.topnav button.topnav__avatar[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.15);
}

/* Profile dropdown panel */
.topnav__profile-panel {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  min-width: 240px;
  z-index: 30;
  overflow: hidden;
}

.topnav__profile-panel.open { display: block; }

.topnav__profile-panel__header {
  padding: var(--space-5);
  border-bottom: 1px solid var(--border);
}

.topnav__profile-panel__name {
  font-size: 14px;
  font-weight: var(--weight-semibold);
  color: var(--obsidian);
  margin-bottom: var(--space-1);
}

.topnav__profile-panel__email {
  font-size: var(--text-xs);
  color: var(--muted);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

.topnav__profile-panel__role {
  font-size: var(--text-xs);
  color: var(--muted);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.topnav__profile-panel__footer {
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-xs);
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

/* Sign out action inside the profile dropdown */
.topnav__profile-panel__actions {
  padding: var(--space-2) var(--space-2);
}

.topnav__profile-signout {
  display: block;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: none;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: var(--weight-medium);
  color: var(--obsidian);
  cursor: pointer;
  text-align: left;
  transition: background var(--transition-fast);
}

.topnav__profile-signout:hover {
  background: #f5f5f3;
  color: #c0392b;
}

/* Request button — kept in CSS for backward compat but hidden by default */
.topnav button.topnav__request-btn {
  background: var(--teal);
  border: 1.5px solid var(--teal);
  color: #fff;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.topnav button.topnav__request-btn svg { width: 12px; height: 12px; }

.topnav button.topnav__request-btn:hover {
  background: #0A5558;
  border-color: #0A5558;
  color: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Legacy standalone logout button — hidden; Sign Out now lives in profile dropdown */
.topnav button.topnav__logout {
  display: none;
}

.topnav__hamburger {
  display: none;
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
}

/* ══════════════════════════════════════════════
   HOME DASHBOARD EXTENDED (header, stats, columns)
   ══════════════════════════════════════════════ */

.home-header {
  margin-bottom: var(--space-10);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.home-header__greeting {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--obsidian);
  line-height: var(--leading-tight);
}

.home-header__right {
  display: flex;
  gap: var(--space-8);
}

.home-header__date {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.home-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-10);
}

.home-stat {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: all var(--transition-fast);
}

.home-stat:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow-sm);
}

.home-stat__value {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--obsidian);
  margin-bottom: var(--space-1);
}

.home-stat__value--teal { color: var(--teal); }
.home-stat__value--gold { color: var(--gold); }
.home-stat__value--caution { color: var(--caution, #D97706); }

.home-stat__label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ── Pipeline Flow (left-to-right process visualization) ── */
.pipeline-flow {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-10) var(--space-8) var(--space-8);
  margin-bottom: var(--space-4);
  background: var(--white);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
}

.pipeline-flow__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 100px;
  padding: var(--space-2);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

.pipeline-flow__step:hover {
  background: var(--white);
}

.pipeline-flow__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: var(--weight-semibold);
}

.pipeline-flow__icon svg {
  width: 18px;
  height: 18px;
}

.pipeline-flow__stat {
  font-size: 28px;
  font-weight: var(--weight-bold);
  color: var(--obsidian);
  line-height: 1.1;
  margin-top: var(--space-2);
}

.pipeline-flow__icon--brain { background: rgba(13, 107, 110, 0.15); color: var(--teal); }
.pipeline-flow__icon--intake { background: rgba(13, 107, 110, 0.1); color: var(--teal); }
.pipeline-flow__icon--forge { background: rgba(13, 107, 110, 0.1); color: var(--teal); }
.pipeline-flow__icon--gate { background: rgba(200, 169, 110, 0.15); color: #9A7B3F; }
.pipeline-flow__icon--pulse { background: rgba(200, 169, 110, 0.15); color: #9A7B3F; }
.pipeline-flow__icon--scout { background: rgba(22, 163, 74, 0.1); color: #16A34A; }

.pipeline-flow__label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--obsidian);
  margin-top: var(--space-1);
}

.pipeline-flow__sub {
  font-size: 11px;
  color: var(--muted);
}

.pipeline-flow__arrow {
  font-size: 18px;
  color: var(--border);
  margin: 0 var(--space-1);
  margin-top: 36px;
}

.pipeline-flow__sep {
  width: 1px;
  height: 48px;
  background: var(--border-soft);
  margin: 24px var(--space-2) 0;
}

.pipeline-flow__step--gated .pipeline-flow__stat {
  font-weight: var(--weight-bold);
}

/* ── Orientation (collapsible how-it-works) ── */
.home-orient {
  margin-bottom: var(--space-4);
}

.home-orient__toggle {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: var(--weight-medium);
  color: var(--muted);
  cursor: pointer;
  padding: var(--space-2) 0;
  list-style: none;
}

.home-orient__toggle::-webkit-details-marker { display: none; }
.home-orient__toggle::before { content: '\25B6 '; font-size: 8px; margin-right: var(--space-2); }
.home-orient[open] .home-orient__toggle::before { content: '\25BC '; }

.home-orient__body {
  padding: var(--space-4) var(--space-6);
  background: var(--surface);
  border-radius: var(--radius-md);
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--steel);
  line-height: var(--leading-snug);
}

.home-orient__body p { margin: 0 0 var(--space-3) 0; }
.home-orient__body p:last-child { margin-bottom: 0; }

@media (max-width: 600px) {
  .pipeline-flow { flex-wrap: wrap; gap: var(--space-3); }
  .pipeline-flow__arrow { display: none; }
}

/* ── Pipeline Action Buttons ─────────────────── */
.home-pipeline-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
  padding: var(--space-4) var(--space-6);
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.pipeline-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), opacity var(--transition-fast);
  white-space: nowrap;
}

.pipeline-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

.pipeline-btn--intake,
.pipeline-btn--forge,
.pipeline-btn--lint,
.pipeline-btn--scout {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}
.pipeline-btn--intake:hover:not(:disabled),
.pipeline-btn--forge:hover:not(:disabled),
.pipeline-btn--lint:hover:not(:disabled),
.pipeline-btn--scout:hover:not(:disabled) { background: #0A5558; border-color: #0A5558; }

.pipeline-btn--gate {
  background: var(--gold);
  color: #fff;
  border-color: var(--gold);
}
.pipeline-btn--gate:hover:not(:disabled) { background: #9A7B3F; border-color: #9A7B3F; }

.pipeline-btn__auto,
.pipeline-btn__manual {
  font-family: var(--font-mono);
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 1px 4px;
  border-radius: 2px;
  margin-left: var(--space-1);
}

.pipeline-btn__auto {
  background: rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.9);
}

.pipeline-btn__manual {
  background: rgba(255,255,255,0.3);
  color: #fff;
  font-weight: var(--weight-semibold);
}

.pipeline-status {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--muted);
  margin-left: auto;
}
.pipeline-status--success { color: var(--green, #16A34A); }
.pipeline-status--warning { color: var(--caution, #D97706); }
.pipeline-status--error { color: var(--danger, #DC2626); }

@media (max-width: 600px) {
  .home-pipeline-actions { flex-wrap: wrap; }
  .pipeline-status { width: 100%; margin-left: 0; margin-top: var(--space-2); }
}

.home-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-8);
  margin-bottom: var(--space-10);
}

@media (max-width: 1200px) {
  .home-columns { grid-template-columns: 1fr; }
}

.home-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all var(--transition-fast);
}

.home-card:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow-sm);
}

.home-card__header {
  padding: var(--space-5);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--obsidian);
}

.home-card__header svg { color: var(--teal); flex-shrink: 0; }

.home-card__body {
  padding: var(--space-5);
  flex: 1;
  overflow-y: auto;
}

.home-card__empty {
  text-align: center;
  padding: var(--space-8);
  color: var(--muted);
  font-size: var(--text-sm);
}

.home-section {
  margin-bottom: var(--space-10);
}

.home-section__label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--obsidian);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-5);
  display: block;
}

.home-section__label::before {
  content: '';
  display: inline-block;
  width: 3rem;
  height: 1px;
  background: var(--gold);
  margin-right: var(--space-4);
  vertical-align: middle;
}

.search-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--obsidian);
  transition: all var(--transition-fast);
}

.search-input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13, 107, 110, 0.1);
}

/* Activity Feed & Action Queue */

.feed-item {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

.feed-item:last-child { border-bottom: none; }

.feed-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  background: rgba(13, 107, 110, 0.1);
  color: var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}

.feed-summary { flex: 1; }

.feed-area {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-1);
}

.feed-time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
}

.action-item {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.action-item:last-child { border-bottom: none; }
.action-item--draft { }
.action-item--requests { }

.action-item__badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 2px var(--space-2);
  border-radius: 2px;
  display: inline-block;
}

.action-item__badge--draft {
  background: rgba(200, 169, 110, 0.15);
  color: #96793C;
}

.action-item__badge--request {
  background: rgba(13, 107, 110, 0.12);
  color: var(--teal);
}

.action-item__area {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  background: var(--surface);
  border-radius: var(--radius-sm);
}

.action-item__title {
  font-size: 13px;
  font-weight: var(--weight-semibold);
  color: var(--obsidian);
}

.action-item__time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
}

.action-item__summary {
  font-size: var(--text-xs);
  color: var(--steel);
  line-height: var(--leading-snug);
}

.action-item__actions {
  display: flex;
  gap: var(--space-2);
}

.action-btn {
  padding: var(--space-2) var(--space-4);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.action-btn--approve {
  background: var(--teal);
  color: white;
}

.action-btn--approve:hover {
  background: #0A5558;
  box-shadow: var(--shadow-sm);
}

.action-btn--reject {
  background: rgba(220, 38, 38, 0.1);
  color: #DC2626;
}

.action-btn--reject:hover {
  background: rgba(220, 38, 38, 0.2);
}

/* Pulse/Scout action buttons */
.action-btn--acknowledge {
  background: rgba(200, 169, 110, 0.15);
  color: #96793C;
}

.action-btn--acknowledge:hover {
  background: rgba(200, 169, 110, 0.3);
}

.action-btn--dismiss {
  background: var(--surface);
  color: var(--muted);
}

.action-btn--dismiss:hover {
  background: var(--border-soft);
  color: var(--steel);
}

.action-btn--accept {
  background: var(--teal);
  color: white;
}

.action-btn--accept:hover {
  background: #0A5558;
  box-shadow: var(--shadow-sm);
}

.action-btn--defer {
  background: rgba(200, 169, 110, 0.15);
  color: #96793C;
}

.action-btn--defer:hover {
  background: rgba(200, 169, 110, 0.3);
}

.action-btn--reject-scout {
  background: rgba(220, 38, 38, 0.1);
  color: #DC2626;
}

.action-btn--reject-scout:hover {
  background: rgba(220, 38, 38, 0.2);
}

/* Severity badges for Pulse Gate */
.action-item__badge--error {
  background: rgba(220, 38, 38, 0.12);
  color: #DC2626;
}

.action-item__badge--warning {
  background: rgba(217, 119, 6, 0.12);
  color: #D97706;
}

/* Gate card header variants */
.home-card__header--forge { border-left: 3px solid var(--gold); padding-left: var(--space-3); }
.home-card__header--pulse { border-left: 3px solid var(--caution, #D97706); padding-left: var(--space-3); }
.home-card__header--scout { border-left: 3px solid var(--teal); padding-left: var(--space-3); }

/* Gate count badge */
.home-card__count {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: var(--weight-bold);
  background: var(--surface);
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: auto;
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

/* Search Results Extended */

.search-result {
  padding: var(--space-4);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.search-result:hover {
  background: var(--surface);
  border-color: var(--teal);
}

.search-result__title {
  font-size: 13px;
  font-weight: var(--weight-semibold);
  color: var(--obsidian);
  margin-bottom: var(--space-2);
}

.search-result__meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-xs);
}

.search-result__area { color: var(--muted); }

.search-result__stability {
  font-size: 10px;
  padding: 2px var(--space-2);
  border-radius: 2px;
  font-weight: var(--weight-medium);
  background: rgba(13, 107, 110, 0.1);
  color: var(--teal);
}

.search-no-results {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--muted);
  font-size: var(--text-sm);
}

/* ══════════════════════════════════════════════
   REQUEST MODAL & OVERLAY
   ══════════════════════════════════════════════ */

.request-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(26, 26, 26, 0.5);
  z-index: 50;
  align-items: center;
  justify-content: center;
}

.request-overlay.open { display: flex; }

.request-modal {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  max-width: 440px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.request-modal__header {
  padding: var(--space-6);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.request-modal__title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--obsidian);
}

.request-modal__close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 20px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.request-modal__close:hover {
  color: var(--obsidian);
  background: var(--surface);
}

/* Source page banner (shown when request originates from a specific page) */
.request-source {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-6);
  background: var(--teal-soft);
  border-bottom: 1px solid rgba(13, 107, 110, 0.15);
  font-size: var(--text-xs);
}

.request-source__label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--teal);
}

.request-source__page {
  color: var(--obsidian);
  font-weight: var(--weight-medium);
}

.request-modal__types {
  padding: var(--space-5) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.request-type-card {
  padding: var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}

.request-type-card:hover {
  border-color: var(--teal);
  background: rgba(13, 107, 110, 0.03);
}

.request-type-card__icon {
  display: flex;
  align-items: center;
  margin-bottom: var(--space-2);
  color: var(--teal);
}

.request-type-card__icon svg {
  width: 20px;
  height: 20px;
}

.request-type-card__label {
  font-size: 14px;
  font-weight: var(--weight-semibold);
  color: var(--obsidian);
  display: block;
  margin-bottom: var(--space-1);
}

.request-type-card__desc {
  font-size: var(--text-xs);
  color: var(--muted);
  line-height: var(--leading-snug);
  display: block;
}

.request-modal__form {
  padding: var(--space-5) var(--space-6) var(--space-6);
}

.request-modal__back {
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: var(--weight-medium);
  cursor: pointer;
  padding: 0;
  margin-bottom: var(--space-4);
  transition: color var(--transition-fast);
}

.request-modal__back:hover { color: var(--obsidian); }

.request-modal__form-type {
  font-size: 13px;
  font-weight: var(--weight-semibold);
  color: var(--obsidian);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.request-field { margin-bottom: var(--space-4); }

.request-field__label {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--obsidian);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-2);
}

.request-field__input,
.request-field__select,
.request-field__textarea {
  display: block;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--obsidian);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  box-sizing: border-box;
}
.request-field__select {
  height: 42px; /* match input height: padding(12+12) + font(14) + border(2) */
  background: var(--white);
}

.request-field__input:focus,
.request-field__select:focus,
.request-field__textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13, 107, 110, 0.1);
}

.request-field__textarea { min-height: 80px; resize: vertical; }

.request-field__actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

.request-field__btn {
  flex: 1;
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.request-field__btn--primary {
  background: var(--teal);
  color: white;
}

.request-field__btn--primary:hover { background: #0A5558; }

.request-field__btn--ghost {
  background: none;
  color: var(--muted);
  border: 1px solid var(--border);
}

.request-field__btn--ghost:hover {
  border-color: var(--obsidian);
  color: var(--obsidian);
}

.request-field__context {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  padding: var(--space-2) 0;
  letter-spacing: 0.02em;
}

/* Baseline metrics section (automation requests) */
.request-metrics {
  border-top: 1px solid rgba(0,0,0,0.08);
  padding-top: var(--space-5);
  margin-top: var(--space-4);
}
.request-metrics__label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: var(--space-4);
}
.request-metrics__row {
  display: flex;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  align-items: flex-start;
}
.request-field--half { flex: 1; min-width: 0; margin-bottom: 0; }
.request-field__textarea--short { min-height: 56px; height: 56px; }

.request-field__success {
  padding: var(--space-4);
  background: rgba(22, 163, 74, 0.1);
  color: #16A34A;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  text-align: center;
  margin-top: var(--space-4);
}

/* ══════════════════════════════════════════════
   LOADING SCREEN & GETTING STARTED
   ══════════════════════════════════════════════ */

.loading-screen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--obsidian);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  z-index: 100;
}

.loading-screen.hidden { display: none; }

.loading-screen__rule {
  width: 3rem;
  height: 1px;
  background: var(--gold);
  margin-bottom: var(--space-4);
}

.loading-screen__name {
  font-size: var(--text-md);
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.loading-screen__sub {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin-top: 4px;
}

.loading-screen__status {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.4);
  font-family: var(--font-mono);
}

.iframe-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: #fff;
}

.iframe-loader.hidden { display: none; }

.iframe-loader__spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════
   AREA VIEW INNER
   ══════════════════════════════════════════════ */

.area-view__inner {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

/* ══════════════════════════════════════════════
   PULSE ACTION BUTTON VARIANTS
   ══════════════════════════════════════════════ */

.pulse-action-btn {
  padding: var(--space-2) var(--space-5);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.pulse-action-btn--primary {
  background: var(--teal);
  color: white;
  border-color: var(--teal);
}

.pulse-action-btn--primary:hover {
  background: #0A5558;
  border-color: #0A5558;
  box-shadow: var(--shadow-sm);
}

.pulse-action-btn--ghost {
  background: transparent;
  color: var(--teal);
  border-color: var(--teal);
}

.pulse-action-btn--ghost:hover {
  background: rgba(13, 107, 110, 0.08);
  border-color: #0A5558;
  color: #0A5558;
}

.pulse-action-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

.pulse-pipeline-status {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--muted);
  margin-top: var(--space-2);
  min-height: 20px;
}
.pulse-pipeline-status--success { color: var(--green, #16A34A); }
.pulse-pipeline-status--warning { color: var(--caution, #D97706); }
.pulse-pipeline-status--error { color: var(--danger, #DC2626); }

/* ══════════════════════════════════════════════
   PRINT STYLES
   ══════════════════════════════════════════════ */

@media print {
  .topnav,
  .request-overlay {
    display: none;
  }

  .content {
    overflow: visible;
  }

  .dash-panel {
    overflow: visible;
  }
}

/* ══════════════════════════════════════════════
   RESPONSIVE DESIGN
   ══════════════════════════════════════════════ */

@media (max-width: 1024px) {
  .topnav {
    padding: 0 var(--space-6);
  }

  .topnav__inner {
    padding: 0 var(--space-4);
  }

  .knowledge-zone__grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }

}

/* ══════════════════════════════════════════════
   PIPELINE TAB BADGES (v14)
   ══════════════════════════════════════════════ */

.topnav__badge {
  display: none;
  margin-left: 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: var(--weight-semibold);
  padding: 1px 5px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.7);
  vertical-align: middle;
}

.topnav__badge.visible {
  display: inline-block;
}

.topnav__badge--alert {
  background: var(--gold);
  color: var(--obsidian);
}

/* ══════════════════════════════════════════════
   TAB VIEW (shared layout for Brain, Intake, Forge, Pulse, Scout)
   ══════════════════════════════════════════════ */

.tab-view {
  flex: 1;
  overflow-y: auto;
  background: var(--surface);
}

.tab-view__inner {
  margin: 0 auto;
  padding: var(--space-10) var(--layout-gutter);
  width: 100%;
}

.tab-header {
  margin-bottom: var(--space-8);
}

.tab-header__title {
  font-size: 20px;
  font-weight: var(--weight-bold);
  color: var(--obsidian);
  margin-bottom: var(--space-2);
}

.tab-header__desc {
  font-size: var(--text-sm);
  color: var(--muted);
  line-height: 1.6;
  max-width: 600px;
}

.tab-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}

.tab-section {
  margin-bottom: var(--space-10);
}

.tab-section__label {
  display: block;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-soft);
}

.tab-loading {
  font-size: var(--text-sm);
  color: var(--muted);
  padding: var(--space-6) 0;
}

.tab-empty {
  font-size: var(--text-sm);
  color: var(--muted);
  padding: var(--space-6) 0;
  text-align: center;
}

/* ══════════════════════════════════════════════
   BRAIN TAB: area chips, stability sub-filters, page cards
   ══════════════════════════════════════════════ */

.tab-controls {
  margin-bottom: var(--space-6);
}

.brain-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.brain-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--steel);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.brain-chip:hover {
  border-color: var(--steel);
}

.brain-chip.active {
  background: var(--obsidian);
  color: var(--white);
  border-color: var(--obsidian);
}

.brain-chip:not(.active)[data-area]:not([data-area="all"]) {
  border-left: 3px solid var(--chip-accent, var(--muted));
}

.brain-chip__count {
  font-family: var(--font-mono);
  font-size: 9px;
  opacity: 0.7;
}

.brain-subfilters {
  display: flex;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
}

.brain-sub {
  padding: 3px 10px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.brain-sub:hover {
  color: var(--steel);
}

.brain-sub.active {
  color: var(--steel);
  border-color: var(--border-soft);
  background: var(--surface);
}

.brain-search {
  width: 100%;
  max-width: 320px;
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--steel);
  transition: border-color var(--transition-fast);
}

.brain-search:focus {
  outline: none;
  border-color: var(--teal);
}

.brain-search::placeholder {
  color: var(--muted);
}

.brain-empty {
  text-align: center;
  padding: var(--space-12) 0;
  font-size: var(--text-sm);
  color: var(--muted);
}

.tab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-4);
}

.brain-card {
  position: relative;
  background: var(--white);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  cursor: pointer;
  transition: all var(--transition-fast);
  overflow: hidden;
}

.brain-card__accent {
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--card-accent, var(--muted));
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.brain-card:hover {
  border-color: var(--card-accent, var(--steel));
  box-shadow: var(--shadow-sm);
}

.brain-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}

.brain-card__area {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.brain-card__stability {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.brain-card__title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--obsidian);
  margin-bottom: var(--space-2);
  line-height: 1.3;
}

.brain-card__tldr {
  font-size: var(--text-xs);
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: var(--space-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.brain-card__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted);
}

.brain-card__tags {
  display: flex;
  gap: var(--space-1);
  margin-left: auto;
}

.brain-card__tag {
  padding: 1px 6px;
  font-size: 9px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  color: var(--muted);
}

/* ══════════════════════════════════════════════
   INTAKE TAB: source cards, record groups
   ══════════════════════════════════════════════ */

.pipeline-btn--secondary {
  background: transparent;
  color: var(--steel);
  border: 1px solid var(--border-soft);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  transition: all var(--transition-fast);
}

.pipeline-btn--secondary:hover {
  border-color: var(--steel);
  background: var(--surface);
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}

.source-card {
  position: relative;
  background: var(--white);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.source-card__accent {
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
}

.source-card__body {
  padding: var(--space-5) var(--space-5) var(--space-5) var(--space-6);
}

.source-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}

.source-card__name {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--obsidian);
}

.source-card__status {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
}

.source-card__status--active {
  background: rgba(13, 107, 110, 0.1);
  color: var(--teal);
}

.source-card__status--inactive {
  background: rgba(102, 112, 133, 0.1);
  color: var(--muted);
}

.source-card__meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted);
}

.source-card__desc {
  font-size: var(--text-xs);
  color: var(--muted);
  margin-bottom: var(--space-3);
  line-height: 1.5;
}

.source-card__weight {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.source-card__weight-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.source-card__weight-bar {
  flex: 1;
  height: 4px;
  background: var(--surface);
  border-radius: 2px;
  overflow: hidden;
}

.source-card__weight-fill {
  height: 100%;
  background: var(--teal);
  border-radius: 2px;
  transition: width var(--transition-fast);
}

.source-card__weight-value {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: var(--weight-semibold);
  color: var(--teal);
  min-width: 32px;
  text-align: right;
}

.source-card__weight-slider {
  flex: 1;
  height: 4px;
  appearance: none;
  -webkit-appearance: none;
  background: var(--border-soft);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.source-card__weight-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--teal);
  cursor: pointer;
  border: 2px solid var(--white);
  box-shadow: 0 1px 2px rgba(0,0,0,0.12);
}

.source-card__weight-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--teal);
  cursor: pointer;
  border: 2px solid var(--white);
  box-shadow: 0 1px 2px rgba(0,0,0,0.12);
}

/* Pipeline directive editor */
.directive-slot {
  margin-bottom: 4px;
}

.tab-guidance {
  margin: 0 0 16px;
}

.guidance-details {
  background: var(--surface);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 8px;
}

.guidance-details__toggle {
  padding: 10px 14px;
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
}

.guidance-details__body {
  padding: 0 14px 14px;
  font-size: 13px;
  color: var(--steel);
  line-height: 1.6;
}

.guidance-details__body p {
  margin: 0 0 8px;
}

.guidance-details__body strong {
  color: var(--obsidian);
}

.directive-editor {
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface);
  padding: 0;
  margin: 8px 0;
}

.directive-editor__toggle {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  cursor: pointer;
  padding: 8px 12px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.directive-editor__toggle::-webkit-details-marker { display: none; }
.directive-editor__toggle::before {
  content: '\25B6';
  font-size: 7px;
  transition: transform 0.15s ease;
}
details[open] > .directive-editor__toggle::before {
  transform: rotate(90deg);
}

.directive-editor__body {
  padding: 0 12px 10px;
}

.directive-editor__hint {
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 6px;
  line-height: 1.4;
}

.directive-editor__text {
  width: 100%;
  min-height: 60px;
  padding: 8px;
  font-family: var(--font-sans);
  font-size: 11px;
  line-height: 1.5;
  color: var(--steel);
  background: var(--white);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  resize: vertical;
  box-sizing: border-box;
}

.directive-editor__text:focus {
  outline: none;
  border-color: var(--teal);
}

.directive-editor__save {
  margin-top: 6px;
}

/* Extraction instructions expandable section */
.source-card__instructions {
  margin-top: 8px;
  border-top: 1px solid var(--border-soft);
  padding-top: 6px;
}

.source-card__instructions-toggle {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 0;
  list-style: none;
}

.source-card__instructions-toggle::-webkit-details-marker { display: none; }
.source-card__instructions-toggle::before {
  content: '\25B6';
  display: inline-block;
  margin-right: 4px;
  font-size: 7px;
  transition: transform 0.15s ease;
}
details[open] > .source-card__instructions-toggle::before {
  transform: rotate(90deg);
}

.source-card__instructions-text {
  width: 100%;
  min-height: 48px;
  margin-top: 6px;
  padding: 8px;
  font-family: var(--font-sans);
  font-size: 11px;
  line-height: 1.5;
  color: var(--steel);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  resize: vertical;
  box-sizing: border-box;
}

.source-card__instructions-text:focus {
  outline: none;
  border-color: var(--teal);
}

.gate-btn--small {
  padding: 3px 10px;
  font-size: 10px;
  margin-top: 4px;
}

.source-card--proposed {
  opacity: 0.7;
  border-style: dashed;
}

.source-card__status--proposed {
  color: var(--gold);
}

.source-section__label {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: var(--space-2);
  margin-top: var(--space-3);
}

.source-propose {
  margin-top: var(--space-3);
}

.gate-btn--propose-source {
  color: var(--teal);
  border-color: var(--teal);
  border-style: dashed;
}

.gate-btn--propose-source:hover {
  background: rgba(13, 107, 110, 0.06);
}

.source-propose__form {
  margin-top: var(--space-3);
  padding: var(--space-4);
  background: var(--white);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
}

.record-group {
  margin-bottom: var(--space-4);
  background: var(--white);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.record-group__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
}

.record-group__name {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--steel);
}

.record-group__count {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted);
}

.record-group__items {
  padding: var(--space-2) 0;
}

.record-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
}

.record-item__area {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  min-width: 60px;
}

.record-item__type {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: rgba(13, 107, 110, 0.08);
  color: var(--teal);
  white-space: nowrap;
}

.record-item__title {
  flex: 1;
  color: var(--steel);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-item__time {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted);
}

.record-item--more {
  color: var(--muted);
  font-style: italic;
  padding: var(--space-2) var(--space-4);
}

/* ══════════════════════════════════════════════
   GATE ITEMS (shared by Forge, Pulse, Scout tabs)
   ══════════════════════════════════════════════ */

.gate-item {
  padding: var(--space-4) var(--space-5);
  background: var(--white);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.gate-item:hover {
  box-shadow: var(--shadow-xs);
}

.gate-item:hover {
  border-color: var(--steel);
}

.gate-item__header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  flex-wrap: wrap;
}

.gate-item__badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.gate-item__badge--draft {
  background: rgba(200, 169, 110, 0.15);
  color: #9A7B3F;
}

.gate-item__badge--error {
  background: rgba(220, 38, 38, 0.1);
  color: #DC2626;
}

.gate-item__badge--warning {
  background: rgba(217, 119, 6, 0.1);
  color: #D97706;
}

.gate-item__area {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.gate-item__category {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.gate-item__title {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--obsidian);
  flex: 1;
}

.gate-item__time {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted);
  margin-left: auto;
}

.gate-item__summary {
  font-size: var(--text-xs);
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: var(--space-2);
}

.gate-item__summary em {
  font-style: italic;
  opacity: 0.8;
}

.gate-item__meta {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted);
}

.gate-item__value {
  color: var(--teal);
  font-weight: var(--weight-semibold);
}

.gate-item__weight {
  color: var(--gold);
}

.gate-item__confidence {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.gate-item__confidence-label {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  flex-shrink: 0;
}

.gate-item__confidence-slider {
  flex: 1;
  max-width: 160px;
  height: 4px;
  appearance: none;
  -webkit-appearance: none;
  background: var(--border-soft);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.gate-item__confidence-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--teal);
  cursor: pointer;
  border: 2px solid var(--white);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.gate-item__confidence-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--teal);
  cursor: pointer;
  border: 2px solid var(--white);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.gate-item__confidence-value {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--teal);
  font-weight: var(--weight-semibold);
  min-width: 32px;
}

.gate-item__actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.gate-btn {
  padding: 4px 12px;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: transparent;
  color: var(--steel);
  transition: all var(--transition-fast);
}

.gate-btn:hover {
  border-color: var(--steel);
}

.gate-btn--approve {
  color: var(--teal);
  border-color: var(--teal);
}

.gate-btn--approve:hover {
  background: var(--teal);
  color: var(--white);
}

.gate-btn--reject, .gate-btn--reject-scout {
  color: #DC2626;
  border-color: #DC2626;
}

.gate-btn--reject:hover, .gate-btn--reject-scout:hover {
  background: #DC2626;
  color: var(--white);
}

.gate-btn--acknowledge {
  color: var(--teal);
  border-color: var(--teal);
}

.gate-btn--acknowledge:hover {
  background: var(--teal);
  color: var(--white);
}

.gate-btn--dismiss {
  color: var(--muted);
}

.gate-btn--dismiss:hover {
  background: var(--surface);
}

.gate-btn--accept {
  color: var(--teal);
  border-color: var(--teal);
}

.gate-btn--accept:hover {
  background: var(--teal);
  color: var(--white);
}

.gate-btn--defer {
  color: var(--gold);
  border-color: var(--gold);
}

.gate-btn--defer:hover {
  background: var(--gold);
  color: var(--obsidian);
}

.gate-btn--flag {
  color: #D97706;
  border-color: #D97706;
}

.gate-btn--flag:hover {
  background: #D97706;
  color: var(--white);
}

.gate-btn--discard {
  color: #DC2626;
  border-color: #DC2626;
}

.gate-btn--discard:hover {
  background: #DC2626;
  color: var(--white);
}

.gate-item--flagged {
  border-left: 3px solid #D97706;
}

/* ══════════════════════════════════════════════
   HISTORY ITEMS (recently actioned, shared)
   ══════════════════════════════════════════════ */

.history-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  background: var(--white);
  border: 1px solid var(--border-soft);
  margin-bottom: var(--space-1);
  transition: background var(--transition-fast);
}

.history-item:hover {
  background: rgba(13, 107, 110, 0.03);
}

.history-item__icon {
  font-size: 12px;
  width: 16px;
  text-align: center;
}

.history-item--approved .history-item__icon { color: var(--teal); }
.history-item--rejected .history-item__icon { color: #DC2626; }
.history-item--dismissed .history-item__icon { color: var(--muted); }
.history-item--deferred .history-item__icon { color: var(--gold); }

.history-item__title {
  flex: 1;
  color: var(--steel);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item__area {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.history-item__status {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
}

.history-item--approved .history-item__status { background: rgba(13, 107, 110, 0.1); color: var(--teal); }
.history-item--rejected .history-item__status { background: rgba(220, 38, 38, 0.1); color: #DC2626; }
.history-item--dismissed .history-item__status { background: rgba(102, 112, 133, 0.1); color: var(--muted); }
.history-item--deferred .history-item__status { background: rgba(200, 169, 110, 0.15); color: #9A7B3F; }

.history-item__time {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted);
}

.history-item__page {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item__who {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--steel);
}

.history-item__notes {
  font-size: 10px;
  color: var(--muted);
  font-style: italic;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gate-btn--reopen {
  margin-left: auto;
  color: var(--muted);
  font-size: 10px;
  padding: 2px 8px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all var(--transition-fast);
}

.gate-btn--reopen:hover {
  border-color: var(--steel);
  color: var(--steel);
}

/* ══════════════════════════════════════════════
   BULK TRIAGE BAR
   ══════════════════════════════════════════════ */

.bulk-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: rgba(13, 107, 110, 0.04);
  border: 1px solid rgba(13, 107, 110, 0.15);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
}

.bulk-bar__select-all {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--steel);
  cursor: pointer;
  user-select: none;
}

.bulk-bar__select-all input[type="checkbox"] {
  accent-color: var(--teal);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.bulk-bar__count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  margin-right: auto;
}

.bulk-bar__btn {
  padding: 4px 14px;
  font-size: 10px;
}

/* Card checkbox */
.gate-item__checkbox {
  position: absolute;
  top: 12px;
  left: -28px;
  accent-color: var(--teal);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.gate-item--selectable {
  position: relative;
  margin-left: 32px;
}

.gate-item--selectable.gate-item--selected {
  border-color: var(--teal);
  background: rgba(13, 107, 110, 0.02);
}

/* Auto-approve badge in history */
.history-item__auto-badge {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(13, 107, 110, 0.08);
  color: var(--teal);
}

/* ══════════════════════════════════════════════
   PULSE v2: FILTERS, GROUPS, CARDS, EXPAND
   ══════════════════════════════════════════════ */

/* Filter bar - two-row layout: filters on top row, sort/group-by on bottom row */
.pulse-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: var(--space-4);
}

.pulse-filters__group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  min-width: 0;
}

/* Clean row break between filter row and sort/group row */
.pulse-filters__break {
  flex-basis: 100%;
  height: 0;
  margin: 0;
  border: none;
}

.pulse-filters__label {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.pulse-filters__pills {
  display: inline-flex;
  gap: 4px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.pulse-filters__pills::-webkit-scrollbar { display: none; }

.pulse-filter-pill {
  padding: 4px 10px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: var(--weight-medium);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-transform: capitalize;
  line-height: 1.3;
  flex-shrink: 0;
}

.pulse-filter-pill:hover {
  border-color: var(--steel);
  color: var(--steel);
}

.pulse-filter-pill--active {
  background: var(--obsidian);
  color: var(--white);
  border-color: var(--obsidian);
}

.pulse-filter-pill--active:hover {
  background: var(--steel);
  border-color: var(--steel);
}

.pulse-filter-pill--error { border-color: rgba(220, 38, 38, 0.3); color: #DC2626; }
.pulse-filter-pill--error.pulse-filter-pill--active { background: #DC2626; border-color: #DC2626; color: var(--white); }
.pulse-filter-pill--warning { border-color: rgba(217, 119, 6, 0.3); color: #D97706; }
.pulse-filter-pill--warning.pulse-filter-pill--active { background: #D97706; border-color: #D97706; color: var(--white); }
.pulse-filter-pill--info { border-color: rgba(102, 112, 133, 0.3); color: var(--muted); }
.pulse-filter-pill--info.pulse-filter-pill--active { background: var(--muted); border-color: var(--muted); color: var(--white); }

.pulse-filter-pill__count {
  font-family: var(--font-mono);
  font-size: 9px;
  opacity: 0.7;
}

/* Groups */
.pulse-group {
  margin-bottom: var(--space-4);
}

.pulse-group__header {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--steel);
  padding: var(--space-2) 0;
  margin-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-soft);
}

.pulse-group__icon {
  font-size: 12px;
}

.pulse-group__count {
  font-weight: var(--weight-normal);
  color: var(--muted);
  margin-left: var(--space-1);
}

/* Pulse card overrides */
.gate-item--pulse .gate-item__context {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.gate-item__page {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--steel);
}

.gate-item__notes {
  font-size: var(--text-xs);
  color: var(--steel);
  background: rgba(200, 169, 110, 0.08);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-2);
  border-left: 2px solid var(--gold);
}

.gate-item__badge--info {
  background: rgba(102, 112, 133, 0.1);
  color: var(--muted);
}

/* Pulse action buttons */
.gate-btn--fix {
  color: var(--teal);
  border-color: var(--teal);
}

.gate-btn--fix:hover {
  background: var(--teal);
  color: var(--white);
}

.gate-btn--dismiss-v2 {
  color: var(--muted);
}

.gate-btn--dismiss-v2:hover {
  background: var(--surface);
  border-color: var(--steel);
}

.gate-btn--note {
  color: var(--gold);
  border-color: rgba(200, 169, 110, 0.4);
}

.gate-btn--note:hover {
  background: rgba(200, 169, 110, 0.1);
  border-color: var(--gold);
}

.gate-btn--fix-confirm {
  color: var(--white);
  background: var(--teal);
  border-color: var(--teal);
}

.gate-btn--fix-confirm:hover {
  background: #0A5558;
}

.gate-btn--dismiss-confirm {
  color: var(--white);
  background: var(--steel);
  border-color: var(--steel);
}

.gate-btn--dismiss-confirm:hover {
  background: var(--obsidian);
}

.gate-btn--note-save {
  color: var(--white);
  background: var(--gold);
  border-color: var(--gold);
}

.gate-btn--note-save:hover {
  background: #9A7B3F;
}

/* Expand panel */
.gate-item__expand {
  margin-top: var(--space-2);
}

.pulse-expand {
  padding: var(--space-3);
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
}

.pulse-expand__input {
  width: 100%;
  padding: var(--space-2);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--obsidian);
  resize: vertical;
  margin-bottom: var(--space-2);
  box-sizing: border-box;
}

.pulse-expand__input:focus {
  outline: none;
  border-color: var(--teal);
}

.pulse-expand__reasons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  padding: var(--space-1);
  border-radius: var(--radius-sm);
  transition: outline var(--transition-fast);
}

.pulse-expand__radio {
  font-size: var(--text-xs);
  color: var(--steel);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.pulse-expand__radio input[type="radio"] {
  margin: 0;
  accent-color: var(--teal);
}

.pulse-expand__actions {
  display: flex;
  gap: var(--space-2);
}

.pulse-expand__cancel {
  color: var(--muted);
}

.pulse-expand__cancel:hover {
  color: var(--steel);
}

/* Tab section header with count */
.tab-section__header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.tab-section__count {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted);
}

/* ══════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════ */

@media (max-width: 768px) {
  .topnav {
    height: 56px;
    padding: 0 var(--space-4);
  }

  .topnav__inner {
    padding: 0 var(--space-3);
  }

  .topnav button {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
  }

  .dash-home__inner, .tab-view__inner {
    padding: var(--space-6) var(--space-4);
  }

  .tab-grid {
    grid-template-columns: 1fr;
  }

  .source-grid {
    grid-template-columns: 1fr;
  }

  .brain-filters {
    gap: var(--space-1);
  }

  .brain-chip {
    padding: 4px 8px;
    font-size: 10px;
  }

  .request-modal {
    width: 95%;
  }
}

@media (max-width: 480px) {
  .topnav {
    height: 48px;
  }

  .dash-home__inner, .tab-view__inner {
    padding: var(--space-4);
  }
}

/* ── Toast Notifications (PLATFORM: bones) ── */
.shell-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: #fff;
  z-index: 10000;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s;
  max-width: 360px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.shell-toast--visible { opacity: 1; transform: translateY(0); }
.shell-toast--error { background: #DC2626; }
.shell-toast--success { background: #059669; }
.shell-toast--info { background: var(--steel, #344054); }

/* ══════════════════════════════════════════════
   CONNECTORS PANEL
   ══════════════════════════════════════════════ */
#panel-connectors { background: var(--surface, #F7F7F5); }
#panel-connectors .gate-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-soft, #F0F0ED);
  background: var(--white, #fff);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
#panel-connectors .gate-header__title {
  font-size: 18px; font-weight: 700; color: var(--obsidian, #1A1A1A); margin-bottom: 4px;
}
#panel-connectors .gate-header__desc {
  font-size: 13px; color: var(--muted, #667085); line-height: 1.5; max-width: 640px;
}
#panel-connectors .gate-header__actions { flex-shrink: 0; padding-top: 2px; }
.connectors-body { padding: 20px 24px; }

.connector-cards { display: flex; flex-direction: column; gap: 10px; margin-bottom: 32px; }

.connector-card {
  background: var(--white, #fff);
  border: 1px solid var(--border-soft, #F0F0ED);
  border-radius: var(--radius-lg, 8px);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.connector-card:hover { border-color: var(--border, #E4E4E2); box-shadow: var(--shadow-sm, 0 2px 6px rgba(26,26,26,0.08)); }
.connector-card.is-connected { border-color: rgba(13,107,110,0.3); }
.connector-card.is-expired  { border-color: rgba(247,144,9,0.3); }

.connector-card__header {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px; cursor: default;
}
.connector-card__logo {
  width: 36px; height: 36px; border-radius: 7px;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
}
.connector-card__logo svg, .connector-card__logo img { width: 36px; height: 36px; border-radius: 7px; }
.connector-card__meta { flex: 1; min-width: 0; }
.connector-card__name { font-size: 14px; font-weight: 600; color: var(--obsidian, #1A1A1A); margin-bottom: 2px; }
.connector-card__desc { font-size: 12px; color: var(--muted, #667085); line-height: 1.4; }
.connector-card__tools { font-size: 11px; color: var(--muted, #667085); font-family: var(--font-mono, monospace); margin-top: 2px; }

.connector-status {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 10px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.03em; flex-shrink: 0;
}
.connector-status::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; opacity: 0.75;
}
.connector-status--connected { color: #0A7A44; background: rgba(18,183,106,0.1); }
.connector-status--disconnected { color: var(--muted, #667085); background: rgba(102,112,133,0.08); }
.connector-status--expired { color: #B45309; background: rgba(247,144,9,0.1); }
.connector-status--env { color: #4F46E5; background: rgba(79,70,229,0.08); }

.connector-card__body {
  border-top: 1px solid var(--border-soft, #F0F0ED);
  padding: 16px 20px;
  display: flex; flex-direction: column; gap: 14px;
  background: var(--surface, #F7F7F5);
}

.connector-config-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.connector-config-grid.single-col { grid-template-columns: 1fr; }
.connector-field { display: flex; flex-direction: column; gap: 5px; }
.connector-field__label {
  font-size: 11px; font-weight: 600; color: var(--steel, #344054);
  letter-spacing: 0.06em; text-transform: uppercase;
}
.connector-field__input {
  background: var(--white, #fff);
  border: 1px solid var(--border, #E4E4E2);
  border-radius: 6px; color: var(--obsidian, #1A1A1A);
  font-family: var(--font-mono, monospace); font-size: 12px;
  padding: 7px 10px; width: 100%; transition: border-color 0.15s;
  box-sizing: border-box;
}
.connector-field__input:focus { outline: none; border-color: var(--teal, #0D6B6E); box-shadow: 0 0 0 3px rgba(13,107,110,0.1); }
.connector-field__input::placeholder { color: var(--muted, #667085); opacity: 0.5; }
.connector-field__hint { font-size: 11px; color: var(--muted, #667085); }

.connector-card__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.connector-card__actions .spacer { flex: 1; }
.connector-save-indicator { font-size: 12px; color: #0A7A44; opacity: 0; transition: opacity 0.3s; }
.connector-save-indicator.visible { opacity: 1; }

.connector-token-info { font-size: 12px; color: var(--muted, #667085); }
.connector-token-info .expiry-warn { color: #B45309; }

.connector-info-note {
  background: rgba(200,169,110,0.06); border: 1px solid rgba(200,169,110,0.2);
  border-radius: 6px; padding: 10px 14px; font-size: 12px;
  color: var(--steel, #344054); line-height: 1.5;
}
.connector-info-note strong { color: var(--gold, #C8A96E); }
.connector-info-note code { font-family: var(--font-mono, monospace); font-size: 11px; }

.connectors-section-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted, #667085); margin-bottom: 12px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border-soft, #F0F0ED);
}

@media (max-width: 640px) {
  .connectors-body { padding: 16px; }
  .connector-config-grid { grid-template-columns: 1fr; }
  .connector-card__header, .connector-card__body { padding: 14px 16px; }
}
