:root {
  --bg: #eef2ff;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --primary: #2563eb;
  --border: #e5e7eb;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "PingFang SC", "Noto Sans SC", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 0%, #dbeafe 0%, transparent 34%),
    radial-gradient(circle at 90% 10%, #e0e7ff 0%, transparent 33%),
    linear-gradient(180deg, #f8fafc 0%, var(--bg) 55%);
}
.container {
  max-width: 1520px;
  margin: 24px auto;
  padding: 0 16px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.04);
}
.nav {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}
.nav a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}
.muted { color: var(--muted); }
.btn {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 6px 12px;
  cursor: pointer;
  font-weight: 600;
}
.btn:hover {
  border-color: #93c5fd;
  color: #1d4ed8;
}
input, select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  min-width: 90px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  border-bottom: 1px solid var(--border);
  padding: 8px;
  text-align: left;
  vertical-align: top;
}
th {
  background: #f8fafc;
  font-weight: 700;
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 1000px) {
  .grid-2 { grid-template-columns: 1fr; }
}
.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  background: #ecfeff;
  border: 1px solid #99f6e4;
}
.pre {
  max-width: 620px;
  white-space: pre-wrap;
  word-break: break-word;
}
.chart {
  width: 100%;
  height: 320px;
}
.header-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.window-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.overview-item {
  border: 1px solid #dbeafe;
  border-radius: 10px;
  padding: 8px 10px;
  background: linear-gradient(180deg, #ffffff 0%, #eff6ff 100%);
}
.overview-item span {
  display: block;
  color: #475569;
  font-size: 12px;
}
.overview-item b {
  display: block;
  margin-top: 4px;
  color: #0f172a;
  font-size: 18px;
}
.pager {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}
.usage-progress {
  width: 130px;
  height: 10px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}
.usage-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #22c55e, #f59e0b, #ef4444);
}
.countdown-wrap {
  min-width: 130px;
}
.countdown-text {
  font-size: 12px;
  color: #334155;
  margin-bottom: 4px;
  white-space: nowrap;
}
.countdown-progress {
  width: 130px;
  height: 8px;
  border-radius: 999px;
  background: #dbeafe;
  overflow: hidden;
}
.countdown-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2563eb, #10b981);
}

.active-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #166534;
  font-weight: 700;
}

.layer-board {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.layer-block {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.layer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.layer-title {
  font-size: 16px;
  font-weight: 700;
}

.layer-stats {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  color: #334155;
}

.layer-rate {
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 700;
}

.layer-rate.good {
  background: #dcfce7;
  color: #166534;
}

.layer-rate.warn {
  background: #fef3c7;
  color: #92400e;
}

.layer-rate.bad {
  background: #fee2e2;
  color: #991b1b;
}

.channel-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
}

.channel-card {
  border: 1px solid #dbe3ee;
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}

.channel-card.disabled {
  opacity: 0.72;
}

.channel-card.auto-disabled {
  border: 1px solid #fca5a5;
  background: linear-gradient(180deg, #fff7f7 0%, #ffecec 100%);
  box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.2);
}

.channel-card.muted-disabled {
  opacity: 0.52;
  filter: grayscale(0.88);
  border-style: dashed;
  background: #f8fafc;
}

.channel-card-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.status-dot.enabled {
  background: #16a34a;
}

.status-dot.disabled {
  background: #ef4444;
}

.status-dot.auto-disabled {
  background: #dc2626;
}

.status-dot.muted-disabled {
  background: #94a3b8;
}

.status-label {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
}

.status-label.enabled {
  background: #dcfce7;
  color: #166534;
}

.status-label.auto-disabled {
  background: #fee2e2;
  color: #991b1b;
}

.status-label.muted-disabled {
  background: #f1f5f9;
  color: #475569;
}

.channel-alert {
  margin-bottom: 8px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 6px 8px;
  background: #fff1f2;
  color: #991b1b;
  font-size: 12px;
  font-weight: 700;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  margin-bottom: 8px;
}

.config-grid .k {
  color: #64748b;
  margin-right: 6px;
}

.config-grid .v {
  color: #0f172a;
  font-weight: 600;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #334155;
  margin-bottom: 6px;
}

.stack-bar {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: #e2e8f0;
  display: flex;
}

.stack-seg {
  height: 100%;
}

.seg-success {
  background: linear-gradient(90deg, #22c55e, #06b6d4);
}

.seg-429 {
  background: linear-gradient(90deg, #f59e0b, #f97316);
}

.seg-4xx {
  background: linear-gradient(90deg, #fb7185, #ef4444);
}

.seg-5xx {
  background: linear-gradient(90deg, #dc2626, #991b1b);
}

.seg-unknown {
  background: #64748b;
}

.stack-empty {
  width: 100%;
  text-align: center;
  color: #64748b;
  font-size: 11px;
  line-height: 14px;
}

.legend-row {
  margin-top: 6px;
  color: #64748b;
  font-size: 12px;
}

.flow-arrow {
  margin-top: 8px;
  text-align: center;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
}

.public-result-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.public-meta {
  font-size: 12px;
  color: #8c8c8c;
  text-align: right;
}

.public-table th,
.public-table td {
  border-bottom: 1px solid #f0f0f0;
  padding: 12px 10px;
}

.combo-cell {
  min-width: 220px;
}

.combo-text {
  font-size: 13px;
  color: #1f2937;
  margin-bottom: 6px;
}

.public-progress {
  width: 220px;
  height: 8px;
  background: #f5f5f5;
  border-radius: 999px;
  overflow: hidden;
}

.public-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: #1677ff;
}

.public-progress-fill.warn {
  background: #fa8c16;
}

.public-progress-fill.danger {
  background: #ff4d4f;
}

.public-thin-progress {
  width: 180px;
  height: 4px;
  background: #f0f0f0;
  border-radius: 999px;
  overflow: hidden;
}

.public-thin-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: #1677ff;
}

.status-tag {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
}

.status-tag.active {
  background: #dcfce7;
  color: #15803d;
}

.status-tag.expired {
  background: #fef3c7;
  color: #b45309;
}

.status-tag.cancelled {
  background: #f3f4f6;
  color: #4b5563;
}

.status-tag.unknown {
  background: #eef2ff;
  color: #3730a3;
}
