:root {
  color-scheme: light;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-soft: #f8faff;
  --line: #d8e0ec;
  --line-strong: #bcc7d9;
  --ink: #222b3a;
  --muted: #6a7487;
  --nav: #10175a;
  --nav-2: #16207a;
  --blue: #4d9bff;
  --teal: #12b7a5;
  --green: #21b66f;
  --yellow: #ffb84d;
  --red: #ef5c67;
  --shadow: 0 10px 25px rgba(28, 40, 73, 0.08);
}

* {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  padding: 7px 8px;
  background: #fff;
  color: var(--ink);
}

.app-shell {
  display: grid;
  grid-template-columns: 54px 1fr;
  min-height: 100vh;
}

.nav-rail {
  background: linear-gradient(180deg, var(--nav), #0d1250);
  color: #fff;
  display: grid;
  grid-auto-rows: min-content;
  align-content: start;
  gap: 10px;
  padding: 10px 8px;
}

.rail-logo,
.rail-item {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: transparent;
  color: inherit;
  font-size: 12px;
  font-weight: 700;
}

.rail-logo {
  margin-bottom: 6px;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.08);
}

.rail-item.active {
  background: rgba(77, 155, 255, 0.24);
  border-color: rgba(255, 255, 255, 0.32);
}

.app-main {
  display: grid;
  grid-template-rows: 54px 42px 1fr;
}

.topbar,
.toolbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar {
  display: grid;
  grid-template-columns: 280px 1fr 240px;
  gap: 16px;
  align-items: center;
  padding: 0 14px;
}

.topbar-left,
.toolbar,
.toolbar-left,
.toolbar-right,
.brand-lockup {
  display: flex;
  align-items: center;
}

.topbar-left {
  gap: 12px;
}

.menu-btn,
.ghost-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 4px;
  padding: 6px 10px;
  color: var(--ink);
}

.brand-lockup {
  gap: 10px;
}

.brand-lockup strong {
  color: var(--nav);
  font-size: 18px;
  text-transform: lowercase;
}

.brand-lockup span {
  font-size: 13px;
  color: var(--muted);
}

.search-wrap input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: #fff;
  padding: 7px 12px;
  color: #8791a4;
}

.topbar-right {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}

.top-pill {
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--muted);
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #6c3bd7;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
}

.toolbar {
  justify-content: space-between;
  gap: 16px;
  padding: 0 10px;
}

.toolbar-left {
  gap: 10px;
  min-width: 0;
}

.toolbar-right {
  gap: 8px;
}

.label-chip,
.source-chip,
.toggle,
.record-tab,
.table-chip,
.score-chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 3px;
  padding: 5px 9px;
  font-size: 12px;
}

.chip-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.source-chip {
  background: #1f78d6;
  border-color: #1f78d6;
  color: #fff;
}

.workspace {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 0;
}

.filters-panel {
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 10px 8px;
  overflow: auto;
}

.filters-head {
  padding: 4px 4px 10px;
  font-size: 14px;
}

.filter-block {
  border-top: 1px solid var(--line);
  padding: 12px 4px;
}

.filter-block label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.filter-block select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  padding: 7px 8px;
  background: #fff;
  color: var(--ink);
}

.run-block {
  gap: 8px;
}

.run-btn {
  border: 1px solid #1f78d6;
  background: #1f78d6;
  color: #fff;
  border-radius: 3px;
  padding: 8px 10px;
  font-weight: 600;
}

.run-btn:disabled {
  opacity: 0.65;
}

.live-status-card {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 8px 9px;
  display: grid;
  gap: 4px;
}

.live-status-card strong {
  font-size: 12px;
}

.live-status-card span {
  color: var(--muted);
  font-size: 12px;
}

.live-status-card.running {
  background: #eef6ff;
  border-color: #bdd6f5;
}

.live-status-card.success {
  background: #ecfff4;
  border-color: #b7e1c8;
}

.live-status-card.error {
  background: #fff0f3;
  border-color: #efc1c9;
}

.mini-label,
.section-kicker,
.chart-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.metric-tags,
.compact-list {
  display: grid;
  gap: 6px;
}

.metric-tag,
.compact-item {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  border-radius: 3px;
  padding: 6px 7px;
  font-size: 12px;
}

.content {
  padding: 14px;
  overflow: auto;
  display: grid;
  gap: 14px;
}

.title-row {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 14px;
}

.smartboard-tabs,
.smartboard-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.smartboard-tabs {
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
}

.smartboard-control-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.smart-tab,
.control-pill,
.control-note,
.go-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 2px;
  padding: 7px 12px;
  font-size: 12px;
}

.smart-tab {
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 8px 4px 10px;
  background: transparent;
  color: var(--muted);
}

.smart-tab.active {
  color: #1f78d6;
  border-bottom-color: #1f78d6;
}

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

.go-btn {
  border-color: #08a44d;
  background: #08a44d;
  color: #fff;
  min-width: 62px;
}

.title-row h1,
.panel-head h2 {
  margin: 4px 0 0;
  font-size: 22px;
  font-weight: 600;
}

.score-chip {
  min-width: 150px;
  text-align: center;
  font-weight: 700;
}

.score-chip.good {
  background: #e8fff3;
  color: #177748;
  border-color: #abe0c2;
}

.score-chip.warn {
  background: #fff7e7;
  color: #9d6808;
  border-color: #ecd19a;
}

.score-chip.bad {
  background: #ffedf0;
  color: #b62034;
  border-color: #efbcc4;
}

.kpi-grid,
.record-metrics,
.check-grid,
.insight-grid,
.alert-grid {
  display: grid;
  gap: 10px;
}

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

.view-switch {
  display: flex;
  align-items: center;
  gap: 8px;
}

.view-tab {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 3px;
  padding: 6px 12px;
  font-size: 12px;
}

.view-tab.active {
  background: #1f78d6;
  border-color: #1f78d6;
  color: #fff;
}

.view-context {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.view-page {
  display: none;
  gap: 14px;
}

.view-page.active {
  display: grid;
}

.summary-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 244px;
  gap: 14px;
  align-items: start;
}

.summary-main,
.summary-side {
  display: grid;
  gap: 14px;
}

.kpi-card,
.panel,
.check-card,
.insight-card {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.kpi-card {
  padding: 12px;
}

.kpi-label {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 6px;
}

.kpi-note {
  color: var(--muted);
  font-size: 12px;
}

.panel {
  padding: 12px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-toggles,
.legend-inline,
.record-tabs,
.table-filters {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.toggle.on,
.record-tab.active,
.table-chip.active {
  background: #1f78d6;
  border-color: #1f78d6;
  color: #fff;
}

.chart-grid,
.two-col,
.final-row {
  display: grid;
  gap: 14px;
}

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

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

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

.chart-box {
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px;
}

.chart-note {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.chart-box-wide .svg-chart {
  height: 200px;
}

.svg-chart {
  height: 260px;
}

.chart-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.axis-line,
.grid-line {
  stroke: #dfe6f1;
  stroke-width: 1;
}

.axis-text,
.legend-text {
  fill: #7a869b;
  font-size: 11px;
}

.line-score {
  fill: none;
  stroke: var(--blue);
  stroke-width: 2;
}

.line-backbone {
  fill: none;
  stroke: var(--blue);
  stroke-width: 2;
}

.line-lastmile {
  fill: none;
  stroke: var(--teal);
  stroke-width: 2;
}

.trend-point {
  cursor: pointer;
  transition: r 120ms ease;
}

.trend-point:hover {
  r: 5.5;
}

.trend-alert {
  stroke: var(--red);
  stroke-width: 2;
}

.area-fill {
  fill: rgba(77, 155, 255, 0.12);
}

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

.alert-card {
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px;
}

.alert-card.warn {
  background: #fff9ea;
  border-color: #ebd198;
}

.alert-card.fail {
  background: #ffedf0;
  border-color: #efc0c7;
}

.alert-time {
  color: var(--muted);
  font-size: 11px;
  margin-top: 6px;
}

.pillar-strip,
.node-bars {
  display: grid;
  gap: 10px;
}

.pillar-item {
  display: grid;
  grid-template-columns: 170px 1fr 56px;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  padding: 10px;
}

.pillar-name strong,
.status-line strong {
  display: block;
  font-size: 13px;
}

.pillar-name span,
.status-line span {
  color: var(--muted);
  font-size: 11px;
}

.pillar-track,
.dual-track {
  position: relative;
  height: 14px;
  border-radius: 20px;
  background: #edf2f8;
  overflow: hidden;
}

.pillar-fill,
.dual-fill-backbone,
.dual-fill-lastmile {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
}

.pillar-fill {
  background: linear-gradient(90deg, #78b4ff, #1f78d6);
}

.pillar-value {
  text-align: right;
  font-weight: 700;
}

.node-row {
  display: grid;
  grid-template-columns: 120px 1fr 90px;
  gap: 12px;
  align-items: center;
}

.dual-fill-backbone {
  background: rgba(77, 155, 255, 0.95);
}

.dual-fill-lastmile {
  background: rgba(18, 183, 165, 0.95);
}

.node-values {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

.record-status {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.panel-head-tight {
  margin-bottom: 8px;
}

.score-panel,
.events-panel {
  min-height: 0;
}

.score-gauge {
  display: grid;
  place-items: center;
  padding: 12px 0 4px;
}

.gauge-ring {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  background: conic-gradient(#52b46b 0 270deg, #d6e8da 270deg 315deg, #eef2f6 315deg 360deg);
  display: grid;
  place-items: center;
}

.gauge-center {
  width: 98px;
  height: 98px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  font-size: 42px;
  font-weight: 700;
  color: #24324a;
  box-shadow: inset 0 0 0 1px var(--line);
}

.score-gauge-note {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

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

.event-stat {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 10px;
  display: grid;
  gap: 6px;
  text-align: center;
}

.event-stat span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.event-stat strong {
  font-size: 26px;
  line-height: 1;
}

.events-empty {
  border: 1px dashed var(--line-strong);
  background: #fbfcfe;
  min-height: 140px;
  margin-top: 12px;
  padding: 18px 16px;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 8px;
}

.events-empty strong {
  font-size: 15px;
}

.events-empty span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.record-header {
  padding-bottom: 8px;
}

.record-run-meta {
  color: var(--muted);
  font-size: 12px;
}

.record-timeline {
  height: 56px;
  display: flex;
  align-items: end;
  gap: 6px;
  overflow: hidden;
}

.timeline-bar {
  flex: 1;
  background: #dbe8fb;
  border: 1px solid #c9daf4;
  min-width: 14px;
}

.timeline-bar.active {
  background: #5f9be4;
  border-color: #3d7fd4;
}

.status-line {
  border: 1px solid var(--line);
  padding: 9px 10px;
  background: var(--surface-soft);
}

.status-line.warn {
  background: #fff7e1;
  border-color: #f1d48a;
}

.status-line.fail {
  background: #ffe9ed;
  border-color: #efb6c0;
}

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

.record-metric {
  border: 1px solid var(--line);
  padding: 10px;
  background: #fff;
}

.record-metric strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
  font-weight: 700;
}

.filmstrip-band,
.activity-band,
.table-head {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.filmstrip-label,
.activity-label {
  font-size: 12px;
  color: var(--muted);
}

.filmstrip-frames {
  display: flex;
  gap: 8px;
  align-items: end;
  overflow: auto;
}

.frame {
  width: 74px;
  height: 52px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, #fafafa 0 70%, #202020 70% 84%, #111 84% 100%);
  position: relative;
}

.frame::before {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  top: 8px;
  height: 10px;
  background: #d7e6ff;
}

.frame::after {
  content: "";
  position: absolute;
  left: 10px;
  width: var(--page-width, 36px);
  top: 24px;
  height: 8px;
  background: #f26c5b;
}

.frame span {
  position: absolute;
  top: -16px;
  left: 0;
  font-size: 10px;
  color: var(--muted);
}

.activity-track {
  height: 18px;
  border: 1px solid var(--line);
  background: #eef4fb;
  display: flex;
  gap: 1px;
  padding: 2px;
}

.activity-segment {
  flex: 1;
  background: #aacaf2;
}

.activity-segment.hot {
  background: #5f9be4;
}

.activity-segment.warn {
  background: #ffd073;
}

.table-head {
  grid-template-columns: 180px 1fr;
}

.table-search {
  border: 1px solid var(--line);
  padding: 7px 10px;
  font-size: 12px;
  color: #8c96a8;
  background: #fff;
}

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

.request-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

.request-table th,
.request-table td {
  border-bottom: 1px solid #edf2f8;
  padding: 7px 8px;
  font-size: 12px;
  text-align: left;
  vertical-align: middle;
}

.request-table th {
  position: sticky;
  top: 0;
  background: #f8fbff;
  color: var(--muted);
  z-index: 1;
}

.status-code.bad {
  color: var(--red);
  font-weight: 700;
}

.status-code.good {
  color: var(--green);
  font-weight: 700;
}

.waterfall {
  position: relative;
  width: 100%;
  min-width: 280px;
  height: 18px;
  background:
    repeating-linear-gradient(90deg, #f4f7fc 0, #f4f7fc 39px, #e3eaf5 40px);
  border: 1px solid #edf2f8;
}

.waterfall-bar {
  position: absolute;
  top: 2px;
  height: 12px;
}

.waterfall-bar.wait {
  background: #f67a69;
}

.waterfall-bar.download {
  background: #64a1f3;
}

.waterfall-bar.process {
  background: #f7c455;
}

.check-grid,
.insight-grid {
  grid-template-columns: 1fr;
}

.check-card,
.insight-card {
  padding: 10px;
}

.check-card {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 10px;
  align-items: start;
}

.check-state {
  border-radius: 3px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 4px;
}

.check-state.pass {
  background: #e8fff3;
  color: #177748;
}

.check-state.warn {
  background: #fff7e1;
  color: #9d6808;
}

.check-state.fail {
  background: #ffe9ed;
  color: #b62034;
}

.insight-card strong {
  display: block;
  margin-bottom: 6px;
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 5px;
}

.dot.backbone {
  background: var(--blue);
}

.dot.lastmile {
  background: var(--teal);
}

@media (max-width: 1280px) {
  .summary-layout {
    grid-template-columns: 1fr;
  }

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

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

  .filters-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

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

  .chart-grid,
  .two-col,
  .summary-side {
    grid-template-columns: 1fr;
  }
}

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

  .nav-rail {
    display: none;
  }

  .topbar {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
    padding: 8px 10px;
  }

  .smartboard-tabs,
  .smartboard-controls {
    align-items: start;
  }

  .title-row,
  .panel-head,
  .filmstrip-band,
  .activity-band,
  .table-head {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: start;
  }

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

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

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

  .events-stats {
    grid-template-columns: 1fr 1fr;
  }

  .pillar-item,
  .node-row,
  .check-card {
    grid-template-columns: 1fr;
  }
}
