/* Dashboard — módulo aislado (tokens de app.css + glassmorphism) */
html.dash-html,
html.dash-html body.dash-page {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

.dash-page {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 50% at 8% -8%, rgba(61, 206, 160, 0.14), transparent 55%),
    radial-gradient(ellipse 55% 40% at 92% 5%, rgba(110, 168, 255, 0.12), transparent 50%),
    radial-gradient(ellipse 40% 30% at 50% 100%, rgba(255, 112, 128, 0.05), transparent 55%),
    #07090d;
  color: #e8edf5;
  overflow-x: hidden;
  font-family: Barlow, system-ui, sans-serif;
}

.dash-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.glass {
  background: rgba(16, 22, 34, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.dash-top {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(7, 9, 13, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.dash-top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.dash-main {
  flex: 1 1 auto;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 28px 20px 48px;
}

.dash-hero {
  display: grid;
  gap: 22px;
  margin-bottom: 28px;
  animation: dash-in 0.55s ease both;
}

.dash-kicker {
  margin: 0 0 6px;
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 12px;
  color: #3dcea0;
}

.dash-hero h1 {
  margin: 0;
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 800;
  font-size: clamp(2.1rem, 5vw, 3.2rem);
  letter-spacing: 0.02em;
  line-height: 1.05;
  background: linear-gradient(120deg, #f4f7fb 15%, #7ad9b8 65%, #6ea8ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.dash-lede {
  margin: 10px 0 0;
  max-width: 48ch;
  color: rgba(232, 237, 245, 0.62);
  font-size: 15px;
  line-height: 1.45;
}

.dash-lede code {
  font-size: 0.92em;
  color: #9fd9c4;
}

.dash-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.dash-kpi {
  position: relative;
  padding: 16px 18px;
  border-radius: 16px;
  overflow: hidden;
  animation: dash-rise 0.6s ease both;
}

.dash-kpi:nth-child(2) { animation-delay: 0.06s; }
.dash-kpi:nth-child(3) { animation-delay: 0.12s; }
.dash-kpi:nth-child(4) { animation-delay: 0.18s; }

.dash-kpi-ok { box-shadow: inset 0 0 0 1px rgba(61, 206, 160, 0.22); }
.dash-kpi-bad { box-shadow: inset 0 0 0 1px rgba(255, 96, 112, 0.2); }
.dash-kpi-warn { box-shadow: inset 0 0 0 1px rgba(160, 170, 190, 0.22); }

.dash-kpi-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(232, 237, 245, 0.5);
  margin-bottom: 6px;
}

.dash-kpi strong {
  font-family: "Barlow Condensed", sans-serif;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.dash-kpi-ok strong { color: #3dcea0; }
.dash-kpi-bad strong { color: #ff7080; }
.dash-kpi-warn strong { color: #a8b0c0; }

.dash-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}

.dash-panel {
  grid-column: span 4;
  border-radius: 18px;
  padding: 18px 18px 20px;
  animation: dash-in 0.65s ease both;
  animation-delay: 0.1s;
}

.dash-panel-chart {
  min-height: 320px;
}

.dash-panel-console {
  min-height: 320px;
  animation-delay: 0.16s;
  display: flex;
  flex-direction: column;
}

.dash-panel-lists {
  grid-column: span 6;
  animation-delay: 0.22s;
}

.dash-panel-head {
  margin-bottom: 14px;
}

.dash-panel-head h2 {
  margin: 0;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.dash-panel-head p {
  margin: 4px 0 0;
  font-size: 12px;
  color: rgba(232, 237, 245, 0.45);
}

.dash-chart-wrap {
  position: relative;
  height: 240px;
}

.dash-ops-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1 1 auto;
  min-height: 0;
}

.dash-ops-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.dash-ops-actions .dash-scan-btn {
  flex: 1 1 220px;
}

.dash-scan-timer-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(61, 206, 160, 0.28);
  background: rgba(61, 206, 160, 0.06);
}

.dash-scan-timer-wrap[hidden] {
  display: none !important;
}

.dash-scan-timer-label {
  font-family: var(--cond);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(159, 232, 200, 0.65);
}

.dash-scan-timer {
  font-family: var(--cond);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #9fe8c8;
  font-variant-numeric: tabular-nums;
  min-width: 4ch;
  text-align: right;
}

.dash-repair-btn {
  flex: 0 0 auto;
  min-height: 56px;
  padding: 14px 18px;
  border-radius: 14px;
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.dash-scan-btn {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 14px 20px;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  color: #06110c;
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: linear-gradient(120deg, #3dcea0, #2bb8d9 55%, #6ea8ff);
  background-size: 200% 200%;
  box-shadow:
    0 0 0 1px rgba(61, 206, 160, 0.35),
    0 12px 32px rgba(45, 180, 140, 0.28);
  transition: transform 0.2s ease, filter 0.2s ease;
  animation: dash-glow 4s ease-in-out infinite;
}

.dash-scan-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.06);
}

.dash-scan-btn:disabled {
  cursor: wait;
  filter: saturate(0.75);
}

.dash-scan-btn.is-running .dash-scan-ring {
  opacity: 1;
  animation: dash-spin 1.1s linear infinite;
}

.dash-scan-ring {
  position: absolute;
  inset: -4px;
  border-radius: 16px;
  border: 2px solid transparent;
  border-top-color: rgba(255, 255, 255, 0.85);
  opacity: 0;
  pointer-events: none;
}

.dash-scan-label {
  position: relative;
  z-index: 1;
}

.dash-progress[hidden] {
  display: none !important;
}

.dash-progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.dash-progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #3dcea0, #6ea8ff);
  box-shadow: 0 0 16px rgba(61, 206, 160, 0.45);
  transition: width 0.35s ease;
}

.dash-progress-meta {
  margin: 8px 0 0;
  font-size: 13px;
  color: rgba(232, 237, 245, 0.7);
  font-variant-numeric: tabular-nums;
}

.dash-console {
  flex: 1 1 auto;
  min-height: 140px;
  max-height: 180px;
  overflow: auto;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.45;
  color: #9fd9c4;
  scrollbar-width: thin;
}

.dash-console-line {
  margin: 0 0 6px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.dash-console-line.ok { color: #3dcea0; }
.dash-console-line.bad { color: #ff7080; }
.dash-console-line.dim { color: rgba(159, 217, 196, 0.45); }
.dash-console-line.info { color: #6ea8ff; }

.dash-rank {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dash-rank li {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.dash-rank .rank-n {
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 700;
  color: #3dcea0;
  font-size: 1.05rem;
}

.dash-rank .rank-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.dash-rank .rank-count {
  font-variant-numeric: tabular-nums;
  color: rgba(232, 237, 245, 0.55);
  font-size: 13px;
}

.dash-stamp {
  margin: 22px 0 0;
  font-size: 12px;
  color: rgba(232, 237, 245, 0.35);
  text-align: right;
}

body.auth-locked .dash-main {
  filter: blur(4px);
  opacity: 0.55;
  pointer-events: none;
  user-select: none;
}
body.auth-locked .dash-top-actions {
  pointer-events: none;
  opacity: 0.5;
}

@keyframes dash-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@keyframes dash-rise {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@keyframes dash-glow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes dash-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 980px) {
  .dash-panel,
  .dash-panel-lists {
    grid-column: span 12;
  }
  .dash-kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .dash-top {
    flex-direction: column;
    align-items: stretch;
  }
  .dash-main {
    padding: 20px 14px 36px;
  }
}
