:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-soft: #f9fbfd;
  --ink: #152033;
  --muted: #647084;
  --line: #dbe3ee;
  --line-strong: #c9d4e3;
  --blue: #2457a6;
  --blue-dark: #183b73;
  --teal: #0f766e;
  --green: #177245;
  --amber: #a35f00;
  --red: #b42318;
  --purple: #6f42c1;
  --shadow: 0 18px 45px rgba(21, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0;
}

button,
select,
textarea,
a.button,
a.nav-item {
  font: inherit;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.sidebar :focus-visible {
  outline-color: #93c5fd;
}

html {
  color-scheme: light;
}

.app-shell {
  min-height: 100vh;
  display: block;
  position: relative;
}

.sidebar {
  --rail-width: 82px;
  --rail-expanded: 260px;
  --rail-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --rail-duration: 220ms;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--rail-expanded);
  background: #101827;
  color: #f8fafc;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow: hidden;
  z-index: 50;
  container-type: inline-size;
  container-name: harness-rail;
  transition:
    width var(--rail-duration) var(--rail-ease),
    padding var(--rail-duration) var(--rail-ease),
    box-shadow var(--rail-duration) var(--rail-ease);
}

body.sidebar-collapsed .sidebar {
  width: var(--rail-width);
  padding: 24px 20px;
}

body.sidebar-collapsed .sidebar:is(:hover, :focus-within) {
  width: var(--rail-expanded);
  padding: 24px 20px;
  box-shadow: 16px 0 40px rgba(16, 24, 39, 0.42);
}

body.sidebar-collapsed .sidebar.is-expanded {
  width: var(--rail-expanded);
  padding: 24px 20px;
  box-shadow: 16px 0 40px rgba(16, 24, 39, 0.42);
}

.main {
  min-width: 0;
  margin-left: 280px;
  padding: 28px;
}

body.sidebar-collapsed .main {
  margin-left: 82px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  flex-shrink: 0;
  transition: gap var(--rail-duration, 220ms) var(--rail-ease, cubic-bezier(0.22, 1, 0.36, 1));
}

.brand-mark {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: transparent;
  border: 0;
  overflow: visible;
  position: relative;
  z-index: 1;
}

.brand-mark img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  display: block;
}

.brand-copy {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  opacity: 1;
  transform: translateX(0);
  transform-origin: left center;
  padding-bottom: 3px;
  transition:
    max-width var(--rail-duration, 220ms) var(--rail-ease, cubic-bezier(0.22, 1, 0.36, 1)),
    opacity 180ms ease,
    transform var(--rail-duration, 220ms) var(--rail-ease, cubic-bezier(0.22, 1, 0.36, 1));
}

.brand-kicker {
  margin: 0 0 2px;
  color: #91a3bd;
  font-size: 12px;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.brand h1 {
  margin: 0;
  font-size: 19px;
  line-height: 1.3;
}

.nav-label,
.nav-group {
  overflow: hidden;
  white-space: nowrap;
  max-width: 200px;
  opacity: 1;
  transition:
    max-width var(--rail-duration, 220ms) var(--rail-ease, cubic-bezier(0.22, 1, 0.36, 1)),
    opacity 160ms ease,
    margin var(--rail-duration, 220ms) var(--rail-ease, cubic-bezier(0.22, 1, 0.36, 1)),
    padding var(--rail-duration, 220ms) var(--rail-ease, cubic-bezier(0.22, 1, 0.36, 1));
}

.nav-list {
  display: grid;
  gap: 6px;
  align-content: start;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
  flex: 1;
  min-height: 0;
  scrollbar-width: none;
}

.nav-list::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.sidebar.rail-scroll-ready .nav-list {
  scrollbar-width: thin;
  scrollbar-color: #5f7391 transparent;
}

.sidebar.rail-scroll-ready .nav-list::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.sidebar.rail-scroll-ready .nav-list::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar.rail-scroll-ready .nav-list::-webkit-scrollbar-thumb {
  border: 2px solid #101827;
  border-radius: 999px;
  background: #5f7391;
}

.sidebar.rail-scroll-ready .nav-list::-webkit-scrollbar-corner {
  background: transparent;
}

.nav-group {
  margin: 10px 0 2px;
  padding: 0 12px;
  color: #91a3bd;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.3;
}

.nav-back {
  margin-bottom: 4px;
  border: 1px solid rgba(148, 163, 184, 0.28);
}

.nav-label-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1px;
  min-width: 0;
  white-space: normal;
}

.nav-label-main,
.nav-label-sub {
  display: block;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.nav-label-sub {
  color: #91a3bd;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.3;
  max-height: 14px;
  transition:
    max-height var(--rail-duration, 220ms) var(--rail-ease, cubic-bezier(0.22, 1, 0.36, 1)),
    opacity 160ms ease;
}

.nav-item {
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #cdd7e5;
  text-align: left;
  text-decoration: none;
  padding: 11px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  position: relative;
  transition:
    background 160ms ease,
    color 160ms ease,
    padding var(--rail-duration, 220ms) var(--rail-ease, cubic-bezier(0.22, 1, 0.36, 1)),
    margin var(--rail-duration, 220ms) var(--rail-ease, cubic-bezier(0.22, 1, 0.36, 1));
}

.nav-item.has-section {
  margin-top: 24px;
}

.nav-item.has-section::before {
  content: attr(data-section);
  position: absolute;
  left: 12px;
  top: -17px;
  max-width: 200px;
  overflow: hidden;
  white-space: nowrap;
  color: #91a3bd;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
  opacity: 1;
  pointer-events: none;
  transition:
    max-width var(--rail-duration, 220ms) var(--rail-ease, cubic-bezier(0.22, 1, 0.36, 1)),
    opacity 160ms ease,
    left var(--rail-duration, 220ms) var(--rail-ease, cubic-bezier(0.22, 1, 0.36, 1));
}

.nav-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: rgba(234, 241, 255, 0.08);
  color: #eaf1ff;
  font-size: 12px;
  font-weight: 800;
  transition: background 160ms ease;
}

.nav-item:hover,
.nav-item.active {
  background: #1b2a42;
  color: #ffffff;
}

/* Collapsed rail: keep text clipped with max-width (animatable), not width:auto */
body.sidebar-collapsed .nav-list {
  overflow-y: auto;
  padding-right: 0;
}

body.sidebar-collapsed .brand {
  gap: 0;
}

body.sidebar-collapsed .sidebar:is(:hover, :focus-within) .brand {
  gap: 12px;
}

body.sidebar-collapsed .sidebar.is-expanded .brand {
  gap: 12px;
}

body.sidebar-collapsed .brand-copy {
  max-width: 0;
  opacity: 0;
  transform: translateX(-8px);
  pointer-events: none;
}

body.sidebar-collapsed .sidebar:is(:hover, :focus-within) .brand-copy {
  max-width: 180px;
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
  transition:
    max-width var(--rail-duration) var(--rail-ease),
    opacity 200ms ease 50ms,
    transform var(--rail-duration) var(--rail-ease);
}

body.sidebar-collapsed .sidebar.is-expanded .brand-copy {
  max-width: 180px;
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .nav-group {
  max-width: 0;
  opacity: 0;
  pointer-events: none;
}

body.sidebar-collapsed .nav-group {
  margin: 0;
  padding: 0;
}

/* Evita que el subtítulo del proyecto agrande el botón en rail colapsado */
body.sidebar-collapsed .nav-label-sub {
  max-height: 0;
  opacity: 0;
  margin: 0;
  overflow: hidden;
}

body.sidebar-collapsed .nav-item.has-section {
  margin-top: 6px;
}

body.sidebar-collapsed .nav-item.has-section::before {
  left: 0;
  max-width: 0;
  opacity: 0;
}

body.sidebar-collapsed .sidebar:is(:hover, :focus-within) .nav-label,
body.sidebar-collapsed .sidebar:is(:hover, :focus-within) .nav-group {
  max-width: 200px;
  opacity: 1;
  pointer-events: auto;
  transition:
    max-width var(--rail-duration) var(--rail-ease),
    opacity 180ms ease 40ms,
    margin var(--rail-duration) var(--rail-ease),
    padding var(--rail-duration) var(--rail-ease);
}

body.sidebar-collapsed .sidebar:is(:hover, :focus-within) .nav-group {
  margin: 10px 0 2px;
  padding: 0 12px;
}

body.sidebar-collapsed .sidebar:is(:hover, :focus-within) .nav-item.has-section,
body.sidebar-collapsed .sidebar.is-expanded .nav-item.has-section {
  margin-top: 24px;
}

body.sidebar-collapsed .sidebar:is(:hover, :focus-within) .nav-item.has-section::before,
body.sidebar-collapsed .sidebar.is-expanded .nav-item.has-section::before {
  left: 12px;
  max-width: 200px;
  opacity: 1;
}

.sidebar.is-expanded .nav-label,
.sidebar.is-expanded .nav-group,
body.sidebar-collapsed .sidebar.is-expanded .nav-label,
body.sidebar-collapsed .sidebar.is-expanded .nav-group,
.sidebar:is(:hover, :focus-within) .nav-label,
.sidebar:is(:hover, :focus-within) .nav-group,
body.sidebar-collapsed .sidebar:is(:hover, :focus-within) .nav-label,
body.sidebar-collapsed .sidebar:is(:hover, :focus-within) .nav-group {
  max-width: 200px;
  opacity: 1;
  pointer-events: auto;
}

.sidebar.is-expanded .nav-group,
body.sidebar-collapsed .sidebar.is-expanded .nav-group,
.sidebar:is(:hover, :focus-within) .nav-group,
body.sidebar-collapsed .sidebar:is(:hover, :focus-within) .nav-group {
  margin: 10px 0 2px;
  padding: 0 12px;
}

/* Fallback por ancho real del rail: si está expandido, grupos y etiquetas se ven */
@container harness-rail (min-width: 200px) {
  .nav-group {
    max-width: 200px !important;
    opacity: 1 !important;
    margin: 10px 0 2px !important;
    padding: 0 12px !important;
    pointer-events: auto !important;
  }

  .nav-label {
    max-width: 200px !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .nav-item.has-section {
    margin-top: 24px !important;
  }

  .nav-item.has-section::before {
    left: 12px !important;
    max-width: 200px !important;
    opacity: 1 !important;
  }

  .nav-label-sub {
    max-height: 14px !important;
    opacity: 1 !important;
  }
}

body.sidebar-collapsed .sidebar:is(:hover, :focus-within) .nav-label-sub {
  max-height: 14px;
  opacity: 1;
  transition:
    max-height var(--rail-duration) var(--rail-ease),
    opacity 180ms ease 40ms;
}

body.sidebar-collapsed .nav-item,
body.sidebar-collapsed .sidebar:is(:hover, :focus-within) .nav-item {
  padding: 11px 10px;
}

body.sidebar-collapsed .nav-icon {
  background: transparent;
}

body.sidebar-collapsed .sidebar:is(:hover, :focus-within) .nav-icon {
  background: rgba(234, 241, 255, 0.08);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 22px;
}

.topbar-title-block {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.breadcrumb:empty {
  display: none;
}

.breadcrumb button,
.breadcrumb a {
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}

.breadcrumb button:hover,
.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb .crumb-sep {
  color: var(--line-strong);
}

.breadcrumb .crumb-current {
  color: var(--muted);
}

.topbar h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
}

.project-open-row {
  cursor: pointer;
}

.project-open-row:focus-visible td {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}

.project-open-row:hover td {
  background: #f3f7fc;
}

.project-open-row.is-selected td {
  background: #e8f0fa;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.env-select,
.user-pill {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 8px 11px;
}

.env-select span {
  color: var(--muted);
  font-size: 12px;
}

.env-select select {
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 700;
}

.live-pill {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.live-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.live-pill.is-live {
  color: #0f766e;
  border-color: rgba(15, 118, 110, 0.28);
  background: #ecfdf5;
}

.live-pill.is-live::before {
  background: currentColor;
}

.user-pill {
  color: var(--ink);
  font-weight: 700;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.view {
  display: none;
}

.active-view {
  display: block;
}

.grid {
  display: grid;
  gap: 16px;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 16px;
  align-items: start;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.panel-header h3 {
  margin: 0;
  font-size: 17px;
}

.panel-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.panel-header > div > p:first-child {
  margin-top: 0;
}

.metric-card {
  min-height: 128px;
}

.metric-value {
  margin: 0;
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.metric-label {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.metric-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.metric-top i {
  color: var(--blue);
  font-size: 20px;
  opacity: 0.75;
}

.sparkline {
  flex: 0 0 auto;
  display: block;
  margin-top: 2px;
}

.charts-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 16px;
}

.chart-panel {
  min-height: 280px;
}

.chart-legend {
  display: flex;
  gap: 14px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
}

.legend-dot.success {
  background: var(--green);
}

.legend-dot.error {
  background: var(--red);
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  min-height: 180px;
  padding-top: 8px;
}

.bar-col {
  display: grid;
  gap: 6px;
  justify-items: center;
  min-width: 0;
}

.bar-track {
  width: 100%;
  max-width: 34px;
  height: 140px;
  border-radius: 4px;
  background: #eef3f9;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
}

.bar-track.stacked {
  gap: 0;
}

.bar-fill {
  width: 100%;
  border-radius: 0;
  min-height: 2px;
}

.bar-fill.success {
  background: var(--green);
}

.bar-fill.error {
  background: var(--red);
}

.bar-value {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}

.bar-label {
  font-size: 11px;
  color: var(--muted);
  line-height: 1;
}

.hbar-chart {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

.hbar-row {
  display: grid;
  grid-template-columns: minmax(72px, 120px) 1fr auto;
  gap: 10px;
  align-items: center;
}

.hbar-label {
  font-size: 12px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hbar-track {
  height: 10px;
  border-radius: 3px;
  background: #eef3f9;
  border: 1px solid var(--line);
  overflow: hidden;
}

.hbar-fill {
  height: 100%;
  border-radius: 2px;
}

.hbar-value {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  min-width: 44px;
  text-align: right;
}

.project-list {
  display: grid;
  gap: 12px;
}

.project-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  overflow: hidden;
}

.project-header {
  width: 100%;
  border: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.project-header:hover {
  background: #f7faff;
}

.project-header strong,
.project-header span {
  display: block;
}

.project-header span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.project-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.project-header-actions i {
  color: var(--muted);
  font-size: 12px;
  transition: transform 160ms ease;
}

.project-agents {
  display: grid;
  max-height: 520px;
  overflow: hidden;
  transition:
    max-height 180ms ease,
    opacity 160ms ease;
}

.project-group.collapsed .project-agents {
  max-height: 0;
  opacity: 0;
}

.project-agents[hidden] {
  display: none;
}

.project-group.collapsed .project-header {
  border-bottom-color: transparent;
}

.project-group.collapsed .project-header-actions i {
  transform: rotate(180deg);
}

.project-agent {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.project-agent:last-child {
  border-bottom: 0;
}

.project-agent-meta {
  min-width: 190px;
  display: grid;
  justify-items: end;
  gap: 8px;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.module-card {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.module-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--blue);
  background: #eef5ff;
}

.module-card strong,
.module-card p {
  display: block;
}

.module-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.cell-note {
  display: block;
  max-width: 520px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.empty-row {
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
}

th,
td {
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

tr:last-child td {
  border-bottom: 0;
}

.name-cell {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 210px;
}

.avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  font-weight: 800;
  background: var(--blue);
}

.name-cell strong {
  display: block;
}

.name-cell span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.badge-row,
.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
  text-transform: lowercase;
}

.badge::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 1px;
  background: currentColor;
}

.badge.green {
  color: var(--green);
}

.badge.amber {
  color: var(--amber);
}

.badge.red {
  color: var(--red);
}

.badge.blue {
  color: var(--blue-dark);
}

.badge.purple {
  color: var(--purple);
}

.meta-tag {
  display: inline;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
}

.meta-tag:not(:last-child)::after {
  content: "·";
  margin-left: 8px;
  color: var(--line-strong);
  font-weight: 700;
}

.button {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  min-height: 38px;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.button.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.icon-button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 16px;
}

.playground-box {
  display: grid;
  gap: 12px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
}

.field textarea {
  min-height: 150px;
  resize: vertical;
  line-height: 1.45;
}

.response-box,
.trace-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 14px;
  min-height: 130px;
  line-height: 1.5;
}

.trace-box {
  display: grid;
  gap: 10px;
}

.compact-panel .panel-header {
  margin-bottom: 10px;
}

.call-list {
  display: grid;
  gap: 8px;
}

.call-item {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.call-item[data-open-trace] {
  cursor: pointer;
}

.call-item.valid {
  border-left-color: var(--green);
}

.call-item.warning {
  border-left-color: var(--amber);
}

.call-item.error {
  border-left-color: var(--red);
}

.call-item > .call-status {
  flex: 0 0 78px;
  display: flex;
  align-items: center;
  align-self: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  border-radius: 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.2;
  background: transparent;
}

.call-status::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 1px;
  background: currentColor;
}

.call-item.valid .call-status {
  background: transparent;
  color: var(--green);
}

.call-item.warning .call-status {
  background: transparent;
  color: var(--amber);
}

.call-item.error .call-status {
  background: transparent;
  color: var(--red);
}

.call-body {
  flex: 1 1 auto;
  min-width: 0;
}

.call-body strong,
.call-body span,
.call-body small {
  display: block;
}

.call-body strong {
  font-size: 13px;
  line-height: 1.3;
}

.call-body span {
  margin-top: 2px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
}

.call-body small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  font-size: 13px;
}

.kv:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.kv span:first-child {
  color: var(--muted);
}

.kv span:last-child {
  font-weight: 800;
  text-align: right;
}

.workflow {
  display: grid;
  gap: 10px;
}

.workflow-node {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.workflow-node span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #eef5ff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.workflow-node strong {
  display: block;
}

.workflow-node strong {
  margin-top: 10px;
}

.workflow-canvas {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.workflow-step {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.step-number {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #eef5ff;
  color: var(--blue);
  font-weight: 800;
  font-size: 13px;
}

.detail-layout {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 16px;
}

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

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
}

.modal-shell.open {
  display: block;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 24, 44, 0.34);
}

.config-modal {
  position: absolute;
  top: 18px;
  right: 18px;
  bottom: 18px;
  width: min(620px, calc(100vw - 36px));
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(12, 24, 44, 0.24);
  overflow: hidden;
  overscroll-behavior: contain;
}

.config-modal-header,
.config-modal-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.config-modal-header p {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.config-modal-header h3 {
  margin: 0;
  font-size: 19px;
}

.config-modal-header span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.config-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #f7faff;
}

.config-steps span {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.config-steps span.active {
  border-color: rgba(36, 87, 166, 0.28);
  background: #eef5ff;
  color: var(--blue);
}

.config-modal-body {
  flex: 1 1 auto;
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 16px;
  overflow: auto;
}

.config-modal-body .field textarea {
  min-height: 118px;
}

.config-modal-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
  background: #fbfdff;
}

.notification-toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  max-width: 340px;
  border: 1px solid rgba(15, 118, 110, 0.25);
  border-radius: 8px;
  background: #ecfdf5;
  color: #0f766e;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 14px 38px rgba(12, 24, 44, 0.16);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.notification-toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1120px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-3,
  .split,
  .detail-layout,
  .dashboard-layout,
  .module-grid,
  .workflow-canvas,
  .charts-grid,
  .config-steps {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    width: auto;
    height: auto;
    z-index: auto;
    box-shadow: none;
  }

  body.sidebar-collapsed .sidebar,
  body.sidebar-collapsed .sidebar:is(:hover, :focus-within) {
    width: auto;
    padding: 24px 18px;
    box-shadow: none;
  }

  body.sidebar-collapsed .brand,
  body.sidebar-collapsed .sidebar:is(:hover, :focus-within) .brand {
    gap: 12px;
  }

  body.sidebar-collapsed .brand-copy,
  body.sidebar-collapsed .sidebar:is(:hover, :focus-within) .brand-copy,
  body.sidebar-collapsed .nav-label,
  body.sidebar-collapsed .nav-group {
    max-width: none;
    opacity: 1;
    overflow: visible;
    pointer-events: auto;
    transform: none;
  }

  .main,
  body.sidebar-collapsed .main {
    margin-left: 0;
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.sidebar-collapsed .nav-group,
  body.sidebar-collapsed .sidebar:is(:hover, :focus-within) .nav-group {
    margin: 10px 0 2px;
    padding: 0 12px;
    max-width: 200px;
    opacity: 1;
  }

  body.sidebar-collapsed .nav-label-sub,
  body.sidebar-collapsed .sidebar:is(:hover, :focus-within) .nav-label-sub {
    max-height: 14px;
    opacity: 1;
  }

  body.sidebar-collapsed .nav-item {
    justify-content: flex-start;
  }

  .main {
    padding: 18px;
  }

  .topbar,
  .topbar-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .grid-2,
  .grid-4,
  .form-row {
    grid-template-columns: 1fr;
  }

  .module-card {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .module-card .badge {
    grid-column: 2;
    width: fit-content;
  }

  .project-agent {
    align-items: flex-start;
    flex-direction: column;
  }

  .project-agent-meta {
    min-width: 0;
    justify-items: start;
  }

  .call-item {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .call-item > .call-status {
    flex-basis: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Selective refinement: original screens, clearer headings and compact icons. */
.view-description {margin:10px 0 0;color:var(--muted);font-size:13px;line-height:1.6;max-width:620px;}
.sidebar .nav-icon {font-size:16px;width:24px;height:24px;background:transparent!important;}
@media(min-width:761px){
body.sidebar-collapsed .sidebar,body.sidebar-collapsed .sidebar:is(:hover,:focus-within),body.sidebar-collapsed .sidebar.is-expanded{padding-left:12px;padding-right:12px;}
body.sidebar-collapsed .nav-item,body.sidebar-collapsed .sidebar:is(:hover,:focus-within) .nav-item{min-height:52px;padding:12px 17px;border-radius:5px;gap:15px;}
}

/* Flat utility header; panels use straight edges, controls retain small radii. */
.topbar-actions{gap:0;flex-wrap:wrap;row-gap:8px;}
.topbar .env-select,.topbar .user-pill,.topbar .live-pill{background:transparent;border:0;border-radius:0;box-shadow:none;min-height:32px;padding:4px 14px;white-space:nowrap;font-size:12px;}
.topbar .env-select{padding-left:0;}
.topbar .live-pill,.topbar .user-pill{border-left:1px solid var(--line-strong);}
.topbar .user-pill{padding-right:0;font-weight:600;}
.topbar .user-pill .status-dot{display:none;}
.topbar .env-select select{border-bottom:1px solid var(--line-strong);border-radius:0;padding:4px 3px;font-size:12px;}
.main .panel{border-radius:0;box-shadow:0 2px 7px rgba(21,32,51,.025);}
.main .metric-card{border-radius:3px;box-shadow:none;}

/* Typography: native humanist sans, restrained heading weights. */
body{font-family:"Segoe UI","Helvetica Neue",Arial,sans-serif;}
input,button,select,textarea{font-family:inherit;}
.topbar h2{font-weight:600;letter-spacing:-.4px;}
.panel-header h3,.panel h3{font-weight:600;}
.metric-value{font-family:"Segoe UI","Helvetica Neue",Arial,sans-serif;font-weight:600;letter-spacing:-.7px;font-variant-numeric:tabular-nums;}
.nav-label,.breadcrumb,.live-pill{font-weight:600;}
.view-description,.metric-label{font-weight:400;}

.sidebar-account{display:flex;align-items:center;gap:14px;flex-shrink:0;width:100%;border:0;border-top:1px solid #344051;border-radius:0;background:transparent;color:#eaf1ff;padding:16px 11px 0;cursor:pointer;text-align:left;overflow:hidden;}
.account-avatar{display:grid;place-items:center;width:34px;height:34px;flex:0 0 34px;background:#26374c;border-radius:4px;font-size:12px;font-weight:600;}
.account-copy strong{display:block;font-size:12px;font-weight:600;white-space:nowrap;max-width:160px;overflow:hidden;text-overflow:ellipsis;}.account-copy small{display:block;font-size:10px;color:#9faec1;margin-top:4px;}
.account-dialog{width:min(440px,calc(100vw - 32px));padding:26px;border:1px solid var(--line);border-radius:4px;color:var(--ink);font-family:inherit;}.account-dialog::backdrop{background:#10182788;}.account-dialog header{display:flex;align-items:center;justify-content:space-between;gap:16px;}.account-dialog h2{font-size:21px;font-weight:600;margin:0;}.account-dialog header button{border:0;background:transparent;font-size:26px;cursor:pointer;color:var(--muted);}.account-dialog p{font-size:13px;line-height:1.6;color:var(--muted);}.account-dialog label{display:block;font-size:13px;margin:20px 0 8px;}.account-dialog input{width:100%;padding:10px;border:1px solid var(--line-strong);border-radius:2px;}.account-dialog footer{display:flex;justify-content:flex-end;margin-top:20px;}

/* A single utility tray groups environment and telemetry without separate pills. */
.topbar-actions{background:var(--panel);border:1px solid var(--line);border-radius:4px;padding:6px;gap:0;box-shadow:0 2px 4px rgba(21,32,51,.025);flex-shrink:0;}
.topbar .env-select{padding:2px 12px 2px 6px;gap:10px;}
.topbar .env-select>span{font-size:11px;color:var(--muted);font-weight:500;}
.topbar .env-select select{appearance:none;-webkit-appearance:none;border:1px solid #cbd8e9;border-radius:3px;padding:6px 28px 6px 10px;min-width:74px;background-color:#f0f4fa;background-image:url("./assets/chevron-down.svg");background-repeat:no-repeat;background-position:right 8px center;color:var(--blue-dark);font-weight:600;cursor:pointer;line-height:1.3;}
.topbar .env-select select:hover{border-color:#8ca6ca;background-color:#e7eef8;}
.topbar .env-select select:focus-visible{outline:2px solid var(--blue);outline-offset:2px;}
.topbar .live-pill{padding:4px 12px;border-left:1px solid var(--line);font-size:11px;font-weight:600;min-height:30px;}
.topbar .live-pill::before{width:6px;height:6px;flex-shrink:0;}
@media(max-width:480px){.topbar-actions{flex-shrink:1;max-width:100%;}.topbar .env-select{padding-right:8px;gap:6px;}.topbar .live-pill{padding-left:8px;padding-right:6px;}}
.integration-workspace { padding: clamp(16px, 3vw, 32px); margin-bottom: 24px; background: #f5f8fc; border: 1px solid #dce4ef; }
.integration-heading h2 { margin: 6px 0 12px; font-size: clamp(22px, 2.4vw, 30px); letter-spacing: -.025em; }
.integration-eyebrow { font-size: 11px; letter-spacing: .14em; color: #2457a6; font-weight: 700; }
.integration-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 18px; align-items: end; margin: 24px 0; }
.integration-form[hidden] { display: none; }
.integration-form select { width: 100%; min-height: 42px; }
.integration-message { padding: 12px 0; color: #244264; overflow-wrap: anywhere; }
.integration-row { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 18px 0; border-bottom: 1px solid #dce4ef; }
.integration-row p { margin: 6px 0 0; }
.integration-detail { margin-top: 28px; }
.integration-capabilities { display: grid; grid-template-columns: minmax(160px, 250px) 1fr; gap: 10px; }
.integration-capabilities dd { margin: 0; font-weight: 700; }
.integration-tool { padding: 14px 0; border-bottom: 1px solid #dce4ef; }
.integration-tool summary { cursor: pointer; font-weight: 600; overflow-wrap: anywhere; }
.integration-tool pre { max-height: 280px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 760px) { .integration-form { grid-template-columns: 1fr; } .integration-row { align-items: flex-start; flex-direction: column; } }

/* CSP-compatible presentation: no inline style attributes. */
.auth-screen{position:fixed;inset:0;z-index:10000;background:#f6f8fb;display:grid;place-content:center;gap:20px;padding:32px;font:16px system-ui}
.mt-16{margin-top:16px}.mt-12{margin:12px 0 0}.project-agents.expanded{max-height:none;opacity:1}
.session-button{display:block;margin-top:10px;text-align:left;white-space:normal}
.chart-blue{background:#2457a6}.chart-red{background:#d94b4b}.chart-green{background:#2d8b65}
.read-only [data-action="catalog-new"],.read-only [data-action="catalog-edit"],.read-only [data-action="catalog-save"]{display:none}
.h-0{height:0%}.w-0{width:0%}
.h-1{height:1%}.w-1{width:1%}
.h-2{height:2%}.w-2{width:2%}
.h-3{height:3%}.w-3{width:3%}
.h-4{height:4%}.w-4{width:4%}
.h-5{height:5%}.w-5{width:5%}
.h-6{height:6%}.w-6{width:6%}
.h-7{height:7%}.w-7{width:7%}
.h-8{height:8%}.w-8{width:8%}
.h-9{height:9%}.w-9{width:9%}
.h-10{height:10%}.w-10{width:10%}
.h-11{height:11%}.w-11{width:11%}
.h-12{height:12%}.w-12{width:12%}
.h-13{height:13%}.w-13{width:13%}
.h-14{height:14%}.w-14{width:14%}
.h-15{height:15%}.w-15{width:15%}
.h-16{height:16%}.w-16{width:16%}
.h-17{height:17%}.w-17{width:17%}
.h-18{height:18%}.w-18{width:18%}
.h-19{height:19%}.w-19{width:19%}
.h-20{height:20%}.w-20{width:20%}
.h-21{height:21%}.w-21{width:21%}
.h-22{height:22%}.w-22{width:22%}
.h-23{height:23%}.w-23{width:23%}
.h-24{height:24%}.w-24{width:24%}
.h-25{height:25%}.w-25{width:25%}
.h-26{height:26%}.w-26{width:26%}
.h-27{height:27%}.w-27{width:27%}
.h-28{height:28%}.w-28{width:28%}
.h-29{height:29%}.w-29{width:29%}
.h-30{height:30%}.w-30{width:30%}
.h-31{height:31%}.w-31{width:31%}
.h-32{height:32%}.w-32{width:32%}
.h-33{height:33%}.w-33{width:33%}
.h-34{height:34%}.w-34{width:34%}
.h-35{height:35%}.w-35{width:35%}
.h-36{height:36%}.w-36{width:36%}
.h-37{height:37%}.w-37{width:37%}
.h-38{height:38%}.w-38{width:38%}
.h-39{height:39%}.w-39{width:39%}
.h-40{height:40%}.w-40{width:40%}
.h-41{height:41%}.w-41{width:41%}
.h-42{height:42%}.w-42{width:42%}
.h-43{height:43%}.w-43{width:43%}
.h-44{height:44%}.w-44{width:44%}
.h-45{height:45%}.w-45{width:45%}
.h-46{height:46%}.w-46{width:46%}
.h-47{height:47%}.w-47{width:47%}
.h-48{height:48%}.w-48{width:48%}
.h-49{height:49%}.w-49{width:49%}
.h-50{height:50%}.w-50{width:50%}
.h-51{height:51%}.w-51{width:51%}
.h-52{height:52%}.w-52{width:52%}
.h-53{height:53%}.w-53{width:53%}
.h-54{height:54%}.w-54{width:54%}
.h-55{height:55%}.w-55{width:55%}
.h-56{height:56%}.w-56{width:56%}
.h-57{height:57%}.w-57{width:57%}
.h-58{height:58%}.w-58{width:58%}
.h-59{height:59%}.w-59{width:59%}
.h-60{height:60%}.w-60{width:60%}
.h-61{height:61%}.w-61{width:61%}
.h-62{height:62%}.w-62{width:62%}
.h-63{height:63%}.w-63{width:63%}
.h-64{height:64%}.w-64{width:64%}
.h-65{height:65%}.w-65{width:65%}
.h-66{height:66%}.w-66{width:66%}
.h-67{height:67%}.w-67{width:67%}
.h-68{height:68%}.w-68{width:68%}
.h-69{height:69%}.w-69{width:69%}
.h-70{height:70%}.w-70{width:70%}
.h-71{height:71%}.w-71{width:71%}
.h-72{height:72%}.w-72{width:72%}
.h-73{height:73%}.w-73{width:73%}
.h-74{height:74%}.w-74{width:74%}
.h-75{height:75%}.w-75{width:75%}
.h-76{height:76%}.w-76{width:76%}
.h-77{height:77%}.w-77{width:77%}
.h-78{height:78%}.w-78{width:78%}
.h-79{height:79%}.w-79{width:79%}
.h-80{height:80%}.w-80{width:80%}
.h-81{height:81%}.w-81{width:81%}
.h-82{height:82%}.w-82{width:82%}
.h-83{height:83%}.w-83{width:83%}
.h-84{height:84%}.w-84{width:84%}
.h-85{height:85%}.w-85{width:85%}
.h-86{height:86%}.w-86{width:86%}
.h-87{height:87%}.w-87{width:87%}
.h-88{height:88%}.w-88{width:88%}
.h-89{height:89%}.w-89{width:89%}
.h-90{height:90%}.w-90{width:90%}
.h-91{height:91%}.w-91{width:91%}
.h-92{height:92%}.w-92{width:92%}
.h-93{height:93%}.w-93{width:93%}
.h-94{height:94%}.w-94{width:94%}
.h-95{height:95%}.w-95{width:95%}
.h-96{height:96%}.w-96{width:96%}
.h-97{height:97%}.w-97{width:97%}
.h-98{height:98%}.w-98{width:98%}
.h-99{height:99%}.w-99{width:99%}
.h-100{height:100%}.w-100{width:100%}

.read-only [data-edit],.read-only [data-agent-edit],.read-only [data-modal]{display:none}
