:root {
  --ink: #172033;
  --blue: #2d68a6;
  --blue-dark: #245688;
  --muted: #5b6472;
  --soft: #8a919c;
  --line: #e7e9ed;
  --bg: #ffffff;
  --bg-soft: #f6f8fb;
  --code-bg: #0f172a;
  --code-ink: #e2e8f0;
  --ok: #2f8f5b;
  --warn: #b7791f;
  --bad: #c0392b;
  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* Header */
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.logo {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.18em;
}
.logo:hover { text-decoration: none; }
.logo-a { color: var(--ink); }
.logo-b { color: var(--blue); }
.logo-c { color: var(--soft); font-weight: 600; }

.top-link {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

/* Hero */
.hero { padding: 56px 0 32px; }

.hero h1 {
  font-size: clamp(36px, 6vw, 56px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.hero h2 {
  font-size: clamp(26px, 4.4vw, 42px);
  font-weight: 500;
  font-style: italic;
  color: var(--blue);
  letter-spacing: -0.025em;
  line-height: 1.12;
  margin-top: 4px;
}

.lead {
  max-width: 580px;
  color: var(--muted);
  margin-top: 22px;
  font-size: 15.5px;
}

.meta {
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--soft);
}

/* Buttons */
.btn {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: 3px;
  padding: 10px 16px;
  cursor: pointer;
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #fff;
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.btn:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn.is-open { background: #fff; color: var(--blue); }
.btn-ghost { background: #fff; color: var(--blue); }
.btn-ghost:hover { background: var(--bg-soft); color: var(--blue-dark); }

.btn-sm {
  padding: 7px 11px;
  font-size: 10px;
  letter-spacing: 0.11em;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Checkbox de comparación */
.compare-check-label {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 4px;
}
.compare-check {
  width: 17px;
  height: 17px;
  cursor: pointer;
  accent-color: var(--blue);
  border-radius: 3px;
}

/* Controls */
.controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 0 12px;
}

.controls input,
.controls select {
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 11px 12px;
  outline: none;
}
.controls input:focus,
.controls select:focus { border-color: var(--blue); }

.selects {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.count {
  font-size: 12.5px;
  color: var(--soft);
  padding: 6px 0 10px;
}

/* List */
.list { list-style: none; border-top: 1px solid var(--line); }

.row {
  border-bottom: 1px solid var(--line);
}

.row.is-selected {
  background: rgba(45, 104, 166, 0.03);
}

.row-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
}

.row-main { flex: 1; min-width: 0; }

.row-name {
  font-weight: 600;
  font-size: 15px;
}

.row-sub {
  font-size: 12.5px;
  color: var(--soft);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 2px;
}

.row-sub code {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
}

.tag {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--blue);
}
.tag.indec { color: #7a4fa0; }

/* Detail panel */
.detail {
  padding: 6px 0 24px;
}

.detail-desc {
  color: var(--muted);
  font-size: 14.5px;
  max-width: 720px;
  margin-bottom: 18px;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 18px;
}

.fact {
  background: var(--bg-soft);
  padding: 10px 12px;
}

.fact-k {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--soft);
}

.fact-v {
  font-size: 14.5px;
  font-weight: 600;
  margin-top: 2px;
  word-break: break-word;
}

.fresh-vigente { color: var(--ok); }
.fresh-demorado { color: var(--warn); }
.fresh-vencido { color: var(--bad); }

/* Subtabs inside detail */
.detail-nav {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  padding-bottom: 8px;
}

.subtab-btn {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid transparent;
  padding: 6px 12px;
  color: var(--soft);
  cursor: pointer;
  border-radius: 3px;
  transition: all .15s;
}
.subtab-btn:hover {
  color: var(--ink);
  background: var(--bg-soft);
}
.subtab-btn.active {
  color: var(--blue);
  background: rgba(45, 104, 166, 0.08);
  border-color: rgba(45, 104, 166, 0.2);
}

.subtab-pane {
  display: none;
}
.subtab-pane.active {
  display: block;
}

/* Tables */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 3px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--soft);
  background: var(--bg-soft);
}

tr:last-child td { border-bottom: none; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
th.num { text-align: right; }

/* Chart View */
.chart-box {
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 16px 16px 12px;
  background: #ffffff;
}

.chart-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin-bottom: 14px;
  font-size: 12.5px;
  color: var(--muted);
}
.chart-stats strong {
  color: var(--ink);
  font-weight: 700;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.chart-svg-wrap {
  width: 100%;
  position: relative;
  overflow: hidden;
}
.chart-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--ink);
  color: #fff;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 11.5px;
  font-family: var(--mono);
  white-space: nowrap;
  transform: translate(-50%, -120%);
  display: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 10;
  line-height: 1.4;
}

/* Python Endpoint View */
.python-box {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.endpoint-badge-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
}

.http-method {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  background: #e0f2fe;
  color: #0369a1;
  padding: 2px 7px;
  border-radius: 3px;
}

.endpoint-url {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 3px;
  color: var(--ink);
  word-break: break-all;
}

.code-wrap {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--code-bg);
  overflow: hidden;
}

.code-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: #1e293b;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 11.5px;
  color: #94a3b8;
  font-family: var(--mono);
}

.copy-btn {
  font-family: var(--font);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #e2e8f0;
  padding: 4px 9px;
  border-radius: 2px;
  cursor: pointer;
  transition: all .15s;
}
.copy-btn:hover {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.copy-btn.copied {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
}

pre.code-pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--code-ink);
}

.python-note {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.5;
}

.detail-foot {
  font-size: 12px;
  color: var(--soft);
  margin-top: 14px;
}
.detail-foot code { font-family: var(--mono); font-size: 11.5px; }

.loading, .error {
  font-size: 13.5px;
  padding: 10px 0 20px;
}
.loading { color: var(--soft); }
.error { color: var(--bad); }

.more-wrap { text-align: center; padding: 24px 0; }

.foot {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  margin-top: 24px;
  font-size: 12.5px;
  color: var(--soft);
}

/* ==========================================================================
   COMPARACIÓN MULTI-SERIE (FLOATING DOCK & MODAL)
   ========================================================================== */
.compare-dock {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 880px;
  background: #ffffff;
  border: 1px solid var(--blue);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  border-radius: 6px;
  padding: 12px 18px;
  z-index: 100;
  animation: slideUp .2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { transform: translate(-50%, 40px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.compare-dock-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.compare-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}

.compare-badge {
  background: var(--blue);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.compare-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.compare-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.compare-tag {
  font-size: 11.5px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 3px 8px;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.compare-tag-remove {
  background: transparent;
  border: none;
  color: var(--soft);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 0 2px;
}
.compare-tag-remove:hover { color: var(--bad); }

.compare-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Modal Multi-serie */
.compare-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.compare-modal-card {
  background: #ffffff;
  border-radius: 6px;
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
}

.compare-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 5;
}

.compare-modal-head h3 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.compare-modal-body {
  padding: 20px 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.compare-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.scale-toggle {
  display: inline-flex;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 2px;
}

.scale-btn {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: transparent;
  border: none;
  padding: 5px 12px;
  border-radius: 2px;
  color: var(--soft);
  cursor: pointer;
  transition: all .15s;
}
.scale-btn.active {
  background: #fff;
  color: var(--blue);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

@media (max-width: 680px) {
  .selects { grid-template-columns: 1fr; }
  .row-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .row-actions { width: 100%; justify-content: flex-start; }
  .hero { padding-top: 36px; }
  .compare-dock { bottom: 10px; width: calc(100% - 20px); padding: 10px 14px; }
}
