/*
  SourceTracer product surface theme.
  jarvis-design doctrine: customer-facing authority work should feel like one
  SourceTracer workspace, while appliance boundaries remain visible.
*/
:root {
  --st-bg: #171717;
  --st-bg-soft: #1e1e1e;
  --st-panel: #202020;
  --st-panel-2: #262626;
  --st-elevated: #2b2b2b;
  --st-line: rgba(255,255,255,0.08);
  --st-line-strong: rgba(255,255,255,0.14);
  --st-text: #ececec;
  --st-muted: #a8a8a8;
  --st-muted-soft: #8b8b8b;
  --st-accent: #83b7ac;
  --st-accent-soft: rgba(131,183,172,0.15);
  --st-warn: #d8a05d;
  --st-bad: #e07d7d;
  --st-shadow: 0 22px 40px rgba(0,0,0,0.24);
}

html {
  background: #0f0f0f;
}

body {
  background:
    radial-gradient(circle at 85% 8%, rgba(131,183,172,0.08), transparent 30rem),
    radial-gradient(circle at 12% 92%, rgba(91,113,145,0.10), transparent 32rem),
    var(--st-bg) !important;
  color: var(--st-text) !important;
}

nav {
  background: rgba(26,26,26,0.94) !important;
  border-bottom: 1px solid var(--st-line) !important;
  backdrop-filter: blur(10px) !important;
}

.nav-logo,
.footer-logo {
  color: var(--st-text) !important;
  font-family: var(--sans) !important;
  font-weight: 800 !important;
  letter-spacing: -0.03em !important;
}

.nav-logo span,
.footer-logo span {
  color: var(--st-accent) !important;
}

.nav-links a {
  color: var(--st-muted) !important;
  font-weight: 700 !important;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--st-text) !important;
}

.nav-links a.active {
  background: var(--st-accent-soft);
  border: 1px solid rgba(131,183,172,0.28);
  border-radius: 999px;
  padding: 0.38rem 0.72rem;
}

.nav-cta,
.btn-primary,
button {
  background: var(--st-accent-soft) !important;
  border-color: rgba(131,183,172,0.42) !important;
  color: var(--st-accent) !important;
  border-radius: 999px !important;
}

.nav-cta:hover,
.btn-primary:hover,
button:hover {
  background: rgba(131,183,172,0.24) !important;
  color: var(--st-text) !important;
}

.workspace,
main {
  background: transparent !important;
}

.workspace-inner,
.shell {
  max-width: 1240px !important;
}

.topline {
  background: linear-gradient(125deg, rgba(32,32,32,0.96), rgba(38,38,38,0.86)) !important;
  border: 1px solid var(--st-line) !important;
  border-radius: 22px !important;
  box-shadow: var(--st-shadow) !important;
  padding: clamp(1.15rem, 3vw, 2rem) !important;
  align-items: center !important;
}

.eyebrow,
.tag,
.filter.active,
.state.ok {
  background: var(--st-accent-soft) !important;
  border-color: rgba(131,183,172,0.34) !important;
  color: var(--st-accent) !important;
}

h1,
.panel-title,
.metric-value,
.lane-name,
.file-name,
.result h3,
.result-title,
label,
.docs-title {
  color: var(--st-text) !important;
}

h1 {
  font-family: var(--sans) !important;
  font-weight: 800 !important;
  letter-spacing: -0.04em !important;
}

.subtitle,
.panel-kicker,
.metric-label,
.lane-note,
.file-state,
.result p,
.result-meta,
.docs-sub,
.endpoint-desc,
.access-row,
.panel-note,
.message,
.footnote {
  color: var(--st-muted) !important;
}

.console-grid {
  gap: 1rem !important;
}

.panel,
.intro,
.detail,
.media-box,
.release-card,
.search-box,
.result,
.metric,
.lane,
.file-row,
.endpoint,
.access-row,
.login-shell .panel {
  background: rgba(32,32,32,0.94) !important;
  border: 1px solid var(--st-line) !important;
  border-radius: 18px !important;
  box-shadow: none !important;
}

.panel-header,
.detail-head {
  border-bottom: 1px solid var(--st-line) !important;
}

.search-box,
input,
textarea,
.search {
  background: rgba(15,15,15,0.72) !important;
  border-color: var(--st-line-strong) !important;
  color: var(--st-text) !important;
}

input:focus,
textarea:focus,
.search:focus {
  border-color: rgba(131,183,172,0.62) !important;
}

.btn-ghost,
.btn {
  background: rgba(255,255,255,0.03) !important;
  border-color: var(--st-line-strong) !important;
  color: var(--st-text) !important;
  border-radius: 999px !important;
}

.btn-ghost:hover,
.btn:hover {
  border-color: rgba(131,183,172,0.42) !important;
  color: var(--st-accent) !important;
}

.filter {
  background: rgba(255,255,255,0.03) !important;
  border-color: var(--st-line) !important;
  color: var(--st-muted) !important;
  border-radius: 999px !important;
}

.status-pill {
  background: rgba(32,32,32,0.96) !important;
  border-color: var(--st-line-strong) !important;
  color: var(--st-muted) !important;
  border-radius: 999px !important;
}

.status-pill.ok,
.state.ok {
  border-color: rgba(131,183,172,0.38) !important;
  color: var(--st-accent) !important;
}

.status-pill.warn,
.state.warn {
  border-color: rgba(216,160,93,0.38) !important;
  color: var(--st-warn) !important;
}

.score,
.lane-count,
.method.get,
.method.post,
.release-meta,
.asset-list a,
.link-list a,
.media-box a {
  color: var(--st-accent) !important;
}

.result-list {
  gap: 0.85rem !important;
}

.result,
.result-row {
  position: relative;
}

.result::before,
.result-row::before,
.lane::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  border-radius: 18px 0 0 18px;
  background: rgba(131,183,172,0.55);
}

.docs-bg,
footer {
  background: #111 !important;
  border-top: 1px solid var(--st-line) !important;
}

.endpoint {
  background: rgba(255,255,255,0.035) !important;
}

.endpoint-path,
.citation,
code {
  color: var(--st-muted) !important;
  background: rgba(15,15,15,0.72) !important;
  border-color: var(--st-line) !important;
}

.method {
  border: 1px solid rgba(131,183,172,0.22) !important;
}

.subscription-locked {
  color: var(--st-muted-soft) !important;
  cursor: not-allowed !important;
}

.subscription-signin-required {
  text-decoration-style: dotted !important;
  text-underline-offset: 0.25rem !important;
}

.subscription-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.05rem;
  margin-left: 0.25rem;
  padding: 0.08rem 0.34rem;
  border: 1px solid rgba(216,160,93,0.34);
  border-radius: 999px;
  color: var(--st-warn);
  background: rgba(216,160,93,0.10);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.subscription-boundary-notice {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  z-index: 1000;
  width: min(92vw, 680px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transform: translate(-50%, calc(100% + 2rem));
  opacity: 0;
  pointer-events: none;
  padding: 0.95rem 1rem;
  border: 1px solid rgba(216,160,93,0.34);
  border-radius: 18px;
  background: rgba(32,32,32,0.98);
  box-shadow: var(--st-shadow);
  color: var(--st-muted);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.subscription-boundary-notice.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.subscription-boundary-notice strong {
  display: block;
  color: var(--st-text);
  font-size: 0.84rem;
}

.subscription-boundary-notice span {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.78rem;
}

.subscription-boundary-notice a {
  flex: 0 0 auto;
  color: var(--st-accent);
  font-weight: 800;
  text-decoration: none;
}

.metric,
.lane,
.file-row,
.access-row {
  position: relative;
}

.metric:hover,
.lane:hover,
.result:hover,
.release-card:hover,
.release-card.active {
  border-color: rgba(131,183,172,0.34) !important;
}

@media (max-width: 920px) {
  nav {
    padding: 0.9rem 1rem !important;
  }

  .topline {
    border-radius: 18px !important;
  }

  .subscription-boundary-notice {
    align-items: flex-start;
    flex-direction: column;
  }
}

/*
  Canonical SourceTracer workspace frame.
  This is the customer-facing shell contract: thin left rail, fixed top context
  strip, scrollable middle work surface, fixed bottom composer, and a file /
  provenance drawer. Appliance pages keep their evidence/provenance content, but
  they now live inside the same product frame.
*/
body.workspace-shell-active {
  height: 100vh;
  overflow: hidden;
}

body.workspace-shell-active > nav,
body.workspace-shell-active > footer,
body.workspace-shell-active > .docs-bg {
  display: none !important;
}

.st-workspace-shell {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  height: 100vh;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  background: var(--st-bg);
  color: var(--st-text);
}

.st-left-rail {
  display: flex;
  flex-direction: column;
  gap: 0.72rem;
  min-width: 0;
  padding: 0.82rem 0.58rem;
  border-right: 1px solid var(--st-line);
  background: rgba(24,24,24,0.98);
}

.st-rail-brand {
  display: inline-flex;
  justify-content: center;
  color: var(--st-text);
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  text-decoration: none;
  white-space: nowrap;
}

.st-rail-brand span {
  color: var(--st-accent);
}

.st-rail-section {
  display: grid;
  gap: 0.42rem;
  padding: 0.58rem;
  border: 1px solid var(--st-line);
  border-radius: 16px;
  background: rgba(255,255,255,0.025);
}

.st-rail-label {
  color: var(--st-muted-soft);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.st-rail-link,
.st-rail-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.32rem;
  padding: 0.42rem 0.35rem;
  border: 1px solid var(--st-line);
  border-radius: 999px;
  background: #232323;
  color: var(--st-muted);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
}

.st-rail-link.active,
.st-rail-action.active {
  border-color: rgba(131,183,172,0.42);
  background: var(--st-accent-soft);
  color: var(--st-accent);
}

.st-rail-link.subscription-locked {
  border-color: rgba(216,160,93,0.22);
}

.st-rail-spacer {
  flex: 1 1 auto;
}

.st-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.45rem;
  height: 2.45rem;
  margin: 0 auto;
  border: 1px solid rgba(216,160,93,0.36);
  border-radius: 50%;
  background: rgba(216,160,93,0.12);
  color: #e1b15f;
  font-weight: 900;
}

.st-workspace-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
}

.st-shell-topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
  min-height: 4.4rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--st-line);
  background: rgba(25,25,25,0.96);
}

.st-product-pill,
.st-context-pill,
.st-top-action {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.35rem;
  padding: 0.52rem 0.78rem;
  border: 1px solid var(--st-line);
  border-radius: 999px;
  background: #242424;
  color: var(--st-text);
  font-weight: 800;
  text-decoration: none;
}

.st-context-pill {
  min-width: 0;
  color: var(--st-muted);
  font-size: 0.78rem;
}

.st-context-pill strong {
  color: var(--st-text);
}

.st-top-actions {
  display: flex;
  gap: 0.5rem;
}

.st-top-action {
  justify-content: center;
  width: 2.6rem;
  padding: 0;
  color: var(--st-muted);
  cursor: pointer;
}

.st-top-action:hover {
  color: var(--st-accent);
  border-color: rgba(131,183,172,0.36);
}

.st-key-action {
  width: auto;
  min-width: 3.1rem;
  padding: 0 0.72rem;
}

.st-scroll-stage {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 1rem 1rem 0;
}

body.workspace-shell-active main.workspace {
  min-height: auto !important;
  padding: 0 !important;
  background: transparent !important;
}

body.workspace-shell-active .workspace-inner,
body.workspace-shell-active .shell {
  max-width: none !important;
  width: 100% !important;
}

body.workspace-shell-active .topline {
  margin-bottom: 1rem !important;
}

body.workspace-shell-active h1 {
  font-size: clamp(1.55rem, 2.4vw, 2.6rem) !important;
}

body.workspace-shell-active .subtitle {
  max-width: 900px !important;
}

body.workspace-shell-active .console-grid {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px) !important;
  padding-bottom: 1rem !important;
}

body.workspace-shell-active .search-box {
  display: none !important;
}

.st-bottom-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.72rem;
  align-items: end;
  padding: 0.82rem 1rem 1rem;
  border-top: 1px solid var(--st-line);
  background: rgba(25,25,25,0.98);
}

.st-composer-box {
  display: grid;
  gap: 0.48rem;
  min-width: 0;
  border: 1px solid var(--st-line-strong);
  border-radius: 18px;
  background: rgba(32,32,32,0.96);
  padding: 0.7rem;
}

.st-composer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--st-muted-soft);
  font-family: var(--mono);
  font-size: 0.68rem;
}

.st-composer-box textarea {
  width: 100%;
  min-height: 3.15rem;
  max-height: 8rem;
  resize: vertical;
  border: 0 !important;
  outline: 0;
  background: transparent !important;
  color: var(--st-text) !important;
  font: 500 0.95rem/1.45 var(--sans);
}

.st-attachment-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-height: 0;
}

.st-attachment-chip,
.st-evidence-foot {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--st-line);
  border-radius: 999px;
  background: rgba(255,255,255,0.03);
  color: var(--st-muted);
  font-family: var(--mono);
  font-size: 0.68rem;
}

.st-attachment-chip {
  padding: 0.22rem 0.52rem;
}

.st-evidence-foot {
  margin-top: 0.75rem;
  padding: 0.28rem 0.6rem;
}

.st-section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.st-section-chip {
  border: 1px solid var(--st-line);
  border-radius: 8px;
  padding: 0.78rem;
  background: rgba(255,255,255,0.03);
}

.st-section-chip strong,
.st-section-chip span,
.st-section-chip small {
  display: block;
}

.st-section-chip strong {
  color: var(--st-text);
  font-size: 0.82rem;
  margin-bottom: 0.38rem;
}

.st-section-chip span {
  color: var(--st-muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.st-section-chip small {
  margin-top: 0.62rem;
  color: var(--st-accent);
  font-family: var(--mono);
  font-size: 0.68rem;
  line-height: 1.4;
}

.st-composer-actions {
  display: grid;
  gap: 0.52rem;
  width: 132px;
}

.st-composer-actions button {
  min-height: 2.45rem;
}

.st-attach-button {
  font-size: 1.25rem !important;
  line-height: 1 !important;
}

.st-agent-card,
.st-agent-event,
.st-evidence-card {
  animation: stFadeIn 0.16s ease-out;
}

.st-agent-event::before {
  background: var(--st-warn) !important;
}

.st-evidence-card::before {
  background: var(--st-accent) !important;
}

@keyframes stFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.st-shell-status {
  color: var(--st-muted);
}

.st-shell-status.working {
  color: var(--st-warn);
}

.st-shell-status.ready {
  color: var(--st-accent);
}

.st-file-drawer {
  position: fixed;
  right: 1rem;
  bottom: 5.8rem;
  z-index: 900;
  width: min(420px, calc(100vw - 8.4rem));
  max-height: min(560px, calc(100vh - 8rem));
  overflow: auto;
  transform: translateX(calc(100% + 1.5rem));
  opacity: 0;
  pointer-events: none;
  border: 1px solid var(--st-line);
  border-radius: 18px;
  background: rgba(32,32,32,0.98);
  box-shadow: var(--st-shadow);
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.st-file-drawer.open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.st-file-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--st-line);
}

.st-file-drawer-title {
  color: var(--st-text);
  font-weight: 900;
}

.st-file-drawer-body {
  display: grid;
  gap: 0.65rem;
  padding: 1rem;
}

@media (max-width: 980px) {
  .st-workspace-shell {
    grid-template-columns: 86px minmax(0, 1fr);
  }

  .st-shell-topbar {
    grid-template-columns: 1fr auto;
  }

  .st-context-pill {
    display: none;
  }

  body.workspace-shell-active .console-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 720px) {
  .st-workspace-shell {
    grid-template-columns: 1fr;
  }

  .st-left-rail {
    display: none;
  }

  .st-shell-topbar,
  .st-bottom-composer {
    padding-left: 0.72rem;
    padding-right: 0.72rem;
  }

  .st-bottom-composer {
    grid-template-columns: 1fr;
  }

  .st-composer-actions {
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .st-file-drawer {
    right: 0.72rem;
    width: calc(100vw - 1.44rem);
  }
}
