:root {
  color-scheme: dark;
  --bg: #030406;
  --panel: #0d1117;
  --panel-2: #111821;
  --ink: #eef6ff;
  --muted: #8fa0b4;
  --line: #223044;
  --green: #24d18b;
  --amber: #ffb84d;
  --red: #ff5d6c;
  --blue: #5aa7ff;
  --violet: #b58cff;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at 50% -20%, rgba(41, 106, 255, 0.16), transparent 34%), var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.shell {
  width: min(1240px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 42px;
}

.topbar,
.panel-heading,
.metrics-strip,
.layout,
.grid,
.toggles,
.item-top,
.bars {
  display: grid;
  gap: 12px;
}

.topbar {
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-bottom: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.1;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

.topbar p,
.metric-label,
.badge,
label span,
.form-note,
.item-meta,
.item-note,
.axis-label,
.topic-meta {
  color: var(--muted);
}

.icon-button,
.primary,
.secondary,
.interval-tab,
.topic-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.icon-button {
  width: 44px;
  height: 44px;
  background: var(--panel);
  color: var(--ink);
  font-size: 22px;
}

.metrics-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.metric,
.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015)), var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 16px;
}

.metric-value {
  display: block;
  font-size: 28px;
  font-weight: 700;
}

.metric.attention .metric-value {
  color: var(--red);
}

.metric.rising .metric-value {
  color: var(--amber);
}

.panel {
  padding: 18px;
}

.panel-heading {
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-bottom: 14px;
}

.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  white-space: nowrap;
}

.chart-panel {
  margin-bottom: 16px;
}

.chart-stage {
  position: relative;
  height: 330px;
  overflow: hidden;
  border: 1px solid #1c2a3e;
  border-radius: 8px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    #070a0f;
  background-size: 100% 64px, 120px 100%;
}

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

.chart-line {
  fill: none;
  stroke: var(--green);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 10px rgba(36, 209, 139, 0.45));
}

.chart-area {
  fill: rgba(36, 209, 139, 0.1);
}

.chart-axis {
  stroke: #314156;
  stroke-width: 2;
}

.chart-grid {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
}

.chart-point {
  fill: #07100d;
  stroke: var(--green);
  stroke-width: 5;
}

.chart-point.hot {
  stroke: var(--red);
  filter: drop-shadow(0 0 12px rgba(255, 93, 108, 0.65));
}

.chart-point.rising {
  stroke: var(--amber);
  filter: drop-shadow(0 0 10px rgba(255, 184, 77, 0.55));
}

.chart-text {
  fill: var(--muted);
  font-size: 24px;
}

.chart-score {
  fill: var(--ink);
  font-size: 22px;
  font-weight: 700;
}

.bubble-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.chart-bubble {
  position: absolute;
  width: min(180px, 25vw);
  transform: translate(-50%, -100%);
  padding: 8px 10px;
  border: 1px solid rgba(36, 209, 139, 0.45);
  border-radius: 8px;
  background: rgba(7, 12, 18, 0.9);
  color: var(--ink);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.36);
  pointer-events: auto;
}

.chart-bubble a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}

.chart-bubble a:hover {
  color: var(--green);
}

.chart-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 12px;
  height: 12px;
  transform: translateX(-50%) rotate(45deg);
  border-right: 1px solid rgba(36, 209, 139, 0.45);
  border-bottom: 1px solid rgba(36, 209, 139, 0.45);
  background: rgba(7, 12, 18, 0.9);
}

.bubble-score {
  display: block;
  margin-top: 4px;
  color: var(--green);
  font-size: 12px;
}

.interval-tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.interval-tab {
  min-height: 38px;
  background: var(--panel-2);
  color: var(--muted);
}

.interval-tab.active {
  border-color: var(--green);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(36, 209, 139, 0.28);
}

.topic-picker {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.topic-button {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  background: #0a0f16;
  color: var(--ink);
  text-align: left;
}

.topic-button:hover {
  border-color: var(--green);
}

.topic-meta {
  font-size: 12px;
  white-space: nowrap;
}

.layout {
  grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.4fr);
  align-items: start;
}

form {
  display: grid;
  gap: 13px;
}

label {
  display: grid;
  gap: 6px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: #070b11;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid rgba(36, 209, 139, 0.16);
  border-color: var(--green);
}

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

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

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

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #070b11;
}

.check input {
  width: 18px;
  height: 18px;
}

.primary {
  min-height: 44px;
  background: var(--green);
  color: #03100a;
  border-color: var(--green);
  font-weight: 800;
}

.secondary {
  min-height: 42px;
  padding: 0 14px;
  background: var(--panel-2);
  color: var(--ink);
  white-space: nowrap;
}

.secondary:hover {
  border-color: var(--green);
  color: var(--green);
}

.input-action {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.form-note {
  min-height: 20px;
}

.radar-panel {
  min-height: 480px;
}

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

.empty {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #080d13;
}

.item-top {
  grid-template-columns: auto 1fr auto;
  align-items: center;
}

.status {
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
  color: #061019;
  white-space: nowrap;
}

.status.normal {
  background: #8fa0b4;
}

.status.warm {
  background: var(--blue);
}

.status.rising {
  background: var(--amber);
}

.status.hot {
  background: var(--red);
}

.item-title {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.item-title a {
  color: var(--ink);
  text-decoration: none;
}

.item-title a:hover {
  color: var(--green);
}

.item-metric {
  font-weight: 700;
}

.item-meta,
.item-note {
  margin-top: 8px;
  line-height: 1.45;
}

.compact {
  margin-top: 16px;
}

.bar-row {
  display: grid;
  grid-template-columns: 90px 1fr 44px;
  gap: 10px;
  align-items: center;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: #111923;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  min-width: 2px;
  background: linear-gradient(90deg, var(--green), var(--blue));
}

@media (max-width: 900px) {
  .shell {
    width: min(100vw - 20px, 760px);
    padding-top: 16px;
  }

  .metrics-strip,
  .layout,
  .grid.four {
    grid-template-columns: 1fr 1fr;
  }

  .layout,
  .grid.two,
  .input-action,
  .toggles {
    grid-template-columns: 1fr;
  }

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

  .chart-bubble {
    width: min(150px, 34vw);
    font-size: 12px;
  }

  .item-top {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 540px) {
  .metrics-strip,
  .grid.four,
  .interval-tabs {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 26px;
  }

  .chart-stage {
    height: 390px;
  }
}
