/* ============================================================
   Shell del tablero: utilbar, masthead, pestanas y avisos
   ============================================================ */

.dash-view {
  max-width: 1240px; margin: 0 auto; padding: 0.4rem clamp(0.8rem, 2.5vw, 1.6rem) 0.55rem;
  height: 100dvh; display: flex; flex-direction: column; gap: 0.35rem; overflow: hidden;
}

/* ---------------- Franja utilitaria ---------------- */
.utilbar {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  flex-wrap: wrap; flex: none;
  padding-bottom: 0.35rem; border-bottom: 1px solid var(--border-strong);
}
.pill-alert { color: var(--fault) !important; border-color: color-mix(in srgb, var(--fault) 45%, var(--border)) !important; background: color-mix(in srgb, var(--fault) 8%, var(--surface)); }
.pill-alert .dot { background: var(--fault); opacity: 1; box-shadow: 0 0 7px color-mix(in srgb, var(--fault) 60%, transparent); }
.status-pills { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.utilbar-actions { display: flex; align-items: center; gap: 0.3rem; }
.last-update { font-family: var(--font-mono); font-size: 0.76rem; color: var(--muted); }

.pill {
  display: inline-flex; align-items: center; gap: 0.42rem;
  padding: 0.3rem 0.62rem; border-radius: 999px; font-size: 0.74rem; font-weight: 600;
  letter-spacing: 0.02em; border: 1px solid var(--border); background: var(--surface);
  text-transform: uppercase;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: 0.6; }
.pill-on { color: var(--run); border-color: color-mix(in srgb, var(--run) 45%, var(--border)); background: color-mix(in srgb, var(--run) 8%, var(--surface)); }
.pill-on .dot { background: var(--run); opacity: 1; box-shadow: 0 0 7px var(--run-glow); }
.pill-off { color: var(--muted); }

/* ---------------- Masthead institucional ---------------- */
.masthead {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center;
  gap: clamp(0.9rem, 3vw, 2.4rem); flex: none; padding: 0;
}
.inst-logo {
  height: clamp(80px, 13vh, 170px); width: clamp(80px, 13vh, 170px); flex: none; object-fit: contain;
  background: #fff; border-radius: 20px; padding: 8px;
  box-shadow: 0 4px 16px rgba(16, 32, 52, 0.2); border: 1px solid rgba(0, 0, 0, 0.06);
}
.masthead-title { text-align: center; min-width: 0; }
.uni-name, .masthead-sub, .scada-tag { overflow-wrap: anywhere; }
.uni-name {
  margin: 0; font-family: var(--font-cond); font-weight: 700; text-transform: uppercase;
  font-size: clamp(1.4rem, 3.6vw, 2.55rem); letter-spacing: 0.015em; line-height: 1.04; color: var(--text);
}
.masthead-sub { margin: 0.1rem 0 0; font-size: clamp(0.86rem, 2vw, 1.1rem); color: var(--muted); line-height: 1.2; }
.scada-tag {
  margin: 0.08rem 0 0; font-family: var(--font-mono); font-size: clamp(0.7rem, 1.5vw, 0.9rem);
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); font-weight: 500;
}
.course-tag {
  margin: 0.2rem 0 0; font-family: var(--font-mono); font-size: clamp(0.62rem, 1.2vw, 0.78rem);
  letter-spacing: 0.08em; color: var(--muted); font-weight: 500;
}

/* ---------------- Pestañas de vista ---------------- */
.view-tabs {
  display: inline-flex; gap: 0.2rem; padding: 0.22rem; align-self: center;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; flex: none;
}
.view-tab {
  font: inherit; font-weight: 600; font-size: 0.82rem; letter-spacing: 0.02em;
  border: 0; border-radius: 999px; padding: 0.4rem 1.15rem; cursor: pointer;
  background: transparent; color: var(--muted); transition: background 0.15s, color 0.15s;
}
.view-tab:hover { color: var(--text); }
.view-tab.is-active { background: var(--accent); color: var(--accent-ink); box-shadow: 0 2px 8px var(--accent-soft); }
.view-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------- Aviso de desconexión ---------------- */
.banner {
  display: flex; align-items: center; gap: 0.55rem; flex: none;
  background: color-mix(in srgb, var(--stop) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--stop) 40%, var(--border));
  color: var(--text); padding: 0.5rem 0.85rem; border-radius: var(--radius-sm);
  font-size: 0.83rem;
}
.banner-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--stop); flex: none;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--stop) 60%, transparent);
  animation: bpulse 1.6s ease-out infinite;
}
@keyframes bpulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--stop) 55%, transparent); } 100% { box-shadow: 0 0 0 8px transparent; } }

/* ---------------- Responsive del shell ---------------- */
@media (max-width: 820px) {
  .masthead { grid-template-columns: auto 1fr auto; gap: 0.7rem; }
}

@media (max-width: 560px) {
  .masthead { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.4rem 1.2rem; }
  .masthead-title { flex-basis: 100%; order: 2; }
  .uni-name { font-size: 1.35rem; }
  .utilbar { justify-content: center; gap: 0.4rem 0.8rem; }
  .last-update { display: none; }
}

/* Pantallas cortas: scroll natural en vez de recortar */
@media (max-height: 800px), (max-width: 820px) {
  .dash-view { height: auto; min-height: 100dvh; overflow: visible; }
}

@media (prefers-reduced-motion: reduce) {
  .banner-dot { animation: none; }
}
