 :root {
  color-scheme: dark;
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
  background-color: #030616;
  color: #f3f5ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at 20% 20%, rgba(7, 39, 75, 0.6), transparent 45%),
    radial-gradient(circle at 80% 0%, rgba(13, 29, 78, 0.4), transparent 35%),
    #030616;
  min-height: 100vh;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

.app-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px;
}

.app-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.app-header h1 {
  font-size: 1.8rem;
}

.subtitle {
  color: #8aa7d8;
}

.controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

 .toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #8aa7d8;
  cursor: pointer;
}

 .toggle input {
  accent-color: #4cb5ff;
}

 .btn {
  background: #0e1b3d;
  color: #f3f5ff;
  border: 1px solid #1d2e5c;
  border-radius: 6px;
  padding: 8px 16px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25);
}

 .btn-live {
  background: linear-gradient(135deg, #4cb5ff, #1e3bb8);
  border: none;
}

 .btn-ghost {
  background: transparent;
  border: 1px solid #28407a;
}

.tag {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.85rem;
}

 .tag.live {
  background: #1e3bb8;
}

 .tag.muted {
  color: #7b92c5;
}

.main {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.three {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.grid.two {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

 .card {
  background: rgba(6, 12, 34, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  padding: 20px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.card h2 {
  font-size: 1.2rem;
}

.value {
  font-size: 2rem;
  font-weight: 700;
}

 .label {
  color: #7b92c5;
}

.kpis .kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.table-card table {
  width: 100%;
  border-collapse: collapse;
}

.table-card th,
.table-card td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

 .table-card thead {
  color: #7b92c5;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

.table-wrap {
  overflow-x: auto;
}

 .error-banner {
  background: rgba(76, 181, 255, 0.18);
  color: #cbecff;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
}

 .error-banner.info {
  background: rgba(30, 59, 184, 0.2);
  color: #dfe6ff;
}

.hidden {
  display: none;
}

 .login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 22, 0.92);
  display: grid;
  place-items: center;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.login-overlay.visible {
  visibility: visible;
  opacity: 1;
}

 .login-modal {
  background: #0b1430;
  padding: 32px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  width: min(90vw, 360px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-modal input {
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  color: #f3f5ff;
}

 .login-modal .btn-primary {
  background: linear-gradient(135deg, #4cb5ff, #1e3bb8);
  border: none;
}

.muted {
  color: #7d88a8;
}

.small {
  font-size: 0.85rem;
}

canvas {
  width: 100%;
  border-radius: 12px;
  background: #050713;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

@media (max-width: 768px) {
  .controls {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .app-shell {
    padding: 20px;
  }
}
