:root {
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --border-subtle: #e2e8f0;
  --border-focus: #3b82f6;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.08);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Modales */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.brand-header {
  text-align: center;
  margin-bottom: 2rem;
}

.brand-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.brand-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

.brand-header p {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Layout */
.app-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top-nav {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-bolt {
  font-size: 2rem;
}

.top-nav h1 {
  font-size: 1.25rem;
  font-weight: 700;
}

.sub-badge {
  font-size: 0.75rem;
  background: #eff6ff;
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 500;
}

.nav-status {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  border-radius: 99px;
  font-size: 0.875rem;
  font-weight: 600;
}

.status-pill.online {
  background: #dcfce7;
  color: #15803d;
}

.status-pill.offline {
  background: #fee2e2;
  color: #b91c1c;
}

.status-pill.charging {
  background: #dbeafe;
  color: #1d4ed8;
}

.status-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.badge-role {
  background: #f1f5f9;
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

/* Tabs */
.tab-bar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  padding: 0 2rem;
  gap: 1.5rem;
  overflow-x: auto;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 1rem 0.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* Contenido */
.content-container {
  flex: 1;
  padding: 2rem;
  max-width: 1300px;
  margin: 0 auto;
  width: 100%;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Overview Banner */
.overview-banner {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: white;
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
}

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

.banner-chips {
  display: flex;
  gap: 1.5rem;
}

.banner-chips .chip {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
}

.banner-chips .chip .k {
  color: #94a3b8;
  margin-right: 0.25rem;
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.metric-icon {
  font-size: 2.25rem;
  background: #f8fafc;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.metric-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 500;
}

.metric-val {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
}

.metric-val small {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Controls Grid */
.control-grid, .split-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.card h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.card-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.control-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

/* Slider */
.slider-container {
  margin: 1.5rem 0;
}

.slider-header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.slider-header strong {
  font-size: 1.25rem;
  color: var(--primary);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
  height: 8px;
  border-radius: 4px;
}

.slider-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Form Styles */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

input[type="text"], input[type="password"], input[type="number"], select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  outline: none;
  transition: border-color 0.15s;
}

input:focus, select:focus {
  border-color: var(--border-focus);
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary { background: #f1f5f9; color: var(--text-main); border-color: var(--border-subtle); }
.btn-secondary:hover { background: #e2e8f0; }

.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text-main); }

.btn-block { width: 100%; }
.btn-lg { padding: 0.85rem 1.5rem; font-size: 1rem; }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.8125rem; }

/* Tablas */
.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th, .data-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 600;
}

.data-table tr:hover {
  background: #f8fafc;
}

/* Terminal Consola */
.terminal-box {
  background: #0f172a;
  color: #38bdf8;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  height: 480px;
  overflow-y: auto;
}

.term-line {
  margin-bottom: 0.4rem;
  word-break: break-all;
}

.term-line.in { color: #4ade80; }
.term-line.out { color: #60a5fa; }
.term-line.info { color: #94a3b8; }
.term-line.error { color: #f87171; }

.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1.5rem; }

/* Responsive Móvil */
@media (max-width: 768px) {
  .top-nav { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .overview-banner { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .banner-chips { flex-direction: column; width: 100%; gap: 0.5rem; }
  .control-actions { flex-direction: column; }
  .content-container { padding: 1rem; }
}
