
:root {
  --bg-primary: #0b0f14;
  --bg-secondary: #121a22;
  --border-color: #1e2a36;
  --text-primary: #e8eef6;
  --text-secondary: #9ab;
  --accent-color: #00ff88;
  --danger-color: #ff5555;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
}

header {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.banner {
  height: 48px;
  border-radius: 8px;
  object-fit: contain;
}

h1 {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0;
}

nav {
  margin-left: auto;
  display: flex;
  gap: 1rem;
}

nav a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: all 0.2s;
}

nav a:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.05);
}

nav a.active {
  color: var(--accent-color);
  background: rgba(0,255,136,0.1);
  font-weight: 500;
}

main {
  padding: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

section {
  margin-bottom: 2rem;
}

h2 {
  font-size: 1.3rem;
  margin-bottom: 1rem;
  color: var(--accent-color);
}

h3 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,255,136,0.1);
}

.grid-kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.grid-charts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .grid-charts {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 767px) {
  .grid-kpi {
    grid-template-columns: 1fr;
  }
}

label {
  display: block;
  margin: 0.75rem 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

input, select, button {
  width: 100%;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 0.95rem;
  margin-top: 0.25rem;
  transition: border-color 0.2s;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(0,255,136,0.1);
}

button {
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--accent-color);
  color: var(--bg-primary);
  border: none;
  font-weight: 600;
}

.btn-primary:hover {
  background: #00dd77;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,255,136,0.3);
}

canvas {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.5rem;
  min-height: 400px !important;
  width: 100% !important;
  display: block !important;
}

details {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.9rem;
  user-select: none;
}

summary:hover {
  color: var(--accent-color);
}

details[open] summary {
  margin-bottom: 0.5rem;
}

footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-color);
  font-size: 0.9rem;
}

footer a {
  color: var(--accent-color);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

.spinner-container {
  text-align: center;
  padding: 2rem;
}

.spinner {
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--accent-color);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.output-box {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  max-height: 500px;
  overflow-y: auto;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
}

.info-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.info-table th,
.info-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.info-table th {
  background: rgba(0,255,136,0.1);
  color: var(--accent-color);
  font-weight: 600;
}

.threshold-group {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.threshold-group h4 {
  color: var(--accent-color);
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.threshold-group p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.threshold-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.threshold-item {
  display: flex;
  flex-direction: column;
}

.threshold-item label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.threshold-item .current-value {
  font-size: 0.75rem;
  color: var(--accent-color);
  margin-bottom: 0.25rem;
}

@media (max-width: 768px) {
  header {
    flex-direction: column;
    align-items: flex-start;
  }
  nav {
    margin-left: 0;
    width: 100%;
  }
  .threshold-grid {
    grid-template-columns: 1fr;
  }
}
