* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, "Segoe UI", sans-serif;
  background: #e8ecf4;
  color: #0f172a;
}

.back-portfolio {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  z-index: 9999;
  padding: 0.5rem 1rem;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 700;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.back-portfolio:hover { background: #4f46e5; }

.app {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
  background: #f1f5f9;
}

@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; }
  .nav { display: flex; flex-wrap: wrap; gap: 0.25rem; }
}

.sidebar {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.logo { font-weight: 800; letter-spacing: -0.03em; }

.nav { display: flex; flex-direction: column; gap: 0.25rem; }
.nav a {
  color: #94a3b8;
  text-decoration: none;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  font-size: 0.875rem;
}
.nav a:hover, .nav a.active {
  background: rgba(99, 102, 241, 0.25);
  color: #fff;
}

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.65rem 1rem; }
.live {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #16a34a;
  background: rgba(34, 197, 94, 0.15);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}
.topbar-title h1 { margin: 0; font-size: 1.35rem; }
.updated { font-size: 0.8rem; color: #94a3b8; }

.topbar-actions { display: flex; align-items: center; gap: 0.5rem; }
.btn-ghost, .btn-primary {
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #e2e8f0;
  background: #fff;
}
.btn-primary {
  background: #4f46e5;
  color: #fff;
  border-color: #4f46e5;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: linear-gradient(135deg, #6366f1, #9333ea);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 800;
}

.content { padding: 1.25rem 1.5rem 2rem; }
.row-title {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.row-title h2 { margin: 0; font-size: 1.05rem; color: #475569; }

.range { display: flex; gap: 0.35rem; background: #fff; padding: 0.25rem; border-radius: 999px; border: 1px solid #e2e8f0; }
.range-btn {
  border: none;
  background: transparent;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  cursor: pointer;
  color: #64748b;
}
.range-btn.on { background: #4f46e5; color: #fff; }

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.kpi {
  background: #fff;
  padding: 1rem 1.15rem;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}
.kpi-label { font-size: 0.75rem; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; }
.kpi strong { display: block; font-size: 1.35rem; margin: 0.35rem 0; }
.kpi-up { font-size: 0.75rem; color: #16a34a; }
.kpi-good { font-size: 0.75rem; color: #2563eb; }

.card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 1.15rem;
  margin-bottom: 1rem;
}
.card h3 { margin: 0 0 1rem; font-size: 0.95rem; }

.bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem;
  height: 160px;
}
.bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.65rem;
  color: #64748b;
}
.bar {
  width: 100%;
  max-width: 36px;
  background: linear-gradient(180deg, #6366f1, #8b5cf6);
  border-radius: 6px 6px 2px 2px;
  min-height: 8px;
}

table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th, td { text-align: left; padding: 0.6rem 0.5rem; border-bottom: 1px solid #e2e8f0; }
.trend { color: #16a34a; font-weight: 600; }

.tech-note {
  text-align: center;
  font-size: 0.75rem;
  color: #64748b;
  padding: 0.5rem;
  margin: 0;
}

.demo-toast {
  position: fixed;
  bottom: 5rem;
  left: 50%;
  width: min(280px, calc(100% - 2rem));
  box-sizing: border-box;
  background: #0f172a;
  color: #f8fafc;
  padding: 0.65rem 1rem;
  border-radius: 12px;
  font-size: 0.875rem;
  text-align: center;
  z-index: 100000;
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.demo-toast--visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
