/* MambaPrice 品牌样式 */
:root {
  --bg: #f6f8fa;
  --card: #ffffff;
  --ink: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #0f9d6c;          /* 品牌绿（蟒蛇绿） */
  --accent-soft: #d3f0e2;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 16px rgba(15, 23, 42, 0.05);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

/* 顶栏 */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 24px;
  background: linear-gradient(135deg, #0f172a 0%, #14384b 100%);
  color: #fff;
}
.topbar .logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.15);
}
.topbar h1 { margin: 0; font-size: 22px; letter-spacing: 0.3px; }
.topbar .tagline { margin: 0; font-size: 12px; opacity: 0.75; }

/* 布局 */
.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
}

/* 额度卡 */
.quota-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.quota-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.quota-text { margin-left: auto; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--line);
}
.dot.ok { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dot.danger { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

.progress {
  height: 10px;
  background: #eef2f6;
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.4s ease, background-color 0.4s ease;
}
.progress-fill.warn { background: var(--warn); }
.progress-fill.danger { background: var(--danger); }

/* 警告 */
.warning {
  background: var(--danger-soft);
  border: 1px solid #fca5a5;
  color: #991b1b;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
}
.hidden { display: none !important; }

/* 控制区 */
.controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); }
select {
  font: inherit;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  min-width: 190px;
}
.gran-buttons { display: flex; gap: 8px; }
.gran {
  font: inherit;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
}
.gran:hover { border-color: var(--accent); color: var(--accent); }
.gran.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.gran:disabled, select:disabled { opacity: 0.5; cursor: not-allowed; }
.hint { flex-basis: 100%; font-size: 12px; color: var(--muted); margin: 0; }

/* 图表 */
.chart-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.chart-head h2 { margin: 0; font-size: 16px; }
.unit { font-size: 12px; color: var(--muted); }
.chart { width: 100%; overflow: hidden; position: relative; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis-text { fill: var(--muted); font-size: 11px; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .point { fill: var(--accent); stroke: #fff; stroke-width: 1.5; }
.chart .hover-point { fill: #fff; stroke: var(--accent); stroke-width: 2; }

.empty, .chart-error {
  padding: 40px 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.chart-error { color: #991b1b; }

/* 工具提示 */
.tooltip {
  position: absolute;
  pointer-events: none;
  background: #0f172a;
  color: #fff;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  white-space: nowrap;
  transform: translate(-50%, -120%);
  z-index: 10;
}
.tooltip b { color: #6ee7b7; font-variant-numeric: tabular-nums; }

/* 页脚 */
.footer {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 0 16px 28px;
}
.footer a { color: var(--accent); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* 响应式 */
@media (max-width: 640px) {
  .controls { flex-direction: column; align-items: stretch; gap: 12px; }
  .gran-buttons { flex-wrap: wrap; }
}
