:root {
  color-scheme: light;
  --surface-1: #fcfcfb;
  --page: #f9f9f7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);

  --series-1: #2a78d6; /* blue */
  --series-2: #eb6834; /* orange */
  --series-3: #1baf7a; /* aqua */
  --series-4: #eda100; /* yellow */
  --series-5: #e87ba4; /* magenta */

  --good: #0ca30c;
  --warning: #fab219;
  --critical: #d03b3b;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-1: #1a1a19;
    --page: #0d0d0d;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --grid: #2c2c2a;
    --baseline: #383835;
    --border: rgba(255, 255, 255, 0.10);

    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;

    --good: #0ca30c;
    --warning: #fab219;
    --critical: #e66767;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
}

.topbar .brand { font-weight: 700; font-size: 1.1rem; }

.topbar nav a {
  color: var(--text-secondary);
  text-decoration: none;
  margin-left: 18px;
  font-size: 0.92rem;
}
.topbar nav a:hover { color: var(--text-primary); }

.container { max-width: 1100px; margin: 0 auto; padding: 24px; }

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}

h1 { font-size: 1.4rem; margin: 0 0 6px; }
h2 { font-size: 1.1rem; margin: 0 0 14px; color: var(--text-secondary); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
table caption { text-align: left; color: var(--text-secondary); margin-bottom: 8px; }
th, td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--grid);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
th:first-child, td:first-child, th:nth-child(2), td:nth-child(2) { text-align: left; }
th {
  color: var(--text-secondary);
  font-weight: 600;
  border-bottom: 1px solid var(--baseline);
}
tfoot td, tr.total td {
  font-weight: 700;
  border-top: 2px solid var(--baseline);
  border-bottom: none;
}
.table-wrap { overflow-x: auto; }

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.menu-grid a {
  display: block;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  color: var(--text-primary);
  text-decoration: none;
}
.menu-grid a:hover { border-color: var(--series-1); }
.menu-grid .titulo { font-weight: 700; margin-bottom: 4px; }
.menu-grid .desc { color: var(--text-secondary); font-size: 0.88rem; }

.banner {
  background: #fff8e6;
  color: #6b4e00;
  border: 1px solid var(--warning);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 0.88rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .banner { background: #2a2200; color: #fab219; }
}

.meta-actualizacion {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-bottom: 16px;
}

form.login-form {
  max-width: 360px;
  margin: 80px auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
form.login-form input {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
  font-size: 1rem;
}
button, .btn {
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  background: var(--series-1);
  color: white;
  font-size: 0.95rem;
  cursor: pointer;
}
.flash { color: var(--critical); margin-bottom: 10px; font-size: 0.9rem; }

.filtros { margin-bottom: 16px; }
.filtros select {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
}

.legend-inline {
  display: flex;
  gap: 16px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 8px;
  flex-wrap: wrap;
}
.legend-inline span.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: middle;
}
