:root {
  --sidebar-width: 320px;
  --bg: #eef2f1;
  --ink: #16201f;
  --muted: #61706f;
  --panel: #ffffff;
  --panel-2: #f6f8f7;
  --line: #d8e0df;
  --navy: #18314f;
  --green: #0f766e;
  --red: #b23b3b;
  --amber: #b7791f;
  --cyan: #1976a2;
  --violet: #6852a3;
  --shadow: 0 18px 45px rgba(23, 38, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.desktop-layout {
  overflow-x: auto;
  min-width: calc(var(--sidebar-width) + 680px);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

body.desktop-layout .app-shell {
  display: block;
  min-width: calc(var(--sidebar-width) + 680px);
}

body.desktop-layout .workspace {
  margin-left: var(--sidebar-width);
  min-width: 680px;
}

body.desktop-layout.sidebar-collapsed .workspace {
  margin-left: 56px;
}

.sidebar {
  container: sidebar / inline-size;
  border-right: 1px solid var(--line);
  background: #fbfcfc;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  position: sticky;
  top: 0;
  z-index: 30;
}

body.desktop-layout .workspace {
  position: relative;
  z-index: 1;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-block > div:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.sidebar-toggle {
  width: 34px;
  min-height: 34px;
  flex-shrink: 0;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--navy), var(--green));
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 18px;
}

h2 {
  font-size: 20px;
  line-height: 1.15;
}

h3 {
  font-size: 16px;
}

.brand-block p,
.panel-header p,
.muted,
.source-card p,
.actor-note,
.topbar .eyebrow {
  color: var(--muted);
}

.toolbar,
.control-band,
.panel-header,
.chip-row,
.field-pair,
.topbar {
  display: flex;
  align-items: center;
}

.toolbar.compact {
  gap: 6px;
  flex-shrink: 0;
}

.brand-block,
.compare-groups,
.filter-grid,
.health-filter-grid,
.sidebar-footer,
.custom-form,
.sidebar-section-title {
  flex-shrink: 0;
}

.sidebar-section-title {
  color: var(--navy);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
  margin-top: 2px;
}

.runtime-block {
  display: grid;
  justify-items: end;
  gap: 6px;
  min-width: 260px;
}

.remote-access {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-align: right;
  max-width: 460px;
  overflow-wrap: anywhere;
}

.search-box {
  flex: 1;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 8px;
}

.search-box input,
.custom-form input,
.custom-form select,
select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  min-height: 40px;
  padding: 0 10px;
  color: var(--ink);
}

.search-box input {
  border: 0;
  outline: 0;
  width: 100%;
  min-width: 0;
  padding: 0;
}

.icon-button,
.command {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ink);
}

.icon-button {
  width: 40px;
}

.icon-text {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.command {
  padding: 0 12px;
}

.command.subtle {
  background: var(--panel-2);
}

.command .icon-text,
.icon-button .icon-text {
  color: inherit;
}

.command.utility,
.icon-button.utility {
  background: #eef6f5;
  color: var(--green);
  border-color: #b9ded2;
}

.command.warning {
  background: #fff6df;
  color: #8a5a00;
  border-color: #efd793;
  font-weight: 700;
}

.command.danger {
  background: #fff0f0;
  color: var(--red);
  border-color: #efc4c4;
}

.icon-button.check {
  background: #ecf8f5;
  color: var(--green);
  border-color: #b9ded2;
}

.icon-button.fetch {
  background: #eef5fb;
  color: var(--cyan);
  border-color: #b9d5e4;
}

.command:disabled,
.icon-button:disabled {
  background: #eef1f0;
  border-color: var(--line);
  color: #8b9996;
  cursor: not-allowed;
  opacity: 0.72;
}

.mini-command {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 7px;
  min-height: 30px;
  padding: 0 9px;
  color: var(--muted);
  font-size: 12px;
}

.filter-grid,
.health-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
  gap: 6px;
}

.filter,
.health-filter,
.segmented button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  min-height: 34px;
  color: var(--muted);
  line-height: 1.2;
  overflow-wrap: anywhere;
  white-space: normal;
}

.filter.active,
.health-filter.active,
.segmented button.active {
  background: #18314f;
  color: #fff;
  border-color: #18314f;
}

.health-filter-grid {
  grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
}

.health-filter {
  min-height: 30px;
  font-size: 12px;
}

.asset-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 6px 4px 6px 6px;
  flex: 0 1 auto;
  min-height: 80px;
  overscroll-behavior: contain;
}

body.desktop-layout .asset-list {
  min-height: 80px;
  padding-right: 6px;
}

.sidebar-footer {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(251, 252, 252, 0.98);
  padding: 8px;
  z-index: 2;
  flex-shrink: 0;
}

body.desktop-layout .sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--sidebar-width);
  height: auto;
  overflow: visible;
  box-shadow: 1px 0 0 rgba(22, 32, 31, 0.04);
}

body.desktop-layout.sidebar-collapsed .sidebar {
  width: 56px;
  padding: 10px 8px;
  gap: 8px;
}

.sidebar-resize-handle {
  display: none;
}

body.desktop-layout .sidebar-resize-handle {
  display: block;
  position: fixed;
  top: 0;
  left: calc(var(--sidebar-width) - 18px);
  width: 42px;
  height: 100%;
  border: 0;
  background: linear-gradient(90deg, transparent 0 16px, rgba(15, 118, 110, 0.28) 16px 24px, transparent 24px 100%);
  cursor: ew-resize;
  padding: 0;
  opacity: 1;
  touch-action: none;
  z-index: 120;
}

body.desktop-layout .sidebar-resize-handle::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 20px;
  width: 3px;
  background: rgba(15, 118, 110, 0.65);
}

body.desktop-layout .sidebar-resize-handle::after {
  content: "⋮\A⋮\A⋮";
  position: absolute;
  top: 48%;
  bottom: auto;
  left: 8px;
  width: 26px;
  height: 118px;
  border-radius: 99px;
  display: grid;
  place-items: center;
  background: #0f766e;
  border: 2px solid #f9fbfb;
  box-shadow: 0 0 0 1px rgba(22, 32, 31, 0.18), 0 10px 22px rgba(22, 32, 31, 0.26);
  color: #fff;
  font-size: 24px;
  line-height: 0.62;
  white-space: pre;
  transform: translateY(-50%);
}

body.desktop-layout .sidebar-resize-handle:hover,
body.desktop-layout .sidebar-resize-handle:focus-visible {
  opacity: 1;
  background: linear-gradient(90deg, transparent 0 16px, rgba(15, 118, 110, 0.38) 16px 24px, transparent 24px 100%);
}

body.desktop-layout .sidebar-resize-handle:hover::after {
  background: #0b5f59;
}

body.desktop-layout.sidebar-collapsed .sidebar-resize-handle {
  display: none;
}

body.desktop-layout.sidebar-collapsed .brand-block {
  display: grid;
  justify-items: center;
  gap: 8px;
}

body.desktop-layout.sidebar-collapsed .brand-block > div:nth-child(2),
body.desktop-layout.sidebar-collapsed .toolbar,
body.desktop-layout.sidebar-collapsed .compare-groups,
body.desktop-layout.sidebar-collapsed .sidebar-section-title,
body.desktop-layout.sidebar-collapsed .filter-grid,
body.desktop-layout.sidebar-collapsed .health-filter-grid,
body.desktop-layout.sidebar-collapsed .asset-list,
body.desktop-layout.sidebar-collapsed .sidebar-footer {
  display: none;
}

body.desktop-layout.sidebar-collapsed .brand-mark {
  width: 38px;
  height: 38px;
}

.selected-summary {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.selected-summary strong {
  color: var(--navy);
  font-size: 12px;
}

.empty-list {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 14px 10px;
  color: var(--muted);
  background: #fff;
  font-size: 13px;
  text-align: center;
}

.asset-group {
  display: grid;
  gap: 4px;
}

.asset-group-toggle {
  border: 1px solid #bfccca;
  background: linear-gradient(180deg, #dfe8e6, #d2ddda);
  border-radius: 8px;
  min-height: 36px;
  padding: 5px 6px;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) 26px;
  gap: 6px;
  align-items: center;
  text-align: left;
  box-shadow: inset 3px 0 0 var(--navy);
}

.asset-group-toggle strong,
.asset-group-toggle em {
  display: block;
  overflow-wrap: anywhere;
  white-space: normal;
}

.asset-group-toggle strong {
  color: var(--navy);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.asset-group-toggle em {
  color: #485957;
  font-size: 10px;
  font-style: normal;
  margin-top: 1px;
}

.asset-group-mark {
  width: 23px;
  height: 23px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: var(--navy);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.asset-group-caret {
  width: 23px;
  height: 23px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.68);
  color: var(--navy);
  font-size: 18px;
  font-weight: 800;
}

.asset-group-body {
  display: grid;
  gap: 5px;
}

.asset-group.collapsed .asset-group-body {
  display: none;
}

.asset-subgroup {
  display: grid;
  gap: 4px;
}

.asset-subgroup-toggle {
  border: 1px solid transparent;
  background: #eef4f2;
  border-radius: 7px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 26px 22px;
  gap: 5px;
  align-items: center;
  min-height: 21px;
  padding: 3px 4px 3px 7px;
  border-left: 3px solid var(--green);
  text-align: left;
}

.asset-subgroup-toggle span {
  color: #485957;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.25;
  overflow-wrap: anywhere;
  white-space: normal;
}

.asset-subgroup-toggle em {
  min-width: 22px;
  height: 18px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  letter-spacing: 0;
}

.asset-subgroup-toggle b {
  width: 22px;
  height: 20px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--green);
  font-size: 15px;
  line-height: 1;
}

.asset-subgroup-body {
  display: grid;
  gap: 5px;
}

.asset-subgroup.collapsed .asset-subgroup-body {
  display: none;
}

.asset-row {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 6px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  text-align: left;
}

.asset-row.active {
  border-color: var(--green);
  background: #ecf8f5;
  box-shadow: inset 4px 0 0 var(--green), 0 0 0 2px rgba(15, 118, 110, 0.18);
  transform: translateX(2px);
}

.asset-main strong {
  display: block;
  font-size: 11px;
  line-height: 1.3;
  overflow-wrap: anywhere;
  white-space: normal;
}

.asset-main span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-top: 1px;
}

.asset-meta {
  overflow-wrap: anywhere;
  white-space: normal;
}

.asset-tag {
  align-self: start;
  border-radius: 999px;
  padding: 3px 6px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 10px;
  text-align: center;
  white-space: normal;
  margin-top: 0;
}

.asset-side {
  display: grid;
  gap: 3px;
  justify-items: end;
  align-self: start;
}

.asset-health {
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  padding: 2px 6px;
  color: inherit;
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
  border: 1px solid transparent;
  margin-top: 0;
  min-height: 20px;
}

.asset-health.ok {
  background: #e7f6f1;
  color: #0f766e;
  border-color: #b9ded2;
}

.asset-health.fail {
  background: #fff0f0;
  color: #b23b3b;
  border-color: #efc4c4;
}

.asset-health.checking {
  background: #fff6df;
  color: #8a5a00;
  border-color: #efd793;
}

.asset-health.unknown {
  background: #eef1f0;
  color: var(--muted);
  border-color: #d8e0df;
}

.compare-groups {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfa;
  padding: 8px;
}

.compare-group-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.compare-group-head strong {
  color: var(--navy);
  font-size: 13px;
}

.compare-group-list {
  display: grid;
  gap: 6px;
  max-height: 112px;
  overflow: auto;
}

.compare-group-row {
  display: grid;
  grid-template-columns: 1fr 30px;
  gap: 6px;
}

.compare-group-load,
.compare-group-delete {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 7px;
}

.compare-group-load {
  min-width: 0;
  min-height: 36px;
  padding: 6px 8px;
  text-align: left;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
}

.compare-group-load strong,
.compare-group-load span {
  display: block;
}

.compare-group-load i {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: var(--green);
  color: #fff;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.compare-group-load.active {
  border-color: var(--green);
  background: #ecf8f5;
}

.compare-group-load strong {
  color: var(--ink);
  font-size: 12px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.compare-group-load span {
  color: var(--muted);
  font-size: 11px;
  margin-top: 1px;
}

.compare-group-delete {
  min-height: 36px;
  color: var(--red);
  font-weight: 800;
}

.save-group-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.sidebar-footer .save-group-control {
  grid-template-columns: minmax(0, 1fr) minmax(58px, 72px);
}

.sidebar-footer .command {
  width: 100%;
  min-height: 36px;
}

.sidebar-footer select,
.sidebar-footer input {
  width: 100%;
  min-width: 0;
  min-height: 36px;
}

.sidebar-footer .field-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(68px, 76px);
}

.custom-asset-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.custom-asset-panel summary {
  min-height: 32px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.custom-asset-panel .custom-form {
  padding: 0 8px 8px;
}

.save-group-control input {
  min-height: 40px;
  min-width: 0;
}

.custom-form {
  display: grid;
  gap: 8px;
  margin-top: 0;
}

.field-pair {
  gap: 8px;
}

.field-pair input {
  min-width: 0;
  flex: 1;
}

@container sidebar (max-width: 300px) {
  .brand-block {
    gap: 8px;
  }

  .brand-block h1 {
    font-size: 16px;
  }

  .brand-block p {
    font-size: 12px;
    line-height: 1.25;
  }

  .toolbar.compact {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 38px 38px;
  }

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

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

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

  .asset-side {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .sidebar-footer .save-group-control,
  .sidebar-footer .field-pair {
    grid-template-columns: minmax(0, 1fr);
  }
}

.workspace {
  min-width: 0;
  padding: 4px 6px;
  display: block;
  gap: 10px;
  align-items: start;
}

.main-column {
  container: main / inline-size;
  min-width: 0;
  display: grid;
  gap: 6px;
}

.topbar {
  justify-content: space-between;
}

.eyebrow {
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
}

.status-pill {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  white-space: nowrap;
}

.control-band {
  display: grid;
  gap: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px;
  box-shadow: var(--shadow);
}

.control-row {
  display: grid;
  align-items: center;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 6px;
}

.control-row > *,
.chart-tool-grid > *,
.control-band select,
.control-band .command {
  min-width: 0;
}

.control-band select,
.control-band .command {
  max-width: 100%;
}

.chart-tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  align-items: center;
  gap: 4px 7px;
  border-top: 1px solid var(--line);
  padding-top: 5px;
}

.tool-field {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 12px;
  min-width: 0;
}

.tool-field input[type="range"] {
  width: 100%;
  accent-color: var(--green);
}

.check-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  min-height: 24px;
  flex-wrap: wrap;
}

.check-field input {
  accent-color: var(--green);
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(7, minmax(42px, 1fr));
  gap: 6px;
  width: 100%;
  grid-column: span 3;
}

.control-row select,
.control-row .command {
  width: 100%;
}

.chart-panel,
.metric-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 0;
  overflow: hidden;
}

.chart-panel {
  padding: 5px 5px 4px;
}

.panel-header {
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}

.panel-header.slim {
  margin: 0;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
}

.chip-row {
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chip {
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.chart {
  height: clamp(460px, calc(100vh - 220px), 760px);
  width: 100%;
  min-height: 420px;
}

.chart-resize-handle {
  width: 100%;
  height: 22px;
  border: 0;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: ns-resize;
  padding: 0;
  touch-action: none;
}

.chart-resize-handle span {
  width: 96px;
  height: 6px;
  border-radius: 999px;
  background: #c7d1cf;
}

.chart-resize-handle:hover span {
  background: var(--green);
}

.chart-stage {
  min-height: 390px;
  height: calc(100% - 34px);
  position: relative;
  touch-action: none;
  user-select: none;
}

.chart-stage svg {
  width: 100%;
  height: 100%;
  display: block;
  shape-rendering: geometricPrecision;
}

.chart-crosshair {
  display: none;
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.chart-crosshair.active {
  display: block;
}

.crosshair-tip {
  position: absolute;
  width: 260px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(23, 38, 42, 0.16);
  padding: 8px 9px;
  font-size: 12px;
}

.crosshair-tip strong,
.crosshair-tip span {
  display: block;
}

.crosshair-tip span {
  color: var(--muted);
  margin-top: 2px;
}

.crosshair-tip b {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 99px;
  margin-right: 6px;
}

.svg-crosshair {
  pointer-events: none;
}

.svg-crosshair-line {
  stroke: rgba(22, 32, 31, 0.46);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.svg-crosshair-point {
  stroke: #fff;
  stroke-width: 2.2;
  vector-effect: non-scaling-stroke;
}

.svg-crosshair-label {
  font-size: 11px;
  font-weight: 700;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 4px;
  stroke-linejoin: round;
}

.trace-gap {
  stroke-dasharray: 4 5;
  opacity: 0.45;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.axis-label {
  fill: var(--muted);
  font-size: 12px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  max-height: 56px;
  overflow: auto;
  padding-right: 4px;
}

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

.chart-legend b {
  display: inline-block;
  width: 18px;
  height: 3px;
  border-radius: 99px;
}

.empty-chart {
  min-height: 360px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  text-align: center;
  color: var(--muted);
}

.empty-chart strong {
  color: var(--ink);
  font-size: 18px;
}

.empty-chart span {
  max-width: 560px;
  line-height: 1.6;
}

.error-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.error-list div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  border: 1px solid #f1c7c7;
  background: #fff7f7;
  color: var(--red);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 12px;
}

.portfolio-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  padding: 4px 7px;
  background: #f8fbfa;
  border-bottom: 1px solid var(--line);
}

.summary-card {
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 3px 8px;
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 6px;
  align-items: baseline;
}

.summary-card:last-child {
  border-right: 0;
}

.summary-card span,
.summary-card em {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  line-height: 1.15;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-card strong {
  display: block;
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.15;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-card.positive strong,
.summary-card.positive em {
  color: var(--green);
}

.summary-card.negative strong,
.summary-card.negative em {
  color: var(--red);
}

.summary-empty {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
}

.side-stack {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  padding: 8px;
  min-width: 0;
}

.side-section,
.data-source-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  min-width: 0;
}

.failure-section {
  grid-column: 1 / -1;
}

.failure-panel {
  font-size: 12px;
  padding: 8px;
}

.failure-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
}

.failure-item {
  display: grid;
  gap: 6px;
  border: 1px solid #efc4c4;
  border-radius: 8px;
  background: #fff5f5;
  box-shadow: inset 4px 0 0 var(--red);
  padding: 9px 10px;
  min-width: 0;
}

.failure-item.recovered {
  border-color: #b9ded2;
  background: #f0faf7;
  box-shadow: inset 4px 0 0 var(--green);
}

.failure-item strong,
.failure-item span {
  display: block;
  overflow-wrap: anywhere;
}

.failure-item span {
  color: #7c5252;
  font-size: 11px;
  margin-top: 2px;
}

.failure-item dl {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 4px 7px;
  margin: 0;
}

.failure-item dt {
  color: #7c5252;
}

.failure-item dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.failure-symbol,
.failure-source,
.failure-message {
  color: var(--red);
}

.failure-source,
.failure-message {
  font-weight: 700;
}

.recovered-symbol,
.recovered-source,
.recovered-message {
  color: var(--green);
  font-weight: 700;
}

.retry-summary {
  margin-top: 8px;
  border: 1px solid #b9ded2;
  border-radius: 8px;
  background: #f0faf7;
  color: var(--green);
  padding: 8px 10px;
  font-weight: 700;
}

.failure-bottom-panel {
  border-color: #efc4c4;
}

.failure-header {
  background: #fff7f7;
}

.failure-header h3,
.failure-header span {
  color: var(--red);
}

.data-source-details {
  grid-column: 1 / -1;
}

.side-section {
  padding: 8px;
}

.side-section-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
  min-width: 0;
}

.side-section-head strong {
  font-size: 13px;
  color: var(--ink);
}

.side-section-head span {
  color: var(--muted);
  font-size: 12px;
}

.correlation-panel {
  font-size: 12px;
}

.corr-table-wrap {
  overflow: auto;
  max-width: 100%;
}

.corr-table {
  width: 100%;
  min-width: 100%;
  font-size: 12px;
  table-layout: fixed;
}

.corr-table th,
.corr-table td {
  padding: 5px 7px;
  text-align: center;
  overflow-wrap: anywhere;
  white-space: normal;
}

.corr-table th:first-child {
  text-align: left;
}

.corr-cell {
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
}

.corr-cell.self {
  color: var(--ink);
  font-weight: 700;
}

.corr-cell.high {
  background: #e7f6f1;
  color: var(--green);
}

.corr-cell.low {
  background: #fff6df;
  color: #8a5a00;
}

.observation-notes {
  display: block;
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 7px 8px;
}

.data-source-details summary {
  min-height: 36px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.data-source-details .source-list {
  padding-top: 0;
}

.metric-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.table-wrap {
  overflow: auto;
  max-width: 100%;
}

.metric-table-wrap {
  overflow: visible;
}

table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
}

th,
td {
  padding: 5px 7px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  overflow-wrap: anywhere;
  white-space: normal;
}

th {
  color: var(--muted);
  font-weight: 650;
}

@container main (max-width: 560px) {
  .control-row {
    grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
  }

  .segmented {
    grid-column: 1 / -1;
  }

  .chart-tool-grid {
    grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  }

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .chip-row {
    justify-content: flex-start;
  }

  .portfolio-summary {
    grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
    padding: 4px 5px;
    gap: 0;
  }

  .summary-card {
    padding: 4px 6px;
  }

  .summary-card span,
  .summary-card em {
    font-size: 10px;
  }

  .summary-card strong {
    font-size: 12px;
    margin: 0;
  }

  .metric-table-wrap {
    overflow: visible;
  }

  table.responsive-table,
  table.responsive-table thead,
  table.responsive-table tbody,
  table.responsive-table tr,
  table.responsive-table td {
    display: block;
  }

  table.responsive-table thead {
    display: none;
  }

  table.responsive-table tbody {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 7px;
    padding: 7px;
  }

  table.responsive-table tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 10px;
    margin: 0;
    padding: 7px 9px;
    min-width: 0;
  }

  table.responsive-table tr.empty-row {
    grid-column: 1 / -1;
    display: block;
    padding: 8px 10px;
  }

  table.responsive-table tr.empty-row td {
    display: block;
    padding: 0;
  }

  table.responsive-table tr.empty-row td::before {
    content: "";
  }

  table.responsive-table td {
    border-bottom: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
    padding: 4px 0;
    min-width: 0;
  }

  table.responsive-table td:last-child {
    border-bottom: 0;
  }

  table.responsive-table td:first-child {
    grid-column: 1 / -1;
    border-bottom: 1px solid var(--line);
    margin-bottom: 2px;
    padding-bottom: 6px;
  }

  table.responsive-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    line-height: 1.15;
  }

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

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

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

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

.source-list,
.detail-content {
  padding: 10px;
}

.source-card,
.detail-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  margin-bottom: 9px;
  background: var(--panel-2);
  overflow-wrap: anywhere;
}

.source-card a,
.detail-card a {
  color: var(--cyan);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.source-card strong,
.detail-card strong {
  display: block;
  margin-bottom: 4px;
}

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

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

.kv span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.kv strong {
  font-size: 15px;
}

.signal-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--ink);
}

.signal-list li {
  margin: 6px 0;
}

.actor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.proxy-row {
  justify-content: flex-start;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  body.desktop-layout .app-shell {
    display: block;
  }

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

  body:not(.desktop-layout) .sidebar {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: auto;
    overflow: visible;
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  body:not(.desktop-layout) .sidebar-footer {
    position: static;
    box-shadow: none;
  }

  body.desktop-layout .sidebar {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 0;
    overflow: visible;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--sidebar-width);
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  body:not(.desktop-layout) .asset-list {
    max-height: 360px;
    min-height: 120px;
    padding-bottom: 8px;
  }

  body.desktop-layout .asset-list {
    max-height: none;
    min-height: 80px;
  }

  .metric-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  body.desktop-layout .metric-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .portfolio-summary {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

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

  .chart-tool-grid {
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  }

  body.desktop-layout .chart-tool-grid {
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  }
}

@media (max-width: 720px) {
  .workspace,
  .sidebar {
    padding: 14px;
  }

  .topbar,
  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  body.desktop-layout .topbar,
  body.desktop-layout .panel-header {
    align-items: center;
    flex-direction: row;
  }

  .runtime-block {
    justify-items: start;
    min-width: 0;
    width: 100%;
  }

  body.desktop-layout .runtime-block {
    justify-items: end;
    min-width: 260px;
    width: auto;
  }

  .remote-access {
    text-align: left;
  }

  body.desktop-layout .remote-access {
    text-align: right;
  }

  h2 {
    font-size: 22px;
  }

  .segmented {
    grid-template-columns: repeat(5, minmax(44px, 1fr));
    width: 100%;
  }

  body.desktop-layout .segmented {
    grid-template-columns: repeat(7, minmax(42px, 1fr));
    width: min(100%, 370px);
  }

  .control-band select,
  .control-band .command {
    width: 100%;
  }

  body.desktop-layout .control-band select,
  body.desktop-layout .control-band .command {
    width: 100%;
  }

  .control-row {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  body.desktop-layout .control-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    width: 100%;
  }

  .chart-tool-grid {
    grid-template-columns: 1fr;
  }

  body.desktop-layout .chart-tool-grid {
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  }

  .chart {
    height: 460px;
  }

  body.desktop-layout .chart {
    height: clamp(460px, calc(100vh - 220px), 760px);
  }

  .chart-stage,
  .chart-stage svg {
    min-height: 390px;
    height: 390px;
  }

  body.desktop-layout .chart-stage {
    min-height: 390px;
    height: calc(100% - 34px);
  }

  body.desktop-layout .chart-stage svg {
    min-height: 0;
    height: 100%;
  }
}

@media (max-height: 720px) {
  .sidebar {
    gap: 8px;
    padding: 10px;
  }

  .compare-group-list {
    max-height: 72px;
  }

  .asset-list {
    min-height: 0;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }
}
