:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface-hover: #243044;
  --border: #2d3a4d;
  --text: #e7ecf3;
  --muted: #8b9cb3;
  --accent: #3d9cf5;
  --accent-dim: #2a6fa8;
  --positive: #5bd082;
  --negative: #f07178;
  --warning: #e6b84d;
  --radius: 12px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.header {
  margin-bottom: 1.5rem;
}

.header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.75rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.tagline code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--surface);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.config-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1 1 220px;
  min-width: 0;
}

.field-narrow {
  flex: 0 0 120px;
}

.label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

input[type="url"],
input[type="text"] {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
}

input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.btn {
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-hover);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent-dim);
  color: #fff;
}

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

.hint {
  margin: 0.75rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.hint code {
  font-family: var(--mono);
  font-size: 0.85em;
}

.status-bar {
  min-height: 1.5rem;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.status-bar.error {
  color: var(--negative);
}

.status-bar.ok {
  color: var(--muted);
}

.section-title {
  margin: 0.25rem 0 0.6rem;
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 650;
  letter-spacing: 0.02em;
}

.dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.35rem;
}

.chart-section {
  margin-bottom: 1.35rem;
}

.chart-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem 0.75rem;
}

#rollup-chart {
  display: block;
  width: 100%;
  height: 300px;
  max-height: 320px;
}

.chart-status {
  margin: 0.65rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.chart-status.error {
  color: var(--negative);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1rem 0.85rem;
  position: relative;
  overflow: hidden;
}

.card-title {
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.card-value {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  letter-spacing: -0.02em;
}

.card-value--text {
  font-size: 1.1rem;
  font-weight: 600;
}

.card-value.positive {
  color: var(--positive);
}

.card-value.negative {
  color: var(--negative);
}

.card-unit {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.card-sub {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.card-soc .card-value {
  margin-bottom: 0.5rem;
}

.soc-bar {
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  margin-top: 0.5rem;
  overflow: hidden;
}

.soc-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  border-radius: 3px;
  transition: width 0.4s ease;
}

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

.empty-state p {
  margin: 0;
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
}
