:root {
  color-scheme: light;
  --bg: #f4f3ef;
  --surface: #fffefb;
  --surface-soft: #f8f7f3;
  --ink: #20211e;
  --muted: #73756d;
  --faint: #a6a89f;
  --line: #e6e4dd;
  --line-strong: #d8d5cc;
  --sidebar: #171916;
  --sidebar-soft: #252821;
  --sidebar-text: #f4f3ec;
  --accent: #655af6;
  --accent-soft: #eceafd;
  --teal: #157f74;
  --teal-soft: #e2f3ef;
  --orange: #b9681b;
  --orange-soft: #fff0df;
  --red: #b84b4b;
  --red-soft: #fae9e7;
  --shadow: 0 1px 2px rgba(25, 26, 22, 0.03), 0 8px 30px rgba(25, 26, 22, 0.045);
  --radius: 18px;
  --font: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
}

button,
select,
input {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(101, 90, 246, 0.25);
  outline-offset: 2px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 24px 16px 18px;
  overflow: auto;
  background:
    radial-gradient(circle at 20% 0%, rgba(101, 90, 246, 0.15), transparent 32%),
    var(--sidebar);
  color: var(--sidebar-text);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 8px 25px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 14px;
  letter-spacing: -0.01em;
}

.brand small {
  margin-top: 2px;
  color: #a8ada2;
  font-size: 11px;
}

.brand-mark {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  width: 32px;
  height: 32px;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
}

.brand-mark span {
  display: block;
  width: 4px;
  border-radius: 4px;
  background: #a49cff;
}

.brand-mark span:nth-child(1) {
  height: 8px;
}

.brand-mark span:nth-child(2) {
  height: 15px;
}

.brand-mark span:nth-child(3) {
  height: 11px;
}

.navigation {
  flex: 1;
}

.nav-section-label {
  margin: 20px 10px 8px;
  color: #74796f;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 2px 0;
  padding: 10px 11px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #bfc3ba;
  text-align: left;
  text-decoration: none;
  transition: 150ms ease;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.055);
  color: #fff;
}

.nav-link.active {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: inherit;
}

.nav-icon svg {
  width: 17px;
  height: 17px;
}

.product-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--product-color, #777);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
}

.nav-badge {
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: #8f948a;
  font-family: var(--mono);
  font-size: 10px;
}

.sidebar-footer {
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.collector-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px;
}

.collector-status strong,
.collector-status small {
  display: block;
}

.collector-status strong {
  color: #d7dad2;
  font-size: 11px;
  font-weight: 600;
}

.collector-status small {
  margin-top: 1px;
  color: #74796f;
  font-size: 10px;
}

.status-dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--faint);
}

.status-dot--ready {
  background: #5fc4a7;
  box-shadow: 0 0 0 4px rgba(95, 196, 167, 0.1);
}

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  min-height: 72px;
  padding: 0 34px;
  border-bottom: 1px solid rgba(216, 213, 204, 0.8);
  background: rgba(244, 243, 239, 0.9);
  backdrop-filter: blur(15px);
}

.topbar-context {
  min-width: 0;
}

.breadcrumb {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

.freshness {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

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

.range-control {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
}

.range-control select {
  height: 38px;
  padding: 0 32px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--ink);
  color: white;
  font-weight: 650;
}

.button:disabled {
  cursor: default;
  opacity: 0.6;
}

.button--ghost {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.button--soft {
  background: var(--accent-soft);
  color: #5048d0;
}

.icon-button,
.menu-toggle {
  border: 0;
  background: transparent;
}

.menu-toggle {
  display: none;
  width: 34px;
  height: 34px;
  margin-right: 8px;
  padding: 7px;
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 3px 0;
  border-radius: 5px;
  background: var(--ink);
}

.content {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 36px 34px 64px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 27px;
}

.page-heading-copy {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 8px;
  font-size: clamp(28px, 3vw, 43px);
  font-weight: 680;
  letter-spacing: -0.045em;
  line-height: 1.05;
}

h2 {
  margin-bottom: 5px;
  font-size: 18px;
  font-weight: 680;
  letter-spacing: -0.025em;
}

h3 {
  margin-bottom: 5px;
  font-size: 14px;
}

.page-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.heading-meta {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.pill--accent {
  border-color: transparent;
  background: var(--accent-soft);
  color: #5048d0;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

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

.metric-card {
  min-height: 142px;
  padding: 19px 20px 17px;
  border-radius: 15px;
}

.metric-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 22px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.metric-card__value {
  margin-top: 14px;
  font-family: var(--mono);
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 600;
  letter-spacing: -0.05em;
  line-height: 1;
}

.metric-card__foot {
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
}

.metric-card__badge {
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.75fr);
  gap: 16px;
  margin-bottom: 28px;
}

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

.panel {
  min-width: 0;
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 22px 13px;
}

.panel-header__copy {
  min-width: 0;
}

.panel-header h2 {
  font-size: 15px;
}

.panel-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.panel-meta {
  margin-left: auto;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  white-space: nowrap;
}

.chart-wrap {
  min-height: 250px;
  padding: 0 16px 13px;
}

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

.chart-grid-line {
  stroke: #e8e6df;
  stroke-width: 1;
}

.chart-axis-label {
  fill: #92948c;
  font-family: var(--mono);
  font-size: 9px;
}

.chart-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.chart-area {
  opacity: 0.16;
}

.chart-point {
  stroke: var(--surface);
  stroke-width: 2;
}

.empty-chart {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.empty-chart strong {
  display: block;
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 13px;
}

.attention-list {
  padding: 0 14px 14px;
}

.attention-item {
  display: flex;
  gap: 12px;
  padding: 14px 8px;
  border-top: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}

.attention-item:first-child {
  border-top: 0;
}

.attention-symbol {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--orange-soft);
  color: var(--orange);
  font-size: 12px;
  font-weight: 800;
}

.attention-symbol--info {
  background: var(--accent-soft);
  color: var(--accent);
}

.attention-symbol--critical {
  background: var(--red-soft);
  color: var(--red);
}

.attention-item strong {
  display: block;
  margin-bottom: 3px;
  font-size: 12px;
}

.attention-item p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin: 29px 0 14px;
}

.section-heading p {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 11px;
}

.section-heading__count {
  margin-left: auto;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.product-card {
  position: relative;
  display: block;
  min-height: 248px;
  padding: 20px;
  overflow: hidden;
  border-radius: 16px;
  color: inherit;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 13px 34px rgba(25, 26, 22, 0.08);
}

.product-card::after {
  position: absolute;
  top: -55px;
  right: -45px;
  width: 145px;
  height: 145px;
  border-radius: 50%;
  background: var(--product-color, var(--accent));
  content: "";
  opacity: 0.08;
}

.product-card__header {
  display: flex;
  align-items: center;
  gap: 11px;
}

.product-logo {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--product-color) 12%, white);
  color: var(--product-color);
  font-size: 15px;
  font-weight: 750;
}

.product-card h3 {
  margin: 0;
  font-size: 14px;
}

.product-card__stage {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.product-card__metric {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-top: 28px;
}

.product-card__metric strong {
  font-family: var(--mono);
  font-size: 29px;
  letter-spacing: -0.04em;
}

.product-card__metric span {
  color: var(--muted);
  font-size: 10px;
}

.product-card__rows {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 17px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.product-card__row span,
.product-card__row strong {
  display: block;
}

.product-card__row span {
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.product-card__row strong {
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 12px;
}

.feature-list {
  padding: 0 22px 20px;
}

.feature-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.75fr) minmax(120px, 2fr) 70px;
  align-items: center;
  gap: 13px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.feature-row:first-child {
  border-top: 0;
}

.feature-name {
  overflow: hidden;
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 7px;
  overflow: hidden;
  border-radius: 99px;
  background: #efeee9;
}

.bar-fill {
  height: 100%;
  min-width: 0;
  border-radius: inherit;
  background: var(--product-color, var(--accent));
}

.feature-value {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  text-align: right;
}

.data-table-wrap {
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.data-table td.numeric,
.data-table th.numeric {
  font-family: var(--mono);
  text-align: right;
}

.event-name {
  font-family: var(--mono);
  font-size: 10px;
}

.repository-list {
  padding: 0 22px 18px;
}

.repository-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) repeat(3, minmax(70px, 0.6fr));
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.repository-row:first-child {
  border-top: 0;
}

.repository-name {
  min-width: 0;
}

.repository-name strong,
.repository-name small {
  display: block;
}

.repository-name strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.repository-name small {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.repository-stat span,
.repository-stat strong {
  display: block;
}

.repository-stat span {
  color: var(--muted);
  font-size: 9px;
}

.repository-stat strong {
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 10px;
}

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

.source-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.source-card__header {
  display: flex;
  align-items: center;
  gap: 11px;
}

.source-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.source-card h3 {
  margin: 0;
}

.source-state {
  margin-left: auto;
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 9px;
  font-weight: 700;
}

.source-state--detected {
  background: var(--orange-soft);
  color: var(--orange);
}

.source-card p {
  min-height: 34px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.integration-panel {
  margin-top: 16px;
}

.integration-content {
  padding: 5px 22px 22px;
}

.integration-content p {
  color: var(--muted);
  font-size: 12px;
}

.code-block {
  position: relative;
  margin-top: 14px;
  padding: 18px 56px 18px 18px;
  overflow: auto;
  border-radius: 13px;
  background: #1c1f1b;
  color: #dfe5da;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.7;
  white-space: pre;
}

.copy-button {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #ccd2c7;
  font-size: 9px;
}

.notice {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid #f0d4b4;
  border-radius: 13px;
  background: #fff7ed;
  color: #855018;
  font-size: 11px;
}

.notice strong {
  display: block;
  margin-bottom: 2px;
}

.empty-state {
  padding: 35px 22px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 5px;
  color: var(--ink);
}

.loading-state {
  padding-top: 10px;
}

.loading-line,
.loading-card,
.loading-panel {
  overflow: hidden;
  border-radius: 13px;
  background:
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent),
    #e8e6df;
  background-size: 180% 100%;
  animation: shimmer 1.4s infinite linear;
}

.loading-line {
  width: 260px;
  height: 34px;
  margin-bottom: 30px;
}

.loading-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.loading-card {
  height: 140px;
}

.loading-panel {
  height: 330px;
  margin-top: 16px;
}

@keyframes shimmer {
  to {
    background-position: -180% 0;
  }
}

.error-page {
  display: grid;
  place-items: center;
  min-height: 60vh;
  text-align: center;
}

.error-page__card {
  max-width: 520px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.error-page p {
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  max-width: 360px;
  padding: 12px 15px;
  border-radius: 11px;
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

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

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

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

  .sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-102%);
    width: 260px;
    transition: transform 180ms ease;
  }

  body.menu-open .sidebar {
    transform: translateX(0);
    box-shadow: 20px 0 55px rgba(0, 0, 0, 0.2);
  }

  .menu-toggle {
    display: block;
  }

  .topbar {
    padding: 0 20px;
  }

  .content {
    padding: 28px 20px 50px;
  }

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

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .heading-meta {
    margin-left: 0;
  }
}

@media (max-width: 620px) {
  .topbar {
    min-height: 64px;
  }

  .freshness,
  .range-control > span,
  .button--ghost {
    display: none;
  }

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

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

  .product-card {
    min-height: 230px;
  }

  .repository-row {
    grid-template-columns: 1fr 1fr;
  }

  .repository-name {
    grid-column: 1 / -1;
  }

  .feature-row {
    grid-template-columns: minmax(95px, 0.8fr) minmax(95px, 1.2fr) 58px;
  }

  .data-table th,
  .data-table td {
    padding-right: 14px;
    padding-left: 14px;
  }
}

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