*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0f172a;
  color: #e5e7eb;
}

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

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: linear-gradient(90deg, #1d4ed8, #0ea5e9);
  color: #f9fafb;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.6);
}

.app-header h1 {
  margin: 0;
  font-size: 1.5rem;
}

.env-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.3);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-btn {
  padding: 0.4rem 0.9rem;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.2);
  color: #f9fafb;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}
.header-btn.secondary {
  background: rgba(15, 23, 42, 0.4);
}
.header-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.month-select {
  width: auto;
  min-width: 160px;
  margin: 0;
  padding: 0.4rem 0.75rem;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #f9fafb;
  border-radius: 0.5rem;
}

.dashboard-header .dashboard-title { margin: 0; }
.dashboard-header .dashboard-title .subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  opacity: 0.9;
}

.config-main {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  padding: 1.5rem;
  flex: 1;
}
.config-content {
  background: rgba(15, 23, 42, 0.9);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.app-main {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  padding: 1.5rem;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card {
  background: rgba(15, 23, 42, 0.85);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.8);
}

.card h2 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
}

select,
input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
}

select:focus,
input:focus {
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4);
}

button {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  font-weight: 500;
  margin-top: 0.25rem;
  background: linear-gradient(135deg, #1d4ed8, #22c55e);
  color: #f9fafb;
  transition: transform 0.06s ease, box-shadow 0.06s ease, filter 0.15s ease;
}

button:hover {
  filter: brightness(1.05);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.6);
}

button:active {
  transform: translateY(1px);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.7);
}

.status-box {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  min-height: 1.2rem;
  color: #9ca3af;
}

.status-ok {
  color: #4ade80;
}

.status-error {
  color: #f97373;
}

.dashboard {
  background: rgba(15, 23, 42, 0.9);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.9);
}

.tabs {
  display: inline-flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  background: rgba(15, 23, 42, 0.9);
  padding: 0.35rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.tab-button {
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  border: none;
  background: transparent;
  color: #9ca3af;
  font-size: 0.85rem;
  cursor: pointer;
  width: auto;
  margin-top: 0;
}

.tab-button.active {
  background: linear-gradient(135deg, #1d4ed8, #22c55e);
  color: #f9fafb;
}

.tab-panel {
  margin-top: 1rem;
}

.depara-section {
  margin-top: 1.5rem;
  padding: 1rem 0;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}
.depara-section h3 { margin-bottom: 0.5rem; }
.depara-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.depara-row span { flex: 1; min-width: 0; }
.depara-row select, .depara-row input[type="text"] {
  min-width: 180px;
  padding: 0.35rem;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #e5e7eb;
  border-radius: 0.375rem;
}

.hidden {
  display: none;
}

.config-gate-msg {
  margin-top: 1rem;
  font-size: 0.875rem;
  color: #94a3b8;
  line-height: 1.5;
}

.charts-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chart-card {
  background: radial-gradient(circle at top left, rgba(56, 189, 248, 0.15), transparent),
    radial-gradient(circle at bottom right, rgba(59, 130, 246, 0.15), transparent);
  border-radius: 0.75rem;
  padding: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.chart-card h3 {
  margin: 0 0 0.5rem;
  font-size: 0.98rem;
  color: #e5e7eb;
}

.admin-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.admin-card .metric-number {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0.25rem 0 0;
}

.quick-links {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.secondary-btn {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.5);
}

.secondary-btn:hover {
  filter: none;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.6);
}

.simple-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.simple-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.simple-table thead {
  background: rgba(15, 23, 42, 0.9);
}

.simple-table th,
.simple-table td {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid rgba(30, 64, 175, 0.4);
}

.simple-table th {
  text-align: left;
  color: #9ca3af;
  font-weight: 500;
}

.simple-table tbody tr:hover {
  background: rgba(15, 23, 42, 0.8);
}

canvas {
  max-height: 260px;
}

/* Dashboard Radar – página única compacta */
.dashboard-page .app-header { padding: 0.75rem 1.5rem; }
.dashboard-radar {
  flex: 1;
  padding: 1rem 1.5rem;
  overflow: auto;
}
.radar-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  max-width: 1400px;
  margin: 0 auto;
}
.radar-card {
  background: rgba(30, 41, 59, 0.9);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
}
.radar-card.span-2 { grid-column: span 2; }
.radar-card h3 {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #e2e8f0;
}
.radar-card .chart-wrap {
  height: 180px;
  position: relative;
  margin: 0.5rem 0;
}
.radar-card .chart-wrap.chart-small { height: 120px; }
.kpi-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}
.kpi-value { font-size: 1.1rem; font-weight: 600; color: #f1f5f9; }
.kpi-badge { font-size: 0.8rem; color: #94a3b8; }
.kpi-badge.positive { color: #4ade80; }
.card-footer-kpi { margin: 0.5rem 0 0; font-size: 0.75rem; color: #94a3b8; }
.bar-list { display: flex; flex-direction: column; gap: 0.35rem; }
.bar-list.compact { gap: 0.2rem; }
.bar-row {
  display: grid;
  grid-template-columns: 1fr auto  minmax(60px, 1fr);
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
}
.bar-label { color: #cbd5e1; }
.bar-value { color: #e2e8f0; font-weight: 500; text-align: right; }
.bar-track {
  height: 6px;
  background: rgba(51, 65, 85, 0.8);
  border-radius: 3px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #0ea5e9, #38bdf8);
  border-radius: 3px;
  transition: width 0.3s ease;
}
.value-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.85rem;
}
.value-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}
.value-list li strong { margin-left: auto; color: #e2e8f0; }
.value-list.with-check li input[type="checkbox"] { margin-right: 0.25rem; }
.kpi-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  color: #94a3b8;
}
.kpi-row strong { color: #e2e8f0; margin-left: 0.25rem; }
.kpi-card .kpi-big { font-size: 1.25rem; font-weight: 700; margin: 0.25rem 0; color: #f1f5f9; }
.kpi-card .kpi-var { font-size: 0.8rem; margin: 0; color: #94a3b8; }
.kpi-card .kpi-var.positive { color: #4ade80; }
.donut-and-list {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 0.75rem;
  align-items: start;
}
.table-scroll { overflow-x: auto; }
.radar-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.radar-table th,
.radar-table td {
  padding: 0.35rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}
.radar-table th { color: #94a3b8; font-weight: 500; }
.radar-table tbody tr:hover { background: rgba(51, 65, 85, 0.4); }
.no-client {
  text-align: center;
  padding: 3rem;
  color: #94a3b8;
}
.no-client a { color: #38bdf8; }

@media (max-width: 900px) {
  .app-main, .config-main {
    grid-template-columns: 1fr;
  }
  .radar-grid { grid-template-columns: 1fr; }
  .radar-card.span-2 { grid-column: span 1; }
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

