/* Dashboard-specific styles — imports theme.css variables */

/* ─── LAYOUT ─────────────────────────────────────────────────── */
.dashboard-body {
  background: var(--bg);
  min-height: 100vh;
}

.dash-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

/* ─── TOPBAR ─────────────────────────────────────────────────── */
.dash-topbar {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-logo {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: 1px;
}

.topbar-sep {
  margin: 0 8px;
  color: var(--fg-muted);
  opacity: 0.3;
}

.topbar-page {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.topbar-link {
  font-size: 0.8rem;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.topbar-link:hover { color: var(--fg); }

/* Live indicator */
.live-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(0,229,153,0.5);
  animation: live-pulse 2s ease-in-out infinite;
}

.live-dot.ping {
  transform: scale(1.5);
  transition: transform 0.15s ease-out;
}

.live-label {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--accent);
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ─── SECTION LABELS ─────────────────────────────────────────── */
.section-label-dash {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2.5px;
  color: var(--accent);
  margin-bottom: 12px;
}

/* ─── SCORE SECTION ─────────────────────────────────────────── */
.score-section {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
}

.score-section-inner {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.score-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.score-title {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--fg);
  margin-bottom: 8px;
}

.score-subtitle {
  font-size: 0.85rem;
  color: var(--fg-muted);
  line-height: 1.5;
}

.score-updated {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--fg-muted);
  white-space: nowrap;
  padding: 4px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* Panel: ring + sub-scores + stats row */
.score-panel {
  display: grid;
  grid-template-columns: 200px 1fr auto;
  gap: 40px;
  align-items: center;
}

/* Score ring */
.score-ring-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.score-ring-container {
  position: relative;
  width: 160px;
  height: 160px;
}

.score-svg {
  width: 100%;
  height: 100%;
}

.score-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  line-height: 1;
}

.score-big {
  font-family: var(--mono);
  font-size: 2.8rem;
  font-weight: 700;
  display: block;
}

.score-big.score-good { color: var(--accent); }
.score-big.score-warn { color: var(--warning); }
.score-big.score-bad  { color: var(--danger);  }

.score-denom {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.score-label-below {
  font-size: 0.78rem;
  color: var(--fg-muted);
  letter-spacing: 0.5px;
}

/* Sub-scores */
.sub-scores {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sub-score-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sub-bar-wrap {
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
}

.sub-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.sub-score-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
}

.sub-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sub-dot.green  { background: var(--accent); }
.sub-dot.yellow { background: var(--warning); }
.sub-dot.red    { background: var(--danger);  }

.sub-name {
  color: var(--fg-muted);
  flex: 1;
}

.sub-val {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--fg);
  min-width: 28px;
  text-align: right;
}

/* Summary stat boxes */
.summary-stats {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  min-width: 140px;
  text-align: center;
}

.stat-box-danger { border-color: rgba(255,92,92,0.2); }
.stat-box-warn   { border-color: rgba(255,181,71,0.2); }
.stat-box-neutral { border-color: var(--border); }

.stat-box-val {
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--fg);
  line-height: 1.1;
  margin-bottom: 4px;
}

.stat-box-danger .stat-box-val { color: var(--danger); }
.stat-box-warn .stat-box-val   { color: var(--warning); }

.stat-box-label {
  font-size: 0.7rem;
  color: var(--fg-muted);
  letter-spacing: 0.5px;
}

/* ─── TIMELINE SECTION ───────────────────────────────────────── */
.timeline-section {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
}

.timeline-header {
  margin-bottom: 32px;
}

.timeline-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.timeline-subtitle {
  font-size: 0.8rem;
  color: var(--fg-muted);
}

/* Empty state */
.timeline-empty {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.empty-icon {
  font-size: 1.5rem;
  color: var(--accent);
}

.empty-text {
  font-size: 0.875rem;
  color: var(--fg-muted);
}

/* Timeline list */
.timeline-list {
  display: flex;
  flex-direction: column;
}

.timeline-item {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 16px;
  position: relative;
}

.timeline-dot-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 2px;
}

.tl-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  z-index: 1;
}

.tl-dot-fail {
  background: var(--danger);
  box-shadow: 0 0 8px rgba(255,92,92,0.3);
}

.tl-connector {
  flex: 1;
  width: 1px;
  background: var(--border);
  margin-top: 4px;
}

.timeline-item:last-child .tl-connector {
  display: none;
}

.timeline-content {
  padding-bottom: 28px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  margin-bottom: 0;
}

.timeline-item:last-child .timeline-content {
  border-bottom: none;
  padding-bottom: 0;
}

.tl-top-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.tl-event-type {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--fg);
}

.tl-amount {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--danger);
}

.tl-time {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--fg-muted);
  margin-left: auto;
}

.tl-error-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.tl-error-badge {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: var(--danger);
  background: rgba(255,92,92,0.1);
  border: 1px solid rgba(255,92,92,0.2);
  padding: 2px 8px;
  border-radius: 3px;
  text-transform: uppercase;
}

.tl-error-msg {
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.tl-customer {
  font-size: 0.75rem;
  color: var(--fg-muted);
  font-family: var(--mono);
  opacity: 0.6;
}

/* ─── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .score-panel {
    grid-template-columns: 160px 1fr;
    grid-template-rows: auto auto;
  }

  .summary-stats {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: space-between;
  }

  .stat-box {
    flex: 1;
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .dash-main { padding: 24px 16px 60px; }

  .score-section,
  .timeline-section { padding: 24px; }

  .score-panel {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    justify-items: center;
  }

  .score-header {
    flex-direction: column;
  }

  .sub-scores { width: 100%; }

  .summary-stats {
    width: 100%;
    flex-direction: row;
  }

  .tl-time { margin-left: 0; }
}
