:root {
  --bg: #0f172a;
  --bg-panel: #131c34;
  --bg-panel-alt: #182341;
  --text: #f1f5f9;
  --muted: #8892b0;
  --accent: #38bdf8;
  --danger: #fb7185;
  --success: #34d399;
  --warning: #fbbf24;
  --border: rgba(255, 255, 255, 0.08);
  font-family: 'Space Grotesk', 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top left, #1d2a4c, #0b1120 60%);
  color: var(--text);
  padding: 32px clamp(16px, 5vw, 56px);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.hero__logo {
  display: block;
  width: 520px;
  max-width: 100%;
  height: auto;
  margin: 0 0 12px;
}

.hero__content h1 {
  margin: 4px 0 8px;
  font-size: clamp(32px, 4vw, 48px);
}

.hero__eyebrow {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 12px;
  margin: 0;
}

.hero__subtitle {
  max-width: 600px;
  color: var(--muted);
  margin: 0;
}

.hero__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  color: var(--muted);
  white-space: nowrap;
}

.hero__meta span {
  font-size: 13px;
}

#generatedAt {
  font-weight: 600;
}

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

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

#refreshButton {
  background: var(--accent);
  color: #04101f;
  border: none;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
}

.refresh-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.refresh-status {
  color: var(--muted);
  font-size: 12px;
}

#refreshButton.is-busy {
  background: rgba(56, 189, 248, 0.4);
  color: #e0f2fe;
  cursor: wait;
}

#refreshButton:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.filter-form {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
}

.filter-form label {
  display: flex;
  flex-direction: column;
  min-width: 220px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  gap: 8px;
}

.filter-form input {
  min-height: 52px;
  min-width: 220px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 16px;
  color: var(--text);
  font-size: 18px;
}

.filter-form button {
  min-height: 52px;
  background: var(--bg-panel-alt);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 12px 24px;
  font-weight: 600;
  font-size: 17px;
  cursor: pointer;
}

.filter-hint {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.dashboard-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.dashboard-shell {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.dashboard-main {
  min-width: 0;
}

.dashboard-sidebar {
  position: sticky;
  top: 16px;
  align-self: start;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 20px 45px rgba(3, 7, 18, 0.45);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-link {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-link__title {
  font-size: 14px;
}

.sidebar-link__meta {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.sidebar-link:hover {
  border-color: rgba(56, 189, 248, 0.45);
}

.sidebar-link.is-active {
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.65);
  color: #e0f2fe;
  box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.25);
}

.sidebar-link.is-active .sidebar-link__meta {
  color: #bae6fd;
}

.orbit-widget {
  margin-top: 16px;
  border: 1px dashed rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.08);
  border-radius: 14px;
  padding: 12px;
}

.orbit-widget__eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 11px;
  color: #bae6fd;
}

.orbit-widget h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.orbit-widget__copy {
  margin: 0 0 8px;
  color: #cbd5e1;
  font-size: 13px;
}

.orbit-widget__list {
  margin: 0;
  padding-left: 18px;
  color: #cbd5e1;
  font-size: 12px;
}

.orbit-widget__list--tight {
  margin-bottom: 8px;
}

.orbit-widget__status-row {
  display: flex;
  gap: 8px;
  margin: 8px 0;
}

.orbit-pill {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  color: #cbd5e1;
}

.orbit-pill--ok {
  border-color: rgba(52, 211, 153, 0.45);
  color: #6ee7b7;
}

.orbit-pill--warn {
  border-color: rgba(251, 191, 36, 0.45);
  color: #fcd34d;
}

.orbit-pill--error {
  border-color: rgba(248, 113, 113, 0.45);
  color: #fca5a5;
}

.orbit-widget__cta {
  width: 100%;
  margin-top: 10px;
  background: rgba(15, 23, 42, 0.5);
  color: #cbd5e1;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  cursor: pointer;
}

.orbit-widget__cta--ghost {
  margin-top: 0;
  background: transparent;
}

.orbit-chat {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.orbit-chat__identity {
  display: grid;
  gap: 4px;
}

.orbit-chat__label {
  font-size: 11px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.orbit-chat__user,
.orbit-chat__composer textarea {
  width: 100%;
  background: rgba(15, 23, 42, 0.55);
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
}

.orbit-chat__messages {
  min-height: 320px;
  max-height: 560px;
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.42);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.orbit-chat__msg {
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.35;
}

.orbit-chat__msg--user {
  background: rgba(37, 99, 235, 0.22);
  border: 1px solid rgba(59, 130, 246, 0.35);
  align-self: flex-end;
}

.orbit-chat__msg--assistant {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.22);
  align-self: flex-start;
}

.orbit-chat__msg small {
  display: block;
  margin-top: 4px;
  color: #94a3b8;
}

.orbit-stream--typing {
  color: #93c5fd;
  font-style: italic;
}

.orbit-chat__composer {
  display: grid;
  gap: 8px;
}

.orbit-chat__actions {
  display: flex;
  gap: 8px;
}

.orbit-chat__actions .orbit-widget__cta {
  flex: 1;
  margin-top: 0;
}

.view-hero {
  border: 1px solid var(--border);
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.12), rgba(15, 23, 42, 0.15));
  border-radius: 16px;
  padding: 14px 16px;
}

.view-hero__eyebrow {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 11px;
}

.view-hero h2 {
  margin: 4px 0;
  font-size: 24px;
}

.view-hero p {
  margin: 0;
  color: #cbd5e1;
  font-size: 14px;
}

.is-hidden-by-view {
  display: none !important;
}

.panel {
  transition: border-color .2s ease, transform .2s ease;
}

.action-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.action-list li {
  color: var(--text);
  line-height: 1.45;
}

.dashboard-layout > .grid {
  width: 100%;
}


.panel {
  background: var(--bg-panel);
  border-radius: 18px;
  padding: 24px;
  border: 1px solid var(--border);
  box-shadow: 0 20px 45px rgba(3, 7, 18, 0.5);
  display: flex;
  flex-direction: column;
}

.panel--wide {
  grid-column: span 2;
}

.panel--full {
  grid-column: 1 / -1;
}

.panel--triple {
  grid-column: 1 / -1;
}

.panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.panel__meta {
  font-size: 13px;
  color: var(--muted);
  text-align: right;
}

.panel__hint {
  margin: -6px 0 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.panel__notice {
  margin: 0 0 18px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px dashed rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.08);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.panel--historic {
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 25px 45px rgba(2, 6, 23, 0.45);
}

.panel--historic .panel__header h2 {
  color: #e0f2fe;
}

.panel--historic .panel__header .panel__eyebrow {
  color: rgba(224, 242, 254, 0.85);
}

.panel__eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 11px;
  color: var(--muted);
  margin: 0;
}

.badge {
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-panel-alt);
  color: var(--muted);
}

.badge--ok {
  background: rgba(52, 211, 153, 0.18);
  color: var(--success);
}

.badge--alert {
  background: rgba(251, 113, 133, 0.18);
  color: var(--danger);
}

.kpi {
  font-size: 32px;
  font-weight: 600;
}

.metrics {
  display: grid;
  gap: 16px;
}

.metrics--3 {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.metrics--2 {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.metrics--corte {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.panel--corte .metrics--corte {
  margin-top: 18px;
}

.metric-card {
  background: var(--bg-panel-alt);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid var(--border);
}

.metric-card h3 {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.metric-card p {
  margin: 8px 0 0;
  font-size: 22px;
  font-weight: 600;
}

.metric-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.metric-card--timestamp {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.metric-card--timestamp .timestamp-value {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 8px 0 0;
}

.metric-card--timestamp .timestamp-value__date {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: capitalize;
}

.metric-card--timestamp .timestamp-value__time {
  font-size: 15px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}

.metric-card--timestamp .timestamp-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.metric-card--timestamp .timestamp-meta__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}

.resumen__body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.variation {
  font-size: 20px;
  font-weight: 500;
}

.variation--up {
  color: var(--success);
}

.variation--down {
  color: var(--danger);
}

.resumen__channels {
  display: grid;
  gap: 12px;
}

.channel-row {
  display: grid;
  align-items: center;
  gap: 12px;
}

.channel-row--resumen {
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
}

.channel-row--mix {
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr) 64px;
}

.channel-row__label {
  min-width: 0;
}

.channel-row__value {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.channel-row--mix .channel-row__label,
.channel-row--mix .channel-row__value {
  font-weight: 600;
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

.progress {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  height: 10px;
  position: relative;
  overflow: hidden;
}

.progress__fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #6366f1);
}

.mix__bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mix-layout {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mix-participacion {
  background: var(--bg-panel-alt);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-self: stretch;
  max-width: none;
}

.mix-participacion .chart--bridge {
  min-height: 165px;
}

.mix-participacion .bridge-donut {
  width: min(208px, 100%);
}

.mix-participacion .bridge-donut__center strong {
  font-size: 22px;
}

.mix-participacion .bridge-donut__center span {
  font-size: 11px;
}

.mix-participacion .chart-legend {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: 6px;
}

.mix-participacion .legend-item {
  font-size: 10.5px;
  padding: 4px 7px;
  white-space: nowrap;
}

.chart {
  min-height: 220px;
  position: relative;
}

.panel--bridge {
  padding-bottom: 20px;
}

.bridge-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

.bridge-row--single {
  grid-template-columns: minmax(0, 1fr);
}

.bridge-card {
  background: var(--bg-panel-alt);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: 360px;
}

.bridge-card__header h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.chart--bridge {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 230px;
}

.bridge-donut-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
}

.bridge-donut {
  width: min(240px, 100%);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: conic-gradient(var(--direct-color, #38bdf8) 0 var(--direct-pct), var(--market-color, #2563eb) var(--direct-pct) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.bridge-donut__center {
  width: 58%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.bridge-donut__center strong {
  font-size: 30px;
  line-height: 1;
}

.bridge-donut__center.is-marketplace strong,
.bridge-donut__center.is-marketplace span {
  color: #93c5fd;
}

.bridge-donut__center.is-directo strong,
.bridge-donut__center.is-directo span {
  color: #67e8f9;
}

.bridge-donut__center span {
  margin-top: 4px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.chart-plot--bridge {
  width: 100%;
  min-height: 230px;
}

.alert-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.alert-item {
  background: rgba(251, 113, 133, 0.08);
  border-left: 4px solid var(--danger);
  padding: 12px 16px;
  border-radius: 12px;
}

.alert-item strong {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
}

.table {
  overflow-x: auto;
}

.table table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.table-filters-row th {
  padding-top: 8px;
  padding-bottom: 8px;
}

.table-filter-input {
  width: 100%;
  min-width: 120px;
  border: 1px solid var(--border);
  background: var(--bg-panel-alt);
  color: var(--text-main);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
}

.table-filter-input::placeholder {
  color: var(--muted);
}

.table--portafolio table {
  font-size: 13px;
  min-width: 960px;
}

.table--portafolio th,
.table--portafolio td {
  padding: 10px 12px;
  vertical-align: middle;
}

.table--portafolio tbody tr:nth-child(odd) {
  background: rgba(255, 255, 255, 0.01);
}

.portafolio-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-weight: 600;
}

.portafolio-label__meta {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.portafolio-article__name {
  font-weight: 600;
}

.portafolio-article__meta {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.portafolio-metric-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.portafolio-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.portafolio-metric__label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.portafolio-metric strong {
  font-size: 14px;
}

@media (max-width: 1100px) {
  .table--portafolio table {
    min-width: 720px;
  }
}

  
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.kpi-card {
  background: var(--bg-panel-alt);
  border-radius: 16px;
  padding: 18px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kpi-card__title {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.kpi-card__value {
  font-size: 30px;
  font-weight: 600;
}

.delta {
  font-size: 14px;
  font-weight: 600;
}

.delta--up {
  color: var(--success);
}

.delta--down {
  color: var(--danger);
}

.kpi-card__detail {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kpi-card__detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}

.snapshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.snapshot-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 16px;
  align-items: stretch;
}

.bridge-card--snapshot-side {
  min-height: 100%;
}

.snapshot-card {
  background: var(--bg-panel-alt);
  border-radius: 18px;
  padding: 18px;
  border: 1px solid var(--border);
}

.snapshot-card h3 {
  margin: 0 0 6px;
}

.snapshot-meta {
  color: var(--muted);
  font-size: 13px;
}

.snapshot-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.corte-shell {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.35);
}

.corte-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.corte-tab {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.corte-tab.is-active {
  background: rgba(37, 99, 235, 0.18);
  border-color: rgba(37, 99, 235, 0.6);
  color: #dbeafe;
}

.corte-tab:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.corte-meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.corte-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.corte-card {
  background: var(--bg-panel-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.corte-card__title {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.corte-card__value {
  margin: 4px 0 0;
  font-size: clamp(26px, 2.2vw, 30px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.corte-card__value--projection {
  font-size: clamp(23px, 2vw, 27px);
}

.corte-card__panel {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.hourly-chart {
  margin-top: 4px;
  overflow-x: auto;
}

.hourly-chart__grid {
  display: grid;
  grid-template-columns: repeat(24, minmax(26px, 1fr));
  gap: 6px;
  align-items: end;
  min-height: 210px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.hourly-col {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

.hourly-bars {
  width: 16px;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(15, 23, 42, 0.65);
}

.hourly-bar {
  width: 100%;
  display: block;
}

.hourly-bar--directo {
  background: rgba(52, 211, 153, 0.8);
}

.hourly-bar--mkp {
  background: rgba(56, 189, 248, 0.8);
}

.hourly-dot {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #1d4ed8;
  border: 1px solid #bfdbfe;
  left: 50%;
  transform: translateX(-50%);
}

.hourly-label {
  margin-top: 6px;
  font-size: 10px;
  color: var(--muted);
}

.hourly-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.swatch {
  width: 10px;
  height: 10px;
  display: inline-block;
  border-radius: 3px;
  margin-right: 4px;
}

.swatch--directo {
  background: rgba(52, 211, 153, 0.9);
}

.swatch--mkp {
  background: rgba(56, 189, 248, 0.9);
}

.swatch--util {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #1d4ed8;
}

.hourly-summary {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  font-size: 12px;
  color: var(--muted);
}

.cidr-chart {
  margin-top: 6px;
}

.cidr-progress-track {
  height: 12px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  overflow: hidden;
}

.cidr-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #2563eb);
}

.cidr-kpis {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.cidr-kpi {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: var(--bg-panel-alt);
}

.cidr-kpi span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.cidr-kpi strong {
  display: block;
  margin-top: 2px;
  font-size: 22px;
}

.cidr-summary {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.cidr-scenarios {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.cidr-scenario {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  background: rgba(15, 23, 42, 0.45);
}

.cidr-scenario span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.cidr-scenario strong {
  display: block;
  margin-top: 2px;
  font-size: 15px;
}

.cidr-scenario--base {
  border-color: rgba(37, 99, 235, 0.7);
  background: rgba(37, 99, 235, 0.12);
}

.snapshot-metric span {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.snapshot-metric strong {
  font-size: 20px;
}

.paridad-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: stretch;
}

.paridad-block {
  background: linear-gradient(180deg, rgba(24, 35, 65, 0.95), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  height: 100%;
}

.paridad-shell {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.paridad-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.paridad-block header {
  display: flex;
  align-items: center;
  min-width: 0;
  margin: 0;
}

.paridad-block h3 {
  margin: 4px 0 0;
}

.paridad-side {
  min-width: 0;
  width: 100%;
  max-width: none;
  border-radius: 12px;
  border: 1px dashed rgba(148, 163, 184, 0.26);
  background: rgba(15, 23, 42, 0.55);
  padding: 10px 12px;
  align-self: start;
}

.paridad-main .metrics--2 {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.paridad-side__panels {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.paridad-block__label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

.paridad-block__hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.bi-notice {
  margin: 0 0 12px;
}

.paridad-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.paridad-metric {
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(15, 23, 42, 0.75);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 82px;
}

.paridad-metric__label {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.paridad-metric__value {
  font-size: 24px;
  line-height: 1.1;
}

.paridad-metric__panel {
  font-size: 11px;
  color: var(--muted);
}

.paridad-strip__meta {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}

.termometro-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.termometro-item {
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--bg-panel-alt);
  border: 1px solid var(--border);
}

.termometro-item header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.pill {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}

.pill--ok {
  background: rgba(52, 211, 153, 0.2);
  color: var(--success);
}

.pill--alert {
  background: rgba(251, 113, 133, 0.2);
  color: var(--danger);
}

.pill--watch {
  background: rgba(251, 191, 36, 0.2);
  color: var(--warning);
}

.termometro-item p {
  margin: 0;
  color: var(--muted);
}

.pendientes-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pendiente-item {
  border-radius: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  background: var(--bg-panel-alt);
}

.pendiente-item header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-weight: 600;
}

.pendiente-item .muted {
  font-size: 13px;
}

@media (max-width: 768px) {
  .dashboard-shell {
    grid-template-columns: 1fr;
  }

  .dashboard-sidebar {
    position: static;
  }

  .sidebar-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .filter-form {
    width: 100%;
    gap: 14px;
  }

  .filter-form label,
  .filter-form input,
  .filter-form button {
    width: 100%;
    min-width: 0;
  }

  .panel--wide {
    grid-column: span 1;
  }

  .panel--triple {
    grid-column: span 1;
  }

  .bridge-row {
    grid-template-columns: 1fr;
  }

  .mix-layout {
    width: 100%;
  }

  .cidr-scenarios {
    grid-template-columns: 1fr;
  }

  .snapshot-layout {
    grid-template-columns: 1fr;
  }

  .bridge-card {
    min-height: 320px;
  }
}

@media (max-width: 540px) {
  .sidebar-nav {
    grid-template-columns: 1fr;
  }
}

.chart-plot {
  position: relative;
  min-height: 260px;
}

.chart-plot svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-overlay {
  position: absolute;
  inset: 0;
  cursor: crosshair;
}

.chart-tooltip {
  position: absolute;
  min-width: 180px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 12px 28px rgba(2, 6, 23, 0.65);
  pointer-events: none;
  font-size: 13px;
  color: var(--text);
  transform: translate(-50%, -110%);
}

.chart-tooltip strong {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
}

.chart-tooltip__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.chart-summary {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.chart-summary__card {
  background: var(--bg-panel-alt);
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 14px;
}

.chart-summary__label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.chart-summary__value {
  font-size: 22px;
  font-weight: 600;
  margin: 6px 0;
}

.chart-summary__delta {
  font-size: 13px;
  font-weight: 600;
}

.alert-detail {
  margin-top: 18px;
}

.alert-detail__title {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}

.table--compact table {
  font-size: 13px;
}

.table--compact th,
.table--compact td {
  padding: 10px;
}

.alert-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.alert-tag__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--danger);
  display: inline-block;
}

.table-primary {
  font-weight: 600;
}

.table-secondary {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}



.panel--editorial .editorial-stack {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.editorial-belt {
  width: 100%;
  display: flex;
  justify-content: center;
}

.kpi-belt {
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.kpi-belt__card {
  background: var(--bg-panel-alt);
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.kpi-belt__label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.kpi-belt__value {
  font-size: 24px;
  font-weight: 600;
}

.kpi-belt__meta {
  font-size: 12px;
  color: var(--muted);
}

.lede-block {
  background: var(--bg-panel-alt);
  border-radius: 22px;
  border: 1px solid var(--border);
  padding: clamp(18px, 3vw, 28px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.lede-block__header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.lede-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
  color: var(--muted);
  margin: 0;
}

.lede-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.lede-meta {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}

.lede-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.lede-metric {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 16px;
  border: 1px dashed var(--border);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lede-metric span {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.lede-metric strong {
  font-size: 20px;
}

.corte-directo__deck {
  border-radius: 22px;
  border: 1px solid var(--border);
  padding: clamp(18px, 3vw, 28px);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.7), rgba(11, 17, 32, 0.9));
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.insight-card {
  border-radius: 18px;
  border: 1px solid var(--border);
  padding: 18px;
  background: rgba(19, 28, 52, 0.9);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.insight-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.insight-card__meta {
  font-size: 12px;
  color: var(--muted);
}

.insight-card p {
  margin: 0;
}

.insight-card__value {
  font-size: 26px;
  font-weight: 600;
}

.panel--portafolio .editorial-stack {
  gap: 20px;
}

.portafolio__lede {
  position: relative;
}

@media (max-width: 768px) {
  .lede-block__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .kpi-belt {
    width: 100%;
  }
}

/* === Estilos mejorados de tablas - Tema Oscuro (2026-05-18) === */
/* Estilos mejorados para tablas - Tema Oscuro (matching dashboard) */

.enhanced-table-wrapper {
  background: #1a202c;
  border-radius: 8px;
  border: 1px solid #2d3748;
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 600px;
}

.enhanced-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.enhanced-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #1a202c;
}

.enhanced-table .header-row th {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-weight: 600;
  padding: 12px 8px;
  text-align: left;
  border-bottom: 2px solid #5a67d8;
  white-space: nowrap;
  user-select: none;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.enhanced-table .header-row th.sortable {
  cursor: pointer;
  transition: background 0.2s;
}

.enhanced-table .header-row th.sortable:hover {
  background: linear-gradient(135deg, #5a67d8 0%, #6b3fa0 100%);
}

.enhanced-table .header-row .sort-indicator {
  font-size: 0.8em;
  opacity: 0.9;
  margin-left: 4px;
}

.enhanced-table .filter-row th {
  background: #2d3748;
  padding: 8px;
  border-bottom: 1px solid #4a5568;
}

.enhanced-table .column-filter {
  width: 100%;
  padding: 6px 8px;
  background: #1a202c;
  border: 1px solid #4a5568;
  border-radius: 4px;
  font-size: 0.85rem;
  color: #e2e8f0;
  transition: all 0.2s;
}

.enhanced-table .column-filter:focus {
  outline: none;
  border-color: #667eea;
  background: #2d3748;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.enhanced-table .column-filter::placeholder {
  color: #718096;
  font-style: italic;
}

.enhanced-table tbody tr {
  border-bottom: 1px solid #2d3748;
  transition: background 0.15s;
}

.enhanced-table tbody tr:hover {
  background: #2d3748;
}

.enhanced-table tbody td {
  padding: 10px 8px;
  color: #cbd5e0;
  font-size: 0.875rem;
}

.enhanced-table tbody td:first-child {
  font-weight: 500;
  color: #e2e8f0;
}

.table-info {
  padding: 12px 16px;
  background: #2d3748;
  border-top: 1px solid #4a5568;
  font-size: 0.85rem;
  color: #a0aec0;
  text-align: right;
}

/* Zebra striping para tema oscuro */
.enhanced-table tbody tr:nth-child(even) {
  background: rgba(45, 55, 72, 0.3);
}

.enhanced-table tbody tr:nth-child(even):hover {
  background: #2d3748;
}

/* Responsive */
@media (max-width: 1024px) {
  .enhanced-table {
    font-size: 0.85rem;
  }
  
  .enhanced-table .header-row th,
  .enhanced-table tbody td {
    padding: 8px 6px;
  }
  
  .table-scroll {
    max-height: 400px;
  }
}

/* Loading state */
.enhanced-table-wrapper.loading {
  opacity: 0.6;
  pointer-events: none;
}

.enhanced-table-wrapper.loading::after {
  content: 'Cargando datos completos...';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #667eea;
  color: white;
  padding: 12px 24px;
  border-radius: 6px;
  font-weight: 500;
  z-index: 100;
}


/* Termómetro sparkline */
.termometro-sparkline {
  width: 100%;
  height: 30px;
  margin-top: 0.5rem;
  color: #667eea;
}
