:root {
  color-scheme: light;
  --surface-1: #fcfcfb;
  --page: #f9f9f7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --gridline: #e1e0d9;
  --baseline: #c3c2b7;
  --series-1: #2a78d6;
  --good: #0ca30c;
  --critical: #d03b3b;
  --border: rgba(11, 11, 11, 0.1);
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --surface-1: #1a1a19;
    --page: #0d0d0d;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --gridline: #2c2c2a;
    --baseline: #383835;
    --series-1: #3987e5;
    --good: #0ca30c;
    --critical: #e66767;
    --border: rgba(255, 255, 255, 0.1);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1: #1a1a19;
  --page: #0d0d0d;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --gridline: #2c2c2a;
  --baseline: #383835;
  --series-1: #3987e5;
  --good: #0ca30c;
  --critical: #e66767;
  --border: rgba(255, 255, 255, 0.1);
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
  color: var(--text-primary);
  background: var(--page);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem 0 1rem;
}
.topbar h1 {
  font-size: 1.3rem;
  margin: 0;
}

.tabs {
  display: flex;
  gap: 0.5rem;
}
.tab-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.tab-btn.active {
  background: var(--series-1);
  color: white;
  border-color: var(--series-1);
}

.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}

.hint {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.stat-tile {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.stat-value {
  font-size: 1.4rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.stat-value.good {
  color: var(--good);
}
.stat-value.critical {
  color: var(--critical);
}

.panel-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
@media (max-width: 640px) {
  .panel-row {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}
.panel h2 {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0 0 0.75rem 0;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.bar-row {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}
.bar-row .bar-label {
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-track {
  background: var(--gridline);
  border-radius: 4px;
  height: 10px;
  overflow: hidden;
}
.bar-fill {
  background: var(--series-1);
  height: 100%;
  border-radius: 4px;
}
.bar-value {
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
}

.list-row {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--gridline);
  font-size: 0.88rem;
}
.list-row:last-child {
  border-bottom: none;
}
.list-row .titulo {
  color: var(--text-primary);
}
.list-row .meta {
  color: var(--text-muted);
  font-size: 0.78rem;
}

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

.item .texto {
  margin: 0 0 0.75rem 0;
  white-space: pre-wrap;
}

.item .campos {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.item select,
.item input {
  padding: 0.35rem;
  font-size: 0.9rem;
}

.item button {
  padding: 0.4rem 1rem;
  cursor: pointer;
}

.empty {
  color: var(--text-muted);
}

#status .ok {
  color: var(--good);
}

#status .error {
  color: var(--critical);
}
