/* Shell del dashboard. Los tokens son los mismos que styles.css: el sidebar y el
   contenido tienen que leerse como una sola aplicación, no como dos. */
:root {
  color-scheme: dark;
  --ui: "Inter Tight", Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-family: var(--ui);
  --bg: #07090C;
  --surface: #0E141B;
  --sidebar: #0B1116;
  --sidebar-2: #0E141B;
  --line: rgba(255, 255, 255, .07);
  --text: #E7EDF3;
  --muted: #93A1AF;
  --meta: #6E7D8C;
  --faint: #5E6C7A;
  --accent: #F0B429;
  --accent-ink: #1A1206;
  --positive: #2EA47C;
}

/* Tema Copec en el shell. Mismos tokens que styles.css: el sidebar y el contenido del
   iframe tienen que cambiar juntos o el dashboard se ve partido en dos. */
:root[data-tema="copec"] {
  color-scheme: light;
  --bg: #EEF1F5;
  --surface: #FFFFFF;
  --sidebar: #FFFFFF;
  --sidebar-2: #F5F7FA;
  --line: rgba(16, 24, 40, .11);
  --text: #121821;
  --muted: #4A5563;
  --meta: #6B7684;
  --faint: #838E9C;
  --accent: #D60812;
  --accent-ink: #FFFFFF;
  --positive: #0F7A55;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; }
body { margin: 0; overflow: hidden; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
button { font: inherit; }
.workspace { display: flex; width: 100%; height: 100%; }
.sidebar {
  position: relative;
  z-index: 2;
  display: flex;
  width: 15.5rem;
  flex: 0 0 15.5rem;
  flex-direction: column;
  padding: 1.25rem 1rem;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
}
.brand {
  display: flex;
  align-items: center;
  gap: .7rem;
  min-height: 2.6rem;
  padding: 0 .2rem;
}
.brand-mark {
  display: grid;
  width: 2.125rem;
  height: 2.125rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: .5625rem;
  color: var(--accent-ink);
  background: var(--accent);
  font-size: 1rem;
  font-weight: 700;
}
.brand-copy, .tab-copy { display: flex; min-width: 0; flex-direction: column; }
.brand-copy strong { font-size: .9rem; font-weight: 600; }
.brand-copy small, .tab-copy small { color: var(--meta); font-size: .72rem; }

/* Conmutador de las dos directrices. Es el control de mayor jerarquia del sidebar:
   por eso va pegado a la marca y no se mezcla con la lista de vistas. */
.section-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .2rem;
  margin-top: 0;
  padding: .1875rem;
  border: 1px solid var(--line);
  border-radius: .625rem;
  background: var(--surface);
}
.section-tab {
  padding: .44rem .3rem;
  border: 0;
  border-radius: .4375rem;
  color: var(--muted);
  background: transparent;
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  transition: color .15s ease, background .15s ease;
}
.section-tab:hover { color: var(--text); }
.section-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.section-tab.active {
  color: var(--accent-ink);
  background: var(--accent);
  font-weight: 600;
}

/* Encabezado de grupo: mono, versalita y apagado. Es lo que separa "decidir" de
   "consultar" sin agregar una sola línea de interfaz. */
.group-label {
  margin: .85rem 0 .1rem;
  padding: 0 .5rem;
  color: var(--faint);
  font-family: var(--mono);
  font-size: .66rem;
  font-weight: 400;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.group-label:first-of-type { margin-top: .2rem; }
.view-tabs { display: grid; gap: .125rem; margin-top: .35rem; }
.view-tabs [hidden] { display: none; }
.view-tab {
  display: flex;
  width: 100%;
  align-items: center;
  gap: .55rem;
  padding: .5rem .625rem;
  border: 0;
  border-left: 2px solid transparent;
  border-radius: .5625rem;
  color: var(--muted);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.view-tab:hover { color: var(--text); background: rgba(255, 255, 255, .03); }
.view-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.view-tab.active {
  color: var(--text);
  border-left-color: var(--accent);
  background: rgba(240, 180, 41, .10);
}
.view-tab.active .tab-copy strong { font-weight: 600; }
/* El icono baja a marca discreta: en la lista lo que debe resaltar es el nombre de la
   vista y el filo del ítem activo, no una caja de color por fila. */
.tab-icon {
  display: grid;
  width: 1.15rem;
  flex: 0 0 auto;
  place-items: center;
  color: var(--faint);
  font-size: .85rem;
}
.view-tab.active .tab-icon { color: var(--accent); }
.tab-copy { gap: .12rem; }
.tab-copy strong { font-size: .825rem; font-weight: 500; }
/* Conmutador de tema. Va al pie, junto al estado: es preferencia, no navegación. */
.tema-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  width: 100%;
  margin-top: .6rem;
  padding: .5rem .625rem;
  border: 1px solid var(--line);
  border-radius: .625rem;
  background: transparent;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .12s ease-out, color .12s ease-out;
}
.tema-toggle:hover { border-color: var(--accent); color: var(--text); }
.tema-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tema-punto {
  width: .8rem;
  height: .8rem;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 50%;
  /* Media luna: la mitad del color al que se va a cambiar. */
  background: linear-gradient(90deg, #07090C 50%, #FFFFFF 50%);
}
:root[data-tema="copec"] .tema-punto { background: linear-gradient(90deg, #FFFFFF 50%, #07090C 50%); }

.sidebar-status {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin-top: auto;
  padding: .625rem;
  border: 1px solid rgba(46, 164, 124, .22);
  border-radius: .625rem;
  background: rgba(46, 164, 124, .08);
  color: var(--muted);
  font-size: .74rem;
}
.status-dot {
  width: .4375rem;
  height: .4375rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--positive);
}
.view-container { min-width: 0; flex: 1; height: 100%; background: var(--bg); }
#dashboardFrame { display: block; width: 100%; height: 100%; border: 0; background: var(--bg); }

/* Escritorio: bajo 1230px el sidebar colapsa a iconos. No hay diseño móvil. */
@media (max-width: 1230px) {
  .sidebar { width: 4.25rem; flex-basis: 4.25rem; align-items: center; padding-inline: .5rem; }
  .brand { width: 100%; justify-content: center; padding-inline: 0; }
  .brand-copy, .tab-copy, .sidebar-status span:last-child, .group-label,
  .tema-toggle span { display: none; }
  .section-switch { grid-template-columns: 1fr; gap: .15rem; }
  .section-tab { font-size: .6rem; padding: .4rem .1rem; }
  .view-tabs, .view-tab { width: 100%; }
  .view-tab { justify-content: center; padding: .65rem .25rem; }
  .sidebar-status { justify-content: center; }
}
