:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-2: #f9fbff;
  --text: #18202a;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #2563eb;
  --primary-soft: #dbeafe;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  min-height: 100vh;
  padding: 24px;
}

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

.sidebar {
  padding: 20px;
  position: sticky;
  top: 24px;
  height: calc(100vh - 48px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sidebar-header h1 {
  font-size: 24px;
  margin: 0;
}

.sidebar-header p,
.muted {
  color: var(--muted);
  margin: 6px 0 0;
}

.field-block {
  margin-top: 18px;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
}

.search-box {
  margin: 18px 0 14px;
}

.search-box input,
.api-base-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 14px;
  outline: none;
}

.search-box input:focus,
.api-base-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.actions {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s ease;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  filter: brightness(1.05);
}

.btn-secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

.btn-secondary:hover {
  background: var(--panel-2);
}

.events-list {
  overflow: auto;
  padding-right: 4px;
  padding-top: 10px;
  flex: 1;
}

.event-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: #fff;
  margin-bottom: 10px;
  cursor: pointer;
  transition: 0.2s ease;
}

.event-item:hover {
  transform: translateY(-1px);
  background: var(--panel-2);
}

.event-item.active {
  border-color: var(--primary);
  background: #eff6ff;
}

.event-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 6px;
}

.event-meta,
.event-description {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.content {
  display: grid;
  gap: 20px;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.status {
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 14px;
  border: 1px solid var(--line);
  background: #fff;
}

.status.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

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

.stat-card {
  padding: 20px;
}

.stat-label {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 10px;
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 8px;
}

.stat-subtext {
  color: var(--muted);
  font-size: 14px;
}

.charts {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
}

.chart-card,
.zones-card,
.api-card {
  padding: 20px;
}

.section-title {
  margin: 0 0 6px;
  font-size: 20px;
}

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

.chart-wrap {
  position: relative;
  height: 360px;
}

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

.zone-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: var(--panel-2);
}

.zone-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.zone-name {
  font-weight: 700;
  margin-bottom: 4px;
}

.zone-id {
  color: var(--muted);
  font-size: 12px;
}

.badge {
  min-width: 44px;
  text-align: center;
  background: #e5edff;
  color: #1d4ed8;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}

.progress {
  margin: 10px 0 8px;
  height: 10px;
  width: 100%;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #60a5fa);
  border-radius: 999px;
}

.zone-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.code-block {
  margin-top: 12px;
  background: #111827;
  color: #e5e7eb;
  border-radius: 14px;
  padding: 14px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.empty {
  padding: 30px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  text-align: center;
  color: var(--muted);
  background: var(--panel-2);
}

.spaced-block {
  margin-top: 16px;
}

.footer-note {
  color: var(--muted);
  font-size: 13px;
  margin-top: 10px;
}

@media (max-width: 1200px) {
  .charts,
  .zones-grid {
    grid-template-columns: 1fr 1fr;
  }
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .stats,
  .charts,
  .zones-grid,
  .toolbar {
    grid-template-columns: 1fr;
  }
}
