:root {
  color-scheme: light;
  font-family: "IBM Plex Sans", "Noto Sans SC", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #f6f6f2;
  --panel: #ffffff;
  --panel-soft: #f0f1ed;
  --ink: #151612;
  --muted: #72756c;
  --line: #dedfd7;
  --accent: #0f7b5f;
  --accent-ink: #ffffff;
  --danger: #b4473d;
  --radius: 8px;
  --shadow: 0 18px 48px rgba(20, 24, 18, .08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(15, 123, 95, .08), transparent 28%),
    linear-gradient(180deg, #fbfbf7, var(--bg));
  color: var(--ink);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 999px;
  min-height: 38px;
  padding: 0 16px;
  background: var(--ink);
  color: white;
  cursor: pointer;
  transition: transform .12s ease, opacity .12s ease, background .12s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: .5;
  transform: none;
}

button.secondary {
  background: var(--panel-soft);
  color: var(--ink);
}

button.accent {
  background: var(--accent);
  color: var(--accent-ink);
}

button.danger {
  background: rgba(180, 71, 61, .1);
  color: var(--danger);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  min-height: 40px;
  padding: 10px 12px;
  outline: none;
}

.compact-select {
  width: auto;
  min-width: 132px;
}

textarea {
  min-height: 84px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--line));
  box-shadow: 0 0 0 3px rgba(15, 123, 95, .12);
}

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

aside {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, .74);
  backdrop-filter: blur(24px);
}

main {
  padding: 28px;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 28px;
}

.brand h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

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

.status-dot.ok {
  background: var(--accent);
}

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

.overview-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(160deg, rgba(15, 123, 95, .12), rgba(255, 255, 255, .9) 42%),
    var(--panel);
  box-shadow: var(--shadow);
}

.overview-card h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.05;
}

.overview-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.overview-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.overview-stats div,
.stat-chip {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .72);
  border: 1px solid rgba(0, 0, 0, .06);
}

.overview-stats span,
.stat-chip span {
  font-size: 12px;
  color: var(--muted);
}

.overview-stats strong,
.stat-chip strong {
  font-size: 15px;
}

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

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 24px;
}

.section-title h2,
.section-title h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}

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

.form-grid {
  display: grid;
  gap: 10px;
}

.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

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

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 20px;
}

.hero-main {
  min-height: 260px;
  display: grid;
  align-content: space-between;
  gap: 24px;
  padding: 26px;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .82), rgba(255, 255, 255, .56)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='520' viewBox='0 0 900 520'%3E%3Crect width='900' height='520' fill='%23e8ebe1'/%3E%3Cpath d='M80 390 C220 280 290 310 410 190 C520 82 660 120 820 48 L900 0 L900 520 L0 520 Z' fill='%23d7ddd1'/%3E%3Cpath d='M0 120 C180 150 280 80 440 118 C610 158 700 90 900 130 L900 0 L0 0 Z' fill='%23f7f8f4'/%3E%3C/svg%3E");
  background-size: cover;
  background-position: center;
  border: 1px solid var(--line);
}

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

.hero h2 {
  margin: 0;
  font-size: clamp(30px, 5vw, 58px);
  line-height: 1;
  letter-spacing: 0;
}

.hero-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .72);
  border: 1px solid rgba(0, 0, 0, .08);
  color: var(--ink);
  font-size: 13px;
}

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

.metric {
  min-height: 88px;
  display: grid;
  align-content: space-between;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

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

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

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 22px 0 16px;
}

.tabs button {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

.tabs button.active {
  background: var(--ink);
  border-color: var(--ink);
  color: white;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: grid;
  gap: 16px;
}

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

.detail-panel {
  grid-column: 1 / -1;
}

.detail-card {
  display: grid;
  gap: 14px;
}

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

.detail-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
}

.detail-meta,
.stats-strip,
.data-points,
.forecast-grid {
  display: grid;
  gap: 10px;
}

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

.stats-strip {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.data-points {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.forecast-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.forecast-card {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

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

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

.chart-card {
  display: grid;
  gap: 10px;
  min-height: 220px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.chart-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.chart-title strong {
  font-size: 18px;
}

.chart-box {
  min-height: 160px;
}

.trend-chart {
  display: block;
  width: 100%;
  height: 160px;
}

.trend-axis {
  stroke: rgba(21, 22, 18, .12);
  stroke-width: 1;
}

.trend-area {
  opacity: .16;
}

.trend-line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trend-dot {
  stroke: var(--panel);
  stroke-width: 2;
}

.trend-point {
  outline: none;
}

.trend-hit {
  fill: transparent;
  cursor: crosshair;
}

.trend-hover-line {
  stroke: rgba(21, 22, 18, .26);
  stroke-dasharray: 4 4;
  stroke-width: 1;
  opacity: 0;
  pointer-events: none;
}

.trend-point-dot {
  opacity: 0;
  stroke: var(--panel);
  stroke-width: 2;
  pointer-events: none;
}

.trend-tooltip {
  opacity: 0;
  pointer-events: none;
}

.trend-tooltip-box {
  fill: rgba(21, 22, 18, .92);
  stroke: rgba(255, 255, 255, .2);
}

.trend-tooltip-text {
  fill: #fff;
  font-size: 12px;
  font-weight: 700;
}

.trend-tooltip-text.muted {
  fill: rgba(255, 255, 255, .72);
  font-size: 10px;
  font-weight: 500;
}

.trend-point:hover .trend-hover-line,
.trend-point:focus .trend-hover-line,
.trend-point:hover .trend-point-dot,
.trend-point:focus .trend-point-dot,
.trend-point:hover .trend-tooltip,
.trend-point:focus .trend-tooltip {
  opacity: 1;
}

.trend-label {
  fill: var(--muted);
  font-size: 11px;
}

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

.item {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--panel);
}

.item textarea {
  min-height: 72px;
}

.item-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.item-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

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

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

.mono {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.notice {
  min-height: 38px;
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.notice.error {
  background: rgba(180, 71, 61, .1);
  color: var(--danger);
}

.notice.ok {
  background: rgba(15, 123, 95, .1);
  color: var(--accent);
}

pre {
  margin: 0;
  max-height: 320px;
  overflow: auto;
  border-radius: var(--radius);
  background: #151612;
  color: #f7f7f2;
  padding: 14px;
  font-size: 12px;
  line-height: 1.5;
}

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

.icon-button {
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 50%;
  background: var(--panel-soft);
  color: var(--ink);
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}

.icon-button:hover {
  transform: translateY(-1px);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 16, 12, .35);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 30;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  width: min(720px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display: grid;
  gap: 12px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.modal pre {
  max-height: 60vh;
}

@media (max-width: 980px) {
  .shell,
  .hero,
  .grid {
    grid-template-columns: 1fr;
  }

  aside {
    position: static;
    height: auto;
  }

  main {
    padding: 18px;
  }

  .detail-meta,
  .overview-stats {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 640px) {
  .two,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .hero-main {
    min-height: 220px;
  }
}
